[1826] | 1 | !> @file plant_canopy_model_mod.f90 |
---|
[1036] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1818] | 16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[257] | 19 | ! Current revisions: |
---|
[138] | 20 | ! ----------------- |
---|
[1827] | 21 | ! |
---|
| 22 | ! |
---|
[1485] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: plant_canopy_model_mod.f90 1827 2016-04-07 12:12:23Z maronga $ |
---|
| 26 | ! |
---|
[1827] | 27 | ! 1826 2016-04-07 12:01:39Z maronga |
---|
| 28 | ! Further modularization |
---|
| 29 | ! |
---|
[1722] | 30 | ! 1721 2015-11-16 12:56:48Z raasch |
---|
| 31 | ! bugfixes: shf is reduced in areas covered with canopy only, |
---|
| 32 | ! canopy is set on top of topography |
---|
| 33 | ! |
---|
[1683] | 34 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 35 | ! Code annotations made doxygen readable |
---|
| 36 | ! |
---|
[1485] | 37 | ! 1484 2014-10-21 10:53:05Z kanani |
---|
[1484] | 38 | ! Changes due to new module structure of the plant canopy model: |
---|
| 39 | ! module plant_canopy_model_mod now contains a subroutine for the |
---|
[1826] | 40 | ! initialization of the canopy model (pcm_init), |
---|
[1484] | 41 | ! limitation of the canopy drag (previously accounted for by calculation of |
---|
| 42 | ! a limiting canopy timestep for the determination of the maximum LES timestep |
---|
| 43 | ! in subroutine timestep) is now realized by the calculation of pre-tendencies |
---|
[1826] | 44 | ! and preliminary velocities in subroutine pcm_tendency, |
---|
| 45 | ! some redundant MPI communication removed in subroutine pcm_init |
---|
[1484] | 46 | ! (was previously in init_3d_model), |
---|
| 47 | ! unnecessary 3d-arrays lad_u, lad_v, lad_w removed - lad information on the |
---|
| 48 | ! respective grid is now provided only by lad_s (e.g. in the calculation of |
---|
| 49 | ! the tendency terms or of cum_lai_hf), |
---|
| 50 | ! drag_coefficient, lai, leaf_surface_concentration, |
---|
| 51 | ! scalar_exchange_coefficient, sec and sls renamed to canopy_drag_coeff, |
---|
| 52 | ! cum_lai_hf, leaf_surface_conc, leaf_scalar_exch_coeff, lsec and lsc, |
---|
| 53 | ! respectively, |
---|
| 54 | ! unnecessary 3d-arrays cdc, lsc and lsec now defined as single-value constants, |
---|
| 55 | ! USE-statements and ONLY-lists modified accordingly |
---|
[1341] | 56 | ! |
---|
| 57 | ! 1340 2014-03-25 19:45:13Z kanani |
---|
| 58 | ! REAL constants defined as wp-kind |
---|
| 59 | ! |
---|
[1321] | 60 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 61 | ! ONLY-attribute added to USE-statements, |
---|
| 62 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 63 | ! kinds are defined in new module kinds, |
---|
| 64 | ! old module precision_kind is removed, |
---|
| 65 | ! revision history before 2012 removed, |
---|
| 66 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 67 | ! all variable declaration statements |
---|
[153] | 68 | ! |
---|
[1037] | 69 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 70 | ! code put under GPL (PALM 3.9) |
---|
| 71 | ! |
---|
[139] | 72 | ! 138 2007-11-28 10:03:58Z letzel |
---|
| 73 | ! Initial revision |
---|
| 74 | ! |
---|
[138] | 75 | ! Description: |
---|
| 76 | ! ------------ |
---|
[1682] | 77 | !> 1) Initialization of the canopy model, e.g. construction of leaf area density |
---|
[1826] | 78 | !> profile (subroutine pcm_init). |
---|
[1682] | 79 | !> 2) Calculation of sinks and sources of momentum, heat and scalar concentration |
---|
[1826] | 80 | !> due to canopy elements (subroutine pcm_tendency). |
---|
[138] | 81 | !------------------------------------------------------------------------------! |
---|
[1682] | 82 | MODULE plant_canopy_model_mod |
---|
| 83 | |
---|
[1484] | 84 | USE arrays_3d, & |
---|
| 85 | ONLY: dzu, dzw, e, q, shf, tend, u, v, w, zu, zw |
---|
[138] | 86 | |
---|
[1484] | 87 | USE indices, & |
---|
| 88 | ONLY: nbgp, nxl, nxlg, nxlu, nxr, nxrg, nyn, nyng, nys, nysg, nysv, & |
---|
| 89 | nz, nzb, nzb_s_inner, nzb_u_inner, nzb_v_inner, nzb_w_inner, nzt |
---|
| 90 | |
---|
| 91 | USE kinds |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | IMPLICIT NONE |
---|
| 95 | |
---|
| 96 | |
---|
[1682] | 97 | CHARACTER (LEN=20) :: canopy_mode = 'block' !< canopy coverage |
---|
[1484] | 98 | |
---|
[1682] | 99 | INTEGER(iwp) :: pch_index = 0 !< plant canopy height/top index |
---|
[1484] | 100 | INTEGER(iwp) :: & |
---|
[1682] | 101 | lad_vertical_gradient_level_ind(10) = -9999 !< lad-profile levels (index) |
---|
[1484] | 102 | |
---|
[1682] | 103 | LOGICAL :: calc_beta_lad_profile = .FALSE. !< switch for calc. of lad from beta func. |
---|
| 104 | LOGICAL :: plant_canopy = .FALSE. !< switch for use of canopy model |
---|
[1484] | 105 | |
---|
[1682] | 106 | REAL(wp) :: alpha_lad = 9999999.9_wp !< coefficient for lad calculation |
---|
| 107 | REAL(wp) :: beta_lad = 9999999.9_wp !< coefficient for lad calculation |
---|
| 108 | REAL(wp) :: canopy_drag_coeff = 0.0_wp !< canopy drag coefficient (parameter) |
---|
| 109 | REAL(wp) :: cdc = 0.0_wp !< canopy drag coeff. (abbreviation used in equations) |
---|
| 110 | REAL(wp) :: cthf = 0.0_wp !< canopy top heat flux |
---|
| 111 | REAL(wp) :: dt_plant_canopy = 0.0_wp !< timestep account. for canopy drag |
---|
| 112 | REAL(wp) :: lad_surface = 0.0_wp !< lad surface value |
---|
| 113 | REAL(wp) :: lai_beta = 0.0_wp !< leaf area index (lai) for lad calc. |
---|
[1484] | 114 | REAL(wp) :: & |
---|
[1682] | 115 | leaf_scalar_exch_coeff = 0.0_wp !< canopy scalar exchange coeff. |
---|
[1484] | 116 | REAL(wp) :: & |
---|
[1682] | 117 | leaf_surface_conc = 0.0_wp !< leaf surface concentration |
---|
| 118 | REAL(wp) :: lsec = 0.0_wp !< leaf scalar exchange coeff. |
---|
| 119 | REAL(wp) :: lsc = 0.0_wp !< leaf surface concentration |
---|
[1484] | 120 | |
---|
| 121 | REAL(wp) :: & |
---|
[1682] | 122 | lad_vertical_gradient(10) = 0.0_wp !< lad gradient |
---|
[1484] | 123 | REAL(wp) :: & |
---|
[1682] | 124 | lad_vertical_gradient_level(10) = -9999999.9_wp !< lad-prof. levels (in m) |
---|
[1484] | 125 | |
---|
[1682] | 126 | REAL(wp), DIMENSION(:), ALLOCATABLE :: lad !< leaf area density |
---|
| 127 | REAL(wp), DIMENSION(:), ALLOCATABLE :: pre_lad !< preliminary lad |
---|
[1484] | 128 | |
---|
| 129 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: & |
---|
[1682] | 130 | canopy_heat_flux !< canopy heat flux |
---|
| 131 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: cum_lai_hf !< cumulative lai for heatflux calc. |
---|
| 132 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: lad_s !< lad on scalar-grid |
---|
[1484] | 133 | |
---|
| 134 | |
---|
| 135 | SAVE |
---|
| 136 | |
---|
| 137 | |
---|
[138] | 138 | PRIVATE |
---|
[1826] | 139 | |
---|
| 140 | ! |
---|
| 141 | !-- Public functions |
---|
| 142 | PUBLIC pcm_check_parameters, pcm_header, pcm_init, pcm_parin, pcm_tendency |
---|
[138] | 143 | |
---|
[1826] | 144 | ! |
---|
| 145 | !-- Public variables and constants |
---|
| 146 | PUBLIC canopy_mode, cthf, dt_plant_canopy, plant_canopy |
---|
[1484] | 147 | |
---|
| 148 | |
---|
[1826] | 149 | INTERFACE pcm_check_parameters |
---|
| 150 | MODULE PROCEDURE pcm_check_parameters |
---|
| 151 | END INTERFACE pcm_check_parameters |
---|
| 152 | |
---|
| 153 | INTERFACE pcm_header |
---|
| 154 | MODULE PROCEDURE pcm_header |
---|
| 155 | END INTERFACE pcm_header |
---|
| 156 | |
---|
| 157 | INTERFACE pcm_init |
---|
| 158 | MODULE PROCEDURE pcm_init |
---|
| 159 | END INTERFACE pcm_init |
---|
[138] | 160 | |
---|
[1826] | 161 | INTERFACE pcm_parin |
---|
| 162 | MODULE PROCEDURE pcm_parin |
---|
| 163 | END INTERFACE pcm_parin |
---|
| 164 | |
---|
| 165 | INTERFACE pcm_tendency |
---|
| 166 | MODULE PROCEDURE pcm_tendency |
---|
| 167 | MODULE PROCEDURE pcm_tendency_ij |
---|
| 168 | END INTERFACE pcm_tendency |
---|
[1484] | 169 | |
---|
| 170 | |
---|
[138] | 171 | CONTAINS |
---|
| 172 | |
---|
[1826] | 173 | |
---|
| 174 | !------------------------------------------------------------------------------! |
---|
| 175 | ! Description: |
---|
| 176 | ! ------------ |
---|
| 177 | !> Check parameters routine for plant canopy model |
---|
| 178 | !------------------------------------------------------------------------------! |
---|
| 179 | SUBROUTINE pcm_check_parameters |
---|
[138] | 180 | |
---|
[1826] | 181 | USE control_parameters, & |
---|
| 182 | ONLY: cloud_physics, message_string, microphysics_seifert |
---|
| 183 | |
---|
| 184 | |
---|
| 185 | IMPLICIT NONE |
---|
| 186 | |
---|
| 187 | |
---|
| 188 | IF ( canopy_drag_coeff == 0.0_wp ) THEN |
---|
| 189 | message_string = 'plant_canopy = .TRUE. requires a non-zero drag '// & |
---|
| 190 | 'coefficient & given value is canopy_drag_coeff = 0.0' |
---|
| 191 | CALL message( 'check_parameters', 'PA0041', 1, 2, 0, 6, 0 ) |
---|
| 192 | ENDIF |
---|
| 193 | |
---|
| 194 | IF ( ( alpha_lad /= 9999999.9_wp .AND. beta_lad == 9999999.9_wp ) .OR.& |
---|
| 195 | beta_lad /= 9999999.9_wp .AND. alpha_lad == 9999999.9_wp ) THEN |
---|
| 196 | message_string = 'using the beta function for the construction ' // & |
---|
| 197 | 'of the leaf area density profile requires ' // & |
---|
| 198 | 'both alpha_lad and beta_lad to be /= 9999999.9' |
---|
| 199 | CALL message( 'check_parameters', 'PA0118', 1, 2, 0, 6, 0 ) |
---|
| 200 | ENDIF |
---|
| 201 | |
---|
| 202 | IF ( calc_beta_lad_profile .AND. lai_beta == 0.0_wp ) THEN |
---|
| 203 | message_string = 'using the beta function for the construction ' // & |
---|
| 204 | 'of the leaf area density profile requires ' // & |
---|
| 205 | 'a non-zero lai_beta, but given value is ' // & |
---|
| 206 | 'lai_beta = 0.0' |
---|
| 207 | CALL message( 'check_parameters', 'PA0119', 1, 2, 0, 6, 0 ) |
---|
| 208 | ENDIF |
---|
| 209 | |
---|
| 210 | IF ( calc_beta_lad_profile .AND. lad_surface /= 0.0_wp ) THEN |
---|
| 211 | message_string = 'simultaneous setting of alpha_lad /= 9999999.9' // & |
---|
| 212 | 'and lad_surface /= 0.0 is not possible, ' // & |
---|
| 213 | 'use either vertical gradients or the beta ' // & |
---|
| 214 | 'function for the construction of the leaf area '// & |
---|
| 215 | 'density profile' |
---|
| 216 | CALL message( 'check_parameters', 'PA0120', 1, 2, 0, 6, 0 ) |
---|
| 217 | ENDIF |
---|
| 218 | |
---|
| 219 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
| 220 | message_string = 'plant_canopy = .TRUE. requires cloud_scheme /=' // & |
---|
| 221 | ' seifert_beheng' |
---|
| 222 | CALL message( 'check_parameters', 'PA0360', 1, 2, 0, 6, 0 ) |
---|
| 223 | ENDIF |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | END SUBROUTINE pcm_check_parameters |
---|
| 227 | |
---|
| 228 | |
---|
[138] | 229 | !------------------------------------------------------------------------------! |
---|
[1484] | 230 | ! Description: |
---|
| 231 | ! ------------ |
---|
[1826] | 232 | !> Header output for plant canopy model |
---|
| 233 | !------------------------------------------------------------------------------! |
---|
| 234 | SUBROUTINE pcm_header ( io ) |
---|
| 235 | |
---|
| 236 | USE control_parameters, & |
---|
| 237 | ONLY: dz, passive_scalar |
---|
| 238 | |
---|
| 239 | |
---|
| 240 | IMPLICIT NONE |
---|
| 241 | |
---|
| 242 | CHARACTER (LEN=10) :: coor_chr !< |
---|
| 243 | |
---|
| 244 | CHARACTER (LEN=86) :: coordinates !< |
---|
| 245 | CHARACTER (LEN=86) :: gradients !< |
---|
| 246 | CHARACTER (LEN=86) :: leaf_area_density !< |
---|
| 247 | CHARACTER (LEN=86) :: slices !< |
---|
| 248 | |
---|
| 249 | INTEGER(iwp) :: i !< |
---|
| 250 | INTEGER(iwp), INTENT(IN) :: io !< Unit of the output file |
---|
| 251 | INTEGER(iwp) :: k !< |
---|
| 252 | |
---|
| 253 | REAL(wp) :: canopy_height !< canopy height (in m) |
---|
| 254 | |
---|
| 255 | canopy_height = pch_index * dz |
---|
| 256 | |
---|
| 257 | WRITE ( io, 1 ) canopy_mode, canopy_height, pch_index, & |
---|
| 258 | canopy_drag_coeff |
---|
| 259 | IF ( passive_scalar ) THEN |
---|
| 260 | WRITE ( io, 2 ) leaf_scalar_exch_coeff, & |
---|
| 261 | leaf_surface_conc |
---|
| 262 | ENDIF |
---|
| 263 | |
---|
| 264 | ! |
---|
| 265 | !-- Heat flux at the top of vegetation |
---|
| 266 | WRITE ( io, 3 ) cthf |
---|
| 267 | |
---|
| 268 | ! |
---|
| 269 | !-- Leaf area density profile, calculated either from given vertical |
---|
| 270 | !-- gradients or from beta probability density function. |
---|
| 271 | IF ( .NOT. calc_beta_lad_profile ) THEN |
---|
| 272 | |
---|
| 273 | !-- Building output strings, starting with surface value |
---|
| 274 | WRITE ( leaf_area_density, '(F7.4)' ) lad_surface |
---|
| 275 | gradients = '------' |
---|
| 276 | slices = ' 0' |
---|
| 277 | coordinates = ' 0.0' |
---|
| 278 | i = 1 |
---|
| 279 | DO WHILE ( i < 11 .AND. lad_vertical_gradient_level_ind(i) & |
---|
| 280 | /= -9999 ) |
---|
| 281 | |
---|
| 282 | WRITE (coor_chr,'(F7.2)') lad(lad_vertical_gradient_level_ind(i)) |
---|
| 283 | leaf_area_density = TRIM( leaf_area_density ) // ' ' // & |
---|
| 284 | TRIM( coor_chr ) |
---|
| 285 | |
---|
| 286 | WRITE (coor_chr,'(F7.2)') lad_vertical_gradient(i) |
---|
| 287 | gradients = TRIM( gradients ) // ' ' // TRIM( coor_chr ) |
---|
| 288 | |
---|
| 289 | WRITE (coor_chr,'(I7)') lad_vertical_gradient_level_ind(i) |
---|
| 290 | slices = TRIM( slices ) // ' ' // TRIM( coor_chr ) |
---|
| 291 | |
---|
| 292 | WRITE (coor_chr,'(F7.1)') lad_vertical_gradient_level(i) |
---|
| 293 | coordinates = TRIM( coordinates ) // ' ' // TRIM( coor_chr ) |
---|
| 294 | |
---|
| 295 | i = i + 1 |
---|
| 296 | ENDDO |
---|
| 297 | |
---|
| 298 | WRITE ( io, 4 ) TRIM( coordinates ), TRIM( leaf_area_density ), & |
---|
| 299 | TRIM( gradients ), TRIM( slices ) |
---|
| 300 | |
---|
| 301 | ELSE |
---|
| 302 | |
---|
| 303 | WRITE ( leaf_area_density, '(F7.4)' ) lad_surface |
---|
| 304 | coordinates = ' 0.0' |
---|
| 305 | |
---|
| 306 | DO k = 1, pch_index |
---|
| 307 | |
---|
| 308 | WRITE (coor_chr,'(F7.2)') lad(k) |
---|
| 309 | leaf_area_density = TRIM( leaf_area_density ) // ' ' // & |
---|
| 310 | TRIM( coor_chr ) |
---|
| 311 | |
---|
| 312 | WRITE (coor_chr,'(F7.1)') zu(k) |
---|
| 313 | coordinates = TRIM( coordinates ) // ' ' // TRIM( coor_chr ) |
---|
| 314 | |
---|
| 315 | ENDDO |
---|
| 316 | |
---|
| 317 | WRITE ( io, 5 ) TRIM( coordinates ), TRIM( leaf_area_density ), & |
---|
| 318 | alpha_lad, beta_lad, lai_beta |
---|
| 319 | |
---|
| 320 | ENDIF |
---|
| 321 | |
---|
| 322 | 1 FORMAT (//' Vegetation canopy (drag) model:'/ & |
---|
| 323 | ' ------------------------------'// & |
---|
| 324 | ' Canopy mode: ', A / & |
---|
| 325 | ' Canopy height: ',F6.2,'m (',I4,' grid points)' / & |
---|
| 326 | ' Leaf drag coefficient: ',F6.2 /) |
---|
| 327 | 2 FORMAT (/ ' Scalar exchange coefficient: ',F6.2 / & |
---|
| 328 | ' Scalar concentration at leaf surfaces in kg/m**3: ',F6.2 /) |
---|
| 329 | 3 FORMAT (' Predefined constant heatflux at the top of the vegetation: ',F6.2, & |
---|
| 330 | ' K m/s') |
---|
| 331 | 4 FORMAT (/ ' Characteristic levels of the leaf area density:'// & |
---|
| 332 | ' Height: ',A,' m'/ & |
---|
| 333 | ' Leaf area density: ',A,' m**2/m**3'/ & |
---|
| 334 | ' Gradient: ',A,' m**2/m**4'/ & |
---|
| 335 | ' Gridpoint: ',A) |
---|
| 336 | 5 FORMAT (//' Characteristic levels of the leaf area density and coefficients:'& |
---|
| 337 | // ' Height: ',A,' m'/ & |
---|
| 338 | ' Leaf area density: ',A,' m**2/m**3'/ & |
---|
| 339 | ' Coefficient alpha: ',F6.2 / & |
---|
| 340 | ' Coefficient beta: ',F6.2 / & |
---|
| 341 | ' Leaf area index: ',F6.2,' m**2/m**2' /) |
---|
| 342 | |
---|
| 343 | END SUBROUTINE pcm_header |
---|
| 344 | |
---|
| 345 | |
---|
| 346 | !------------------------------------------------------------------------------! |
---|
| 347 | ! Description: |
---|
| 348 | ! ------------ |
---|
[1682] | 349 | !> Initialization of the plant canopy model |
---|
[138] | 350 | !------------------------------------------------------------------------------! |
---|
[1826] | 351 | SUBROUTINE pcm_init |
---|
[1484] | 352 | |
---|
| 353 | |
---|
| 354 | USE control_parameters, & |
---|
| 355 | ONLY: dz, ocean, passive_scalar |
---|
| 356 | |
---|
| 357 | |
---|
| 358 | IMPLICIT NONE |
---|
| 359 | |
---|
[1682] | 360 | INTEGER(iwp) :: i !< running index |
---|
| 361 | INTEGER(iwp) :: j !< running index |
---|
| 362 | INTEGER(iwp) :: k !< running index |
---|
[1484] | 363 | |
---|
[1682] | 364 | REAL(wp) :: int_bpdf !< vertical integral for lad-profile construction |
---|
| 365 | REAL(wp) :: dzh !< vertical grid spacing in units of canopy height |
---|
| 366 | REAL(wp) :: gradient !< gradient for lad-profile construction |
---|
| 367 | REAL(wp) :: canopy_height !< canopy height for lad-profile construction |
---|
[1484] | 368 | |
---|
| 369 | ! |
---|
| 370 | !-- Allocate one-dimensional arrays for the computation of the |
---|
| 371 | !-- leaf area density (lad) profile |
---|
| 372 | ALLOCATE( lad(0:nz+1), pre_lad(0:nz+1) ) |
---|
| 373 | lad = 0.0_wp |
---|
| 374 | pre_lad = 0.0_wp |
---|
| 375 | |
---|
| 376 | ! |
---|
[1826] | 377 | !-- Set flag that indicates that the lad-profile shall be calculated by using |
---|
| 378 | !-- a beta probability density function |
---|
| 379 | IF ( alpha_lad /= 9999999.9_wp .AND. beta_lad /= 9999999.9_wp ) THEN |
---|
| 380 | calc_beta_lad_profile = .TRUE. |
---|
| 381 | ENDIF |
---|
| 382 | |
---|
| 383 | |
---|
| 384 | ! |
---|
[1484] | 385 | !-- Compute the profile of leaf area density used in the plant |
---|
| 386 | !-- canopy model. The profile can either be constructed from |
---|
| 387 | !-- prescribed vertical gradients of the leaf area density or by |
---|
| 388 | !-- using a beta probability density function (see e.g. Markkanen et al., |
---|
| 389 | !-- 2003: Boundary-Layer Meteorology, 106, 437-459) |
---|
| 390 | IF ( .NOT. calc_beta_lad_profile ) THEN |
---|
| 391 | |
---|
| 392 | ! |
---|
| 393 | !-- Use vertical gradients for lad-profile construction |
---|
| 394 | i = 1 |
---|
| 395 | gradient = 0.0_wp |
---|
| 396 | |
---|
| 397 | IF ( .NOT. ocean ) THEN |
---|
| 398 | |
---|
| 399 | lad(0) = lad_surface |
---|
| 400 | lad_vertical_gradient_level_ind(1) = 0 |
---|
| 401 | |
---|
| 402 | DO k = 1, pch_index |
---|
| 403 | IF ( i < 11 ) THEN |
---|
| 404 | IF ( lad_vertical_gradient_level(i) < zu(k) .AND. & |
---|
| 405 | lad_vertical_gradient_level(i) >= 0.0_wp ) THEN |
---|
| 406 | gradient = lad_vertical_gradient(i) |
---|
| 407 | lad_vertical_gradient_level_ind(i) = k - 1 |
---|
| 408 | i = i + 1 |
---|
| 409 | ENDIF |
---|
| 410 | ENDIF |
---|
| 411 | IF ( gradient /= 0.0_wp ) THEN |
---|
| 412 | IF ( k /= 1 ) THEN |
---|
| 413 | lad(k) = lad(k-1) + dzu(k) * gradient |
---|
| 414 | ELSE |
---|
| 415 | lad(k) = lad_surface + dzu(k) * gradient |
---|
| 416 | ENDIF |
---|
| 417 | ELSE |
---|
| 418 | lad(k) = lad(k-1) |
---|
| 419 | ENDIF |
---|
| 420 | ENDDO |
---|
| 421 | |
---|
| 422 | ENDIF |
---|
| 423 | |
---|
| 424 | ! |
---|
| 425 | !-- In case of no given leaf area density gradients, choose a vanishing |
---|
| 426 | !-- gradient. This information is used for the HEADER and the RUN_CONTROL |
---|
| 427 | !-- file. |
---|
| 428 | IF ( lad_vertical_gradient_level(1) == -9999999.9_wp ) THEN |
---|
| 429 | lad_vertical_gradient_level(1) = 0.0_wp |
---|
| 430 | ENDIF |
---|
| 431 | |
---|
| 432 | ELSE |
---|
| 433 | |
---|
| 434 | ! |
---|
| 435 | !-- Use beta function for lad-profile construction |
---|
| 436 | int_bpdf = 0.0_wp |
---|
| 437 | canopy_height = pch_index * dz |
---|
| 438 | |
---|
| 439 | DO k = nzb, pch_index |
---|
| 440 | int_bpdf = int_bpdf + & |
---|
[1826] | 441 | ( ( ( zw(k) / canopy_height )**( alpha_lad-1.0_wp ) ) * & |
---|
| 442 | ( ( 1.0_wp - ( zw(k) / canopy_height ) )**( & |
---|
| 443 | beta_lad-1.0_wp ) ) & |
---|
| 444 | * ( ( zw(k+1)-zw(k) ) / canopy_height ) ) |
---|
[1484] | 445 | ENDDO |
---|
| 446 | |
---|
| 447 | ! |
---|
| 448 | !-- Preliminary lad profile (defined on w-grid) |
---|
| 449 | DO k = nzb, pch_index |
---|
[1826] | 450 | pre_lad(k) = lai_beta * & |
---|
| 451 | ( ( ( zw(k) / canopy_height )**( alpha_lad-1.0_wp ) ) & |
---|
| 452 | * ( ( 1.0_wp - ( zw(k) / canopy_height ) )**( & |
---|
| 453 | beta_lad-1.0_wp ) ) / int_bpdf & |
---|
| 454 | ) / canopy_height |
---|
[1484] | 455 | ENDDO |
---|
| 456 | |
---|
| 457 | ! |
---|
| 458 | !-- Final lad profile (defined on scalar-grid level, since most prognostic |
---|
| 459 | !-- quantities are defined there, hence, less interpolation is required |
---|
| 460 | !-- when calculating the canopy tendencies) |
---|
| 461 | lad(0) = pre_lad(0) |
---|
| 462 | DO k = nzb+1, pch_index |
---|
| 463 | lad(k) = 0.5 * ( pre_lad(k-1) + pre_lad(k) ) |
---|
| 464 | ENDDO |
---|
| 465 | |
---|
| 466 | ENDIF |
---|
| 467 | |
---|
| 468 | ! |
---|
| 469 | !-- Allocate 3D-array for the leaf area density (lad_s). In case of a |
---|
| 470 | !-- prescribed canopy-top heat flux (cthf), allocate 3D-arrays for |
---|
| 471 | !-- the cumulative leaf area index (cum_lai_hf) and the canopy heat flux. |
---|
| 472 | ALLOCATE( lad_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 473 | |
---|
| 474 | IF ( cthf /= 0.0_wp ) THEN |
---|
| 475 | ALLOCATE( cum_lai_hf(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 476 | canopy_heat_flux(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 477 | ENDIF |
---|
| 478 | |
---|
| 479 | ! |
---|
| 480 | !-- Initialize canopy parameters cdc (canopy drag coefficient), |
---|
| 481 | !-- lsec (leaf scalar exchange coefficient), lsc (leaf surface concentration) |
---|
| 482 | !-- with the prescribed values |
---|
| 483 | cdc = canopy_drag_coeff |
---|
| 484 | lsec = leaf_scalar_exch_coeff |
---|
| 485 | lsc = leaf_surface_conc |
---|
| 486 | |
---|
| 487 | ! |
---|
| 488 | !-- Initialization of the canopy coverage in the model domain: |
---|
| 489 | !-- Setting the parameter canopy_mode = 'block' initializes a canopy, which |
---|
| 490 | !-- fully covers the domain surface |
---|
| 491 | SELECT CASE ( TRIM( canopy_mode ) ) |
---|
| 492 | |
---|
| 493 | CASE( 'block' ) |
---|
| 494 | |
---|
| 495 | DO i = nxlg, nxrg |
---|
| 496 | DO j = nysg, nyng |
---|
| 497 | lad_s(:,j,i) = lad(:) |
---|
| 498 | ENDDO |
---|
| 499 | ENDDO |
---|
| 500 | |
---|
| 501 | CASE DEFAULT |
---|
| 502 | |
---|
| 503 | ! |
---|
| 504 | !-- The DEFAULT case is reached either if the parameter |
---|
| 505 | !-- canopy mode contains a wrong character string or if the |
---|
| 506 | !-- user has coded a special case in the user interface. |
---|
| 507 | !-- There, the subroutine user_init_plant_canopy checks |
---|
| 508 | !-- which of these two conditions applies. |
---|
| 509 | CALL user_init_plant_canopy |
---|
| 510 | |
---|
| 511 | END SELECT |
---|
| 512 | |
---|
| 513 | ! |
---|
| 514 | !-- Initialization of the canopy heat source distribution |
---|
| 515 | IF ( cthf /= 0.0_wp ) THEN |
---|
| 516 | ! |
---|
| 517 | !-- Piecewise calculation of the leaf area index by vertical |
---|
| 518 | !-- integration of the leaf area density |
---|
| 519 | cum_lai_hf(:,:,:) = 0.0_wp |
---|
| 520 | DO i = nxlg, nxrg |
---|
| 521 | DO j = nysg, nyng |
---|
| 522 | DO k = pch_index-1, 0, -1 |
---|
| 523 | IF ( k == pch_index-1 ) THEN |
---|
| 524 | cum_lai_hf(k,j,i) = cum_lai_hf(k+1,j,i) + & |
---|
| 525 | ( 0.5_wp * lad_s(k+1,j,i) * & |
---|
| 526 | ( zw(k+1) - zu(k+1) ) ) + & |
---|
| 527 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+1,j,i) + & |
---|
| 528 | lad_s(k,j,i) ) + & |
---|
| 529 | lad_s(k+1,j,i) ) * & |
---|
| 530 | ( zu(k+1) - zw(k) ) ) |
---|
| 531 | ELSE |
---|
| 532 | cum_lai_hf(k,j,i) = cum_lai_hf(k+1,j,i) + & |
---|
| 533 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+2,j,i) + & |
---|
| 534 | lad_s(k+1,j,i) ) + & |
---|
| 535 | lad_s(k+1,j,i) ) * & |
---|
| 536 | ( zw(k+1) - zu(k+1) ) ) + & |
---|
| 537 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+1,j,i) + & |
---|
| 538 | lad_s(k,j,i) ) + & |
---|
| 539 | lad_s(k+1,j,i) ) * & |
---|
| 540 | ( zu(k+1) - zw(k) ) ) |
---|
| 541 | ENDIF |
---|
| 542 | ENDDO |
---|
| 543 | ENDDO |
---|
| 544 | ENDDO |
---|
| 545 | |
---|
| 546 | ! |
---|
| 547 | !-- Calculation of the upward kinematic vertical heat flux within the |
---|
| 548 | !-- canopy |
---|
| 549 | DO i = nxlg, nxrg |
---|
| 550 | DO j = nysg, nyng |
---|
| 551 | DO k = 0, pch_index |
---|
| 552 | canopy_heat_flux(k,j,i) = cthf * & |
---|
| 553 | exp( -0.6_wp * cum_lai_hf(k,j,i) ) |
---|
| 554 | ENDDO |
---|
| 555 | ENDDO |
---|
| 556 | ENDDO |
---|
| 557 | |
---|
| 558 | ! |
---|
[1721] | 559 | !-- In areas covered with canopy, the surface heat flux is set to |
---|
| 560 | !-- the surface value of the above calculated in-canopy heat flux |
---|
| 561 | !-- distribution |
---|
| 562 | DO i = nxlg,nxrg |
---|
| 563 | DO j = nysg, nyng |
---|
| 564 | IF ( canopy_heat_flux(0,j,i) /= cthf ) THEN |
---|
| 565 | shf(j,i) = canopy_heat_flux(0,j,i) |
---|
| 566 | ENDIF |
---|
| 567 | ENDDO |
---|
| 568 | ENDDO |
---|
[1484] | 569 | |
---|
| 570 | ENDIF |
---|
| 571 | |
---|
| 572 | |
---|
| 573 | |
---|
[1826] | 574 | END SUBROUTINE pcm_init |
---|
[1484] | 575 | |
---|
| 576 | |
---|
| 577 | |
---|
| 578 | !------------------------------------------------------------------------------! |
---|
| 579 | ! Description: |
---|
| 580 | ! ------------ |
---|
[1682] | 581 | !> Calculation of the tendency terms, accounting for the effect of the plant |
---|
| 582 | !> canopy on momentum and scalar quantities. |
---|
| 583 | !> |
---|
| 584 | !> The canopy is located where the leaf area density lad_s(k,j,i) > 0.0 |
---|
[1826] | 585 | !> (defined on scalar grid), as initialized in subroutine pcm_init. |
---|
[1682] | 586 | !> The lad on the w-grid is vertically interpolated from the surrounding |
---|
| 587 | !> lad_s. The upper boundary of the canopy is defined on the w-grid at |
---|
| 588 | !> k = pch_index. Here, the lad is zero. |
---|
| 589 | !> |
---|
| 590 | !> The canopy drag must be limited (previously accounted for by calculation of |
---|
| 591 | !> a limiting canopy timestep for the determination of the maximum LES timestep |
---|
| 592 | !> in subroutine timestep), since it is physically impossible that the canopy |
---|
| 593 | !> drag alone can locally change the sign of a velocity component. This |
---|
| 594 | !> limitation is realized by calculating preliminary tendencies and velocities. |
---|
| 595 | !> It is subsequently checked if the preliminary new velocity has a different |
---|
| 596 | !> sign than the current velocity. If so, the tendency is limited in a way that |
---|
| 597 | !> the velocity can at maximum be reduced to zero by the canopy drag. |
---|
| 598 | !> |
---|
| 599 | !> |
---|
| 600 | !> Call for all grid points |
---|
[1484] | 601 | !------------------------------------------------------------------------------! |
---|
[1826] | 602 | SUBROUTINE pcm_tendency( component ) |
---|
[138] | 603 | |
---|
| 604 | |
---|
[1320] | 605 | USE control_parameters, & |
---|
[1484] | 606 | ONLY: dt_3d, message_string |
---|
[1320] | 607 | |
---|
| 608 | USE kinds |
---|
| 609 | |
---|
[138] | 610 | IMPLICIT NONE |
---|
| 611 | |
---|
[1682] | 612 | INTEGER(iwp) :: component !< prognostic variable (u,v,w,pt,q,e) |
---|
| 613 | INTEGER(iwp) :: i !< running index |
---|
| 614 | INTEGER(iwp) :: j !< running index |
---|
| 615 | INTEGER(iwp) :: k !< running index |
---|
[1721] | 616 | INTEGER(iwp) :: kk !< running index for flat lad arrays |
---|
[1484] | 617 | |
---|
[1682] | 618 | REAL(wp) :: ddt_3d !< inverse of the LES timestep (dt_3d) |
---|
| 619 | REAL(wp) :: lad_local !< local lad value |
---|
| 620 | REAL(wp) :: pre_tend !< preliminary tendency |
---|
| 621 | REAL(wp) :: pre_u !< preliminary u-value |
---|
| 622 | REAL(wp) :: pre_v !< preliminary v-value |
---|
| 623 | REAL(wp) :: pre_w !< preliminary w-value |
---|
[1484] | 624 | |
---|
| 625 | |
---|
| 626 | ddt_3d = 1.0_wp / dt_3d |
---|
[138] | 627 | |
---|
| 628 | ! |
---|
[1484] | 629 | !-- Compute drag for the three velocity components and the SGS-TKE: |
---|
[138] | 630 | SELECT CASE ( component ) |
---|
| 631 | |
---|
| 632 | ! |
---|
| 633 | !-- u-component |
---|
| 634 | CASE ( 1 ) |
---|
| 635 | DO i = nxlu, nxr |
---|
| 636 | DO j = nys, nyn |
---|
[1721] | 637 | DO k = nzb_u_inner(j,i)+1, nzb_u_inner(j,i)+pch_index |
---|
[1484] | 638 | |
---|
[1721] | 639 | kk = k - nzb_u_inner(j,i) !- lad arrays are defined flat |
---|
[1484] | 640 | ! |
---|
| 641 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 642 | !-- the lad on the u-grid at index (k,j,i) is equal to |
---|
| 643 | !-- lad_s(k,j,i), rather than being interpolated from the |
---|
| 644 | !-- surrounding lad_s, because this would yield smaller lad |
---|
| 645 | !-- at the canopy boundaries than inside of the canopy. |
---|
| 646 | !-- For the same reason, the lad at the rightmost(i+1)canopy |
---|
| 647 | !-- boundary on the u-grid equals lad_s(k,j,i). |
---|
[1721] | 648 | lad_local = lad_s(kk,j,i) |
---|
| 649 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j,i-1) > 0.0_wp )& |
---|
| 650 | THEN |
---|
| 651 | lad_local = lad_s(kk,j,i-1) |
---|
[1484] | 652 | ENDIF |
---|
| 653 | |
---|
| 654 | pre_tend = 0.0_wp |
---|
| 655 | pre_u = 0.0_wp |
---|
| 656 | ! |
---|
| 657 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 658 | pre_tend = - cdc * & |
---|
| 659 | lad_local * & |
---|
| 660 | SQRT( u(k,j,i)**2 + & |
---|
| 661 | ( 0.25_wp * ( v(k,j,i-1) + & |
---|
| 662 | v(k,j,i) + & |
---|
| 663 | v(k,j+1,i) + & |
---|
| 664 | v(k,j+1,i-1) ) & |
---|
| 665 | )**2 + & |
---|
| 666 | ( 0.25_wp * ( w(k-1,j,i-1) + & |
---|
| 667 | w(k-1,j,i) + & |
---|
| 668 | w(k,j,i-1) + & |
---|
| 669 | w(k,j,i) ) & |
---|
| 670 | )**2 & |
---|
| 671 | ) * & |
---|
| 672 | u(k,j,i) |
---|
| 673 | |
---|
| 674 | ! |
---|
| 675 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 676 | pre_u = u(k,j,i) + dt_3d * pre_tend |
---|
| 677 | ! |
---|
| 678 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 679 | !-- and in case the signs are different, limit the tendency |
---|
| 680 | IF ( SIGN(pre_u,u(k,j,i)) /= pre_u ) THEN |
---|
| 681 | pre_tend = - u(k,j,i) * ddt_3d |
---|
| 682 | ELSE |
---|
| 683 | pre_tend = pre_tend |
---|
| 684 | ENDIF |
---|
| 685 | ! |
---|
| 686 | !-- Calculate final tendency |
---|
| 687 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 688 | |
---|
[138] | 689 | ENDDO |
---|
| 690 | ENDDO |
---|
| 691 | ENDDO |
---|
| 692 | |
---|
| 693 | ! |
---|
| 694 | !-- v-component |
---|
| 695 | CASE ( 2 ) |
---|
| 696 | DO i = nxl, nxr |
---|
| 697 | DO j = nysv, nyn |
---|
[1721] | 698 | DO k = nzb_v_inner(j,i)+1, nzb_v_inner(j,i)+pch_index |
---|
[1484] | 699 | |
---|
[1721] | 700 | kk = k - nzb_v_inner(j,i) !- lad arrays are defined flat |
---|
[1484] | 701 | ! |
---|
| 702 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 703 | !-- the lad on the v-grid at index (k,j,i) is equal to |
---|
| 704 | !-- lad_s(k,j,i), rather than being interpolated from the |
---|
| 705 | !-- surrounding lad_s, because this would yield smaller lad |
---|
| 706 | !-- at the canopy boundaries than inside of the canopy. |
---|
| 707 | !-- For the same reason, the lad at the northmost(j+1) canopy |
---|
| 708 | !-- boundary on the v-grid equals lad_s(k,j,i). |
---|
[1721] | 709 | lad_local = lad_s(kk,j,i) |
---|
| 710 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j-1,i) > 0.0_wp )& |
---|
| 711 | THEN |
---|
| 712 | lad_local = lad_s(kk,j-1,i) |
---|
[1484] | 713 | ENDIF |
---|
| 714 | |
---|
| 715 | pre_tend = 0.0_wp |
---|
| 716 | pre_v = 0.0_wp |
---|
| 717 | ! |
---|
| 718 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 719 | pre_tend = - cdc * & |
---|
| 720 | lad_local * & |
---|
| 721 | SQRT( ( 0.25_wp * ( u(k,j-1,i) + & |
---|
| 722 | u(k,j-1,i+1) + & |
---|
| 723 | u(k,j,i) + & |
---|
| 724 | u(k,j,i+1) ) & |
---|
| 725 | )**2 + & |
---|
| 726 | v(k,j,i)**2 + & |
---|
| 727 | ( 0.25_wp * ( w(k-1,j-1,i) + & |
---|
| 728 | w(k-1,j,i) + & |
---|
| 729 | w(k,j-1,i) + & |
---|
| 730 | w(k,j,i) ) & |
---|
| 731 | )**2 & |
---|
| 732 | ) * & |
---|
| 733 | v(k,j,i) |
---|
| 734 | |
---|
| 735 | ! |
---|
| 736 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 737 | pre_v = v(k,j,i) + dt_3d * pre_tend |
---|
| 738 | ! |
---|
| 739 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 740 | !-- and in case the signs are different, limit the tendency |
---|
| 741 | IF ( SIGN(pre_v,v(k,j,i)) /= pre_v ) THEN |
---|
| 742 | pre_tend = - v(k,j,i) * ddt_3d |
---|
| 743 | ELSE |
---|
| 744 | pre_tend = pre_tend |
---|
| 745 | ENDIF |
---|
| 746 | ! |
---|
| 747 | !-- Calculate final tendency |
---|
| 748 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 749 | |
---|
[138] | 750 | ENDDO |
---|
| 751 | ENDDO |
---|
| 752 | ENDDO |
---|
| 753 | |
---|
| 754 | ! |
---|
| 755 | !-- w-component |
---|
| 756 | CASE ( 3 ) |
---|
| 757 | DO i = nxl, nxr |
---|
| 758 | DO j = nys, nyn |
---|
[1721] | 759 | DO k = nzb_w_inner(j,i)+1, nzb_w_inner(j,i)+pch_index-1 |
---|
[1484] | 760 | |
---|
[1721] | 761 | kk = k - nzb_w_inner(j,i) !- lad arrays are defined flat |
---|
| 762 | |
---|
[1484] | 763 | pre_tend = 0.0_wp |
---|
| 764 | pre_w = 0.0_wp |
---|
| 765 | ! |
---|
| 766 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 767 | pre_tend = - cdc * & |
---|
| 768 | (0.5_wp * & |
---|
[1721] | 769 | ( lad_s(kk+1,j,i) + lad_s(kk,j,i) )) * & |
---|
[1484] | 770 | SQRT( ( 0.25_wp * ( u(k,j,i) + & |
---|
| 771 | u(k,j,i+1) + & |
---|
| 772 | u(k+1,j,i) + & |
---|
| 773 | u(k+1,j,i+1) ) & |
---|
| 774 | )**2 + & |
---|
| 775 | ( 0.25_wp * ( v(k,j,i) + & |
---|
| 776 | v(k,j+1,i) + & |
---|
| 777 | v(k+1,j,i) + & |
---|
| 778 | v(k+1,j+1,i) ) & |
---|
| 779 | )**2 + & |
---|
| 780 | w(k,j,i)**2 & |
---|
| 781 | ) * & |
---|
| 782 | w(k,j,i) |
---|
| 783 | ! |
---|
| 784 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 785 | pre_w = w(k,j,i) + dt_3d * pre_tend |
---|
| 786 | ! |
---|
| 787 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 788 | !-- and in case the signs are different, limit the tendency |
---|
| 789 | IF ( SIGN(pre_w,w(k,j,i)) /= pre_w ) THEN |
---|
| 790 | pre_tend = - w(k,j,i) * ddt_3d |
---|
| 791 | ELSE |
---|
| 792 | pre_tend = pre_tend |
---|
| 793 | ENDIF |
---|
| 794 | ! |
---|
| 795 | !-- Calculate final tendency |
---|
| 796 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 797 | |
---|
[138] | 798 | ENDDO |
---|
| 799 | ENDDO |
---|
| 800 | ENDDO |
---|
| 801 | |
---|
| 802 | ! |
---|
[153] | 803 | !-- potential temperature |
---|
[138] | 804 | CASE ( 4 ) |
---|
| 805 | DO i = nxl, nxr |
---|
| 806 | DO j = nys, nyn |
---|
[1721] | 807 | DO k = nzb_s_inner(j,i)+1, nzb_s_inner(j,i)+pch_index |
---|
| 808 | kk = k - nzb_s_inner(j,i) !- lad arrays are defined flat |
---|
[1484] | 809 | tend(k,j,i) = tend(k,j,i) + & |
---|
[1721] | 810 | ( canopy_heat_flux(kk,j,i) - & |
---|
| 811 | canopy_heat_flux(kk-1,j,i) ) / dzw(k) |
---|
[153] | 812 | ENDDO |
---|
| 813 | ENDDO |
---|
| 814 | ENDDO |
---|
| 815 | |
---|
| 816 | ! |
---|
| 817 | !-- scalar concentration |
---|
| 818 | CASE ( 5 ) |
---|
| 819 | DO i = nxl, nxr |
---|
| 820 | DO j = nys, nyn |
---|
[1721] | 821 | DO k = nzb_s_inner(j,i)+1, nzb_s_inner(j,i)+pch_index |
---|
| 822 | kk = k - nzb_s_inner(j,i) !- lad arrays are defined flat |
---|
[1484] | 823 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 824 | lsec * & |
---|
[1721] | 825 | lad_s(kk,j,i) * & |
---|
[1484] | 826 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 827 | u(k,j,i+1) ) & |
---|
| 828 | )**2 + & |
---|
| 829 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 830 | v(k,j+1,i) ) & |
---|
| 831 | )**2 + & |
---|
| 832 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 833 | w(k,j,i) ) & |
---|
| 834 | )**2 & |
---|
| 835 | ) * & |
---|
| 836 | ( q(k,j,i) - lsc ) |
---|
[153] | 837 | ENDDO |
---|
| 838 | ENDDO |
---|
| 839 | ENDDO |
---|
| 840 | |
---|
| 841 | ! |
---|
| 842 | !-- sgs-tke |
---|
| 843 | CASE ( 6 ) |
---|
| 844 | DO i = nxl, nxr |
---|
| 845 | DO j = nys, nyn |
---|
[1721] | 846 | DO k = nzb_s_inner(j,i)+1, nzb_s_inner(j,i)+pch_index |
---|
| 847 | kk = k - nzb_s_inner(j,i) !- lad arrays are defined flat |
---|
[1484] | 848 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 849 | 2.0_wp * cdc * & |
---|
[1721] | 850 | lad_s(kk,j,i) * & |
---|
[1484] | 851 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 852 | u(k,j,i+1) ) & |
---|
| 853 | )**2 + & |
---|
| 854 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 855 | v(k,j+1,i) ) & |
---|
| 856 | )**2 + & |
---|
| 857 | ( 0.5_wp * ( w(k,j,i) + & |
---|
| 858 | w(k+1,j,i) ) & |
---|
| 859 | )**2 & |
---|
| 860 | ) * & |
---|
| 861 | e(k,j,i) |
---|
[138] | 862 | ENDDO |
---|
| 863 | ENDDO |
---|
| 864 | ENDDO |
---|
[1484] | 865 | |
---|
| 866 | |
---|
[138] | 867 | CASE DEFAULT |
---|
| 868 | |
---|
[257] | 869 | WRITE( message_string, * ) 'wrong component: ', component |
---|
[1826] | 870 | CALL message( 'pcm_tendency', 'PA0279', 1, 2, 0, 6, 0 ) |
---|
[138] | 871 | |
---|
| 872 | END SELECT |
---|
| 873 | |
---|
[1826] | 874 | END SUBROUTINE pcm_tendency |
---|
[138] | 875 | |
---|
| 876 | |
---|
| 877 | !------------------------------------------------------------------------------! |
---|
[1484] | 878 | ! Description: |
---|
| 879 | ! ------------ |
---|
[1826] | 880 | !> Parin for &canopy_par for plant canopy model |
---|
| 881 | !------------------------------------------------------------------------------! |
---|
| 882 | SUBROUTINE pcm_parin |
---|
| 883 | |
---|
| 884 | |
---|
| 885 | IMPLICIT NONE |
---|
| 886 | |
---|
| 887 | CHARACTER (LEN=80) :: line !< dummy string that contains the current line of the parameter file |
---|
| 888 | |
---|
| 889 | NAMELIST /canopy_par/ alpha_lad, beta_lad, canopy_drag_coeff, & |
---|
| 890 | canopy_mode, cthf, & |
---|
| 891 | lad_surface, & |
---|
| 892 | lad_vertical_gradient, & |
---|
| 893 | lad_vertical_gradient_level, & |
---|
| 894 | lai_beta, & |
---|
| 895 | leaf_scalar_exch_coeff, & |
---|
| 896 | leaf_surface_conc, pch_index |
---|
| 897 | |
---|
| 898 | line = ' ' |
---|
| 899 | |
---|
| 900 | ! |
---|
| 901 | !-- Try to find radiation model package |
---|
| 902 | REWIND ( 11 ) |
---|
| 903 | line = ' ' |
---|
| 904 | DO WHILE ( INDEX( line, '&canopy_par' ) == 0 ) |
---|
| 905 | READ ( 11, '(A)', END=10 ) line |
---|
| 906 | ENDDO |
---|
| 907 | BACKSPACE ( 11 ) |
---|
| 908 | |
---|
| 909 | ! |
---|
| 910 | !-- Read user-defined namelist |
---|
| 911 | READ ( 11, canopy_par ) |
---|
| 912 | |
---|
| 913 | ! |
---|
| 914 | !-- Set flag that indicates that the radiation model is switched on |
---|
| 915 | plant_canopy = .TRUE. |
---|
| 916 | |
---|
| 917 | 10 CONTINUE |
---|
| 918 | |
---|
| 919 | |
---|
| 920 | END SUBROUTINE pcm_parin |
---|
| 921 | |
---|
| 922 | |
---|
| 923 | |
---|
| 924 | !------------------------------------------------------------------------------! |
---|
| 925 | ! Description: |
---|
| 926 | ! ------------ |
---|
[1682] | 927 | !> Calculation of the tendency terms, accounting for the effect of the plant |
---|
| 928 | !> canopy on momentum and scalar quantities. |
---|
| 929 | !> |
---|
| 930 | !> The canopy is located where the leaf area density lad_s(k,j,i) > 0.0 |
---|
[1826] | 931 | !> (defined on scalar grid), as initialized in subroutine pcm_init. |
---|
[1682] | 932 | !> The lad on the w-grid is vertically interpolated from the surrounding |
---|
| 933 | !> lad_s. The upper boundary of the canopy is defined on the w-grid at |
---|
| 934 | !> k = pch_index. Here, the lad is zero. |
---|
| 935 | !> |
---|
| 936 | !> The canopy drag must be limited (previously accounted for by calculation of |
---|
| 937 | !> a limiting canopy timestep for the determination of the maximum LES timestep |
---|
| 938 | !> in subroutine timestep), since it is physically impossible that the canopy |
---|
| 939 | !> drag alone can locally change the sign of a velocity component. This |
---|
| 940 | !> limitation is realized by calculating preliminary tendencies and velocities. |
---|
| 941 | !> It is subsequently checked if the preliminary new velocity has a different |
---|
| 942 | !> sign than the current velocity. If so, the tendency is limited in a way that |
---|
| 943 | !> the velocity can at maximum be reduced to zero by the canopy drag. |
---|
| 944 | !> |
---|
| 945 | !> |
---|
| 946 | !> Call for grid point i,j |
---|
[138] | 947 | !------------------------------------------------------------------------------! |
---|
[1826] | 948 | SUBROUTINE pcm_tendency_ij( i, j, component ) |
---|
[138] | 949 | |
---|
| 950 | |
---|
[1320] | 951 | USE control_parameters, & |
---|
[1484] | 952 | ONLY: dt_3d, message_string |
---|
[1320] | 953 | |
---|
| 954 | USE kinds |
---|
| 955 | |
---|
[138] | 956 | IMPLICIT NONE |
---|
| 957 | |
---|
[1682] | 958 | INTEGER(iwp) :: component !< prognostic variable (u,v,w,pt,q,e) |
---|
| 959 | INTEGER(iwp) :: i !< running index |
---|
| 960 | INTEGER(iwp) :: j !< running index |
---|
| 961 | INTEGER(iwp) :: k !< running index |
---|
[1721] | 962 | INTEGER(iwp) :: kk !< running index for flat lad arrays |
---|
[138] | 963 | |
---|
[1682] | 964 | REAL(wp) :: ddt_3d !< inverse of the LES timestep (dt_3d) |
---|
| 965 | REAL(wp) :: lad_local !< local lad value |
---|
| 966 | REAL(wp) :: pre_tend !< preliminary tendency |
---|
| 967 | REAL(wp) :: pre_u !< preliminary u-value |
---|
| 968 | REAL(wp) :: pre_v !< preliminary v-value |
---|
| 969 | REAL(wp) :: pre_w !< preliminary w-value |
---|
[1484] | 970 | |
---|
| 971 | |
---|
| 972 | ddt_3d = 1.0_wp / dt_3d |
---|
| 973 | |
---|
[138] | 974 | ! |
---|
[1484] | 975 | !-- Compute drag for the three velocity components and the SGS-TKE |
---|
[142] | 976 | SELECT CASE ( component ) |
---|
[138] | 977 | |
---|
| 978 | ! |
---|
[142] | 979 | !-- u-component |
---|
[1484] | 980 | CASE ( 1 ) |
---|
[1721] | 981 | DO k = nzb_u_inner(j,i)+1, nzb_u_inner(j,i)+pch_index |
---|
[138] | 982 | |
---|
[1721] | 983 | kk = k - nzb_u_inner(j,i) !- lad arrays are defined flat |
---|
[138] | 984 | ! |
---|
[1484] | 985 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 986 | !-- the lad on the u-grid at index (k,j,i) is equal to lad_s(k,j,i), |
---|
| 987 | !-- rather than being interpolated from the surrounding lad_s, |
---|
| 988 | !-- because this would yield smaller lad at the canopy boundaries |
---|
| 989 | !-- than inside of the canopy. |
---|
| 990 | !-- For the same reason, the lad at the rightmost(i+1)canopy |
---|
| 991 | !-- boundary on the u-grid equals lad_s(k,j,i). |
---|
[1721] | 992 | lad_local = lad_s(kk,j,i) |
---|
| 993 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j,i-1) > 0.0_wp ) THEN |
---|
| 994 | lad_local = lad_s(kk,j,i-1) |
---|
[1484] | 995 | ENDIF |
---|
| 996 | |
---|
| 997 | pre_tend = 0.0_wp |
---|
| 998 | pre_u = 0.0_wp |
---|
| 999 | ! |
---|
| 1000 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1001 | pre_tend = - cdc * & |
---|
| 1002 | lad_local * & |
---|
| 1003 | SQRT( u(k,j,i)**2 + & |
---|
| 1004 | ( 0.25_wp * ( v(k,j,i-1) + & |
---|
| 1005 | v(k,j,i) + & |
---|
| 1006 | v(k,j+1,i) + & |
---|
| 1007 | v(k,j+1,i-1) ) & |
---|
| 1008 | )**2 + & |
---|
| 1009 | ( 0.25_wp * ( w(k-1,j,i-1) + & |
---|
| 1010 | w(k-1,j,i) + & |
---|
| 1011 | w(k,j,i-1) + & |
---|
| 1012 | w(k,j,i) ) & |
---|
| 1013 | )**2 & |
---|
| 1014 | ) * & |
---|
| 1015 | u(k,j,i) |
---|
| 1016 | |
---|
| 1017 | ! |
---|
| 1018 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1019 | pre_u = u(k,j,i) + dt_3d * pre_tend |
---|
| 1020 | ! |
---|
| 1021 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1022 | !-- and in case the signs are different, limit the tendency |
---|
| 1023 | IF ( SIGN(pre_u,u(k,j,i)) /= pre_u ) THEN |
---|
| 1024 | pre_tend = - u(k,j,i) * ddt_3d |
---|
| 1025 | ELSE |
---|
| 1026 | pre_tend = pre_tend |
---|
| 1027 | ENDIF |
---|
| 1028 | ! |
---|
| 1029 | !-- Calculate final tendency |
---|
| 1030 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1031 | ENDDO |
---|
| 1032 | |
---|
| 1033 | |
---|
| 1034 | ! |
---|
[142] | 1035 | !-- v-component |
---|
[1484] | 1036 | CASE ( 2 ) |
---|
[1721] | 1037 | DO k = nzb_v_inner(j,i)+1, nzb_v_inner(j,i)+pch_index |
---|
[138] | 1038 | |
---|
[1721] | 1039 | kk = k - nzb_v_inner(j,i) !- lad arrays are defined flat |
---|
[138] | 1040 | ! |
---|
[1484] | 1041 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 1042 | !-- the lad on the v-grid at index (k,j,i) is equal to lad_s(k,j,i), |
---|
| 1043 | !-- rather than being interpolated from the surrounding lad_s, |
---|
| 1044 | !-- because this would yield smaller lad at the canopy boundaries |
---|
| 1045 | !-- than inside of the canopy. |
---|
| 1046 | !-- For the same reason, the lad at the northmost(j+1)canopy |
---|
| 1047 | !-- boundary on the v-grid equals lad_s(k,j,i). |
---|
[1721] | 1048 | lad_local = lad_s(kk,j,i) |
---|
| 1049 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j-1,i) > 0.0_wp ) THEN |
---|
| 1050 | lad_local = lad_s(kk,j-1,i) |
---|
[1484] | 1051 | ENDIF |
---|
| 1052 | |
---|
| 1053 | pre_tend = 0.0_wp |
---|
| 1054 | pre_v = 0.0_wp |
---|
| 1055 | ! |
---|
| 1056 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1057 | pre_tend = - cdc * & |
---|
| 1058 | lad_local * & |
---|
| 1059 | SQRT( ( 0.25_wp * ( u(k,j-1,i) + & |
---|
| 1060 | u(k,j-1,i+1) + & |
---|
| 1061 | u(k,j,i) + & |
---|
| 1062 | u(k,j,i+1) ) & |
---|
| 1063 | )**2 + & |
---|
| 1064 | v(k,j,i)**2 + & |
---|
| 1065 | ( 0.25_wp * ( w(k-1,j-1,i) + & |
---|
| 1066 | w(k-1,j,i) + & |
---|
| 1067 | w(k,j-1,i) + & |
---|
| 1068 | w(k,j,i) ) & |
---|
| 1069 | )**2 & |
---|
| 1070 | ) * & |
---|
| 1071 | v(k,j,i) |
---|
| 1072 | |
---|
| 1073 | ! |
---|
| 1074 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1075 | pre_v = v(k,j,i) + dt_3d * pre_tend |
---|
| 1076 | ! |
---|
| 1077 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1078 | !-- and in case the signs are different, limit the tendency |
---|
| 1079 | IF ( SIGN(pre_v,v(k,j,i)) /= pre_v ) THEN |
---|
| 1080 | pre_tend = - v(k,j,i) * ddt_3d |
---|
| 1081 | ELSE |
---|
| 1082 | pre_tend = pre_tend |
---|
| 1083 | ENDIF |
---|
| 1084 | ! |
---|
| 1085 | !-- Calculate final tendency |
---|
| 1086 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1087 | ENDDO |
---|
| 1088 | |
---|
| 1089 | |
---|
| 1090 | ! |
---|
[142] | 1091 | !-- w-component |
---|
[1484] | 1092 | CASE ( 3 ) |
---|
[1721] | 1093 | DO k = nzb_w_inner(j,i)+1, nzb_w_inner(j,i)+pch_index-1 |
---|
[138] | 1094 | |
---|
[1721] | 1095 | kk = k - nzb_w_inner(j,i) !- lad arrays are defined flat |
---|
| 1096 | |
---|
[1484] | 1097 | pre_tend = 0.0_wp |
---|
| 1098 | pre_w = 0.0_wp |
---|
[138] | 1099 | ! |
---|
[1484] | 1100 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1101 | pre_tend = - cdc * & |
---|
| 1102 | (0.5_wp * & |
---|
[1721] | 1103 | ( lad_s(kk+1,j,i) + lad_s(kk,j,i) )) * & |
---|
[1484] | 1104 | SQRT( ( 0.25_wp * ( u(k,j,i) + & |
---|
| 1105 | u(k,j,i+1) + & |
---|
| 1106 | u(k+1,j,i) + & |
---|
| 1107 | u(k+1,j,i+1) ) & |
---|
| 1108 | )**2 + & |
---|
| 1109 | ( 0.25_wp * ( v(k,j,i) + & |
---|
| 1110 | v(k,j+1,i) + & |
---|
| 1111 | v(k+1,j,i) + & |
---|
| 1112 | v(k+1,j+1,i) ) & |
---|
| 1113 | )**2 + & |
---|
| 1114 | w(k,j,i)**2 & |
---|
| 1115 | ) * & |
---|
| 1116 | w(k,j,i) |
---|
| 1117 | ! |
---|
| 1118 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1119 | pre_w = w(k,j,i) + dt_3d * pre_tend |
---|
| 1120 | ! |
---|
| 1121 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1122 | !-- and in case the signs are different, limit the tendency |
---|
| 1123 | IF ( SIGN(pre_w,w(k,j,i)) /= pre_w ) THEN |
---|
| 1124 | pre_tend = - w(k,j,i) * ddt_3d |
---|
| 1125 | ELSE |
---|
| 1126 | pre_tend = pre_tend |
---|
| 1127 | ENDIF |
---|
| 1128 | ! |
---|
| 1129 | !-- Calculate final tendency |
---|
| 1130 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1131 | ENDDO |
---|
| 1132 | |
---|
| 1133 | ! |
---|
[153] | 1134 | !-- potential temperature |
---|
| 1135 | CASE ( 4 ) |
---|
[1721] | 1136 | DO k = nzb_s_inner(j,i)+1, nzb_s_inner(j,i)+pch_index |
---|
| 1137 | kk = k - nzb_s_inner(j,i) !- lad arrays are defined flat |
---|
[1484] | 1138 | tend(k,j,i) = tend(k,j,i) + & |
---|
[1721] | 1139 | ( canopy_heat_flux(kk,j,i) - & |
---|
| 1140 | canopy_heat_flux(kk-1,j,i) ) / dzw(k) |
---|
[153] | 1141 | ENDDO |
---|
| 1142 | |
---|
| 1143 | |
---|
| 1144 | ! |
---|
| 1145 | !-- scalar concentration |
---|
| 1146 | CASE ( 5 ) |
---|
[1721] | 1147 | DO k = nzb_s_inner(j,i)+1, nzb_s_inner(j,i)+pch_index |
---|
| 1148 | kk = k - nzb_s_inner(j,i) !- lad arrays are defined flat |
---|
[1484] | 1149 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1150 | lsec * & |
---|
[1721] | 1151 | lad_s(kk,j,i) * & |
---|
[1484] | 1152 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1153 | u(k,j,i+1) ) & |
---|
| 1154 | )**2 + & |
---|
| 1155 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1156 | v(k,j+1,i) ) & |
---|
| 1157 | )**2 + & |
---|
| 1158 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 1159 | w(k,j,i) ) & |
---|
| 1160 | )**2 & |
---|
| 1161 | ) * & |
---|
| 1162 | ( q(k,j,i) - lsc ) |
---|
[153] | 1163 | ENDDO |
---|
| 1164 | |
---|
| 1165 | ! |
---|
[142] | 1166 | !-- sgs-tke |
---|
[1484] | 1167 | CASE ( 6 ) |
---|
[1721] | 1168 | DO k = nzb_s_inner(j,i)+1, nzb_s_inner(j,i)+pch_index |
---|
| 1169 | kk = k - nzb_s_inner(j,i) !- lad arrays are defined flat |
---|
[1484] | 1170 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1171 | 2.0_wp * cdc * & |
---|
[1721] | 1172 | lad_s(kk,j,i) * & |
---|
[1484] | 1173 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1174 | u(k,j,i+1) ) & |
---|
| 1175 | )**2 + & |
---|
| 1176 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1177 | v(k,j+1,i) ) & |
---|
| 1178 | )**2 + & |
---|
| 1179 | ( 0.5_wp * ( w(k,j,i) + & |
---|
| 1180 | w(k+1,j,i) ) & |
---|
| 1181 | )**2 & |
---|
| 1182 | ) * & |
---|
| 1183 | e(k,j,i) |
---|
| 1184 | ENDDO |
---|
[138] | 1185 | |
---|
[142] | 1186 | CASE DEFAULT |
---|
[138] | 1187 | |
---|
[257] | 1188 | WRITE( message_string, * ) 'wrong component: ', component |
---|
[1826] | 1189 | CALL message( 'pcm_tendency', 'PA0279', 1, 2, 0, 6, 0 ) |
---|
[138] | 1190 | |
---|
[142] | 1191 | END SELECT |
---|
[138] | 1192 | |
---|
[1826] | 1193 | END SUBROUTINE pcm_tendency_ij |
---|
[138] | 1194 | |
---|
| 1195 | END MODULE plant_canopy_model_mod |
---|