[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 | ! |
---|
| 17 | ! Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
| 18 | !------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
| 20 | ! Current revisions: |
---|
| 21 | ! ------------------ |
---|
| 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: time_integration_spinup.f90 2696 2017-12-14 17:12:51Z maronga $ |
---|
[2696] | 27 | ! Added radiation interactions (moved from USM) (MS) |
---|
| 28 | ! |
---|
| 29 | ! 2544 2017-10-13 18:09:32Z maronga |
---|
[2544] | 30 | ! Date and time quantities are now read from date_and_time_mod |
---|
| 31 | ! |
---|
| 32 | ! 2299 2017-06-29 10:14:38Z maronga |
---|
[2299] | 33 | ! Call of soil model adjusted to avoid prognostic equation for soil moisture |
---|
| 34 | ! during spinup. |
---|
| 35 | ! Better representation of diurnal cycle of near-surface temperature. |
---|
| 36 | ! Excluded prognostic equation for soil moisture during spinup. |
---|
| 37 | ! Added output of run control data for spinup. |
---|
| 38 | ! |
---|
| 39 | ! 2297 2017-06-28 14:35:57Z scharf |
---|
[2297] | 40 | ! bugfixes |
---|
| 41 | ! |
---|
| 42 | ! 2296 2017-06-28 07:53:56Z maronga |
---|
[2296] | 43 | ! Initial revision |
---|
| 44 | ! |
---|
| 45 | ! |
---|
| 46 | ! Description: |
---|
| 47 | ! ------------ |
---|
| 48 | !> Integration in time of the non-atmospheric model components such as land |
---|
| 49 | !> surface model and urban surface model |
---|
| 50 | !------------------------------------------------------------------------------! |
---|
| 51 | SUBROUTINE time_integration_spinup |
---|
| 52 | |
---|
| 53 | USE arrays_3d, & |
---|
| 54 | ONLY: pt, pt_p |
---|
| 55 | |
---|
| 56 | USE control_parameters, & |
---|
[2297] | 57 | ONLY: averaging_interval_pr, constant_diffusion, constant_flux_layer, & |
---|
| 58 | coupling_start_time, current_timestep_number, & |
---|
| 59 | data_output_during_spinup, disturbance_created, dopr_n, do_sum, & |
---|
| 60 | dt_averaging_input_pr, dt_dopr, dt_dots, dt_run_control, & |
---|
| 61 | dt_spinup, humidity, intermediate_timestep_count, & |
---|
| 62 | intermediate_timestep_count_max, land_surface, & |
---|
[2299] | 63 | simulated_time, simulated_time_chr, & |
---|
[2297] | 64 | skip_time_dopr, spinup, spinup_pt_amplitude, spinup_pt_mean, & |
---|
| 65 | spinup_time, timestep_count, timestep_scheme, time_dopr, & |
---|
| 66 | time_dopr_av, time_dots, time_run_control, & |
---|
| 67 | time_since_reference_point, urban_surface |
---|
[2296] | 68 | |
---|
| 69 | USE constants, & |
---|
| 70 | ONLY: pi |
---|
| 71 | |
---|
| 72 | USE cpulog, & |
---|
| 73 | ONLY: cpu_log, log_point, log_point_s |
---|
| 74 | |
---|
[2544] | 75 | USE date_and_time_mod, & |
---|
| 76 | ONLY: day_of_year_init, time_utc_init |
---|
| 77 | |
---|
[2296] | 78 | USE indices, & |
---|
| 79 | ONLY: nbgp, nzb, nzt, nysg, nyng, nxlg, nxrg |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | USE land_surface_model_mod, & |
---|
[2299] | 83 | ONLY: lsm_energy_balance, lsm_soil_model, lsm_swap_timelevel |
---|
[2296] | 84 | |
---|
[2299] | 85 | USE pegrid, & |
---|
| 86 | ONLY: myid |
---|
[2296] | 87 | |
---|
| 88 | USE kinds |
---|
| 89 | |
---|
| 90 | USE radiation_model_mod, & |
---|
| 91 | ONLY: dt_radiation, force_radiation_call, radiation, & |
---|
[2696] | 92 | radiation_control, rad_sw_in, time_radiation, & |
---|
| 93 | radiation_interaction, radiation_interactions |
---|
[2296] | 94 | |
---|
| 95 | USE statistics, & |
---|
| 96 | ONLY: flow_statistics_called |
---|
| 97 | |
---|
| 98 | USE surface_layer_fluxes_mod, & |
---|
| 99 | ONLY: surface_layer_fluxes |
---|
| 100 | |
---|
[2297] | 101 | USE surface_mod, & |
---|
| 102 | ONLY : surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h, & |
---|
[2296] | 103 | surf_usm_v |
---|
| 104 | |
---|
| 105 | USE urban_surface_mod, & |
---|
| 106 | ONLY: usm_material_heat_model, usm_material_model, & |
---|
[2696] | 107 | usm_surface_energy_balance, usm_swap_timelevel, & |
---|
| 108 | usm_green_heat_model, usm_temperature_near_surface |
---|
[2296] | 109 | |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | IMPLICIT NONE |
---|
| 114 | |
---|
| 115 | CHARACTER (LEN=9) :: time_to_string !< |
---|
| 116 | |
---|
[2299] | 117 | INTEGER(iwp) :: i !< running index |
---|
| 118 | INTEGER(iwp) :: j !< running index |
---|
| 119 | INTEGER(iwp) :: k !< running index |
---|
| 120 | INTEGER(iwp) :: l !< running index |
---|
| 121 | INTEGER(iwp) :: m !< running index |
---|
| 122 | |
---|
| 123 | INTEGER(iwp) :: current_timestep_number_spinup = 0 !< number if timestep during spinup |
---|
[2296] | 124 | |
---|
[2299] | 125 | LOGICAL :: run_control_header_spinup = .FALSE. !< flag parameter for steering whether the header information must be output |
---|
| 126 | |
---|
[2296] | 127 | REAL(wp) :: pt_spinup !< temporary storage of temperature |
---|
| 128 | |
---|
| 129 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pt_save !< temporary storage of temperature |
---|
| 130 | |
---|
| 131 | ALLOCATE( pt_save(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 132 | |
---|
[2299] | 133 | CALL exchange_horiz( pt, nbgp ) |
---|
| 134 | pt_save = pt |
---|
[2296] | 135 | |
---|
| 136 | CALL location_message( 'starting spinup-sequence', .TRUE. ) |
---|
| 137 | ! |
---|
| 138 | !-- Start of the time loop |
---|
| 139 | DO WHILE ( simulated_time < spinup_time ) |
---|
| 140 | |
---|
| 141 | CALL cpu_log( log_point_s(15), 'timesteps spinup', 'start' ) |
---|
| 142 | |
---|
| 143 | ! |
---|
| 144 | !-- Start of intermediate step loop |
---|
| 145 | intermediate_timestep_count = 0 |
---|
| 146 | DO WHILE ( intermediate_timestep_count < & |
---|
| 147 | intermediate_timestep_count_max ) |
---|
| 148 | |
---|
| 149 | intermediate_timestep_count = intermediate_timestep_count + 1 |
---|
| 150 | |
---|
| 151 | ! |
---|
| 152 | !-- Set the steering factors for the prognostic equations which depend |
---|
| 153 | !-- on the timestep scheme |
---|
| 154 | CALL timestep_scheme_steering |
---|
| 155 | |
---|
| 156 | |
---|
[2299] | 157 | ! |
---|
| 158 | !-- Estimate a near-surface air temperature based on the position of the |
---|
| 159 | !-- sun and user input about mean temperature and amplitude. The time is |
---|
| 160 | !-- shifted by one hour to simulate a lag between air temperature and |
---|
| 161 | !-- incoming radiation |
---|
| 162 | pt_spinup = spinup_pt_mean + spinup_pt_amplitude & |
---|
| 163 | * solar_angle (time_utc_init + time_since_reference_point - 3600.0) |
---|
[2296] | 164 | |
---|
[2299] | 165 | ! |
---|
| 166 | !-- Map air temperature to all grid points in the vicinity of a surface |
---|
| 167 | !-- element |
---|
[2296] | 168 | IF ( land_surface ) THEN |
---|
| 169 | DO m = 1, surf_lsm_h%ns |
---|
| 170 | i = surf_lsm_h%i(m) |
---|
| 171 | j = surf_lsm_h%j(m) |
---|
| 172 | k = surf_lsm_h%k(m) |
---|
[2299] | 173 | pt(k,j,i) = pt_spinup |
---|
[2296] | 174 | ENDDO |
---|
| 175 | |
---|
| 176 | DO l = 0, 3 |
---|
| 177 | DO m = 1, surf_lsm_v(l)%ns |
---|
| 178 | i = surf_lsm_v(l)%i(m) |
---|
| 179 | j = surf_lsm_v(l)%j(m) |
---|
| 180 | k = surf_lsm_v(l)%k(m) |
---|
[2299] | 181 | pt(k,j,i) = pt_spinup |
---|
[2296] | 182 | ENDDO |
---|
| 183 | ENDDO |
---|
| 184 | ENDIF |
---|
| 185 | |
---|
| 186 | IF ( urban_surface ) THEN |
---|
| 187 | DO m = 1, surf_usm_h%ns |
---|
| 188 | i = surf_usm_h%i(m) |
---|
| 189 | j = surf_usm_h%j(m) |
---|
| 190 | k = surf_usm_h%k(m) |
---|
[2299] | 191 | pt(k,j,i) = pt_spinup |
---|
[2296] | 192 | ENDDO |
---|
| 193 | |
---|
| 194 | DO l = 0, 3 |
---|
| 195 | DO m = 1, surf_usm_v(l)%ns |
---|
| 196 | i = surf_usm_v(l)%i(m) |
---|
| 197 | j = surf_usm_v(l)%j(m) |
---|
| 198 | k = surf_usm_v(l)%k(m) |
---|
[2299] | 199 | pt(k,j,i) = pt_spinup |
---|
[2296] | 200 | ENDDO |
---|
| 201 | ENDDO |
---|
| 202 | ENDIF |
---|
| 203 | |
---|
| 204 | ! |
---|
| 205 | !-- Swap the time levels in preparation for the next time step. |
---|
| 206 | timestep_count = timestep_count + 1 |
---|
| 207 | |
---|
| 208 | IF ( land_surface ) THEN |
---|
| 209 | CALL lsm_swap_timelevel ( 0 ) |
---|
| 210 | ENDIF |
---|
| 211 | |
---|
| 212 | IF ( urban_surface ) THEN |
---|
| 213 | CALL usm_swap_timelevel ( 0 ) |
---|
| 214 | ENDIF |
---|
| 215 | |
---|
| 216 | IF ( land_surface ) THEN |
---|
| 217 | CALL lsm_swap_timelevel ( MOD( timestep_count, 2) ) |
---|
| 218 | ENDIF |
---|
| 219 | |
---|
| 220 | IF ( urban_surface ) THEN |
---|
| 221 | CALL usm_swap_timelevel ( MOD( timestep_count, 2) ) |
---|
| 222 | ENDIF |
---|
| 223 | |
---|
| 224 | ! |
---|
| 225 | !-- If required, compute virtual potential temperature |
---|
| 226 | IF ( humidity ) THEN |
---|
| 227 | CALL compute_vpt |
---|
| 228 | ENDIF |
---|
| 229 | |
---|
| 230 | ! |
---|
| 231 | !-- Compute the diffusion quantities |
---|
| 232 | IF ( .NOT. constant_diffusion ) THEN |
---|
| 233 | |
---|
| 234 | ! |
---|
| 235 | !-- First the vertical (and horizontal) fluxes in the surface |
---|
| 236 | !-- (constant flux) layer are computed |
---|
| 237 | IF ( constant_flux_layer ) THEN |
---|
| 238 | CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'start' ) |
---|
| 239 | CALL surface_layer_fluxes |
---|
| 240 | CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'stop' ) |
---|
| 241 | ENDIF |
---|
| 242 | |
---|
| 243 | ! |
---|
| 244 | !-- If required, solve the energy balance for the surface and run soil |
---|
[2299] | 245 | !-- model. Call for horizontal as well as vertical surfaces. |
---|
| 246 | !-- The prognostic equation for soil moisure is switched off |
---|
| 247 | IF ( land_surface ) THEN |
---|
[2296] | 248 | |
---|
| 249 | CALL cpu_log( log_point(54), 'land_surface', 'start' ) |
---|
| 250 | ! |
---|
| 251 | !-- Call for horizontal upward-facing surfaces |
---|
| 252 | CALL lsm_energy_balance( .TRUE., -1 ) |
---|
[2299] | 253 | CALL lsm_soil_model( .TRUE., -1, .FALSE. ) |
---|
[2296] | 254 | ! |
---|
| 255 | !-- Call for northward-facing surfaces |
---|
| 256 | CALL lsm_energy_balance( .FALSE., 0 ) |
---|
[2299] | 257 | CALL lsm_soil_model( .FALSE., 0, .FALSE. ) |
---|
[2296] | 258 | ! |
---|
| 259 | !-- Call for southward-facing surfaces |
---|
| 260 | CALL lsm_energy_balance( .FALSE., 1 ) |
---|
[2299] | 261 | CALL lsm_soil_model( .FALSE., 1, .FALSE. ) |
---|
[2296] | 262 | ! |
---|
| 263 | !-- Call for eastward-facing surfaces |
---|
| 264 | CALL lsm_energy_balance( .FALSE., 2 ) |
---|
[2299] | 265 | CALL lsm_soil_model( .FALSE., 2, .FALSE. ) |
---|
[2296] | 266 | ! |
---|
| 267 | !-- Call for westward-facing surfaces |
---|
| 268 | CALL lsm_energy_balance( .FALSE., 3 ) |
---|
[2299] | 269 | CALL lsm_soil_model( .FALSE., 3, .FALSE. ) |
---|
[2296] | 270 | |
---|
| 271 | CALL cpu_log( log_point(54), 'land_surface', 'stop' ) |
---|
| 272 | ENDIF |
---|
| 273 | |
---|
| 274 | ! |
---|
| 275 | !-- If required, solve the energy balance for urban surfaces and run |
---|
| 276 | !-- the material heat model |
---|
| 277 | IF (urban_surface) THEN |
---|
| 278 | CALL cpu_log( log_point(74), 'urban_surface', 'start' ) |
---|
| 279 | CALL usm_surface_energy_balance |
---|
| 280 | IF ( usm_material_model ) THEN |
---|
[2696] | 281 | CALL usm_green_heat_model |
---|
[2296] | 282 | CALL usm_material_heat_model |
---|
| 283 | ENDIF |
---|
[2696] | 284 | IF ( urban_surface ) THEN |
---|
| 285 | CALL usm_temperature_near_surface |
---|
| 286 | ENDIF |
---|
[2296] | 287 | CALL cpu_log( log_point(74), 'urban_surface', 'stop' ) |
---|
| 288 | ENDIF |
---|
| 289 | |
---|
| 290 | ENDIF |
---|
| 291 | |
---|
| 292 | ! |
---|
| 293 | !-- If required, calculate radiative fluxes and heating rates |
---|
| 294 | IF ( radiation .AND. intermediate_timestep_count & |
---|
[2299] | 295 | == intermediate_timestep_count_max ) THEN |
---|
[2296] | 296 | |
---|
| 297 | time_radiation = time_radiation + dt_spinup |
---|
| 298 | |
---|
| 299 | IF ( time_radiation >= dt_radiation .OR. force_radiation_call ) & |
---|
| 300 | THEN |
---|
| 301 | |
---|
| 302 | CALL cpu_log( log_point(50), 'radiation', 'start' ) |
---|
| 303 | |
---|
| 304 | IF ( .NOT. force_radiation_call ) THEN |
---|
| 305 | time_radiation = time_radiation - dt_radiation |
---|
| 306 | ENDIF |
---|
| 307 | |
---|
| 308 | CALL radiation_control |
---|
| 309 | |
---|
| 310 | CALL cpu_log( log_point(50), 'radiation', 'stop' ) |
---|
| 311 | |
---|
[2696] | 312 | IF ( radiation_interactions ) THEN |
---|
| 313 | CALL cpu_log( log_point(75), 'radiation_interaction', 'start' ) |
---|
| 314 | CALL radiation_interaction |
---|
| 315 | CALL cpu_log( log_point(75), 'radiation_interaction', 'stop' ) |
---|
[2296] | 316 | ENDIF |
---|
| 317 | ENDIF |
---|
| 318 | ENDIF |
---|
| 319 | |
---|
| 320 | ENDDO ! Intermediate step loop |
---|
| 321 | |
---|
| 322 | ! |
---|
| 323 | !-- Increase simulation time and output times |
---|
[2299] | 324 | current_timestep_number_spinup = current_timestep_number_spinup + 1 |
---|
[2296] | 325 | simulated_time = simulated_time + dt_spinup |
---|
| 326 | simulated_time_chr = time_to_string( simulated_time ) |
---|
| 327 | time_since_reference_point = simulated_time - coupling_start_time |
---|
| 328 | |
---|
| 329 | IF ( data_output_during_spinup ) THEN |
---|
| 330 | time_dots = time_dots + dt_spinup |
---|
| 331 | IF ( simulated_time >= skip_time_dopr ) THEN |
---|
| 332 | time_dopr = time_dopr + dt_spinup |
---|
| 333 | ENDIF |
---|
| 334 | time_run_control = time_run_control + dt_spinup |
---|
| 335 | |
---|
| 336 | ! |
---|
| 337 | !-- Carry out statistical analysis and output at the requested output times. |
---|
| 338 | !-- The MOD function is used for calculating the output time counters (like |
---|
| 339 | !-- time_dopr) in order to regard a possible decrease of the output time |
---|
| 340 | !-- interval in case of restart runs |
---|
| 341 | |
---|
| 342 | ! |
---|
| 343 | !-- Set a flag indicating that so far no statistics have been created |
---|
| 344 | !-- for this time step |
---|
| 345 | flow_statistics_called = .FALSE. |
---|
| 346 | |
---|
| 347 | ! |
---|
| 348 | !-- If required, call flow_statistics for averaging in time |
---|
| 349 | IF ( averaging_interval_pr /= 0.0_wp .AND. & |
---|
| 350 | ( dt_dopr - time_dopr ) <= averaging_interval_pr .AND. & |
---|
| 351 | simulated_time >= skip_time_dopr ) THEN |
---|
| 352 | time_dopr_av = time_dopr_av + dt_spinup |
---|
| 353 | IF ( time_dopr_av >= dt_averaging_input_pr ) THEN |
---|
| 354 | do_sum = .TRUE. |
---|
| 355 | time_dopr_av = MOD( time_dopr_av, & |
---|
| 356 | MAX( dt_averaging_input_pr, dt_spinup ) ) |
---|
| 357 | ENDIF |
---|
| 358 | ENDIF |
---|
| 359 | IF ( do_sum ) CALL flow_statistics |
---|
| 360 | |
---|
| 361 | ! |
---|
| 362 | !-- Output of profiles |
---|
| 363 | IF ( time_dopr >= dt_dopr ) THEN |
---|
| 364 | IF ( dopr_n /= 0 ) CALL data_output_profiles |
---|
| 365 | time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_spinup ) ) |
---|
| 366 | time_dopr_av = 0.0_wp ! due to averaging (see above) |
---|
| 367 | ENDIF |
---|
| 368 | |
---|
| 369 | ! |
---|
| 370 | !-- Output of time series |
---|
| 371 | IF ( time_dots >= dt_dots ) THEN |
---|
| 372 | CALL data_output_tseries |
---|
| 373 | time_dots = MOD( time_dots, MAX( dt_dots, dt_spinup ) ) |
---|
| 374 | ENDIF |
---|
| 375 | |
---|
| 376 | ENDIF |
---|
| 377 | |
---|
| 378 | ! |
---|
| 379 | !-- Computation and output of run control parameters. |
---|
| 380 | !-- This is also done whenever perturbations have been imposed |
---|
[2299] | 381 | ! IF ( time_run_control >= dt_run_control .OR. & |
---|
| 382 | ! timestep_scheme(1:5) /= 'runge' .OR. disturbance_created ) & |
---|
| 383 | ! THEN |
---|
| 384 | ! CALL run_control |
---|
| 385 | ! IF ( time_run_control >= dt_run_control ) THEN |
---|
| 386 | ! time_run_control = MOD( time_run_control, & |
---|
| 387 | ! MAX( dt_run_control, dt_spinup ) ) |
---|
| 388 | ! ENDIF |
---|
| 389 | ! ENDIF |
---|
[2296] | 390 | |
---|
| 391 | CALL cpu_log( log_point_s(15), 'timesteps spinup', 'stop' ) |
---|
| 392 | |
---|
[2299] | 393 | |
---|
| 394 | ! |
---|
| 395 | !-- Run control output |
---|
[2296] | 396 | IF ( myid == 0 ) THEN |
---|
[2299] | 397 | ! |
---|
| 398 | !-- If necessary, write header |
---|
| 399 | IF ( .NOT. run_control_header_spinup ) THEN |
---|
| 400 | CALL check_open( 15 ) |
---|
| 401 | WRITE ( 15, 100 ) |
---|
| 402 | run_control_header_spinup = .TRUE. |
---|
| 403 | ENDIF |
---|
| 404 | ! |
---|
| 405 | !-- Write some general information about the spinup in run control file |
---|
| 406 | WRITE ( 15, 101 ) current_timestep_number_spinup, simulated_time_chr, dt_spinup, pt_spinup, rad_sw_in(0,nysg,nxlg) |
---|
| 407 | ! |
---|
| 408 | !-- Write buffer contents to disc immediately |
---|
| 409 | FLUSH( 15 ) |
---|
[2296] | 410 | ENDIF |
---|
| 411 | |
---|
[2299] | 412 | |
---|
| 413 | |
---|
[2296] | 414 | ENDDO ! time loop |
---|
| 415 | |
---|
| 416 | ! |
---|
| 417 | !-- Write back saved temperature to the 3D arrays |
---|
| 418 | pt(:,:,:) = pt_save |
---|
| 419 | pt_p(:,:,:) = pt_save |
---|
| 420 | |
---|
| 421 | DEALLOCATE(pt_save) |
---|
| 422 | |
---|
[2299] | 423 | CALL location_message( 'finished spinup-sequence', .TRUE. ) |
---|
[2296] | 424 | |
---|
[2299] | 425 | |
---|
| 426 | ! |
---|
| 427 | !-- Formats |
---|
| 428 | 100 FORMAT (///'Spinup control output:'/ & |
---|
| 429 | '----------------------------------------'// & |
---|
| 430 | 'ITER. HH:MM:SS DT PT(z_MO) SWD'/ & |
---|
| 431 | '----------------------------------------') |
---|
| 432 | 101 FORMAT (I5,2X,A9,1X,F6.2,3X,F6.2,2X,F6.2) |
---|
| 433 | |
---|
| 434 | CONTAINS |
---|
| 435 | |
---|
| 436 | ! |
---|
| 437 | !-- Returns the cosine of the solar zenith angle at a given time. This routine |
---|
| 438 | !-- is similar to that for calculation zenith (see radiation_model_mod.f90) |
---|
| 439 | FUNCTION solar_angle( local_time ) |
---|
| 440 | |
---|
| 441 | USE constants, & |
---|
[2544] | 442 | ONLY: pi |
---|
| 443 | |
---|
[2299] | 444 | USE kinds |
---|
| 445 | |
---|
| 446 | USE radiation_model_mod, & |
---|
[2544] | 447 | ONLY: decl_1, decl_2, decl_3, lat, lon |
---|
[2299] | 448 | |
---|
| 449 | IMPLICIT NONE |
---|
| 450 | |
---|
| 451 | |
---|
| 452 | REAL(wp) :: solar_angle !< cosine of the solar zenith angle |
---|
| 453 | |
---|
| 454 | REAL(wp) :: day !< day of the year |
---|
| 455 | REAL(wp) :: declination !< solar declination angle |
---|
| 456 | REAL(wp) :: hour_angle !< solar hour angle |
---|
| 457 | REAL(wp) :: time_utc !< current time in UTC |
---|
| 458 | REAL(wp), INTENT(IN) :: local_time |
---|
| 459 | ! |
---|
| 460 | !-- Calculate current day and time based on the initial values and simulation |
---|
| 461 | !-- time |
---|
| 462 | |
---|
[2544] | 463 | day = day_of_year_init + INT(FLOOR( local_time / 86400.0_wp ), KIND=iwp) |
---|
[2299] | 464 | time_utc = MOD(local_time, 86400.0_wp) |
---|
| 465 | |
---|
| 466 | |
---|
| 467 | ! |
---|
| 468 | !-- Calculate solar declination and hour angle |
---|
| 469 | declination = ASIN( decl_1 * SIN(decl_2 * REAL(day, KIND=wp) - decl_3) ) |
---|
| 470 | hour_angle = 2.0_wp * pi * (time_utc / 86400.0_wp) + lon - pi |
---|
| 471 | |
---|
| 472 | ! |
---|
| 473 | !-- Calculate cosine of solar zenith angle |
---|
| 474 | solar_angle = SIN(lat) * SIN(declination) + COS(lat) * COS(declination) & |
---|
| 475 | * COS(hour_angle) |
---|
| 476 | |
---|
| 477 | |
---|
| 478 | END FUNCTION solar_angle |
---|
| 479 | |
---|
| 480 | |
---|
[2296] | 481 | END SUBROUTINE time_integration_spinup |
---|