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

Last change on this file since 4802 was 4802, checked in by suehring, 3 years ago

Bugfix in time-control of indoor model in case of restarts and at the very first time step

  • Property svn:keywords set to Id
File size: 66.9 KB
Line 
1!> @file time_integration.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! 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-2020 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: time_integration.f90 4802 2020-11-30 14:16:31Z suehring $
27! Bugfix in time-control of indoor model at the very first time step
28!
29! 4732 2020-10-07 14:46:34Z schwenkel
30! Add use statements for OPENACC
31!
32! 4731 2020-10-07 13:25:11Z schwenkel
33! Move exchange_horiz from time_integration to modules
34!
35! 4671 2020-09-09 20:27:58Z pavelkrc
36! Implementation of downward facing USM and LSM surfaces
37!
38! 4669 2020-09-09 13:43:47Z pavelkrc
39! - Fix missing call of radiation after spinup
40! - Fix calculation of force_radiation_call
41! - Fix calculation of radiation times
42!
43! 4668 2020-09-09 13:00:16Z pavelkrc
44! Improve debug messages during timestepping
45!
46! 4581 2020-06-29 08:49:58Z suehring
47! Omit explicit pressure forcing via geostrophic wind components in case of
48! mesoscale nesting.
49!
50! 4578 2020-06-25 15:43:32Z gronemeier
51! bugfix: removed unused variables
52!
53! 4573 2020-06-24 13:08:47Z oliver.maas
54! calculate pt(0) incrementally by using dt_3d instead of calculating it absolutely
55! by using time_since_reference_point, because time_since_reference_point is set
56! to zero for initializing_actions = 'cyclic_fill'
57!
58! 4565 2020-06-15 08:30:38Z oliver.maas
59! added new surface temperature forcing method for bc_pt_b = 'dirichlet':
60! surface temperature pt(0) can be linearly increased by pt_surface_heating_rate (in K/h)
61!
62! 4564 2020-06-12 14:03:36Z raasch
63! Vertical nesting method of Huq et al. (2019) removed
64!
65! 4521 2020-05-06 11:39:49Z schwenkel
66! Rename variable
67!
68! 4511 2020-04-30 12:20:40Z raasch
69! chemistry decycling replaced by explicit setting of lateral boundary conditions
70!
71! 4508 2020-04-24 13:32:20Z raasch
72! salsa decycling replaced by explicit setting of lateral boundary conditions
73!
74! 4502 2020-04-17 16:14:16Z schwenkel
75! Implementation of ice microphysics
76!
77! 4472 2020-03-24 12:21:00Z Giersch
78! OPENACC COPYIN directive for ddx and ddy added
79!
80! 4466 2020-03-20 16:14:41Z suehring
81! Add advection fluxes to ACC copyin
82!
83! 4457 2020-03-11 14:20:43Z raasch
84! use statement for exchange horiz added
85!
86! 4444 2020-03-05 15:59:50Z raasch
87! bugfix: cpp-directives for serial mode added
88!
89! 4420 2020-02-24 14:13:56Z maronga
90! Added output control for wind turbine model
91!
92! 4403 2020-02-12 13:08:46Z banzhafs
93! Allowing both existing and on-demand emission read modes
94!
95! 4360 2020-01-07 11:25:50Z suehring
96! Bugfix, hour_call_emis uninitialized at first call of time_integration
97!
98! 4346 2019-12-18 11:55:56Z motisi
99! Introduction of wall_flags_total_0, which currently sets bits based on static
100! topography information used in wall_flags_static_0
101!
102! 4329 2019-12-10 15:46:36Z motisi
103! Renamed wall_flags_0 to wall_flags_static_0
104!
105! 4281 2019-10-29 15:15:39Z schwenkel
106! Moved boundary conditions to module interface
107!
108! 4276 2019-10-28 16:03:29Z schwenkel
109! Further modularization of lpm code components
110!
111! 4275 2019-10-28 15:34:55Z schwenkel
112! Move call oft lpm to the end of intermediate timestep loop
113!
114! 4268 2019-10-17 11:29:38Z schwenkel
115! Removing module specific boundary conditions an put them into their modules
116!
117! 4227 2019-09-10 18:04:34Z gronemeier
118! implement new palm_date_time_mod
119!
120! 4226 2019-09-10 17:03:24Z suehring
121! Changes in interface for the offline nesting
122!
123! 4182 2019-08-22 15:20:23Z scharf
124! Corrected "Former revisions" section
125!
126! 4170 2019-08-19 17:12:31Z gronemeier
127! copy diss, diss_p, tdiss_m to GPU
128!
129! 4144 2019-08-06 09:11:47Z raasch
130! relational operators .EQ., .NE., etc. replaced by ==, /=, etc.
131!
132! 4126 2019-07-30 11:09:11Z gronemeier
133! renamed routine to calculate uv exposure
134!
135! 4111 2019-07-22 18:16:57Z suehring
136! advc_flags_1 / advc_flags_2 renamed to advc_flags_m / advc_flags_s
137!
138! 4069 2019-07-01 14:05:51Z Giersch
139! Masked output running index mid has been introduced as a local variable to
140! avoid runtime error (Loop variable has been modified) in time_integration
141!
142! 4064 2019-07-01 05:33:33Z gronemeier
143! Moved call to radiation module out of intermediate time loop
144!
145! 4048 2019-06-21 21:00:21Z knoop
146! Moved production_e_init call into turbulence_closure_mod
147!
148! 4047 2019-06-21 18:58:09Z knoop
149! Added remainings of swap_timelevel upon its dissolution
150!
151! 4043 2019-06-18 16:59:00Z schwenkel
152! Further LPM modularization
153!
154! 4039 2019-06-18 10:32:41Z suehring
155! Rename subroutines in module for diagnostic quantities
156!
157! 4029 2019-06-14 14:04:35Z raasch
158! exchange of ghost points and boundary conditions separated for chemical species and SALSA module,
159! bugfix: decycling of chemistry species after nesting data transfer
160!
161! 4022 2019-06-12 11:52:39Z suehring
162! Call synthetic turbulence generator at last RK3 substep right after boundary
163! conditions are updated in offline nesting in order to assure that
164! perturbations are always imposed
165!
166! 4017 2019-06-06 12:16:46Z schwenkel
167! Mass (volume) flux correction included to ensure global mass conservation for child domains.
168!
169! 3994 2019-05-22 18:08:09Z suehring
170! output of turbulence intensity added
171!
172! 3988 2019-05-22 11:32:37Z kanani
173! Implement steerable output interval for virtual measurements
174!
175! 3968 2019-05-13 11:04:01Z suehring
176! replace nspec_out with n_matched_vars
177!
178! 3929 2019-04-24 12:52:08Z banzhafs
179! Reverse changes back from revision 3878: use chem_boundary_conds instead of
180! chem_boundary_conds_decycle
181!
182!
183! 3885 2019-04-11 11:29:34Z kanani
184! Changes related to global restructuring of location messages and introduction
185! of additional debug messages
186!
187! 3879 2019-04-08 20:25:23Z knoop
188! Moved wtm_forces to module_interface_actions
189!
190! 3872 2019-04-08 15:03:06Z knoop
191! Modifications made for salsa:
192! - Call salsa_emission_update at each time step but do the checks within
193!   salsa_emission_update (i.e. skip_time_do_salsa >= time_since_reference_point
194!   and next_aero_emission_update <= time_since_reference_point ).
195! - Renamed nbins --> nbins_aerosol, ncc_tot --> ncomponents_mass and
196!   ngast --> ngases_salsa and loop indices b, c and sg to ib, ic and ig
197! - Apply nesting for salsa variables
198! - Removed cpu_log calls speciffic for salsa.
199!
200! 3833 2019-03-28 15:04:04Z forkel
201! added USE chem_gasphase_mod, replaced nspec by nspec since fixed compounds are not integrated
202!
203! 3820 2019-03-27 11:53:41Z forkel
204! renamed do_emiss to emissions_anthropogenic (ecc)
205!
206!
207! 3774 2019-03-04 10:52:49Z moh.hefny
208! rephrase if statement to avoid unallocated array in case of
209! nesting_offline is false (crashing during debug mode)
210!
211! 3761 2019-02-25 15:31:42Z raasch $
212! module section re-formatted and openacc required variables moved to separate section,
213! re-formatting to 100 char line width
214!
215! 3745 2019-02-15 18:57:56Z suehring
216! Call indoor model after first timestep
217!
218! 3744 2019-02-15 18:38:58Z suehring
219! - Moved call of bio_calculate_thermal_index_maps from biometeorology module to
220! time_integration to make sure averaged input is updated before calculating.
221!
222! 3739 2019-02-13 08:05:17Z dom_dwd_user
223! Removed everything related to "time_bio_results" as this is never used.
224!
225! 3724 2019-02-06 16:28:23Z kanani
226! Correct double-used log_point_s unit
227!
228! 3719 2019-02-06 13:10:18Z kanani
229! - removed wind_turbine cpu measurement, since same time is measured inside
230!   wtm_forces subroutine as special measures
231! - moved the numerous vnest cpulog to special measures
232! - extended radiation cpulog over entire radiation part,
233!   moved radiation_interactions cpulog to special measures
234! - moved some cpu_log calls to this routine for better overview
235!
236! 3705 2019-01-29 19:56:39Z suehring
237! Data output for virtual measurements added
238!
239! 3704 2019-01-29 19:51:41Z suehring
240! Rename subroutines for surface-data output
241!
242! 3647 2019-01-02 14:10:44Z kanani
243! Bugfix: add time_since_reference_point to IF clause for data_output calls
244! (otherwise skip_time_* values don't come into affect with dt_do* = 0.0).
245! Clean up indoor_model and biometeorology model call.
246!
247! Revision 1.1  1997/08/11 06:19:04  raasch
248! Initial revision
249!
250!
251! Description:
252! ------------
253!> Integration in time of the model equations, statistical analysis and graphic
254!> output
255!------------------------------------------------------------------------------!
256 SUBROUTINE time_integration
257
258
259    USE advec_ws,                                                                                  &
260        ONLY:  ws_statistics
261
262    USE arrays_3d,                                                                                 &
263        ONLY:  dzu, prho, pt, pt_init, q,                                                          &
264               q_init, ref_state, rho_ocean, tend, u, v, vpt
265
266    USE biometeorology_mod,                                                                        &
267        ONLY:  bio_calculate_thermal_index_maps, thermal_comfort, bio_calculate_uv_exposure,       &
268               uv_exposure
269
270    USE bulk_cloud_model_mod,                                                                      &
271        ONLY: bulk_cloud_model, calc_liquid_water_content
272
273    USE calc_mean_profile_mod,                                                                     &
274        ONLY:  calc_mean_profile
275
276    USE chem_emissions_mod,                                                                        &
277        ONLY:  chem_emissions_setup, chem_emissions_update_on_demand
278
279    USE chem_gasphase_mod,                                                                         &
280        ONLY:  nvar
281
282    USE chem_modules,                                                                              &
283        ONLY:  bc_cs_t_val, chem_species, emissions_anthropogenic,                                 &
284               emiss_read_legacy_mode, n_matched_vars
285
286    USE control_parameters,                                                                        &
287        ONLY:  advected_distance_x, advected_distance_y, air_chemistry, average_count_3d,          &
288               averaging_interval, averaging_interval_pr, bc_lr_cyc, bc_ns_cyc, bc_pt_t_val,       &
289               bc_q_t_val, biometeorology, call_psolver_at_all_substeps,  child_domain,            &
290               constant_flux_layer, constant_heatflux, create_disturbances,                        &
291               dopr_n, constant_diffusion, coupling_mode, coupling_start_time,                     &
292               current_timestep_number, debug_output_timestep, debug_string,                       &
293               disturbance_created, disturbance_energy_limit, dist_range,                          &
294               do_sum, dt_3d, dt_averaging_input, dt_averaging_input_pr, dt_coupling,              &
295               dt_data_output_av, dt_disturb, dt_do2d_xy, dt_do2d_xz, dt_do2d_yz, dt_do3d,         &
296               dt_domask,dt_dopts, dt_dopr, dt_dopr_listing, dt_dots, dt_run_control,              &
297               end_time, first_call_lpm, first_call_mas, galilei_transformation, humidity,         &
298               indoor_model, intermediate_timestep_count, intermediate_timestep_count_max,         &
299               land_surface, large_scale_forcing, loop_optimization, lsf_surf, lsf_vert, masks,    &
300               multi_agent_system_end, multi_agent_system_start, nesting_offline, neutral,         &
301               nr_timesteps_this_run, nudging, ocean_mode, pt_reference,                           &
302               pt_slope_offset, pt_surface_heating_rate,                                           &
303               random_heatflux, run_coupled, salsa,                                                &
304               simulated_time, simulated_time_chr, skip_time_do2d_xy, skip_time_do2d_xz,           &
305               skip_time_do2d_yz, skip_time_do3d, skip_time_domask, skip_time_dopr,                &
306               skip_time_data_output_av, sloping_surface, stop_dt, surface_output,                 &
307               terminate_coupled, terminate_run, timestep_scheme, time_coupling, time_do2d_xy,     &
308               time_do2d_xz, time_do2d_yz, time_do3d, time_domask, time_dopr, time_dopr_av,        &
309               time_dopr_listing, time_dopts, time_dosp, time_dosp_av, time_dots, time_do_av,      &
310               time_do_sla, time_disturb, time_run_control, time_since_reference_point,            &
311               timestep_count, turbulent_inflow, turbulent_outflow, urban_surface,                 &
312               use_initial_profile_as_reference, use_single_reference_value, u_gtrans, v_gtrans,   &
313               virtual_flight, virtual_measurement, ws_scheme_mom, ws_scheme_sca
314
315    USE cpulog,                                                                                    &
316        ONLY:  cpu_log, log_point, log_point_s
317
318    USE diagnostic_output_quantities_mod,                                                          &
319        ONLY:  doq_calculate,                                                                      &
320               timestep_number_at_prev_calc
321
322    USE exchange_horiz_mod,                                                                        &
323        ONLY:  exchange_horiz
324
325    USE flight_mod,                                                                                &
326        ONLY:  flight_measurement
327
328    USE grid_variables,                                                                            &
329        ONLY:  ddx, ddy
330
331    USE indices,                                                                                   &
332        ONLY:  nx, nxl, nxlg, nxr, nxrg, nzb, nzt
333
334    USE indoor_model_mod,                                                                          &
335        ONLY:  dt_indoor, im_main_heatcool, time_indoor
336
337    USE interfaces
338
339    USE kinds
340
341    USE land_surface_model_mod,                                                                    &
342        ONLY:  lsm_boundary_condition, lsm_energy_balance, skip_time_do_lsm
343
344    USE lagrangian_particle_model_mod,                                                             &
345        ONLY:  lpm_data_output_ptseries
346
347    USE lsf_nudging_mod,                                                                           &
348        ONLY:  calc_tnudge, ls_forcing_surf, ls_forcing_vert, nudge_ref
349
350    USE module_interface,                                                                          &
351        ONLY:  module_interface_actions, module_interface_swap_timelevel,                          &
352               module_interface_boundary_conditions, module_interface_exchange_horiz
353
354    USE multi_agent_system_mod,                                                                    &
355        ONLY:  agents_active, multi_agent_system
356
357    USE nesting_offl_mod,                                                                          &
358        ONLY:  nesting_offl_bc,                                                                    &
359               nesting_offl_input,                                                                 &
360               nesting_offl_interpolation_factor,                                                  &
361               nesting_offl_mass_conservation
362
363    USE netcdf_data_input_mod,                                                                     &
364        ONLY:  chem_emis, chem_emis_att
365
366    USE ocean_mod,                                                                                 &
367        ONLY:  prho_reference
368
369    USE palm_date_time_mod,                                                                        &
370        ONLY:  get_date_time
371
372    USE particle_attributes,                                                                       &
373        ONLY:  particle_advection, particle_advection_start
374
375    USE pegrid
376
377#if defined( __parallel )
378    USE pmc_interface,                                                                             &
379        ONLY:  nested_run, nesting_mode, pmci_boundary_conds, pmci_datatrans, pmci_synchronize,    &
380        pmci_ensure_nest_mass_conservation, pmci_ensure_nest_mass_conservation_vertical,           &
381        pmci_set_swaplevel
382#endif
383
384    USE progress_bar,                                                                              &
385        ONLY:  finish_progress_bar, output_progress_bar
386
387    USE prognostic_equations_mod,                                                                  &
388        ONLY:  prognostic_equations_cache, prognostic_equations_vector
389
390    USE radiation_model_mod,                                                                       &
391        ONLY: dt_radiation, force_radiation_call, radiation, radiation_control,                    &
392              radiation_interaction, radiation_interactions, skip_time_do_radiation, time_radiation
393
394    USE salsa_mod,                                                                                 &
395        ONLY: aerosol_number, aerosol_mass, bc_am_t_val, bc_an_t_val, bc_gt_t_val,                 &
396              nbins_aerosol, ncomponents_mass, ngases_salsa,                                       &
397              salsa_boundary_conditions, salsa_emission_update, salsa_gas, salsa_gases_from_chem,  &
398              skip_time_do_salsa
399
400    USE spectra_mod,                                                                               &
401        ONLY: average_count_sp, averaging_interval_sp, calc_spectra, dt_dosp, skip_time_dosp
402
403    USE statistics,                                                                                &
404        ONLY:  flow_statistics_called, hom, pr_palm, sums_ls_l
405
406
407    USE surface_layer_fluxes_mod,                                                                  &
408        ONLY:  surface_layer_fluxes
409
410    USE surface_data_output_mod,                                                                   &
411        ONLY:  average_count_surf, averaging_interval_surf, dt_dosurf, dt_dosurf_av,               &
412               surface_data_output, surface_data_output_averaging, skip_time_dosurf,               &
413               skip_time_dosurf_av, time_dosurf, time_dosurf_av
414
415    USE surface_mod,                                                                               &
416        ONLY:  surf_def_h, surf_lsm_h, surf_usm_h
417
418    USE synthetic_turbulence_generator_mod,                                                        &
419        ONLY:  dt_stg_call, dt_stg_adjust, parametrize_inflow_turbulence, stg_adjust, stg_main,    &
420               time_stg_adjust, time_stg_call, use_syn_turb_gen
421
422    USE turbulence_closure_mod,                                                                    &
423        ONLY:  tcm_diffusivities
424
425    USE urban_surface_mod,                                                                         &
426        ONLY:  usm_boundary_condition,                                                             &
427               usm_energy_balance
428
429    USE virtual_measurement_mod,                                                                   &
430        ONLY:  dt_virtual_measurement,                                                             &
431               time_virtual_measurement,                                                           &
432               vm_data_output,                                                                     &
433               vm_sampling,                                                                        &
434               vm_time_start
435
436
437    USE wind_turbine_model_mod,                                                                    &
438        ONLY:  dt_data_output_wtm, time_wtm, wind_turbine, wtm_data_output
439
440#if defined( _OPENACC )
441    USE arrays_3d,                                                                                 &
442        ONLY:  d, dd2zu, ddzu, ddzw,                                                               &
443               diss,                                                                               &
444               diss_p,                                                                             &
445               diss_l_u,                                                                           &
446               diss_l_v,                                                                           &
447               diss_l_w,                                                                           &
448               diss_s_u,                                                                           &
449               diss_s_v,                                                                           &
450               diss_s_w,                                                                           &
451               drho_air, drho_air_zw, dzw, e,                                                      &
452               flux_l_u,                                                                           &
453               flux_l_v,                                                                           &
454               flux_l_w,                                                                           &
455               flux_s_u,                                                                           &
456               flux_s_v,                                                                           &
457               flux_s_w,                                                                           &
458               heatflux_output_conversion,                                                         &
459               e_p,                                                                                &
460               pt_p,                                                                               &
461               u_p,                                                                                &
462               v_p,                                                                                &
463               w_p,                                                                                &
464               kh, km, momentumflux_output_conversion, nc, ni, nr, p, ptdf_x, ptdf_y, qc, qi, qr, rdf,     &
465               rdf_sc, rho_air, rho_air_zw, s, tdiss_m, te_m, tpt_m, tu_m, tv_m, tw_m, ug, u_init, &
466               u_stokes_zu, vg, v_init, v_stokes_zu, w, zu
467
468    USE control_parameters,                                                                        &
469        ONLY:  tsc
470
471    USE indices,                                                                                   &
472        ONLY:  advc_flags_m, advc_flags_s, nyn, nyng, nys, nysg, nz, nzb_max, wall_flags_total_0
473
474    USE statistics,                                                                                &
475        ONLY:  rmask, statistic_regions, sums_l, sums_l_l, sums_us2_ws_l,                          &
476               sums_wsus_ws_l, sums_vs2_ws_l, sums_wsvs_ws_l, sums_ws2_ws_l, sums_wspts_ws_l,      &
477               sums_wsqs_ws_l, sums_wssas_ws_l, sums_wsqcs_ws_l, sums_wsqrs_ws_l, sums_wsncs_ws_l, &
478               sums_wsnrs_ws_l, sums_wsss_ws_l, weight_substep, sums_salsa_ws_l, sums_wsqis_ws_l,  &
479               sums_wsnis_ws_l
480
481    USE surface_mod,                                                                               &
482        ONLY:  bc_h, enter_surface_arrays, exit_surface_arrays
483#endif
484
485
486    IMPLICIT NONE
487
488    CHARACTER (LEN=9) ::  time_to_string   !<
489
490    INTEGER(iwp) ::  hour                !< hour of current time
491    INTEGER(iwp) ::  hour_call_emis = -1 !< last hour where emission was called
492    INTEGER(iwp) ::  ib                  !< index for aerosol size bins
493    INTEGER(iwp) ::  ic                  !< index for aerosol mass bins
494    INTEGER(iwp) ::  icc                 !< additional index for aerosol mass bins
495    INTEGER(iwp) ::  ig                  !< index for salsa gases
496    INTEGER(iwp) ::  mid                 !< masked output running index
497    INTEGER(iwp) ::  n                   !< loop counter for chemistry species
498
499    REAL(wp) ::  dt_3d_old  !< temporary storage of timestep to be used for
500                            !< steering of run control output interval
501    REAL(wp) ::  time_since_reference_point_save  !< original value of
502                                                  !< time_since_reference_point
503
504
505!
506!-- Copy data from arrays_3d
507!$ACC DATA &
508!$ACC COPY(d(nzb+1:nzt,nys:nyn,nxl:nxr)) &
509!$ACC COPY(diss(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
510!$ACC COPY(e(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
511!$ACC COPY(u(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
512!$ACC COPY(v(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
513!$ACC COPY(w(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
514!$ACC COPY(kh(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
515!$ACC COPY(km(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
516!$ACC COPY(p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
517!$ACC COPY(pt(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
518
519!$ACC DATA &
520!$ACC COPYIN(diss_l_u(0:nz+1,nys:nyn,0), flux_l_u(0:nz+1,nys:nyn,0)) &
521!$ACC COPYIN(diss_l_v(0:nz+1,nys:nyn,0), flux_l_v(0:nz+1,nys:nyn,0)) &
522!$ACC COPYIN(diss_l_w(0:nz+1,nys:nyn,0), flux_l_w(0:nz+1,nys:nyn,0)) &
523!$ACC COPYIN(diss_s_u(0:nz+1,0), flux_s_u(0:nz+1,0)) &
524!$ACC COPYIN(diss_s_v(0:nz+1,0), flux_s_v(0:nz+1,0)) &
525!$ACC COPYIN(diss_s_w(0:nz+1,0), flux_s_w(0:nz+1,0)) &
526!$ACC COPY(diss_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
527!$ACC COPY(e_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
528!$ACC COPY(u_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
529!$ACC COPY(v_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
530!$ACC COPY(w_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
531!$ACC COPY(pt_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
532!$ACC COPY(tend(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
533!$ACC COPY(tdiss_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
534!$ACC COPY(te_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
535!$ACC COPY(tu_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
536!$ACC COPY(tv_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
537!$ACC COPY(tw_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
538!$ACC COPY(tpt_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
539
540!$ACC DATA &
541!$ACC COPYIN(rho_air(nzb:nzt+1), drho_air(nzb:nzt+1)) &
542!$ACC COPYIN(rho_air_zw(nzb:nzt+1), drho_air_zw(nzb:nzt+1)) &
543!$ACC COPYIN(zu(nzb:nzt+1)) &
544!$ACC COPYIN(dzu(1:nzt+1), dzw(1:nzt+1)) &
545!$ACC COPYIN(ddzu(1:nzt+1), dd2zu(1:nzt)) &
546!$ACC COPYIN(ddzw(1:nzt+1)) &
547!$ACC COPYIN(heatflux_output_conversion(nzb:nzt+1)) &
548!$ACC COPYIN(momentumflux_output_conversion(nzb:nzt+1)) &
549!$ACC COPYIN(rdf(nzb+1:nzt), rdf_sc(nzb+1:nzt)) &
550!$ACC COPYIN(ptdf_x(nxlg:nxrg), ptdf_y(nysg:nyng)) &
551!$ACC COPYIN(ref_state(0:nz+1)) &
552!$ACC COPYIN(u_init(0:nz+1), v_init(0:nz+1)) &
553!$ACC COPYIN(u_stokes_zu(nzb:nzt+1), v_stokes_zu(nzb:nzt+1)) &
554!$ACC COPYIN(pt_init(0:nz+1)) &
555!$ACC COPYIN(ug(0:nz+1), vg(0:nz+1))
556
557!
558!-- Copy data from control_parameters
559!$ACC DATA &
560!$ACC COPYIN(tsc(1:5))
561
562!
563!-- Copy data from grid_variables
564!$ACC DATA &
565!$ACC COPYIN(ddx, ddy)
566
567!
568!-- Copy data from indices
569!$ACC DATA &
570!$ACC COPYIN(advc_flags_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
571!$ACC COPYIN(advc_flags_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
572!$ACC COPYIN(wall_flags_total_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
573
574!
575!-- Copy data from surface_mod
576!$ACC DATA &
577!$ACC COPYIN(bc_h(0:1)) &
578!$ACC COPYIN(bc_h(0)%i(1:bc_h(0)%ns)) &
579!$ACC COPYIN(bc_h(0)%j(1:bc_h(0)%ns)) &
580!$ACC COPYIN(bc_h(0)%k(1:bc_h(0)%ns)) &
581!$ACC COPYIN(bc_h(1)%i(1:bc_h(1)%ns)) &
582!$ACC COPYIN(bc_h(1)%j(1:bc_h(1)%ns)) &
583!$ACC COPYIN(bc_h(1)%k(1:bc_h(1)%ns))
584
585!
586!-- Copy data from statistics
587!$ACC DATA &
588!$ACC COPYIN(hom(0:nz+1,1:2,1:4,0)) &
589!$ACC COPYIN(rmask(nysg:nyng,nxlg:nxrg,0:statistic_regions)) &
590!$ACC COPYIN(weight_substep(1:intermediate_timestep_count_max)) &
591!$ACC COPY(sums_l(nzb:nzt+1,1:pr_palm,0)) &
592!$ACC COPY(sums_l_l(nzb:nzt+1,0:statistic_regions,0)) &
593!$ACC COPY(sums_us2_ws_l(nzb:nzt+1,0)) &
594!$ACC COPY(sums_wsus_ws_l(nzb:nzt+1,0)) &
595!$ACC COPY(sums_vs2_ws_l(nzb:nzt+1,0)) &
596!$ACC COPY(sums_wsvs_ws_l(nzb:nzt+1,0)) &
597!$ACC COPY(sums_ws2_ws_l(nzb:nzt+1,0)) &
598!$ACC COPY(sums_wspts_ws_l(nzb:nzt+1,0)) &
599!$ACC COPY(sums_wssas_ws_l(nzb:nzt+1,0)) &
600!$ACC COPY(sums_wsqs_ws_l(nzb:nzt+1,0)) &
601!$ACC COPY(sums_wsqcs_ws_l(nzb:nzt+1,0)) &
602!$ACC COPY(sums_wsqis_ws_l(nzb:nzt+1,0)) &
603!$ACC COPY(sums_wsqrs_ws_l(nzb:nzt+1,0)) &
604!$ACC COPY(sums_wsncs_ws_l(nzb:nzt+1,0)) &
605!$ACC COPY(sums_wsnis_ws_l(nzb:nzt+1,0)) &
606!$ACC COPY(sums_wsnrs_ws_l(nzb:nzt+1,0)) &
607!$ACC COPY(sums_wsss_ws_l(nzb:nzt+1,0)) &
608!$ACC COPY(sums_salsa_ws_l(nzb:nzt+1,0))
609
610!
611!-- Next statement is to avoid compiler warnings about unused variables. Please
612!-- remove in case that you are using them. ddx and ddy need to be defined in
613!-- time_integration because of ACC COPYIN directive.
614    ddx = ddx
615    ddy = ddy
616
617#if defined( _OPENACC )
618    CALL enter_surface_arrays
619#endif
620
621!
622!-- At beginning determine the first time step
623    CALL timestep
624
625#if defined( __parallel )
626!
627!-- Synchronize the timestep in case of nested run.
628    IF ( nested_run )  THEN
629!
630!--    Synchronization by unifying the time step.
631!--    Global minimum of all time-steps is used for all.
632       CALL pmci_synchronize
633    ENDIF
634#endif
635
636!
637!-- Determine and print out the run control quantities before the first time
638!-- step of this run. For the initial run, some statistics (e.g. divergence)
639!-- need to be determined first --> CALL flow_statistics at the beginning of
640!-- run_control
641    CALL run_control
642!
643!-- Data exchange between coupled models in case that a call has been omitted
644!-- at the end of the previous run of a job chain.
645    IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled )  THEN
646!
647!--    In case of model termination initiated by the local model the coupler
648!--    must not be called because this would again cause an MPI hang.
649       DO WHILE ( time_coupling >= dt_coupling  .AND.  terminate_coupled == 0 )
650          CALL surface_coupler
651          time_coupling = time_coupling - dt_coupling
652       ENDDO
653       IF (time_coupling == 0.0_wp  .AND.  time_since_reference_point < dt_coupling )  THEN
654          time_coupling = time_since_reference_point
655       ENDIF
656    ENDIF
657
658    CALL location_message( 'atmosphere (and/or ocean) time-stepping', 'start' )
659write(9,*) "time_indoor begin", time_indoor
660flush(9)
661!
662!-- Start of the time loop
663    DO  WHILE ( simulated_time < end_time  .AND.  .NOT. stop_dt  .AND. .NOT. terminate_run )
664
665       CALL cpu_log( log_point_s(10), 'timesteps', 'start' )
666
667       IF ( debug_output_timestep )  THEN
668           WRITE( debug_string, * ) 'time_integration', simulated_time
669           CALL debug_message( debug_string, 'start' )
670       ENDIF
671
672!
673!--    Determine ug, vg and w_subs in dependence on data from external file
674!--    LSF_DATA
675       IF ( large_scale_forcing .AND. lsf_vert )  THEN
676           CALL ls_forcing_vert ( simulated_time )
677           sums_ls_l = 0.0_wp
678       ENDIF
679
680!
681!--    Set pt_init and q_init to the current profiles taken from
682!--    NUDGING_DATA
683       IF ( nudging )  THEN
684           CALL nudge_ref ( simulated_time )
685!
686!--        Store temperature gradient at the top boundary for possible Neumann
687!--        boundary condition
688           bc_pt_t_val = ( pt_init(nzt+1) - pt_init(nzt) ) / dzu(nzt+1)
689           bc_q_t_val  = ( q_init(nzt+1) - q_init(nzt) ) / dzu(nzt+1)
690           IF ( air_chemistry )  THEN
691              DO  n = 1, nvar
692                 bc_cs_t_val = (  chem_species(n)%conc_pr_init(nzt+1)                              &
693                                - chem_species(n)%conc_pr_init(nzt) )                              &
694                               / dzu(nzt+1)
695              ENDDO
696           ENDIF
697           IF ( salsa  .AND.  time_since_reference_point >= skip_time_do_salsa )  THEN
698              DO  ib = 1, nbins_aerosol
699                 bc_an_t_val = ( aerosol_number(ib)%init(nzt+1) - aerosol_number(ib)%init(nzt) ) / &
700                               dzu(nzt+1)
701                 DO  ic = 1, ncomponents_mass
702                    icc = ( ic - 1 ) * nbins_aerosol + ib
703                    bc_am_t_val = ( aerosol_mass(icc)%init(nzt+1) - aerosol_mass(icc)%init(nzt) ) /&
704                                  dzu(nzt+1)
705                 ENDDO
706              ENDDO
707              IF ( .NOT. salsa_gases_from_chem )  THEN
708                 DO  ig = 1, ngases_salsa
709                    bc_gt_t_val = ( salsa_gas(ig)%init(nzt+1) - salsa_gas(ig)%init(nzt) ) /        &
710                                  dzu(nzt+1)
711                 ENDDO
712              ENDIF
713           ENDIF
714       ENDIF
715!
716!--    Input of boundary data.
717       IF ( nesting_offline )  CALL nesting_offl_input
718!
719!--    Execute all other module actions routines
720       CALL module_interface_actions( 'before_timestep' )
721
722!
723!--    Start of intermediate step loop
724       intermediate_timestep_count = 0
725       DO  WHILE ( intermediate_timestep_count < intermediate_timestep_count_max )
726
727          intermediate_timestep_count = intermediate_timestep_count + 1
728
729!
730!--       Set the steering factors for the prognostic equations which depend
731!--       on the timestep scheme
732          CALL timestep_scheme_steering
733
734!
735!--       Calculate those variables needed in the tendency terms which need
736!--       global communication
737          IF ( .NOT. use_single_reference_value  .AND.  .NOT. use_initial_profile_as_reference )   &
738          THEN
739!
740!--          Horizontally averaged profiles to be used as reference state in
741!--          buoyancy terms (WARNING: only the respective last call of
742!--          calc_mean_profile defines the reference state!)
743             IF ( .NOT. neutral )  THEN
744                CALL calc_mean_profile( pt, 4 )
745                ref_state(:)  = hom(:,1,4,0) ! this is used in the buoyancy term
746             ENDIF
747             IF ( ocean_mode )  THEN
748                CALL calc_mean_profile( rho_ocean, 64 )
749                ref_state(:)  = hom(:,1,64,0)
750             ENDIF
751             IF ( humidity )  THEN
752                CALL calc_mean_profile( vpt, 44 )
753                ref_state(:)  = hom(:,1,44,0)
754             ENDIF
755!
756!--          Assure that ref_state does not become zero at any level
757!--          ( might be the case if a vertical level is completely occupied
758!--            with topography ).
759             ref_state = MERGE( MAXVAL(ref_state), ref_state, ref_state == 0.0_wp )
760          ENDIF
761
762          IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  intermediate_timestep_count == 1 )     &
763          THEN
764             CALL ws_statistics
765          ENDIF
766!
767!--       In case of nudging calculate current nudging time scale and horizontal
768!--       means of u, v, pt and q
769          IF ( nudging )  THEN
770             CALL calc_tnudge( simulated_time )
771             CALL calc_mean_profile( u, 1 )
772             CALL calc_mean_profile( v, 2 )
773             CALL calc_mean_profile( pt, 4 )
774             CALL calc_mean_profile( q, 41 )
775          ENDIF
776!
777!--       Execute all other module actions routines
778          CALL module_interface_actions( 'before_prognostic_equations' )
779!
780!--       Solve the prognostic equations. A fast cache optimized version with
781!--       only one single loop is used in case of Piascek-Williams advection
782!--       scheme. NEC vector machines use a different version, because
783!--       in the other versions a good vectorization is prohibited due to
784!--       inlining problems.
785          IF ( loop_optimization == 'cache' )  THEN
786             CALL prognostic_equations_cache
787          ELSEIF ( loop_optimization == 'vector' )  THEN
788             CALL prognostic_equations_vector
789          ENDIF
790
791!
792!--       Movement of agents in multi agent system
793          IF ( agents_active  .AND.  time_since_reference_point >= multi_agent_system_start  .AND. &
794               time_since_reference_point <= multi_agent_system_end  .AND.                         &
795               intermediate_timestep_count == 1 )                                                  &
796          THEN
797             CALL multi_agent_system
798             first_call_mas = .FALSE.
799          ENDIF
800
801!
802!--       Exchange of ghost points (lateral boundary conditions)
803          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
804
805          CALL module_interface_exchange_horiz( 'after_prognostic_equation' )
806
807          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
808
809!
810!--       Boundary conditions for the prognostic quantities (except of the
811!--       velocities at the outflow in case of a non-cyclic lateral wall) and
812!--       boundary conditions for module-specific variables
813          CALL module_interface_boundary_conditions
814
815!
816!--       Incrementing timestep counter
817          timestep_count = timestep_count + 1
818
819          CALL cpu_log( log_point(28), 'swap_timelevel', 'start' )
820!
821!--       Set the swap level for all modules
822          CALL module_interface_swap_timelevel( MOD( timestep_count, 2) )
823
824#if defined( __parallel )
825!
826!--       Set the swap level for steering the pmc data transfer
827          IF ( nested_run )  CALL pmci_set_swaplevel( MOD( timestep_count, 2) + 1 )  !> @todo: why the +1 ?
828#endif
829
830          CALL cpu_log( log_point(28), 'swap_timelevel', 'stop' )
831
832#if defined( __parallel )
833          IF ( nested_run )  THEN
834
835             CALL cpu_log( log_point(60), 'nesting', 'start' )
836!
837!--          Domain nesting. The data transfer subroutines pmci_parent_datatrans
838!--          and pmci_child_datatrans are called inside the wrapper
839!--          subroutine pmci_datatrans according to the control parameters
840!--          nesting_mode and nesting_datatransfer_mode.
841!--          TO_DO: why is nesting_mode given as a parameter here?
842             CALL pmci_datatrans( nesting_mode )
843
844             IF ( TRIM( nesting_mode ) == 'two-way' .OR.  nesting_mode == 'vertical' )  THEN
845
846                CALL cpu_log( log_point_s(92), 'exchange-horiz-nest', 'start' )
847!
848!--             Exchange_horiz is needed for all parent-domains after the
849!--             anterpolation
850                CALL module_interface_exchange_horiz( 'after_anterpolation' )
851
852                CALL cpu_log( log_point_s(92), 'exchange-horiz-nest', 'stop' )
853
854             ENDIF
855
856!
857!--          Set boundary conditions again after interpolation and anterpolation.
858             CALL pmci_boundary_conds
859
860             CALL cpu_log( log_point(60), 'nesting', 'stop' )
861
862          ENDIF
863#endif
864
865!
866!--       Temperature offset must be imposed at cyclic boundaries in x-direction
867!--       when a sloping surface is used
868          IF ( sloping_surface )  THEN
869             IF ( nxl ==  0 )  pt(:,:,nxlg:nxl-1) = pt(:,:,nxlg:nxl-1) - pt_slope_offset
870             IF ( nxr == nx )  pt(:,:,nxr+1:nxrg) = pt(:,:,nxr+1:nxrg) + pt_slope_offset
871          ENDIF
872
873!
874!--       Increase temperature pt(0) according to pt_surface_heating_rate (convert from K/h to K/s)
875          IF ( pt_surface_heating_rate /= 0.0_wp .AND. intermediate_timestep_count == 1 ) THEN
876             pt(0,:,:) = pt(0,:,:) + dt_3d * pt_surface_heating_rate / 3600.0_wp
877          ENDIF
878
879!
880!--       Impose a turbulent inflow using the recycling method
881          IF ( turbulent_inflow )  CALL inflow_turbulence
882
883!
884!--       Set values at outflow boundary using the special outflow condition
885          IF ( turbulent_outflow )  CALL outflow_turbulence
886
887!
888!--       Impose a random perturbation on the horizontal velocity field
889          IF ( create_disturbances  .AND.  ( call_psolver_at_all_substeps  .AND.                   &
890               intermediate_timestep_count == intermediate_timestep_count_max )                    &
891               .OR. ( .NOT. call_psolver_at_all_substeps  .AND.  intermediate_timestep_count == 1 ) ) &
892          THEN
893             time_disturb = time_disturb + dt_3d
894             IF ( time_disturb >= dt_disturb )  THEN
895                IF ( disturbance_energy_limit /= 0.0_wp  .AND.                                     &
896                     hom(nzb+5,1,pr_palm,0) < disturbance_energy_limit )  THEN
897                   CALL disturb_field( 'u', tend, u )
898                   CALL disturb_field( 'v', tend, v )
899                ELSEIF ( ( .NOT. bc_lr_cyc  .OR.  .NOT. bc_ns_cyc )                                &
900                         .AND. .NOT. child_domain  .AND.  .NOT.  nesting_offline )                 &
901                THEN
902!
903!--                Runs with a non-cyclic lateral wall need perturbations
904!--                near the inflow throughout the whole simulation
905                   dist_range = 1
906                   CALL disturb_field( 'u', tend, u )
907                   CALL disturb_field( 'v', tend, v )
908                   dist_range = 0
909                ENDIF
910                time_disturb = time_disturb - dt_disturb
911             ENDIF
912          ENDIF
913
914!
915!--       Map forcing data derived from larger scale model onto domain
916!--       boundaries. Further, update geostrophic wind components.
917          IF ( nesting_offline  .AND.  intermediate_timestep_count ==                              &
918                                       intermediate_timestep_count_max  )  THEN
919!--          Determine interpolation factor before boundary conditions and geostrophic wind
920!--          is updated.
921             CALL nesting_offl_interpolation_factor
922             CALL nesting_offl_bc
923!              CALL nesting_offl_geostrophic_wind
924          ENDIF
925!
926!--       Impose a turbulent inflow using synthetic generated turbulence.
927          IF ( use_syn_turb_gen  .AND.                                                             &
928               intermediate_timestep_count == intermediate_timestep_count_max )  THEN
929             CALL cpu_log( log_point(57), 'synthetic_turbulence_gen', 'start' )
930             CALL stg_main
931             CALL cpu_log( log_point(57), 'synthetic_turbulence_gen', 'stop' )
932          ENDIF
933!
934!--       Ensure mass conservation. This need to be done after imposing
935!--       synthetic turbulence and top boundary condition for pressure is set to
936!--       Neumann conditions.
937!--       Is this also required in case of Dirichlet?
938          IF ( nesting_offline )  CALL nesting_offl_mass_conservation
939!
940!--       Reduce the velocity divergence via the equation for perturbation
941!--       pressure.
942          IF ( intermediate_timestep_count == 1  .OR.  call_psolver_at_all_substeps )  THEN
943
944#if defined( __parallel )
945!
946!--          Mass (volume) flux correction to ensure global mass conservation for child domains.
947             IF ( child_domain )  THEN
948                IF ( nesting_mode == 'vertical' )  THEN
949                   CALL pmci_ensure_nest_mass_conservation_vertical
950                ELSE
951                   CALL pmci_ensure_nest_mass_conservation
952                ENDIF
953             ENDIF
954#endif
955             CALL pres
956
957          ENDIF
958!
959!--       Particle transport/physics with the Lagrangian particle model
960!--       (only once during intermediate steps, because it uses an Euler-step)
961!--       ### particle model should be moved before prognostic_equations, in order
962!--       to regard droplet interactions directly
963
964          CALL module_interface_actions( 'after_pressure_solver' )
965!
966!--       Interaction of droplets with temperature and mixing ratio.
967!--       Droplet condensation and evaporation is calculated within
968!--       advec_particles.
969!
970!--       If required, compute liquid water content
971          IF ( bulk_cloud_model )  THEN
972             CALL calc_liquid_water_content
973          ENDIF
974!
975!--       If required, compute virtual potential temperature
976          IF ( humidity )  THEN
977             CALL compute_vpt
978          ENDIF
979
980!
981!--       Compute the diffusion quantities
982          IF ( .NOT. constant_diffusion )  THEN
983
984!
985!--          Determine surface fluxes shf and qsws and surface values
986!--          pt_surface and q_surface in dependence on data from external
987!--          file LSF_DATA respectively
988             IF ( ( large_scale_forcing .AND. lsf_surf ) .AND.                                     &
989                 intermediate_timestep_count == intermediate_timestep_count_max )                  &
990             THEN
991                CALL ls_forcing_surf( simulated_time )
992             ENDIF
993
994!
995!--          First the vertical (and horizontal) fluxes in the surface
996!--          (constant flux) layer are computed
997             IF ( constant_flux_layer )  THEN
998                CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'start' )
999                CALL surface_layer_fluxes
1000                CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'stop' )
1001             ENDIF
1002!
1003!--          If required, solve the energy balance for the surface and run soil
1004!--          model. Call for horizontal as well as vertical surfaces
1005             IF ( land_surface .AND. time_since_reference_point >= skip_time_do_lsm)  THEN
1006
1007                CALL cpu_log( log_point(54), 'land_surface', 'start' )
1008                CALL lsm_energy_balance( .FALSE. )
1009
1010!
1011!--             At the end, set boundary conditons for potential temperature
1012!--             and humidity after running the land-surface model. This
1013!--             might be important for the nesting, where arrays are transfered.
1014                CALL lsm_boundary_condition
1015
1016
1017                CALL cpu_log( log_point(54), 'land_surface', 'stop' )
1018             ENDIF
1019!
1020!--          If required, solve the energy balance for urban surfaces and run
1021!--          the material heat model
1022             IF (urban_surface) THEN
1023                CALL cpu_log( log_point(74), 'urban_surface', 'start' )
1024                CALL usm_energy_balance( .FALSE. )
1025
1026!
1027!--             At the end, set boundary conditons for potential temperature
1028!--             and humidity after running the urban-surface model. This
1029!--             might be important for the nesting, where arrays are transfered.
1030                CALL usm_boundary_condition
1031
1032                CALL cpu_log( log_point(74), 'urban_surface', 'stop' )
1033             ENDIF
1034!
1035!--          Compute the diffusion coefficients
1036             CALL cpu_log( log_point(17), 'diffusivities', 'start' )
1037             IF ( .NOT. humidity ) THEN
1038                IF ( ocean_mode )  THEN
1039                   CALL tcm_diffusivities( prho, prho_reference )
1040                ELSE
1041                   CALL tcm_diffusivities( pt, pt_reference )
1042                ENDIF
1043             ELSE
1044                CALL tcm_diffusivities( vpt, pt_reference )
1045             ENDIF
1046             CALL cpu_log( log_point(17), 'diffusivities', 'stop' )
1047
1048          ENDIF
1049
1050       ENDDO   ! Intermediate step loop
1051
1052!
1053!--    Will be used at some point by flow_statistics.
1054       !$ACC UPDATE &
1055       !$ACC HOST(sums_l_l(nzb:nzt+1,0:statistic_regions,0)) &
1056       !$ACC HOST(sums_us2_ws_l(nzb:nzt+1,0)) &
1057       !$ACC HOST(sums_wsus_ws_l(nzb:nzt+1,0)) &
1058       !$ACC HOST(sums_vs2_ws_l(nzb:nzt+1,0)) &
1059       !$ACC HOST(sums_wsvs_ws_l(nzb:nzt+1,0)) &
1060       !$ACC HOST(sums_ws2_ws_l(nzb:nzt+1,0)) &
1061       !$ACC HOST(sums_wspts_ws_l(nzb:nzt+1,0)) &
1062       !$ACC HOST(sums_wssas_ws_l(nzb:nzt+1,0)) &
1063       !$ACC HOST(sums_wsqs_ws_l(nzb:nzt+1,0)) &
1064       !$ACC HOST(sums_wsqcs_ws_l(nzb:nzt+1,0)) &
1065       !$ACC HOST(sums_wsqis_ws_l(nzb:nzt+1,0)) &
1066       !$ACC HOST(sums_wsqrs_ws_l(nzb:nzt+1,0)) &
1067       !$ACC HOST(sums_wsncs_ws_l(nzb:nzt+1,0)) &
1068       !$ACC HOST(sums_wsnis_ws_l(nzb:nzt+1,0)) &
1069       !$ACC HOST(sums_wsnrs_ws_l(nzb:nzt+1,0)) &
1070       !$ACC HOST(sums_wsss_ws_l(nzb:nzt+1,0)) &
1071       !$ACC HOST(sums_salsa_ws_l(nzb:nzt+1,0))
1072
1073!
1074!--    If required, calculate radiative fluxes and heating rates
1075       IF ( radiation  .AND.  time_since_reference_point >= skip_time_do_radiation )  THEN
1076
1077          time_radiation = time_radiation + dt_3d
1078
1079          IF ( time_radiation >= dt_radiation  .OR.  force_radiation_call )  THEN
1080
1081             CALL cpu_log( log_point(50), 'radiation', 'start' )
1082
1083             IF ( time_radiation >= dt_radiation )  THEN
1084                time_radiation = time_radiation - dt_radiation
1085             ENDIF
1086
1087!
1088!--          Adjust the current time to the time step of the radiation model.
1089!--          Needed since radiation is pre-calculated and stored only on apparent
1090!--          solar positions
1091             time_since_reference_point_save = time_since_reference_point
1092             time_since_reference_point = time_since_reference_point -                            &
1093                                          MODULO(time_since_reference_point, dt_radiation)
1094
1095             CALL radiation_control
1096
1097             IF ( ( urban_surface  .OR.  land_surface )  .AND.  radiation_interactions )  THEN
1098                CALL cpu_log( log_point_s(46), 'radiation_interaction', 'start' )
1099                CALL radiation_interaction
1100                CALL cpu_log( log_point_s(46), 'radiation_interaction', 'stop' )
1101             ENDIF
1102
1103!
1104!--          Return the current time to its original value
1105             time_since_reference_point = time_since_reference_point_save
1106!
1107!--          Reset forcing of radiation call
1108             force_radiation_call = .FALSE.
1109
1110             CALL cpu_log( log_point(50), 'radiation', 'stop' )
1111
1112          ENDIF
1113       ENDIF
1114
1115
1116!
1117!-- 20200203 (ECC)
1118!-- allows for emission update mode in legacy mode as well as on-demand mode
1119!-- note that under on-demand mode emission update is no longer restricted to
1120!-- an hourly frequency, but whenever the simulation time corresponds to an
1121!-- inrement in emission timestamp value
1122
1123!
1124!-- If required, consider chemical emissions
1125
1126       IF  ( air_chemistry .AND. emissions_anthropogenic )  THEN
1127
1128          IF  ( emiss_read_legacy_mode )  THEN
1129!
1130!-- get hourly index and updates emission data when the hour is passed
1131
1132             CALL get_date_time( time_since_reference_point, hour=hour )
1133
1134             IF  ( hour_call_emis /= hour )   THEN
1135
1136                CALL chem_emissions_setup( chem_emis_att, chem_emis, n_matched_vars )
1137                hour_call_emis = hour
1138
1139             ENDIF
1140
1141          ELSE
1142
1143             CALL chem_emissions_update_on_demand
1144
1145          ENDIF
1146
1147       ENDIF
1148
1149
1150!
1151!--    If required, consider aerosol emissions for the salsa model
1152       IF ( salsa )  THEN
1153!
1154!--       Call emission routine to update emissions if needed
1155          CALL salsa_emission_update
1156
1157       ENDIF
1158!
1159!--    If required, calculate indoor temperature, waste heat, heat flux
1160!--    through wall, etc.
1161!--    dt_indoor steers the frequency of the indoor model calculations.
1162!--    Note, at first timestep indoor model is called, in order to provide
1163!--    a waste heat flux.
1164       IF ( indoor_model )  THEN
1165
1166          time_indoor = time_indoor + dt_3d
1167
1168          IF ( time_indoor >= dt_indoor  .OR.  current_timestep_number == 0 )  THEN
1169
1170             IF ( time_indoor >= dt_indoor )  time_indoor = time_indoor - dt_indoor
1171
1172             CALL cpu_log( log_point(76), 'indoor_model', 'start' )
1173             CALL im_main_heatcool
1174             CALL cpu_log( log_point(76), 'indoor_model', 'stop' )
1175
1176          ENDIF
1177       ENDIF
1178!
1179!--    Increase simulation time and output times
1180       nr_timesteps_this_run      = nr_timesteps_this_run + 1
1181       current_timestep_number    = current_timestep_number + 1
1182       simulated_time             = simulated_time   + dt_3d
1183       time_since_reference_point = simulated_time - coupling_start_time
1184       simulated_time_chr         = time_to_string( time_since_reference_point )
1185
1186
1187       IF ( time_since_reference_point >= skip_time_data_output_av )  THEN
1188          time_do_av         = time_do_av       + dt_3d
1189       ENDIF
1190       IF ( time_since_reference_point >= skip_time_do2d_xy )  THEN
1191          time_do2d_xy       = time_do2d_xy     + dt_3d
1192       ENDIF
1193       IF ( time_since_reference_point >= skip_time_do2d_xz )  THEN
1194          time_do2d_xz       = time_do2d_xz     + dt_3d
1195       ENDIF
1196       IF ( time_since_reference_point >= skip_time_do2d_yz )  THEN
1197          time_do2d_yz       = time_do2d_yz     + dt_3d
1198       ENDIF
1199       IF ( time_since_reference_point >= skip_time_do3d    )  THEN
1200          time_do3d          = time_do3d        + dt_3d
1201       ENDIF
1202       DO  mid = 1, masks
1203          IF ( time_since_reference_point >= skip_time_domask(mid) )  THEN
1204             time_domask(mid)= time_domask(mid) + dt_3d
1205          ENDIF
1206       ENDDO
1207       IF ( time_since_reference_point >= skip_time_dosp )  THEN
1208          time_dosp       = time_dosp        + dt_3d
1209       ENDIF
1210       time_dots          = time_dots        + dt_3d
1211       IF ( .NOT. first_call_lpm )  THEN
1212          time_dopts      = time_dopts       + dt_3d
1213       ENDIF
1214       IF ( time_since_reference_point >= skip_time_dopr )  THEN
1215          time_dopr       = time_dopr        + dt_3d
1216       ENDIF
1217       time_dopr_listing  = time_dopr_listing + dt_3d
1218       time_run_control   = time_run_control + dt_3d
1219!
1220!--    Increment time-counter for surface output
1221       IF ( surface_output )  THEN
1222          IF ( time_since_reference_point >= skip_time_dosurf )  THEN
1223             time_dosurf    = time_dosurf + dt_3d
1224          ENDIF
1225          IF ( time_since_reference_point >= skip_time_dosurf_av )  THEN
1226             time_dosurf_av = time_dosurf_av + dt_3d
1227          ENDIF
1228       ENDIF
1229!
1230!--    Increment time-counter for virtual measurements
1231       IF ( virtual_measurement  .AND.  vm_time_start <= time_since_reference_point )  THEN
1232          time_virtual_measurement = time_virtual_measurement + dt_3d
1233       ENDIF
1234
1235!
1236!--    Increment time-counter for wind turbine data output
1237       IF ( wind_turbine )  THEN
1238          time_wtm = time_wtm + dt_3d
1239       ENDIF
1240
1241!
1242!--    In case of synthetic turbulence generation and parametrized turbulence
1243!--    information, update the time counter and if required, adjust the
1244!--    STG to new atmospheric conditions.
1245       IF ( use_syn_turb_gen  )  THEN
1246          IF ( parametrize_inflow_turbulence )  THEN
1247             time_stg_adjust = time_stg_adjust + dt_3d
1248             IF ( time_stg_adjust >= dt_stg_adjust )  THEN
1249                CALL cpu_log( log_point(57), 'synthetic_turbulence_gen', 'start' )
1250                CALL stg_adjust
1251                CALL cpu_log( log_point(57), 'synthetic_turbulence_gen', 'stop' )
1252             ENDIF
1253          ENDIF
1254          time_stg_call = time_stg_call + dt_3d
1255       ENDIF
1256
1257!
1258!--    Data exchange between coupled models
1259       IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled )  THEN
1260          time_coupling = time_coupling + dt_3d
1261
1262!
1263!--       In case of model termination initiated by the local model
1264!--       (terminate_coupled > 0), the coupler must be skipped because it would
1265!--       cause an MPI intercomminucation hang.
1266!--       If necessary, the coupler will be called at the beginning of the
1267!--       next restart run.
1268          DO WHILE ( time_coupling >= dt_coupling  .AND.  terminate_coupled == 0 )
1269             CALL surface_coupler
1270             time_coupling = time_coupling - dt_coupling
1271          ENDDO
1272       ENDIF
1273
1274!
1275!--    Biometeorology calculation of stationary thermal indices
1276!--    Todo (kanani): biometeorology needs own time_... treatment.
1277!--                   It might be that time_do2d_xy differs from time_do3d,
1278!--                   and then we might get trouble with the biomet output,
1279!--                   because we can have 2d and/or 3d biomet output!!
1280       IF ( biometeorology                                                                         &
1281            .AND. ( ( time_do3d >= dt_do3d  .AND.  time_since_reference_point >= skip_time_do3d )  &
1282                  .OR.                                                                             &
1283            ( time_do2d_xy >= dt_do2d_xy  .AND.  time_since_reference_point >= skip_time_do2d_xy ) &
1284                    ) )  THEN
1285!
1286!--       If required, do thermal comfort calculations
1287          IF ( thermal_comfort )  THEN
1288             CALL bio_calculate_thermal_index_maps ( .FALSE. )
1289          ENDIF
1290!
1291!--       If required, do UV exposure calculations
1292          IF ( uv_exposure )  THEN
1293             CALL bio_calculate_uv_exposure
1294          ENDIF
1295       ENDIF
1296
1297!
1298!--    Execute alle other module actions routunes
1299       CALL module_interface_actions( 'after_integration' )
1300
1301!
1302!--    If Galilei transformation is used, determine the distance that the
1303!--    model has moved so far
1304       IF ( galilei_transformation )  THEN
1305          advected_distance_x = advected_distance_x + u_gtrans * dt_3d
1306          advected_distance_y = advected_distance_y + v_gtrans * dt_3d
1307       ENDIF
1308
1309!
1310!--    Check, if restart is necessary (because cpu-time is expiring or
1311!--    because it is forced by user) and set stop flag
1312!--    This call is skipped if the remote model has already initiated a restart.
1313       IF ( .NOT. terminate_run )  CALL check_for_restart
1314
1315!
1316!--    Carry out statistical analysis and output at the requested output times.
1317!--    The MOD function is used for calculating the output time counters (like
1318!--    time_dopr) in order to regard a possible decrease of the output time
1319!--    interval in case of restart runs
1320
1321!
1322!--    Set a flag indicating that so far no statistics have been created
1323!--    for this time step
1324       flow_statistics_called = .FALSE.
1325
1326!
1327!--    If required, call flow_statistics for averaging in time
1328       IF ( averaging_interval_pr /= 0.0_wp  .AND.                                                 &
1329            ( dt_dopr - time_dopr ) <= averaging_interval_pr  .AND.                                &
1330            time_since_reference_point >= skip_time_dopr )  THEN
1331          time_dopr_av = time_dopr_av + dt_3d
1332          IF ( time_dopr_av >= dt_averaging_input_pr )  THEN
1333             do_sum = .TRUE.
1334             time_dopr_av = MOD( time_dopr_av, MAX( dt_averaging_input_pr, dt_3d ) )
1335          ENDIF
1336       ENDIF
1337       IF ( do_sum )  CALL flow_statistics
1338
1339!
1340!--    Sum-up 3d-arrays for later output of time-averaged 2d/3d/masked data
1341       IF ( averaging_interval /= 0.0_wp  .AND.                                                    &
1342            ( dt_data_output_av - time_do_av ) <= averaging_interval  .AND.                        &
1343            time_since_reference_point >= skip_time_data_output_av )                               &
1344       THEN
1345          time_do_sla = time_do_sla + dt_3d
1346          IF ( time_do_sla >= dt_averaging_input )  THEN
1347             IF ( current_timestep_number > timestep_number_at_prev_calc )                         &
1348                CALL doq_calculate
1349
1350             CALL sum_up_3d_data
1351             average_count_3d = average_count_3d + 1
1352             time_do_sla = MOD( time_do_sla, MAX( dt_averaging_input, dt_3d ) )
1353          ENDIF
1354       ENDIF
1355!
1356!--    Average surface data
1357       IF ( surface_output )  THEN
1358          IF ( averaging_interval_surf /= 0.0_wp                                                   &
1359                .AND.  ( dt_dosurf_av - time_dosurf_av ) <= averaging_interval_surf                &
1360                .AND.  time_since_reference_point >= skip_time_dosurf_av )  THEN
1361             IF ( time_dosurf_av >= dt_averaging_input )  THEN
1362                CALL surface_data_output_averaging
1363                average_count_surf = average_count_surf + 1
1364             ENDIF
1365          ENDIF
1366       ENDIF
1367
1368!
1369!--    Calculate spectra for time averaging
1370       IF ( averaging_interval_sp /= 0.0_wp  .AND. ( dt_dosp - time_dosp ) <= averaging_interval_sp&
1371            .AND.  time_since_reference_point >= skip_time_dosp )  THEN
1372          time_dosp_av = time_dosp_av + dt_3d
1373          IF ( time_dosp_av >= dt_averaging_input_pr )  THEN
1374             CALL calc_spectra
1375             time_dosp_av = MOD( time_dosp_av, MAX( dt_averaging_input_pr, dt_3d ) )
1376          ENDIF
1377       ENDIF
1378
1379!
1380!--    Call flight module and output data
1381       IF ( virtual_flight )  THEN
1382          CALL flight_measurement
1383          CALL data_output_flight
1384       ENDIF
1385!
1386!--    Take virtual measurements
1387       IF ( virtual_measurement  .AND.  time_virtual_measurement >= dt_virtual_measurement         &
1388                                 .AND.  vm_time_start <= time_since_reference_point )  THEN
1389          CALL vm_sampling
1390          CALL vm_data_output
1391          time_virtual_measurement = MOD(      time_virtual_measurement,                           &
1392                                          MAX( dt_virtual_measurement, dt_3d ) )
1393       ENDIF
1394
1395!
1396!--    Output wind turbine data
1397       IF ( wind_turbine  .AND.  time_wtm >= dt_data_output_wtm )  THEN
1398          CALL wtm_data_output
1399          time_wtm = MOD( time_wtm, MAX( dt_data_output_wtm, dt_3d ) )
1400       ENDIF
1401
1402!
1403!--    Profile output (ASCII) on file
1404       IF ( time_dopr_listing >= dt_dopr_listing )  THEN
1405          CALL print_1d
1406          time_dopr_listing = MOD( time_dopr_listing, MAX( dt_dopr_listing, dt_3d ) )
1407       ENDIF
1408
1409!
1410!--    Graphic output for PROFIL
1411       IF ( time_dopr >= dt_dopr  .AND.  time_since_reference_point >= skip_time_dopr )  THEN
1412          IF ( dopr_n /= 0 )  CALL data_output_profiles
1413          time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_3d ) )
1414          time_dopr_av = 0.0_wp    ! due to averaging (see above)
1415       ENDIF
1416
1417!
1418!--    Graphic output for time series
1419       IF ( time_dots >= dt_dots )  THEN
1420          CALL data_output_tseries
1421          time_dots = MOD( time_dots, MAX( dt_dots, dt_3d ) )
1422       ENDIF
1423
1424!
1425!--    Output of spectra (formatted for use with PROFIL), in case of no
1426!--    time averaging, spectra has to be calculated before
1427       IF ( time_dosp >= dt_dosp  .AND.  time_since_reference_point >= skip_time_dosp )  THEN
1428          IF ( average_count_sp == 0 )  CALL calc_spectra
1429          CALL data_output_spectra
1430          time_dosp = MOD( time_dosp, MAX( dt_dosp, dt_3d ) )
1431       ENDIF
1432
1433!
1434!--    2d-data output (cross-sections)
1435       IF ( time_do2d_xy >= dt_do2d_xy  .AND.  time_since_reference_point >= skip_time_do2d_xy )  THEN
1436          IF ( current_timestep_number > timestep_number_at_prev_calc )                            &
1437             CALL doq_calculate
1438
1439          CALL data_output_2d( 'xy', 0 )
1440          time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) )
1441       ENDIF
1442       IF ( time_do2d_xz >= dt_do2d_xz  .AND.  time_since_reference_point >= skip_time_do2d_xz )  THEN
1443          IF ( current_timestep_number > timestep_number_at_prev_calc )                            &
1444
1445             CALL doq_calculate
1446          CALL data_output_2d( 'xz', 0 )
1447          time_do2d_xz = MOD( time_do2d_xz, MAX( dt_do2d_xz, dt_3d ) )
1448       ENDIF
1449       IF ( time_do2d_yz >= dt_do2d_yz  .AND.  time_since_reference_point >= skip_time_do2d_yz )  THEN
1450          IF ( current_timestep_number > timestep_number_at_prev_calc )                            &
1451             CALL doq_calculate
1452
1453          CALL data_output_2d( 'yz', 0 )
1454          time_do2d_yz = MOD( time_do2d_yz, MAX( dt_do2d_yz, dt_3d ) )
1455       ENDIF
1456
1457!
1458!--    3d-data output (volume data)
1459       IF ( time_do3d >= dt_do3d  .AND.  time_since_reference_point >= skip_time_do3d )  THEN
1460          IF ( current_timestep_number > timestep_number_at_prev_calc )                            &
1461             CALL doq_calculate
1462
1463          CALL data_output_3d( 0 )
1464          time_do3d = MOD( time_do3d, MAX( dt_do3d, dt_3d ) )
1465       ENDIF
1466
1467!
1468!--    Masked data output
1469       DO  mid = 1, masks
1470          IF ( time_domask(mid) >= dt_domask(mid)                                                  &
1471               .AND.  time_since_reference_point >= skip_time_domask(mid) )  THEN
1472             IF ( current_timestep_number > timestep_number_at_prev_calc )                         &
1473                CALL doq_calculate
1474
1475             CALL data_output_mask( 0, mid )
1476             time_domask(mid) = MOD( time_domask(mid), MAX( dt_domask(mid), dt_3d ) )
1477          ENDIF
1478       ENDDO
1479
1480!
1481!--    Output of time-averaged 2d/3d/masked data
1482       IF ( time_do_av >= dt_data_output_av                                                        &
1483            .AND.  time_since_reference_point >= skip_time_data_output_av )  THEN
1484          CALL average_3d_data
1485!
1486!--       Udate thermal comfort indices based on updated averaged input
1487          IF ( biometeorology  .AND.  thermal_comfort )  THEN
1488             CALL bio_calculate_thermal_index_maps ( .TRUE. )
1489          ENDIF
1490          CALL data_output_2d( 'xy', 1 )
1491          CALL data_output_2d( 'xz', 1 )
1492          CALL data_output_2d( 'yz', 1 )
1493          CALL data_output_3d( 1 )
1494          DO  mid = 1, masks
1495             CALL data_output_mask( 1, mid )
1496          ENDDO
1497          time_do_av = MOD( time_do_av, MAX( dt_data_output_av, dt_3d ) )
1498       ENDIF
1499!
1500!--    Output of surface data, instantaneous and averaged data
1501       IF ( surface_output )  THEN
1502          IF ( time_dosurf >= dt_dosurf  .AND.  time_since_reference_point >= skip_time_dosurf )  THEN
1503             CALL surface_data_output( 0 )
1504             time_dosurf = MOD( time_dosurf, MAX( dt_dosurf, dt_3d ) )
1505          ENDIF
1506          IF ( time_dosurf_av >= dt_dosurf_av  .AND.  time_since_reference_point >= skip_time_dosurf_av )  THEN
1507             CALL surface_data_output( 1 )
1508             time_dosurf_av = MOD( time_dosurf_av, MAX( dt_dosurf_av, dt_3d ) )
1509          ENDIF
1510       ENDIF
1511
1512!
1513!--    Output of particle time series
1514       IF ( particle_advection )  THEN
1515          IF ( time_dopts >= dt_dopts  .OR.                                                        &
1516               ( time_since_reference_point >= particle_advection_start  .AND.                     &
1517                 first_call_lpm ) )  THEN
1518             CALL lpm_data_output_ptseries
1519             time_dopts = MOD( time_dopts, MAX( dt_dopts, dt_3d ) )
1520          ENDIF
1521       ENDIF
1522
1523!
1524!--    If required, set the heat flux for the next time step to a random value
1525       IF ( constant_heatflux  .AND.  random_heatflux )  THEN
1526          IF ( surf_def_h(0)%ns >= 1 )  THEN
1527             CALL cpu_log( log_point(23), 'disturb_heatflux', 'start' )
1528             CALL disturb_heatflux( surf_def_h(0) )
1529             CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' )
1530          ENDIF
1531          IF ( surf_lsm_h(0)%ns >= 1 )  THEN
1532             CALL cpu_log( log_point(23), 'disturb_heatflux', 'start' )
1533             CALL disturb_heatflux( surf_lsm_h(0) )
1534             CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' )
1535          ENDIF
1536          IF ( surf_usm_h(0)%ns >= 1 )  THEN
1537             CALL cpu_log( log_point(23), 'disturb_heatflux', 'start' )
1538             CALL disturb_heatflux( surf_usm_h(0) )
1539             CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' )
1540          ENDIF
1541       ENDIF
1542
1543!
1544!--    Execute alle other module actions routunes
1545       CALL module_interface_actions( 'after_timestep' )
1546
1547!
1548!--    Determine size of next time step. Save timestep dt_3d because it is
1549!--    newly calculated in routine timestep, but required further below for
1550!--    steering the run control output interval
1551       dt_3d_old = dt_3d
1552       CALL timestep
1553
1554#if defined( __parallel )
1555!
1556!--    Synchronize the timestep in case of nested run.
1557       IF ( nested_run )  THEN
1558!
1559!--       Synchronize by unifying the time step.
1560!--       Global minimum of all time-steps is used for all.
1561          CALL pmci_synchronize
1562       ENDIF
1563#endif
1564
1565!
1566!--    Computation and output of run control parameters.
1567!--    This is also done whenever perturbations have been imposed
1568       IF ( time_run_control >= dt_run_control  .OR.                                               &
1569            timestep_scheme(1:5) /= 'runge'  .OR.  disturbance_created )                           &
1570       THEN
1571          CALL run_control
1572          IF ( time_run_control >= dt_run_control )  THEN
1573             time_run_control = MOD( time_run_control, MAX( dt_run_control, dt_3d_old ) )
1574          ENDIF
1575       ENDIF
1576
1577!
1578!--    Output elapsed simulated time in form of a progress bar on stdout
1579       IF ( myid == 0 )  CALL output_progress_bar
1580
1581       IF ( debug_output_timestep )  THEN
1582           WRITE( debug_string, * ) 'time_integration', simulated_time
1583           CALL debug_message( debug_string, 'end' )
1584       ENDIF
1585
1586       CALL cpu_log( log_point_s(10), 'timesteps', 'stop' )
1587
1588
1589    ENDDO   ! time loop
1590
1591#if defined( _OPENACC )
1592    CALL exit_surface_arrays
1593#endif
1594!$ACC END DATA
1595!$ACC END DATA
1596!$ACC END DATA
1597!$ACC END DATA
1598!$ACC END DATA
1599!$ACC END DATA
1600!$ACC END DATA
1601!$ACC END DATA
1602
1603    IF ( myid == 0 )  CALL finish_progress_bar
1604
1605    CALL location_message( 'atmosphere (and/or ocean) time-stepping', 'finished' )
1606
1607 END SUBROUTINE time_integration
Note: See TracBrowser for help on using the repository browser.