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