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