[2296] | 1 | !> @file time_integration_spinup.f90 |
---|
| 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[2296] | 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
| 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 | ! |
---|
[3655] | 17 | ! Copyright 1997-2019 Leibniz Universitaet Hannover |
---|
[2296] | 18 | !------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
| 20 | ! Current revisions: |
---|
| 21 | ! ------------------ |
---|
| 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: time_integration_spinup.f90 3719 2019-02-06 13:10:18Z raasch $ |
---|
[3719] | 27 | ! Removed log_point(19,54,74,50,75), since they count together with same log |
---|
| 28 | ! points in time_integration, impossible to separate the contributions. |
---|
| 29 | ! Instead, the entire spinup gets an individual log_point in palm.f90 |
---|
| 30 | ! |
---|
| 31 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
[3597] | 32 | ! Removed call to calculation of near air (10 cm) potential temperature (now in |
---|
| 33 | ! surface layer fluxes) |
---|
| 34 | ! |
---|
| 35 | ! 3467 2018-10-30 19:05:21Z suehring |
---|
[3418] | 36 | ! call to material_heat_model now with check if spinup runs (rvtils) |
---|
| 37 | ! |
---|
| 38 | ! 3337 2018-10-12 15:17:09Z kanani |
---|
[3337] | 39 | ! (from branch resler) |
---|
| 40 | ! Add pt1 initialization |
---|
| 41 | ! |
---|
| 42 | ! 3274 2018-09-24 15:42:55Z knoop |
---|
[3274] | 43 | ! Modularization of all bulk cloud physics code components |
---|
| 44 | ! |
---|
| 45 | ! 3241 2018-09-12 15:02:00Z raasch |
---|
[3241] | 46 | ! unused variables removed |
---|
| 47 | ! |
---|
| 48 | ! 2983 2018-04-18 10:43:40Z suehring |
---|
[2983] | 49 | ! Revise limitation of wall-adjacent velocity. |
---|
| 50 | ! |
---|
| 51 | ! 2934 2018-03-26 19:13:22Z suehring |
---|
[2934] | 52 | ! Synchronize parent and child models after spinup. |
---|
| 53 | ! |
---|
| 54 | ! 2881 2018-03-13 16:24:40Z maronga |
---|
[2881] | 55 | ! Added flag for switching on/off calculation of soil moisture |
---|
| 56 | ! |
---|
| 57 | ! 2818 2018-02-19 16:42:36Z maronga |
---|
[2818] | 58 | ! Velocity components near walls/ground are now set to the profiles stored in |
---|
| 59 | ! u_init and v_init. Activated soil moisture calculation during spinup. |
---|
| 60 | ! |
---|
| 61 | ! 2782 2018-02-02 11:51:10Z maronga |
---|
[2782] | 62 | ! Bugfix and re-activation of homogeneous setting of velocity components |
---|
| 63 | ! during spinup |
---|
| 64 | ! |
---|
| 65 | ! 2758 2018-01-17 12:55:21Z suehring |
---|
[2758] | 66 | ! Comment out homogeneous setting of wind velocity as this will lead to zero |
---|
| 67 | ! friction velocity and cause problems in MOST relationships. |
---|
| 68 | ! |
---|
| 69 | ! 2728 2018-01-09 07:03:53Z maronga |
---|
[2728] | 70 | ! Set velocity componenets to homogeneous values during spinup |
---|
| 71 | ! |
---|
| 72 | ! 2724 2018-01-05 12:12:38Z maronga |
---|
[2724] | 73 | ! Use dt_spinup for all active components during spinup |
---|
| 74 | ! |
---|
| 75 | ! 2723 2018-01-05 09:27:03Z maronga |
---|
[2723] | 76 | ! Bugfix: array rad_sw_in no longer exists and is thus removed from RUN_CONTROL |
---|
| 77 | ! output. |
---|
| 78 | ! Added output of XY and 3D data during spinup. |
---|
| 79 | ! Bugfix: time step in LSM and USM was set to dt_3d instead of dt_spinup |
---|
| 80 | ! |
---|
| 81 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 82 | ! Corrected "Former revisions" section |
---|
| 83 | ! |
---|
| 84 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 85 | ! Change in file header (GPL part) |
---|
[2696] | 86 | ! Added radiation interactions (moved from USM) (MS) |
---|
| 87 | ! |
---|
| 88 | ! 2544 2017-10-13 18:09:32Z maronga |
---|
[2544] | 89 | ! Date and time quantities are now read from date_and_time_mod |
---|
| 90 | ! |
---|
| 91 | ! 2299 2017-06-29 10:14:38Z maronga |
---|
[2299] | 92 | ! Call of soil model adjusted to avoid prognostic equation for soil moisture |
---|
| 93 | ! during spinup. |
---|
| 94 | ! Better representation of diurnal cycle of near-surface temperature. |
---|
| 95 | ! Excluded prognostic equation for soil moisture during spinup. |
---|
| 96 | ! Added output of run control data for spinup. |
---|
| 97 | ! |
---|
| 98 | ! 2297 2017-06-28 14:35:57Z scharf |
---|
[2297] | 99 | ! bugfixes |
---|
| 100 | ! |
---|
| 101 | ! 2296 2017-06-28 07:53:56Z maronga |
---|
[2296] | 102 | ! Initial revision |
---|
| 103 | ! |
---|
| 104 | ! |
---|
| 105 | ! Description: |
---|
| 106 | ! ------------ |
---|
| 107 | !> Integration in time of the non-atmospheric model components such as land |
---|
| 108 | !> surface model and urban surface model |
---|
| 109 | !------------------------------------------------------------------------------! |
---|
| 110 | SUBROUTINE time_integration_spinup |
---|
| 111 | |
---|
| 112 | USE arrays_3d, & |
---|
[2818] | 113 | ONLY: pt, pt_p, u, u_init, v, v_init |
---|
[2296] | 114 | |
---|
| 115 | USE control_parameters, & |
---|
[2881] | 116 | ONLY: averaging_interval_pr, calc_soil_moisture_during_spinup, & |
---|
[3241] | 117 | constant_diffusion, constant_flux_layer, coupling_start_time, & |
---|
| 118 | data_output_during_spinup, dopr_n, do_sum, & |
---|
[2728] | 119 | dt_averaging_input_pr, dt_dopr, dt_dots, dt_do2d_xy, dt_do3d, & |
---|
[3241] | 120 | dt_spinup, dt_3d, humidity, intermediate_timestep_count, & |
---|
[2297] | 121 | intermediate_timestep_count_max, land_surface, & |
---|
[3241] | 122 | simulated_time, simulated_time_chr, skip_time_dopr, & |
---|
| 123 | skip_time_do2d_xy, skip_time_do3d, spinup_pt_amplitude, & |
---|
| 124 | spinup_pt_mean, spinup_time, timestep_count, time_dopr, & |
---|
| 125 | time_dopr_av, time_dots, time_do2d_xy, time_do3d, & |
---|
| 126 | time_run_control, time_since_reference_point, urban_surface |
---|
[2296] | 127 | |
---|
| 128 | USE cpulog, & |
---|
| 129 | ONLY: cpu_log, log_point, log_point_s |
---|
| 130 | |
---|
[2544] | 131 | USE date_and_time_mod, & |
---|
| 132 | ONLY: day_of_year_init, time_utc_init |
---|
| 133 | |
---|
[2296] | 134 | USE indices, & |
---|
| 135 | ONLY: nbgp, nzb, nzt, nysg, nyng, nxlg, nxrg |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | USE land_surface_model_mod, & |
---|
[2299] | 139 | ONLY: lsm_energy_balance, lsm_soil_model, lsm_swap_timelevel |
---|
[2934] | 140 | USE pegrid |
---|
[2296] | 141 | |
---|
[2934] | 142 | USE pmc_interface, & |
---|
| 143 | ONLY: nested_run |
---|
| 144 | |
---|
[2296] | 145 | USE kinds |
---|
| 146 | |
---|
| 147 | USE radiation_model_mod, & |
---|
[3241] | 148 | ONLY: force_radiation_call, radiation, radiation_control, & |
---|
| 149 | radiation_interaction, radiation_interactions, time_radiation |
---|
[2296] | 150 | |
---|
| 151 | USE statistics, & |
---|
| 152 | ONLY: flow_statistics_called |
---|
| 153 | |
---|
| 154 | USE surface_layer_fluxes_mod, & |
---|
| 155 | ONLY: surface_layer_fluxes |
---|
| 156 | |
---|
[2297] | 157 | USE surface_mod, & |
---|
[3241] | 158 | ONLY : surf_lsm_h, surf_lsm_v, surf_usm_h, & |
---|
[2296] | 159 | surf_usm_v |
---|
| 160 | |
---|
| 161 | USE urban_surface_mod, & |
---|
| 162 | ONLY: usm_material_heat_model, usm_material_model, & |
---|
[2696] | 163 | usm_surface_energy_balance, usm_swap_timelevel, & |
---|
[3597] | 164 | usm_green_heat_model |
---|
[2296] | 165 | |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | IMPLICIT NONE |
---|
| 170 | |
---|
| 171 | CHARACTER (LEN=9) :: time_to_string !< |
---|
| 172 | |
---|
[2299] | 173 | INTEGER(iwp) :: i !< running index |
---|
| 174 | INTEGER(iwp) :: j !< running index |
---|
| 175 | INTEGER(iwp) :: k !< running index |
---|
| 176 | INTEGER(iwp) :: l !< running index |
---|
| 177 | INTEGER(iwp) :: m !< running index |
---|
| 178 | |
---|
| 179 | INTEGER(iwp) :: current_timestep_number_spinup = 0 !< number if timestep during spinup |
---|
[2296] | 180 | |
---|
[2299] | 181 | LOGICAL :: run_control_header_spinup = .FALSE. !< flag parameter for steering whether the header information must be output |
---|
| 182 | |
---|
[2296] | 183 | REAL(wp) :: pt_spinup !< temporary storage of temperature |
---|
[2723] | 184 | REAL(wp) :: dt_save !< temporary storage for time step |
---|
[2296] | 185 | |
---|
[2728] | 186 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pt_save !< temporary storage of temperature |
---|
| 187 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_save !< temporary storage of u wind component |
---|
| 188 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_save !< temporary storage of v wind component |
---|
[2296] | 189 | |
---|
[2728] | 190 | |
---|
| 191 | ! |
---|
| 192 | !-- Save 3D arrays because they are to be changed for spinup purpose |
---|
[2296] | 193 | ALLOCATE( pt_save(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[2728] | 194 | ALLOCATE( u_save(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 195 | ALLOCATE( v_save(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[2296] | 196 | |
---|
[2299] | 197 | CALL exchange_horiz( pt, nbgp ) |
---|
[2728] | 198 | CALL exchange_horiz( u, nbgp ) |
---|
| 199 | CALL exchange_horiz( v, nbgp ) |
---|
| 200 | |
---|
[2299] | 201 | pt_save = pt |
---|
[2728] | 202 | u_save = u |
---|
| 203 | v_save = v |
---|
[2296] | 204 | |
---|
[2728] | 205 | ! |
---|
| 206 | !-- Set the same wall-adjacent velocity to all grid points. The sign of the |
---|
| 207 | !-- original velocity field must be preserved because the surface schemes crash |
---|
| 208 | !-- otherwise. The precise reason is still unknown. A minimum velocity of 0.1 |
---|
| 209 | !-- m/s is used to maintain turbulent transfer at the surface. |
---|
[2782] | 210 | IF ( land_surface ) THEN |
---|
| 211 | DO m = 1, surf_lsm_h%ns |
---|
| 212 | i = surf_lsm_h%i(m) |
---|
| 213 | j = surf_lsm_h%j(m) |
---|
| 214 | k = surf_lsm_h%k(m) |
---|
[2983] | 215 | u(k,j,i) = SIGN(1.0_wp,u_init(k)) * MAX( ABS( u_init(k) ),0.1_wp) |
---|
| 216 | v(k,j,i) = SIGN(1.0_wp,v_init(k)) * MAX( ABS( v_init(k) ),0.1_wp) |
---|
[2782] | 217 | ENDDO |
---|
[2728] | 218 | |
---|
[2782] | 219 | DO l = 0, 3 |
---|
| 220 | DO m = 1, surf_lsm_v(l)%ns |
---|
| 221 | i = surf_lsm_v(l)%i(m) |
---|
| 222 | j = surf_lsm_v(l)%j(m) |
---|
| 223 | k = surf_lsm_v(l)%k(m) |
---|
[2983] | 224 | u(k,j,i) = SIGN(1.0_wp,u_init(k)) * MAX( ABS( u_init(k) ),0.1_wp) |
---|
| 225 | v(k,j,i) = SIGN(1.0_wp,v_init(k)) * MAX( ABS( v_init(k) ),0.1_wp) |
---|
[2782] | 226 | ENDDO |
---|
| 227 | ENDDO |
---|
| 228 | ENDIF |
---|
| 229 | |
---|
| 230 | IF ( urban_surface ) THEN |
---|
| 231 | DO m = 1, surf_usm_h%ns |
---|
| 232 | i = surf_usm_h%i(m) |
---|
| 233 | j = surf_usm_h%j(m) |
---|
| 234 | k = surf_usm_h%k(m) |
---|
[2983] | 235 | u(k,j,i) = SIGN(1.0_wp,u_init(k)) * MAX( ABS( u_init(k) ),0.1_wp) |
---|
| 236 | v(k,j,i) = SIGN(1.0_wp,v_init(k)) * MAX( ABS( v_init(k) ),0.1_wp) |
---|
[2782] | 237 | ENDDO |
---|
| 238 | |
---|
| 239 | DO l = 0, 3 |
---|
| 240 | DO m = 1, surf_usm_v(l)%ns |
---|
| 241 | i = surf_usm_v(l)%i(m) |
---|
| 242 | j = surf_usm_v(l)%j(m) |
---|
| 243 | k = surf_usm_v(l)%k(m) |
---|
[2983] | 244 | u(k,j,i) = SIGN(1.0_wp,u_init(k)) * MAX( ABS( u_init(k) ),0.1_wp) |
---|
| 245 | v(k,j,i) = SIGN(1.0_wp,v_init(k)) * MAX( ABS( v_init(k) ),0.1_wp) |
---|
[2782] | 246 | ENDDO |
---|
| 247 | ENDDO |
---|
| 248 | ENDIF |
---|
| 249 | |
---|
[2818] | 250 | CALL exchange_horiz( u, nbgp ) |
---|
| 251 | CALL exchange_horiz( v, nbgp ) |
---|
| 252 | |
---|
[2723] | 253 | dt_save = dt_3d |
---|
| 254 | dt_3d = dt_spinup |
---|
| 255 | |
---|
[2296] | 256 | CALL location_message( 'starting spinup-sequence', .TRUE. ) |
---|
| 257 | ! |
---|
| 258 | !-- Start of the time loop |
---|
| 259 | DO WHILE ( simulated_time < spinup_time ) |
---|
| 260 | |
---|
| 261 | CALL cpu_log( log_point_s(15), 'timesteps spinup', 'start' ) |
---|
| 262 | |
---|
| 263 | ! |
---|
| 264 | !-- Start of intermediate step loop |
---|
| 265 | intermediate_timestep_count = 0 |
---|
| 266 | DO WHILE ( intermediate_timestep_count < & |
---|
| 267 | intermediate_timestep_count_max ) |
---|
| 268 | |
---|
| 269 | intermediate_timestep_count = intermediate_timestep_count + 1 |
---|
| 270 | |
---|
| 271 | ! |
---|
| 272 | !-- Set the steering factors for the prognostic equations which depend |
---|
| 273 | !-- on the timestep scheme |
---|
| 274 | CALL timestep_scheme_steering |
---|
| 275 | |
---|
| 276 | |
---|
[2299] | 277 | ! |
---|
| 278 | !-- Estimate a near-surface air temperature based on the position of the |
---|
| 279 | !-- sun and user input about mean temperature and amplitude. The time is |
---|
| 280 | !-- shifted by one hour to simulate a lag between air temperature and |
---|
| 281 | !-- incoming radiation |
---|
| 282 | pt_spinup = spinup_pt_mean + spinup_pt_amplitude & |
---|
| 283 | * solar_angle (time_utc_init + time_since_reference_point - 3600.0) |
---|
[2296] | 284 | |
---|
[2299] | 285 | ! |
---|
| 286 | !-- Map air temperature to all grid points in the vicinity of a surface |
---|
| 287 | !-- element |
---|
[2296] | 288 | IF ( land_surface ) THEN |
---|
| 289 | DO m = 1, surf_lsm_h%ns |
---|
| 290 | i = surf_lsm_h%i(m) |
---|
| 291 | j = surf_lsm_h%j(m) |
---|
| 292 | k = surf_lsm_h%k(m) |
---|
[2299] | 293 | pt(k,j,i) = pt_spinup |
---|
[2296] | 294 | ENDDO |
---|
| 295 | |
---|
| 296 | DO l = 0, 3 |
---|
| 297 | DO m = 1, surf_lsm_v(l)%ns |
---|
| 298 | i = surf_lsm_v(l)%i(m) |
---|
| 299 | j = surf_lsm_v(l)%j(m) |
---|
| 300 | k = surf_lsm_v(l)%k(m) |
---|
[2299] | 301 | pt(k,j,i) = pt_spinup |
---|
[2296] | 302 | ENDDO |
---|
| 303 | ENDDO |
---|
| 304 | ENDIF |
---|
| 305 | |
---|
| 306 | IF ( urban_surface ) THEN |
---|
| 307 | DO m = 1, surf_usm_h%ns |
---|
| 308 | i = surf_usm_h%i(m) |
---|
| 309 | j = surf_usm_h%j(m) |
---|
| 310 | k = surf_usm_h%k(m) |
---|
[2299] | 311 | pt(k,j,i) = pt_spinup |
---|
[3337] | 312 | !!!!!!!!!!!!!!!!HACK!!!!!!!!!!!!! |
---|
| 313 | surf_usm_h%pt1 = pt_spinup |
---|
| 314 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[2296] | 315 | ENDDO |
---|
| 316 | |
---|
| 317 | DO l = 0, 3 |
---|
| 318 | DO m = 1, surf_usm_v(l)%ns |
---|
| 319 | i = surf_usm_v(l)%i(m) |
---|
| 320 | j = surf_usm_v(l)%j(m) |
---|
| 321 | k = surf_usm_v(l)%k(m) |
---|
[2299] | 322 | pt(k,j,i) = pt_spinup |
---|
[3337] | 323 | !!!!!!!!!!!!!!!!HACK!!!!!!!!!!!!! |
---|
| 324 | surf_usm_v(l)%pt1 = pt_spinup |
---|
| 325 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[2296] | 326 | ENDDO |
---|
| 327 | ENDDO |
---|
| 328 | ENDIF |
---|
| 329 | |
---|
[2818] | 330 | CALL exchange_horiz( pt, nbgp ) |
---|
| 331 | |
---|
| 332 | |
---|
[2296] | 333 | ! |
---|
| 334 | !-- Swap the time levels in preparation for the next time step. |
---|
| 335 | timestep_count = timestep_count + 1 |
---|
| 336 | |
---|
| 337 | IF ( land_surface ) THEN |
---|
| 338 | CALL lsm_swap_timelevel ( 0 ) |
---|
| 339 | ENDIF |
---|
| 340 | |
---|
| 341 | IF ( urban_surface ) THEN |
---|
| 342 | CALL usm_swap_timelevel ( 0 ) |
---|
| 343 | ENDIF |
---|
| 344 | |
---|
| 345 | IF ( land_surface ) THEN |
---|
| 346 | CALL lsm_swap_timelevel ( MOD( timestep_count, 2) ) |
---|
| 347 | ENDIF |
---|
| 348 | |
---|
| 349 | IF ( urban_surface ) THEN |
---|
| 350 | CALL usm_swap_timelevel ( MOD( timestep_count, 2) ) |
---|
| 351 | ENDIF |
---|
| 352 | |
---|
| 353 | ! |
---|
| 354 | !-- If required, compute virtual potential temperature |
---|
| 355 | IF ( humidity ) THEN |
---|
| 356 | CALL compute_vpt |
---|
| 357 | ENDIF |
---|
| 358 | |
---|
| 359 | ! |
---|
| 360 | !-- Compute the diffusion quantities |
---|
| 361 | IF ( .NOT. constant_diffusion ) THEN |
---|
| 362 | |
---|
| 363 | ! |
---|
| 364 | !-- First the vertical (and horizontal) fluxes in the surface |
---|
| 365 | !-- (constant flux) layer are computed |
---|
| 366 | IF ( constant_flux_layer ) THEN |
---|
| 367 | CALL surface_layer_fluxes |
---|
| 368 | ENDIF |
---|
| 369 | |
---|
| 370 | ! |
---|
| 371 | !-- If required, solve the energy balance for the surface and run soil |
---|
[2299] | 372 | !-- model. Call for horizontal as well as vertical surfaces. |
---|
| 373 | !-- The prognostic equation for soil moisure is switched off |
---|
| 374 | IF ( land_surface ) THEN |
---|
[2296] | 375 | |
---|
| 376 | ! |
---|
| 377 | !-- Call for horizontal upward-facing surfaces |
---|
| 378 | CALL lsm_energy_balance( .TRUE., -1 ) |
---|
[2881] | 379 | CALL lsm_soil_model( .TRUE., -1, calc_soil_moisture_during_spinup ) |
---|
[2296] | 380 | ! |
---|
| 381 | !-- Call for northward-facing surfaces |
---|
| 382 | CALL lsm_energy_balance( .FALSE., 0 ) |
---|
[2881] | 383 | CALL lsm_soil_model( .FALSE., 0, calc_soil_moisture_during_spinup ) |
---|
[2296] | 384 | ! |
---|
| 385 | !-- Call for southward-facing surfaces |
---|
| 386 | CALL lsm_energy_balance( .FALSE., 1 ) |
---|
[2881] | 387 | CALL lsm_soil_model( .FALSE., 1, calc_soil_moisture_during_spinup ) |
---|
[2296] | 388 | ! |
---|
| 389 | !-- Call for eastward-facing surfaces |
---|
| 390 | CALL lsm_energy_balance( .FALSE., 2 ) |
---|
[2881] | 391 | CALL lsm_soil_model( .FALSE., 2, calc_soil_moisture_during_spinup ) |
---|
[2296] | 392 | ! |
---|
| 393 | !-- Call for westward-facing surfaces |
---|
| 394 | CALL lsm_energy_balance( .FALSE., 3 ) |
---|
[2881] | 395 | CALL lsm_soil_model( .FALSE., 3, calc_soil_moisture_during_spinup ) |
---|
[3719] | 396 | |
---|
[2296] | 397 | ENDIF |
---|
| 398 | |
---|
| 399 | ! |
---|
| 400 | !-- If required, solve the energy balance for urban surfaces and run |
---|
| 401 | !-- the material heat model |
---|
| 402 | IF (urban_surface) THEN |
---|
[3719] | 403 | |
---|
[3418] | 404 | CALL usm_surface_energy_balance( .TRUE. ) |
---|
[2296] | 405 | IF ( usm_material_model ) THEN |
---|
[2696] | 406 | CALL usm_green_heat_model |
---|
[3418] | 407 | CALL usm_material_heat_model( .TRUE. ) |
---|
[2296] | 408 | ENDIF |
---|
[3719] | 409 | |
---|
[2296] | 410 | ENDIF |
---|
| 411 | |
---|
| 412 | ENDIF |
---|
| 413 | |
---|
| 414 | ! |
---|
| 415 | !-- If required, calculate radiative fluxes and heating rates |
---|
| 416 | IF ( radiation .AND. intermediate_timestep_count & |
---|
[2299] | 417 | == intermediate_timestep_count_max ) THEN |
---|
[2296] | 418 | |
---|
[2723] | 419 | time_radiation = time_radiation + dt_3d |
---|
[2296] | 420 | |
---|
[2724] | 421 | IF ( time_radiation >= dt_3d .OR. force_radiation_call ) & |
---|
[2296] | 422 | THEN |
---|
| 423 | |
---|
| 424 | IF ( .NOT. force_radiation_call ) THEN |
---|
[2724] | 425 | time_radiation = time_radiation - dt_3d |
---|
[2296] | 426 | ENDIF |
---|
| 427 | |
---|
| 428 | CALL radiation_control |
---|
| 429 | |
---|
[2696] | 430 | IF ( radiation_interactions ) THEN |
---|
| 431 | CALL radiation_interaction |
---|
[2296] | 432 | ENDIF |
---|
| 433 | ENDIF |
---|
| 434 | ENDIF |
---|
| 435 | |
---|
| 436 | ENDDO ! Intermediate step loop |
---|
| 437 | |
---|
| 438 | ! |
---|
| 439 | !-- Increase simulation time and output times |
---|
[2299] | 440 | current_timestep_number_spinup = current_timestep_number_spinup + 1 |
---|
[2723] | 441 | simulated_time = simulated_time + dt_3d |
---|
[2296] | 442 | simulated_time_chr = time_to_string( simulated_time ) |
---|
| 443 | time_since_reference_point = simulated_time - coupling_start_time |
---|
| 444 | |
---|
| 445 | IF ( data_output_during_spinup ) THEN |
---|
[2723] | 446 | IF ( simulated_time >= skip_time_do2d_xy ) THEN |
---|
| 447 | time_do2d_xy = time_do2d_xy + dt_3d |
---|
| 448 | ENDIF |
---|
| 449 | IF ( simulated_time >= skip_time_do3d ) THEN |
---|
| 450 | time_do3d = time_do3d + dt_3d |
---|
| 451 | ENDIF |
---|
| 452 | time_dots = time_dots + dt_3d |
---|
[2296] | 453 | IF ( simulated_time >= skip_time_dopr ) THEN |
---|
[2723] | 454 | time_dopr = time_dopr + dt_3d |
---|
[2296] | 455 | ENDIF |
---|
[2723] | 456 | time_run_control = time_run_control + dt_3d |
---|
[2296] | 457 | |
---|
| 458 | ! |
---|
| 459 | !-- Carry out statistical analysis and output at the requested output times. |
---|
| 460 | !-- The MOD function is used for calculating the output time counters (like |
---|
| 461 | !-- time_dopr) in order to regard a possible decrease of the output time |
---|
| 462 | !-- interval in case of restart runs |
---|
| 463 | |
---|
| 464 | ! |
---|
| 465 | !-- Set a flag indicating that so far no statistics have been created |
---|
| 466 | !-- for this time step |
---|
| 467 | flow_statistics_called = .FALSE. |
---|
| 468 | |
---|
| 469 | ! |
---|
| 470 | !-- If required, call flow_statistics for averaging in time |
---|
| 471 | IF ( averaging_interval_pr /= 0.0_wp .AND. & |
---|
| 472 | ( dt_dopr - time_dopr ) <= averaging_interval_pr .AND. & |
---|
| 473 | simulated_time >= skip_time_dopr ) THEN |
---|
[2723] | 474 | time_dopr_av = time_dopr_av + dt_3d |
---|
[2296] | 475 | IF ( time_dopr_av >= dt_averaging_input_pr ) THEN |
---|
| 476 | do_sum = .TRUE. |
---|
| 477 | time_dopr_av = MOD( time_dopr_av, & |
---|
[2723] | 478 | MAX( dt_averaging_input_pr, dt_3d ) ) |
---|
[2296] | 479 | ENDIF |
---|
| 480 | ENDIF |
---|
| 481 | IF ( do_sum ) CALL flow_statistics |
---|
| 482 | |
---|
| 483 | ! |
---|
| 484 | !-- Output of profiles |
---|
| 485 | IF ( time_dopr >= dt_dopr ) THEN |
---|
| 486 | IF ( dopr_n /= 0 ) CALL data_output_profiles |
---|
[2723] | 487 | time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_3d ) ) |
---|
[2296] | 488 | time_dopr_av = 0.0_wp ! due to averaging (see above) |
---|
| 489 | ENDIF |
---|
| 490 | |
---|
| 491 | ! |
---|
| 492 | !-- Output of time series |
---|
| 493 | IF ( time_dots >= dt_dots ) THEN |
---|
| 494 | CALL data_output_tseries |
---|
[2723] | 495 | time_dots = MOD( time_dots, MAX( dt_dots, dt_3d ) ) |
---|
[2296] | 496 | ENDIF |
---|
| 497 | |
---|
[2723] | 498 | ! |
---|
| 499 | !-- 2d-data output (cross-sections) |
---|
| 500 | IF ( time_do2d_xy >= dt_do2d_xy ) THEN |
---|
| 501 | CALL data_output_2d( 'xy', 0 ) |
---|
| 502 | time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) ) |
---|
| 503 | ENDIF |
---|
| 504 | |
---|
| 505 | ! |
---|
| 506 | !-- 3d-data output (volume data) |
---|
| 507 | IF ( time_do3d >= dt_do3d ) THEN |
---|
| 508 | CALL data_output_3d( 0 ) |
---|
| 509 | time_do3d = MOD( time_do3d, MAX( dt_do3d, dt_3d ) ) |
---|
| 510 | ENDIF |
---|
| 511 | |
---|
| 512 | |
---|
[2296] | 513 | ENDIF |
---|
| 514 | |
---|
| 515 | ! |
---|
| 516 | !-- Computation and output of run control parameters. |
---|
| 517 | !-- This is also done whenever perturbations have been imposed |
---|
[2299] | 518 | ! IF ( time_run_control >= dt_run_control .OR. & |
---|
| 519 | ! timestep_scheme(1:5) /= 'runge' .OR. disturbance_created ) & |
---|
| 520 | ! THEN |
---|
| 521 | ! CALL run_control |
---|
| 522 | ! IF ( time_run_control >= dt_run_control ) THEN |
---|
| 523 | ! time_run_control = MOD( time_run_control, & |
---|
[2723] | 524 | ! MAX( dt_run_control, dt_3d ) ) |
---|
[2299] | 525 | ! ENDIF |
---|
| 526 | ! ENDIF |
---|
[2296] | 527 | |
---|
| 528 | CALL cpu_log( log_point_s(15), 'timesteps spinup', 'stop' ) |
---|
| 529 | |
---|
[2299] | 530 | |
---|
| 531 | ! |
---|
| 532 | !-- Run control output |
---|
[2296] | 533 | IF ( myid == 0 ) THEN |
---|
[2299] | 534 | ! |
---|
| 535 | !-- If necessary, write header |
---|
| 536 | IF ( .NOT. run_control_header_spinup ) THEN |
---|
| 537 | CALL check_open( 15 ) |
---|
| 538 | WRITE ( 15, 100 ) |
---|
| 539 | run_control_header_spinup = .TRUE. |
---|
| 540 | ENDIF |
---|
| 541 | ! |
---|
| 542 | !-- Write some general information about the spinup in run control file |
---|
[2723] | 543 | WRITE ( 15, 101 ) current_timestep_number_spinup, simulated_time_chr, dt_3d, pt_spinup |
---|
[2299] | 544 | ! |
---|
| 545 | !-- Write buffer contents to disc immediately |
---|
| 546 | FLUSH( 15 ) |
---|
[2296] | 547 | ENDIF |
---|
| 548 | |
---|
[2299] | 549 | |
---|
| 550 | |
---|
[2296] | 551 | ENDDO ! time loop |
---|
| 552 | |
---|
| 553 | ! |
---|
[2728] | 554 | !-- Write back saved arrays to the 3D arrays |
---|
| 555 | pt = pt_save |
---|
| 556 | pt_p = pt_save |
---|
| 557 | u = u_save |
---|
| 558 | v = v_save |
---|
[2296] | 559 | |
---|
[2723] | 560 | ! |
---|
| 561 | !-- Reset time step |
---|
| 562 | dt_3d = dt_save |
---|
| 563 | |
---|
[2296] | 564 | DEALLOCATE(pt_save) |
---|
[2728] | 565 | DEALLOCATE(u_save) |
---|
| 566 | DEALLOCATE(v_save) |
---|
[2296] | 567 | |
---|
[2934] | 568 | #if defined( __parallel ) |
---|
| 569 | IF ( nested_run ) CALL MPI_BARRIER( MPI_COMM_WORLD, ierr ) |
---|
| 570 | #endif |
---|
| 571 | |
---|
[2299] | 572 | CALL location_message( 'finished spinup-sequence', .TRUE. ) |
---|
[2296] | 573 | |
---|
[2299] | 574 | |
---|
| 575 | ! |
---|
| 576 | !-- Formats |
---|
| 577 | 100 FORMAT (///'Spinup control output:'/ & |
---|
[2723] | 578 | '--------------------------------'// & |
---|
| 579 | 'ITER. HH:MM:SS DT PT(z_MO)'/ & |
---|
| 580 | '--------------------------------') |
---|
[2299] | 581 | 101 FORMAT (I5,2X,A9,1X,F6.2,3X,F6.2,2X,F6.2) |
---|
| 582 | |
---|
| 583 | CONTAINS |
---|
| 584 | |
---|
| 585 | ! |
---|
| 586 | !-- Returns the cosine of the solar zenith angle at a given time. This routine |
---|
| 587 | !-- is similar to that for calculation zenith (see radiation_model_mod.f90) |
---|
| 588 | FUNCTION solar_angle( local_time ) |
---|
| 589 | |
---|
[3274] | 590 | USE basic_constants_and_equations_mod, & |
---|
[2544] | 591 | ONLY: pi |
---|
| 592 | |
---|
[2299] | 593 | USE kinds |
---|
| 594 | |
---|
| 595 | USE radiation_model_mod, & |
---|
[2544] | 596 | ONLY: decl_1, decl_2, decl_3, lat, lon |
---|
[2299] | 597 | |
---|
| 598 | IMPLICIT NONE |
---|
| 599 | |
---|
| 600 | |
---|
| 601 | REAL(wp) :: solar_angle !< cosine of the solar zenith angle |
---|
| 602 | |
---|
| 603 | REAL(wp) :: day !< day of the year |
---|
| 604 | REAL(wp) :: declination !< solar declination angle |
---|
| 605 | REAL(wp) :: hour_angle !< solar hour angle |
---|
| 606 | REAL(wp) :: time_utc !< current time in UTC |
---|
| 607 | REAL(wp), INTENT(IN) :: local_time |
---|
| 608 | ! |
---|
| 609 | !-- Calculate current day and time based on the initial values and simulation |
---|
| 610 | !-- time |
---|
| 611 | |
---|
[2544] | 612 | day = day_of_year_init + INT(FLOOR( local_time / 86400.0_wp ), KIND=iwp) |
---|
[2299] | 613 | time_utc = MOD(local_time, 86400.0_wp) |
---|
| 614 | |
---|
| 615 | |
---|
| 616 | ! |
---|
| 617 | !-- Calculate solar declination and hour angle |
---|
| 618 | declination = ASIN( decl_1 * SIN(decl_2 * REAL(day, KIND=wp) - decl_3) ) |
---|
| 619 | hour_angle = 2.0_wp * pi * (time_utc / 86400.0_wp) + lon - pi |
---|
| 620 | |
---|
| 621 | ! |
---|
| 622 | !-- Calculate cosine of solar zenith angle |
---|
| 623 | solar_angle = SIN(lat) * SIN(declination) + COS(lat) * COS(declination) & |
---|
| 624 | * COS(hour_angle) |
---|
| 625 | |
---|
| 626 | |
---|
| 627 | END FUNCTION solar_angle |
---|
| 628 | |
---|
| 629 | |
---|
[2296] | 630 | END SUBROUTINE time_integration_spinup |
---|