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