[411] | 1 | MODULE subsidence_mod |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later 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 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[411] | 20 | ! Current revisions: |
---|
| 21 | ! ----------------- |
---|
[1383] | 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: subsidence.f90 1383 2014-04-30 12:17:54Z raasch $ |
---|
| 27 | ! |
---|
| 28 | ! 1382 2014-04-30 12:15:41Z boeske |
---|
[1382] | 29 | ! Changed the weighting factor that is used in the summation of subsidence |
---|
| 30 | ! tendencies for profile data output from weight_pres to weight_substep |
---|
| 31 | ! added Neumann boundary conditions for profile data output of subsidence terms |
---|
| 32 | ! at nzt+1 |
---|
[1321] | 33 | ! |
---|
[1381] | 34 | ! 1380 2014-04-28 12:40:45Z heinze |
---|
| 35 | ! Shifting only necessary in case of scalar Rayleigh damping |
---|
| 36 | ! |
---|
[1366] | 37 | ! 1365 2014-04-22 15:03:56Z boeske |
---|
| 38 | ! Summation of subsidence tendencies for data output added |
---|
| 39 | ! +ls_index, sums_ls_l, tmp_tend |
---|
| 40 | ! |
---|
[1354] | 41 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 42 | ! REAL constants provided with KIND-attribute |
---|
| 43 | ! |
---|
[1321] | 44 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 45 | ! ONLY-attribute added to USE-statements, |
---|
| 46 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 47 | ! kinds are defined in new module kinds, |
---|
| 48 | ! old module precision_kind is removed, |
---|
| 49 | ! revision history before 2012 removed, |
---|
| 50 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 51 | ! all variable declaration statements |
---|
[411] | 52 | ! |
---|
[1037] | 53 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 54 | ! code put under GPL (PALM 3.9) |
---|
| 55 | ! |
---|
[464] | 56 | ! Revision 3.7 2009-12-11 14:15:58Z heinze |
---|
| 57 | ! Initial revision |
---|
[411] | 58 | ! |
---|
| 59 | ! Description: |
---|
| 60 | ! ------------ |
---|
| 61 | ! Impact of large-scale subsidence or ascent as tendency term for use |
---|
| 62 | ! in the prognostic equation of potential temperature. This enables the |
---|
| 63 | ! construction of a constant boundary layer height z_i with time. |
---|
| 64 | !-----------------------------------------------------------------------------! |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | IMPLICIT NONE |
---|
| 68 | |
---|
| 69 | PRIVATE |
---|
| 70 | PUBLIC init_w_subsidence, subsidence |
---|
| 71 | |
---|
| 72 | INTERFACE init_w_subsidence |
---|
| 73 | MODULE PROCEDURE init_w_subsidence |
---|
| 74 | END INTERFACE init_w_subsidence |
---|
| 75 | |
---|
| 76 | INTERFACE subsidence |
---|
| 77 | MODULE PROCEDURE subsidence |
---|
| 78 | MODULE PROCEDURE subsidence_ij |
---|
| 79 | END INTERFACE subsidence |
---|
| 80 | |
---|
| 81 | CONTAINS |
---|
| 82 | |
---|
| 83 | SUBROUTINE init_w_subsidence |
---|
| 84 | |
---|
[1320] | 85 | USE arrays_3d, & |
---|
| 86 | ONLY: dzu, w_subs, zu |
---|
[411] | 87 | |
---|
[1320] | 88 | USE control_parameters, & |
---|
| 89 | ONLY: message_string, ocean, subs_vertical_gradient, & |
---|
| 90 | subs_vertical_gradient_level, subs_vertical_gradient_level_i |
---|
| 91 | |
---|
| 92 | USE indices, & |
---|
| 93 | ONLY: nzb, nzt |
---|
| 94 | |
---|
| 95 | USE kinds |
---|
| 96 | |
---|
[411] | 97 | IMPLICIT NONE |
---|
| 98 | |
---|
[1320] | 99 | INTEGER(iwp) :: i !: |
---|
| 100 | INTEGER(iwp) :: k !: |
---|
[411] | 101 | |
---|
[1320] | 102 | REAL(wp) :: gradient !: |
---|
| 103 | REAL(wp) :: ws_surface !: |
---|
| 104 | |
---|
[1365] | 105 | IF ( .NOT. ALLOCATED( w_subs )) THEN |
---|
[411] | 106 | ALLOCATE( w_subs(nzb:nzt+1) ) |
---|
[1353] | 107 | w_subs = 0.0_wp |
---|
[411] | 108 | ENDIF |
---|
| 109 | |
---|
[1365] | 110 | IF ( ocean ) THEN |
---|
[411] | 111 | message_string = 'Applying large scale vertical motion is not ' // & |
---|
| 112 | 'allowed for ocean runs' |
---|
| 113 | CALL message( 'init_w_subsidence', 'PA0324', 2, 2, 0, 6, 0 ) |
---|
| 114 | ENDIF |
---|
| 115 | |
---|
| 116 | ! |
---|
| 117 | !-- Compute the profile of the subsidence/ascent velocity |
---|
| 118 | !-- using the given gradients |
---|
| 119 | i = 1 |
---|
[1353] | 120 | gradient = 0.0_wp |
---|
| 121 | ws_surface = 0.0_wp |
---|
[411] | 122 | |
---|
| 123 | |
---|
[580] | 124 | subs_vertical_gradient_level_i(1) = 0 |
---|
[411] | 125 | DO k = 1, nzt+1 |
---|
[1365] | 126 | IF ( i < 11 ) THEN |
---|
[580] | 127 | IF ( subs_vertical_gradient_level(i) < zu(k) .AND. & |
---|
[1353] | 128 | subs_vertical_gradient_level(i) >= 0.0_wp ) THEN |
---|
| 129 | gradient = subs_vertical_gradient(i) / 100.0_wp |
---|
[580] | 130 | subs_vertical_gradient_level_i(i) = k - 1 |
---|
[411] | 131 | i = i + 1 |
---|
| 132 | ENDIF |
---|
| 133 | ENDIF |
---|
[1353] | 134 | IF ( gradient /= 0.0_wp ) THEN |
---|
[411] | 135 | IF ( k /= 1 ) THEN |
---|
| 136 | w_subs(k) = w_subs(k-1) + dzu(k) * gradient |
---|
| 137 | ELSE |
---|
[1353] | 138 | w_subs(k) = ws_surface + 0.5_wp * dzu(k) * gradient |
---|
[411] | 139 | ENDIF |
---|
| 140 | ELSE |
---|
| 141 | w_subs(k) = w_subs(k-1) |
---|
| 142 | ENDIF |
---|
| 143 | ENDDO |
---|
| 144 | |
---|
| 145 | ! |
---|
| 146 | !-- In case of no given gradients for the subsidence/ascent velocity, |
---|
| 147 | !-- choose zero gradient |
---|
[1353] | 148 | IF ( subs_vertical_gradient_level(1) == -9999999.9_wp ) THEN |
---|
| 149 | subs_vertical_gradient_level(1) = 0.0_wp |
---|
[411] | 150 | ENDIF |
---|
| 151 | |
---|
| 152 | END SUBROUTINE init_w_subsidence |
---|
| 153 | |
---|
| 154 | |
---|
[1365] | 155 | SUBROUTINE subsidence( tendency, var, var_init, ls_index ) |
---|
[411] | 156 | |
---|
[1320] | 157 | USE arrays_3d, & |
---|
| 158 | ONLY: ddzu, w_subs |
---|
[411] | 159 | |
---|
[1320] | 160 | USE control_parameters, & |
---|
[1380] | 161 | ONLY: dt_3d, intermediate_timestep_count, large_scale_forcing, & |
---|
| 162 | scalar_rayleigh_damping |
---|
[1320] | 163 | |
---|
| 164 | USE indices, & |
---|
| 165 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_s_inner,& |
---|
| 166 | nzt |
---|
| 167 | |
---|
| 168 | USE kinds |
---|
| 169 | |
---|
[1365] | 170 | USE statistics, & |
---|
[1382] | 171 | ONLY: sums_ls_l, weight_substep |
---|
[1365] | 172 | |
---|
[411] | 173 | IMPLICIT NONE |
---|
| 174 | |
---|
[1320] | 175 | INTEGER(iwp) :: i !: |
---|
| 176 | INTEGER(iwp) :: j !: |
---|
| 177 | INTEGER(iwp) :: k !: |
---|
[1365] | 178 | INTEGER(iwp) :: ls_index !: |
---|
[411] | 179 | |
---|
[1365] | 180 | REAL(wp) :: tmp_tend !: |
---|
[1320] | 181 | REAL(wp) :: tmp_grad !: |
---|
[411] | 182 | |
---|
[1320] | 183 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: var !: |
---|
| 184 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: tendency !: |
---|
| 185 | REAL(wp), DIMENSION(nzb:nzt+1) :: var_init !: |
---|
| 186 | REAL(wp), DIMENSION(nzb:nzt+1) :: var_mod !: |
---|
[411] | 187 | |
---|
[464] | 188 | var_mod = var_init |
---|
[411] | 189 | |
---|
| 190 | ! |
---|
| 191 | !-- Influence of w_subsidence on the current tendency term |
---|
| 192 | DO i = nxl, nxr |
---|
| 193 | DO j = nys, nyn |
---|
[1382] | 194 | |
---|
[411] | 195 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
[1365] | 196 | IF ( w_subs(k) < 0.0_wp ) THEN ! large-scale subsidence |
---|
| 197 | tmp_tend = - w_subs(k) * & |
---|
| 198 | ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1) |
---|
| 199 | ELSE ! large-scale ascent |
---|
| 200 | tmp_tend = - w_subs(k) * & |
---|
| 201 | ( var(k,j,i) - var(k-1,j,i) ) * ddzu(k) |
---|
[411] | 202 | ENDIF |
---|
[1365] | 203 | |
---|
| 204 | tendency(k,j,i) = tendency(k,j,i) + tmp_tend |
---|
| 205 | |
---|
| 206 | IF ( large_scale_forcing ) THEN |
---|
| 207 | sums_ls_l(k,ls_index) = sums_ls_l(k,ls_index) + tmp_tend & |
---|
[1382] | 208 | * weight_substep(intermediate_timestep_count) |
---|
[1365] | 209 | ENDIF |
---|
[411] | 210 | ENDDO |
---|
[1382] | 211 | |
---|
| 212 | sums_ls_l(nzt+1,ls_index) = sums_ls_l(nzt,ls_index) |
---|
| 213 | |
---|
[411] | 214 | ENDDO |
---|
| 215 | ENDDO |
---|
| 216 | |
---|
| 217 | ! |
---|
| 218 | !-- Shifting of the initial profile is especially necessary with Rayleigh |
---|
| 219 | !-- damping switched on |
---|
[1380] | 220 | IF ( scalar_rayleigh_damping ) THEN |
---|
| 221 | DO k = nzb, nzt |
---|
| 222 | IF ( w_subs(k) < 0.0_wp ) THEN ! large-scale subsidence |
---|
| 223 | var_mod(k) = var_init(k) - dt_3d * w_subs(k) * & |
---|
| 224 | ( var_init(k+1) - var_init(k) ) * ddzu(k+1) |
---|
| 225 | ENDIF |
---|
| 226 | ENDDO |
---|
[411] | 227 | ! |
---|
[1380] | 228 | !-- At the upper boundary, the initial profile is shifted with aid of |
---|
| 229 | !-- the gradient tmp_grad. (This is ok if the gradients are linear.) |
---|
| 230 | IF ( w_subs(nzt) < 0.0_wp ) THEN |
---|
| 231 | tmp_grad = ( var_init(nzt+1) - var_init(nzt) ) * ddzu(nzt+1) |
---|
| 232 | var_mod(nzt+1) = var_init(nzt+1) - & |
---|
| 233 | dt_3d * w_subs(nzt+1) * tmp_grad |
---|
| 234 | ENDIF |
---|
[411] | 235 | |
---|
| 236 | |
---|
[1380] | 237 | DO k = nzt+1, nzb+1, -1 |
---|
| 238 | IF ( w_subs(k) >= 0.0_wp ) THEN ! large-scale ascent |
---|
| 239 | var_mod(k) = var_init(k) - dt_3d * w_subs(k) * & |
---|
| 240 | ( var_init(k) - var_init(k-1) ) * ddzu(k) |
---|
| 241 | ENDIF |
---|
| 242 | ENDDO |
---|
| 243 | ! |
---|
| 244 | !-- At the lower boundary shifting is not necessary because the |
---|
| 245 | !-- subsidence velocity w_subs(nzb) vanishes. |
---|
| 246 | IF ( w_subs(nzb+1) >= 0.0_wp ) THEN |
---|
| 247 | var_mod(nzb) = var_init(nzb) |
---|
[411] | 248 | ENDIF |
---|
[1380] | 249 | |
---|
| 250 | var_init = var_mod |
---|
[411] | 251 | ENDIF |
---|
| 252 | |
---|
| 253 | |
---|
| 254 | END SUBROUTINE subsidence |
---|
| 255 | |
---|
[1365] | 256 | SUBROUTINE subsidence_ij( i, j, tendency, var, var_init, ls_index ) |
---|
[411] | 257 | |
---|
[1320] | 258 | USE arrays_3d, & |
---|
| 259 | ONLY: ddzu, w_subs |
---|
[411] | 260 | |
---|
[1320] | 261 | USE control_parameters, & |
---|
[1380] | 262 | ONLY: dt_3d, intermediate_timestep_count, large_scale_forcing, & |
---|
| 263 | scalar_rayleigh_damping |
---|
[1320] | 264 | |
---|
| 265 | USE indices, & |
---|
| 266 | ONLY: nxl, nxlg, nxrg, nyng, nys, nysg, nzb_s_inner, nzb, nzt |
---|
| 267 | |
---|
| 268 | USE kinds |
---|
| 269 | |
---|
[1365] | 270 | USE statistics, & |
---|
[1382] | 271 | ONLY: sums_ls_l, weight_substep |
---|
[1365] | 272 | |
---|
[411] | 273 | IMPLICIT NONE |
---|
| 274 | |
---|
[1320] | 275 | INTEGER(iwp) :: i !: |
---|
| 276 | INTEGER(iwp) :: j !: |
---|
| 277 | INTEGER(iwp) :: k !: |
---|
[1365] | 278 | INTEGER(iwp) :: ls_index !: |
---|
[411] | 279 | |
---|
[1365] | 280 | REAL(wp) :: tmp_tend !: |
---|
[1320] | 281 | REAL(wp) :: tmp_grad !: |
---|
[411] | 282 | |
---|
[1320] | 283 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: var !: |
---|
| 284 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: tendency !: |
---|
| 285 | REAL(wp), DIMENSION(nzb:nzt+1) :: var_init !: |
---|
| 286 | REAL(wp), DIMENSION(nzb:nzt+1) :: var_mod !: |
---|
[411] | 287 | |
---|
[464] | 288 | var_mod = var_init |
---|
[411] | 289 | |
---|
| 290 | ! |
---|
| 291 | !-- Influence of w_subsidence on the current tendency term |
---|
| 292 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
[1365] | 293 | IF ( w_subs(k) < 0.0_wp ) THEN ! large-scale subsidence |
---|
| 294 | tmp_tend = - w_subs(k) * ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1) |
---|
| 295 | ELSE ! large-scale ascent |
---|
| 296 | tmp_tend = - w_subs(k) * ( var(k,j,i) - var(k-1,j,i) ) * ddzu(k) |
---|
[411] | 297 | ENDIF |
---|
[1365] | 298 | |
---|
| 299 | tendency(k,j,i) = tendency(k,j,i) + tmp_tend |
---|
| 300 | |
---|
| 301 | IF ( large_scale_forcing ) THEN |
---|
| 302 | sums_ls_l(k,ls_index) = sums_ls_l(k,ls_index) + tmp_tend & |
---|
[1382] | 303 | * weight_substep(intermediate_timestep_count) |
---|
[1365] | 304 | ENDIF |
---|
[411] | 305 | ENDDO |
---|
| 306 | |
---|
[1382] | 307 | sums_ls_l(nzt+1,ls_index) = sums_ls_l(nzt,ls_index) |
---|
[411] | 308 | |
---|
[1382] | 309 | |
---|
[411] | 310 | ! |
---|
| 311 | !-- Shifting of the initial profile is especially necessary with Rayleigh |
---|
| 312 | !-- damping switched on |
---|
[1380] | 313 | IF ( scalar_rayleigh_damping ) THEN |
---|
| 314 | IF ( i == nxl .AND. j == nys ) THEN ! shifting only once per PE |
---|
[411] | 315 | |
---|
[1380] | 316 | DO k = nzb, nzt |
---|
| 317 | IF ( w_subs(k) < 0.0_wp ) THEN ! large-scale subsidence |
---|
| 318 | var_mod(k) = var_init(k) - dt_3d * w_subs(k) * & |
---|
| 319 | ( var_init(k+1) - var_init(k) ) * ddzu(k+1) |
---|
| 320 | ENDIF |
---|
| 321 | ENDDO |
---|
| 322 | ! |
---|
| 323 | !-- At the upper boundary, the initial profile is shifted with aid of |
---|
| 324 | !-- the gradient tmp_grad. (This is ok if the gradients are linear.) |
---|
| 325 | IF ( w_subs(nzt) < 0.0_wp ) THEN |
---|
| 326 | tmp_grad = ( var_init(nzt+1) - var_init(nzt) ) * ddzu(nzt+1) |
---|
| 327 | var_mod(nzt+1) = var_init(nzt+1) - & |
---|
| 328 | dt_3d * w_subs(nzt+1) * tmp_grad |
---|
[411] | 329 | ENDIF |
---|
| 330 | |
---|
| 331 | |
---|
[1380] | 332 | DO k = nzt+1, nzb+1, -1 |
---|
| 333 | IF ( w_subs(k) >= 0.0_wp ) THEN ! large-scale ascent |
---|
| 334 | var_mod(k) = var_init(k) - dt_3d * w_subs(k) * & |
---|
| 335 | ( var_init(k) - var_init(k-1) ) * ddzu(k) |
---|
| 336 | ENDIF |
---|
| 337 | ENDDO |
---|
| 338 | ! |
---|
| 339 | !-- At the lower boundary shifting is not necessary because the |
---|
| 340 | !-- subsidence velocity w_subs(nzb) vanishes. |
---|
| 341 | IF ( w_subs(nzb+1) >= 0.0_wp ) THEN |
---|
| 342 | var_mod(nzb) = var_init(nzb) |
---|
[411] | 343 | ENDIF |
---|
| 344 | |
---|
[1380] | 345 | var_init = var_mod |
---|
[411] | 346 | |
---|
[1380] | 347 | ENDIF |
---|
[411] | 348 | ENDIF |
---|
| 349 | |
---|
| 350 | END SUBROUTINE subsidence_ij |
---|
| 351 | |
---|
| 352 | |
---|
| 353 | END MODULE subsidence_mod |
---|