source: palm/trunk/SOURCE/time_integration.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: 20.1 KB
Line 
1 SUBROUTINE time_integration
2
3!------------------------------------------------------------------------------!
4! Current revisions:
5! -----------------
6! Calls of exchange_horiz are modified.
7! Adaption to slooping surface.
8!
9! Former revisions:
10! -----------------
11! $Id: time_integration.f90 667 2010-12-23 12:06:00Z suehring $
12!
13! 449 2010-02-02 11:23:59Z raasch
14! Bugfix: exchange of ghost points for prho included
15!
16! 410 2009-12-04 17:05:40Z letzel
17! masked data output
18!
19! 388 2009-09-23 09:40:33Z raasch
20! Using prho instead of rho in diffusvities.
21! Coupling with independent precursor runs.
22! Bugfix: output of particle time series only if particle advection is switched
23!         on
24!
25! 151 2008-03-07 13:42:18Z raasch
26! inflow turbulence is imposed by calling new routine inflow_turbulence
27!
28! 108 2007-08-24 15:10:38Z letzel
29! Call of new routine surface_coupler,
30! presure solver is called after the first Runge-Kutta substep instead of the
31! last in case that call_psolver_at_all_substeps = .F.; for this case, the
32! random perturbation has to be added to the velocity fields also after the
33! first substep
34!
35! 97 2007-06-21 08:23:15Z raasch
36! diffusivities is called with argument rho in case of ocean runs,
37! new argument pt_/prho_reference in calls of diffusivities,
38! ghostpoint exchange for salinity and density
39!
40! 87 2007-05-22 15:46:47Z raasch
41! var_hom renamed pr_palm
42!
43! 75 2007-03-22 09:54:05Z raasch
44! Move call of user_actions( 'after_integration' ) below increment of times
45! and counters,
46! calls of prognostic_equations_.. changed to .._noopt, .._cache, and
47! .._vector, these calls are now controlled by switch loop_optimization,
48! uxrp, vynp eliminated, 2nd+3rd argument removed from exchange horiz,
49! moisture renamed humidity
50!
51! RCS Log replace by Id keyword, revision history cleaned up
52!
53! Revision 1.8  2006/08/22 14:16:05  raasch
54! Disturbances are imposed only for the last Runge-Kutta-substep
55!
56! Revision 1.2  2004/04/30 13:03:40  raasch
57! decalpha-specific warning removed, routine name changed to time_integration,
58! particle advection is carried out only once during the intermediate steps,
59! impulse_advec renamed momentum_advec
60!
61! Revision 1.1  1997/08/11 06:19:04  raasch
62! Initial revision
63!
64!
65! Description:
66! ------------
67! Integration in time of the model equations, statistical analysis and graphic
68! output
69!------------------------------------------------------------------------------!
70
71    USE arrays_3d
72    USE averaging
73    USE control_parameters
74    USE cpulog
75#if defined( __dvrp_graphics )
76    USE DVRP
77#endif
78    USE grid_variables
79    USE indices
80    USE interaction_droplets_ptq_mod
81    USE interfaces
82    USE particle_attributes
83    USE pegrid
84    USE prognostic_equations_mod
85    USE statistics
86    USE user_actions_mod
87
88    IMPLICIT NONE
89
90    CHARACTER (LEN=9) ::  time_to_string
91    INTEGER ::  i, j, k
92
93!
94!-- At the beginning of a simulation determine the time step as well as
95!-- determine and print out the run control parameters
96    IF ( simulated_time == 0.0 )  CALL timestep
97
98    CALL run_control
99
100
101!
102!-- Data exchange between coupled models in case that a call has been omitted
103!-- at the end of the previous run of a job chain.
104    IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled )  THEN
105!
106!--    In case of model termination initiated by the local model the coupler
107!--    must not be called because this would again cause an MPI hang.
108       DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 )
109          CALL surface_coupler
110          time_coupling = time_coupling - dt_coupling
111       ENDDO
112       IF (time_coupling == 0.0 .AND. time_since_reference_point < dt_coupling)&
113       THEN
114          time_coupling = time_since_reference_point
115       ENDIF
116    ENDIF
117
118
119#if defined( __dvrp_graphics )
120!
121!-- Time measurement with dvrp software 
122    CALL DVRP_LOG_EVENT( 2, current_timestep_number )
123#endif
124
125!
126!-- Start of the time loop
127    DO  WHILE ( simulated_time < end_time  .AND.  .NOT. stop_dt  .AND. &
128                .NOT. terminate_run )
129
130       CALL cpu_log( log_point_s(10), 'timesteps', 'start' )
131!
132!--    Determine size of next time step
133       IF ( simulated_time /= 0.0 )  CALL timestep
134!
135!--    Execute the user-defined actions
136       CALL user_actions( 'before_timestep' )
137
138!
139!--    Start of intermediate step loop
140       intermediate_timestep_count = 0
141       DO  WHILE ( intermediate_timestep_count < &
142                   intermediate_timestep_count_max )
143
144          intermediate_timestep_count = intermediate_timestep_count + 1
145
146!
147!--       Set the steering factors for the prognostic equations which depend
148!--       on the timestep scheme
149          CALL timestep_scheme_steering
150
151!
152!--       Solve the prognostic equations. A fast cache optimized version with
153!--       only one single loop is used in case of Piascek-Williams advection
154!--       scheme. NEC vector machines use a different version, because
155!--       in the other versions a good vectorization is prohibited due to
156!--       inlining problems.
157          IF ( loop_optimization == 'vector' )  THEN
158             CALL prognostic_equations_vector
159          ELSE
160             IF ( momentum_advec == 'ups-scheme'  .OR.  &
161                  scalar_advec == 'ups-scheme'   .OR.  &
162                  scalar_advec == 'bc-scheme' )        &
163             THEN
164                CALL prognostic_equations_noopt
165             ELSE
166                CALL prognostic_equations_cache
167             ENDIF
168          ENDIF
169
170!
171!--       Particle advection (only once during intermediate steps, because
172!--       it uses an Euler-step)
173          IF ( particle_advection  .AND.                         &
174               simulated_time >= particle_advection_start  .AND. &
175               intermediate_timestep_count == 1 )  THEN
176             CALL advec_particles
177             first_call_advec_particles = .FALSE.
178          ENDIF
179
180!
181!--       Interaction of droplets with temperature and specific humidity.
182!--       Droplet condensation and evaporation is calculated within
183!--       advec_particles.
184          IF ( cloud_droplets  .AND.  &
185               intermediate_timestep_count == intermediate_timestep_count_max )&
186          THEN
187             CALL interaction_droplets_ptq
188          ENDIF
189
190!
191!--       Exchange of ghost points (lateral boundary conditions)
192          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
193          CALL exchange_horiz( u_p, nbgp )
194          CALL exchange_horiz( v_p, nbgp )
195          CALL exchange_horiz( w_p, nbgp )
196          CALL exchange_horiz( pt_p, nbgp )
197          IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
198          IF ( ocean )  THEN
199             CALL exchange_horiz( sa_p, nbgp )
200             CALL exchange_horiz( rho, nbgp )
201             CALL exchange_horiz( prho, nbgp )
202          ENDIF
203          IF (humidity  .OR.  passive_scalar) CALL exchange_horiz( q_p, nbgp )
204          IF ( cloud_droplets )  THEN
205             CALL exchange_horiz( ql, nbgp )
206             CALL exchange_horiz( ql_c, nbgp )
207             CALL exchange_horiz( ql_v, nbgp )
208             CALL exchange_horiz( ql_vp, nbgp )
209          ENDIF
210
211          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
212
213!
214!--       Apply time filter in case of leap-frog timestep
215          IF ( tsc(2) == 2.0  .AND.  timestep_scheme(1:8) == 'leapfrog' )  THEN
216             CALL asselin_filter
217          ENDIF
218
219!
220!--       Boundary conditions for the prognostic quantities (except of the
221!--       velocities at the outflow in case of a non-cyclic lateral wall)
222          CALL boundary_conds( 'main' )
223
224!
225!--       Swap the time levels in preparation for the next time step.
226          CALL swap_timelevel
227
228!
229!--       Temperature offset must be imposed at cyclic boundaries in x-direction
230!--       when a sloping surface is used
231          IF ( sloping_surface )  THEN
232             IF ( nxl ==  0 ) pt(:,:,nxlg:nxl-1) = pt(:,:,nxlg:nxl-1) - pt_slope_offset
233             IF ( nxr == nx )  pt(:,:,nxr+1:nxrg) = pt(:,:,nxr+1:nxrg) + pt_slope_offset
234          ENDIF
235
236!
237!--       Impose a turbulent inflow using the recycling method
238          IF ( turbulent_inflow )  CALL  inflow_turbulence
239
240!
241!--       Impose a random perturbation on the horizontal velocity field
242          IF ( create_disturbances  .AND.                                      &
243               ( call_psolver_at_all_substeps  .AND.                           &
244               intermediate_timestep_count == intermediate_timestep_count_max )&
245          .OR. ( .NOT. call_psolver_at_all_substeps  .AND.                     &
246               intermediate_timestep_count == 1 ) )                            &
247          THEN
248             time_disturb = time_disturb + dt_3d
249             IF ( time_disturb >= dt_disturb )  THEN
250                IF ( hom(nzb+5,1,pr_palm,0) < disturbance_energy_limit )  THEN
251                   CALL disturb_field( nzb_u_inner, tend, u )
252                   CALL disturb_field( nzb_v_inner, tend, v )
253                ELSEIF ( bc_lr /= 'cyclic'  .OR.  bc_ns /= 'cyclic' )  THEN
254!
255!--                Runs with a non-cyclic lateral wall need perturbations
256!--                near the inflow throughout the whole simulation
257                   dist_range = 1
258                   CALL disturb_field( nzb_u_inner, tend, u )
259                   CALL disturb_field( nzb_v_inner, tend, v )
260                   dist_range = 0
261                ENDIF
262                time_disturb = time_disturb - dt_disturb
263             ENDIF
264          ENDIF
265
266!
267!--       Reduce the velocity divergence via the equation for perturbation
268!--       pressure.
269          IF ( intermediate_timestep_count == 1  .OR. &
270                call_psolver_at_all_substeps )  THEN
271             CALL pres
272          ENDIF
273
274!
275!--       If required, compute virtuell potential temperature
276          IF ( humidity ) CALL compute_vpt
277
278!
279!--       If required, compute liquid water content
280          IF ( cloud_physics ) CALL calc_liquid_water_content
281
282!
283!--       Compute the diffusion quantities
284          IF ( .NOT. constant_diffusion )  THEN
285
286!
287!--          First the vertical fluxes in the Prandtl layer are being computed
288             IF ( prandtl_layer )  THEN
289                CALL cpu_log( log_point(19), 'prandtl_fluxes', 'start' )
290                CALL prandtl_fluxes
291                CALL cpu_log( log_point(19), 'prandtl_fluxes', 'stop' )
292             ENDIF
293
294!
295!--          Compute the diffusion coefficients
296             CALL cpu_log( log_point(17), 'diffusivities', 'start' )
297             IF ( .NOT. humidity ) THEN
298                IF ( ocean )  THEN
299                   CALL diffusivities( prho, prho_reference )
300                ELSE
301                   CALL diffusivities( pt, pt_reference )
302                ENDIF
303             ELSE
304                CALL diffusivities( vpt, pt_reference )
305             ENDIF
306             CALL cpu_log( log_point(17), 'diffusivities', 'stop' )
307
308          ENDIF
309
310       ENDDO   ! Intermediate step loop
311
312!
313!--    Increase simulation time and output times
314       current_timestep_number    = current_timestep_number + 1
315       simulated_time             = simulated_time   + dt_3d
316       simulated_time_chr         = time_to_string( simulated_time )
317       time_since_reference_point = simulated_time - coupling_start_time
318
319       IF ( simulated_time >= skip_time_data_output_av )  THEN
320          time_do_av         = time_do_av       + dt_3d
321       ENDIF
322       IF ( simulated_time >= skip_time_do2d_xy )  THEN
323          time_do2d_xy       = time_do2d_xy     + dt_3d
324       ENDIF
325       IF ( simulated_time >= skip_time_do2d_xz )  THEN
326          time_do2d_xz       = time_do2d_xz     + dt_3d
327       ENDIF
328       IF ( simulated_time >= skip_time_do2d_yz )  THEN
329          time_do2d_yz       = time_do2d_yz     + dt_3d
330       ENDIF
331       IF ( simulated_time >= skip_time_do3d    )  THEN
332          time_do3d          = time_do3d        + dt_3d
333       ENDIF
334       DO  mid = 1, masks
335          IF ( simulated_time >= skip_time_domask(mid) )  THEN
336             time_domask(mid)= time_domask(mid) + dt_3d
337          ENDIF
338       ENDDO
339       time_dvrp          = time_dvrp        + dt_3d
340       IF ( simulated_time >= skip_time_dosp )  THEN
341          time_dosp       = time_dosp        + dt_3d
342       ENDIF
343       time_dots          = time_dots        + dt_3d
344       IF ( .NOT. first_call_advec_particles )  THEN
345          time_dopts      = time_dopts       + dt_3d
346       ENDIF
347       IF ( simulated_time >= skip_time_dopr )  THEN
348          time_dopr       = time_dopr        + dt_3d
349       ENDIF
350       time_dopr_listing          = time_dopr_listing        + dt_3d
351       time_run_control   = time_run_control + dt_3d
352
353!
354!--    Data exchange between coupled models
355       IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled )  THEN
356          time_coupling = time_coupling + dt_3d
357
358!
359!--       In case of model termination initiated by the local model
360!--       (terminate_coupled > 0), the coupler must be skipped because it would
361!--       cause an MPI intercomminucation hang.
362!--       If necessary, the coupler will be called at the beginning of the
363!--       next restart run.
364          DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 )
365             CALL surface_coupler
366             time_coupling = time_coupling - dt_coupling
367          ENDDO
368       ENDIF
369
370!
371!--    Execute user-defined actions
372       CALL user_actions( 'after_integration' )
373
374!
375!--    If Galilei transformation is used, determine the distance that the
376!--    model has moved so far
377       IF ( galilei_transformation )  THEN
378          advected_distance_x = advected_distance_x + u_gtrans * dt_3d
379          advected_distance_y = advected_distance_y + v_gtrans * dt_3d
380       ENDIF
381
382!
383!--    Check, if restart is necessary (because cpu-time is expiring or
384!--    because it is forced by user) and set stop flag
385!--    This call is skipped if the remote model has already initiated a restart.
386       IF ( .NOT. terminate_run )  CALL check_for_restart
387
388!
389!--    Carry out statistical analysis and output at the requested output times.
390!--    The MOD function is used for calculating the output time counters (like
391!--    time_dopr) in order to regard a possible decrease of the output time
392!--    interval in case of restart runs
393
394!
395!--    Set a flag indicating that so far no statistics have been created
396!--    for this time step
397       flow_statistics_called = .FALSE.
398
399!
400!--    If required, call flow_statistics for averaging in time
401       IF ( averaging_interval_pr /= 0.0  .AND.  &
402            ( dt_dopr - time_dopr ) <= averaging_interval_pr  .AND.  &
403            simulated_time >= skip_time_dopr )  THEN
404          time_dopr_av = time_dopr_av + dt_3d
405          IF ( time_dopr_av >= dt_averaging_input_pr )  THEN
406             do_sum = .TRUE.
407             time_dopr_av = MOD( time_dopr_av, &
408                                    MAX( dt_averaging_input_pr, dt_3d ) )
409          ENDIF
410       ENDIF
411       IF ( do_sum )  CALL flow_statistics
412
413!
414!--    Sum-up 3d-arrays for later output of time-averaged 2d/3d/masked data
415       IF ( averaging_interval /= 0.0  .AND.                                &
416            ( dt_data_output_av - time_do_av ) <= averaging_interval  .AND. &
417            simulated_time >= skip_time_data_output_av )                    &
418       THEN
419          time_do_sla = time_do_sla + dt_3d
420          IF ( time_do_sla >= dt_averaging_input )  THEN
421             CALL sum_up_3d_data
422             average_count_3d = average_count_3d + 1
423             time_do_sla = MOD( time_do_sla, MAX( dt_averaging_input, dt_3d ) )
424          ENDIF
425       ENDIF
426
427!
428!--    Calculate spectra for time averaging
429       IF ( averaging_interval_sp /= 0.0  .AND.  &
430            ( dt_dosp - time_dosp ) <= averaging_interval_sp  .AND.  &
431            simulated_time >= skip_time_dosp )  THEN
432          time_dosp_av = time_dosp_av + dt_3d
433          IF ( time_dosp_av >= dt_averaging_input_pr )  THEN
434             CALL calc_spectra
435             time_dosp_av = MOD( time_dosp_av, &
436                                 MAX( dt_averaging_input_pr, dt_3d ) )
437          ENDIF
438       ENDIF
439
440!
441!--    Computation and output of run control parameters.
442!--    This is also done whenever the time step has changed or perturbations
443!--    have been imposed
444       IF ( time_run_control >= dt_run_control  .OR.                     &
445            ( dt_changed  .AND.  timestep_scheme(1:5) /= 'runge' )  .OR. &
446            disturbance_created )                                        &
447       THEN
448          CALL run_control
449          IF ( time_run_control >= dt_run_control )  THEN
450             time_run_control = MOD( time_run_control, &
451                                     MAX( dt_run_control, dt_3d ) )
452          ENDIF
453       ENDIF
454
455!
456!--    Profile output (ASCII) on file
457       IF ( time_dopr_listing >= dt_dopr_listing )  THEN
458          CALL print_1d
459          time_dopr_listing = MOD( time_dopr_listing, MAX( dt_dopr_listing, &
460                                                           dt_3d ) )
461       ENDIF
462
463!
464!--    Graphic output for PROFIL
465       IF ( time_dopr >= dt_dopr )  THEN
466          IF ( dopr_n /= 0 )  CALL data_output_profiles
467          time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_3d ) )
468          time_dopr_av = 0.0    ! due to averaging (see above)
469       ENDIF
470
471!
472!--    Graphic output for time series
473       IF ( time_dots >= dt_dots )  THEN
474          CALL data_output_tseries
475          time_dots = MOD( time_dots, MAX( dt_dots, dt_3d ) )
476       ENDIF
477
478!
479!--    Output of spectra (formatted for use with PROFIL), in case of no
480!--    time averaging, spectra has to be calculated before
481       IF ( time_dosp >= dt_dosp )  THEN
482          IF ( average_count_sp == 0 )  CALL calc_spectra
483          CALL data_output_spectra
484          time_dosp = MOD( time_dosp, MAX( dt_dosp, dt_3d ) )
485       ENDIF
486
487!
488!--    2d-data output (cross-sections)
489       IF ( time_do2d_xy >= dt_do2d_xy )  THEN
490          CALL data_output_2d( 'xy', 0 )
491          time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) )
492       ENDIF
493       IF ( time_do2d_xz >= dt_do2d_xz )  THEN
494          CALL data_output_2d( 'xz', 0 )
495          time_do2d_xz = MOD( time_do2d_xz, MAX( dt_do2d_xz, dt_3d ) )
496       ENDIF
497       IF ( time_do2d_yz >= dt_do2d_yz )  THEN
498          CALL data_output_2d( 'yz', 0 )
499          time_do2d_yz = MOD( time_do2d_yz, MAX( dt_do2d_yz, dt_3d ) )
500       ENDIF
501
502!
503!--    3d-data output (volume data)
504       IF ( time_do3d >= dt_do3d )  THEN
505          CALL data_output_3d( 0 )
506          time_do3d = MOD( time_do3d, MAX( dt_do3d, dt_3d ) )
507       ENDIF
508
509!
510!--    masked data output
511       DO  mid = 1, masks
512          IF ( time_domask(mid) >= dt_domask(mid) )  THEN
513             CALL data_output_mask( 0 )
514             time_domask(mid) = MOD( time_domask(mid),  &
515                                     MAX( dt_domask(mid), dt_3d ) )
516          ENDIF
517       ENDDO
518
519!
520!--    Output of time-averaged 2d/3d/masked data
521       IF ( time_do_av >= dt_data_output_av )  THEN
522          CALL average_3d_data
523          CALL data_output_2d( 'xy', 1 )
524          CALL data_output_2d( 'xz', 1 )
525          CALL data_output_2d( 'yz', 1 )
526          CALL data_output_3d( 1 )
527          DO  mid = 1, masks
528             CALL data_output_mask( 1 )
529          ENDDO
530          time_do_av = MOD( time_do_av, MAX( dt_data_output_av, dt_3d ) )
531       ENDIF
532
533!
534!--    Output of particle time series
535       IF ( particle_advection )  THEN
536          IF ( time_dopts >= dt_dopts  .OR. &
537               ( simulated_time >= particle_advection_start  .AND. &
538                 first_call_advec_particles ) )  THEN
539             CALL data_output_ptseries
540             time_dopts = MOD( time_dopts, MAX( dt_dopts, dt_3d ) )
541          ENDIF
542       ENDIF
543
544!
545!--    Output of dvrp-graphics (isosurface, particles, slicer)
546#if defined( __dvrp_graphics )
547       CALL DVRP_LOG_EVENT( -2, current_timestep_number-1 )
548#endif
549       IF ( time_dvrp >= dt_dvrp )  THEN
550          CALL data_output_dvrp
551          time_dvrp = MOD( time_dvrp, MAX( dt_dvrp, dt_3d ) )
552       ENDIF
553#if defined( __dvrp_graphics )
554       CALL DVRP_LOG_EVENT( 2, current_timestep_number )
555#endif
556
557!
558!--    If required, set the heat flux for the next time step at a random value
559       IF ( constant_heatflux  .AND.  random_heatflux )  CALL disturb_heatflux
560
561!
562!--    Execute user-defined actions
563       CALL user_actions( 'after_timestep' )
564
565       CALL cpu_log( log_point_s(10), 'timesteps', 'stop' )
566
567
568    ENDDO   ! time loop
569
570#if defined( __dvrp_graphics )
571    CALL DVRP_LOG_EVENT( -2, current_timestep_number )
572#endif
573
574 END SUBROUTINE time_integration
Note: See TracBrowser for help on using the repository browser.