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