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-2014 Leibniz Universitaet Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ------------------ |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: time_integration.f90 1366 2014-04-22 15:06:33Z boeske $ |
---|
27 | ! |
---|
28 | ! 1365 2014-04-22 15:03:56Z boeske |
---|
29 | ! Reset sums_ls_l to zero at each timestep |
---|
30 | ! +sums_ls_l |
---|
31 | ! Calculation of reference state (previously in subroutine calc_mean_profile) |
---|
32 | |
---|
33 | ! 1342 2014-03-26 17:04:47Z kanani |
---|
34 | ! REAL constants defined as wp-kind |
---|
35 | ! |
---|
36 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
37 | ! ONLY-attribute added to USE-statements, |
---|
38 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
39 | ! kinds are defined in new module kinds, |
---|
40 | ! old module precision_kind is removed, |
---|
41 | ! revision history before 2012 removed, |
---|
42 | ! comment fields (!:) to be used for variable explanations added to |
---|
43 | ! all variable declaration statements |
---|
44 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
45 | ! module interfaces removed |
---|
46 | ! |
---|
47 | ! 1308 2014-03-13 14:58:42Z fricke |
---|
48 | ! +netcdf_data_format_save |
---|
49 | ! For masked data, parallel netcdf output is not tested so far, hence |
---|
50 | ! netcdf_data_format is switched back to non-paralell output. |
---|
51 | ! |
---|
52 | ! 1276 2014-01-15 13:40:41Z heinze |
---|
53 | ! Use LSF_DATA also in case of Dirichlet bottom boundary condition for scalars |
---|
54 | ! |
---|
55 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
56 | ! acc-update-host directive for timestep removed |
---|
57 | ! |
---|
58 | ! 1241 2013-10-30 11:36:58Z heinze |
---|
59 | ! Generalize calc_mean_profile for wider use |
---|
60 | ! Determine shf and qsws in dependence on data from LSF_DATA |
---|
61 | ! Determine ug and vg in dependence on data from LSF_DATA |
---|
62 | ! 1221 2013-09-10 08:59:13Z raasch |
---|
63 | ! host update of arrays before timestep is called |
---|
64 | ! |
---|
65 | ! 1179 2013-06-14 05:57:58Z raasch |
---|
66 | ! mean profiles for reference state are only calculated if required, |
---|
67 | ! small bugfix for background communication |
---|
68 | ! |
---|
69 | ! 1171 2013-05-30 11:27:45Z raasch |
---|
70 | ! split of prognostic_equations deactivated (comment lines), for the time being |
---|
71 | ! |
---|
72 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
73 | ! asynchronous transfer of ghost point data realized for acc-optimized version: |
---|
74 | ! prognostic_equations are first called two times for those points required for |
---|
75 | ! the left-right and north-south exchange, respectively, and then for the |
---|
76 | ! remaining points, |
---|
77 | ! those parts requiring global communication moved from prognostic_equations to |
---|
78 | ! here |
---|
79 | ! |
---|
80 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
81 | ! calculation of qr and nr is restricted to precipitation |
---|
82 | ! |
---|
83 | ! 1113 2013-03-10 02:48:14Z raasch |
---|
84 | ! GPU-porting of boundary conditions, |
---|
85 | ! openACC directives updated |
---|
86 | ! formal parameter removed from routine boundary_conds |
---|
87 | ! |
---|
88 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
89 | ! +internal timestep counter for cpu statistics added, |
---|
90 | ! openACC directives updated |
---|
91 | ! |
---|
92 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
93 | ! unused variables removed |
---|
94 | ! |
---|
95 | ! 1065 2012-11-22 17:42:36Z hoffmann |
---|
96 | ! exchange of diss (dissipation rate) in case of turbulence = .TRUE. added |
---|
97 | ! |
---|
98 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
99 | ! exchange of ghost points for nr, qr added |
---|
100 | ! |
---|
101 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
102 | ! code put under GPL (PALM 3.9) |
---|
103 | ! |
---|
104 | ! 1019 2012-09-28 06:46:45Z raasch |
---|
105 | ! non-optimized version of prognostic_equations removed |
---|
106 | ! |
---|
107 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
108 | ! +call of prognostic_equations_acc |
---|
109 | ! |
---|
110 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
111 | ! all actions concerning leapfrog- and upstream-spline-scheme removed |
---|
112 | ! |
---|
113 | ! 849 2012-03-15 10:35:09Z raasch |
---|
114 | ! advec_particles renamed lpm, first_call_advec_particles renamed first_call_lpm |
---|
115 | ! |
---|
116 | ! 825 2012-02-19 03:03:44Z raasch |
---|
117 | ! wang_collision_kernel renamed wang_kernel |
---|
118 | ! |
---|
119 | ! Revision 1.1 1997/08/11 06:19:04 raasch |
---|
120 | ! Initial revision |
---|
121 | ! |
---|
122 | ! |
---|
123 | ! Description: |
---|
124 | ! ------------ |
---|
125 | ! Integration in time of the model equations, statistical analysis and graphic |
---|
126 | ! output |
---|
127 | !------------------------------------------------------------------------------! |
---|
128 | |
---|
129 | USE advec_ws, & |
---|
130 | ONLY: ws_statistics |
---|
131 | |
---|
132 | USE arrays_3d, & |
---|
133 | ONLY: diss, e_p, nr_p, prho, pt, pt_p, q, ql, ql_c, ql_v, ql_vp, qr_p,& |
---|
134 | q_p, ref_state, rho, sa_p, tend, u, u_p, v, vpt, v_p, w_p |
---|
135 | |
---|
136 | USE calc_mean_profile_mod, & |
---|
137 | ONLY: calc_mean_profile |
---|
138 | |
---|
139 | USE control_parameters, & |
---|
140 | ONLY: advected_distance_x, advected_distance_y, average_count_3d, & |
---|
141 | average_count_sp, averaging_interval, averaging_interval_pr, & |
---|
142 | averaging_interval_sp, bc_lr_cyc, bc_ns_cyc, & |
---|
143 | call_psolver_at_all_substeps, cloud_droplets, cloud_physics, & |
---|
144 | constant_heatflux, create_disturbances, dopr_n, & |
---|
145 | constant_diffusion, coupling_mode, coupling_start_time, & |
---|
146 | current_timestep_number, disturbance_created, & |
---|
147 | disturbance_energy_limit, dist_range, do_sum, dt_3d, & |
---|
148 | dt_averaging_input, dt_averaging_input_pr, dt_coupling, & |
---|
149 | dt_data_output_av, dt_disturb, dt_do2d_xy, dt_do2d_xz, & |
---|
150 | dt_do2d_yz, dt_do3d, dt_domask,dt_dopts, dt_dopr, & |
---|
151 | dt_dopr_listing, dt_dosp, dt_dots, dt_dvrp, dt_run_control, & |
---|
152 | end_time, first_call_lpm, galilei_transformation, humidity, & |
---|
153 | icloud_scheme, intermediate_timestep_count, & |
---|
154 | intermediate_timestep_count_max, large_scale_forcing, & |
---|
155 | loop_optimization, lsf_surf, lsf_vert, masks, mid, & |
---|
156 | netcdf_data_format, neutral, nr_timesteps_this_run, nudging, & |
---|
157 | ocean, on_device, passive_scalar, prandtl_layer, precipitation, & |
---|
158 | prho_reference, pt_reference, pt_slope_offset, random_heatflux, & |
---|
159 | run_coupled, simulated_time, simulated_time_chr, & |
---|
160 | skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz, & |
---|
161 | skip_time_do3d, skip_time_domask, skip_time_dopr, & |
---|
162 | skip_time_dosp, skip_time_data_output_av, sloping_surface, & |
---|
163 | stop_dt, terminate_coupled, terminate_run, timestep_scheme, & |
---|
164 | time_coupling, time_do2d_xy, time_do2d_xz, time_do2d_yz, & |
---|
165 | time_do3d, time_domask, time_dopr, time_dopr_av, & |
---|
166 | time_dopr_listing, time_dopts, time_dosp, time_dosp_av, & |
---|
167 | time_dots, time_do_av, time_do_sla, time_disturb, time_dvrp, & |
---|
168 | time_run_control, time_since_reference_point, turbulence, & |
---|
169 | turbulent_inflow, use_initial_profile_as_reference, & |
---|
170 | use_single_reference_value, u_gtrans, v_gtrans, ws_scheme_mom, & |
---|
171 | ws_scheme_sca |
---|
172 | |
---|
173 | USE cpulog, & |
---|
174 | ONLY: cpu_log, log_point, log_point_s |
---|
175 | |
---|
176 | USE indices, & |
---|
177 | ONLY: i_left, i_right, j_north, j_south, nbgp, nx, nxl, nxlg, nxr, & |
---|
178 | nxrg, nyn, nys, nzb, nzb_u_inner, nzb_v_inner |
---|
179 | |
---|
180 | USE interaction_droplets_ptq_mod, & |
---|
181 | ONLY: interaction_droplets_ptq |
---|
182 | |
---|
183 | USE kinds |
---|
184 | |
---|
185 | USE ls_forcing_mod, & |
---|
186 | ONLY: ls_forcing_surf, ls_forcing_vert |
---|
187 | |
---|
188 | USE nudge_mod, & |
---|
189 | ONLY: calc_tnudge |
---|
190 | |
---|
191 | USE particle_attributes, & |
---|
192 | ONLY: particle_advection, particle_advection_start, wang_kernel |
---|
193 | |
---|
194 | USE pegrid |
---|
195 | |
---|
196 | USE production_e_mod, & |
---|
197 | ONLY: production_e_init |
---|
198 | |
---|
199 | USE prognostic_equations_mod, & |
---|
200 | ONLY: prognostic_equations_acc, prognostic_equations_cache, & |
---|
201 | prognostic_equations_vector |
---|
202 | |
---|
203 | USE statistics, & |
---|
204 | ONLY: flow_statistics_called, hom, pr_palm, sums_ls_l |
---|
205 | |
---|
206 | USE user_actions_mod, & |
---|
207 | ONLY: user_actions |
---|
208 | |
---|
209 | IMPLICIT NONE |
---|
210 | |
---|
211 | CHARACTER (LEN=9) :: time_to_string !: |
---|
212 | |
---|
213 | INTEGER(iwp) :: netcdf_data_format_save !: |
---|
214 | |
---|
215 | ! |
---|
216 | !-- At the beginning of a simulation determine the time step as well as |
---|
217 | !-- determine and print out the run control parameters |
---|
218 | IF ( simulated_time == 0.0_wp ) CALL timestep |
---|
219 | |
---|
220 | CALL run_control |
---|
221 | |
---|
222 | |
---|
223 | ! |
---|
224 | !-- Data exchange between coupled models in case that a call has been omitted |
---|
225 | !-- at the end of the previous run of a job chain. |
---|
226 | IF ( coupling_mode /= 'uncoupled' .AND. run_coupled ) THEN |
---|
227 | ! |
---|
228 | !-- In case of model termination initiated by the local model the coupler |
---|
229 | !-- must not be called because this would again cause an MPI hang. |
---|
230 | DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 ) |
---|
231 | CALL surface_coupler |
---|
232 | time_coupling = time_coupling - dt_coupling |
---|
233 | ENDDO |
---|
234 | IF (time_coupling == 0.0_wp .AND. time_since_reference_point < dt_coupling)& |
---|
235 | THEN |
---|
236 | time_coupling = time_since_reference_point |
---|
237 | ENDIF |
---|
238 | ENDIF |
---|
239 | |
---|
240 | |
---|
241 | #if defined( __dvrp_graphics ) |
---|
242 | ! |
---|
243 | !-- Time measurement with dvrp software |
---|
244 | CALL DVRP_LOG_EVENT( 2, current_timestep_number ) |
---|
245 | #endif |
---|
246 | |
---|
247 | ! |
---|
248 | !-- Start of the time loop |
---|
249 | DO WHILE ( simulated_time < end_time .AND. .NOT. stop_dt .AND. & |
---|
250 | .NOT. terminate_run ) |
---|
251 | |
---|
252 | CALL cpu_log( log_point_s(10), 'timesteps', 'start' ) |
---|
253 | |
---|
254 | ! |
---|
255 | !-- Determine size of next time step |
---|
256 | IF ( simulated_time /= 0.0_wp ) THEN |
---|
257 | CALL timestep |
---|
258 | ENDIF |
---|
259 | |
---|
260 | ! |
---|
261 | !-- Determine ug, vg and w_subs in dependence on data from external file |
---|
262 | !-- LSF_DATA |
---|
263 | IF ( large_scale_forcing .AND. lsf_vert ) THEN |
---|
264 | CALL ls_forcing_vert ( simulated_time ) |
---|
265 | sums_ls_l = 0.0_wp |
---|
266 | ENDIF |
---|
267 | |
---|
268 | ! |
---|
269 | !-- Execute the user-defined actions |
---|
270 | CALL user_actions( 'before_timestep' ) |
---|
271 | |
---|
272 | ! |
---|
273 | !-- Start of intermediate step loop |
---|
274 | intermediate_timestep_count = 0 |
---|
275 | DO WHILE ( intermediate_timestep_count < & |
---|
276 | intermediate_timestep_count_max ) |
---|
277 | |
---|
278 | intermediate_timestep_count = intermediate_timestep_count + 1 |
---|
279 | |
---|
280 | ! |
---|
281 | !-- Set the steering factors for the prognostic equations which depend |
---|
282 | !-- on the timestep scheme |
---|
283 | CALL timestep_scheme_steering |
---|
284 | |
---|
285 | ! |
---|
286 | !-- Calculate those variables needed in the tendency terms which need |
---|
287 | !-- global communication |
---|
288 | IF ( .NOT. use_single_reference_value .AND. & |
---|
289 | .NOT. use_initial_profile_as_reference ) THEN |
---|
290 | ! |
---|
291 | !-- Horizontally averaged profiles to be used as reference state in |
---|
292 | !-- buoyancy terms (WARNING: only the respective last call of |
---|
293 | !-- calc_mean_profile defines the reference state!) |
---|
294 | IF ( .NOT. neutral ) THEN |
---|
295 | CALL calc_mean_profile( pt, 4 ) |
---|
296 | ref_state(:) = hom(:,1,4,0) ! this is used in the buoyancy term |
---|
297 | ENDIF |
---|
298 | IF ( ocean ) THEN |
---|
299 | CALL calc_mean_profile( rho, 64 ) |
---|
300 | ref_state(:) = hom(:,1,64,0) |
---|
301 | ENDIF |
---|
302 | IF ( humidity ) THEN |
---|
303 | CALL calc_mean_profile( vpt, 44 ) |
---|
304 | ref_state(:) = hom(:,1,44,0) |
---|
305 | ENDIF |
---|
306 | |
---|
307 | ENDIF |
---|
308 | |
---|
309 | IF ( .NOT. constant_diffusion ) CALL production_e_init |
---|
310 | IF ( ( ws_scheme_mom .OR. ws_scheme_sca ) .AND. & |
---|
311 | intermediate_timestep_count == 1 ) CALL ws_statistics |
---|
312 | ! |
---|
313 | !-- In case of nudging calculate current nudging time scale and horizontal |
---|
314 | !-- means of u,v,pt and q |
---|
315 | IF ( nudging ) THEN |
---|
316 | CALL calc_tnudge( simulated_time ) |
---|
317 | CALL calc_mean_profile( u, 1 ) |
---|
318 | CALL calc_mean_profile( v, 2 ) |
---|
319 | CALL calc_mean_profile( pt, 4 ) |
---|
320 | CALL calc_mean_profile( q, 41 ) |
---|
321 | ENDIF |
---|
322 | |
---|
323 | ! |
---|
324 | !-- Solve the prognostic equations. A fast cache optimized version with |
---|
325 | !-- only one single loop is used in case of Piascek-Williams advection |
---|
326 | !-- scheme. NEC vector machines use a different version, because |
---|
327 | !-- in the other versions a good vectorization is prohibited due to |
---|
328 | !-- inlining problems. |
---|
329 | IF ( loop_optimization == 'cache' ) THEN |
---|
330 | CALL prognostic_equations_cache |
---|
331 | ELSEIF ( loop_optimization == 'vector' ) THEN |
---|
332 | CALL prognostic_equations_vector |
---|
333 | ELSEIF ( loop_optimization == 'acc' ) THEN |
---|
334 | i_left = nxl; i_right = nxr |
---|
335 | j_south = nys; j_north = nyn |
---|
336 | CALL prognostic_equations_acc |
---|
337 | |
---|
338 | ! i_left = nxl; i_right = nxl+nbgp-1 |
---|
339 | ! j_south = nys; j_north = nyn |
---|
340 | ! CALL prognostic_equations_acc |
---|
341 | ! i_left = nxr-nbgp+1; i_right = nxr |
---|
342 | ! j_south = nys; j_north = nyn |
---|
343 | ! CALL prognostic_equations_acc |
---|
344 | |
---|
345 | ! |
---|
346 | !-- Exchange of ghost points (lateral boundary conditions) |
---|
347 | IF ( background_communication ) THEN |
---|
348 | |
---|
349 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' ) |
---|
350 | |
---|
351 | send_receive = 'lr' |
---|
352 | sendrecv_in_background = .TRUE. |
---|
353 | req = 0 |
---|
354 | req_count = 0 |
---|
355 | |
---|
356 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
357 | on_device = .TRUE. ! to be removed after complete porting |
---|
358 | ELSE ! of ghost point exchange |
---|
359 | !$acc update host( e_p, pt_p, u_p, v_p, w_p ) |
---|
360 | ENDIF |
---|
361 | |
---|
362 | CALL exchange_horiz( u_p, nbgp ) |
---|
363 | CALL exchange_horiz( v_p, nbgp ) |
---|
364 | CALL exchange_horiz( w_p, nbgp ) |
---|
365 | CALL exchange_horiz( pt_p, nbgp ) |
---|
366 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e_p, nbgp ) |
---|
367 | IF ( ocean ) THEN |
---|
368 | CALL exchange_horiz( sa_p, nbgp ) |
---|
369 | CALL exchange_horiz( rho, nbgp ) |
---|
370 | CALL exchange_horiz( prho, nbgp ) |
---|
371 | ENDIF |
---|
372 | IF (humidity .OR. passive_scalar) THEN |
---|
373 | CALL exchange_horiz( q_p, nbgp ) |
---|
374 | IF ( cloud_physics .AND. icloud_scheme == 0 ) THEN |
---|
375 | CALL exchange_horiz( qr_p, nbgp ) |
---|
376 | CALL exchange_horiz( nr_p, nbgp ) |
---|
377 | ENDIF |
---|
378 | ENDIF |
---|
379 | IF ( cloud_droplets ) THEN |
---|
380 | CALL exchange_horiz( ql, nbgp ) |
---|
381 | CALL exchange_horiz( ql_c, nbgp ) |
---|
382 | CALL exchange_horiz( ql_v, nbgp ) |
---|
383 | CALL exchange_horiz( ql_vp, nbgp ) |
---|
384 | ENDIF |
---|
385 | IF ( wang_kernel .OR. turbulence ) CALL exchange_horiz( diss, nbgp ) |
---|
386 | |
---|
387 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
388 | on_device = .FALSE. ! to be removed after complete porting |
---|
389 | ELSE ! of ghost point exchange |
---|
390 | !$acc update device( e_p, pt_p, u_p, v_p, w_p ) |
---|
391 | ENDIF |
---|
392 | |
---|
393 | sendrecv_in_background = .FALSE. |
---|
394 | |
---|
395 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'pause' ) |
---|
396 | |
---|
397 | ENDIF |
---|
398 | |
---|
399 | ! i_left = nxl+nbgp; i_right = nxr-nbgp |
---|
400 | ! j_south = nys; j_north = nys+nbgp-1 |
---|
401 | ! CALL prognostic_equations_acc |
---|
402 | ! i_left = nxl+nbgp; i_right = nxr-nbgp |
---|
403 | ! j_south = nyn-nbgp+1; j_north = nyn |
---|
404 | ! CALL prognostic_equations_acc |
---|
405 | |
---|
406 | IF ( background_communication ) THEN |
---|
407 | CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'start' ) |
---|
408 | #if defined( __parallel ) |
---|
409 | CALL MPI_WAITALL( req_count, req, wait_stat, ierr ) |
---|
410 | #endif |
---|
411 | CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'pause' ) |
---|
412 | |
---|
413 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'continue' ) |
---|
414 | |
---|
415 | send_receive = 'ns' |
---|
416 | sendrecv_in_background = .TRUE. |
---|
417 | req = 0 |
---|
418 | req_count = 0 |
---|
419 | |
---|
420 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
421 | on_device = .TRUE. ! to be removed after complete porting |
---|
422 | ELSE ! of ghost point exchange |
---|
423 | !$acc update host( e_p, pt_p, u_p, v_p, w_p ) |
---|
424 | ENDIF |
---|
425 | |
---|
426 | CALL exchange_horiz( u_p, nbgp ) |
---|
427 | CALL exchange_horiz( v_p, nbgp ) |
---|
428 | CALL exchange_horiz( w_p, nbgp ) |
---|
429 | CALL exchange_horiz( pt_p, nbgp ) |
---|
430 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e_p, nbgp ) |
---|
431 | IF ( ocean ) THEN |
---|
432 | CALL exchange_horiz( sa_p, nbgp ) |
---|
433 | CALL exchange_horiz( rho, nbgp ) |
---|
434 | CALL exchange_horiz( prho, nbgp ) |
---|
435 | ENDIF |
---|
436 | IF (humidity .OR. passive_scalar) THEN |
---|
437 | CALL exchange_horiz( q_p, nbgp ) |
---|
438 | IF ( cloud_physics .AND. icloud_scheme == 0 ) THEN |
---|
439 | CALL exchange_horiz( qr_p, nbgp ) |
---|
440 | CALL exchange_horiz( nr_p, nbgp ) |
---|
441 | ENDIF |
---|
442 | ENDIF |
---|
443 | IF ( cloud_droplets ) THEN |
---|
444 | CALL exchange_horiz( ql, nbgp ) |
---|
445 | CALL exchange_horiz( ql_c, nbgp ) |
---|
446 | CALL exchange_horiz( ql_v, nbgp ) |
---|
447 | CALL exchange_horiz( ql_vp, nbgp ) |
---|
448 | ENDIF |
---|
449 | IF ( wang_kernel .OR. turbulence ) CALL exchange_horiz( diss, nbgp ) |
---|
450 | |
---|
451 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
452 | on_device = .FALSE. ! to be removed after complete porting |
---|
453 | ELSE ! of ghost point exchange |
---|
454 | !$acc update device( e_p, pt_p, u_p, v_p, w_p ) |
---|
455 | ENDIF |
---|
456 | |
---|
457 | sendrecv_in_background = .FALSE. |
---|
458 | |
---|
459 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' ) |
---|
460 | |
---|
461 | ENDIF |
---|
462 | |
---|
463 | ! i_left = nxl+nbgp; i_right = nxr-nbgp |
---|
464 | ! j_south = nys+nbgp; j_north = nyn-nbgp |
---|
465 | ! CALL prognostic_equations_acc |
---|
466 | |
---|
467 | IF ( background_communication ) THEN |
---|
468 | CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'continue' ) |
---|
469 | #if defined( __parallel ) |
---|
470 | CALL MPI_WAITALL( req_count, req, wait_stat, ierr ) |
---|
471 | #endif |
---|
472 | send_receive = 'al' |
---|
473 | CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'stop' ) |
---|
474 | ENDIF |
---|
475 | |
---|
476 | ENDIF |
---|
477 | |
---|
478 | ! |
---|
479 | !-- Particle transport/physics with the Lagrangian particle model |
---|
480 | !-- (only once during intermediate steps, because it uses an Euler-step) |
---|
481 | !-- ### particle model should be moved before prognostic_equations, in order |
---|
482 | !-- to regard droplet interactions directly |
---|
483 | IF ( particle_advection .AND. & |
---|
484 | simulated_time >= particle_advection_start .AND. & |
---|
485 | intermediate_timestep_count == 1 ) THEN |
---|
486 | CALL lpm |
---|
487 | first_call_lpm = .FALSE. |
---|
488 | ENDIF |
---|
489 | |
---|
490 | ! |
---|
491 | !-- Interaction of droplets with temperature and specific humidity. |
---|
492 | !-- Droplet condensation and evaporation is calculated within |
---|
493 | !-- advec_particles. |
---|
494 | IF ( cloud_droplets .AND. & |
---|
495 | intermediate_timestep_count == intermediate_timestep_count_max )& |
---|
496 | THEN |
---|
497 | CALL interaction_droplets_ptq |
---|
498 | ENDIF |
---|
499 | |
---|
500 | ! |
---|
501 | !-- Exchange of ghost points (lateral boundary conditions) |
---|
502 | IF ( .NOT. background_communication ) THEN |
---|
503 | |
---|
504 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' ) |
---|
505 | |
---|
506 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
507 | on_device = .TRUE. ! to be removed after complete porting |
---|
508 | ELSE ! of ghost point exchange |
---|
509 | !$acc update host( e_p, pt_p, u_p, v_p, w_p ) |
---|
510 | ENDIF |
---|
511 | |
---|
512 | CALL exchange_horiz( u_p, nbgp ) |
---|
513 | CALL exchange_horiz( v_p, nbgp ) |
---|
514 | CALL exchange_horiz( w_p, nbgp ) |
---|
515 | CALL exchange_horiz( pt_p, nbgp ) |
---|
516 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e_p, nbgp ) |
---|
517 | IF ( ocean ) THEN |
---|
518 | CALL exchange_horiz( sa_p, nbgp ) |
---|
519 | CALL exchange_horiz( rho, nbgp ) |
---|
520 | CALL exchange_horiz( prho, nbgp ) |
---|
521 | ENDIF |
---|
522 | IF (humidity .OR. passive_scalar) THEN |
---|
523 | CALL exchange_horiz( q_p, nbgp ) |
---|
524 | IF ( cloud_physics .AND. icloud_scheme == 0 .AND. & |
---|
525 | precipitation ) THEN |
---|
526 | CALL exchange_horiz( qr_p, nbgp ) |
---|
527 | CALL exchange_horiz( nr_p, nbgp ) |
---|
528 | ENDIF |
---|
529 | ENDIF |
---|
530 | IF ( cloud_droplets ) THEN |
---|
531 | CALL exchange_horiz( ql, nbgp ) |
---|
532 | CALL exchange_horiz( ql_c, nbgp ) |
---|
533 | CALL exchange_horiz( ql_v, nbgp ) |
---|
534 | CALL exchange_horiz( ql_vp, nbgp ) |
---|
535 | ENDIF |
---|
536 | IF ( wang_kernel .OR. turbulence ) CALL exchange_horiz( diss, nbgp ) |
---|
537 | |
---|
538 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
539 | on_device = .FALSE. ! to be removed after complete porting |
---|
540 | ELSE ! of ghost point exchange |
---|
541 | !$acc update device( e_p, pt_p, u_p, v_p, w_p ) |
---|
542 | ENDIF |
---|
543 | |
---|
544 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' ) |
---|
545 | |
---|
546 | ENDIF |
---|
547 | |
---|
548 | ! |
---|
549 | !-- Boundary conditions for the prognostic quantities (except of the |
---|
550 | !-- velocities at the outflow in case of a non-cyclic lateral wall) |
---|
551 | CALL boundary_conds |
---|
552 | |
---|
553 | ! |
---|
554 | !-- Swap the time levels in preparation for the next time step. |
---|
555 | CALL swap_timelevel |
---|
556 | |
---|
557 | ! |
---|
558 | !-- Temperature offset must be imposed at cyclic boundaries in x-direction |
---|
559 | !-- when a sloping surface is used |
---|
560 | IF ( sloping_surface ) THEN |
---|
561 | IF ( nxl == 0 ) pt(:,:,nxlg:nxl-1) = pt(:,:,nxlg:nxl-1) - & |
---|
562 | pt_slope_offset |
---|
563 | IF ( nxr == nx ) pt(:,:,nxr+1:nxrg) = pt(:,:,nxr+1:nxrg) + & |
---|
564 | pt_slope_offset |
---|
565 | ENDIF |
---|
566 | |
---|
567 | ! |
---|
568 | !-- Impose a turbulent inflow using the recycling method |
---|
569 | IF ( turbulent_inflow ) CALL inflow_turbulence |
---|
570 | |
---|
571 | ! |
---|
572 | !-- Impose a random perturbation on the horizontal velocity field |
---|
573 | IF ( create_disturbances .AND. & |
---|
574 | ( call_psolver_at_all_substeps .AND. & |
---|
575 | intermediate_timestep_count == intermediate_timestep_count_max )& |
---|
576 | .OR. ( .NOT. call_psolver_at_all_substeps .AND. & |
---|
577 | intermediate_timestep_count == 1 ) ) & |
---|
578 | THEN |
---|
579 | time_disturb = time_disturb + dt_3d |
---|
580 | IF ( time_disturb >= dt_disturb ) THEN |
---|
581 | !$acc update host( u, v ) |
---|
582 | IF ( numprocs == 1 ) on_device = .FALSE. ! workaround, remove later |
---|
583 | IF ( hom(nzb+5,1,pr_palm,0) < disturbance_energy_limit ) THEN |
---|
584 | CALL disturb_field( nzb_u_inner, tend, u ) |
---|
585 | CALL disturb_field( nzb_v_inner, tend, v ) |
---|
586 | ELSEIF ( .NOT. bc_lr_cyc .OR. .NOT. bc_ns_cyc ) THEN |
---|
587 | ! |
---|
588 | !-- Runs with a non-cyclic lateral wall need perturbations |
---|
589 | !-- near the inflow throughout the whole simulation |
---|
590 | dist_range = 1 |
---|
591 | CALL disturb_field( nzb_u_inner, tend, u ) |
---|
592 | CALL disturb_field( nzb_v_inner, tend, v ) |
---|
593 | dist_range = 0 |
---|
594 | ENDIF |
---|
595 | IF ( numprocs == 1 ) on_device = .TRUE. ! workaround, remove later |
---|
596 | !$acc update device( u, v ) |
---|
597 | time_disturb = time_disturb - dt_disturb |
---|
598 | ENDIF |
---|
599 | ENDIF |
---|
600 | |
---|
601 | ! |
---|
602 | !-- Reduce the velocity divergence via the equation for perturbation |
---|
603 | !-- pressure. |
---|
604 | IF ( intermediate_timestep_count == 1 .OR. & |
---|
605 | call_psolver_at_all_substeps ) THEN |
---|
606 | CALL pres |
---|
607 | ENDIF |
---|
608 | |
---|
609 | ! |
---|
610 | !-- If required, compute liquid water content |
---|
611 | IF ( cloud_physics ) THEN |
---|
612 | CALL calc_liquid_water_content |
---|
613 | !$acc update device( ql ) |
---|
614 | ENDIF |
---|
615 | ! |
---|
616 | !-- If required, compute virtual potential temperature |
---|
617 | IF ( humidity ) THEN |
---|
618 | CALL compute_vpt |
---|
619 | !$acc update device( vpt ) |
---|
620 | ENDIF |
---|
621 | ! |
---|
622 | !-- Compute the diffusion quantities |
---|
623 | IF ( .NOT. constant_diffusion ) THEN |
---|
624 | |
---|
625 | ! |
---|
626 | !-- Determine surface fluxes shf and qsws and surface values |
---|
627 | !-- pt_surface and q_surface in dependence on data from external |
---|
628 | !-- file LSF_DATA respectively |
---|
629 | IF ( ( large_scale_forcing .AND. lsf_surf ) .AND. & |
---|
630 | intermediate_timestep_count == intermediate_timestep_count_max )& |
---|
631 | THEN |
---|
632 | CALL ls_forcing_surf ( simulated_time ) |
---|
633 | ENDIF |
---|
634 | |
---|
635 | ! |
---|
636 | !-- First the vertical fluxes in the Prandtl layer are being computed |
---|
637 | IF ( prandtl_layer ) THEN |
---|
638 | CALL cpu_log( log_point(19), 'prandtl_fluxes', 'start' ) |
---|
639 | CALL prandtl_fluxes |
---|
640 | CALL cpu_log( log_point(19), 'prandtl_fluxes', 'stop' ) |
---|
641 | ENDIF |
---|
642 | |
---|
643 | ! |
---|
644 | !-- Compute the diffusion coefficients |
---|
645 | CALL cpu_log( log_point(17), 'diffusivities', 'start' ) |
---|
646 | IF ( .NOT. humidity ) THEN |
---|
647 | IF ( ocean ) THEN |
---|
648 | CALL diffusivities( prho, prho_reference ) |
---|
649 | ELSE |
---|
650 | CALL diffusivities( pt, pt_reference ) |
---|
651 | ENDIF |
---|
652 | ELSE |
---|
653 | CALL diffusivities( vpt, pt_reference ) |
---|
654 | ENDIF |
---|
655 | CALL cpu_log( log_point(17), 'diffusivities', 'stop' ) |
---|
656 | |
---|
657 | ENDIF |
---|
658 | |
---|
659 | ENDDO ! Intermediate step loop |
---|
660 | |
---|
661 | ! |
---|
662 | !-- Increase simulation time and output times |
---|
663 | nr_timesteps_this_run = nr_timesteps_this_run + 1 |
---|
664 | current_timestep_number = current_timestep_number + 1 |
---|
665 | simulated_time = simulated_time + dt_3d |
---|
666 | simulated_time_chr = time_to_string( simulated_time ) |
---|
667 | time_since_reference_point = simulated_time - coupling_start_time |
---|
668 | |
---|
669 | IF ( simulated_time >= skip_time_data_output_av ) THEN |
---|
670 | time_do_av = time_do_av + dt_3d |
---|
671 | ENDIF |
---|
672 | IF ( simulated_time >= skip_time_do2d_xy ) THEN |
---|
673 | time_do2d_xy = time_do2d_xy + dt_3d |
---|
674 | ENDIF |
---|
675 | IF ( simulated_time >= skip_time_do2d_xz ) THEN |
---|
676 | time_do2d_xz = time_do2d_xz + dt_3d |
---|
677 | ENDIF |
---|
678 | IF ( simulated_time >= skip_time_do2d_yz ) THEN |
---|
679 | time_do2d_yz = time_do2d_yz + dt_3d |
---|
680 | ENDIF |
---|
681 | IF ( simulated_time >= skip_time_do3d ) THEN |
---|
682 | time_do3d = time_do3d + dt_3d |
---|
683 | ENDIF |
---|
684 | DO mid = 1, masks |
---|
685 | IF ( simulated_time >= skip_time_domask(mid) ) THEN |
---|
686 | time_domask(mid)= time_domask(mid) + dt_3d |
---|
687 | ENDIF |
---|
688 | ENDDO |
---|
689 | time_dvrp = time_dvrp + dt_3d |
---|
690 | IF ( simulated_time >= skip_time_dosp ) THEN |
---|
691 | time_dosp = time_dosp + dt_3d |
---|
692 | ENDIF |
---|
693 | time_dots = time_dots + dt_3d |
---|
694 | IF ( .NOT. first_call_lpm ) THEN |
---|
695 | time_dopts = time_dopts + dt_3d |
---|
696 | ENDIF |
---|
697 | IF ( simulated_time >= skip_time_dopr ) THEN |
---|
698 | time_dopr = time_dopr + dt_3d |
---|
699 | ENDIF |
---|
700 | time_dopr_listing = time_dopr_listing + dt_3d |
---|
701 | time_run_control = time_run_control + dt_3d |
---|
702 | |
---|
703 | ! |
---|
704 | !-- Data exchange between coupled models |
---|
705 | IF ( coupling_mode /= 'uncoupled' .AND. run_coupled ) THEN |
---|
706 | time_coupling = time_coupling + dt_3d |
---|
707 | |
---|
708 | ! |
---|
709 | !-- In case of model termination initiated by the local model |
---|
710 | !-- (terminate_coupled > 0), the coupler must be skipped because it would |
---|
711 | !-- cause an MPI intercomminucation hang. |
---|
712 | !-- If necessary, the coupler will be called at the beginning of the |
---|
713 | !-- next restart run. |
---|
714 | DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 ) |
---|
715 | CALL surface_coupler |
---|
716 | time_coupling = time_coupling - dt_coupling |
---|
717 | ENDDO |
---|
718 | ENDIF |
---|
719 | |
---|
720 | ! |
---|
721 | !-- Execute user-defined actions |
---|
722 | CALL user_actions( 'after_integration' ) |
---|
723 | |
---|
724 | ! |
---|
725 | !-- If Galilei transformation is used, determine the distance that the |
---|
726 | !-- model has moved so far |
---|
727 | IF ( galilei_transformation ) THEN |
---|
728 | advected_distance_x = advected_distance_x + u_gtrans * dt_3d |
---|
729 | advected_distance_y = advected_distance_y + v_gtrans * dt_3d |
---|
730 | ENDIF |
---|
731 | |
---|
732 | ! |
---|
733 | !-- Check, if restart is necessary (because cpu-time is expiring or |
---|
734 | !-- because it is forced by user) and set stop flag |
---|
735 | !-- This call is skipped if the remote model has already initiated a restart. |
---|
736 | IF ( .NOT. terminate_run ) CALL check_for_restart |
---|
737 | |
---|
738 | ! |
---|
739 | !-- Carry out statistical analysis and output at the requested output times. |
---|
740 | !-- The MOD function is used for calculating the output time counters (like |
---|
741 | !-- time_dopr) in order to regard a possible decrease of the output time |
---|
742 | !-- interval in case of restart runs |
---|
743 | |
---|
744 | ! |
---|
745 | !-- Set a flag indicating that so far no statistics have been created |
---|
746 | !-- for this time step |
---|
747 | flow_statistics_called = .FALSE. |
---|
748 | |
---|
749 | ! |
---|
750 | !-- If required, call flow_statistics for averaging in time |
---|
751 | IF ( averaging_interval_pr /= 0.0_wp .AND. & |
---|
752 | ( dt_dopr - time_dopr ) <= averaging_interval_pr .AND. & |
---|
753 | simulated_time >= skip_time_dopr ) THEN |
---|
754 | time_dopr_av = time_dopr_av + dt_3d |
---|
755 | IF ( time_dopr_av >= dt_averaging_input_pr ) THEN |
---|
756 | do_sum = .TRUE. |
---|
757 | time_dopr_av = MOD( time_dopr_av, & |
---|
758 | MAX( dt_averaging_input_pr, dt_3d ) ) |
---|
759 | ENDIF |
---|
760 | ENDIF |
---|
761 | IF ( do_sum ) CALL flow_statistics |
---|
762 | |
---|
763 | ! |
---|
764 | !-- Sum-up 3d-arrays for later output of time-averaged 2d/3d/masked data |
---|
765 | IF ( averaging_interval /= 0.0_wp .AND. & |
---|
766 | ( dt_data_output_av - time_do_av ) <= averaging_interval .AND. & |
---|
767 | simulated_time >= skip_time_data_output_av ) & |
---|
768 | THEN |
---|
769 | time_do_sla = time_do_sla + dt_3d |
---|
770 | IF ( time_do_sla >= dt_averaging_input ) THEN |
---|
771 | CALL sum_up_3d_data |
---|
772 | average_count_3d = average_count_3d + 1 |
---|
773 | time_do_sla = MOD( time_do_sla, MAX( dt_averaging_input, dt_3d ) ) |
---|
774 | ENDIF |
---|
775 | ENDIF |
---|
776 | |
---|
777 | ! |
---|
778 | !-- Calculate spectra for time averaging |
---|
779 | IF ( averaging_interval_sp /= 0.0_wp .AND. & |
---|
780 | ( dt_dosp - time_dosp ) <= averaging_interval_sp .AND. & |
---|
781 | simulated_time >= skip_time_dosp ) THEN |
---|
782 | time_dosp_av = time_dosp_av + dt_3d |
---|
783 | IF ( time_dosp_av >= dt_averaging_input_pr ) THEN |
---|
784 | CALL calc_spectra |
---|
785 | time_dosp_av = MOD( time_dosp_av, & |
---|
786 | MAX( dt_averaging_input_pr, dt_3d ) ) |
---|
787 | ENDIF |
---|
788 | ENDIF |
---|
789 | |
---|
790 | ! |
---|
791 | !-- Computation and output of run control parameters. |
---|
792 | !-- This is also done whenever perturbations have been imposed |
---|
793 | IF ( time_run_control >= dt_run_control .OR. & |
---|
794 | timestep_scheme(1:5) /= 'runge' .OR. disturbance_created ) & |
---|
795 | THEN |
---|
796 | CALL run_control |
---|
797 | IF ( time_run_control >= dt_run_control ) THEN |
---|
798 | time_run_control = MOD( time_run_control, & |
---|
799 | MAX( dt_run_control, dt_3d ) ) |
---|
800 | ENDIF |
---|
801 | ENDIF |
---|
802 | |
---|
803 | ! |
---|
804 | !-- Profile output (ASCII) on file |
---|
805 | IF ( time_dopr_listing >= dt_dopr_listing ) THEN |
---|
806 | CALL print_1d |
---|
807 | time_dopr_listing = MOD( time_dopr_listing, MAX( dt_dopr_listing, & |
---|
808 | dt_3d ) ) |
---|
809 | ENDIF |
---|
810 | |
---|
811 | ! |
---|
812 | !-- Graphic output for PROFIL |
---|
813 | IF ( time_dopr >= dt_dopr ) THEN |
---|
814 | IF ( dopr_n /= 0 ) CALL data_output_profiles |
---|
815 | time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_3d ) ) |
---|
816 | time_dopr_av = 0.0_wp ! due to averaging (see above) |
---|
817 | ENDIF |
---|
818 | |
---|
819 | ! |
---|
820 | !-- Graphic output for time series |
---|
821 | IF ( time_dots >= dt_dots ) THEN |
---|
822 | CALL data_output_tseries |
---|
823 | time_dots = MOD( time_dots, MAX( dt_dots, dt_3d ) ) |
---|
824 | ENDIF |
---|
825 | |
---|
826 | ! |
---|
827 | !-- Output of spectra (formatted for use with PROFIL), in case of no |
---|
828 | !-- time averaging, spectra has to be calculated before |
---|
829 | IF ( time_dosp >= dt_dosp ) THEN |
---|
830 | IF ( average_count_sp == 0 ) CALL calc_spectra |
---|
831 | CALL data_output_spectra |
---|
832 | time_dosp = MOD( time_dosp, MAX( dt_dosp, dt_3d ) ) |
---|
833 | ENDIF |
---|
834 | |
---|
835 | ! |
---|
836 | !-- 2d-data output (cross-sections) |
---|
837 | IF ( time_do2d_xy >= dt_do2d_xy ) THEN |
---|
838 | CALL data_output_2d( 'xy', 0 ) |
---|
839 | time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) ) |
---|
840 | ENDIF |
---|
841 | IF ( time_do2d_xz >= dt_do2d_xz ) THEN |
---|
842 | CALL data_output_2d( 'xz', 0 ) |
---|
843 | time_do2d_xz = MOD( time_do2d_xz, MAX( dt_do2d_xz, dt_3d ) ) |
---|
844 | ENDIF |
---|
845 | IF ( time_do2d_yz >= dt_do2d_yz ) THEN |
---|
846 | CALL data_output_2d( 'yz', 0 ) |
---|
847 | time_do2d_yz = MOD( time_do2d_yz, MAX( dt_do2d_yz, dt_3d ) ) |
---|
848 | ENDIF |
---|
849 | |
---|
850 | ! |
---|
851 | !-- 3d-data output (volume data) |
---|
852 | IF ( time_do3d >= dt_do3d ) THEN |
---|
853 | CALL data_output_3d( 0 ) |
---|
854 | time_do3d = MOD( time_do3d, MAX( dt_do3d, dt_3d ) ) |
---|
855 | ENDIF |
---|
856 | |
---|
857 | ! |
---|
858 | !-- masked data output |
---|
859 | !-- Parallel netcdf output is not tested so far for masked data, hence |
---|
860 | !-- netcdf_data_format is switched back to non-paralell output. |
---|
861 | netcdf_data_format_save = netcdf_data_format |
---|
862 | IF ( netcdf_data_format == 5 ) netcdf_data_format = 3 |
---|
863 | IF ( netcdf_data_format == 6 ) netcdf_data_format = 4 |
---|
864 | DO mid = 1, masks |
---|
865 | IF ( time_domask(mid) >= dt_domask(mid) ) THEN |
---|
866 | CALL data_output_mask( 0 ) |
---|
867 | time_domask(mid) = MOD( time_domask(mid), & |
---|
868 | MAX( dt_domask(mid), dt_3d ) ) |
---|
869 | ENDIF |
---|
870 | ENDDO |
---|
871 | netcdf_data_format = netcdf_data_format_save |
---|
872 | |
---|
873 | ! |
---|
874 | !-- Output of time-averaged 2d/3d/masked data |
---|
875 | IF ( time_do_av >= dt_data_output_av ) THEN |
---|
876 | CALL average_3d_data |
---|
877 | CALL data_output_2d( 'xy', 1 ) |
---|
878 | CALL data_output_2d( 'xz', 1 ) |
---|
879 | CALL data_output_2d( 'yz', 1 ) |
---|
880 | CALL data_output_3d( 1 ) |
---|
881 | !-- Parallel netcdf output is not tested so far for masked data, hence |
---|
882 | !-- netcdf_data_format is switched back to non-paralell output. |
---|
883 | netcdf_data_format_save = netcdf_data_format |
---|
884 | IF ( netcdf_data_format == 5 ) netcdf_data_format = 3 |
---|
885 | IF ( netcdf_data_format == 6 ) netcdf_data_format = 4 |
---|
886 | DO mid = 1, masks |
---|
887 | CALL data_output_mask( 1 ) |
---|
888 | ENDDO |
---|
889 | netcdf_data_format = netcdf_data_format_save |
---|
890 | time_do_av = MOD( time_do_av, MAX( dt_data_output_av, dt_3d ) ) |
---|
891 | ENDIF |
---|
892 | |
---|
893 | ! |
---|
894 | !-- Output of particle time series |
---|
895 | IF ( particle_advection ) THEN |
---|
896 | IF ( time_dopts >= dt_dopts .OR. & |
---|
897 | ( simulated_time >= particle_advection_start .AND. & |
---|
898 | first_call_lpm ) ) THEN |
---|
899 | CALL data_output_ptseries |
---|
900 | time_dopts = MOD( time_dopts, MAX( dt_dopts, dt_3d ) ) |
---|
901 | ENDIF |
---|
902 | ENDIF |
---|
903 | |
---|
904 | ! |
---|
905 | !-- Output of dvrp-graphics (isosurface, particles, slicer) |
---|
906 | #if defined( __dvrp_graphics ) |
---|
907 | CALL DVRP_LOG_EVENT( -2, current_timestep_number-1 ) |
---|
908 | #endif |
---|
909 | IF ( time_dvrp >= dt_dvrp ) THEN |
---|
910 | CALL data_output_dvrp |
---|
911 | time_dvrp = MOD( time_dvrp, MAX( dt_dvrp, dt_3d ) ) |
---|
912 | ENDIF |
---|
913 | #if defined( __dvrp_graphics ) |
---|
914 | CALL DVRP_LOG_EVENT( 2, current_timestep_number ) |
---|
915 | #endif |
---|
916 | |
---|
917 | ! |
---|
918 | !-- If required, set the heat flux for the next time step at a random value |
---|
919 | IF ( constant_heatflux .AND. random_heatflux ) CALL disturb_heatflux |
---|
920 | |
---|
921 | ! |
---|
922 | !-- Execute user-defined actions |
---|
923 | CALL user_actions( 'after_timestep' ) |
---|
924 | |
---|
925 | CALL cpu_log( log_point_s(10), 'timesteps', 'stop' ) |
---|
926 | |
---|
927 | |
---|
928 | ENDDO ! time loop |
---|
929 | |
---|
930 | #if defined( __dvrp_graphics ) |
---|
931 | CALL DVRP_LOG_EVENT( -2, current_timestep_number ) |
---|
932 | #endif |
---|
933 | |
---|
934 | END SUBROUTINE time_integration |
---|