[1] | 1 | SUBROUTINE time_integration |
---|
| 2 | |
---|
| 3 | !------------------------------------------------------------------------------! |
---|
[484] | 4 | ! Current revisions: |
---|
[1] | 5 | ! ----------------- |
---|
[667] | 6 | ! Calls of exchange_horiz are modified. |
---|
| 7 | ! Adaption to slooping surface. |
---|
[392] | 8 | ! |
---|
| 9 | ! Former revisions: |
---|
| 10 | ! ----------------- |
---|
| 11 | ! $Id: time_integration.f90 668 2010-12-23 13:22:58Z gryschka $ |
---|
| 12 | ! |
---|
[668] | 13 | ! 667 2010-12-23 12:06:00Z suehring/gryschka |
---|
| 14 | ! Calls of exchange_horiz are modified. |
---|
| 15 | ! Adaption to slooping surface. |
---|
| 16 | ! |
---|
[482] | 17 | ! 449 2010-02-02 11:23:59Z raasch |
---|
| 18 | ! Bugfix: exchange of ghost points for prho included |
---|
| 19 | ! |
---|
[449] | 20 | ! 410 2009-12-04 17:05:40Z letzel |
---|
| 21 | ! masked data output |
---|
| 22 | ! |
---|
[392] | 23 | ! 388 2009-09-23 09:40:33Z raasch |
---|
[388] | 24 | ! Using prho instead of rho in diffusvities. |
---|
[291] | 25 | ! Coupling with independent precursor runs. |
---|
| 26 | ! Bugfix: output of particle time series only if particle advection is switched |
---|
[253] | 27 | ! on |
---|
[110] | 28 | ! |
---|
[198] | 29 | ! 151 2008-03-07 13:42:18Z raasch |
---|
| 30 | ! inflow turbulence is imposed by calling new routine inflow_turbulence |
---|
| 31 | ! |
---|
[110] | 32 | ! 108 2007-08-24 15:10:38Z letzel |
---|
[106] | 33 | ! Call of new routine surface_coupler, |
---|
| 34 | ! presure solver is called after the first Runge-Kutta substep instead of the |
---|
| 35 | ! last in case that call_psolver_at_all_substeps = .F.; for this case, the |
---|
| 36 | ! random perturbation has to be added to the velocity fields also after the |
---|
| 37 | ! first substep |
---|
[77] | 38 | ! |
---|
[98] | 39 | ! 97 2007-06-21 08:23:15Z raasch |
---|
| 40 | ! diffusivities is called with argument rho in case of ocean runs, |
---|
| 41 | ! new argument pt_/prho_reference in calls of diffusivities, |
---|
| 42 | ! ghostpoint exchange for salinity and density |
---|
| 43 | ! |
---|
[90] | 44 | ! 87 2007-05-22 15:46:47Z raasch |
---|
| 45 | ! var_hom renamed pr_palm |
---|
| 46 | ! |
---|
[77] | 47 | ! 75 2007-03-22 09:54:05Z raasch |
---|
[46] | 48 | ! Move call of user_actions( 'after_integration' ) below increment of times |
---|
[63] | 49 | ! and counters, |
---|
| 50 | ! calls of prognostic_equations_.. changed to .._noopt, .._cache, and |
---|
[75] | 51 | ! .._vector, these calls are now controlled by switch loop_optimization, |
---|
| 52 | ! uxrp, vynp eliminated, 2nd+3rd argument removed from exchange horiz, |
---|
| 53 | ! moisture renamed humidity |
---|
[1] | 54 | ! |
---|
[3] | 55 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
| 56 | ! |
---|
[1] | 57 | ! Revision 1.8 2006/08/22 14:16:05 raasch |
---|
| 58 | ! Disturbances are imposed only for the last Runge-Kutta-substep |
---|
| 59 | ! |
---|
| 60 | ! Revision 1.2 2004/04/30 13:03:40 raasch |
---|
| 61 | ! decalpha-specific warning removed, routine name changed to time_integration, |
---|
| 62 | ! particle advection is carried out only once during the intermediate steps, |
---|
| 63 | ! impulse_advec renamed momentum_advec |
---|
| 64 | ! |
---|
| 65 | ! Revision 1.1 1997/08/11 06:19:04 raasch |
---|
| 66 | ! Initial revision |
---|
| 67 | ! |
---|
| 68 | ! |
---|
| 69 | ! Description: |
---|
| 70 | ! ------------ |
---|
| 71 | ! Integration in time of the model equations, statistical analysis and graphic |
---|
| 72 | ! output |
---|
| 73 | !------------------------------------------------------------------------------! |
---|
| 74 | |
---|
| 75 | USE arrays_3d |
---|
| 76 | USE averaging |
---|
| 77 | USE control_parameters |
---|
| 78 | USE cpulog |
---|
| 79 | #if defined( __dvrp_graphics ) |
---|
| 80 | USE DVRP |
---|
| 81 | #endif |
---|
| 82 | USE grid_variables |
---|
| 83 | USE indices |
---|
| 84 | USE interaction_droplets_ptq_mod |
---|
| 85 | USE interfaces |
---|
| 86 | USE particle_attributes |
---|
| 87 | USE pegrid |
---|
| 88 | USE prognostic_equations_mod |
---|
| 89 | USE statistics |
---|
| 90 | USE user_actions_mod |
---|
| 91 | |
---|
| 92 | IMPLICIT NONE |
---|
| 93 | |
---|
| 94 | CHARACTER (LEN=9) :: time_to_string |
---|
| 95 | INTEGER :: i, j, k |
---|
| 96 | |
---|
| 97 | ! |
---|
| 98 | !-- At the beginning of a simulation determine the time step as well as |
---|
| 99 | !-- determine and print out the run control parameters |
---|
| 100 | IF ( simulated_time == 0.0 ) CALL timestep |
---|
[667] | 101 | |
---|
[1] | 102 | CALL run_control |
---|
| 103 | |
---|
[667] | 104 | |
---|
[108] | 105 | ! |
---|
| 106 | !-- Data exchange between coupled models in case that a call has been omitted |
---|
| 107 | !-- at the end of the previous run of a job chain. |
---|
[291] | 108 | IF ( coupling_mode /= 'uncoupled' .AND. run_coupled ) THEN |
---|
[108] | 109 | ! |
---|
| 110 | !-- In case of model termination initiated by the local model the coupler |
---|
| 111 | !-- must not be called because this would again cause an MPI hang. |
---|
| 112 | DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 ) |
---|
| 113 | CALL surface_coupler |
---|
| 114 | time_coupling = time_coupling - dt_coupling |
---|
| 115 | ENDDO |
---|
[348] | 116 | IF (time_coupling == 0.0 .AND. time_since_reference_point < dt_coupling)& |
---|
| 117 | THEN |
---|
| 118 | time_coupling = time_since_reference_point |
---|
| 119 | ENDIF |
---|
[108] | 120 | ENDIF |
---|
| 121 | |
---|
| 122 | |
---|
[1] | 123 | #if defined( __dvrp_graphics ) |
---|
| 124 | ! |
---|
| 125 | !-- Time measurement with dvrp software |
---|
| 126 | CALL DVRP_LOG_EVENT( 2, current_timestep_number ) |
---|
| 127 | #endif |
---|
| 128 | |
---|
| 129 | ! |
---|
| 130 | !-- Start of the time loop |
---|
| 131 | DO WHILE ( simulated_time < end_time .AND. .NOT. stop_dt .AND. & |
---|
| 132 | .NOT. terminate_run ) |
---|
| 133 | |
---|
| 134 | CALL cpu_log( log_point_s(10), 'timesteps', 'start' ) |
---|
| 135 | ! |
---|
| 136 | !-- Determine size of next time step |
---|
| 137 | IF ( simulated_time /= 0.0 ) CALL timestep |
---|
| 138 | ! |
---|
| 139 | !-- Execute the user-defined actions |
---|
| 140 | CALL user_actions( 'before_timestep' ) |
---|
| 141 | |
---|
| 142 | ! |
---|
| 143 | !-- Start of intermediate step loop |
---|
| 144 | intermediate_timestep_count = 0 |
---|
| 145 | DO WHILE ( intermediate_timestep_count < & |
---|
| 146 | intermediate_timestep_count_max ) |
---|
| 147 | |
---|
| 148 | intermediate_timestep_count = intermediate_timestep_count + 1 |
---|
| 149 | |
---|
| 150 | ! |
---|
| 151 | !-- Set the steering factors for the prognostic equations which depend |
---|
| 152 | !-- on the timestep scheme |
---|
| 153 | CALL timestep_scheme_steering |
---|
| 154 | |
---|
| 155 | ! |
---|
| 156 | !-- Solve the prognostic equations. A fast cache optimized version with |
---|
| 157 | !-- only one single loop is used in case of Piascek-Williams advection |
---|
| 158 | !-- scheme. NEC vector machines use a different version, because |
---|
| 159 | !-- in the other versions a good vectorization is prohibited due to |
---|
| 160 | !-- inlining problems. |
---|
[63] | 161 | IF ( loop_optimization == 'vector' ) THEN |
---|
| 162 | CALL prognostic_equations_vector |
---|
[1] | 163 | ELSE |
---|
| 164 | IF ( momentum_advec == 'ups-scheme' .OR. & |
---|
| 165 | scalar_advec == 'ups-scheme' .OR. & |
---|
| 166 | scalar_advec == 'bc-scheme' ) & |
---|
| 167 | THEN |
---|
[63] | 168 | CALL prognostic_equations_noopt |
---|
[1] | 169 | ELSE |
---|
[63] | 170 | CALL prognostic_equations_cache |
---|
[1] | 171 | ENDIF |
---|
| 172 | ENDIF |
---|
| 173 | |
---|
| 174 | ! |
---|
| 175 | !-- Particle advection (only once during intermediate steps, because |
---|
| 176 | !-- it uses an Euler-step) |
---|
[63] | 177 | IF ( particle_advection .AND. & |
---|
| 178 | simulated_time >= particle_advection_start .AND. & |
---|
[1] | 179 | intermediate_timestep_count == 1 ) THEN |
---|
| 180 | CALL advec_particles |
---|
| 181 | first_call_advec_particles = .FALSE. |
---|
| 182 | ENDIF |
---|
| 183 | |
---|
| 184 | ! |
---|
| 185 | !-- Interaction of droplets with temperature and specific humidity. |
---|
| 186 | !-- Droplet condensation and evaporation is calculated within |
---|
| 187 | !-- advec_particles. |
---|
| 188 | IF ( cloud_droplets .AND. & |
---|
| 189 | intermediate_timestep_count == intermediate_timestep_count_max )& |
---|
| 190 | THEN |
---|
| 191 | CALL interaction_droplets_ptq |
---|
| 192 | ENDIF |
---|
| 193 | |
---|
| 194 | ! |
---|
| 195 | !-- Exchange of ghost points (lateral boundary conditions) |
---|
| 196 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' ) |
---|
[667] | 197 | CALL exchange_horiz( u_p, nbgp ) |
---|
| 198 | CALL exchange_horiz( v_p, nbgp ) |
---|
| 199 | CALL exchange_horiz( w_p, nbgp ) |
---|
| 200 | CALL exchange_horiz( pt_p, nbgp ) |
---|
| 201 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e_p, nbgp ) |
---|
[95] | 202 | IF ( ocean ) THEN |
---|
[667] | 203 | CALL exchange_horiz( sa_p, nbgp ) |
---|
| 204 | CALL exchange_horiz( rho, nbgp ) |
---|
| 205 | CALL exchange_horiz( prho, nbgp ) |
---|
[95] | 206 | ENDIF |
---|
[667] | 207 | IF (humidity .OR. passive_scalar) CALL exchange_horiz( q_p, nbgp ) |
---|
[1] | 208 | IF ( cloud_droplets ) THEN |
---|
[667] | 209 | CALL exchange_horiz( ql, nbgp ) |
---|
| 210 | CALL exchange_horiz( ql_c, nbgp ) |
---|
| 211 | CALL exchange_horiz( ql_v, nbgp ) |
---|
| 212 | CALL exchange_horiz( ql_vp, nbgp ) |
---|
[1] | 213 | ENDIF |
---|
| 214 | |
---|
| 215 | CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' ) |
---|
| 216 | |
---|
| 217 | ! |
---|
| 218 | !-- Apply time filter in case of leap-frog timestep |
---|
| 219 | IF ( tsc(2) == 2.0 .AND. timestep_scheme(1:8) == 'leapfrog' ) THEN |
---|
| 220 | CALL asselin_filter |
---|
| 221 | ENDIF |
---|
| 222 | |
---|
| 223 | ! |
---|
| 224 | !-- Boundary conditions for the prognostic quantities (except of the |
---|
| 225 | !-- velocities at the outflow in case of a non-cyclic lateral wall) |
---|
| 226 | CALL boundary_conds( 'main' ) |
---|
| 227 | |
---|
| 228 | ! |
---|
[73] | 229 | !-- Swap the time levels in preparation for the next time step. |
---|
| 230 | CALL swap_timelevel |
---|
| 231 | |
---|
| 232 | ! |
---|
[1] | 233 | !-- Temperature offset must be imposed at cyclic boundaries in x-direction |
---|
| 234 | !-- when a sloping surface is used |
---|
| 235 | IF ( sloping_surface ) THEN |
---|
[667] | 236 | IF ( nxl == 0 ) pt(:,:,nxlg:nxl-1) = pt(:,:,nxlg:nxl-1) - pt_slope_offset |
---|
| 237 | IF ( nxr == nx ) pt(:,:,nxr+1:nxrg) = pt(:,:,nxr+1:nxrg) + pt_slope_offset |
---|
[1] | 238 | ENDIF |
---|
| 239 | |
---|
| 240 | ! |
---|
[151] | 241 | !-- Impose a turbulent inflow using the recycling method |
---|
| 242 | IF ( turbulent_inflow ) CALL inflow_turbulence |
---|
| 243 | |
---|
| 244 | ! |
---|
[1] | 245 | !-- Impose a random perturbation on the horizontal velocity field |
---|
[106] | 246 | IF ( create_disturbances .AND. & |
---|
| 247 | ( call_psolver_at_all_substeps .AND. & |
---|
[1] | 248 | intermediate_timestep_count == intermediate_timestep_count_max )& |
---|
[106] | 249 | .OR. ( .NOT. call_psolver_at_all_substeps .AND. & |
---|
| 250 | intermediate_timestep_count == 1 ) ) & |
---|
[1] | 251 | THEN |
---|
| 252 | time_disturb = time_disturb + dt_3d |
---|
| 253 | IF ( time_disturb >= dt_disturb ) THEN |
---|
[87] | 254 | IF ( hom(nzb+5,1,pr_palm,0) < disturbance_energy_limit ) THEN |
---|
[75] | 255 | CALL disturb_field( nzb_u_inner, tend, u ) |
---|
| 256 | CALL disturb_field( nzb_v_inner, tend, v ) |
---|
[1] | 257 | ELSEIF ( bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic' ) THEN |
---|
| 258 | ! |
---|
| 259 | !-- Runs with a non-cyclic lateral wall need perturbations |
---|
| 260 | !-- near the inflow throughout the whole simulation |
---|
| 261 | dist_range = 1 |
---|
[75] | 262 | CALL disturb_field( nzb_u_inner, tend, u ) |
---|
| 263 | CALL disturb_field( nzb_v_inner, tend, v ) |
---|
[1] | 264 | dist_range = 0 |
---|
| 265 | ENDIF |
---|
| 266 | time_disturb = time_disturb - dt_disturb |
---|
| 267 | ENDIF |
---|
| 268 | ENDIF |
---|
| 269 | |
---|
| 270 | ! |
---|
| 271 | !-- Reduce the velocity divergence via the equation for perturbation |
---|
| 272 | !-- pressure. |
---|
[106] | 273 | IF ( intermediate_timestep_count == 1 .OR. & |
---|
| 274 | call_psolver_at_all_substeps ) THEN |
---|
[1] | 275 | CALL pres |
---|
| 276 | ENDIF |
---|
| 277 | |
---|
| 278 | ! |
---|
| 279 | !-- If required, compute virtuell potential temperature |
---|
[75] | 280 | IF ( humidity ) CALL compute_vpt |
---|
[1] | 281 | |
---|
| 282 | ! |
---|
| 283 | !-- If required, compute liquid water content |
---|
| 284 | IF ( cloud_physics ) CALL calc_liquid_water_content |
---|
| 285 | |
---|
| 286 | ! |
---|
| 287 | !-- Compute the diffusion quantities |
---|
| 288 | IF ( .NOT. constant_diffusion ) THEN |
---|
| 289 | |
---|
| 290 | ! |
---|
| 291 | !-- First the vertical fluxes in the Prandtl layer are being computed |
---|
| 292 | IF ( prandtl_layer ) THEN |
---|
| 293 | CALL cpu_log( log_point(19), 'prandtl_fluxes', 'start' ) |
---|
| 294 | CALL prandtl_fluxes |
---|
| 295 | CALL cpu_log( log_point(19), 'prandtl_fluxes', 'stop' ) |
---|
| 296 | ENDIF |
---|
| 297 | |
---|
| 298 | ! |
---|
| 299 | !-- Compute the diffusion coefficients |
---|
| 300 | CALL cpu_log( log_point(17), 'diffusivities', 'start' ) |
---|
[75] | 301 | IF ( .NOT. humidity ) THEN |
---|
[97] | 302 | IF ( ocean ) THEN |
---|
[388] | 303 | CALL diffusivities( prho, prho_reference ) |
---|
[97] | 304 | ELSE |
---|
| 305 | CALL diffusivities( pt, pt_reference ) |
---|
| 306 | ENDIF |
---|
[1] | 307 | ELSE |
---|
[97] | 308 | CALL diffusivities( vpt, pt_reference ) |
---|
[1] | 309 | ENDIF |
---|
| 310 | CALL cpu_log( log_point(17), 'diffusivities', 'stop' ) |
---|
| 311 | |
---|
| 312 | ENDIF |
---|
| 313 | |
---|
| 314 | ENDDO ! Intermediate step loop |
---|
| 315 | |
---|
| 316 | ! |
---|
| 317 | !-- Increase simulation time and output times |
---|
[291] | 318 | current_timestep_number = current_timestep_number + 1 |
---|
| 319 | simulated_time = simulated_time + dt_3d |
---|
| 320 | simulated_time_chr = time_to_string( simulated_time ) |
---|
| 321 | time_since_reference_point = simulated_time - coupling_start_time |
---|
| 322 | |
---|
[1] | 323 | IF ( simulated_time >= skip_time_data_output_av ) THEN |
---|
| 324 | time_do_av = time_do_av + dt_3d |
---|
| 325 | ENDIF |
---|
| 326 | IF ( simulated_time >= skip_time_do2d_xy ) THEN |
---|
| 327 | time_do2d_xy = time_do2d_xy + dt_3d |
---|
| 328 | ENDIF |
---|
| 329 | IF ( simulated_time >= skip_time_do2d_xz ) THEN |
---|
| 330 | time_do2d_xz = time_do2d_xz + dt_3d |
---|
| 331 | ENDIF |
---|
| 332 | IF ( simulated_time >= skip_time_do2d_yz ) THEN |
---|
| 333 | time_do2d_yz = time_do2d_yz + dt_3d |
---|
| 334 | ENDIF |
---|
| 335 | IF ( simulated_time >= skip_time_do3d ) THEN |
---|
| 336 | time_do3d = time_do3d + dt_3d |
---|
| 337 | ENDIF |
---|
[410] | 338 | DO mid = 1, masks |
---|
| 339 | IF ( simulated_time >= skip_time_domask(mid) ) THEN |
---|
| 340 | time_domask(mid)= time_domask(mid) + dt_3d |
---|
| 341 | ENDIF |
---|
| 342 | ENDDO |
---|
[1] | 343 | time_dvrp = time_dvrp + dt_3d |
---|
| 344 | IF ( simulated_time >= skip_time_dosp ) THEN |
---|
| 345 | time_dosp = time_dosp + dt_3d |
---|
| 346 | ENDIF |
---|
| 347 | time_dots = time_dots + dt_3d |
---|
| 348 | IF ( .NOT. first_call_advec_particles ) THEN |
---|
| 349 | time_dopts = time_dopts + dt_3d |
---|
| 350 | ENDIF |
---|
| 351 | IF ( simulated_time >= skip_time_dopr ) THEN |
---|
| 352 | time_dopr = time_dopr + dt_3d |
---|
| 353 | ENDIF |
---|
| 354 | time_dopr_listing = time_dopr_listing + dt_3d |
---|
| 355 | time_run_control = time_run_control + dt_3d |
---|
| 356 | |
---|
| 357 | ! |
---|
[102] | 358 | !-- Data exchange between coupled models |
---|
[291] | 359 | IF ( coupling_mode /= 'uncoupled' .AND. run_coupled ) THEN |
---|
[102] | 360 | time_coupling = time_coupling + dt_3d |
---|
[343] | 361 | |
---|
[108] | 362 | ! |
---|
| 363 | !-- In case of model termination initiated by the local model |
---|
| 364 | !-- (terminate_coupled > 0), the coupler must be skipped because it would |
---|
| 365 | !-- cause an MPI intercomminucation hang. |
---|
| 366 | !-- If necessary, the coupler will be called at the beginning of the |
---|
| 367 | !-- next restart run. |
---|
| 368 | DO WHILE ( time_coupling >= dt_coupling .AND. terminate_coupled == 0 ) |
---|
[102] | 369 | CALL surface_coupler |
---|
| 370 | time_coupling = time_coupling - dt_coupling |
---|
| 371 | ENDDO |
---|
| 372 | ENDIF |
---|
| 373 | |
---|
| 374 | ! |
---|
[46] | 375 | !-- Execute user-defined actions |
---|
| 376 | CALL user_actions( 'after_integration' ) |
---|
| 377 | |
---|
| 378 | ! |
---|
[1] | 379 | !-- If Galilei transformation is used, determine the distance that the |
---|
| 380 | !-- model has moved so far |
---|
| 381 | IF ( galilei_transformation ) THEN |
---|
| 382 | advected_distance_x = advected_distance_x + u_gtrans * dt_3d |
---|
| 383 | advected_distance_y = advected_distance_y + v_gtrans * dt_3d |
---|
| 384 | ENDIF |
---|
| 385 | |
---|
| 386 | ! |
---|
| 387 | !-- Check, if restart is necessary (because cpu-time is expiring or |
---|
| 388 | !-- because it is forced by user) and set stop flag |
---|
[108] | 389 | !-- This call is skipped if the remote model has already initiated a restart. |
---|
| 390 | IF ( .NOT. terminate_run ) CALL check_for_restart |
---|
[1] | 391 | |
---|
| 392 | ! |
---|
| 393 | !-- Carry out statistical analysis and output at the requested output times. |
---|
| 394 | !-- The MOD function is used for calculating the output time counters (like |
---|
| 395 | !-- time_dopr) in order to regard a possible decrease of the output time |
---|
| 396 | !-- interval in case of restart runs |
---|
| 397 | |
---|
| 398 | ! |
---|
| 399 | !-- Set a flag indicating that so far no statistics have been created |
---|
| 400 | !-- for this time step |
---|
| 401 | flow_statistics_called = .FALSE. |
---|
| 402 | |
---|
| 403 | ! |
---|
| 404 | !-- If required, call flow_statistics for averaging in time |
---|
| 405 | IF ( averaging_interval_pr /= 0.0 .AND. & |
---|
| 406 | ( dt_dopr - time_dopr ) <= averaging_interval_pr .AND. & |
---|
| 407 | simulated_time >= skip_time_dopr ) THEN |
---|
| 408 | time_dopr_av = time_dopr_av + dt_3d |
---|
| 409 | IF ( time_dopr_av >= dt_averaging_input_pr ) THEN |
---|
| 410 | do_sum = .TRUE. |
---|
| 411 | time_dopr_av = MOD( time_dopr_av, & |
---|
| 412 | MAX( dt_averaging_input_pr, dt_3d ) ) |
---|
| 413 | ENDIF |
---|
| 414 | ENDIF |
---|
| 415 | IF ( do_sum ) CALL flow_statistics |
---|
| 416 | |
---|
| 417 | ! |
---|
[410] | 418 | !-- Sum-up 3d-arrays for later output of time-averaged 2d/3d/masked data |
---|
[1] | 419 | IF ( averaging_interval /= 0.0 .AND. & |
---|
| 420 | ( dt_data_output_av - time_do_av ) <= averaging_interval .AND. & |
---|
| 421 | simulated_time >= skip_time_data_output_av ) & |
---|
| 422 | THEN |
---|
| 423 | time_do_sla = time_do_sla + dt_3d |
---|
| 424 | IF ( time_do_sla >= dt_averaging_input ) THEN |
---|
| 425 | CALL sum_up_3d_data |
---|
| 426 | average_count_3d = average_count_3d + 1 |
---|
| 427 | time_do_sla = MOD( time_do_sla, MAX( dt_averaging_input, dt_3d ) ) |
---|
| 428 | ENDIF |
---|
| 429 | ENDIF |
---|
| 430 | |
---|
| 431 | ! |
---|
| 432 | !-- Calculate spectra for time averaging |
---|
| 433 | IF ( averaging_interval_sp /= 0.0 .AND. & |
---|
| 434 | ( dt_dosp - time_dosp ) <= averaging_interval_sp .AND. & |
---|
| 435 | simulated_time >= skip_time_dosp ) THEN |
---|
| 436 | time_dosp_av = time_dosp_av + dt_3d |
---|
| 437 | IF ( time_dosp_av >= dt_averaging_input_pr ) THEN |
---|
| 438 | CALL calc_spectra |
---|
| 439 | time_dosp_av = MOD( time_dosp_av, & |
---|
| 440 | MAX( dt_averaging_input_pr, dt_3d ) ) |
---|
| 441 | ENDIF |
---|
| 442 | ENDIF |
---|
| 443 | |
---|
| 444 | ! |
---|
| 445 | !-- Computation and output of run control parameters. |
---|
| 446 | !-- This is also done whenever the time step has changed or perturbations |
---|
| 447 | !-- have been imposed |
---|
| 448 | IF ( time_run_control >= dt_run_control .OR. & |
---|
| 449 | ( dt_changed .AND. timestep_scheme(1:5) /= 'runge' ) .OR. & |
---|
| 450 | disturbance_created ) & |
---|
| 451 | THEN |
---|
| 452 | CALL run_control |
---|
| 453 | IF ( time_run_control >= dt_run_control ) THEN |
---|
| 454 | time_run_control = MOD( time_run_control, & |
---|
| 455 | MAX( dt_run_control, dt_3d ) ) |
---|
| 456 | ENDIF |
---|
| 457 | ENDIF |
---|
| 458 | |
---|
| 459 | ! |
---|
| 460 | !-- Profile output (ASCII) on file |
---|
| 461 | IF ( time_dopr_listing >= dt_dopr_listing ) THEN |
---|
| 462 | CALL print_1d |
---|
| 463 | time_dopr_listing = MOD( time_dopr_listing, MAX( dt_dopr_listing, & |
---|
| 464 | dt_3d ) ) |
---|
| 465 | ENDIF |
---|
| 466 | |
---|
| 467 | ! |
---|
| 468 | !-- Graphic output for PROFIL |
---|
| 469 | IF ( time_dopr >= dt_dopr ) THEN |
---|
| 470 | IF ( dopr_n /= 0 ) CALL data_output_profiles |
---|
| 471 | time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_3d ) ) |
---|
| 472 | time_dopr_av = 0.0 ! due to averaging (see above) |
---|
| 473 | ENDIF |
---|
| 474 | |
---|
| 475 | ! |
---|
| 476 | !-- Graphic output for time series |
---|
| 477 | IF ( time_dots >= dt_dots ) THEN |
---|
[48] | 478 | CALL data_output_tseries |
---|
[1] | 479 | time_dots = MOD( time_dots, MAX( dt_dots, dt_3d ) ) |
---|
| 480 | ENDIF |
---|
| 481 | |
---|
| 482 | ! |
---|
| 483 | !-- Output of spectra (formatted for use with PROFIL), in case of no |
---|
| 484 | !-- time averaging, spectra has to be calculated before |
---|
| 485 | IF ( time_dosp >= dt_dosp ) THEN |
---|
| 486 | IF ( average_count_sp == 0 ) CALL calc_spectra |
---|
| 487 | CALL data_output_spectra |
---|
| 488 | time_dosp = MOD( time_dosp, MAX( dt_dosp, dt_3d ) ) |
---|
| 489 | ENDIF |
---|
| 490 | |
---|
| 491 | ! |
---|
| 492 | !-- 2d-data output (cross-sections) |
---|
| 493 | IF ( time_do2d_xy >= dt_do2d_xy ) THEN |
---|
| 494 | CALL data_output_2d( 'xy', 0 ) |
---|
| 495 | time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) ) |
---|
| 496 | ENDIF |
---|
| 497 | IF ( time_do2d_xz >= dt_do2d_xz ) THEN |
---|
| 498 | CALL data_output_2d( 'xz', 0 ) |
---|
| 499 | time_do2d_xz = MOD( time_do2d_xz, MAX( dt_do2d_xz, dt_3d ) ) |
---|
| 500 | ENDIF |
---|
| 501 | IF ( time_do2d_yz >= dt_do2d_yz ) THEN |
---|
| 502 | CALL data_output_2d( 'yz', 0 ) |
---|
| 503 | time_do2d_yz = MOD( time_do2d_yz, MAX( dt_do2d_yz, dt_3d ) ) |
---|
| 504 | ENDIF |
---|
| 505 | |
---|
| 506 | ! |
---|
| 507 | !-- 3d-data output (volume data) |
---|
| 508 | IF ( time_do3d >= dt_do3d ) THEN |
---|
| 509 | CALL data_output_3d( 0 ) |
---|
| 510 | time_do3d = MOD( time_do3d, MAX( dt_do3d, dt_3d ) ) |
---|
| 511 | ENDIF |
---|
| 512 | |
---|
| 513 | ! |
---|
[410] | 514 | !-- masked data output |
---|
| 515 | DO mid = 1, masks |
---|
| 516 | IF ( time_domask(mid) >= dt_domask(mid) ) THEN |
---|
| 517 | CALL data_output_mask( 0 ) |
---|
| 518 | time_domask(mid) = MOD( time_domask(mid), & |
---|
| 519 | MAX( dt_domask(mid), dt_3d ) ) |
---|
| 520 | ENDIF |
---|
| 521 | ENDDO |
---|
| 522 | |
---|
| 523 | ! |
---|
| 524 | !-- Output of time-averaged 2d/3d/masked data |
---|
[1] | 525 | IF ( time_do_av >= dt_data_output_av ) THEN |
---|
| 526 | CALL average_3d_data |
---|
| 527 | CALL data_output_2d( 'xy', 1 ) |
---|
| 528 | CALL data_output_2d( 'xz', 1 ) |
---|
| 529 | CALL data_output_2d( 'yz', 1 ) |
---|
| 530 | CALL data_output_3d( 1 ) |
---|
[410] | 531 | DO mid = 1, masks |
---|
| 532 | CALL data_output_mask( 1 ) |
---|
| 533 | ENDDO |
---|
[1] | 534 | time_do_av = MOD( time_do_av, MAX( dt_data_output_av, dt_3d ) ) |
---|
| 535 | ENDIF |
---|
| 536 | |
---|
| 537 | ! |
---|
| 538 | !-- Output of particle time series |
---|
[253] | 539 | IF ( particle_advection ) THEN |
---|
| 540 | IF ( time_dopts >= dt_dopts .OR. & |
---|
| 541 | ( simulated_time >= particle_advection_start .AND. & |
---|
| 542 | first_call_advec_particles ) ) THEN |
---|
| 543 | CALL data_output_ptseries |
---|
| 544 | time_dopts = MOD( time_dopts, MAX( dt_dopts, dt_3d ) ) |
---|
| 545 | ENDIF |
---|
[1] | 546 | ENDIF |
---|
| 547 | |
---|
| 548 | ! |
---|
| 549 | !-- Output of dvrp-graphics (isosurface, particles, slicer) |
---|
| 550 | #if defined( __dvrp_graphics ) |
---|
| 551 | CALL DVRP_LOG_EVENT( -2, current_timestep_number-1 ) |
---|
| 552 | #endif |
---|
| 553 | IF ( time_dvrp >= dt_dvrp ) THEN |
---|
| 554 | CALL data_output_dvrp |
---|
| 555 | time_dvrp = MOD( time_dvrp, MAX( dt_dvrp, dt_3d ) ) |
---|
| 556 | ENDIF |
---|
| 557 | #if defined( __dvrp_graphics ) |
---|
| 558 | CALL DVRP_LOG_EVENT( 2, current_timestep_number ) |
---|
| 559 | #endif |
---|
| 560 | |
---|
| 561 | ! |
---|
| 562 | !-- If required, set the heat flux for the next time step at a random value |
---|
| 563 | IF ( constant_heatflux .AND. random_heatflux ) CALL disturb_heatflux |
---|
| 564 | |
---|
| 565 | ! |
---|
| 566 | !-- Execute user-defined actions |
---|
| 567 | CALL user_actions( 'after_timestep' ) |
---|
| 568 | |
---|
| 569 | CALL cpu_log( log_point_s(10), 'timesteps', 'stop' ) |
---|
| 570 | |
---|
[667] | 571 | |
---|
[1] | 572 | ENDDO ! time loop |
---|
| 573 | |
---|
| 574 | #if defined( __dvrp_graphics ) |
---|
| 575 | CALL DVRP_LOG_EVENT( -2, current_timestep_number ) |
---|
| 576 | #endif |
---|
| 577 | |
---|
| 578 | END SUBROUTINE time_integration |
---|