source: palm/trunk/SOURCE/data_output_3d.f90 @ 1682

Last change on this file since 1682 was 1682, checked in by knoop, 9 years ago

Code annotations made doxygen readable

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