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