1 | SUBROUTINE data_output_3d( av ) |
---|
2 | |
---|
3 | !--------------------------------------------------------------------------------! |
---|
4 | ! This file is part of PALM. |
---|
5 | ! |
---|
6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
8 | ! either version 3 of the License, or (at your option) any later version. |
---|
9 | ! |
---|
10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
13 | ! |
---|
14 | ! You should have received a copy of the GNU General Public License along with |
---|
15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | ! |
---|
17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ------------------ |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: data_output_3d.f90 1354 2014-04-08 15:22:57Z heinze $ |
---|
27 | ! |
---|
28 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
29 | ! REAL constants provided with KIND-attribute |
---|
30 | ! |
---|
31 | ! 1327 2014-03-21 11:00:16Z raasch |
---|
32 | ! parts concerning avs output removed, |
---|
33 | ! -netcdf output queries |
---|
34 | ! |
---|
35 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
36 | ! ONLY-attribute added to USE-statements, |
---|
37 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
38 | ! kinds are defined in new module kinds, |
---|
39 | ! old module precision_kind is removed, |
---|
40 | ! revision history before 2012 removed, |
---|
41 | ! comment fields (!:) to be used for variable explanations added to |
---|
42 | ! all variable declaration statements |
---|
43 | ! |
---|
44 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
45 | ! barrier argument removed from cpu_log, |
---|
46 | ! module interfaces removed |
---|
47 | ! |
---|
48 | ! 1308 2014-03-13 14:58:42Z fricke |
---|
49 | ! Check, if the limit of the time dimension is exceeded for parallel output |
---|
50 | ! To increase the performance for parallel output, the following is done: |
---|
51 | ! - Update of time axis is only done by PE0 |
---|
52 | ! |
---|
53 | ! 1244 2013-10-31 08:16:56Z raasch |
---|
54 | ! Bugfix for index bounds in case of 3d-parallel output |
---|
55 | ! |
---|
56 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
57 | ! ql is calculated by calc_liquid_water_content |
---|
58 | ! |
---|
59 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
60 | ! array_kind renamed precision_kind |
---|
61 | ! |
---|
62 | ! 1076 2012-12-05 08:30:18Z hoffmann |
---|
63 | ! Bugfix in output of ql |
---|
64 | ! |
---|
65 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
66 | ! +nr, qr, prr, qc and averaged quantities |
---|
67 | ! |
---|
68 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
69 | ! code put under GPL (PALM 3.9) |
---|
70 | ! |
---|
71 | ! 1031 2012-10-19 14:35:30Z raasch |
---|
72 | ! netCDF4 without parallel file support implemented |
---|
73 | ! |
---|
74 | ! 1007 2012-09-19 14:30:36Z franke |
---|
75 | ! Bugfix: missing calculation of ql_vp added |
---|
76 | ! |
---|
77 | ! Revision 1.1 1997/09/03 06:29:36 raasch |
---|
78 | ! Initial revision |
---|
79 | ! |
---|
80 | ! |
---|
81 | ! Description: |
---|
82 | ! ------------ |
---|
83 | ! Output of the 3D-arrays in netCDF and/or AVS format. |
---|
84 | !------------------------------------------------------------------------------! |
---|
85 | |
---|
86 | USE arrays_3d, & |
---|
87 | ONLY: e, nr, p, pt, q, qc, ql, ql_c, ql_v, qr, rho, sa, tend, u, v, & |
---|
88 | vpt, w |
---|
89 | |
---|
90 | USE averaging |
---|
91 | |
---|
92 | USE cloud_parameters, & |
---|
93 | ONLY: l_d_cp, prr, pt_d_t |
---|
94 | |
---|
95 | USE control_parameters, & |
---|
96 | ONLY: avs_data_file, cloud_physics, do3d, do3d_avs_n, & |
---|
97 | do3d_no, do3d_time_count, io_blocks, io_group, & |
---|
98 | message_string, netcdf_data_format, ntdim_3d, & |
---|
99 | nz_do3d, plot_3d_precision, psolver, simulated_time, & |
---|
100 | simulated_time_chr, skip_do_avs, time_since_reference_point |
---|
101 | |
---|
102 | USE cpulog, & |
---|
103 | ONLY: log_point, cpu_log |
---|
104 | |
---|
105 | USE indices, & |
---|
106 | ONLY: nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzt, & |
---|
107 | nzb |
---|
108 | |
---|
109 | USE kinds |
---|
110 | |
---|
111 | USE netcdf_control |
---|
112 | |
---|
113 | USE particle_attributes, & |
---|
114 | ONLY: particles, prt_count, prt_start_index |
---|
115 | |
---|
116 | USE pegrid |
---|
117 | |
---|
118 | IMPLICIT NONE |
---|
119 | |
---|
120 | CHARACTER (LEN=9) :: simulated_time_mod !: |
---|
121 | |
---|
122 | INTEGER(iwp) :: av !: |
---|
123 | INTEGER(iwp) :: i !: |
---|
124 | INTEGER(iwp) :: if !: |
---|
125 | INTEGER(iwp) :: j !: |
---|
126 | INTEGER(iwp) :: k !: |
---|
127 | INTEGER(iwp) :: n !: |
---|
128 | INTEGER(iwp) :: pos !: |
---|
129 | INTEGER(iwp) :: prec !: |
---|
130 | INTEGER(iwp) :: psi !: |
---|
131 | |
---|
132 | LOGICAL :: found !: |
---|
133 | LOGICAL :: resorted !: |
---|
134 | |
---|
135 | REAL(wp) :: mean_r !: |
---|
136 | REAL(wp) :: s_r3 !: |
---|
137 | REAL(wp) :: s_r4 !: |
---|
138 | |
---|
139 | REAL(sp), DIMENSION(:,:,:), ALLOCATABLE :: local_pf !: |
---|
140 | |
---|
141 | REAL(wp), DIMENSION(:,:,:), POINTER :: to_be_resorted !: |
---|
142 | |
---|
143 | ! |
---|
144 | !-- Return, if nothing to output |
---|
145 | IF ( do3d_no(av) == 0 ) RETURN |
---|
146 | ! |
---|
147 | !-- For parallel netcdf output the time axis must be limited. Return, if this |
---|
148 | !-- limit is exceeded. This could be the case, if the simulated time exceeds |
---|
149 | !-- the given end time by the length of the given output interval. |
---|
150 | IF ( netcdf_data_format > 4 ) THEN |
---|
151 | IF ( do3d_time_count(av) + 1 > ntdim_3d(av) ) THEN |
---|
152 | WRITE ( message_string, * ) 'Output of 3d data is not given at t=', & |
---|
153 | simulated_time, '&because the maximum ', & |
---|
154 | 'number of output time levels is ', & |
---|
155 | 'exceeded.' |
---|
156 | CALL message( 'data_output_3d', 'PA0387', 0, 1, 0, 6, 0 ) |
---|
157 | RETURN |
---|
158 | ENDIF |
---|
159 | ENDIF |
---|
160 | |
---|
161 | CALL cpu_log (log_point(14),'data_output_3d','start') |
---|
162 | |
---|
163 | ! |
---|
164 | !-- Open output file. |
---|
165 | !-- Also creates coordinate and fld-file for AVS. |
---|
166 | !-- For classic or 64bit netCDF output or output of other (old) data formats, |
---|
167 | !-- for a run on more than one PE, each PE opens its own file and |
---|
168 | !-- writes the data of its subdomain in binary format (regardless of the format |
---|
169 | !-- the user has requested). After the run, these files are combined to one |
---|
170 | !-- file by combine_plot_fields in the format requested by the user (netcdf |
---|
171 | !-- and/or avs). |
---|
172 | !-- For netCDF4/HDF5 output, data is written in parallel into one file. |
---|
173 | IF ( netcdf_data_format < 5 ) THEN |
---|
174 | CALL check_open( 30 ) |
---|
175 | IF ( myid == 0 ) CALL check_open( 106+av*10 ) |
---|
176 | ELSE |
---|
177 | CALL check_open( 106+av*10 ) |
---|
178 | ENDIF |
---|
179 | |
---|
180 | ! |
---|
181 | !-- Allocate a temporary array with the desired output dimensions. |
---|
182 | ALLOCATE( local_pf(nxlg:nxrg,nysg:nyng,nzb:nz_do3d) ) |
---|
183 | |
---|
184 | ! |
---|
185 | !-- Update the netCDF time axis |
---|
186 | !-- In case of parallel output, this is only done by PE0 to increase the |
---|
187 | !-- performance. |
---|
188 | #if defined( __netcdf ) |
---|
189 | do3d_time_count(av) = do3d_time_count(av) + 1 |
---|
190 | IF ( myid == 0 ) THEN |
---|
191 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av), & |
---|
192 | (/ time_since_reference_point /), & |
---|
193 | start = (/ do3d_time_count(av) /), & |
---|
194 | count = (/ 1 /) ) |
---|
195 | CALL handle_netcdf_error( 'data_output_3d', 376 ) |
---|
196 | ENDIF |
---|
197 | #endif |
---|
198 | |
---|
199 | ! |
---|
200 | !-- Loop over all variables to be written. |
---|
201 | if = 1 |
---|
202 | |
---|
203 | DO WHILE ( do3d(av,if)(1:1) /= ' ' ) |
---|
204 | ! |
---|
205 | !-- Store the array chosen on the temporary array. |
---|
206 | resorted = .FALSE. |
---|
207 | SELECT CASE ( TRIM( do3d(av,if) ) ) |
---|
208 | |
---|
209 | CASE ( 'e' ) |
---|
210 | IF ( av == 0 ) THEN |
---|
211 | to_be_resorted => e |
---|
212 | ELSE |
---|
213 | to_be_resorted => e_av |
---|
214 | ENDIF |
---|
215 | |
---|
216 | CASE ( 'lpt' ) |
---|
217 | IF ( av == 0 ) THEN |
---|
218 | to_be_resorted => pt |
---|
219 | ELSE |
---|
220 | to_be_resorted => lpt_av |
---|
221 | ENDIF |
---|
222 | |
---|
223 | CASE ( 'nr' ) |
---|
224 | IF ( av == 0 ) THEN |
---|
225 | to_be_resorted => nr |
---|
226 | ELSE |
---|
227 | to_be_resorted => nr_av |
---|
228 | ENDIF |
---|
229 | |
---|
230 | CASE ( 'p' ) |
---|
231 | IF ( av == 0 ) THEN |
---|
232 | IF ( psolver /= 'sor' ) CALL exchange_horiz( p, nbgp ) |
---|
233 | to_be_resorted => p |
---|
234 | ELSE |
---|
235 | IF ( psolver /= 'sor' ) CALL exchange_horiz( p_av, nbgp ) |
---|
236 | to_be_resorted => p_av |
---|
237 | ENDIF |
---|
238 | |
---|
239 | CASE ( 'pc' ) ! particle concentration (requires ghostpoint exchange) |
---|
240 | IF ( av == 0 ) THEN |
---|
241 | tend = prt_count |
---|
242 | CALL exchange_horiz( tend, nbgp ) |
---|
243 | DO i = nxlg, nxrg |
---|
244 | DO j = nysg, nyng |
---|
245 | DO k = nzb, nz_do3d |
---|
246 | local_pf(i,j,k) = tend(k,j,i) |
---|
247 | ENDDO |
---|
248 | ENDDO |
---|
249 | ENDDO |
---|
250 | resorted = .TRUE. |
---|
251 | ELSE |
---|
252 | CALL exchange_horiz( pc_av, nbgp ) |
---|
253 | to_be_resorted => pc_av |
---|
254 | ENDIF |
---|
255 | |
---|
256 | CASE ( 'pr' ) ! mean particle radius |
---|
257 | IF ( av == 0 ) THEN |
---|
258 | DO i = nxl, nxr |
---|
259 | DO j = nys, nyn |
---|
260 | DO k = nzb, nz_do3d |
---|
261 | psi = prt_start_index(k,j,i) |
---|
262 | s_r3 = 0.0_wp |
---|
263 | s_r4 = 0.0_wp |
---|
264 | DO n = psi, psi+prt_count(k,j,i)-1 |
---|
265 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
266 | particles(n)%weight_factor |
---|
267 | s_r4 = s_r4 + particles(n)%radius**4 * & |
---|
268 | particles(n)%weight_factor |
---|
269 | ENDDO |
---|
270 | IF ( s_r3 /= 0.0_wp ) THEN |
---|
271 | mean_r = s_r4 / s_r3 |
---|
272 | ELSE |
---|
273 | mean_r = 0.0_wp |
---|
274 | ENDIF |
---|
275 | tend(k,j,i) = mean_r |
---|
276 | ENDDO |
---|
277 | ENDDO |
---|
278 | ENDDO |
---|
279 | CALL exchange_horiz( tend, nbgp ) |
---|
280 | DO i = nxlg, nxrg |
---|
281 | DO j = nysg, nyng |
---|
282 | DO k = nzb, nz_do3d |
---|
283 | local_pf(i,j,k) = tend(k,j,i) |
---|
284 | ENDDO |
---|
285 | ENDDO |
---|
286 | ENDDO |
---|
287 | resorted = .TRUE. |
---|
288 | ELSE |
---|
289 | CALL exchange_horiz( pr_av, nbgp ) |
---|
290 | to_be_resorted => pr_av |
---|
291 | ENDIF |
---|
292 | |
---|
293 | CASE ( 'prr' ) |
---|
294 | IF ( av == 0 ) THEN |
---|
295 | CALL exchange_horiz( prr, nbgp ) |
---|
296 | DO i = nxlg, nxrg |
---|
297 | DO j = nysg, nyng |
---|
298 | DO k = nzb, nzt+1 |
---|
299 | local_pf(i,j,k) = prr(k,j,i) |
---|
300 | ENDDO |
---|
301 | ENDDO |
---|
302 | ENDDO |
---|
303 | ELSE |
---|
304 | CALL exchange_horiz( prr_av, nbgp ) |
---|
305 | DO i = nxlg, nxrg |
---|
306 | DO j = nysg, nyng |
---|
307 | DO k = nzb, nzt+1 |
---|
308 | local_pf(i,j,k) = prr_av(k,j,i) |
---|
309 | ENDDO |
---|
310 | ENDDO |
---|
311 | ENDDO |
---|
312 | ENDIF |
---|
313 | resorted = .TRUE. |
---|
314 | |
---|
315 | CASE ( 'pt' ) |
---|
316 | IF ( av == 0 ) THEN |
---|
317 | IF ( .NOT. cloud_physics ) THEN |
---|
318 | to_be_resorted => pt |
---|
319 | ELSE |
---|
320 | DO i = nxlg, nxrg |
---|
321 | DO j = nysg, nyng |
---|
322 | DO k = nzb, nz_do3d |
---|
323 | local_pf(i,j,k) = pt(k,j,i) + l_d_cp * & |
---|
324 | pt_d_t(k) * & |
---|
325 | ql(k,j,i) |
---|
326 | ENDDO |
---|
327 | ENDDO |
---|
328 | ENDDO |
---|
329 | resorted = .TRUE. |
---|
330 | ENDIF |
---|
331 | ELSE |
---|
332 | to_be_resorted => pt_av |
---|
333 | ENDIF |
---|
334 | |
---|
335 | CASE ( 'q' ) |
---|
336 | IF ( av == 0 ) THEN |
---|
337 | to_be_resorted => q |
---|
338 | ELSE |
---|
339 | to_be_resorted => q_av |
---|
340 | ENDIF |
---|
341 | |
---|
342 | CASE ( 'qc' ) |
---|
343 | IF ( av == 0 ) THEN |
---|
344 | to_be_resorted => qc |
---|
345 | ELSE |
---|
346 | to_be_resorted => qc_av |
---|
347 | ENDIF |
---|
348 | |
---|
349 | CASE ( 'ql' ) |
---|
350 | IF ( av == 0 ) THEN |
---|
351 | to_be_resorted => ql |
---|
352 | ELSE |
---|
353 | to_be_resorted => ql_av |
---|
354 | ENDIF |
---|
355 | |
---|
356 | CASE ( 'ql_c' ) |
---|
357 | IF ( av == 0 ) THEN |
---|
358 | to_be_resorted => ql_c |
---|
359 | ELSE |
---|
360 | to_be_resorted => ql_c_av |
---|
361 | ENDIF |
---|
362 | |
---|
363 | CASE ( 'ql_v' ) |
---|
364 | IF ( av == 0 ) THEN |
---|
365 | to_be_resorted => ql_v |
---|
366 | ELSE |
---|
367 | to_be_resorted => ql_v_av |
---|
368 | ENDIF |
---|
369 | |
---|
370 | CASE ( 'ql_vp' ) |
---|
371 | IF ( av == 0 ) THEN |
---|
372 | DO i = nxl, nxr |
---|
373 | DO j = nys, nyn |
---|
374 | DO k = nzb, nz_do3d |
---|
375 | psi = prt_start_index(k,j,i) |
---|
376 | DO n = psi, psi+prt_count(k,j,i)-1 |
---|
377 | tend(k,j,i) = tend(k,j,i) + & |
---|
378 | particles(n)%weight_factor / & |
---|
379 | prt_count(k,j,i) |
---|
380 | ENDDO |
---|
381 | ENDDO |
---|
382 | ENDDO |
---|
383 | ENDDO |
---|
384 | CALL exchange_horiz( tend, nbgp ) |
---|
385 | DO i = nxlg, nxrg |
---|
386 | DO j = nysg, nyng |
---|
387 | DO k = nzb, nz_do3d |
---|
388 | local_pf(i,j,k) = tend(k,j,i) |
---|
389 | ENDDO |
---|
390 | ENDDO |
---|
391 | ENDDO |
---|
392 | resorted = .TRUE. |
---|
393 | ELSE |
---|
394 | CALL exchange_horiz( ql_vp_av, nbgp ) |
---|
395 | to_be_resorted => ql_vp_av |
---|
396 | ENDIF |
---|
397 | |
---|
398 | CASE ( 'qr' ) |
---|
399 | IF ( av == 0 ) THEN |
---|
400 | to_be_resorted => qr |
---|
401 | ELSE |
---|
402 | to_be_resorted => qr_av |
---|
403 | ENDIF |
---|
404 | |
---|
405 | CASE ( 'qv' ) |
---|
406 | IF ( av == 0 ) THEN |
---|
407 | DO i = nxlg, nxrg |
---|
408 | DO j = nysg, nyng |
---|
409 | DO k = nzb, nz_do3d |
---|
410 | local_pf(i,j,k) = q(k,j,i) - ql(k,j,i) |
---|
411 | ENDDO |
---|
412 | ENDDO |
---|
413 | ENDDO |
---|
414 | resorted = .TRUE. |
---|
415 | ELSE |
---|
416 | to_be_resorted => qv_av |
---|
417 | ENDIF |
---|
418 | |
---|
419 | CASE ( 'rho' ) |
---|
420 | IF ( av == 0 ) THEN |
---|
421 | to_be_resorted => rho |
---|
422 | ELSE |
---|
423 | to_be_resorted => rho_av |
---|
424 | ENDIF |
---|
425 | |
---|
426 | CASE ( 's' ) |
---|
427 | IF ( av == 0 ) THEN |
---|
428 | to_be_resorted => q |
---|
429 | ELSE |
---|
430 | to_be_resorted => s_av |
---|
431 | ENDIF |
---|
432 | |
---|
433 | CASE ( 'sa' ) |
---|
434 | IF ( av == 0 ) THEN |
---|
435 | to_be_resorted => sa |
---|
436 | ELSE |
---|
437 | to_be_resorted => sa_av |
---|
438 | ENDIF |
---|
439 | |
---|
440 | CASE ( 'u' ) |
---|
441 | IF ( av == 0 ) THEN |
---|
442 | to_be_resorted => u |
---|
443 | ELSE |
---|
444 | to_be_resorted => u_av |
---|
445 | ENDIF |
---|
446 | |
---|
447 | CASE ( 'v' ) |
---|
448 | IF ( av == 0 ) THEN |
---|
449 | to_be_resorted => v |
---|
450 | ELSE |
---|
451 | to_be_resorted => v_av |
---|
452 | ENDIF |
---|
453 | |
---|
454 | CASE ( 'vpt' ) |
---|
455 | IF ( av == 0 ) THEN |
---|
456 | to_be_resorted => vpt |
---|
457 | ELSE |
---|
458 | to_be_resorted => vpt_av |
---|
459 | ENDIF |
---|
460 | |
---|
461 | CASE ( 'w' ) |
---|
462 | IF ( av == 0 ) THEN |
---|
463 | to_be_resorted => w |
---|
464 | ELSE |
---|
465 | to_be_resorted => w_av |
---|
466 | ENDIF |
---|
467 | |
---|
468 | CASE DEFAULT |
---|
469 | ! |
---|
470 | !-- User defined quantity |
---|
471 | CALL user_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
472 | nz_do3d ) |
---|
473 | resorted = .TRUE. |
---|
474 | |
---|
475 | IF ( .NOT. found ) THEN |
---|
476 | message_string = 'no output available for: ' // & |
---|
477 | TRIM( do3d(av,if) ) |
---|
478 | CALL message( 'data_output_3d', 'PA0182', 0, 0, 0, 6, 0 ) |
---|
479 | ENDIF |
---|
480 | |
---|
481 | END SELECT |
---|
482 | |
---|
483 | ! |
---|
484 | !-- Resort the array to be output, if not done above |
---|
485 | IF ( .NOT. resorted ) THEN |
---|
486 | DO i = nxlg, nxrg |
---|
487 | DO j = nysg, nyng |
---|
488 | DO k = nzb, nz_do3d |
---|
489 | local_pf(i,j,k) = to_be_resorted(k,j,i) |
---|
490 | ENDDO |
---|
491 | ENDDO |
---|
492 | ENDDO |
---|
493 | ENDIF |
---|
494 | |
---|
495 | ! |
---|
496 | !-- Output of the 3D-array |
---|
497 | #if defined( __parallel ) |
---|
498 | IF ( netcdf_data_format < 5 ) THEN |
---|
499 | ! |
---|
500 | !-- Non-parallel netCDF output. Data is output in parallel in |
---|
501 | !-- FORTRAN binary format here, and later collected into one file by |
---|
502 | !-- combine_plot_fields |
---|
503 | IF ( myid == 0 ) THEN |
---|
504 | WRITE ( 30 ) time_since_reference_point, & |
---|
505 | do3d_time_count(av), av |
---|
506 | ENDIF |
---|
507 | DO i = 0, io_blocks-1 |
---|
508 | IF ( i == io_group ) THEN |
---|
509 | WRITE ( 30 ) nxlg, nxrg, nysg, nyng, nzb, nz_do3d |
---|
510 | WRITE ( 30 ) local_pf |
---|
511 | ENDIF |
---|
512 | #if defined( __parallel ) |
---|
513 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
514 | #endif |
---|
515 | ENDDO |
---|
516 | |
---|
517 | ELSE |
---|
518 | #if defined( __netcdf ) |
---|
519 | ! |
---|
520 | !-- Parallel output in netCDF4/HDF5 format. |
---|
521 | !-- Do not output redundant ghost point data except for the |
---|
522 | !-- boundaries of the total domain. |
---|
523 | IF ( nxr == nx .AND. nyn /= ny ) THEN |
---|
524 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
525 | local_pf(nxl:nxr+1,nys:nyn,nzb:nz_do3d), & |
---|
526 | start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & |
---|
527 | count = (/ nxr-nxl+2, nyn-nys+1, nz_do3d-nzb+1, 1 /) ) |
---|
528 | ELSEIF ( nxr /= nx .AND. nyn == ny ) THEN |
---|
529 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
530 | local_pf(nxl:nxr,nys:nyn+1,nzb:nz_do3d), & |
---|
531 | start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & |
---|
532 | count = (/ nxr-nxl+1, nyn-nys+2, nz_do3d-nzb+1, 1 /) ) |
---|
533 | ELSEIF ( nxr == nx .AND. nyn == ny ) THEN |
---|
534 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
535 | local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d), & |
---|
536 | start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & |
---|
537 | count = (/ nxr-nxl+2, nyn-nys+2, nz_do3d-nzb+1, 1 /) ) |
---|
538 | ELSE |
---|
539 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
540 | local_pf(nxl:nxr,nys:nyn,nzb:nz_do3d), & |
---|
541 | start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & |
---|
542 | count = (/ nxr-nxl+1, nyn-nys+1, nz_do3d-nzb+1, 1 /) ) |
---|
543 | ENDIF |
---|
544 | CALL handle_netcdf_error( 'data_output_3d', 386 ) |
---|
545 | #endif |
---|
546 | ENDIF |
---|
547 | #else |
---|
548 | #if defined( __netcdf ) |
---|
549 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
550 | local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d), & |
---|
551 | start = (/ 1, 1, 1, do3d_time_count(av) /), & |
---|
552 | count = (/ nx+2, ny+2, nz_do3d-nzb+1, 1 /) ) |
---|
553 | CALL handle_netcdf_error( 'data_output_3d', 446 ) |
---|
554 | #endif |
---|
555 | #endif |
---|
556 | |
---|
557 | if = if + 1 |
---|
558 | |
---|
559 | ENDDO |
---|
560 | |
---|
561 | ! |
---|
562 | !-- Deallocate temporary array. |
---|
563 | DEALLOCATE( local_pf ) |
---|
564 | |
---|
565 | |
---|
566 | CALL cpu_log( log_point(14), 'data_output_3d', 'stop' ) |
---|
567 | |
---|
568 | ! |
---|
569 | !-- Formats. |
---|
570 | 3300 FORMAT ('variable ',I4,' file=',A,' filetype=unformatted skip=',I12/ & |
---|
571 | 'label = ',A,A) |
---|
572 | |
---|
573 | END SUBROUTINE data_output_3d |
---|