[1] | 1 | SUBROUTINE time_integration |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1092] | 21 | ! ------------------ |
---|
[1321] | 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: time_integration.f90 1321 2014-03-20 09:40:40Z maronga $ |
---|
| 27 | ! |
---|
| 28 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 29 | ! ONLY-attribute added to USE-statements, |
---|
| 30 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 31 | ! kinds are defined in new module kinds, |
---|
| 32 | ! old module precision_kind is removed, |
---|
| 33 | ! revision history before 2012 removed, |
---|
| 34 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 35 | ! all variable declaration statements |
---|
[1319] | 36 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 37 | ! module interfaces removed |
---|
| 38 | ! |
---|
[1309] | 39 | ! 1308 2014-03-13 14:58:42Z fricke |
---|
| 40 | ! +netcdf_data_format_save |
---|
| 41 | ! For masked data, parallel netcdf output is not tested so far, hence |
---|
| 42 | ! netcdf_data_format is switched back to non-paralell output. |
---|
| 43 | ! |
---|
[1277] | 44 | ! 1276 2014-01-15 13:40:41Z heinze |
---|
| 45 | ! Use LSF_DATA also in case of Dirichlet bottom boundary condition for scalars |
---|
| 46 | ! |
---|
[1258] | 47 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
| 48 | ! acc-update-host directive for timestep removed |
---|
| 49 | ! |
---|
[1242] | 50 | ! 1241 2013-10-30 11:36:58Z heinze |
---|
| 51 | ! Generalize calc_mean_profile for wider use |
---|
| 52 | ! Determine shf and qsws in dependence on data from LSF_DATA |
---|
| 53 | ! Determine ug and vg in dependence on data from LSF_DATA |
---|
[1222] | 54 | ! 1221 2013-09-10 08:59:13Z raasch |
---|
| 55 | ! host update of arrays before timestep is called |
---|
| 56 | ! |
---|
[1182] | 57 | ! 1179 2013-06-14 05:57:58Z raasch |
---|
| 58 | ! mean profiles for reference state are only calculated if required, |
---|
| 59 | ! small bugfix for background communication |
---|
| 60 | ! |
---|
[1172] | 61 | ! 1171 2013-05-30 11:27:45Z raasch |
---|
| 62 | ! split of prognostic_equations deactivated (comment lines), for the time being |
---|
| 63 | ! |
---|
[1132] | 64 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
[1128] | 65 | ! asynchronous transfer of ghost point data realized for acc-optimized version: |
---|
| 66 | ! prognostic_equations are first called two times for those points required for |
---|
| 67 | ! the left-right and north-south exchange, respectively, and then for the |
---|
| 68 | ! remaining points, |
---|
| 69 | ! those parts requiring global communication moved from prognostic_equations to |
---|
| 70 | ! here |
---|
[392] | 71 | ! |
---|
[1116] | 72 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 73 | ! calculation of qr and nr is restricted to precipitation |
---|
| 74 | ! |
---|
[1114] | 75 | ! 1113 2013-03-10 02:48:14Z raasch |
---|
| 76 | ! GPU-porting of boundary conditions, |
---|
| 77 | ! openACC directives updated |
---|
| 78 | ! formal parameter removed from routine boundary_conds |
---|
| 79 | ! |
---|
[1112] | 80 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
| 81 | ! +internal timestep counter for cpu statistics added, |
---|
| 82 | ! openACC directives updated |
---|
| 83 | ! |
---|
[1093] | 84 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 85 | ! unused variables removed |
---|
| 86 | ! |
---|
[1066] | 87 | ! 1065 2012-11-22 17:42:36Z hoffmann |
---|
| 88 | ! exchange of diss (dissipation rate) in case of turbulence = .TRUE. added |
---|
| 89 | ! |
---|
[1054] | 90 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 91 | ! exchange of ghost points for nr, qr added |
---|
| 92 | ! |
---|
[1037] | 93 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 94 | ! code put under GPL (PALM 3.9) |
---|
| 95 | ! |
---|
[1020] | 96 | ! 1019 2012-09-28 06:46:45Z raasch |
---|
| 97 | ! non-optimized version of prognostic_equations removed |
---|
| 98 | ! |
---|
[1017] | 99 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 100 | ! +call of prognostic_equations_acc |
---|
| 101 | ! |
---|
[1002] | 102 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
| 103 | ! all actions concerning leapfrog- and upstream-spline-scheme removed |
---|
| 104 | ! |
---|
[850] | 105 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 106 | ! advec_particles renamed lpm, first_call_advec_particles renamed first_call_lpm |
---|
| 107 | ! |
---|
[826] | 108 | ! 825 2012-02-19 03:03:44Z raasch |
---|
| 109 | ! wang_collision_kernel renamed wang_kernel |
---|
| 110 | ! |
---|
[1] | 111 | ! Revision 1.1 1997/08/11 06:19:04 raasch |
---|
| 112 | ! Initial revision |
---|
| 113 | ! |
---|
| 114 | ! |
---|
| 115 | ! Description: |
---|
| 116 | ! ------------ |
---|
| 117 | ! Integration in time of the model equations, statistical analysis and graphic |
---|
| 118 | ! output |
---|
| 119 | !------------------------------------------------------------------------------! |
---|
| 120 | |
---|
[1320] | 121 | USE advec_ws, & |
---|
| 122 | ONLY: ws_statistics |
---|
| 123 | |
---|
| 124 | USE arrays_3d, & |
---|
| 125 | ONLY: diss, e_p, nr_p, prho, pt, pt_p, ql, ql_c, ql_v, ql_vp, qr_p, & |
---|
| 126 | q_p, rho, sa_p, tend, u, u_p, v, vpt, v_p, w_p |
---|
| 127 | |
---|
| 128 | USE buoyancy_mod, & |
---|
| 129 | ONLY: calc_mean_profile |
---|
| 130 | |
---|
| 131 | USE control_parameters, & |
---|
| 132 | ONLY: advected_distance_x, advected_distance_y, average_count_3d, & |
---|
| 133 | average_count_sp, averaging_interval, averaging_interval_pr, & |
---|
| 134 | averaging_interval_sp, bc_lr_cyc, bc_ns_cyc, & |
---|
| 135 | call_psolver_at_all_substeps, cloud_droplets, cloud_physics, & |
---|
| 136 | constant_heatflux, create_disturbances, dopr_n, & |
---|
| 137 | constant_diffusion, coupling_mode, coupling_start_time, & |
---|
| 138 | current_timestep_number, disturbance_created, & |
---|
| 139 | disturbance_energy_limit, dist_range, do_sum, dt_3d, & |
---|
| 140 | dt_averaging_input, dt_averaging_input_pr, dt_coupling, & |
---|
| 141 | dt_data_output_av, dt_disturb, dt_do2d_xy, dt_do2d_xz, & |
---|
| 142 | dt_do2d_yz, dt_do3d, dt_domask,dt_dopts, dt_dopr, & |
---|
| 143 | dt_dopr_listing, dt_dosp, dt_dots, dt_dvrp, dt_run_control, & |
---|
| 144 | end_time, first_call_lpm, galilei_transformation, humidity, & |
---|
| 145 | icloud_scheme, intermediate_timestep_count, & |
---|
| 146 | intermediate_timestep_count_max, large_scale_forcing, & |
---|
| 147 | loop_optimization, lsf_surf, lsf_vert, masks, mid, & |
---|
| 148 | netcdf_data_format, neutral, nr_timesteps_this_run, ocean, & |
---|
| 149 | on_device, passive_scalar, prandtl_layer, precipitation, & |
---|
| 150 | prho_reference, pt_reference, pt_slope_offset, random_heatflux, & |
---|
| 151 | run_coupled, simulated_time, simulated_time_chr, & |
---|
| 152 | skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz, & |
---|
| 153 | skip_time_do3d, skip_time_domask, skip_time_dopr, & |
---|
| 154 | skip_time_dosp, skip_time_data_output_av, sloping_surface, & |
---|
| 155 | stop_dt, terminate_coupled, terminate_run, timestep_scheme, & |
---|
| 156 | time_coupling, time_do2d_xy, time_do2d_xz, time_do2d_yz, & |
---|
| 157 | time_do3d, time_domask, time_dopr, time_dopr_av, & |
---|
| 158 | time_dopr_listing, time_dopts, time_dosp, time_dosp_av, & |
---|
| 159 | time_dots, time_do_av, time_do_sla, time_disturb, time_dvrp, & |
---|
| 160 | time_run_control, time_since_reference_point, turbulence, & |
---|
| 161 | turbulent_inflow, use_initial_profile_as_reference, & |
---|
| 162 | use_single_reference_value, u_gtrans, v_gtrans, ws_scheme_mom, & |
---|
| 163 | ws_scheme_sca |
---|
| 164 | |
---|
| 165 | USE cpulog, & |
---|
| 166 | ONLY: cpu_log, log_point, log_point_s |
---|
| 167 | |
---|
| 168 | USE indices, & |
---|
| 169 | ONLY: i_left, i_right, j_north, j_south, nbgp, nx, nxl, nxlg, nxr, & |
---|
| 170 | nxrg, nyn, nys, nzb, nzb_u_inner, nzb_v_inner |
---|
| 171 | |
---|
| 172 | USE interaction_droplets_ptq_mod, & |
---|
| 173 | ONLY: interaction_droplets_ptq |
---|
| 174 | |
---|
| 175 | USE kinds |
---|
| 176 | |
---|
| 177 | USE ls_forcing_mod, & |
---|
| 178 | ONLY: ls_forcing_surf, ls_forcing_vert |
---|
| 179 | |
---|
| 180 | USE particle_attributes, & |
---|
| 181 | ONLY: particle_advection, particle_advection_start, wang_kernel |
---|
| 182 | |
---|
[1] | 183 | USE pegrid |
---|
| 184 | |
---|
[1320] | 185 | USE production_e_mod, & |
---|
| 186 | ONLY: production_e_init |
---|
| 187 | |
---|
| 188 | USE prognostic_equations_mod, & |
---|
| 189 | ONLY: prognostic_equations_acc, prognostic_equations_cache, & |
---|
| 190 | prognostic_equations_vector |
---|
| 191 | |
---|
| 192 | USE statistics, & |
---|
| 193 | ONLY: flow_statistics_called, hom, pr_palm |
---|
| 194 | |
---|
| 195 | USE user_actions_mod, & |
---|
| 196 | ONLY: user_actions |
---|
| 197 | |
---|
[1] | 198 | IMPLICIT NONE |
---|
| 199 | |
---|
[1320] | 200 | CHARACTER (LEN=9) :: time_to_string !: |
---|
[1] | 201 | |
---|
[1320] | 202 | INTEGER(iwp) :: netcdf_data_format_save !: |
---|
| 203 | |
---|
[1] | 204 | ! |
---|
| 205 | !-- At the beginning of a simulation determine the time step as well as |
---|
| 206 | !-- determine and print out the run control parameters |
---|
| 207 | IF ( simulated_time == 0.0 ) CALL timestep |
---|
[667] | 208 | |
---|
[1] | 209 | CALL run_control |
---|
| 210 | |
---|
[667] | 211 | |
---|
[108] | 212 | ! |
---|
| 213 | !-- Data exchange between coupled models in case that a call has been omitted |
---|
| 214 | !-- at the end of the previous run of a job chain. |
---|
[291] | 215 | IF ( coupling_mode /= 'uncoupled' .AND. run_coupled ) THEN |
---|
[108] | 216 | ! |
---|
| 217 | !-- In case of model termination initiated by the local model the coupler |
---|
| 218 | !-- must not be called because this would again cause an MPI hang. |
---|
| 219 | DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 ) |
---|
| 220 | CALL surface_coupler |
---|
| 221 | time_coupling = time_coupling - dt_coupling |
---|
| 222 | ENDDO |
---|
[348] | 223 | IF (time_coupling == 0.0 .AND. time_since_reference_point < dt_coupling)& |
---|
| 224 | THEN |
---|
| 225 | time_coupling = time_since_reference_point |
---|
| 226 | ENDIF |
---|
[108] | 227 | ENDIF |
---|
| 228 | |
---|
| 229 | |
---|
[1] | 230 | #if defined( __dvrp_graphics ) |
---|
| 231 | ! |
---|
| 232 | !-- Time measurement with dvrp software |
---|
| 233 | CALL DVRP_LOG_EVENT( 2, current_timestep_number ) |
---|
| 234 | #endif |
---|
| 235 | |
---|
| 236 | ! |
---|
| 237 | !-- Start of the time loop |
---|
| 238 | DO WHILE ( simulated_time < end_time .AND. .NOT. stop_dt .AND. & |
---|
| 239 | .NOT. terminate_run ) |
---|
| 240 | |
---|
| 241 | CALL cpu_log( log_point_s(10), 'timesteps', 'start' ) |
---|
[1221] | 242 | |
---|
[1] | 243 | ! |
---|
| 244 | !-- Determine size of next time step |
---|
[1221] | 245 | IF ( simulated_time /= 0.0 ) THEN |
---|
| 246 | CALL timestep |
---|
| 247 | ENDIF |
---|
| 248 | |
---|
[1] | 249 | ! |
---|
[1241] | 250 | !-- Determine ug, vg and w_subs in dependence on data from external file |
---|
| 251 | !-- LSF_DATA |
---|
| 252 | IF ( large_scale_forcing .AND. lsf_vert ) THEN |
---|
| 253 | CALL ls_forcing_vert ( simulated_time ) |
---|
| 254 | ENDIF |
---|
| 255 | |
---|
| 256 | ! |
---|
[1] | 257 | !-- Execute the user-defined actions |
---|
| 258 | CALL user_actions( 'before_timestep' ) |
---|
| 259 | |
---|
| 260 | ! |
---|
| 261 | !-- Start of intermediate step loop |
---|
| 262 | intermediate_timestep_count = 0 |
---|
| 263 | DO WHILE ( intermediate_timestep_count < & |
---|
| 264 | intermediate_timestep_count_max ) |
---|
| 265 | |
---|
| 266 | intermediate_timestep_count = intermediate_timestep_count + 1 |
---|
| 267 | |
---|
| 268 | ! |
---|
| 269 | !-- Set the steering factors for the prognostic equations which depend |
---|
| 270 | !-- on the timestep scheme |
---|
| 271 | CALL timestep_scheme_steering |
---|
| 272 | |
---|
| 273 | ! |
---|
[1128] | 274 | !-- Calculate those variables needed in the tendency terms which need |
---|
| 275 | !-- global communication |
---|
[1179] | 276 | IF ( .NOT. use_single_reference_value .AND. & |
---|
| 277 | .NOT. use_initial_profile_as_reference ) THEN |
---|
| 278 | ! |
---|
| 279 | !-- Horizontally averaged profiles to be used as reference state in |
---|
| 280 | !-- buoyancy terms (WARNING: only the respective last call of |
---|
| 281 | !-- calc_mean_profile defines the reference state!) |
---|
[1241] | 282 | IF ( .NOT. neutral ) CALL calc_mean_profile( pt, 4, 'time_int' ) |
---|
| 283 | IF ( ocean ) CALL calc_mean_profile( rho, 64, 'time_int' ) |
---|
| 284 | IF ( humidity ) CALL calc_mean_profile( vpt, 44, 'time_int' ) |
---|
[1179] | 285 | ENDIF |
---|
| 286 | |
---|
[1128] | 287 | IF ( .NOT. constant_diffusion ) CALL production_e_init |
---|
| 288 | IF ( ( ws_scheme_mom .OR. ws_scheme_sca ) .AND. & |
---|
| 289 | intermediate_timestep_count == 1 ) CALL ws_statistics |
---|
| 290 | |
---|
| 291 | ! |
---|
[1] | 292 | !-- Solve the prognostic equations. A fast cache optimized version with |
---|
| 293 | !-- only one single loop is used in case of Piascek-Williams advection |
---|
| 294 | !-- scheme. NEC vector machines use a different version, because |
---|
| 295 | !-- in the other versions a good vectorization is prohibited due to |
---|
| 296 | !-- inlining problems. |
---|
[1019] | 297 | IF ( loop_optimization == 'cache' ) THEN |
---|
| 298 | CALL prognostic_equations_cache |
---|
| 299 | ELSEIF ( loop_optimization == 'vector' ) THEN |
---|
[63] | 300 | CALL prognostic_equations_vector |
---|
[1015] | 301 | ELSEIF ( loop_optimization == 'acc' ) THEN |
---|
[1171] | 302 | i_left = nxl; i_right = nxr |
---|
| 303 | j_south = nys; j_north = nyn |
---|
| 304 | CALL prognostic_equations_acc |
---|
| 305 | |
---|
| 306 | ! i_left = nxl; i_right = nxl+nbgp-1 |
---|
[1128] | 307 | ! j_south = nys; j_north = nyn |
---|
| 308 | ! CALL prognostic_equations_acc |
---|
[1171] | 309 | ! i_left = nxr-nbgp+1; i_right = nxr |
---|
| 310 | ! j_south = nys; j_north = nyn |
---|
| 311 | ! CALL prognostic_equations_acc |
---|
[1128] | 312 | |
---|
| 313 | ! |
---|
| 314 | !-- Exchange of ghost points (lateral boundary conditions) |
---|
| 315 | IF ( background_communication ) THEN |
---|
| 316 | |
---|
| 317 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' ) |
---|
| 318 | |
---|
| 319 | send_receive = 'lr' |
---|
| 320 | sendrecv_in_background = .TRUE. |
---|
| 321 | req = 0 |
---|
| 322 | req_count = 0 |
---|
| 323 | |
---|
| 324 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
| 325 | on_device = .TRUE. ! to be removed after complete porting |
---|
| 326 | ELSE ! of ghost point exchange |
---|
| 327 | !$acc update host( e_p, pt_p, u_p, v_p, w_p ) |
---|
| 328 | ENDIF |
---|
| 329 | |
---|
| 330 | CALL exchange_horiz( u_p, nbgp ) |
---|
| 331 | CALL exchange_horiz( v_p, nbgp ) |
---|
| 332 | CALL exchange_horiz( w_p, nbgp ) |
---|
| 333 | CALL exchange_horiz( pt_p, nbgp ) |
---|
| 334 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e_p, nbgp ) |
---|
| 335 | IF ( ocean ) THEN |
---|
| 336 | CALL exchange_horiz( sa_p, nbgp ) |
---|
| 337 | CALL exchange_horiz( rho, nbgp ) |
---|
| 338 | CALL exchange_horiz( prho, nbgp ) |
---|
| 339 | ENDIF |
---|
| 340 | IF (humidity .OR. passive_scalar) THEN |
---|
| 341 | CALL exchange_horiz( q_p, nbgp ) |
---|
| 342 | IF ( cloud_physics .AND. icloud_scheme == 0 ) THEN |
---|
| 343 | CALL exchange_horiz( qr_p, nbgp ) |
---|
| 344 | CALL exchange_horiz( nr_p, nbgp ) |
---|
| 345 | ENDIF |
---|
| 346 | ENDIF |
---|
| 347 | IF ( cloud_droplets ) THEN |
---|
| 348 | CALL exchange_horiz( ql, nbgp ) |
---|
| 349 | CALL exchange_horiz( ql_c, nbgp ) |
---|
| 350 | CALL exchange_horiz( ql_v, nbgp ) |
---|
| 351 | CALL exchange_horiz( ql_vp, nbgp ) |
---|
| 352 | ENDIF |
---|
| 353 | IF ( wang_kernel .OR. turbulence ) CALL exchange_horiz( diss, nbgp ) |
---|
| 354 | |
---|
| 355 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
| 356 | on_device = .FALSE. ! to be removed after complete porting |
---|
| 357 | ELSE ! of ghost point exchange |
---|
| 358 | !$acc update device( e_p, pt_p, u_p, v_p, w_p ) |
---|
| 359 | ENDIF |
---|
| 360 | |
---|
| 361 | sendrecv_in_background = .FALSE. |
---|
| 362 | |
---|
| 363 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'pause' ) |
---|
| 364 | |
---|
| 365 | ENDIF |
---|
| 366 | |
---|
[1171] | 367 | ! i_left = nxl+nbgp; i_right = nxr-nbgp |
---|
| 368 | ! j_south = nys; j_north = nys+nbgp-1 |
---|
| 369 | ! CALL prognostic_equations_acc |
---|
| 370 | ! i_left = nxl+nbgp; i_right = nxr-nbgp |
---|
| 371 | ! j_south = nyn-nbgp+1; j_north = nyn |
---|
| 372 | ! CALL prognostic_equations_acc |
---|
[1128] | 373 | |
---|
| 374 | IF ( background_communication ) THEN |
---|
| 375 | CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'start' ) |
---|
| 376 | #if defined( __parallel ) |
---|
| 377 | CALL MPI_WAITALL( req_count, req, wait_stat, ierr ) |
---|
| 378 | #endif |
---|
| 379 | CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'pause' ) |
---|
| 380 | |
---|
| 381 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'continue' ) |
---|
| 382 | |
---|
| 383 | send_receive = 'ns' |
---|
| 384 | sendrecv_in_background = .TRUE. |
---|
| 385 | req = 0 |
---|
| 386 | req_count = 0 |
---|
| 387 | |
---|
| 388 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
| 389 | on_device = .TRUE. ! to be removed after complete porting |
---|
| 390 | ELSE ! of ghost point exchange |
---|
| 391 | !$acc update host( e_p, pt_p, u_p, v_p, w_p ) |
---|
| 392 | ENDIF |
---|
| 393 | |
---|
| 394 | CALL exchange_horiz( u_p, nbgp ) |
---|
| 395 | CALL exchange_horiz( v_p, nbgp ) |
---|
| 396 | CALL exchange_horiz( w_p, nbgp ) |
---|
| 397 | CALL exchange_horiz( pt_p, nbgp ) |
---|
| 398 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e_p, nbgp ) |
---|
| 399 | IF ( ocean ) THEN |
---|
| 400 | CALL exchange_horiz( sa_p, nbgp ) |
---|
| 401 | CALL exchange_horiz( rho, nbgp ) |
---|
| 402 | CALL exchange_horiz( prho, nbgp ) |
---|
| 403 | ENDIF |
---|
| 404 | IF (humidity .OR. passive_scalar) THEN |
---|
| 405 | CALL exchange_horiz( q_p, nbgp ) |
---|
| 406 | IF ( cloud_physics .AND. icloud_scheme == 0 ) THEN |
---|
| 407 | CALL exchange_horiz( qr_p, nbgp ) |
---|
| 408 | CALL exchange_horiz( nr_p, nbgp ) |
---|
| 409 | ENDIF |
---|
| 410 | ENDIF |
---|
| 411 | IF ( cloud_droplets ) THEN |
---|
| 412 | CALL exchange_horiz( ql, nbgp ) |
---|
| 413 | CALL exchange_horiz( ql_c, nbgp ) |
---|
| 414 | CALL exchange_horiz( ql_v, nbgp ) |
---|
| 415 | CALL exchange_horiz( ql_vp, nbgp ) |
---|
| 416 | ENDIF |
---|
| 417 | IF ( wang_kernel .OR. turbulence ) CALL exchange_horiz( diss, nbgp ) |
---|
| 418 | |
---|
| 419 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
| 420 | on_device = .FALSE. ! to be removed after complete porting |
---|
| 421 | ELSE ! of ghost point exchange |
---|
| 422 | !$acc update device( e_p, pt_p, u_p, v_p, w_p ) |
---|
| 423 | ENDIF |
---|
| 424 | |
---|
| 425 | sendrecv_in_background = .FALSE. |
---|
| 426 | |
---|
| 427 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' ) |
---|
| 428 | |
---|
| 429 | ENDIF |
---|
| 430 | |
---|
[1171] | 431 | ! i_left = nxl+nbgp; i_right = nxr-nbgp |
---|
| 432 | ! j_south = nys+nbgp; j_north = nyn-nbgp |
---|
| 433 | ! CALL prognostic_equations_acc |
---|
[1128] | 434 | |
---|
| 435 | IF ( background_communication ) THEN |
---|
| 436 | CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'continue' ) |
---|
| 437 | #if defined( __parallel ) |
---|
| 438 | CALL MPI_WAITALL( req_count, req, wait_stat, ierr ) |
---|
| 439 | #endif |
---|
| 440 | send_receive = 'al' |
---|
| 441 | CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'stop' ) |
---|
| 442 | ENDIF |
---|
| 443 | |
---|
[1] | 444 | ENDIF |
---|
| 445 | |
---|
| 446 | ! |
---|
[849] | 447 | !-- Particle transport/physics with the Lagrangian particle model |
---|
| 448 | !-- (only once during intermediate steps, because it uses an Euler-step) |
---|
[1128] | 449 | !-- ### particle model should be moved before prognostic_equations, in order |
---|
| 450 | !-- to regard droplet interactions directly |
---|
[63] | 451 | IF ( particle_advection .AND. & |
---|
| 452 | simulated_time >= particle_advection_start .AND. & |
---|
[1] | 453 | intermediate_timestep_count == 1 ) THEN |
---|
[849] | 454 | CALL lpm |
---|
| 455 | first_call_lpm = .FALSE. |
---|
[1] | 456 | ENDIF |
---|
| 457 | |
---|
| 458 | ! |
---|
| 459 | !-- Interaction of droplets with temperature and specific humidity. |
---|
| 460 | !-- Droplet condensation and evaporation is calculated within |
---|
| 461 | !-- advec_particles. |
---|
| 462 | IF ( cloud_droplets .AND. & |
---|
| 463 | intermediate_timestep_count == intermediate_timestep_count_max )& |
---|
| 464 | THEN |
---|
| 465 | CALL interaction_droplets_ptq |
---|
| 466 | ENDIF |
---|
| 467 | |
---|
| 468 | ! |
---|
| 469 | !-- Exchange of ghost points (lateral boundary conditions) |
---|
[1128] | 470 | IF ( .NOT. background_communication ) THEN |
---|
[1113] | 471 | |
---|
[1128] | 472 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' ) |
---|
[1113] | 473 | |
---|
[1128] | 474 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
| 475 | on_device = .TRUE. ! to be removed after complete porting |
---|
| 476 | ELSE ! of ghost point exchange |
---|
| 477 | !$acc update host( e_p, pt_p, u_p, v_p, w_p ) |
---|
[1053] | 478 | ENDIF |
---|
[1] | 479 | |
---|
[1128] | 480 | CALL exchange_horiz( u_p, nbgp ) |
---|
| 481 | CALL exchange_horiz( v_p, nbgp ) |
---|
| 482 | CALL exchange_horiz( w_p, nbgp ) |
---|
| 483 | CALL exchange_horiz( pt_p, nbgp ) |
---|
| 484 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e_p, nbgp ) |
---|
| 485 | IF ( ocean ) THEN |
---|
| 486 | CALL exchange_horiz( sa_p, nbgp ) |
---|
| 487 | CALL exchange_horiz( rho, nbgp ) |
---|
| 488 | CALL exchange_horiz( prho, nbgp ) |
---|
| 489 | ENDIF |
---|
| 490 | IF (humidity .OR. passive_scalar) THEN |
---|
| 491 | CALL exchange_horiz( q_p, nbgp ) |
---|
[1179] | 492 | IF ( cloud_physics .AND. icloud_scheme == 0 .AND. & |
---|
| 493 | precipitation ) THEN |
---|
[1128] | 494 | CALL exchange_horiz( qr_p, nbgp ) |
---|
| 495 | CALL exchange_horiz( nr_p, nbgp ) |
---|
| 496 | ENDIF |
---|
| 497 | ENDIF |
---|
| 498 | IF ( cloud_droplets ) THEN |
---|
| 499 | CALL exchange_horiz( ql, nbgp ) |
---|
| 500 | CALL exchange_horiz( ql_c, nbgp ) |
---|
| 501 | CALL exchange_horiz( ql_v, nbgp ) |
---|
| 502 | CALL exchange_horiz( ql_vp, nbgp ) |
---|
| 503 | ENDIF |
---|
| 504 | IF ( wang_kernel .OR. turbulence ) CALL exchange_horiz( diss, nbgp ) |
---|
| 505 | |
---|
| 506 | IF ( numprocs == 1 ) THEN ! workaround for single-core GPU runs |
---|
| 507 | on_device = .FALSE. ! to be removed after complete porting |
---|
| 508 | ELSE ! of ghost point exchange |
---|
| 509 | !$acc update device( e_p, pt_p, u_p, v_p, w_p ) |
---|
| 510 | ENDIF |
---|
| 511 | |
---|
| 512 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' ) |
---|
| 513 | |
---|
[1113] | 514 | ENDIF |
---|
| 515 | |
---|
[1] | 516 | ! |
---|
| 517 | !-- Boundary conditions for the prognostic quantities (except of the |
---|
| 518 | !-- velocities at the outflow in case of a non-cyclic lateral wall) |
---|
[1113] | 519 | CALL boundary_conds |
---|
[1] | 520 | |
---|
| 521 | ! |
---|
[73] | 522 | !-- Swap the time levels in preparation for the next time step. |
---|
| 523 | CALL swap_timelevel |
---|
| 524 | |
---|
| 525 | ! |
---|
[1] | 526 | !-- Temperature offset must be imposed at cyclic boundaries in x-direction |
---|
| 527 | !-- when a sloping surface is used |
---|
| 528 | IF ( sloping_surface ) THEN |
---|
[707] | 529 | IF ( nxl == 0 ) pt(:,:,nxlg:nxl-1) = pt(:,:,nxlg:nxl-1) - & |
---|
| 530 | pt_slope_offset |
---|
| 531 | IF ( nxr == nx ) pt(:,:,nxr+1:nxrg) = pt(:,:,nxr+1:nxrg) + & |
---|
| 532 | pt_slope_offset |
---|
[1] | 533 | ENDIF |
---|
| 534 | |
---|
| 535 | ! |
---|
[151] | 536 | !-- Impose a turbulent inflow using the recycling method |
---|
| 537 | IF ( turbulent_inflow ) CALL inflow_turbulence |
---|
| 538 | |
---|
| 539 | ! |
---|
[1] | 540 | !-- Impose a random perturbation on the horizontal velocity field |
---|
[106] | 541 | IF ( create_disturbances .AND. & |
---|
| 542 | ( call_psolver_at_all_substeps .AND. & |
---|
[1] | 543 | intermediate_timestep_count == intermediate_timestep_count_max )& |
---|
[106] | 544 | .OR. ( .NOT. call_psolver_at_all_substeps .AND. & |
---|
| 545 | intermediate_timestep_count == 1 ) ) & |
---|
[1] | 546 | THEN |
---|
| 547 | time_disturb = time_disturb + dt_3d |
---|
| 548 | IF ( time_disturb >= dt_disturb ) THEN |
---|
[1111] | 549 | !$acc update host( u, v ) |
---|
[1113] | 550 | IF ( numprocs == 1 ) on_device = .FALSE. ! workaround, remove later |
---|
[87] | 551 | IF ( hom(nzb+5,1,pr_palm,0) < disturbance_energy_limit ) THEN |
---|
[75] | 552 | CALL disturb_field( nzb_u_inner, tend, u ) |
---|
| 553 | CALL disturb_field( nzb_v_inner, tend, v ) |
---|
[707] | 554 | ELSEIF ( .NOT. bc_lr_cyc .OR. .NOT. bc_ns_cyc ) THEN |
---|
[1] | 555 | ! |
---|
| 556 | !-- Runs with a non-cyclic lateral wall need perturbations |
---|
| 557 | !-- near the inflow throughout the whole simulation |
---|
| 558 | dist_range = 1 |
---|
[75] | 559 | CALL disturb_field( nzb_u_inner, tend, u ) |
---|
| 560 | CALL disturb_field( nzb_v_inner, tend, v ) |
---|
[1] | 561 | dist_range = 0 |
---|
| 562 | ENDIF |
---|
[1113] | 563 | IF ( numprocs == 1 ) on_device = .TRUE. ! workaround, remove later |
---|
[1111] | 564 | !$acc update device( u, v ) |
---|
[1] | 565 | time_disturb = time_disturb - dt_disturb |
---|
| 566 | ENDIF |
---|
| 567 | ENDIF |
---|
| 568 | |
---|
| 569 | ! |
---|
| 570 | !-- Reduce the velocity divergence via the equation for perturbation |
---|
| 571 | !-- pressure. |
---|
[106] | 572 | IF ( intermediate_timestep_count == 1 .OR. & |
---|
| 573 | call_psolver_at_all_substeps ) THEN |
---|
[1] | 574 | CALL pres |
---|
| 575 | ENDIF |
---|
| 576 | |
---|
| 577 | ! |
---|
| 578 | !-- If required, compute liquid water content |
---|
[1015] | 579 | IF ( cloud_physics ) THEN |
---|
| 580 | CALL calc_liquid_water_content |
---|
| 581 | !$acc update device( ql ) |
---|
| 582 | ENDIF |
---|
[1115] | 583 | ! |
---|
| 584 | !-- If required, compute virtual potential temperature |
---|
| 585 | IF ( humidity ) THEN |
---|
| 586 | CALL compute_vpt |
---|
| 587 | !$acc update device( vpt ) |
---|
| 588 | ENDIF |
---|
[1] | 589 | ! |
---|
| 590 | !-- Compute the diffusion quantities |
---|
| 591 | IF ( .NOT. constant_diffusion ) THEN |
---|
| 592 | |
---|
| 593 | ! |
---|
[1276] | 594 | !-- Determine surface fluxes shf and qsws and surface values |
---|
| 595 | !-- pt_surface and q_surface in dependence on data from external |
---|
| 596 | !-- file LSF_DATA respectively |
---|
| 597 | IF ( ( large_scale_forcing .AND. lsf_surf ) .AND. & |
---|
| 598 | intermediate_timestep_count == intermediate_timestep_count_max )& |
---|
| 599 | THEN |
---|
| 600 | CALL ls_forcing_surf ( simulated_time ) |
---|
| 601 | ENDIF |
---|
| 602 | |
---|
| 603 | ! |
---|
[1] | 604 | !-- First the vertical fluxes in the Prandtl layer are being computed |
---|
| 605 | IF ( prandtl_layer ) THEN |
---|
| 606 | CALL cpu_log( log_point(19), 'prandtl_fluxes', 'start' ) |
---|
| 607 | CALL prandtl_fluxes |
---|
| 608 | CALL cpu_log( log_point(19), 'prandtl_fluxes', 'stop' ) |
---|
| 609 | ENDIF |
---|
[1241] | 610 | |
---|
[1] | 611 | ! |
---|
| 612 | !-- Compute the diffusion coefficients |
---|
| 613 | CALL cpu_log( log_point(17), 'diffusivities', 'start' ) |
---|
[75] | 614 | IF ( .NOT. humidity ) THEN |
---|
[97] | 615 | IF ( ocean ) THEN |
---|
[388] | 616 | CALL diffusivities( prho, prho_reference ) |
---|
[97] | 617 | ELSE |
---|
| 618 | CALL diffusivities( pt, pt_reference ) |
---|
| 619 | ENDIF |
---|
[1] | 620 | ELSE |
---|
[97] | 621 | CALL diffusivities( vpt, pt_reference ) |
---|
[1] | 622 | ENDIF |
---|
| 623 | CALL cpu_log( log_point(17), 'diffusivities', 'stop' ) |
---|
| 624 | |
---|
| 625 | ENDIF |
---|
| 626 | |
---|
| 627 | ENDDO ! Intermediate step loop |
---|
| 628 | |
---|
| 629 | ! |
---|
| 630 | !-- Increase simulation time and output times |
---|
[1111] | 631 | nr_timesteps_this_run = nr_timesteps_this_run + 1 |
---|
[291] | 632 | current_timestep_number = current_timestep_number + 1 |
---|
| 633 | simulated_time = simulated_time + dt_3d |
---|
| 634 | simulated_time_chr = time_to_string( simulated_time ) |
---|
| 635 | time_since_reference_point = simulated_time - coupling_start_time |
---|
| 636 | |
---|
[1] | 637 | IF ( simulated_time >= skip_time_data_output_av ) THEN |
---|
| 638 | time_do_av = time_do_av + dt_3d |
---|
| 639 | ENDIF |
---|
| 640 | IF ( simulated_time >= skip_time_do2d_xy ) THEN |
---|
| 641 | time_do2d_xy = time_do2d_xy + dt_3d |
---|
| 642 | ENDIF |
---|
| 643 | IF ( simulated_time >= skip_time_do2d_xz ) THEN |
---|
| 644 | time_do2d_xz = time_do2d_xz + dt_3d |
---|
| 645 | ENDIF |
---|
| 646 | IF ( simulated_time >= skip_time_do2d_yz ) THEN |
---|
| 647 | time_do2d_yz = time_do2d_yz + dt_3d |
---|
| 648 | ENDIF |
---|
| 649 | IF ( simulated_time >= skip_time_do3d ) THEN |
---|
| 650 | time_do3d = time_do3d + dt_3d |
---|
| 651 | ENDIF |
---|
[410] | 652 | DO mid = 1, masks |
---|
| 653 | IF ( simulated_time >= skip_time_domask(mid) ) THEN |
---|
| 654 | time_domask(mid)= time_domask(mid) + dt_3d |
---|
| 655 | ENDIF |
---|
| 656 | ENDDO |
---|
[1] | 657 | time_dvrp = time_dvrp + dt_3d |
---|
| 658 | IF ( simulated_time >= skip_time_dosp ) THEN |
---|
| 659 | time_dosp = time_dosp + dt_3d |
---|
| 660 | ENDIF |
---|
| 661 | time_dots = time_dots + dt_3d |
---|
[849] | 662 | IF ( .NOT. first_call_lpm ) THEN |
---|
[1] | 663 | time_dopts = time_dopts + dt_3d |
---|
| 664 | ENDIF |
---|
| 665 | IF ( simulated_time >= skip_time_dopr ) THEN |
---|
| 666 | time_dopr = time_dopr + dt_3d |
---|
| 667 | ENDIF |
---|
| 668 | time_dopr_listing = time_dopr_listing + dt_3d |
---|
| 669 | time_run_control = time_run_control + dt_3d |
---|
| 670 | |
---|
| 671 | ! |
---|
[102] | 672 | !-- Data exchange between coupled models |
---|
[291] | 673 | IF ( coupling_mode /= 'uncoupled' .AND. run_coupled ) THEN |
---|
[102] | 674 | time_coupling = time_coupling + dt_3d |
---|
[343] | 675 | |
---|
[108] | 676 | ! |
---|
| 677 | !-- In case of model termination initiated by the local model |
---|
| 678 | !-- (terminate_coupled > 0), the coupler must be skipped because it would |
---|
| 679 | !-- cause an MPI intercomminucation hang. |
---|
| 680 | !-- If necessary, the coupler will be called at the beginning of the |
---|
| 681 | !-- next restart run. |
---|
| 682 | DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 ) |
---|
[102] | 683 | CALL surface_coupler |
---|
| 684 | time_coupling = time_coupling - dt_coupling |
---|
| 685 | ENDDO |
---|
| 686 | ENDIF |
---|
| 687 | |
---|
| 688 | ! |
---|
[46] | 689 | !-- Execute user-defined actions |
---|
| 690 | CALL user_actions( 'after_integration' ) |
---|
| 691 | |
---|
| 692 | ! |
---|
[1] | 693 | !-- If Galilei transformation is used, determine the distance that the |
---|
| 694 | !-- model has moved so far |
---|
| 695 | IF ( galilei_transformation ) THEN |
---|
| 696 | advected_distance_x = advected_distance_x + u_gtrans * dt_3d |
---|
| 697 | advected_distance_y = advected_distance_y + v_gtrans * dt_3d |
---|
| 698 | ENDIF |
---|
| 699 | |
---|
| 700 | ! |
---|
| 701 | !-- Check, if restart is necessary (because cpu-time is expiring or |
---|
| 702 | !-- because it is forced by user) and set stop flag |
---|
[108] | 703 | !-- This call is skipped if the remote model has already initiated a restart. |
---|
| 704 | IF ( .NOT. terminate_run ) CALL check_for_restart |
---|
[1] | 705 | |
---|
| 706 | ! |
---|
| 707 | !-- Carry out statistical analysis and output at the requested output times. |
---|
| 708 | !-- The MOD function is used for calculating the output time counters (like |
---|
| 709 | !-- time_dopr) in order to regard a possible decrease of the output time |
---|
| 710 | !-- interval in case of restart runs |
---|
| 711 | |
---|
| 712 | ! |
---|
| 713 | !-- Set a flag indicating that so far no statistics have been created |
---|
| 714 | !-- for this time step |
---|
| 715 | flow_statistics_called = .FALSE. |
---|
| 716 | |
---|
| 717 | ! |
---|
| 718 | !-- If required, call flow_statistics for averaging in time |
---|
| 719 | IF ( averaging_interval_pr /= 0.0 .AND. & |
---|
| 720 | ( dt_dopr - time_dopr ) <= averaging_interval_pr .AND. & |
---|
| 721 | simulated_time >= skip_time_dopr ) THEN |
---|
| 722 | time_dopr_av = time_dopr_av + dt_3d |
---|
| 723 | IF ( time_dopr_av >= dt_averaging_input_pr ) THEN |
---|
| 724 | do_sum = .TRUE. |
---|
| 725 | time_dopr_av = MOD( time_dopr_av, & |
---|
| 726 | MAX( dt_averaging_input_pr, dt_3d ) ) |
---|
| 727 | ENDIF |
---|
| 728 | ENDIF |
---|
| 729 | IF ( do_sum ) CALL flow_statistics |
---|
| 730 | |
---|
| 731 | ! |
---|
[410] | 732 | !-- Sum-up 3d-arrays for later output of time-averaged 2d/3d/masked data |
---|
[1] | 733 | IF ( averaging_interval /= 0.0 .AND. & |
---|
| 734 | ( dt_data_output_av - time_do_av ) <= averaging_interval .AND. & |
---|
| 735 | simulated_time >= skip_time_data_output_av ) & |
---|
| 736 | THEN |
---|
| 737 | time_do_sla = time_do_sla + dt_3d |
---|
| 738 | IF ( time_do_sla >= dt_averaging_input ) THEN |
---|
| 739 | CALL sum_up_3d_data |
---|
| 740 | average_count_3d = average_count_3d + 1 |
---|
| 741 | time_do_sla = MOD( time_do_sla, MAX( dt_averaging_input, dt_3d ) ) |
---|
| 742 | ENDIF |
---|
| 743 | ENDIF |
---|
| 744 | |
---|
| 745 | ! |
---|
| 746 | !-- Calculate spectra for time averaging |
---|
| 747 | IF ( averaging_interval_sp /= 0.0 .AND. & |
---|
| 748 | ( dt_dosp - time_dosp ) <= averaging_interval_sp .AND. & |
---|
| 749 | simulated_time >= skip_time_dosp ) THEN |
---|
| 750 | time_dosp_av = time_dosp_av + dt_3d |
---|
| 751 | IF ( time_dosp_av >= dt_averaging_input_pr ) THEN |
---|
| 752 | CALL calc_spectra |
---|
| 753 | time_dosp_av = MOD( time_dosp_av, & |
---|
| 754 | MAX( dt_averaging_input_pr, dt_3d ) ) |
---|
| 755 | ENDIF |
---|
| 756 | ENDIF |
---|
| 757 | |
---|
| 758 | ! |
---|
| 759 | !-- Computation and output of run control parameters. |
---|
[1001] | 760 | !-- This is also done whenever perturbations have been imposed |
---|
[1] | 761 | IF ( time_run_control >= dt_run_control .OR. & |
---|
[1001] | 762 | timestep_scheme(1:5) /= 'runge' .OR. disturbance_created ) & |
---|
[1] | 763 | THEN |
---|
| 764 | CALL run_control |
---|
| 765 | IF ( time_run_control >= dt_run_control ) THEN |
---|
| 766 | time_run_control = MOD( time_run_control, & |
---|
| 767 | MAX( dt_run_control, dt_3d ) ) |
---|
| 768 | ENDIF |
---|
| 769 | ENDIF |
---|
| 770 | |
---|
| 771 | ! |
---|
| 772 | !-- Profile output (ASCII) on file |
---|
| 773 | IF ( time_dopr_listing >= dt_dopr_listing ) THEN |
---|
| 774 | CALL print_1d |
---|
| 775 | time_dopr_listing = MOD( time_dopr_listing, MAX( dt_dopr_listing, & |
---|
| 776 | dt_3d ) ) |
---|
| 777 | ENDIF |
---|
| 778 | |
---|
| 779 | ! |
---|
| 780 | !-- Graphic output for PROFIL |
---|
| 781 | IF ( time_dopr >= dt_dopr ) THEN |
---|
| 782 | IF ( dopr_n /= 0 ) CALL data_output_profiles |
---|
| 783 | time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_3d ) ) |
---|
| 784 | time_dopr_av = 0.0 ! due to averaging (see above) |
---|
| 785 | ENDIF |
---|
| 786 | |
---|
| 787 | ! |
---|
| 788 | !-- Graphic output for time series |
---|
| 789 | IF ( time_dots >= dt_dots ) THEN |
---|
[48] | 790 | CALL data_output_tseries |
---|
[1] | 791 | time_dots = MOD( time_dots, MAX( dt_dots, dt_3d ) ) |
---|
| 792 | ENDIF |
---|
| 793 | |
---|
| 794 | ! |
---|
| 795 | !-- Output of spectra (formatted for use with PROFIL), in case of no |
---|
| 796 | !-- time averaging, spectra has to be calculated before |
---|
| 797 | IF ( time_dosp >= dt_dosp ) THEN |
---|
| 798 | IF ( average_count_sp == 0 ) CALL calc_spectra |
---|
| 799 | CALL data_output_spectra |
---|
| 800 | time_dosp = MOD( time_dosp, MAX( dt_dosp, dt_3d ) ) |
---|
| 801 | ENDIF |
---|
| 802 | |
---|
| 803 | ! |
---|
| 804 | !-- 2d-data output (cross-sections) |
---|
| 805 | IF ( time_do2d_xy >= dt_do2d_xy ) THEN |
---|
| 806 | CALL data_output_2d( 'xy', 0 ) |
---|
| 807 | time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) ) |
---|
| 808 | ENDIF |
---|
| 809 | IF ( time_do2d_xz >= dt_do2d_xz ) THEN |
---|
| 810 | CALL data_output_2d( 'xz', 0 ) |
---|
| 811 | time_do2d_xz = MOD( time_do2d_xz, MAX( dt_do2d_xz, dt_3d ) ) |
---|
| 812 | ENDIF |
---|
| 813 | IF ( time_do2d_yz >= dt_do2d_yz ) THEN |
---|
| 814 | CALL data_output_2d( 'yz', 0 ) |
---|
| 815 | time_do2d_yz = MOD( time_do2d_yz, MAX( dt_do2d_yz, dt_3d ) ) |
---|
| 816 | ENDIF |
---|
| 817 | |
---|
| 818 | ! |
---|
| 819 | !-- 3d-data output (volume data) |
---|
| 820 | IF ( time_do3d >= dt_do3d ) THEN |
---|
| 821 | CALL data_output_3d( 0 ) |
---|
| 822 | time_do3d = MOD( time_do3d, MAX( dt_do3d, dt_3d ) ) |
---|
| 823 | ENDIF |
---|
| 824 | |
---|
| 825 | ! |
---|
[410] | 826 | !-- masked data output |
---|
[1308] | 827 | !-- Parallel netcdf output is not tested so far for masked data, hence |
---|
| 828 | !-- netcdf_data_format is switched back to non-paralell output. |
---|
| 829 | netcdf_data_format_save = netcdf_data_format |
---|
| 830 | IF ( netcdf_data_format == 5 ) netcdf_data_format = 3 |
---|
| 831 | IF ( netcdf_data_format == 6 ) netcdf_data_format = 4 |
---|
[410] | 832 | DO mid = 1, masks |
---|
| 833 | IF ( time_domask(mid) >= dt_domask(mid) ) THEN |
---|
| 834 | CALL data_output_mask( 0 ) |
---|
| 835 | time_domask(mid) = MOD( time_domask(mid), & |
---|
| 836 | MAX( dt_domask(mid), dt_3d ) ) |
---|
| 837 | ENDIF |
---|
| 838 | ENDDO |
---|
[1308] | 839 | netcdf_data_format = netcdf_data_format_save |
---|
[410] | 840 | |
---|
| 841 | ! |
---|
| 842 | !-- Output of time-averaged 2d/3d/masked data |
---|
[1] | 843 | IF ( time_do_av >= dt_data_output_av ) THEN |
---|
| 844 | CALL average_3d_data |
---|
| 845 | CALL data_output_2d( 'xy', 1 ) |
---|
| 846 | CALL data_output_2d( 'xz', 1 ) |
---|
| 847 | CALL data_output_2d( 'yz', 1 ) |
---|
| 848 | CALL data_output_3d( 1 ) |
---|
[1308] | 849 | !-- Parallel netcdf output is not tested so far for masked data, hence |
---|
| 850 | !-- netcdf_data_format is switched back to non-paralell output. |
---|
| 851 | netcdf_data_format_save = netcdf_data_format |
---|
| 852 | IF ( netcdf_data_format == 5 ) netcdf_data_format = 3 |
---|
| 853 | IF ( netcdf_data_format == 6 ) netcdf_data_format = 4 |
---|
[410] | 854 | DO mid = 1, masks |
---|
| 855 | CALL data_output_mask( 1 ) |
---|
| 856 | ENDDO |
---|
[1308] | 857 | netcdf_data_format = netcdf_data_format_save |
---|
[1] | 858 | time_do_av = MOD( time_do_av, MAX( dt_data_output_av, dt_3d ) ) |
---|
| 859 | ENDIF |
---|
| 860 | |
---|
| 861 | ! |
---|
| 862 | !-- Output of particle time series |
---|
[253] | 863 | IF ( particle_advection ) THEN |
---|
| 864 | IF ( time_dopts >= dt_dopts .OR. & |
---|
| 865 | ( simulated_time >= particle_advection_start .AND. & |
---|
[849] | 866 | first_call_lpm ) ) THEN |
---|
[253] | 867 | CALL data_output_ptseries |
---|
| 868 | time_dopts = MOD( time_dopts, MAX( dt_dopts, dt_3d ) ) |
---|
| 869 | ENDIF |
---|
[1] | 870 | ENDIF |
---|
| 871 | |
---|
| 872 | ! |
---|
| 873 | !-- Output of dvrp-graphics (isosurface, particles, slicer) |
---|
| 874 | #if defined( __dvrp_graphics ) |
---|
| 875 | CALL DVRP_LOG_EVENT( -2, current_timestep_number-1 ) |
---|
| 876 | #endif |
---|
| 877 | IF ( time_dvrp >= dt_dvrp ) THEN |
---|
| 878 | CALL data_output_dvrp |
---|
| 879 | time_dvrp = MOD( time_dvrp, MAX( dt_dvrp, dt_3d ) ) |
---|
| 880 | ENDIF |
---|
| 881 | #if defined( __dvrp_graphics ) |
---|
| 882 | CALL DVRP_LOG_EVENT( 2, current_timestep_number ) |
---|
| 883 | #endif |
---|
| 884 | |
---|
| 885 | ! |
---|
| 886 | !-- If required, set the heat flux for the next time step at a random value |
---|
| 887 | IF ( constant_heatflux .AND. random_heatflux ) CALL disturb_heatflux |
---|
| 888 | |
---|
| 889 | ! |
---|
| 890 | !-- Execute user-defined actions |
---|
| 891 | CALL user_actions( 'after_timestep' ) |
---|
| 892 | |
---|
| 893 | CALL cpu_log( log_point_s(10), 'timesteps', 'stop' ) |
---|
| 894 | |
---|
[667] | 895 | |
---|
[1] | 896 | ENDDO ! time loop |
---|
| 897 | |
---|
| 898 | #if defined( __dvrp_graphics ) |
---|
| 899 | CALL DVRP_LOG_EVENT( -2, current_timestep_number ) |
---|
| 900 | #endif |
---|
| 901 | |
---|
| 902 | END SUBROUTINE time_integration |
---|