[1850] | 1 | !> @file ls_forcing_mod.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[1239] | 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
[2000] | 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. |
---|
[1239] | 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 | ! |
---|
[1818] | 17 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1239] | 19 | ! |
---|
| 20 | ! Current revisions: |
---|
| 21 | ! ------------------ |
---|
[1383] | 22 | ! |
---|
[2072] | 23 | ! |
---|
[1383] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: ls_forcing_mod.f90 2072 2016-11-17 11:27:57Z suehring $ |
---|
| 27 | ! |
---|
[2072] | 28 | ! 2071 2016-11-17 11:22:14Z maronga |
---|
| 29 | ! Small bugfix (Resler) |
---|
| 30 | ! |
---|
[2038] | 31 | ! 2037 2016-10-26 11:15:40Z knoop |
---|
| 32 | ! Anelastic approximation implemented |
---|
| 33 | ! |
---|
[2001] | 34 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 35 | ! Forced header and separation lines into 80 columns |
---|
| 36 | ! |
---|
[1851] | 37 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 38 | ! Module renamed |
---|
| 39 | ! |
---|
| 40 | ! |
---|
[1683] | 41 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 42 | ! Code annotations made doxygen readable |
---|
| 43 | ! |
---|
[1603] | 44 | ! 1602 2015-06-22 07:50:56Z heinze |
---|
| 45 | ! PA0370 changed to PA0363 |
---|
| 46 | ! |
---|
[1383] | 47 | ! 1382 2014-04-30 12:15:41Z boeske |
---|
[1382] | 48 | ! Renamed variables which store large scale forcing tendencies |
---|
| 49 | ! pt_lsa -> td_lsa_lpt, pt_subs -> td_sub_lpt, |
---|
| 50 | ! q_lsa -> td_lsa_q, q_subs -> td_sub_q, |
---|
| 51 | ! high|lowpt_lsa -> high|low_td_lsa_lpt, ... |
---|
[1366] | 52 | ! |
---|
| 53 | ! 1365 2014-04-22 15:03:56Z boeske |
---|
[1365] | 54 | ! Usage of large scale forcing for pt and q enabled: |
---|
| 55 | ! Added new subroutine ls_advec for horizontal large scale advection and large |
---|
| 56 | ! scale subsidence, |
---|
| 57 | ! error message in init_ls_forcing specified, |
---|
| 58 | ! variable t renamed nt |
---|
[1354] | 59 | ! |
---|
| 60 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 61 | ! REAL constants provided with KIND-attribute |
---|
| 62 | ! |
---|
[1321] | 63 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 64 | ! ONLY-attribute added to USE-statements, |
---|
| 65 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 66 | ! kinds are defined in new module kinds, |
---|
| 67 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 68 | ! all variable declaration statements |
---|
[1239] | 69 | ! |
---|
[1319] | 70 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 71 | ! module interfaces removed |
---|
| 72 | ! |
---|
[1300] | 73 | ! 1299 2014-03-06 13:15:21Z heinze |
---|
| 74 | ! Ensure a zero large scale vertical velocity at the surface |
---|
| 75 | ! Bugfix: typo in case of boundary condition in if-clause |
---|
| 76 | ! |
---|
[1277] | 77 | ! 1276 2014-01-15 13:40:41Z heinze |
---|
| 78 | ! Use LSF_DATA also in case of Dirichlet bottom boundary condition for scalars |
---|
| 79 | ! |
---|
[1250] | 80 | ! 1249 2013-11-06 10:45:47Z heinze |
---|
| 81 | ! remove call of user module |
---|
| 82 | ! reformatting |
---|
| 83 | ! |
---|
[1242] | 84 | ! 1241 2013-10-30 11:36:58Z heinze |
---|
| 85 | ! Initial revision |
---|
[1239] | 86 | ! |
---|
| 87 | ! Description: |
---|
| 88 | ! ------------ |
---|
[1682] | 89 | !> Calculates large scale forcings (geostrophic wind and subsidence velocity) as |
---|
| 90 | !> well as surfaces fluxes dependent on time given in an external file (LSF_DATA). |
---|
| 91 | !> Code is based in parts on DALES and UCLA-LES. |
---|
[1239] | 92 | !--------------------------------------------------------------------------------! |
---|
[1682] | 93 | MODULE ls_forcing_mod |
---|
| 94 | |
---|
[1239] | 95 | |
---|
| 96 | PRIVATE |
---|
[1365] | 97 | PUBLIC init_ls_forcing, ls_forcing_surf, ls_forcing_vert, ls_advec |
---|
[1239] | 98 | SAVE |
---|
| 99 | |
---|
[1365] | 100 | INTERFACE ls_advec |
---|
| 101 | MODULE PROCEDURE ls_advec |
---|
| 102 | MODULE PROCEDURE ls_advec_ij |
---|
| 103 | END INTERFACE ls_advec |
---|
[1239] | 104 | |
---|
| 105 | CONTAINS |
---|
| 106 | |
---|
[1682] | 107 | !------------------------------------------------------------------------------! |
---|
| 108 | ! Description: |
---|
| 109 | ! ------------ |
---|
| 110 | !> @todo Missing subroutine description. |
---|
| 111 | !------------------------------------------------------------------------------! |
---|
[1239] | 112 | SUBROUTINE init_ls_forcing |
---|
| 113 | |
---|
[1320] | 114 | USE arrays_3d, & |
---|
[1382] | 115 | ONLY: p_surf, pt_surf, q_surf, qsws_surf, shf_surf, td_lsa_lpt, & |
---|
| 116 | td_lsa_q, td_sub_lpt, td_sub_q, time_surf, time_vert, & |
---|
[2037] | 117 | heatflux_input_conversion, waterflux_input_conversion, & |
---|
[1382] | 118 | ug_vert, vg_vert, wsubs_vert, zu |
---|
[1239] | 119 | |
---|
[1320] | 120 | USE control_parameters, & |
---|
| 121 | ONLY: end_time, lsf_surf, lsf_vert, message_string, nlsf |
---|
| 122 | |
---|
| 123 | USE indices, & |
---|
[1365] | 124 | ONLY: ngp_sums_ls, nzb, nz, nzt |
---|
[1320] | 125 | |
---|
| 126 | USE kinds |
---|
| 127 | |
---|
[1365] | 128 | USE statistics, & |
---|
| 129 | ONLY: sums_ls_l |
---|
[1320] | 130 | |
---|
[1365] | 131 | |
---|
[1239] | 132 | IMPLICIT NONE |
---|
| 133 | |
---|
[1682] | 134 | CHARACTER(100) :: chmess !< |
---|
| 135 | CHARACTER(1) :: hash !< |
---|
[1239] | 136 | |
---|
[1682] | 137 | INTEGER(iwp) :: ierrn !< |
---|
| 138 | INTEGER(iwp) :: finput = 90 !< |
---|
| 139 | INTEGER(iwp) :: k !< |
---|
| 140 | INTEGER(iwp) :: nt !< |
---|
[1320] | 141 | |
---|
[1682] | 142 | REAL(wp) :: fac !< |
---|
| 143 | REAL(wp) :: highheight !< |
---|
| 144 | REAL(wp) :: highug_vert !< |
---|
| 145 | REAL(wp) :: highvg_vert !< |
---|
| 146 | REAL(wp) :: highwsubs_vert !< |
---|
| 147 | REAL(wp) :: lowheight !< |
---|
| 148 | REAL(wp) :: lowug_vert !< |
---|
| 149 | REAL(wp) :: lowvg_vert !< |
---|
| 150 | REAL(wp) :: lowwsubs_vert !< |
---|
| 151 | REAL(wp) :: high_td_lsa_lpt !< |
---|
| 152 | REAL(wp) :: low_td_lsa_lpt !< |
---|
| 153 | REAL(wp) :: high_td_lsa_q !< |
---|
| 154 | REAL(wp) :: low_td_lsa_q !< |
---|
| 155 | REAL(wp) :: high_td_sub_lpt !< |
---|
| 156 | REAL(wp) :: low_td_sub_lpt !< |
---|
| 157 | REAL(wp) :: high_td_sub_q !< |
---|
| 158 | REAL(wp) :: low_td_sub_q !< |
---|
| 159 | REAL(wp) :: r_dummy !< |
---|
[1320] | 160 | |
---|
[1382] | 161 | ALLOCATE( p_surf(0:nlsf), pt_surf(0:nlsf), q_surf(0:nlsf), & |
---|
| 162 | qsws_surf(0:nlsf), shf_surf(0:nlsf), & |
---|
| 163 | td_lsa_lpt(nzb:nzt+1,0:nlsf), td_lsa_q(nzb:nzt+1,0:nlsf), & |
---|
| 164 | td_sub_lpt(nzb:nzt+1,0:nlsf), td_sub_q(nzb:nzt+1,0:nlsf), & |
---|
[1365] | 165 | time_vert(0:nlsf), time_surf(0:nlsf), & |
---|
| 166 | ug_vert(nzb:nzt+1,0:nlsf), vg_vert(nzb:nzt+1,0:nlsf), & |
---|
| 167 | wsubs_vert(nzb:nzt+1,0:nlsf) ) |
---|
[1239] | 168 | |
---|
[1382] | 169 | p_surf = 0.0_wp; pt_surf = 0.0_wp; q_surf = 0.0_wp; qsws_surf = 0.0_wp |
---|
| 170 | shf_surf = 0.0_wp; time_vert = 0.0_wp; td_lsa_lpt = 0.0_wp |
---|
| 171 | td_lsa_q = 0.0_wp; td_sub_lpt = 0.0_wp; td_sub_q = 0.0_wp |
---|
| 172 | time_surf = 0.0_wp; ug_vert = 0.0_wp; vg_vert = 0.0_wp |
---|
| 173 | wsubs_vert = 0.0_wp |
---|
[1239] | 174 | |
---|
[1365] | 175 | ! |
---|
| 176 | !-- Array for storing large scale forcing and nudging tendencies at each |
---|
| 177 | !-- timestep for data output |
---|
| 178 | ALLOCATE( sums_ls_l(nzb:nzt+1,0:7) ) |
---|
| 179 | sums_ls_l = 0.0_wp |
---|
[1239] | 180 | |
---|
[1365] | 181 | ngp_sums_ls = (nz+2)*6 |
---|
| 182 | |
---|
[1249] | 183 | OPEN ( finput, FILE='LSF_DATA', STATUS='OLD', & |
---|
| 184 | FORM='FORMATTED', IOSTAT=ierrn ) |
---|
[1239] | 185 | |
---|
[1249] | 186 | IF ( ierrn /= 0 ) THEN |
---|
[1239] | 187 | message_string = 'file LSF_DATA does not exist' |
---|
| 188 | CALL message( 'ls_forcing', 'PA0368', 1, 2, 0, 6, 0 ) |
---|
| 189 | ENDIF |
---|
| 190 | |
---|
| 191 | ierrn = 0 |
---|
| 192 | ! |
---|
| 193 | !-- First three lines of LSF_DATA contain header |
---|
[1249] | 194 | READ ( finput, FMT='(a100)', IOSTAT=ierrn ) chmess |
---|
| 195 | READ ( finput, FMT='(a100)', IOSTAT=ierrn ) chmess |
---|
| 196 | READ ( finput, FMT='(a100)', IOSTAT=ierrn ) chmess |
---|
[1239] | 197 | |
---|
[1249] | 198 | IF ( ierrn /= 0 ) THEN |
---|
[1239] | 199 | message_string = 'errors in file LSF_DATA' |
---|
| 200 | CALL message( 'ls_forcing', 'PA0369', 1, 2, 0, 6, 0 ) |
---|
| 201 | ENDIF |
---|
| 202 | |
---|
| 203 | ! |
---|
| 204 | !-- Surface values are read in |
---|
[1365] | 205 | nt = 0 |
---|
[1239] | 206 | ierrn = 0 |
---|
| 207 | |
---|
[1365] | 208 | DO WHILE ( time_surf(nt) < end_time ) |
---|
| 209 | nt = nt + 1 |
---|
| 210 | READ ( finput, *, IOSTAT = ierrn ) time_surf(nt), shf_surf(nt), & |
---|
| 211 | qsws_surf(nt), pt_surf(nt), & |
---|
| 212 | q_surf(nt), p_surf(nt) |
---|
[1239] | 213 | |
---|
[1249] | 214 | IF ( ierrn < 0 ) THEN |
---|
[1299] | 215 | WRITE ( message_string, * ) 'No time dependent surface variables ',& |
---|
[1239] | 216 | 'in&LSF_DATA for end of run found' |
---|
| 217 | |
---|
[1602] | 218 | CALL message( 'ls_forcing', 'PA0363', 1, 2, 0, 6, 0 ) |
---|
[1239] | 219 | ENDIF |
---|
| 220 | ENDDO |
---|
| 221 | |
---|
[1249] | 222 | IF ( time_surf(1) > end_time ) THEN |
---|
[1299] | 223 | WRITE ( message_string, * ) 'No time dependent surface variables in ',& |
---|
[1365] | 224 | '&LSF_DATA for end of run found - ', & |
---|
[1239] | 225 | 'lsf_surf is set to FALSE' |
---|
| 226 | CALL message( 'ls_forcing', 'PA0371', 0, 0, 0, 6, 0 ) |
---|
| 227 | lsf_surf = .FALSE. |
---|
[2071] | 228 | ELSE |
---|
| 229 | shf_surf = shf_surf * heatflux_input_conversion(nzb) |
---|
| 230 | qsws_surf = qsws_surf * waterflux_input_conversion(nzb) |
---|
[1239] | 231 | ENDIF |
---|
| 232 | |
---|
| 233 | ! |
---|
| 234 | !-- Go to the end of the list with surface variables |
---|
| 235 | DO WHILE ( ierrn == 0 ) |
---|
[1249] | 236 | READ ( finput, *, IOSTAT = ierrn ) r_dummy |
---|
[1239] | 237 | ENDDO |
---|
| 238 | |
---|
| 239 | ! |
---|
| 240 | !-- Profiles of ug, vg and w_subs are read in (large scale forcing) |
---|
| 241 | |
---|
[1365] | 242 | nt = 0 |
---|
| 243 | DO WHILE ( time_vert(nt) < end_time ) |
---|
| 244 | nt = nt + 1 |
---|
[1239] | 245 | hash = "#" |
---|
| 246 | ierrn = 1 ! not zero |
---|
| 247 | ! |
---|
| 248 | !-- Search for the next line consisting of "# time", |
---|
| 249 | !-- from there onwards the profiles will be read |
---|
| 250 | DO WHILE ( .NOT. ( hash == "#" .AND. ierrn == 0 ) ) |
---|
[1365] | 251 | READ ( finput, *, IOSTAT=ierrn ) hash, time_vert(nt) |
---|
[1249] | 252 | IF ( ierrn < 0 ) THEN |
---|
[1299] | 253 | WRITE( message_string, * ) 'No time dependent vertical profiles',& |
---|
[1239] | 254 | ' in&LSF_DATA for end of run found' |
---|
| 255 | CALL message( 'ls_forcing', 'PA0372', 1, 2, 0, 6, 0 ) |
---|
| 256 | ENDIF |
---|
| 257 | ENDDO |
---|
| 258 | |
---|
[1365] | 259 | IF ( nt == 1 .AND. time_vert(nt) > end_time ) EXIT |
---|
[1239] | 260 | |
---|
[1365] | 261 | READ ( finput, *, IOSTAT=ierrn ) lowheight, lowug_vert, lowvg_vert, & |
---|
[1382] | 262 | lowwsubs_vert, low_td_lsa_lpt, & |
---|
| 263 | low_td_lsa_q, low_td_sub_lpt, & |
---|
| 264 | low_td_sub_q |
---|
[1249] | 265 | IF ( ierrn /= 0 ) THEN |
---|
[1239] | 266 | message_string = 'errors in file LSF_DATA' |
---|
[1299] | 267 | CALL message( 'ls_forcing', 'PA0369', 1, 2, 0, 6, 0 ) |
---|
[1239] | 268 | ENDIF |
---|
| 269 | |
---|
[1365] | 270 | READ ( finput, *, IOSTAT=ierrn ) highheight, highug_vert, & |
---|
| 271 | highvg_vert, highwsubs_vert, & |
---|
[1382] | 272 | high_td_lsa_lpt, high_td_lsa_q, & |
---|
| 273 | high_td_sub_lpt, high_td_sub_q |
---|
[1239] | 274 | |
---|
[1249] | 275 | IF ( ierrn /= 0 ) THEN |
---|
[1239] | 276 | message_string = 'errors in file LSF_DATA' |
---|
[1299] | 277 | CALL message( 'ls_forcing', 'PA0369', 1, 2, 0, 6, 0 ) |
---|
[1239] | 278 | ENDIF |
---|
| 279 | |
---|
[1241] | 280 | |
---|
[1239] | 281 | DO k = nzb, nzt+1 |
---|
[1249] | 282 | IF ( highheight < zu(k) ) THEN |
---|
[1382] | 283 | lowheight = highheight |
---|
| 284 | lowug_vert = highug_vert |
---|
| 285 | lowvg_vert = highvg_vert |
---|
| 286 | lowwsubs_vert = highwsubs_vert |
---|
| 287 | low_td_lsa_lpt = high_td_lsa_lpt |
---|
| 288 | low_td_lsa_q = high_td_lsa_q |
---|
| 289 | low_td_sub_lpt = high_td_sub_lpt |
---|
| 290 | low_td_sub_q = high_td_sub_q |
---|
[1239] | 291 | |
---|
| 292 | ierrn = 0 |
---|
[1365] | 293 | READ ( finput, *, IOSTAT=ierrn ) highheight, highug_vert, & |
---|
| 294 | highvg_vert, highwsubs_vert, & |
---|
[1382] | 295 | high_td_lsa_lpt, & |
---|
| 296 | high_td_lsa_q, & |
---|
| 297 | high_td_sub_lpt, high_td_sub_q |
---|
[1239] | 298 | |
---|
[1249] | 299 | IF ( ierrn /= 0 ) THEN |
---|
[1365] | 300 | WRITE( message_string, * ) 'zu(nzt+1) = ', zu(nzt+1), 'm ', & |
---|
| 301 | 'is higher than the maximum height in LSF_DATA which ',& |
---|
| 302 | 'is ', lowheight, 'm. Interpolation on PALM ', & |
---|
| 303 | 'grid is not possible.' |
---|
| 304 | CALL message( 'ls_forcing', 'PA0395', 1, 2, 0, 6, 0 ) |
---|
[1239] | 305 | ENDIF |
---|
| 306 | |
---|
| 307 | ENDIF |
---|
| 308 | |
---|
| 309 | ! |
---|
| 310 | !-- Interpolation of prescribed profiles in space |
---|
| 311 | fac = (highheight-zu(k))/(highheight - lowheight) |
---|
| 312 | |
---|
[1382] | 313 | ug_vert(k,nt) = fac * lowug_vert & |
---|
| 314 | + ( 1.0_wp - fac ) * highug_vert |
---|
| 315 | vg_vert(k,nt) = fac * lowvg_vert & |
---|
| 316 | + ( 1.0_wp - fac ) * highvg_vert |
---|
| 317 | wsubs_vert(k,nt) = fac * lowwsubs_vert & |
---|
| 318 | + ( 1.0_wp - fac ) * highwsubs_vert |
---|
[1239] | 319 | |
---|
[1382] | 320 | td_lsa_lpt(k,nt) = fac * low_td_lsa_lpt & |
---|
| 321 | + ( 1.0_wp - fac ) * high_td_lsa_lpt |
---|
| 322 | td_lsa_q(k,nt) = fac * low_td_lsa_q & |
---|
| 323 | + ( 1.0_wp - fac ) * high_td_lsa_q |
---|
| 324 | td_sub_lpt(k,nt) = fac * low_td_sub_lpt & |
---|
| 325 | + ( 1.0_wp - fac ) * high_td_sub_lpt |
---|
| 326 | td_sub_q(k,nt) = fac * low_td_sub_q & |
---|
| 327 | + ( 1.0_wp - fac ) * high_td_sub_q |
---|
[1365] | 328 | |
---|
[1239] | 329 | ENDDO |
---|
| 330 | |
---|
| 331 | ENDDO |
---|
| 332 | |
---|
[1299] | 333 | ! |
---|
| 334 | !-- Large scale vertical velocity has to be zero at the surface |
---|
[1353] | 335 | wsubs_vert(nzb,:) = 0.0_wp |
---|
[1299] | 336 | |
---|
[1249] | 337 | IF ( time_vert(1) > end_time ) THEN |
---|
[1365] | 338 | WRITE ( message_string, * ) 'Time dependent large scale profile ', & |
---|
| 339 | 'forcing from&LSF_DATA sets in after end of ' , & |
---|
[1249] | 340 | 'simulation - lsf_vert is set to FALSE' |
---|
[1239] | 341 | CALL message( 'ls_forcing', 'PA0373', 0, 0, 0, 6, 0 ) |
---|
| 342 | lsf_vert = .FALSE. |
---|
| 343 | ENDIF |
---|
| 344 | |
---|
| 345 | CLOSE( finput ) |
---|
| 346 | |
---|
| 347 | |
---|
| 348 | END SUBROUTINE init_ls_forcing |
---|
| 349 | |
---|
| 350 | |
---|
[1682] | 351 | !------------------------------------------------------------------------------! |
---|
| 352 | ! Description: |
---|
| 353 | ! ------------ |
---|
| 354 | !> @todo Missing subroutine description. |
---|
| 355 | !------------------------------------------------------------------------------! |
---|
[1239] | 356 | SUBROUTINE ls_forcing_surf ( time ) |
---|
| 357 | |
---|
[1320] | 358 | USE arrays_3d, & |
---|
| 359 | ONLY: p_surf, pt_surf, q_surf, qsws, qsws_surf, shf, shf_surf, & |
---|
| 360 | time_surf, time_vert, ug, ug_vert, vg, vg_vert |
---|
[1239] | 361 | |
---|
[1320] | 362 | USE control_parameters, & |
---|
| 363 | ONLY: bc_q_b, ibc_pt_b, ibc_q_b, pt_surface, q_surface, & |
---|
| 364 | surface_pressure |
---|
| 365 | |
---|
| 366 | USE kinds |
---|
| 367 | |
---|
[1239] | 368 | IMPLICIT NONE |
---|
| 369 | |
---|
[1682] | 370 | INTEGER(iwp) :: nt !< |
---|
[1239] | 371 | |
---|
[1682] | 372 | REAL(wp) :: fac !< |
---|
| 373 | REAL(wp), INTENT(in) :: time !< |
---|
[1320] | 374 | |
---|
[1239] | 375 | ! |
---|
| 376 | !-- Interpolation in time of LSF_DATA at the surface |
---|
[1365] | 377 | nt = 1 |
---|
| 378 | DO WHILE ( time > time_surf(nt) ) |
---|
| 379 | nt = nt + 1 |
---|
[1239] | 380 | ENDDO |
---|
[1365] | 381 | IF ( time /= time_surf(nt) ) THEN |
---|
| 382 | nt = nt - 1 |
---|
[1239] | 383 | ENDIF |
---|
| 384 | |
---|
[1365] | 385 | fac = ( time -time_surf(nt) ) / ( time_surf(nt+1) - time_surf(nt) ) |
---|
[1239] | 386 | |
---|
[1276] | 387 | IF ( ibc_pt_b == 0 ) THEN |
---|
| 388 | ! |
---|
| 389 | !-- In case of Dirichlet boundary condition shf must not |
---|
| 390 | !-- be set - it is calculated via MOST in prandtl_fluxes |
---|
[1365] | 391 | pt_surface = pt_surf(nt) + fac * ( pt_surf(nt+1) - pt_surf(nt) ) |
---|
[1276] | 392 | |
---|
| 393 | ELSEIF ( ibc_pt_b == 1 ) THEN |
---|
| 394 | ! |
---|
| 395 | !-- In case of Neumann boundary condition pt_surface is needed for |
---|
| 396 | !-- calculation of reference density |
---|
[1365] | 397 | shf = shf_surf(nt) + fac * ( shf_surf(nt+1) - shf_surf(nt) ) |
---|
| 398 | pt_surface = pt_surf(nt) + fac * ( pt_surf(nt+1) - pt_surf(nt) ) |
---|
[1276] | 399 | |
---|
| 400 | ENDIF |
---|
| 401 | |
---|
| 402 | IF ( ibc_q_b == 0 ) THEN |
---|
| 403 | ! |
---|
| 404 | !-- In case of Dirichlet boundary condition qsws must not |
---|
| 405 | !-- be set - it is calculated via MOST in prandtl_fluxes |
---|
[1365] | 406 | q_surface = q_surf(nt) + fac * ( q_surf(nt+1) - q_surf(nt) ) |
---|
[1276] | 407 | |
---|
[1299] | 408 | ELSEIF ( ibc_q_b == 1 ) THEN |
---|
[1276] | 409 | |
---|
[1365] | 410 | qsws = qsws_surf(nt) + fac * ( qsws_surf(nt+1) - qsws_surf(nt) ) |
---|
[1276] | 411 | |
---|
| 412 | ENDIF |
---|
| 413 | |
---|
[1365] | 414 | surface_pressure = p_surf(nt) + fac * ( p_surf(nt+1) - p_surf(nt) ) |
---|
[1239] | 415 | |
---|
| 416 | END SUBROUTINE ls_forcing_surf |
---|
| 417 | |
---|
| 418 | |
---|
[1682] | 419 | !------------------------------------------------------------------------------! |
---|
| 420 | ! Description: |
---|
| 421 | ! ------------ |
---|
| 422 | !> @todo Missing subroutine description. |
---|
| 423 | !------------------------------------------------------------------------------! |
---|
[1239] | 424 | SUBROUTINE ls_forcing_vert ( time ) |
---|
| 425 | |
---|
[1320] | 426 | USE arrays_3d, & |
---|
| 427 | ONLY: time_vert, ug, ug_vert, vg, vg_vert, w_subs, wsubs_vert |
---|
[1239] | 428 | |
---|
[1320] | 429 | USE control_parameters, & |
---|
| 430 | ONLY: large_scale_subsidence |
---|
| 431 | |
---|
| 432 | USE kinds |
---|
| 433 | |
---|
[1239] | 434 | IMPLICIT NONE |
---|
| 435 | |
---|
[1682] | 436 | INTEGER(iwp) :: nt !< |
---|
[1239] | 437 | |
---|
[1682] | 438 | REAL(wp) :: fac !< |
---|
| 439 | REAL(wp), INTENT(in) :: time !< |
---|
[1320] | 440 | |
---|
[1239] | 441 | ! |
---|
| 442 | !-- Interpolation in time of LSF_DATA for ug, vg and w_subs |
---|
[1365] | 443 | nt = 1 |
---|
| 444 | DO WHILE ( time > time_vert(nt) ) |
---|
| 445 | nt = nt + 1 |
---|
[1239] | 446 | ENDDO |
---|
[1365] | 447 | IF ( time /= time_vert(nt) ) THEN |
---|
| 448 | nt = nt - 1 |
---|
[1239] | 449 | ENDIF |
---|
| 450 | |
---|
[1365] | 451 | fac = ( time-time_vert(nt) ) / ( time_vert(nt+1)-time_vert(nt) ) |
---|
[1239] | 452 | |
---|
[1365] | 453 | ug = ug_vert(:,nt) + fac * ( ug_vert(:,nt+1) - ug_vert(:,nt) ) |
---|
| 454 | vg = vg_vert(:,nt) + fac * ( vg_vert(:,nt+1) - vg_vert(:,nt) ) |
---|
[1239] | 455 | |
---|
[1249] | 456 | IF ( large_scale_subsidence ) THEN |
---|
[1365] | 457 | w_subs = wsubs_vert(:,nt) & |
---|
| 458 | + fac * ( wsubs_vert(:,nt+1) - wsubs_vert(:,nt) ) |
---|
[1239] | 459 | ENDIF |
---|
| 460 | |
---|
| 461 | END SUBROUTINE ls_forcing_vert |
---|
| 462 | |
---|
| 463 | |
---|
[1365] | 464 | !------------------------------------------------------------------------------! |
---|
[1682] | 465 | ! Description: |
---|
| 466 | ! ------------ |
---|
| 467 | !> Call for all grid points |
---|
[1365] | 468 | !------------------------------------------------------------------------------! |
---|
| 469 | SUBROUTINE ls_advec ( time, prog_var ) |
---|
| 470 | |
---|
| 471 | USE arrays_3d, & |
---|
[1382] | 472 | ONLY: td_lsa_lpt, td_lsa_q, td_sub_lpt, td_sub_q, tend, time_vert |
---|
[1365] | 473 | |
---|
| 474 | USE control_parameters, & |
---|
| 475 | ONLY: large_scale_subsidence, use_subsidence_tendencies |
---|
| 476 | |
---|
| 477 | USE indices |
---|
| 478 | |
---|
| 479 | USE kinds |
---|
| 480 | |
---|
| 481 | IMPLICIT NONE |
---|
| 482 | |
---|
[1682] | 483 | CHARACTER (LEN=*) :: prog_var !< |
---|
[1365] | 484 | |
---|
[1682] | 485 | REAL(wp), INTENT(in) :: time !< |
---|
| 486 | REAL(wp) :: fac !< |
---|
[1365] | 487 | |
---|
[1682] | 488 | INTEGER(iwp) :: i !< |
---|
| 489 | INTEGER(iwp) :: j !< |
---|
| 490 | INTEGER(iwp) :: k !< |
---|
| 491 | INTEGER(iwp) :: nt !< |
---|
[1365] | 492 | |
---|
| 493 | ! |
---|
| 494 | !-- Interpolation in time of LSF_DATA |
---|
| 495 | nt = 1 |
---|
| 496 | DO WHILE ( time > time_vert(nt) ) |
---|
| 497 | nt = nt + 1 |
---|
| 498 | ENDDO |
---|
| 499 | IF ( time /= time_vert(nt) ) THEN |
---|
| 500 | nt = nt - 1 |
---|
| 501 | ENDIF |
---|
| 502 | |
---|
| 503 | fac = ( time-time_vert(nt) ) / ( time_vert(nt+1)-time_vert(nt) ) |
---|
| 504 | |
---|
| 505 | ! |
---|
| 506 | !-- Add horizontal large scale advection tendencies of pt and q |
---|
| 507 | SELECT CASE ( prog_var ) |
---|
| 508 | |
---|
| 509 | CASE ( 'pt' ) |
---|
| 510 | |
---|
| 511 | DO i = nxl, nxr |
---|
| 512 | DO j = nys, nyn |
---|
| 513 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1382] | 514 | tend(k,j,i) = tend(k,j,i) + td_lsa_lpt(k,nt) + fac * & |
---|
| 515 | ( td_lsa_lpt(k,nt+1) - td_lsa_lpt(k,nt) ) |
---|
[1365] | 516 | ENDDO |
---|
| 517 | ENDDO |
---|
| 518 | ENDDO |
---|
| 519 | |
---|
| 520 | CASE ( 'q' ) |
---|
| 521 | |
---|
| 522 | DO i = nxl, nxr |
---|
| 523 | DO j = nys, nyn |
---|
| 524 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1382] | 525 | tend(k,j,i) = tend(k,j,i) + td_lsa_q(k,nt) + fac * & |
---|
| 526 | ( td_lsa_q(k,nt+1) - td_lsa_q(k,nt) ) |
---|
[1365] | 527 | ENDDO |
---|
| 528 | ENDDO |
---|
| 529 | ENDDO |
---|
| 530 | |
---|
| 531 | END SELECT |
---|
| 532 | |
---|
| 533 | ! |
---|
| 534 | !-- Subsidence of pt and q with prescribed subsidence tendencies |
---|
| 535 | IF ( large_scale_subsidence .AND. use_subsidence_tendencies ) THEN |
---|
| 536 | |
---|
| 537 | SELECT CASE ( prog_var ) |
---|
| 538 | |
---|
| 539 | CASE ( 'pt' ) |
---|
| 540 | |
---|
| 541 | DO i = nxl, nxr |
---|
| 542 | DO j = nys, nyn |
---|
| 543 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1382] | 544 | tend(k,j,i) = tend(k,j,i) + td_sub_lpt(k,nt) + fac * & |
---|
| 545 | ( td_sub_lpt(k,nt+1) - td_sub_lpt(k,nt) ) |
---|
[1365] | 546 | ENDDO |
---|
| 547 | ENDDO |
---|
| 548 | ENDDO |
---|
| 549 | |
---|
| 550 | CASE ( 'q' ) |
---|
| 551 | |
---|
| 552 | DO i = nxl, nxr |
---|
| 553 | DO j = nys, nyn |
---|
| 554 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1382] | 555 | tend(k,j,i) = tend(k,j,i) + td_sub_q(k,nt) + fac * & |
---|
| 556 | ( td_sub_q(k,nt+1) - td_sub_q(k,nt) ) |
---|
[1365] | 557 | ENDDO |
---|
| 558 | ENDDO |
---|
| 559 | ENDDO |
---|
| 560 | |
---|
| 561 | END SELECT |
---|
| 562 | |
---|
| 563 | ENDIF |
---|
| 564 | |
---|
| 565 | END SUBROUTINE ls_advec |
---|
| 566 | |
---|
| 567 | |
---|
| 568 | !------------------------------------------------------------------------------! |
---|
[1682] | 569 | ! Description: |
---|
| 570 | ! ------------ |
---|
| 571 | !> Call for grid point i,j |
---|
[1365] | 572 | !------------------------------------------------------------------------------! |
---|
| 573 | SUBROUTINE ls_advec_ij ( i, j, time, prog_var ) |
---|
| 574 | |
---|
| 575 | USE arrays_3d, & |
---|
[1382] | 576 | ONLY: td_lsa_lpt, td_lsa_q, td_sub_lpt, td_sub_q, tend, time_vert |
---|
[1365] | 577 | |
---|
| 578 | USE control_parameters, & |
---|
| 579 | ONLY: large_scale_subsidence, use_subsidence_tendencies |
---|
| 580 | |
---|
| 581 | USE indices |
---|
| 582 | |
---|
| 583 | USE kinds |
---|
| 584 | |
---|
| 585 | IMPLICIT NONE |
---|
| 586 | |
---|
[1682] | 587 | CHARACTER (LEN=*) :: prog_var !< |
---|
[1365] | 588 | |
---|
[1682] | 589 | REAL(wp), INTENT(in) :: time !< |
---|
| 590 | REAL(wp) :: fac !< |
---|
[1365] | 591 | |
---|
[1682] | 592 | INTEGER(iwp) :: i !< |
---|
| 593 | INTEGER(iwp) :: j !< |
---|
| 594 | INTEGER(iwp) :: k !< |
---|
| 595 | INTEGER(iwp) :: nt !< |
---|
[1365] | 596 | |
---|
| 597 | ! |
---|
| 598 | !-- Interpolation in time of LSF_DATA |
---|
| 599 | nt = 1 |
---|
| 600 | DO WHILE ( time > time_vert(nt) ) |
---|
| 601 | nt = nt + 1 |
---|
| 602 | ENDDO |
---|
| 603 | IF ( time /= time_vert(nt) ) THEN |
---|
| 604 | nt = nt - 1 |
---|
| 605 | ENDIF |
---|
| 606 | |
---|
| 607 | fac = ( time-time_vert(nt) ) / ( time_vert(nt+1)-time_vert(nt) ) |
---|
| 608 | |
---|
| 609 | ! |
---|
| 610 | !-- Add horizontal large scale advection tendencies of pt and q |
---|
| 611 | SELECT CASE ( prog_var ) |
---|
| 612 | |
---|
| 613 | CASE ( 'pt' ) |
---|
| 614 | |
---|
| 615 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1382] | 616 | tend(k,j,i) = tend(k,j,i) + td_lsa_lpt(k,nt) & |
---|
| 617 | + fac * ( td_lsa_lpt(k,nt+1) - td_lsa_lpt(k,nt) ) |
---|
[1365] | 618 | ENDDO |
---|
| 619 | |
---|
| 620 | CASE ( 'q' ) |
---|
| 621 | |
---|
| 622 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1382] | 623 | tend(k,j,i) = tend(k,j,i) + td_lsa_q(k,nt) & |
---|
| 624 | + fac * ( td_lsa_q(k,nt+1) - td_lsa_q(k,nt) ) |
---|
[1365] | 625 | ENDDO |
---|
| 626 | |
---|
| 627 | END SELECT |
---|
| 628 | |
---|
| 629 | ! |
---|
| 630 | !-- Subsidence of pt and q with prescribed profiles |
---|
| 631 | IF ( large_scale_subsidence .AND. use_subsidence_tendencies ) THEN |
---|
| 632 | |
---|
| 633 | SELECT CASE ( prog_var ) |
---|
| 634 | |
---|
| 635 | CASE ( 'pt' ) |
---|
| 636 | |
---|
| 637 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1382] | 638 | tend(k,j,i) = tend(k,j,i) + td_sub_lpt(k,nt) + fac * & |
---|
| 639 | ( td_sub_lpt(k,nt+1) - td_sub_lpt(k,nt) ) |
---|
[1365] | 640 | ENDDO |
---|
| 641 | |
---|
| 642 | CASE ( 'q' ) |
---|
| 643 | |
---|
| 644 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1382] | 645 | tend(k,j,i) = tend(k,j,i) + td_sub_q(k,nt) + fac * & |
---|
| 646 | ( td_sub_q(k,nt+1) - td_sub_q(k,nt) ) |
---|
[1365] | 647 | ENDDO |
---|
| 648 | |
---|
| 649 | END SELECT |
---|
| 650 | |
---|
| 651 | ENDIF |
---|
| 652 | |
---|
| 653 | END SUBROUTINE ls_advec_ij |
---|
| 654 | |
---|
| 655 | |
---|
[1239] | 656 | END MODULE ls_forcing_mod |
---|