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

Last change on this file since 667 was 667, checked in by suehring, 13 years ago

summary:


Gryschka:

  • Coupling with different resolution and different numbers of PEs in ocean and atmosphere is available
  • Exchange of u and v from ocean surface to atmosphere surface
  • Mirror boundary condition for u and v at the bottom are replaced by dirichlet boundary conditions
  • Inflow turbulence is now defined by flucuations around spanwise mean
  • Bugfixes for cyclic_fill and constant_volume_flow

Suehring:

  • New advection added ( Wicker and Skamarock 5th order ), therefore:
    • New module advec_ws.f90
    • Modified exchange of ghost boundaries.
    • Modified evaluation of turbulent fluxes
    • New index bounds nxlg, nxrg, nysg, nyng

advec_ws.f90


Advection scheme for scalars and momentum using the flux formulation of
Wicker and Skamarock 5th order.
Additionally the module contains of a routine using for initialisation and
steering of the statical evaluation. The computation of turbulent fluxes takes
place inside the advection routines.
In case of vector architectures Dirichlet and Radiation boundary conditions are
outstanding and not available. Furthermore simulations within topography are
not possible so far. A further routine local_diss_ij is available and is used
if a control of dissipative fluxes is desired.

check_parameters.f90


Exchange of parameters between ocean and atmosphere via PE0
Check for illegal combination of ws-scheme and timestep scheme.
Check for topography and ws-scheme.
Check for not cyclic boundary conditions in combination with ws-scheme and
loop_optimization = 'vector'.
Check for call_psolver_at_all_substeps and ws-scheme for momentum_advec.

Different processor/grid topology in atmosphere and ocean is now allowed!
Bugfixes in checking for conserve_volume_flow_mode.

exchange_horiz.f90


Dynamic exchange of ghost points with nbgp_local to ensure that no useless
ghost points exchanged in case of multigrid. type_yz(0) and type_xz(0) used for
normal grid, the remaining types used for the several grid levels.
Exchange is done via MPI-Vectors with a dynamic value of ghost points which
depend on the advection scheme. Exchange of left and right PEs is 10% faster
with MPI-Vectors than without.

flow_statistics.f90


When advection is computed with ws-scheme, turbulent fluxes are already
computed in the respective advection routines and buffered in arrays
sums_xxxx_ws_l(). This is due to a consistent treatment of statistics
with the numerics and to avoid unphysical kinks near the surface. So some if-
requests has to be done to dicern between fluxes from ws-scheme other advection
schemes. Furthermore the computation of z_i is only done if the heat flux
exceeds a minimum value. This affects only simulations of a neutral boundary
layer and is due to reasons of computations in the advection scheme.

inflow_turbulence.f90


Using nbgp recycling planes for a better resolution of the turbulent flow near
the inflow.

init_grid.f90


Definition of new array bounds nxlg, nxrg, nysg, nyng on each PE.
Furthermore the allocation of arrays and steering of loops is done with these
parameters. Call of exchange_horiz are modified.
In case of dirichlet bounday condition at the bottom zu(0)=0.0
dzu_mg has to be set explicitly for a equally spaced grid near bottom.
ddzu_pres added to use a equally spaced grid near bottom.

init_pegrid.f90


Moved determination of target_id's from init_coupling
Determination of parameters needed for coupling (coupling_topology, ngp_a, ngp_o)
with different grid/processor-topology in ocean and atmosphere

Adaption of ngp_xy, ngp_y to a dynamic number of ghost points.
The maximum_grid_level changed from 1 to 0. 0 is the normal grid, 1 to
maximum_grid_level the grids for multigrid, in which 0 and 1 are normal grids.
This distinction is due to reasons of data exchange and performance for the
normal grid and grids in poismg.
The definition of MPI-Vectors adapted to a dynamic numer of ghost points.
New MPI-Vectors for data exchange between left and right boundaries added.
This is due to reasons of performance (10% faster).

ATTENTION: nnz_x undefined problem still has to be solved!!!!!!!!
TEST OUTPUT (TO BE REMOVED) logging mpi2 ierr values

parin.f90


Steering parameter dissipation_control added in inipar.

Makefile


Module advec_ws added.

Modules


Removed u_nzb_p1_for_vfc and v_nzb_p1_for_vfc

For coupling with different resolution in ocean and atmophere:
+nx_a, +nx_o, ny_a, +ny_o, ngp_a, ngp_o, +total_2d_o, +total_2d_a,
+coupling_topology

Buffer arrays for the left sided advective fluxes added in arrays_3d.
+flux_s_u, +flux_s_v, +flux_s_w, +diss_s_u, +diss_s_v, +diss_s_w,
+flux_s_pt, +diss_s_pt, +flux_s_e, +diss_s_e, +flux_s_q, +diss_s_q,
+flux_s_sa, +diss_s_sa
3d arrays for dissipation control added. (only necessary for vector arch.)
+var_x, +var_y, +var_z, +gamma_x, +gamma_y, +gamma_z
Default of momentum_advec and scalar_advec changed to 'ws-scheme' .
+exchange_mg added in control_parameters to steer the data exchange.
Parameters +nbgp, +nxlg, +nxrg, +nysg, +nyng added in indices.
flag array +boundary_flags added in indices to steer the degradation of order
of the advective fluxes when non-cyclic boundaries are used.
MPI-datatypes +type_y, +type_y_int and +type_yz for data_exchange added in
pegrid.
+sums_wsus_ws_l, +sums_wsvs_ws_l, +sums_us2_ws_l, +sums_vs2_ws_l,
+sums_ws2_ws_l, +sums_wspts_ws_l, +sums_wssas_ws_l, +sums_wsqs_ws_l
and +weight_substep added in statistics to steer the statistical evaluation
of turbulent fluxes in the advection routines.
LOGICALS +ws_scheme_sca and +ws_scheme_mom added to get a better performance
in prognostic_equations.
LOGICAL +dissipation_control control added to steer numerical dissipation
in ws-scheme.

Changed length of string run_description_header

pres.f90


New allocation of tend when ws-scheme and multigrid is used. This is due to
reasons of perforance of the data_exchange. The same is done with p after
poismg is called.
nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng when no
multigrid is used. Calls of exchange_horiz are modified.

bugfix: After pressure correction no volume flow correction in case of
non-cyclic boundary conditions
(has to be done only before pressure correction)

Call of SOR routine is referenced with ddzu_pres.

prognostic_equations.f90


Calls of the advection routines with WS5 added.
Calls of ws_statistics added to set the statistical arrays to zero after each
time step.

advec_particles.f90


Declaration of de_dx, de_dy, de_dz adapted to additional ghost points.
Furthermore the calls of exchange_horiz were modified.

asselin_filter.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

average_3d_data.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

boundary_conds.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
Removed mirror boundary conditions for u and v at the bottom in case of
ibc_uv_b == 0. Instead, dirichelt boundary conditions (u=v=0) are set
in init_3d_model

calc_liquid_water_content.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

calc_spectra.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng for
allocation of tend.

check_open.f90


Output of total array size was adapted to nbgp.

data_output_2d.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and
allocation of arrays local_2d and total_2d.
Calls of exchange_horiz are modified.

data_output_2d.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and
allocation of arrays. Calls of exchange_horiz are modified.
Skip-value skip_do_avs changed to a dynamic adaption of ghost points.

data_output_mask.f90


Calls of exchange_horiz are modified.

diffusion_e.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

diffusion_s.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

diffusion_u.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

diffusion_v.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

diffusion_w.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

diffusivities.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

diffusivities.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.
Calls of exchange_horiz are modified.

exchange_horiz_2d.f90


Dynamic exchange of ghost points with nbgp, which depends on the advection
scheme. Exchange between left and right PEs is now done with MPI-vectors.

global_min_max.f90


Adapting of the index arrays, because MINLOC assumes lowerbound
at 1 and not at nbgp.

init_3d_model.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and
allocation of arrays. Calls of exchange_horiz are modified.
Call ws_init to initialize arrays needed for statistical evaluation and
optimization when ws-scheme is used.
Initial volume flow is now calculated by using the variable hom_sum.
Therefore the correction of initial volume flow for non-flat topography
removed (removed u_nzb_p1_for_vfc and v_nzb_p1_for_vfc)
Changed surface boundary conditions for u and v in case of ibc_uv_b == 0 from
mirror bc to dirichlet boundary conditions (u=v=0), so that k=nzb is
representative for the height z0

Bugfix: type conversion of '1' to 64bit for the MAX function (ngp_3d_inner)

init_coupling.f90


determination of target_id's moved to init_pegrid

init_pt_anomaly.f90


Call of exchange_horiz are modified.

init_rankine.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.
Calls of exchange_horiz are modified.

init_slope.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.

header.f90


Output of advection scheme.

poismg.f90


Calls of exchange_horiz are modified.

prandtl_fluxes.f90


Changed surface boundary conditions for u and v from mirror bc to dirichelt bc,
therefore u(uzb,:,:) and v(nzb,:,:) is now representative for the height z0
nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

production_e.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng

read_3d_binary.f90


+/- 1 replaced with +/- nbgp when swapping and allocating variables.

sor.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.
Call of exchange_horiz are modified.
bug removed in declaration of ddzw(), nz replaced by nzt+1

subsidence.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.

sum_up_3d_data.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.

surface_coupler.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in
MPI_SEND() and MPI_RECV.
additional case for nonequivalent processor and grid topopolgy in ocean and
atmosphere added (coupling_topology = 1)

Added exchange of u and v from Ocean to Atmosphere

time_integration.f90


Calls of exchange_horiz are modified.
Adaption to slooping surface.

timestep.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.

user_3d_data_averaging.f90, user_data_output_2d.f90, user_data_output_3d.f90,
user_actions.f90, user_init.f90, user_init_plant_canopy.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.

user_read_restart_data.f90


Allocation with nbgp.

wall_fluxes.f90


nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.

write_compressed.f90


Array bounds and nx, ny adapted with nbgp.

sor.f90


bug removed in declaration of ddzw(), nz replaced by nzt+1

  • Property svn:keywords set to Id
File size: 15.3 KB
Line 
1 SUBROUTINE data_output_3d( av )
2
3!------------------------------------------------------------------------------!
4! Current revisions:
5! -----------------
6! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and
7! allocation of arrays.  Calls of exchange_horiz are modified.
8! Skip-value skip_do_avs changed to a dynamic adaption of ghost points.
9!
10! Former revisions:
11! -----------------
12! $Id: data_output_3d.f90 667 2010-12-23 12:06:00Z suehring $
13!
14! 646 2010-12-15 13:03:52Z raasch
15! bugfix: missing define statements for netcdf added
16!
17! 493 2010-03-01 08:30:24Z raasch
18! NetCDF4 support (parallel output)
19!
20! 355 2009-07-17 01:03:01Z letzel
21! simulated_time in NetCDF output replaced by time_since_reference_point.
22! Output of NetCDF messages with aid of message handling routine.
23! Output of messages replaced by message handling routine.
24! Bugfix: to_be_resorted => s_av for time-averaged scalars
25!
26! 96 2007-06-04 08:07:41Z raasch
27! Output of density and salinity
28!
29! 75 2007-03-22 09:54:05Z raasch
30! 2nd+3rd argument removed from exchange horiz
31!
32! RCS Log replace by Id keyword, revision history cleaned up
33!
34! Revision 1.3  2006/06/02 15:18:59  raasch
35! +argument "found", -argument grid in call of routine user_data_output_3d
36!
37! Revision 1.2  2006/02/23 10:23:07  raasch
38! Former subroutine plot_3d renamed data_output_3d, pl.. renamed do..,
39! .._anz renamed .._n,
40! output extended to (almost) all quantities, output of user-defined quantities
41!
42! Revision 1.1  1997/09/03 06:29:36  raasch
43! Initial revision
44!
45!
46! Description:
47! ------------
48! Output of the 3D-arrays in NetCDF and/or AVS format.
49!------------------------------------------------------------------------------!
50
51    USE array_kind
52    USE arrays_3d
53    USE averaging
54    USE cloud_parameters
55    USE control_parameters
56    USE cpulog
57    USE indices
58    USE interfaces
59    USE netcdf_control
60    USE particle_attributes
61    USE pegrid
62
63    IMPLICIT NONE
64
65    CHARACTER (LEN=9) ::  simulated_time_mod
66
67    INTEGER           ::  av, i, if, j, k, n, pos, prec, psi
68
69    LOGICAL           ::  found, resorted
70
71    REAL              ::  mean_r, s_r3, s_r4
72
73    REAL(spk), DIMENSION(:,:,:), ALLOCATABLE  ::  local_pf
74
75    REAL, DIMENSION(:,:,:), POINTER ::  to_be_resorted
76
77!
78!-- Return, if nothing to output
79    IF ( do3d_no(av) == 0 )  RETURN
80
81    CALL cpu_log (log_point(14),'data_output_3d','start')
82
83!
84!-- Open output file.
85!-- Also creates coordinate and fld-file for AVS.
86!-- For classic or 64bit NetCDF output or output of other (old) data formats,
87!-- for a run on more than one PE, each PE opens its own file and
88!-- writes the data of its subdomain in binary format (regardless of the format
89!-- the user has requested). After the run, these files are combined to one
90!-- file by combine_plot_fields in the format requested by the user (netcdf
91!-- and/or avs).
92!-- For NetCDF4/HDF5 output, data is written in parallel into one file.
93    IF ( netcdf_output )  THEN
94       IF ( netcdf_data_format < 3 )  THEN
95          CALL check_open( 30 )
96          IF ( myid == 0 )  CALL check_open( 106+av*10 )
97       ELSE
98          CALL check_open( 106+av*10 )
99       ENDIF
100    ELSE
101       IF ( avs_output  .OR.  ( numprocs > 1 ) )  CALL check_open( 30 )
102    ENDIF
103
104!
105!-- Allocate a temporary array with the desired output dimensions.
106    ALLOCATE( local_pf(nxlg:nxrg,nysg:nyng,nzb:nz_do3d) )
107
108!
109!-- Update the NetCDF time axis
110#if defined( __netcdf )
111    IF ( myid == 0  .OR.  netcdf_data_format > 2 )  THEN
112       do3d_time_count(av) = do3d_time_count(av) + 1
113       IF ( netcdf_output )  THEN
114          nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av), &
115                                  (/ time_since_reference_point /),  &
116                                  start = (/ do3d_time_count(av) /), &
117                                  count = (/ 1 /) )
118          CALL handle_netcdf_error( 'data_output_3d', 376 )
119       ENDIF
120    ENDIF
121#endif
122
123!
124!-- Loop over all variables to be written.
125    if = 1
126
127    DO  WHILE ( do3d(av,if)(1:1) /= ' ' )
128!
129!--    Set the precision for data compression.
130       IF ( do3d_compress )  THEN
131          DO  i = 1, 100
132             IF ( plot_3d_precision(i)%variable == do3d(av,if) )  THEN
133                prec = plot_3d_precision(i)%precision
134                EXIT
135             ENDIF
136          ENDDO
137       ENDIF
138
139!
140!--    Store the array chosen on the temporary array.
141       resorted = .FALSE.
142       SELECT CASE ( TRIM( do3d(av,if) ) )
143
144          CASE ( 'e' )
145             IF ( av == 0 )  THEN
146                to_be_resorted => e
147             ELSE
148                to_be_resorted => e_av
149             ENDIF
150
151          CASE ( 'p' )
152             IF ( av == 0 )  THEN
153                to_be_resorted => p
154             ELSE
155                to_be_resorted => p_av
156             ENDIF
157
158          CASE ( 'pc' )  ! particle concentration (requires ghostpoint exchange)
159             IF ( av == 0 )  THEN
160                tend = prt_count
161                CALL exchange_horiz( tend, nbgp )
162                DO  i = nxlg, nxrg
163                   DO  j = nysg, nyng
164                      DO  k = nzb, nz_do3d
165                         local_pf(i,j,k) = tend(k,j,i)
166                      ENDDO
167                   ENDDO
168                ENDDO
169                resorted = .TRUE.
170             ELSE
171                CALL exchange_horiz( pc_av, nbgp )
172                to_be_resorted => pc_av
173             ENDIF
174
175          CASE ( 'pr' )  ! mean particle radius
176             IF ( av == 0 )  THEN
177                DO  i = nxl, nxr
178                   DO  j = nys, nyn
179                      DO  k = nzb, nzt+1
180                         psi = prt_start_index(k,j,i)
181                         s_r3 = 0.0
182                         s_r4 = 0.0
183                         DO  n = psi, psi+prt_count(k,j,i)-1
184                            s_r3 = s_r3 + particles(n)%radius**3
185                            s_r4 = s_r4 + particles(n)%radius**4
186                         ENDDO
187                         IF ( s_r3 /= 0.0 )  THEN
188                            mean_r = s_r4 / s_r3
189                         ELSE
190                            mean_r = 0.0
191                         ENDIF
192                         tend(k,j,i) = mean_r
193                      ENDDO
194                   ENDDO
195                ENDDO
196                CALL exchange_horiz( tend, nbgp )
197                DO  i = nxlg, nxrg
198                   DO  j = nysg, nyng
199                      DO  k = nzb, nzt+1
200                         local_pf(i,j,k) = tend(k,j,i)
201                      ENDDO
202                   ENDDO
203                ENDDO
204                resorted = .TRUE.
205             ELSE
206                CALL exchange_horiz( pr_av, nbgp )
207                to_be_resorted => pr_av
208             ENDIF
209
210          CASE ( 'pt' )
211             IF ( av == 0 )  THEN
212                IF ( .NOT. cloud_physics ) THEN
213                   to_be_resorted => pt
214                ELSE
215                   DO  i = nxlg, nxrg
216                      DO  j = nysg, nyng
217                         DO  k = nzb, nz_do3d
218                            local_pf(i,j,k) = pt(k,j,i) + l_d_cp *    &
219                                                          pt_d_t(k) * &
220                                                          ql(k,j,i)
221                         ENDDO
222                      ENDDO
223                   ENDDO
224                   resorted = .TRUE.
225                ENDIF
226             ELSE
227                to_be_resorted => pt_av
228             ENDIF
229
230          CASE ( 'q' )
231             IF ( av == 0 )  THEN
232                to_be_resorted => q
233             ELSE
234                to_be_resorted => q_av
235             ENDIF
236             
237          CASE ( 'ql' )
238             IF ( av == 0 )  THEN
239                to_be_resorted => ql
240             ELSE
241                to_be_resorted => ql_av
242             ENDIF
243
244          CASE ( 'ql_c' )
245             IF ( av == 0 )  THEN
246                to_be_resorted => ql_c
247             ELSE
248                to_be_resorted => ql_c_av
249             ENDIF
250
251          CASE ( 'ql_v' )
252             IF ( av == 0 )  THEN
253                to_be_resorted => ql_v
254             ELSE
255                to_be_resorted => ql_v_av
256             ENDIF
257
258          CASE ( 'ql_vp' )
259             IF ( av == 0 )  THEN
260                to_be_resorted => ql_vp
261             ELSE
262                to_be_resorted => ql_vp_av
263             ENDIF
264
265          CASE ( 'qv' )
266             IF ( av == 0 )  THEN
267                DO  i = nxlg, nxrg
268                   DO  j = nysg, nyng
269                      DO  k = nzb, nz_do3d
270                         local_pf(i,j,k) = q(k,j,i) - ql(k,j,i)
271                      ENDDO
272                   ENDDO
273                ENDDO
274                resorted = .TRUE.
275             ELSE
276                to_be_resorted => qv_av
277             ENDIF
278
279          CASE ( 'rho' )
280             IF ( av == 0 )  THEN
281                to_be_resorted => rho
282             ELSE
283                to_be_resorted => rho_av
284             ENDIF
285             
286          CASE ( 's' )
287             IF ( av == 0 )  THEN
288                to_be_resorted => q
289             ELSE
290                to_be_resorted => s_av
291             ENDIF
292             
293          CASE ( 'sa' )
294             IF ( av == 0 )  THEN
295                to_be_resorted => sa
296             ELSE
297                to_be_resorted => sa_av
298             ENDIF
299             
300          CASE ( 'u' )
301             IF ( av == 0 )  THEN
302                to_be_resorted => u
303             ELSE
304                to_be_resorted => u_av
305             ENDIF
306
307          CASE ( 'v' )
308             IF ( av == 0 )  THEN
309                to_be_resorted => v
310             ELSE
311                to_be_resorted => v_av
312             ENDIF
313
314          CASE ( 'vpt' )
315             IF ( av == 0 )  THEN
316                to_be_resorted => vpt
317             ELSE
318                to_be_resorted => vpt_av
319             ENDIF
320
321          CASE ( 'w' )
322             IF ( av == 0 )  THEN
323                to_be_resorted => w
324             ELSE
325                to_be_resorted => w_av
326             ENDIF
327
328          CASE DEFAULT
329!
330!--          User defined quantity
331             CALL user_data_output_3d( av, do3d(av,if), found, local_pf, &
332                                       nz_do3d )
333             resorted = .TRUE.
334
335             IF ( .NOT. found )  THEN
336                message_string =  'no output available for: ' //   &
337                                  TRIM( do3d(av,if) )
338                CALL message( 'data_output_3d', 'PA0182', 0, 0, 0, 6, 0 )
339             ENDIF
340
341       END SELECT
342
343!
344!--    Resort the array to be output, if not done above
345       IF ( .NOT. resorted )  THEN
346          DO  i = nxlg, nxrg
347             DO  j = nysg, nyng
348                DO  k = nzb, nz_do3d
349                   local_pf(i,j,k) = to_be_resorted(k,j,i)
350                ENDDO
351             ENDDO
352          ENDDO
353       ENDIF
354
355!
356!--    Output of the volume data information for the AVS-FLD-file.
357       do3d_avs_n = do3d_avs_n + 1
358       IF ( myid == 0  .AND.  avs_output )  THEN
359!
360!--       AVS-labels must not contain any colons. Hence they must be removed
361!--       from the time character string.
362          simulated_time_mod = simulated_time_chr
363          DO  WHILE ( SCAN( simulated_time_mod, ':' ) /= 0 )
364             pos = SCAN( simulated_time_mod, ':' )
365             simulated_time_mod(pos:pos) = '/'
366          ENDDO
367
368          IF ( av == 0 )  THEN
369             WRITE ( 33, 3300 )  do3d_avs_n, TRIM( avs_data_file ), &
370                                 skip_do_avs, TRIM( do3d(av,if) ), &
371                                 TRIM( simulated_time_mod )
372          ELSE
373             WRITE ( 33, 3300 )  do3d_avs_n, TRIM( avs_data_file ), &
374                                 skip_do_avs, TRIM( do3d(av,if) ) // &
375                                 ' averaged', TRIM( simulated_time_mod )
376          ENDIF
377!
378!--       Determine the Skip-value for the next array. Record end and start
379!--       require 4 byte each.
380          skip_do_avs = skip_do_avs + ( ((nx+2*nbgp)*(ny+2*nbgp)*(nz_do3d+1)) * 4 + 8 )
381       ENDIF
382
383!
384!--    Output of the 3D-array. (compressed/uncompressed)
385       IF ( do3d_compress )  THEN
386!
387!--       Compression, output of compression information on FLD-file and output
388!--       of compressed data.
389          CALL write_compressed( local_pf, 30, 33, myid, nxl, nxr, nyn, nys, &
390                                 nzb, nz_do3d, prec, nbgp )
391       ELSE
392!
393!--       Uncompressed output.
394#if defined( __parallel )
395          IF ( netcdf_output )  THEN
396             IF ( netcdf_data_format < 3 )  THEN
397!
398!--             Classic or 64bit format. Data is output in parallel in FORTRAN
399!--             binary format here, and later collected into one file by
400!--             combine_plot_fields
401                IF ( myid == 0 )  THEN
402                   WRITE ( 30 )  simulated_time, do3d_time_count(av), av
403                ENDIF
404                WRITE ( 30 )  nxlg, nxrg, nysg, nyng, nzb, nz_do3d
405                WRITE ( 30 )  local_pf
406
407             ELSE
408#if defined( __netcdf )
409!
410!--             Output in NetCDF4/HDF5 format.
411!--             Do not output redundant ghost point data except for the
412!--             boundaries of the total domain.
413                IF ( nxr == nx  .AND.  nyn /= ny )  THEN
414                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), &
415                                  local_pf(nxl:nxrg,nys:nyn,nzb:nz_do3d),    &
416                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), &
417                      count = (/ nxr-nxl+1+nbgp, nyn-nys+1, nz_do3d-nzb+1, 1 /) )
418                ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
419                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), &
420                                  local_pf(nxl:nxr,nys:nyng,nzb:nz_do3d),    &
421                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), &
422                      count = (/ nxr-nxl+1, nyn-nys+1+nbgp, nz_do3d-nzb+1, 1 /) )
423                ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
424                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), &
425                                  local_pf(nxl:nxrg,nys:nyng,nzb:nz_do3d),  &
426                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), &
427                      count = (/ nxr-nxl+1+nbgp, nyn-nys+1+nbgp, nz_do3d-nzb+1, 1 /) )
428                ELSE
429                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), &
430                                  local_pf(nxl:nxr,nys:nyn,nzb:nz_do3d),      &
431                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), &
432                      count = (/ nxr-nxl+1, nyn-nys+1, nz_do3d-nzb+1, 1 /) )
433                ENDIF
434                CALL handle_netcdf_error( 'data_output_3d', 386 )
435#endif
436             ENDIF
437          ENDIF
438#else
439          IF ( avs_output )  THEN
440             WRITE ( 30 )  local_pf(nxl:nxr+1,nys:nyn+1,:)
441          ENDIF
442#if defined( __netcdf )
443          IF ( netcdf_output )  THEN
444
445             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),    &
446                               local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d),  &
447                               start = (/ 1, 1, 1, do3d_time_count(av) /), &
448                               count = (/ nx+2, ny+2, nz_do3d-nzb+1, 1 /) )
449             CALL handle_netcdf_error( 'data_output_3d', 446 )
450
451          ENDIF
452#endif
453#endif
454       ENDIF
455
456       if = if + 1
457
458    ENDDO
459
460!
461!-- Deallocate temporary array.
462    DEALLOCATE( local_pf )
463
464
465    CALL cpu_log (log_point(14),'data_output_3d','stop','nobarrier')
466
467!
468!-- Formats.
4693300 FORMAT ('variable ',I4,'  file=',A,'  filetype=unformatted  skip=',I12/ &
470             'label = ',A,A)
471
472 END SUBROUTINE data_output_3d
Note: See TracBrowser for help on using the repository browser.