source: palm/trunk/SOURCE/time_integration.f90 @ 1764

Last change on this file since 1764 was 1764, checked in by raasch, 8 years ago

update of the nested domain system + some bugfixes

  • Property svn:keywords set to Id
File size: 45.6 KB
RevLine 
[1682]1!> @file time_integration.f90
[1036]2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
[1691]16! Copyright 1997-2015 Leibniz Universitaet Hannover
[1036]17!--------------------------------------------------------------------------------!
18!
[484]19! Current revisions:
[1092]20! ------------------
[1764]21! PMC_ACTIVE flags removed,
22! nest synchronization after first call of timestep
[1737]23!
[1366]24! Former revisions:
25! -----------------
26! $Id: time_integration.f90 1764 2016-02-28 12:45:19Z raasch $
27!
[1763]28! 1762 2016-02-25 12:31:13Z hellstea
29! Introduction of nested domain feature
30!
[1737]31! 1736 2015-12-04 08:56:33Z raasch
32! no perturbations added to total domain if energy limit has been set zero
33!
[1692]34! 1691 2015-10-26 16:17:44Z maronga
35! Added option for spin-ups without land surface and radiation models. Moved calls
36! for radiation and lan surface schemes.
37!
[1683]38! 1682 2015-10-07 23:56:08Z knoop
39! Code annotations made doxygen readable
40!
[1672]41! 1671 2015-09-25 03:29:37Z raasch
42! bugfix: ghostpoint exchange for array diss in case that sgs velocities are used
43! for particles
44!
[1586]45! 1585 2015-04-30 07:05:52Z maronga
46! Moved call of radiation scheme. Added support for RRTM
47!
[1552]48! 1551 2015-03-03 14:18:16Z maronga
49! Added interface for different radiation schemes.
50!
[1497]51! 1496 2014-12-02 17:25:50Z maronga
52! Added calls for the land surface model and radiation scheme
53!
[1403]54! 1402 2014-05-09 14:25:13Z raasch
55! location messages modified
56!
[1385]57! 1384 2014-05-02 14:31:06Z raasch
58! location messages added
59!
[1381]60! 1380 2014-04-28 12:40:45Z heinze
61! CALL of nudge_ref added
62! bc_pt_t_val and bc_q_t_val are updated in case nudging is used
63!
[1366]64! 1365 2014-04-22 15:03:56Z boeske
[1365]65! Reset sums_ls_l to zero at each timestep
66! +sums_ls_l
67! Calculation of reference state (previously in subroutine calc_mean_profile)
68
[1343]69! 1342 2014-03-26 17:04:47Z kanani
70! REAL constants defined as wp-kind
71!
[1321]72! 1320 2014-03-20 08:40:49Z raasch
[1320]73! ONLY-attribute added to USE-statements,
74! kind-parameters added to all INTEGER and REAL declaration statements,
75! kinds are defined in new module kinds,
76! old module precision_kind is removed,
77! revision history before 2012 removed,
78! comment fields (!:) to be used for variable explanations added to
79! all variable declaration statements
[1319]80! 1318 2014-03-17 13:35:16Z raasch
81! module interfaces removed
82!
[1309]83! 1308 2014-03-13 14:58:42Z fricke
84! +netcdf_data_format_save
85! For masked data, parallel netcdf output is not tested so far, hence
86! netcdf_data_format is switched back to non-paralell output.
87!
[1277]88! 1276 2014-01-15 13:40:41Z heinze
89! Use LSF_DATA also in case of Dirichlet bottom boundary condition for scalars
90!
[1258]91! 1257 2013-11-08 15:18:40Z raasch
92! acc-update-host directive for timestep removed
93!
[1242]94! 1241 2013-10-30 11:36:58Z heinze
95! Generalize calc_mean_profile for wider use
96! Determine shf and qsws in dependence on data from LSF_DATA
97! Determine ug and vg in dependence on data from LSF_DATA
[1222]98! 1221 2013-09-10 08:59:13Z raasch
99! host update of arrays before timestep is called
100!
[1182]101! 1179 2013-06-14 05:57:58Z raasch
102! mean profiles for reference state are only calculated if required,
103! small bugfix for background communication
104!
[1172]105! 1171 2013-05-30 11:27:45Z raasch
106! split of prognostic_equations deactivated (comment lines), for the time being
107!
[1132]108! 1128 2013-04-12 06:19:32Z raasch
[1128]109! asynchronous transfer of ghost point data realized for acc-optimized version:
110! prognostic_equations are first called two times for those points required for
111! the left-right and north-south exchange, respectively, and then for the
112! remaining points,
113! those parts requiring global communication moved from prognostic_equations to
114! here
[392]115!
[1116]116! 1115 2013-03-26 18:16:16Z hoffmann
117! calculation of qr and nr is restricted to precipitation
118!
[1114]119! 1113 2013-03-10 02:48:14Z raasch
120! GPU-porting of boundary conditions,
121! openACC directives updated
122! formal parameter removed from routine boundary_conds
123!
[1112]124! 1111 2013-03-08 23:54:10Z raasch
125! +internal timestep counter for cpu statistics added,
126! openACC directives updated
127!
[1093]128! 1092 2013-02-02 11:24:22Z raasch
129! unused variables removed
130!
[1066]131! 1065 2012-11-22 17:42:36Z hoffmann
132! exchange of diss (dissipation rate) in case of turbulence = .TRUE. added
133!
[1054]134! 1053 2012-11-13 17:11:03Z hoffmann
135! exchange of ghost points for nr, qr added
136!
[1037]137! 1036 2012-10-22 13:43:42Z raasch
138! code put under GPL (PALM 3.9)
139!
[1020]140! 1019 2012-09-28 06:46:45Z raasch
141! non-optimized version of prognostic_equations removed
142!
[1017]143! 1015 2012-09-27 09:23:24Z raasch
144! +call of prognostic_equations_acc
145!
[1002]146! 1001 2012-09-13 14:08:46Z raasch
147! all actions concerning leapfrog- and upstream-spline-scheme removed
148!
[850]149! 849 2012-03-15 10:35:09Z raasch
150! advec_particles renamed lpm, first_call_advec_particles renamed first_call_lpm
151!
[826]152! 825 2012-02-19 03:03:44Z raasch
153! wang_collision_kernel renamed wang_kernel
154!
[1]155! Revision 1.1  1997/08/11 06:19:04  raasch
156! Initial revision
157!
158!
159! Description:
160! ------------
[1682]161!> Integration in time of the model equations, statistical analysis and graphic
162!> output
[1]163!------------------------------------------------------------------------------!
[1682]164 SUBROUTINE time_integration
165 
[1]166
[1320]167    USE advec_ws,                                                              &
168        ONLY:  ws_statistics
169
170    USE arrays_3d,                                                             &
[1762]171        ONLY:  diss, dzu, e, e_p, nr_p, prho, pt, pt_p, pt_init, q_init, q,    &
172               ql, ql_c, ql_v, ql_vp, qr_p, q_p, ref_state, rho, sa_p, tend,   &
173               u, u_p, v, vpt, v_p, w, w_p
[1320]174
[1365]175    USE calc_mean_profile_mod,                                                 &
[1320]176        ONLY:  calc_mean_profile
177
178    USE control_parameters,                                                    &
179        ONLY:  advected_distance_x, advected_distance_y, average_count_3d,     &
180               average_count_sp, averaging_interval, averaging_interval_pr,    &
[1380]181               averaging_interval_sp, bc_lr_cyc, bc_ns_cyc, bc_pt_t_val,       &
182               bc_q_t_val, call_psolver_at_all_substeps, cloud_droplets,       &
[1691]183               cloud_physics, constant_flux_layer, constant_heatflux,          &
184               create_disturbances, dopr_n, constant_diffusion, coupling_mode, &
185               coupling_start_time, current_timestep_number,                   &
186               disturbance_created, disturbance_energy_limit, dist_range,      &
187               do_sum, dt_3d, dt_averaging_input, dt_averaging_input_pr,       &
188               dt_coupling, dt_data_output_av, dt_disturb, dt_do2d_xy,         &
189               dt_do2d_xz, dt_do2d_yz, dt_do3d, dt_domask,dt_dopts, dt_dopr,   &
[1320]190               dt_dopr_listing, dt_dosp, dt_dots, dt_dvrp, dt_run_control,     &
191               end_time, first_call_lpm, galilei_transformation, humidity,     &
192               icloud_scheme, intermediate_timestep_count,                     &
193               intermediate_timestep_count_max, large_scale_forcing,           &
[1762]194               loop_optimization, lsf_surf, lsf_vert, masks, mid, nest_domain, &
[1365]195               netcdf_data_format, neutral, nr_timesteps_this_run, nudging,    &
[1691]196               ocean, on_device, passive_scalar, precipitation,                &
[1320]197               prho_reference, pt_reference, pt_slope_offset, random_heatflux, &
198               run_coupled, simulated_time, simulated_time_chr,                &
199               skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz,        &
200               skip_time_do3d, skip_time_domask, skip_time_dopr,               &
201               skip_time_dosp, skip_time_data_output_av, sloping_surface,      &
202               stop_dt, terminate_coupled, terminate_run, timestep_scheme,     &
203               time_coupling, time_do2d_xy, time_do2d_xz, time_do2d_yz,        &
204               time_do3d, time_domask, time_dopr, time_dopr_av,                &
205               time_dopr_listing, time_dopts, time_dosp, time_dosp_av,         &
206               time_dots, time_do_av, time_do_sla, time_disturb, time_dvrp,    &
[1496]207               time_run_control, time_since_reference_point,                   &
208               turbulence,                                                     &
[1320]209               turbulent_inflow, use_initial_profile_as_reference,             &
210               use_single_reference_value, u_gtrans, v_gtrans, ws_scheme_mom,  &
211               ws_scheme_sca
212
213    USE cpulog,                                                                &
214        ONLY:  cpu_log, log_point, log_point_s
215
216    USE indices,                                                               &
217        ONLY:  i_left, i_right, j_north, j_south, nbgp, nx, nxl, nxlg, nxr,    &
[1380]218               nxrg, nyn, nys, nzb, nzt, nzb_u_inner, nzb_v_inner 
[1320]219
220    USE interaction_droplets_ptq_mod,                                          &
221        ONLY:  interaction_droplets_ptq
222
223    USE kinds
224
[1496]225    USE land_surface_model_mod,                                                &
[1691]226        ONLY:  land_surface, lsm_energy_balance, lsm_soil_model,               &
227               skip_time_do_lsm
[1496]228
[1320]229    USE ls_forcing_mod,                                                        &
230        ONLY:  ls_forcing_surf, ls_forcing_vert
231
[1365]232    USE nudge_mod,                                                             &
[1380]233        ONLY:  calc_tnudge, nudge_ref
[1365]234
[1320]235    USE particle_attributes,                                                   &
[1671]236        ONLY:  particle_advection, particle_advection_start,                   &
237               use_sgs_for_particles, wang_kernel
[1320]238
[1]239    USE pegrid
240
[1762]241    USE pmc_interface,                                                         &
[1764]242        ONLY:  client_to_server, nested_run, nesting_mode,                     &
[1762]243               pmci_ensure_nest_mass_conservation, pmci_client_datatrans,      &
244               pmci_client_initialize, pmci_client_synchronize,                &
245               pmci_server_datatrans, pmci_server_initialize,                  &
246               pmci_server_synchronize, pmci_update_new, server_to_client
247
[1320]248    USE production_e_mod,                                                      &
249        ONLY:  production_e_init
250
[1402]251    USE progress_bar,                                                          &
252        ONLY:  finish_progress_bar, output_progress_bar
253
[1320]254    USE prognostic_equations_mod,                                              &
255        ONLY:  prognostic_equations_acc, prognostic_equations_cache,           &
256               prognostic_equations_vector
257
[1496]258    USE radiation_model_mod,                                                   &
[1691]259        ONLY: dt_radiation, force_radiation_call, radiation,                   &
260              radiation_clearsky, radiation_rrtmg, radiation_scheme,           &
261              skip_time_do_radiation, time_radiation
[1496]262
[1320]263    USE statistics,                                                            &
[1365]264        ONLY:  flow_statistics_called, hom, pr_palm, sums_ls_l
[1320]265
[1691]266    USE surface_layer_fluxes_mod,                                              &
267        ONLY:  surface_layer_fluxes
268
[1320]269    USE user_actions_mod,                                                      &
270        ONLY:  user_actions
271
[1]272    IMPLICIT NONE
273
[1682]274    CHARACTER (LEN=9) ::  time_to_string          !<
[1]275
[1682]276    INTEGER(iwp)      ::  netcdf_data_format_save !<
[1320]277
[1]278!
279!-- At the beginning of a simulation determine the time step as well as
280!-- determine and print out the run control parameters
[1342]281    IF ( simulated_time == 0.0_wp )  CALL timestep
[667]282
[1764]283!
284!-- Synchronize the timestep in case of nested run.
285!-- The server side must be called first
286    IF ( nested_run )  THEN
287       CALL pmci_server_synchronize
288       CALL pmci_client_synchronize
289    ENDIF
290
[1]291    CALL run_control
292
[108]293!
294!-- Data exchange between coupled models in case that a call has been omitted
295!-- at the end of the previous run of a job chain.
[291]296    IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled )  THEN
[108]297!
298!--    In case of model termination initiated by the local model the coupler
299!--    must not be called because this would again cause an MPI hang.
300       DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 )
301          CALL surface_coupler
302          time_coupling = time_coupling - dt_coupling
303       ENDDO
[1342]304       IF (time_coupling == 0.0_wp .AND. time_since_reference_point < dt_coupling)&
[348]305       THEN
306          time_coupling = time_since_reference_point
307       ENDIF
[108]308    ENDIF
309
[1764]310    IF ( nested_run )  THEN
[1762]311!
[1764]312!--    TO_DO: try to give more meaningful comments here
313!--    Domain nesting: From server to client commmunication
314!--    ( direction=SERVER_TO_CLIENT )
315!--    Nest initial conditions
[1762]316!
[1764]317!--    Send initial condition data from server to client
318       CALL pmci_server_initialize
[1762]319!
[1764]320!--    Receive and interpolate initial data on client
321       CALL pmci_client_initialize
[1762]322!
[1764]323!--    TO_DO, maybe removed
324!--    Obs. Nesting may be unnecessary at this point.
[1762]325!
[1764]326!--    Nest boundary conditions
327       CALL pmci_server_datatrans( server_to_client )
328       CALL pmci_client_datatrans( server_to_client )
[108]329
[1764]330       IF ( nesting_mode == 'two-way' )  THEN
331          CALL pmci_server_datatrans( client_to_server )
332          CALL pmci_client_datatrans( client_to_server )
[1762]333!
[1764]334!--       Exchange_horiz is needed for all server-domains after the anterpolation
335          CALL exchange_horiz( u, nbgp )
336          CALL exchange_horiz( v, nbgp )
337          CALL exchange_horiz( w, nbgp )
338          CALL exchange_horiz( pt, nbgp )
339          IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e, nbgp )
340          intermediate_timestep_count = 0
341          CALL pres
342       ENDIF
[1762]343!
[1764]344!--    Correct the w top-BC in nest domains to ensure mass conservation.
345!--    Copy the interpolated/anterpolated boundary values to the _p
346!--    arrays, too, to make sure the interpolated/anterpolated boundary
347!--    values are carried over from one RK inner step to another.
348!--    These actions must not be done for the root domain.
349       IF ( nest_domain )  THEN
350          CALL pmci_ensure_nest_mass_conservation
351          CALL pmci_update_new
352       ENDIF
353
[1762]354    ENDIF
355
[1]356#if defined( __dvrp_graphics )
357!
358!-- Time measurement with dvrp software 
359    CALL DVRP_LOG_EVENT( 2, current_timestep_number )
360#endif
361
[1402]362    CALL location_message( 'start with time-stepping', .TRUE. )
[1]363!
364!-- Start of the time loop
365    DO  WHILE ( simulated_time < end_time  .AND.  .NOT. stop_dt  .AND. &
366                .NOT. terminate_run )
367
368       CALL cpu_log( log_point_s(10), 'timesteps', 'start' )
[1221]369
[1]370!
371!--    Determine size of next time step
[1342]372       IF ( simulated_time /= 0.0_wp )  THEN
[1221]373          CALL timestep
[1762]374
[1764]375          IF ( nested_run )  THEN
[1762]376!
[1764]377!--          TO_DO: try to give more detailed and meaningful comments here
378!--          Server side must be called first
379             CALL pmci_server_synchronize
380             CALL pmci_client_synchronize
381          ENDIF
[1221]382       ENDIF
383
[1762]384
[1]385!
[1241]386!--    Determine ug, vg and w_subs in dependence on data from external file
387!--    LSF_DATA
[1365]388       IF ( large_scale_forcing .AND. lsf_vert )  THEN
[1241]389           CALL ls_forcing_vert ( simulated_time )
[1365]390           sums_ls_l = 0.0_wp
[1241]391       ENDIF
392
393!
[1380]394!--    Set pt_init and q_init to the current profiles taken from
395!--    NUDGING_DATA
396       IF ( nudging )  THEN
397           CALL nudge_ref ( simulated_time )
398!
399!--        Store temperature gradient at the top boundary for possible Neumann
400!--        boundary condition
401           bc_pt_t_val = ( pt_init(nzt+1) - pt_init(nzt) ) / dzu(nzt+1)
402           bc_q_t_val  = ( q_init(nzt+1) - q_init(nzt) ) / dzu(nzt+1)
403       ENDIF
404
405!
[1]406!--    Execute the user-defined actions
407       CALL user_actions( 'before_timestep' )
408
409!
410!--    Start of intermediate step loop
411       intermediate_timestep_count = 0
412       DO  WHILE ( intermediate_timestep_count < &
413                   intermediate_timestep_count_max )
414
415          intermediate_timestep_count = intermediate_timestep_count + 1
416
417!
418!--       Set the steering factors for the prognostic equations which depend
419!--       on the timestep scheme
420          CALL timestep_scheme_steering
421
422!
[1128]423!--       Calculate those variables needed in the tendency terms which need
424!--       global communication
[1179]425          IF ( .NOT. use_single_reference_value  .AND. &
426               .NOT. use_initial_profile_as_reference )  THEN
427!
428!--          Horizontally averaged profiles to be used as reference state in
429!--          buoyancy terms (WARNING: only the respective last call of
430!--          calc_mean_profile defines the reference state!)
[1365]431             IF ( .NOT. neutral )  THEN
432                CALL calc_mean_profile( pt, 4 )
433                ref_state(:)  = hom(:,1,4,0) ! this is used in the buoyancy term
434             ENDIF
435             IF ( ocean )  THEN
436                CALL calc_mean_profile( rho, 64 )
437                ref_state(:)  = hom(:,1,64,0)
438             ENDIF
439             IF ( humidity )  THEN
440                CALL calc_mean_profile( vpt, 44 )
441                ref_state(:)  = hom(:,1,44,0)
442             ENDIF
443
[1179]444          ENDIF
445
[1128]446          IF ( .NOT. constant_diffusion )  CALL production_e_init
447          IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
448               intermediate_timestep_count == 1 )  CALL ws_statistics
[1365]449!
450!--       In case of nudging calculate current nudging time scale and horizontal
[1380]451!--       means of u, v, pt and q
[1365]452          IF ( nudging )  THEN
453             CALL calc_tnudge( simulated_time )
454             CALL calc_mean_profile( u, 1 )
455             CALL calc_mean_profile( v, 2 )
456             CALL calc_mean_profile( pt, 4 )
457             CALL calc_mean_profile( q, 41 )
458          ENDIF
[1128]459
460!
[1]461!--       Solve the prognostic equations. A fast cache optimized version with
462!--       only one single loop is used in case of Piascek-Williams advection
463!--       scheme. NEC vector machines use a different version, because
464!--       in the other versions a good vectorization is prohibited due to
465!--       inlining problems.
[1019]466          IF ( loop_optimization == 'cache' )  THEN
467             CALL prognostic_equations_cache
468          ELSEIF ( loop_optimization == 'vector' )  THEN
[63]469             CALL prognostic_equations_vector
[1015]470          ELSEIF ( loop_optimization == 'acc' )  THEN
[1171]471             i_left  = nxl;         i_right = nxr
472             j_south = nys;         j_north = nyn
473             CALL prognostic_equations_acc
474
475!             i_left  = nxl;         i_right = nxl+nbgp-1
[1128]476!             j_south = nys;         j_north = nyn
477!             CALL prognostic_equations_acc
[1171]478!             i_left  = nxr-nbgp+1;  i_right = nxr
479!             j_south = nys;         j_north = nyn
480!             CALL prognostic_equations_acc
[1128]481
482!
483!--          Exchange of ghost points (lateral boundary conditions)
484             IF ( background_communication )  THEN
485
486                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
487               
488                send_receive = 'lr'
489                sendrecv_in_background = .TRUE.
490                req          = 0
491                req_count    = 0
492
493                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
494                   on_device = .TRUE.         ! to be removed after complete porting
495                ELSE                          ! of ghost point exchange
496                   !$acc update host( e_p, pt_p, u_p, v_p, w_p )
497                ENDIF
498
499                CALL exchange_horiz( u_p, nbgp )
500                CALL exchange_horiz( v_p, nbgp )
501                CALL exchange_horiz( w_p, nbgp )
502                CALL exchange_horiz( pt_p, nbgp )
503                IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
504                IF ( ocean )  THEN
505                   CALL exchange_horiz( sa_p, nbgp )
506                   CALL exchange_horiz( rho, nbgp )
507                  CALL exchange_horiz( prho, nbgp )
508                ENDIF
509                IF (humidity  .OR.  passive_scalar)  THEN
510                   CALL exchange_horiz( q_p, nbgp )
511                   IF ( cloud_physics .AND. icloud_scheme == 0 )  THEN
512                      CALL exchange_horiz( qr_p, nbgp )
513                      CALL exchange_horiz( nr_p, nbgp )
514                   ENDIF
515                ENDIF
516                IF ( cloud_droplets )  THEN
517                   CALL exchange_horiz( ql, nbgp )
518                   CALL exchange_horiz( ql_c, nbgp )
519                   CALL exchange_horiz( ql_v, nbgp )
520                   CALL exchange_horiz( ql_vp, nbgp )
521                ENDIF
[1671]522                IF ( wang_kernel  .OR.  turbulence  .OR.  use_sgs_for_particles ) &
523                THEN
524                   CALL exchange_horiz( diss, nbgp )
525                ENDIF
[1128]526
527                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
528                   on_device = .FALSE.        ! to be removed after complete porting
529                ELSE                          ! of ghost point exchange
530                   !$acc update device( e_p, pt_p, u_p, v_p, w_p )
531                ENDIF
532
533                sendrecv_in_background = .FALSE.
534
535                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'pause' )
536
537             ENDIF
538
[1171]539!             i_left  = nxl+nbgp;    i_right = nxr-nbgp
540!             j_south = nys;         j_north = nys+nbgp-1
541!             CALL prognostic_equations_acc
542!             i_left  = nxl+nbgp;    i_right = nxr-nbgp
543!             j_south = nyn-nbgp+1;  j_north = nyn
544!             CALL prognostic_equations_acc
[1128]545
546             IF ( background_communication )  THEN
547                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'start' )
548#if defined( __parallel )
549                CALL MPI_WAITALL( req_count, req, wait_stat, ierr )
550#endif
551                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'pause' )
552
553                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'continue' )
554
555                send_receive = 'ns'
556                sendrecv_in_background = .TRUE.
557                req          = 0
558                req_count    = 0
559
560                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
561                   on_device = .TRUE.         ! to be removed after complete porting
562                ELSE                          ! of ghost point exchange
563                   !$acc update host( e_p, pt_p, u_p, v_p, w_p )
564                ENDIF
565
566                CALL exchange_horiz( u_p, nbgp )
567                CALL exchange_horiz( v_p, nbgp )
568                CALL exchange_horiz( w_p, nbgp )
569                CALL exchange_horiz( pt_p, nbgp )
570                IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
571                IF ( ocean )  THEN
572                   CALL exchange_horiz( sa_p, nbgp )
573                   CALL exchange_horiz( rho, nbgp )
574                  CALL exchange_horiz( prho, nbgp )
575                ENDIF
576                IF (humidity  .OR.  passive_scalar)  THEN
577                   CALL exchange_horiz( q_p, nbgp )
578                   IF ( cloud_physics .AND. icloud_scheme == 0 )  THEN
579                      CALL exchange_horiz( qr_p, nbgp )
580                      CALL exchange_horiz( nr_p, nbgp )
581                   ENDIF
582                ENDIF
583                IF ( cloud_droplets )  THEN
584                   CALL exchange_horiz( ql, nbgp )
585                   CALL exchange_horiz( ql_c, nbgp )
586                   CALL exchange_horiz( ql_v, nbgp )
587                   CALL exchange_horiz( ql_vp, nbgp )
588                ENDIF
[1671]589                IF ( wang_kernel  .OR.  turbulence  .OR.  use_sgs_for_particles ) &
590                THEN
591                   CALL exchange_horiz( diss, nbgp )
592                ENDIF
[1128]593
594                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
595                   on_device = .FALSE.        ! to be removed after complete porting
596                ELSE                          ! of ghost point exchange
597                   !$acc update device( e_p, pt_p, u_p, v_p, w_p )
598                ENDIF
599
600                sendrecv_in_background = .FALSE.
601
602                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
603
604             ENDIF
605
[1171]606!             i_left  = nxl+nbgp;    i_right = nxr-nbgp
607!             j_south = nys+nbgp;    j_north = nyn-nbgp
608!             CALL prognostic_equations_acc
[1128]609
610             IF ( background_communication )  THEN
611                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'continue' )
612#if defined( __parallel )
613                CALL MPI_WAITALL( req_count, req, wait_stat, ierr )
614#endif
615                send_receive = 'al'
616                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'stop' )
617             ENDIF
618
[1]619          ENDIF
620
621!
[849]622!--       Particle transport/physics with the Lagrangian particle model
623!--       (only once during intermediate steps, because it uses an Euler-step)
[1128]624!--       ### particle model should be moved before prognostic_equations, in order
625!--       to regard droplet interactions directly
[63]626          IF ( particle_advection  .AND.                         &
627               simulated_time >= particle_advection_start  .AND. &
[1]628               intermediate_timestep_count == 1 )  THEN
[849]629             CALL lpm
630             first_call_lpm = .FALSE.
[1]631          ENDIF
632
633!
634!--       Interaction of droplets with temperature and specific humidity.
635!--       Droplet condensation and evaporation is calculated within
636!--       advec_particles.
637          IF ( cloud_droplets  .AND.  &
638               intermediate_timestep_count == intermediate_timestep_count_max )&
639          THEN
640             CALL interaction_droplets_ptq
641          ENDIF
642
643!
644!--       Exchange of ghost points (lateral boundary conditions)
[1128]645          IF ( .NOT. background_communication )  THEN
[1113]646
[1128]647             CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
[1113]648
[1128]649             IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
650                on_device = .TRUE.         ! to be removed after complete porting
651             ELSE                          ! of ghost point exchange
652                !$acc update host( e_p, pt_p, u_p, v_p, w_p )
[1053]653             ENDIF
[1]654
[1128]655             CALL exchange_horiz( u_p, nbgp )
656             CALL exchange_horiz( v_p, nbgp )
657             CALL exchange_horiz( w_p, nbgp )
658             CALL exchange_horiz( pt_p, nbgp )
659             IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
660             IF ( ocean )  THEN
661                CALL exchange_horiz( sa_p, nbgp )
662                CALL exchange_horiz( rho, nbgp )
663                CALL exchange_horiz( prho, nbgp )
664             ENDIF
665             IF (humidity  .OR.  passive_scalar)  THEN
666                CALL exchange_horiz( q_p, nbgp )
[1179]667                IF ( cloud_physics .AND. icloud_scheme == 0  .AND.  &
668                     precipitation )  THEN
[1128]669                   CALL exchange_horiz( qr_p, nbgp )
670                   CALL exchange_horiz( nr_p, nbgp )
671                ENDIF
672             ENDIF
673             IF ( cloud_droplets )  THEN
674                CALL exchange_horiz( ql, nbgp )
675                CALL exchange_horiz( ql_c, nbgp )
676                CALL exchange_horiz( ql_v, nbgp )
677                CALL exchange_horiz( ql_vp, nbgp )
678             ENDIF
[1671]679             IF ( wang_kernel  .OR.  turbulence  .OR.  use_sgs_for_particles ) &
680             THEN
681                CALL exchange_horiz( diss, nbgp )
682             ENDIF
[1128]683
684             IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
685                on_device = .FALSE.        ! to be removed after complete porting
686             ELSE                          ! of ghost point exchange
687                !$acc update device( e_p, pt_p, u_p, v_p, w_p )
688             ENDIF
689
690             CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
691
[1113]692          ENDIF
693
[1]694!
695!--       Boundary conditions for the prognostic quantities (except of the
696!--       velocities at the outflow in case of a non-cyclic lateral wall)
[1113]697          CALL boundary_conds
[1]698
699!
[73]700!--       Swap the time levels in preparation for the next time step.
701          CALL swap_timelevel
702
[1764]703          IF ( nested_run )  THEN
[73]704!
[1764]705!--          TO_DO: try to give more meaningful comments here
706!--          Domain nesting
707!--          Note that the nesting operations are omitted intentionally on the
708!--          first two RK-substeps.
709             CALL cpu_log( log_point(60), 'nesting', 'start' )
[1762]710!
[1764]711!--          From server to client commmunication ( direction=SERVER_TO_CLIENT )
712             CALL pmci_server_datatrans( server_to_client )
713             CALL pmci_client_datatrans( server_to_client )
[1762]714
[1764]715             IF ( nesting_mode == 'two-way' )  THEN
[1762]716!
[1764]717!--             From client to server commmunication ( direction=CLIENT_TO_SERVER )
718                CALL pmci_server_datatrans( client_to_server )
719                CALL pmci_client_datatrans( client_to_server )
[1762]720!
[1764]721!--             Exchange_horiz is needed for all server-domains after the
722!--             anterpolation
723                CALL exchange_horiz( u, nbgp )
724                CALL exchange_horiz( v, nbgp )
725                CALL exchange_horiz( w, nbgp )
726                CALL exchange_horiz( pt, nbgp )
727                IF ( humidity  .OR.  passive_scalar )  THEN
728                   CALL exchange_horiz( q, nbgp )
729                ENDIF
730                IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e, nbgp )
[1762]731             ENDIF
732!
[1764]733!--          Correct the w top-BC in nest domains to ensure mass conservation.
734!--          This action must never be done for the root domain.
735             IF ( nest_domain )  THEN
736                CALL pmci_ensure_nest_mass_conservation
[1762]737!
[1764]738!--             pmc_update_new is not necessary if nesting is made at each
739!--             substep
740                CALL pmci_update_new
741             ENDIF
742
743             CALL cpu_log( log_point(60), 'nesting', 'stop' )
744
[1762]745          ENDIF
746
747!
[1]748!--       Temperature offset must be imposed at cyclic boundaries in x-direction
749!--       when a sloping surface is used
750          IF ( sloping_surface )  THEN
[707]751             IF ( nxl ==  0 )  pt(:,:,nxlg:nxl-1) = pt(:,:,nxlg:nxl-1) - &
752                                                    pt_slope_offset
753             IF ( nxr == nx )  pt(:,:,nxr+1:nxrg) = pt(:,:,nxr+1:nxrg) + &
754                                                    pt_slope_offset
[1]755          ENDIF
756
757!
[151]758!--       Impose a turbulent inflow using the recycling method
759          IF ( turbulent_inflow )  CALL  inflow_turbulence
760
761!
[1]762!--       Impose a random perturbation on the horizontal velocity field
[106]763          IF ( create_disturbances  .AND.                                      &
764               ( call_psolver_at_all_substeps  .AND.                           &
[1]765               intermediate_timestep_count == intermediate_timestep_count_max )&
[106]766          .OR. ( .NOT. call_psolver_at_all_substeps  .AND.                     &
767               intermediate_timestep_count == 1 ) )                            &
[1]768          THEN
769             time_disturb = time_disturb + dt_3d
770             IF ( time_disturb >= dt_disturb )  THEN
[1111]771                !$acc update host( u, v )
[1113]772                IF ( numprocs == 1 )  on_device = .FALSE.  ! workaround, remove later
[1736]773                IF ( disturbance_energy_limit /= 0.0_wp  .AND.                 &
774                     hom(nzb+5,1,pr_palm,0) < disturbance_energy_limit )  THEN
[75]775                   CALL disturb_field( nzb_u_inner, tend, u )
776                   CALL disturb_field( nzb_v_inner, tend, v )
[707]777                ELSEIF ( .NOT. bc_lr_cyc  .OR.  .NOT. bc_ns_cyc )  THEN
[1]778!
779!--                Runs with a non-cyclic lateral wall need perturbations
780!--                near the inflow throughout the whole simulation
781                   dist_range = 1
[75]782                   CALL disturb_field( nzb_u_inner, tend, u )
783                   CALL disturb_field( nzb_v_inner, tend, v )
[1]784                   dist_range = 0
785                ENDIF
[1113]786                IF ( numprocs == 1 )  on_device = .TRUE.  ! workaround, remove later
[1111]787                !$acc update device( u, v )
[1]788                time_disturb = time_disturb - dt_disturb
789             ENDIF
790          ENDIF
791
792!
793!--       Reduce the velocity divergence via the equation for perturbation
794!--       pressure.
[106]795          IF ( intermediate_timestep_count == 1  .OR. &
796                call_psolver_at_all_substeps )  THEN
[1]797             CALL pres
798          ENDIF
799
800!
801!--       If required, compute liquid water content
[1015]802          IF ( cloud_physics )  THEN
803             CALL calc_liquid_water_content
804             !$acc update device( ql )
805          ENDIF
[1115]806!
807!--       If required, compute virtual potential temperature
808          IF ( humidity )  THEN
809             CALL compute_vpt 
810             !$acc update device( vpt )
811          ENDIF 
[1585]812
[1]813!
814!--       Compute the diffusion quantities
815          IF ( .NOT. constant_diffusion )  THEN
816
817!
[1276]818!--          Determine surface fluxes shf and qsws and surface values
819!--          pt_surface and q_surface in dependence on data from external
820!--          file LSF_DATA respectively
821             IF ( ( large_scale_forcing .AND. lsf_surf ) .AND. &
822                 intermediate_timestep_count == intermediate_timestep_count_max )&
823             THEN
824                CALL ls_forcing_surf ( simulated_time )
825             ENDIF
826
827!
[1691]828!--          First the vertical fluxes in the surface (constant flux) layer are computed
829             IF ( constant_flux_layer )  THEN
830                CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'start' )
831                CALL surface_layer_fluxes
832                CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'stop' )
[1]833             ENDIF
[1241]834
[1]835!
[1691]836!--          If required, solve the energy balance for the surface and run soil
837!--          model
838             IF ( land_surface .AND. simulated_time > skip_time_do_lsm)  THEN
839
840                CALL cpu_log( log_point(54), 'land_surface', 'start' )
841                CALL lsm_energy_balance
842                CALL lsm_soil_model
843                CALL cpu_log( log_point(54), 'land_surface', 'stop' )
844             ENDIF
845!
[1]846!--          Compute the diffusion coefficients
847             CALL cpu_log( log_point(17), 'diffusivities', 'start' )
[75]848             IF ( .NOT. humidity ) THEN
[97]849                IF ( ocean )  THEN
[388]850                   CALL diffusivities( prho, prho_reference )
[97]851                ELSE
852                   CALL diffusivities( pt, pt_reference )
853                ENDIF
[1]854             ELSE
[97]855                CALL diffusivities( vpt, pt_reference )
[1]856             ENDIF
857             CALL cpu_log( log_point(17), 'diffusivities', 'stop' )
858
859          ENDIF
860
[1691]861!
862!--       If required, calculate radiative fluxes and heating rates
863          IF ( radiation .AND. intermediate_timestep_count                     &
864               == intermediate_timestep_count_max .AND. simulated_time >    &
865               skip_time_do_radiation )  THEN
866
867               time_radiation = time_radiation + dt_3d
868
869             IF ( time_radiation >= dt_radiation .OR. force_radiation_call )   &
870             THEN
871
872                CALL cpu_log( log_point(50), 'radiation', 'start' )
873
874                IF ( .NOT. force_radiation_call )  THEN
875                   time_radiation = time_radiation - dt_radiation
876                ELSE
877                   WRITE(9,*) "Unscheduled radiation call at ", simulated_time
878                   CALL LOCAL_FLUSH ( 9 )
879                ENDIF
880
881                IF ( radiation_scheme == 'clear-sky' )  THEN
882                   CALL radiation_clearsky
883                ELSEIF ( radiation_scheme == 'rrtmg' )  THEN
884                   CALL radiation_rrtmg
885                ENDIF
886
887                CALL cpu_log( log_point(50), 'radiation', 'stop' )
888             ENDIF
889          ENDIF
890
[1]891       ENDDO   ! Intermediate step loop
892
893!
894!--    Increase simulation time and output times
[1111]895       nr_timesteps_this_run      = nr_timesteps_this_run + 1
[291]896       current_timestep_number    = current_timestep_number + 1
897       simulated_time             = simulated_time   + dt_3d
898       simulated_time_chr         = time_to_string( simulated_time )
899       time_since_reference_point = simulated_time - coupling_start_time
900
[1]901       IF ( simulated_time >= skip_time_data_output_av )  THEN
902          time_do_av         = time_do_av       + dt_3d
903       ENDIF
904       IF ( simulated_time >= skip_time_do2d_xy )  THEN
905          time_do2d_xy       = time_do2d_xy     + dt_3d
906       ENDIF
907       IF ( simulated_time >= skip_time_do2d_xz )  THEN
908          time_do2d_xz       = time_do2d_xz     + dt_3d
909       ENDIF
910       IF ( simulated_time >= skip_time_do2d_yz )  THEN
911          time_do2d_yz       = time_do2d_yz     + dt_3d
912       ENDIF
913       IF ( simulated_time >= skip_time_do3d    )  THEN
914          time_do3d          = time_do3d        + dt_3d
915       ENDIF
[410]916       DO  mid = 1, masks
917          IF ( simulated_time >= skip_time_domask(mid) )  THEN
918             time_domask(mid)= time_domask(mid) + dt_3d
919          ENDIF
920       ENDDO
[1]921       time_dvrp          = time_dvrp        + dt_3d
922       IF ( simulated_time >= skip_time_dosp )  THEN
923          time_dosp       = time_dosp        + dt_3d
924       ENDIF
925       time_dots          = time_dots        + dt_3d
[849]926       IF ( .NOT. first_call_lpm )  THEN
[1]927          time_dopts      = time_dopts       + dt_3d
928       ENDIF
929       IF ( simulated_time >= skip_time_dopr )  THEN
930          time_dopr       = time_dopr        + dt_3d
931       ENDIF
932       time_dopr_listing          = time_dopr_listing        + dt_3d
933       time_run_control   = time_run_control + dt_3d
934
935!
[102]936!--    Data exchange between coupled models
[291]937       IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled )  THEN
[102]938          time_coupling = time_coupling + dt_3d
[343]939
[108]940!
941!--       In case of model termination initiated by the local model
942!--       (terminate_coupled > 0), the coupler must be skipped because it would
943!--       cause an MPI intercomminucation hang.
944!--       If necessary, the coupler will be called at the beginning of the
945!--       next restart run.
946          DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 )
[102]947             CALL surface_coupler
948             time_coupling = time_coupling - dt_coupling
949          ENDDO
950       ENDIF
951
952!
[46]953!--    Execute user-defined actions
954       CALL user_actions( 'after_integration' )
955
956!
[1]957!--    If Galilei transformation is used, determine the distance that the
958!--    model has moved so far
959       IF ( galilei_transformation )  THEN
960          advected_distance_x = advected_distance_x + u_gtrans * dt_3d
961          advected_distance_y = advected_distance_y + v_gtrans * dt_3d
962       ENDIF
963
964!
965!--    Check, if restart is necessary (because cpu-time is expiring or
966!--    because it is forced by user) and set stop flag
[108]967!--    This call is skipped if the remote model has already initiated a restart.
968       IF ( .NOT. terminate_run )  CALL check_for_restart
[1]969
970!
971!--    Carry out statistical analysis and output at the requested output times.
972!--    The MOD function is used for calculating the output time counters (like
973!--    time_dopr) in order to regard a possible decrease of the output time
974!--    interval in case of restart runs
975
976!
977!--    Set a flag indicating that so far no statistics have been created
978!--    for this time step
979       flow_statistics_called = .FALSE.
980
981!
982!--    If required, call flow_statistics for averaging in time
[1342]983       IF ( averaging_interval_pr /= 0.0_wp  .AND.  &
[1]984            ( dt_dopr - time_dopr ) <= averaging_interval_pr  .AND.  &
985            simulated_time >= skip_time_dopr )  THEN
986          time_dopr_av = time_dopr_av + dt_3d
987          IF ( time_dopr_av >= dt_averaging_input_pr )  THEN
988             do_sum = .TRUE.
989             time_dopr_av = MOD( time_dopr_av, &
990                                    MAX( dt_averaging_input_pr, dt_3d ) )
991          ENDIF
992       ENDIF
993       IF ( do_sum )  CALL flow_statistics
994
995!
[410]996!--    Sum-up 3d-arrays for later output of time-averaged 2d/3d/masked data
[1342]997       IF ( averaging_interval /= 0.0_wp  .AND.                                &
[1]998            ( dt_data_output_av - time_do_av ) <= averaging_interval  .AND. &
999            simulated_time >= skip_time_data_output_av )                    &
1000       THEN
1001          time_do_sla = time_do_sla + dt_3d
1002          IF ( time_do_sla >= dt_averaging_input )  THEN
1003             CALL sum_up_3d_data
1004             average_count_3d = average_count_3d + 1
1005             time_do_sla = MOD( time_do_sla, MAX( dt_averaging_input, dt_3d ) )
1006          ENDIF
1007       ENDIF
1008
1009!
1010!--    Calculate spectra for time averaging
[1342]1011       IF ( averaging_interval_sp /= 0.0_wp  .AND.  &
[1]1012            ( dt_dosp - time_dosp ) <= averaging_interval_sp  .AND.  &
1013            simulated_time >= skip_time_dosp )  THEN
1014          time_dosp_av = time_dosp_av + dt_3d
1015          IF ( time_dosp_av >= dt_averaging_input_pr )  THEN
1016             CALL calc_spectra
1017             time_dosp_av = MOD( time_dosp_av, &
1018                                 MAX( dt_averaging_input_pr, dt_3d ) )
1019          ENDIF
1020       ENDIF
1021
1022!
1023!--    Computation and output of run control parameters.
[1001]1024!--    This is also done whenever perturbations have been imposed
[1]1025       IF ( time_run_control >= dt_run_control  .OR.                     &
[1001]1026            timestep_scheme(1:5) /= 'runge'  .OR.  disturbance_created ) &
[1]1027       THEN
1028          CALL run_control
1029          IF ( time_run_control >= dt_run_control )  THEN
1030             time_run_control = MOD( time_run_control, &
1031                                     MAX( dt_run_control, dt_3d ) )
1032          ENDIF
1033       ENDIF
1034
1035!
1036!--    Profile output (ASCII) on file
1037       IF ( time_dopr_listing >= dt_dopr_listing )  THEN
1038          CALL print_1d
1039          time_dopr_listing = MOD( time_dopr_listing, MAX( dt_dopr_listing, &
1040                                                           dt_3d ) )
1041       ENDIF
1042
1043!
1044!--    Graphic output for PROFIL
1045       IF ( time_dopr >= dt_dopr )  THEN
1046          IF ( dopr_n /= 0 )  CALL data_output_profiles
1047          time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_3d ) )
[1342]1048          time_dopr_av = 0.0_wp    ! due to averaging (see above)
[1]1049       ENDIF
1050
1051!
1052!--    Graphic output for time series
1053       IF ( time_dots >= dt_dots )  THEN
[48]1054          CALL data_output_tseries
[1]1055          time_dots = MOD( time_dots, MAX( dt_dots, dt_3d ) )
1056       ENDIF
1057
1058!
1059!--    Output of spectra (formatted for use with PROFIL), in case of no
1060!--    time averaging, spectra has to be calculated before
1061       IF ( time_dosp >= dt_dosp )  THEN
1062          IF ( average_count_sp == 0 )  CALL calc_spectra
1063          CALL data_output_spectra
1064          time_dosp = MOD( time_dosp, MAX( dt_dosp, dt_3d ) )
1065       ENDIF
1066
1067!
1068!--    2d-data output (cross-sections)
1069       IF ( time_do2d_xy >= dt_do2d_xy )  THEN
1070          CALL data_output_2d( 'xy', 0 )
1071          time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) )
1072       ENDIF
1073       IF ( time_do2d_xz >= dt_do2d_xz )  THEN
1074          CALL data_output_2d( 'xz', 0 )
1075          time_do2d_xz = MOD( time_do2d_xz, MAX( dt_do2d_xz, dt_3d ) )
1076       ENDIF
1077       IF ( time_do2d_yz >= dt_do2d_yz )  THEN
1078          CALL data_output_2d( 'yz', 0 )
1079          time_do2d_yz = MOD( time_do2d_yz, MAX( dt_do2d_yz, dt_3d ) )
1080       ENDIF
1081
1082!
1083!--    3d-data output (volume data)
1084       IF ( time_do3d >= dt_do3d )  THEN
1085          CALL data_output_3d( 0 )
1086          time_do3d = MOD( time_do3d, MAX( dt_do3d, dt_3d ) )
1087       ENDIF
1088
1089!
[410]1090!--    masked data output
[1308]1091!--    Parallel netcdf output is not tested so far for masked data, hence
1092!--    netcdf_data_format is switched back to non-paralell output.
1093       netcdf_data_format_save = netcdf_data_format
1094       IF ( netcdf_data_format == 5 ) netcdf_data_format = 3
1095       IF ( netcdf_data_format == 6 ) netcdf_data_format = 4
[410]1096       DO  mid = 1, masks
1097          IF ( time_domask(mid) >= dt_domask(mid) )  THEN
1098             CALL data_output_mask( 0 )
1099             time_domask(mid) = MOD( time_domask(mid),  &
1100                                     MAX( dt_domask(mid), dt_3d ) )
1101          ENDIF
1102       ENDDO
[1308]1103       netcdf_data_format = netcdf_data_format_save
[410]1104
1105!
1106!--    Output of time-averaged 2d/3d/masked data
[1]1107       IF ( time_do_av >= dt_data_output_av )  THEN
1108          CALL average_3d_data
1109          CALL data_output_2d( 'xy', 1 )
1110          CALL data_output_2d( 'xz', 1 )
1111          CALL data_output_2d( 'yz', 1 )
1112          CALL data_output_3d( 1 )
[1308]1113!--       Parallel netcdf output is not tested so far for masked data, hence
1114!--       netcdf_data_format is switched back to non-paralell output.
1115          netcdf_data_format_save = netcdf_data_format
1116          IF ( netcdf_data_format == 5 ) netcdf_data_format = 3
1117          IF ( netcdf_data_format == 6 ) netcdf_data_format = 4
[410]1118          DO  mid = 1, masks
1119             CALL data_output_mask( 1 )
1120          ENDDO
[1308]1121          netcdf_data_format = netcdf_data_format_save
[1]1122          time_do_av = MOD( time_do_av, MAX( dt_data_output_av, dt_3d ) )
1123       ENDIF
1124
1125!
1126!--    Output of particle time series
[253]1127       IF ( particle_advection )  THEN
1128          IF ( time_dopts >= dt_dopts  .OR. &
1129               ( simulated_time >= particle_advection_start  .AND. &
[849]1130                 first_call_lpm ) )  THEN
[253]1131             CALL data_output_ptseries
1132             time_dopts = MOD( time_dopts, MAX( dt_dopts, dt_3d ) )
1133          ENDIF
[1]1134       ENDIF
1135
1136!
1137!--    Output of dvrp-graphics (isosurface, particles, slicer)
1138#if defined( __dvrp_graphics )
1139       CALL DVRP_LOG_EVENT( -2, current_timestep_number-1 )
1140#endif
1141       IF ( time_dvrp >= dt_dvrp )  THEN
1142          CALL data_output_dvrp
1143          time_dvrp = MOD( time_dvrp, MAX( dt_dvrp, dt_3d ) )
1144       ENDIF
1145#if defined( __dvrp_graphics )
1146       CALL DVRP_LOG_EVENT( 2, current_timestep_number )
1147#endif
1148
1149!
1150!--    If required, set the heat flux for the next time step at a random value
1151       IF ( constant_heatflux  .AND.  random_heatflux )  CALL disturb_heatflux
1152
1153!
1154!--    Execute user-defined actions
1155       CALL user_actions( 'after_timestep' )
1156
[1402]1157!
1158!--    Output elapsed simulated time in form of a progress bar on stdout
1159       IF ( myid == 0 )  CALL output_progress_bar
1160
[1]1161       CALL cpu_log( log_point_s(10), 'timesteps', 'stop' )
1162
[667]1163
[1]1164    ENDDO   ! time loop
1165
[1402]1166    IF ( myid == 0 )  CALL finish_progress_bar
1167
[1]1168#if defined( __dvrp_graphics )
1169    CALL DVRP_LOG_EVENT( -2, current_timestep_number )
1170#endif
1171
[1402]1172    CALL location_message( 'finished time-stepping', .TRUE. )
[1384]1173
[1]1174 END SUBROUTINE time_integration
Note: See TracBrowser for help on using the repository browser.