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