[1826] | 1 | !> @file plant_canopy_model_mod.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 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. |
---|
[1036] | 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[3655] | 17 | ! Copyright 1997-2019 Leibniz Universitaet Hannover |
---|
[3885] | 18 | ! Copyright 2017-2019 Institute of Computer Science of the |
---|
| 19 | ! Czech Academy of Sciences, Prague |
---|
[2000] | 20 | !------------------------------------------------------------------------------! |
---|
[1036] | 21 | ! |
---|
[257] | 22 | ! Current revisions: |
---|
[2977] | 23 | ! ------------------ |
---|
[2214] | 24 | ! |
---|
[4226] | 25 | ! |
---|
[2214] | 26 | ! Former revisions: |
---|
| 27 | ! ----------------- |
---|
| 28 | ! $Id: plant_canopy_model_mod.f90 4302 2019-11-22 13:15:56Z suehring $ |
---|
[4302] | 29 | ! Omit tall canopy mapped on top of buildings |
---|
| 30 | ! |
---|
| 31 | ! 4279 2019-10-29 08:48:17Z scharf |
---|
[4279] | 32 | ! unused variables removed |
---|
| 33 | ! |
---|
| 34 | ! 4258 2019-10-07 13:29:08Z scharf |
---|
[4278] | 35 | ! changed check for static driver and fixed bugs in initialization and header |
---|
| 36 | ! |
---|
| 37 | ! 4258 2019-10-07 13:29:08Z suehring |
---|
[4258] | 38 | ! Check if any LAD is prescribed when plant-canopy model is applied. |
---|
| 39 | ! |
---|
| 40 | ! 4226 2019-09-10 17:03:24Z suehring |
---|
[4226] | 41 | ! Bugfix, missing initialization of heating rate |
---|
| 42 | ! |
---|
| 43 | ! 4221 2019-09-09 08:50:35Z suehring |
---|
[4220] | 44 | ! Further bugfix in 3d data output for plant canopy |
---|
| 45 | ! |
---|
| 46 | ! 4216 2019-09-04 09:09:03Z suehring |
---|
[4216] | 47 | ! Bugfixes in 3d data output |
---|
| 48 | ! |
---|
| 49 | ! 4205 2019-08-30 13:25:00Z suehring |
---|
[4205] | 50 | ! Missing working precision + bugfix in calculation of wind speed |
---|
| 51 | ! |
---|
| 52 | ! 4188 2019-08-26 14:15:47Z suehring |
---|
[4188] | 53 | ! Minor adjustment in error number |
---|
| 54 | ! |
---|
| 55 | ! 4187 2019-08-26 12:43:15Z suehring |
---|
[4187] | 56 | ! Give specific error numbers instead of PA0999 |
---|
| 57 | ! |
---|
| 58 | ! 4182 2019-08-22 15:20:23Z scharf |
---|
[4182] | 59 | ! Corrected "Former revisions" section |
---|
| 60 | ! |
---|
| 61 | ! 4168 2019-08-16 13:50:17Z suehring |
---|
[4168] | 62 | ! Replace function get_topography_top_index by topo_top_ind |
---|
| 63 | ! |
---|
| 64 | ! 4127 2019-07-30 14:47:10Z suehring |
---|
[4127] | 65 | ! Output of 3D plant canopy variables changed. It is now relative to the local |
---|
| 66 | ! terrain rather than located at the acutal vertical level in the model. This |
---|
| 67 | ! way, the vertical dimension of the output can be significantly reduced. |
---|
| 68 | ! (merge from branch resler) |
---|
| 69 | ! |
---|
| 70 | ! 3885 2019-04-11 11:29:34Z kanani |
---|
[3885] | 71 | ! Changes related to global restructuring of location messages and introduction |
---|
| 72 | ! of additional debug messages |
---|
| 73 | ! |
---|
| 74 | ! 3864 2019-04-05 09:01:56Z monakurppa |
---|
[3761] | 75 | ! unsed variables removed |
---|
| 76 | ! |
---|
| 77 | ! 3745 2019-02-15 18:57:56Z suehring |
---|
[3745] | 78 | ! Bugfix in transpiration, floating invalid when temperature |
---|
| 79 | ! becomes > 40 degrees |
---|
| 80 | ! |
---|
| 81 | ! 3744 2019-02-15 18:38:58Z suehring |
---|
[3685] | 82 | ! Some interface calls moved to module_interface + cleanup |
---|
| 83 | ! |
---|
| 84 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
[3614] | 85 | ! unused variables removed |
---|
[3498] | 86 | ! |
---|
[4182] | 87 | ! 138 2007-11-28 10:03:58Z letzel |
---|
| 88 | ! Initial revision |
---|
| 89 | ! |
---|
[138] | 90 | ! Description: |
---|
| 91 | ! ------------ |
---|
[1682] | 92 | !> 1) Initialization of the canopy model, e.g. construction of leaf area density |
---|
[1826] | 93 | !> profile (subroutine pcm_init). |
---|
[1682] | 94 | !> 2) Calculation of sinks and sources of momentum, heat and scalar concentration |
---|
[1826] | 95 | !> due to canopy elements (subroutine pcm_tendency). |
---|
[3744] | 96 | ! |
---|
| 97 | ! @todo - precalculate constant terms in pcm_calc_transpiration_rate |
---|
[4216] | 98 | ! @todo - unify variable names (pcm_, pc_, ...) |
---|
[138] | 99 | !------------------------------------------------------------------------------! |
---|
[1682] | 100 | MODULE plant_canopy_model_mod |
---|
| 101 | |
---|
[1484] | 102 | USE arrays_3d, & |
---|
[3449] | 103 | ONLY: dzu, dzw, e, exner, hyp, pt, q, s, tend, u, v, w, zu, zw |
---|
[138] | 104 | |
---|
[3449] | 105 | USE basic_constants_and_equations_mod, & |
---|
| 106 | ONLY: c_p, degc_to_k, l_v, lv_d_cp, r_d, rd_d_rv |
---|
| 107 | |
---|
[3885] | 108 | USE control_parameters, & |
---|
| 109 | ONLY: debug_output, humidity |
---|
[3449] | 110 | |
---|
[1484] | 111 | USE indices, & |
---|
| 112 | ONLY: nbgp, nxl, nxlg, nxlu, nxr, nxrg, nyn, nyng, nys, nysg, nysv, & |
---|
[4168] | 113 | nz, nzb, nzt, topo_top_ind |
---|
[1484] | 114 | |
---|
| 115 | USE kinds |
---|
| 116 | |
---|
[3449] | 117 | USE pegrid |
---|
| 118 | |
---|
[1484] | 119 | |
---|
| 120 | IMPLICIT NONE |
---|
| 121 | |
---|
| 122 | |
---|
[3449] | 123 | CHARACTER (LEN=30) :: canopy_mode = 'block' !< canopy coverage |
---|
| 124 | LOGICAL :: plant_canopy_transpiration = .FALSE. !< flag to switch calculation of transpiration and corresponding latent heat |
---|
| 125 | !< for resolved plant canopy inside radiation model |
---|
| 126 | !< (calls subroutine pcm_calc_transpiration_rate from module plant_canopy_mod) |
---|
[1484] | 127 | |
---|
[3449] | 128 | INTEGER(iwp) :: pch_index = 0 !< plant canopy height/top index |
---|
| 129 | INTEGER(iwp) :: lad_vertical_gradient_level_ind(10) = -9999 !< lad-profile levels (index) |
---|
[1484] | 130 | |
---|
[3449] | 131 | INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: pch_index_ji !< local plant canopy top |
---|
[2696] | 132 | |
---|
[3449] | 133 | LOGICAL :: calc_beta_lad_profile = .FALSE. !< switch for calc. of lad from beta func. |
---|
[1484] | 134 | |
---|
[2696] | 135 | REAL(wp) :: alpha_lad = 9999999.9_wp !< coefficient for lad calculation |
---|
| 136 | REAL(wp) :: beta_lad = 9999999.9_wp !< coefficient for lad calculation |
---|
| 137 | REAL(wp) :: canopy_drag_coeff = 0.0_wp !< canopy drag coefficient (parameter) |
---|
| 138 | REAL(wp) :: cdc = 0.0_wp !< canopy drag coeff. (abbreviation used in equations) |
---|
| 139 | REAL(wp) :: cthf = 0.0_wp !< canopy top heat flux |
---|
| 140 | REAL(wp) :: dt_plant_canopy = 0.0_wp !< timestep account. for canopy drag |
---|
| 141 | REAL(wp) :: ext_coef = 0.6_wp !< extinction coefficient |
---|
| 142 | REAL(wp) :: lad_surface = 0.0_wp !< lad surface value |
---|
| 143 | REAL(wp) :: lai_beta = 0.0_wp !< leaf area index (lai) for lad calc. |
---|
| 144 | REAL(wp) :: leaf_scalar_exch_coeff = 0.0_wp !< canopy scalar exchange coeff. |
---|
| 145 | REAL(wp) :: leaf_surface_conc = 0.0_wp !< leaf surface concentration |
---|
[2768] | 146 | REAL(wp) :: lsc = 0.0_wp !< leaf surface concentration |
---|
[2696] | 147 | REAL(wp) :: lsec = 0.0_wp !< leaf scalar exchange coeff. |
---|
[1484] | 148 | |
---|
[2696] | 149 | REAL(wp) :: lad_vertical_gradient(10) = 0.0_wp !< lad gradient |
---|
| 150 | REAL(wp) :: lad_vertical_gradient_level(10) = -9999999.9_wp !< lad-prof. levels (in m) |
---|
[1484] | 151 | |
---|
[2977] | 152 | REAL(wp) :: lad_type_coef(0:10) = 1.0_wp !< multiplicative coeficients for particular types |
---|
| 153 | !< of plant canopy (e.g. deciduous tree during winter) |
---|
| 154 | |
---|
[1682] | 155 | REAL(wp), DIMENSION(:), ALLOCATABLE :: lad !< leaf area density |
---|
| 156 | REAL(wp), DIMENSION(:), ALLOCATABLE :: pre_lad !< preliminary lad |
---|
[1484] | 157 | |
---|
[4127] | 158 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: cum_lai_hf !< cumulative lai for heatflux calc. |
---|
| 159 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: lad_s !< lad on scalar-grid |
---|
| 160 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pc_heating_rate !< plant canopy heating rate |
---|
| 161 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pc_transpiration_rate !< plant canopy transpiration rate |
---|
| 162 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pc_latent_rate !< plant canopy latent heating rate |
---|
[1484] | 163 | |
---|
[4127] | 164 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pcm_heatrate_av !< array for averaging plant canopy sensible heating rate |
---|
| 165 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pcm_latentrate_av !< array for averaging plant canopy latent heating rate |
---|
| 166 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pcm_transpirationrate_av !< array for averaging plant canopy transpiration rate |
---|
| 167 | |
---|
[1484] | 168 | SAVE |
---|
| 169 | |
---|
| 170 | |
---|
[138] | 171 | PRIVATE |
---|
[1826] | 172 | |
---|
| 173 | ! |
---|
| 174 | !-- Public functions |
---|
[3449] | 175 | PUBLIC pcm_calc_transpiration_rate, pcm_check_data_output, & |
---|
[4127] | 176 | pcm_check_parameters, pcm_3d_data_averaging, & |
---|
| 177 | pcm_data_output_3d, pcm_define_netcdf_grid, & |
---|
[3449] | 178 | pcm_header, pcm_init, pcm_parin, pcm_tendency |
---|
[138] | 179 | |
---|
[1826] | 180 | ! |
---|
| 181 | !-- Public variables and constants |
---|
[3467] | 182 | PUBLIC cdc, pc_heating_rate, pc_transpiration_rate, pc_latent_rate, & |
---|
| 183 | canopy_mode, cthf, dt_plant_canopy, lad, lad_s, pch_index, & |
---|
| 184 | plant_canopy_transpiration |
---|
[1484] | 185 | |
---|
[3449] | 186 | INTERFACE pcm_calc_transpiration_rate |
---|
| 187 | MODULE PROCEDURE pcm_calc_transpiration_rate |
---|
| 188 | END INTERFACE pcm_calc_transpiration_rate |
---|
| 189 | |
---|
[2209] | 190 | INTERFACE pcm_check_data_output |
---|
| 191 | MODULE PROCEDURE pcm_check_data_output |
---|
| 192 | END INTERFACE pcm_check_data_output |
---|
| 193 | |
---|
[1826] | 194 | INTERFACE pcm_check_parameters |
---|
| 195 | MODULE PROCEDURE pcm_check_parameters |
---|
[2209] | 196 | END INTERFACE pcm_check_parameters |
---|
| 197 | |
---|
[4127] | 198 | INTERFACE pcm_3d_data_averaging |
---|
| 199 | MODULE PROCEDURE pcm_3d_data_averaging |
---|
| 200 | END INTERFACE pcm_3d_data_averaging |
---|
| 201 | |
---|
[2209] | 202 | INTERFACE pcm_data_output_3d |
---|
| 203 | MODULE PROCEDURE pcm_data_output_3d |
---|
| 204 | END INTERFACE pcm_data_output_3d |
---|
| 205 | |
---|
| 206 | INTERFACE pcm_define_netcdf_grid |
---|
| 207 | MODULE PROCEDURE pcm_define_netcdf_grid |
---|
| 208 | END INTERFACE pcm_define_netcdf_grid |
---|
[1826] | 209 | |
---|
| 210 | INTERFACE pcm_header |
---|
| 211 | MODULE PROCEDURE pcm_header |
---|
| 212 | END INTERFACE pcm_header |
---|
| 213 | |
---|
| 214 | INTERFACE pcm_init |
---|
| 215 | MODULE PROCEDURE pcm_init |
---|
| 216 | END INTERFACE pcm_init |
---|
[138] | 217 | |
---|
[1826] | 218 | INTERFACE pcm_parin |
---|
| 219 | MODULE PROCEDURE pcm_parin |
---|
[2007] | 220 | END INTERFACE pcm_parin |
---|
| 221 | |
---|
| 222 | INTERFACE pcm_read_plant_canopy_3d |
---|
| 223 | MODULE PROCEDURE pcm_read_plant_canopy_3d |
---|
| 224 | END INTERFACE pcm_read_plant_canopy_3d |
---|
[1826] | 225 | |
---|
| 226 | INTERFACE pcm_tendency |
---|
| 227 | MODULE PROCEDURE pcm_tendency |
---|
| 228 | MODULE PROCEDURE pcm_tendency_ij |
---|
| 229 | END INTERFACE pcm_tendency |
---|
[1484] | 230 | |
---|
| 231 | |
---|
[138] | 232 | CONTAINS |
---|
| 233 | |
---|
[2209] | 234 | |
---|
[3449] | 235 | |
---|
[2209] | 236 | !------------------------------------------------------------------------------! |
---|
| 237 | ! Description: |
---|
| 238 | ! ------------ |
---|
[3449] | 239 | !> Calculation of the plant canopy transpiration rate based on the Jarvis-Stewart |
---|
| 240 | !> with parametrizations described in Daudet et al. (1999; Agricult. and Forest |
---|
| 241 | !> Meteorol. 97) and Ngao, Adam and Saudreau (2017; Agricult. and Forest Meteorol |
---|
| 242 | !> 237-238). Model functions f1-f4 were adapted from Stewart (1998; Agric. |
---|
| 243 | !> and Forest. Meteorol. 43) instead, because they are valid for broader intervals |
---|
| 244 | !> of values. Funcion f4 used in form present in van Wijk et al. (1998; |
---|
| 245 | !> Tree Physiology 20). |
---|
| 246 | !> |
---|
| 247 | !> This subroutine is called from subroutine radiation_interaction |
---|
| 248 | !> after the calculation of radiation in plant canopy boxes. |
---|
| 249 | !> (arrays pcbinsw and pcbinlw). |
---|
| 250 | !> |
---|
| 251 | !------------------------------------------------------------------------------! |
---|
| 252 | SUBROUTINE pcm_calc_transpiration_rate(i, j, k, kk, pcbsw, pcblw, pcbtr, pcblh) |
---|
| 253 | |
---|
| 254 | USE control_parameters, & |
---|
| 255 | ONLY: dz |
---|
| 256 | |
---|
| 257 | USE grid_variables, & |
---|
| 258 | ONLY: dx, dy |
---|
| 259 | |
---|
| 260 | IMPLICIT NONE |
---|
| 261 | !-- input parameters |
---|
[4205] | 262 | INTEGER(iwp), INTENT(IN) :: i, j, k, kk !< indices of the pc gridbox |
---|
| 263 | REAL(wp), INTENT(IN) :: pcbsw !< sw radiation in gridbox (W) |
---|
| 264 | REAL(wp), INTENT(IN) :: pcblw !< lw radiation in gridbox (W) |
---|
| 265 | REAL(wp), INTENT(OUT) :: pcbtr !< transpiration rate dq/dt (kg/kg/s) |
---|
| 266 | REAL(wp), INTENT(OUT) :: pcblh !< latent heat from transpiration dT/dt (K/s) |
---|
[3449] | 267 | |
---|
| 268 | !-- variables and parameters for calculation of transpiration rate |
---|
[4205] | 269 | REAL(wp) :: sat_press, sat_press_d, temp, v_lad |
---|
| 270 | REAL(wp) :: d_fact, g_b, g_s, wind_speed, evapor_rate |
---|
| 271 | REAL(wp) :: f1, f2, f3, f4, vpd, rswc, e_eq, e_imp, rad |
---|
| 272 | REAL(wp), PARAMETER :: gama_psychr = 66.0_wp !< psychrometric constant (Pa/K) |
---|
| 273 | REAL(wp), PARAMETER :: g_s_max = 0.01 !< maximum stomatal conductivity (m/s) |
---|
| 274 | REAL(wp), PARAMETER :: m_soil = 0.4_wp !< soil water content (needs to adjust or take from LSM) |
---|
| 275 | REAL(wp), PARAMETER :: m_wilt = 0.01_wp !< wilting point soil water content (needs to adjust or take from LSM) |
---|
| 276 | REAL(wp), PARAMETER :: m_sat = 0.51_wp !< saturation soil water content (needs to adjust or take from LSM) |
---|
| 277 | REAL(wp), PARAMETER :: t2_min = 0.0_wp !< minimal temperature for calculation of f2 |
---|
| 278 | REAL(wp), PARAMETER :: t2_max = 40.0_wp !< maximal temperature for calculation of f2 |
---|
[3449] | 279 | |
---|
| 280 | |
---|
| 281 | !-- Temperature (deg C) |
---|
| 282 | temp = pt(k,j,i) * exner(k) - degc_to_k |
---|
| 283 | !-- Coefficient for conversion of radiation to grid to radiation to unit leaves surface |
---|
[4205] | 284 | v_lad = 1.0_wp / ( MAX( lad_s(kk,j,i), 1.0E-10_wp ) * dx * dy * dz(1) ) |
---|
[3449] | 285 | !-- Magnus formula for the saturation pressure (see Ngao, Adam and Saudreau (2017) eq. 1) |
---|
| 286 | !-- There are updated formulas available, kept consistent with the rest of the parametrization |
---|
| 287 | sat_press = 610.8_wp * exp(17.27_wp * temp/(temp + 237.3_wp)) |
---|
| 288 | !-- Saturation pressure derivative (derivative of the above) |
---|
| 289 | sat_press_d = sat_press * 17.27_wp * 237.3_wp / (temp + 237.3_wp)**2 |
---|
| 290 | !-- Wind speed |
---|
[3744] | 291 | wind_speed = SQRT( ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) )**2 + & |
---|
[4205] | 292 | ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) )**2 + & |
---|
| 293 | ( 0.5_wp * ( w(k,j,i) + w(k-1,j,i) ) )**2 ) |
---|
[3449] | 294 | !-- Aerodynamic conductivity (Daudet et al. (1999) eq. 14 |
---|
| 295 | g_b = 0.01_wp * wind_speed + 0.0071_wp |
---|
| 296 | !-- Radiation flux per leaf surface unit |
---|
| 297 | rad = pcbsw * v_lad |
---|
| 298 | !-- First function for calculation of stomatal conductivity (radiation dependency) |
---|
| 299 | !-- Stewart (1988; Agric. and Forest. Meteorol. 43) eq. 17 |
---|
[4205] | 300 | f1 = rad * (1000.0_wp+42.1_wp) / 1000.0_wp / (rad+42.1_wp) |
---|
[3449] | 301 | !-- Second function for calculation of stomatal conductivity (temperature dependency) |
---|
| 302 | !-- Stewart (1988; Agric. and Forest. Meteorol. 43) eq. 21 |
---|
[3744] | 303 | f2 = MAX(t2_min, (temp-t2_min) * MAX(0.0_wp,t2_max-temp)**((t2_max-16.9_wp)/(16.9_wp-t2_min)) / & |
---|
[3449] | 304 | ((16.9_wp-t2_min) * (t2_max-16.9_wp)**((t2_max-16.9_wp)/(16.9_wp-t2_min))) ) |
---|
| 305 | !-- Water pressure deficit |
---|
| 306 | !-- Ngao, Adam and Saudreau (2017) eq. 6 but with water vapour partial pressure |
---|
| 307 | vpd = max( sat_press - q(k,j,i) * hyp(k) / rd_d_rv, 0._wp ) |
---|
| 308 | !-- Third function for calculation of stomatal conductivity (water pressure deficit dependency) |
---|
| 309 | !-- Ngao, Adam and Saudreau (2017) Table 1, limited from below according to Stewart (1988) |
---|
| 310 | !-- The coefficients of the linear dependence should better correspond to broad-leaved trees |
---|
| 311 | !-- than the coefficients from Stewart (1988) which correspond to conifer trees. |
---|
| 312 | vpd = MIN(MAX(vpd,770.0_wp),3820.0_wp) |
---|
[4205] | 313 | f3 = -2E-4_wp * vpd + 1.154_wp |
---|
[3449] | 314 | !-- Fourth function for calculation of stomatal conductivity (soil moisture dependency) |
---|
| 315 | !-- Residual soil water content |
---|
| 316 | !-- van Wijk et al. (1998; Tree Physiology 20) eq. 7 |
---|
| 317 | !-- TODO - over LSM surface might be calculated from LSM parameters |
---|
| 318 | rswc = ( m_sat - m_soil ) / ( m_sat - m_wilt ) |
---|
| 319 | !-- van Wijk et al. (1998; Tree Physiology 20) eq. 5-6 (it is a reformulation of eq. 22-23 of Stewart(1988)) |
---|
[4205] | 320 | f4 = MAX(0.0_wp, MIN(1.0_wp - 0.041_wp * EXP(3.2_wp * rswc), 1.0_wp - 0.041_wp)) |
---|
[3449] | 321 | !-- Stomatal conductivity |
---|
| 322 | !-- Stewart (1988; Agric. and Forest. Meteorol. 43) eq. 12 |
---|
| 323 | !-- (notation according to Ngao, Adam and Saudreau (2017) and others) |
---|
[4205] | 324 | g_s = g_s_max * f1 * f2 * f3 * f4 + 1.0E-10_wp |
---|
[3449] | 325 | !-- Decoupling factor |
---|
| 326 | !-- Daudet et al. (1999) eq. 6 |
---|
[4205] | 327 | d_fact = (sat_press_d / gama_psychr + 2.0_wp ) / & |
---|
| 328 | (sat_press_d / gama_psychr + 2.0_wp + 2.0_wp * g_b / g_s ) |
---|
[3449] | 329 | !-- Equilibrium evaporation rate |
---|
| 330 | !-- Daudet et al. (1999) eq. 4 |
---|
| 331 | e_eq = (pcbsw + pcblw) * v_lad * sat_press_d / & |
---|
| 332 | gama_psychr /( sat_press_d / gama_psychr + 2.0_wp ) / l_v |
---|
| 333 | !-- Imposed evaporation rate |
---|
| 334 | !-- Daudet et al. (1999) eq. 5 |
---|
| 335 | e_imp = r_d * pt(k,j,i) * exner(k) / hyp(k) * c_p * g_s * vpd / gama_psychr / l_v |
---|
| 336 | !-- Evaporation rate |
---|
| 337 | !-- Daudet et al. (1999) eq. 3 |
---|
| 338 | !-- (evaporation rate is limited to non-negative values) |
---|
| 339 | evapor_rate = MAX(d_fact * e_eq + ( 1.0_wp - d_fact ) * e_imp, 0.0_wp) |
---|
| 340 | !-- Conversion of evaporation rate to q tendency in gridbox |
---|
| 341 | !-- dq/dt = E * LAD * V_g / (rho_air * V_g) |
---|
| 342 | pcbtr = evapor_rate * r_d * pt(k,j,i) * exner(k) * lad_s(kk,j,i) / hyp(k) !-- = dq/dt |
---|
| 343 | !-- latent heat from evaporation |
---|
| 344 | pcblh = pcbtr * lv_d_cp !-- = - dT/dt |
---|
| 345 | |
---|
| 346 | END SUBROUTINE pcm_calc_transpiration_rate |
---|
| 347 | |
---|
| 348 | |
---|
| 349 | !------------------------------------------------------------------------------! |
---|
| 350 | ! Description: |
---|
| 351 | ! ------------ |
---|
[2209] | 352 | !> Check data output for plant canopy model |
---|
| 353 | !------------------------------------------------------------------------------! |
---|
| 354 | SUBROUTINE pcm_check_data_output( var, unit ) |
---|
[4279] | 355 | |
---|
[2209] | 356 | USE control_parameters, & |
---|
[3241] | 357 | ONLY: message_string, urban_surface |
---|
[2209] | 358 | |
---|
| 359 | IMPLICIT NONE |
---|
| 360 | |
---|
| 361 | CHARACTER (LEN=*) :: unit !< |
---|
| 362 | CHARACTER (LEN=*) :: var !< |
---|
| 363 | |
---|
| 364 | |
---|
| 365 | SELECT CASE ( TRIM( var ) ) |
---|
| 366 | |
---|
| 367 | CASE ( 'pcm_heatrate' ) |
---|
[2770] | 368 | IF ( cthf == 0.0_wp .AND. .NOT. urban_surface ) THEN |
---|
[2768] | 369 | message_string = 'output of "' // TRIM( var ) // '" requi' // & |
---|
| 370 | 'res setting of parameter cthf /= 0.0' |
---|
| 371 | CALL message( 'pcm_check_data_output', 'PA1000', 1, 2, 0, 6, 0 ) |
---|
| 372 | ENDIF |
---|
[2209] | 373 | unit = 'K s-1' |
---|
| 374 | |
---|
[3014] | 375 | CASE ( 'pcm_transpirationrate' ) |
---|
| 376 | unit = 'kg kg-1 s-1' |
---|
| 377 | |
---|
[3449] | 378 | CASE ( 'pcm_latentrate' ) |
---|
| 379 | unit = 'K s-1' |
---|
| 380 | |
---|
| 381 | CASE ( 'pcm_bowenratio' ) |
---|
| 382 | unit = 'K s-1' |
---|
| 383 | |
---|
[2209] | 384 | CASE ( 'pcm_lad' ) |
---|
| 385 | unit = 'm2 m-3' |
---|
| 386 | |
---|
| 387 | |
---|
| 388 | CASE DEFAULT |
---|
| 389 | unit = 'illegal' |
---|
| 390 | |
---|
| 391 | END SELECT |
---|
| 392 | |
---|
| 393 | |
---|
| 394 | END SUBROUTINE pcm_check_data_output |
---|
| 395 | |
---|
| 396 | |
---|
[1826] | 397 | !------------------------------------------------------------------------------! |
---|
| 398 | ! Description: |
---|
| 399 | ! ------------ |
---|
| 400 | !> Check parameters routine for plant canopy model |
---|
| 401 | !------------------------------------------------------------------------------! |
---|
| 402 | SUBROUTINE pcm_check_parameters |
---|
[138] | 403 | |
---|
[1826] | 404 | USE control_parameters, & |
---|
[4279] | 405 | ONLY: message_string |
---|
[2696] | 406 | |
---|
[3274] | 407 | USE bulk_cloud_model_mod, & |
---|
| 408 | ONLY: bulk_cloud_model, microphysics_seifert |
---|
| 409 | |
---|
[2696] | 410 | USE netcdf_data_input_mod, & |
---|
[4279] | 411 | ONLY: input_pids_static |
---|
| 412 | |
---|
| 413 | |
---|
[1826] | 414 | IMPLICIT NONE |
---|
| 415 | |
---|
| 416 | IF ( canopy_drag_coeff == 0.0_wp ) THEN |
---|
| 417 | message_string = 'plant_canopy = .TRUE. requires a non-zero drag '// & |
---|
[3046] | 418 | 'coefficient & given value is canopy_drag_coeff = 0.0' |
---|
[2768] | 419 | CALL message( 'pcm_check_parameters', 'PA0041', 1, 2, 0, 6, 0 ) |
---|
[1826] | 420 | ENDIF |
---|
[4279] | 421 | |
---|
[3045] | 422 | IF ( ( alpha_lad /= 9999999.9_wp .AND. beta_lad == 9999999.9_wp ) .OR.& |
---|
[1826] | 423 | beta_lad /= 9999999.9_wp .AND. alpha_lad == 9999999.9_wp ) THEN |
---|
| 424 | message_string = 'using the beta function for the construction ' // & |
---|
| 425 | 'of the leaf area density profile requires ' // & |
---|
| 426 | 'both alpha_lad and beta_lad to be /= 9999999.9' |
---|
[2768] | 427 | CALL message( 'pcm_check_parameters', 'PA0118', 1, 2, 0, 6, 0 ) |
---|
[1826] | 428 | ENDIF |
---|
[4279] | 429 | |
---|
[1826] | 430 | IF ( calc_beta_lad_profile .AND. lai_beta == 0.0_wp ) THEN |
---|
| 431 | message_string = 'using the beta function for the construction ' // & |
---|
| 432 | 'of the leaf area density profile requires ' // & |
---|
| 433 | 'a non-zero lai_beta, but given value is ' // & |
---|
| 434 | 'lai_beta = 0.0' |
---|
[2768] | 435 | CALL message( 'pcm_check_parameters', 'PA0119', 1, 2, 0, 6, 0 ) |
---|
[1826] | 436 | ENDIF |
---|
| 437 | |
---|
| 438 | IF ( calc_beta_lad_profile .AND. lad_surface /= 0.0_wp ) THEN |
---|
[2274] | 439 | message_string = 'simultaneous setting of alpha_lad /= 9999999.9 '// & |
---|
| 440 | 'combined with beta_lad /= 9999999.9 ' // & |
---|
[1826] | 441 | 'and lad_surface /= 0.0 is not possible, ' // & |
---|
| 442 | 'use either vertical gradients or the beta ' // & |
---|
| 443 | 'function for the construction of the leaf area '// & |
---|
| 444 | 'density profile' |
---|
[2768] | 445 | CALL message( 'pcm_check_parameters', 'PA0120', 1, 2, 0, 6, 0 ) |
---|
[1826] | 446 | ENDIF |
---|
| 447 | |
---|
[3274] | 448 | IF ( bulk_cloud_model .AND. microphysics_seifert ) THEN |
---|
[1826] | 449 | message_string = 'plant_canopy = .TRUE. requires cloud_scheme /=' // & |
---|
| 450 | ' seifert_beheng' |
---|
[2768] | 451 | CALL message( 'pcm_check_parameters', 'PA0360', 1, 2, 0, 6, 0 ) |
---|
[1826] | 452 | ENDIF |
---|
[2696] | 453 | ! |
---|
[4278] | 454 | !-- If canopy shall be read from file, static input file must be present |
---|
| 455 | IF ( TRIM( canopy_mode ) == 'read_from_file_3d' .AND. & |
---|
| 456 | .NOT. input_pids_static ) THEN |
---|
| 457 | message_string = 'canopy_mode = read_from_file_3d requires ' // & |
---|
| 458 | 'static input file' |
---|
[4188] | 459 | CALL message( 'pcm_check_parameters', 'PA0672', 1, 2, 0, 6, 0 ) |
---|
[2696] | 460 | ENDIF |
---|
[1826] | 461 | |
---|
| 462 | |
---|
| 463 | END SUBROUTINE pcm_check_parameters |
---|
| 464 | |
---|
| 465 | |
---|
[138] | 466 | !------------------------------------------------------------------------------! |
---|
[2209] | 467 | ! |
---|
[1484] | 468 | ! Description: |
---|
| 469 | ! ------------ |
---|
[4127] | 470 | !> Subroutine for averaging 3D data |
---|
[2209] | 471 | !------------------------------------------------------------------------------! |
---|
[4216] | 472 | SUBROUTINE pcm_3d_data_averaging( mode, variable ) |
---|
[4127] | 473 | |
---|
| 474 | |
---|
| 475 | USE control_parameters |
---|
| 476 | |
---|
| 477 | USE indices |
---|
| 478 | |
---|
| 479 | USE kinds |
---|
| 480 | |
---|
| 481 | IMPLICIT NONE |
---|
| 482 | |
---|
| 483 | CHARACTER (LEN=*) :: mode !< |
---|
| 484 | CHARACTER (LEN=*) :: variable !< |
---|
| 485 | |
---|
| 486 | INTEGER(iwp) :: i !< |
---|
| 487 | INTEGER(iwp) :: j !< |
---|
| 488 | INTEGER(iwp) :: k !< |
---|
| 489 | |
---|
| 490 | |
---|
| 491 | IF ( mode == 'allocate' ) THEN |
---|
| 492 | |
---|
| 493 | SELECT CASE ( TRIM( variable ) ) |
---|
| 494 | |
---|
| 495 | CASE ( 'pcm_heatrate' ) |
---|
| 496 | IF ( .NOT. ALLOCATED( pcm_heatrate_av ) ) THEN |
---|
| 497 | ALLOCATE( pcm_heatrate_av(0:pch_index,nysg:nyng,nxlg:nxrg) ) |
---|
| 498 | ENDIF |
---|
| 499 | pcm_heatrate_av = 0.0_wp |
---|
| 500 | |
---|
| 501 | |
---|
| 502 | CASE ( 'pcm_latentrate' ) |
---|
| 503 | IF ( .NOT. ALLOCATED( pcm_latentrate_av ) ) THEN |
---|
| 504 | ALLOCATE( pcm_latentrate_av(0:pch_index,nysg:nyng,nxlg:nxrg) ) |
---|
| 505 | ENDIF |
---|
| 506 | pcm_latentrate_av = 0.0_wp |
---|
| 507 | |
---|
| 508 | |
---|
| 509 | CASE ( 'pcm_transpirationrate' ) |
---|
| 510 | IF ( .NOT. ALLOCATED( pcm_transpirationrate_av ) ) THEN |
---|
| 511 | ALLOCATE( pcm_transpirationrate_av(0:pch_index,nysg:nyng,nxlg:nxrg) ) |
---|
| 512 | ENDIF |
---|
| 513 | pcm_transpirationrate_av = 0.0_wp |
---|
| 514 | |
---|
| 515 | CASE DEFAULT |
---|
| 516 | CONTINUE |
---|
| 517 | |
---|
| 518 | END SELECT |
---|
| 519 | |
---|
| 520 | ELSEIF ( mode == 'sum' ) THEN |
---|
| 521 | |
---|
| 522 | SELECT CASE ( TRIM( variable ) ) |
---|
| 523 | |
---|
| 524 | CASE ( 'pcm_heatrate' ) |
---|
| 525 | IF ( ALLOCATED( pcm_heatrate_av ) ) THEN |
---|
| 526 | DO i = nxl, nxr |
---|
| 527 | DO j = nys, nyn |
---|
| 528 | IF ( pch_index_ji(j,i) /= 0 ) THEN |
---|
| 529 | DO k = 0, pch_index_ji(j,i) |
---|
| 530 | pcm_heatrate_av(k,j,i) = pcm_heatrate_av(k,j,i) + pc_heating_rate(k,j,i) |
---|
| 531 | ENDDO |
---|
| 532 | ENDIF |
---|
| 533 | ENDDO |
---|
| 534 | ENDDO |
---|
| 535 | ENDIF |
---|
| 536 | |
---|
| 537 | |
---|
| 538 | CASE ( 'pcm_latentrate' ) |
---|
| 539 | IF ( ALLOCATED( pcm_latentrate_av ) ) THEN |
---|
| 540 | DO i = nxl, nxr |
---|
| 541 | DO j = nys, nyn |
---|
| 542 | IF ( pch_index_ji(j,i) /= 0 ) THEN |
---|
| 543 | DO k = 0, pch_index_ji(j,i) |
---|
| 544 | pcm_latentrate_av(k,j,i) = pcm_latentrate_av(k,j,i) + pc_latent_rate(k,j,i) |
---|
| 545 | ENDDO |
---|
| 546 | ENDIF |
---|
| 547 | ENDDO |
---|
| 548 | ENDDO |
---|
| 549 | ENDIF |
---|
| 550 | |
---|
| 551 | |
---|
| 552 | CASE ( 'pcm_transpirationrate' ) |
---|
| 553 | IF ( ALLOCATED( pcm_transpirationrate_av ) ) THEN |
---|
| 554 | DO i = nxl, nxr |
---|
| 555 | DO j = nys, nyn |
---|
| 556 | IF ( pch_index_ji(j,i) /= 0 ) THEN |
---|
| 557 | DO k = 0, pch_index_ji(j,i) |
---|
| 558 | pcm_transpirationrate_av(k,j,i) = pcm_transpirationrate_av(k,j,i) + pc_transpiration_rate(k,j,i) |
---|
| 559 | ENDDO |
---|
| 560 | ENDIF |
---|
| 561 | ENDDO |
---|
| 562 | ENDDO |
---|
| 563 | ENDIF |
---|
| 564 | |
---|
| 565 | CASE DEFAULT |
---|
| 566 | CONTINUE |
---|
| 567 | |
---|
| 568 | END SELECT |
---|
| 569 | |
---|
| 570 | ELSEIF ( mode == 'average' ) THEN |
---|
| 571 | |
---|
| 572 | SELECT CASE ( TRIM( variable ) ) |
---|
| 573 | |
---|
| 574 | CASE ( 'pcm_heatrate' ) |
---|
| 575 | IF ( ALLOCATED( pcm_heatrate_av ) ) THEN |
---|
| 576 | DO i = nxlg, nxrg |
---|
| 577 | DO j = nysg, nyng |
---|
| 578 | IF ( pch_index_ji(j,i) /= 0 ) THEN |
---|
| 579 | DO k = 0, pch_index_ji(j,i) |
---|
| 580 | pcm_heatrate_av(k,j,i) = pcm_heatrate_av(k,j,i) & |
---|
| 581 | / REAL( average_count_3d, KIND=wp ) |
---|
| 582 | ENDDO |
---|
| 583 | ENDIF |
---|
| 584 | ENDDO |
---|
| 585 | ENDDO |
---|
| 586 | ENDIF |
---|
| 587 | |
---|
| 588 | |
---|
| 589 | CASE ( 'pcm_latentrate' ) |
---|
| 590 | IF ( ALLOCATED( pcm_latentrate_av ) ) THEN |
---|
| 591 | DO i = nxlg, nxrg |
---|
| 592 | DO j = nysg, nyng |
---|
| 593 | IF ( pch_index_ji(j,i) /= 0 ) THEN |
---|
| 594 | DO k = 0, pch_index_ji(j,i) |
---|
| 595 | pcm_latentrate_av(k,j,i) = pcm_latentrate_av(k,j,i) & |
---|
| 596 | / REAL( average_count_3d, KIND=wp ) |
---|
| 597 | ENDDO |
---|
| 598 | ENDIF |
---|
| 599 | ENDDO |
---|
| 600 | ENDDO |
---|
| 601 | ENDIF |
---|
| 602 | |
---|
| 603 | |
---|
| 604 | CASE ( 'pcm_transpirationrate' ) |
---|
| 605 | IF ( ALLOCATED( pcm_transpirationrate_av ) ) THEN |
---|
| 606 | DO i = nxlg, nxrg |
---|
| 607 | DO j = nysg, nyng |
---|
| 608 | IF ( pch_index_ji(j,i) /= 0 ) THEN |
---|
| 609 | DO k = 0, pch_index_ji(j,i) |
---|
| 610 | pcm_transpirationrate_av(k,j,i) = pcm_transpirationrate_av(k,j,i) & |
---|
| 611 | / REAL( average_count_3d, KIND=wp ) |
---|
| 612 | ENDDO |
---|
| 613 | ENDIF |
---|
| 614 | ENDDO |
---|
| 615 | ENDDO |
---|
| 616 | ENDIF |
---|
| 617 | |
---|
| 618 | END SELECT |
---|
| 619 | |
---|
| 620 | ENDIF |
---|
| 621 | |
---|
[4216] | 622 | END SUBROUTINE pcm_3d_data_averaging |
---|
[4127] | 623 | |
---|
| 624 | !------------------------------------------------------------------------------! |
---|
| 625 | ! |
---|
| 626 | ! Description: |
---|
| 627 | ! ------------ |
---|
| 628 | !> Subroutine defining 3D output variables. |
---|
| 629 | !> Note, 3D plant-canopy output has it's own vertical output dimension, meaning |
---|
| 630 | !> that 3D output is relative to the model surface now rather than at the actual |
---|
| 631 | !> grid point where the plant canopy is located. |
---|
| 632 | !------------------------------------------------------------------------------! |
---|
[3014] | 633 | SUBROUTINE pcm_data_output_3d( av, variable, found, local_pf, fill_value, & |
---|
| 634 | nzb_do, nzt_do ) |
---|
| 635 | |
---|
[2209] | 636 | USE indices |
---|
| 637 | |
---|
| 638 | USE kinds |
---|
| 639 | |
---|
| 640 | |
---|
| 641 | IMPLICIT NONE |
---|
| 642 | |
---|
[4216] | 643 | CHARACTER (LEN=*) :: variable !< treated variable |
---|
[2209] | 644 | |
---|
[4216] | 645 | INTEGER(iwp) :: av !< flag indicating instantaneous or averaged data output |
---|
| 646 | INTEGER(iwp) :: i !< grid index x-direction |
---|
| 647 | INTEGER(iwp) :: j !< grid index y-direction |
---|
| 648 | INTEGER(iwp) :: k !< grid index z-direction |
---|
[3014] | 649 | INTEGER(iwp) :: nzb_do !< lower limit of the data output (usually 0) |
---|
| 650 | INTEGER(iwp) :: nzt_do !< vertical upper limit of the data output (usually nz_do3d) |
---|
[2209] | 651 | |
---|
[4216] | 652 | LOGICAL :: found !< flag indicating if variable is found |
---|
[2209] | 653 | |
---|
[4216] | 654 | REAL(wp) :: fill_value !< fill value |
---|
| 655 | REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< data output array |
---|
[2209] | 656 | |
---|
| 657 | |
---|
| 658 | found = .TRUE. |
---|
| 659 | |
---|
[2696] | 660 | local_pf = REAL( fill_value, KIND = 4 ) |
---|
[2209] | 661 | |
---|
| 662 | SELECT CASE ( TRIM( variable ) ) |
---|
[4216] | 663 | ! |
---|
| 664 | !-- Note, to save memory arrays for heating are allocated from 0:pch_index. |
---|
| 665 | !-- Thus, output must be relative to these array indices. Further, check |
---|
| 666 | !-- whether the output is within the vertical output range, |
---|
[4220] | 667 | !-- i.e. nzb_do:nzt_do, which is necessary as local_pf is only allocated |
---|
| 668 | !-- for this index space. Note, plant-canopy output has a separate |
---|
| 669 | !-- vertical output coordinate zlad, so that output is mapped down to the |
---|
| 670 | !-- surface. |
---|
[4127] | 671 | CASE ( 'pcm_heatrate' ) |
---|
| 672 | IF ( av == 0 ) THEN |
---|
| 673 | DO i = nxl, nxr |
---|
| 674 | DO j = nys, nyn |
---|
[4220] | 675 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 676 | local_pf(i,j,k) = pc_heating_rate(k,j,i) |
---|
[4216] | 677 | ENDDO |
---|
[4127] | 678 | ENDDO |
---|
| 679 | ENDDO |
---|
| 680 | ELSE |
---|
| 681 | DO i = nxl, nxr |
---|
| 682 | DO j = nys, nyn |
---|
[4220] | 683 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 684 | local_pf(i,j,k) = pcm_heatrate_av(k,j,i) |
---|
[4127] | 685 | ENDDO |
---|
| 686 | ENDDO |
---|
| 687 | ENDDO |
---|
| 688 | ENDIF |
---|
[3449] | 689 | |
---|
| 690 | CASE ( 'pcm_latentrate' ) |
---|
[4127] | 691 | IF ( av == 0 ) THEN |
---|
| 692 | DO i = nxl, nxr |
---|
| 693 | DO j = nys, nyn |
---|
[4220] | 694 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 695 | local_pf(i,j,k) = pc_latent_rate(k,j,i) |
---|
[4216] | 696 | ENDDO |
---|
[4127] | 697 | ENDDO |
---|
| 698 | ENDDO |
---|
| 699 | ELSE |
---|
| 700 | DO i = nxl, nxr |
---|
| 701 | DO j = nys, nyn |
---|
[4220] | 702 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 703 | local_pf(i,j,k) = pcm_latentrate_av(k,j,i) |
---|
[4127] | 704 | ENDDO |
---|
| 705 | ENDDO |
---|
| 706 | ENDDO |
---|
| 707 | ENDIF |
---|
[3449] | 708 | |
---|
[4127] | 709 | CASE ( 'pcm_transpirationrate' ) |
---|
| 710 | IF ( av == 0 ) THEN |
---|
| 711 | DO i = nxl, nxr |
---|
| 712 | DO j = nys, nyn |
---|
[4220] | 713 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 714 | local_pf(i,j,k) = pc_transpiration_rate(k,j,i) |
---|
[4216] | 715 | ENDDO |
---|
[4127] | 716 | ENDDO |
---|
| 717 | ENDDO |
---|
| 718 | ELSE |
---|
| 719 | DO i = nxl, nxr |
---|
| 720 | DO j = nys, nyn |
---|
[4220] | 721 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 722 | local_pf(i,j,k) = pcm_transpirationrate_av(k,j,i) |
---|
[4127] | 723 | ENDDO |
---|
| 724 | ENDDO |
---|
| 725 | ENDDO |
---|
| 726 | ENDIF |
---|
| 727 | |
---|
[3449] | 728 | CASE ( 'pcm_bowenratio' ) |
---|
[4127] | 729 | IF ( av == 0 ) THEN |
---|
| 730 | DO i = nxl, nxr |
---|
| 731 | DO j = nys, nyn |
---|
[4220] | 732 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 733 | IF ( pc_latent_rate(k,j,i) /= 0.0_wp ) THEN |
---|
| 734 | local_pf(i,j,k) = pc_heating_rate(k,j,i) / & |
---|
| 735 | pc_latent_rate(k,j,i) |
---|
[4216] | 736 | ENDIF |
---|
| 737 | ENDDO |
---|
[4127] | 738 | ENDDO |
---|
| 739 | ENDDO |
---|
[4216] | 740 | ELSE |
---|
| 741 | DO i = nxl, nxr |
---|
| 742 | DO j = nys, nyn |
---|
[4220] | 743 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 744 | IF ( pcm_latentrate_av(k,j,i) /= 0.0_wp ) THEN |
---|
| 745 | local_pf(i,j,k) = pcm_heatrate_av(k,j,i) / & |
---|
| 746 | pcm_latentrate_av(k,j,i) |
---|
[4216] | 747 | ENDIF |
---|
| 748 | ENDDO |
---|
| 749 | ENDDO |
---|
| 750 | ENDDO |
---|
[4127] | 751 | ENDIF |
---|
[3449] | 752 | |
---|
[4127] | 753 | CASE ( 'pcm_lad' ) |
---|
| 754 | IF ( av == 0 ) THEN |
---|
| 755 | DO i = nxl, nxr |
---|
| 756 | DO j = nys, nyn |
---|
[4220] | 757 | DO k = MAX( 1, nzb_do ), MIN( pch_index, nzt_do ) |
---|
| 758 | local_pf(i,j,k) = lad_s(k,j,i) |
---|
[4216] | 759 | ENDDO |
---|
[4127] | 760 | ENDDO |
---|
| 761 | ENDDO |
---|
| 762 | ENDIF |
---|
| 763 | |
---|
[2209] | 764 | CASE DEFAULT |
---|
| 765 | found = .FALSE. |
---|
| 766 | |
---|
| 767 | END SELECT |
---|
| 768 | |
---|
| 769 | |
---|
| 770 | END SUBROUTINE pcm_data_output_3d |
---|
| 771 | |
---|
| 772 | !------------------------------------------------------------------------------! |
---|
| 773 | ! |
---|
| 774 | ! Description: |
---|
| 775 | ! ------------ |
---|
| 776 | !> Subroutine defining appropriate grid for netcdf variables. |
---|
| 777 | !> It is called from subroutine netcdf. |
---|
| 778 | !------------------------------------------------------------------------------! |
---|
| 779 | SUBROUTINE pcm_define_netcdf_grid( var, found, grid_x, grid_y, grid_z ) |
---|
| 780 | |
---|
| 781 | IMPLICIT NONE |
---|
| 782 | |
---|
| 783 | CHARACTER (LEN=*), INTENT(IN) :: var !< |
---|
| 784 | LOGICAL, INTENT(OUT) :: found !< |
---|
| 785 | CHARACTER (LEN=*), INTENT(OUT) :: grid_x !< |
---|
| 786 | CHARACTER (LEN=*), INTENT(OUT) :: grid_y !< |
---|
| 787 | CHARACTER (LEN=*), INTENT(OUT) :: grid_z !< |
---|
| 788 | |
---|
| 789 | found = .TRUE. |
---|
| 790 | |
---|
| 791 | ! |
---|
| 792 | !-- Check for the grid |
---|
| 793 | SELECT CASE ( TRIM( var ) ) |
---|
| 794 | |
---|
[3449] | 795 | CASE ( 'pcm_heatrate', 'pcm_lad', 'pcm_transpirationrate', 'pcm_latentrate', 'pcm_bowenratio') |
---|
[2209] | 796 | grid_x = 'x' |
---|
| 797 | grid_y = 'y' |
---|
[4127] | 798 | grid_z = 'zpc' |
---|
[2209] | 799 | |
---|
| 800 | CASE DEFAULT |
---|
| 801 | found = .FALSE. |
---|
| 802 | grid_x = 'none' |
---|
| 803 | grid_y = 'none' |
---|
| 804 | grid_z = 'none' |
---|
| 805 | END SELECT |
---|
| 806 | |
---|
| 807 | END SUBROUTINE pcm_define_netcdf_grid |
---|
| 808 | |
---|
| 809 | |
---|
| 810 | !------------------------------------------------------------------------------! |
---|
| 811 | ! Description: |
---|
| 812 | ! ------------ |
---|
[1826] | 813 | !> Header output for plant canopy model |
---|
| 814 | !------------------------------------------------------------------------------! |
---|
| 815 | SUBROUTINE pcm_header ( io ) |
---|
| 816 | |
---|
| 817 | USE control_parameters, & |
---|
[3065] | 818 | ONLY: passive_scalar |
---|
[1826] | 819 | |
---|
| 820 | |
---|
| 821 | IMPLICIT NONE |
---|
| 822 | |
---|
| 823 | CHARACTER (LEN=10) :: coor_chr !< |
---|
| 824 | |
---|
| 825 | CHARACTER (LEN=86) :: coordinates !< |
---|
| 826 | CHARACTER (LEN=86) :: gradients !< |
---|
| 827 | CHARACTER (LEN=86) :: leaf_area_density !< |
---|
| 828 | CHARACTER (LEN=86) :: slices !< |
---|
| 829 | |
---|
| 830 | INTEGER(iwp) :: i !< |
---|
| 831 | INTEGER(iwp), INTENT(IN) :: io !< Unit of the output file |
---|
| 832 | INTEGER(iwp) :: k !< |
---|
| 833 | |
---|
| 834 | REAL(wp) :: canopy_height !< canopy height (in m) |
---|
| 835 | |
---|
[3065] | 836 | canopy_height = zw(pch_index) |
---|
[1826] | 837 | |
---|
| 838 | WRITE ( io, 1 ) canopy_mode, canopy_height, pch_index, & |
---|
| 839 | canopy_drag_coeff |
---|
| 840 | IF ( passive_scalar ) THEN |
---|
| 841 | WRITE ( io, 2 ) leaf_scalar_exch_coeff, & |
---|
| 842 | leaf_surface_conc |
---|
| 843 | ENDIF |
---|
| 844 | |
---|
| 845 | ! |
---|
| 846 | !-- Heat flux at the top of vegetation |
---|
| 847 | WRITE ( io, 3 ) cthf |
---|
| 848 | |
---|
| 849 | ! |
---|
| 850 | !-- Leaf area density profile, calculated either from given vertical |
---|
| 851 | !-- gradients or from beta probability density function. |
---|
| 852 | IF ( .NOT. calc_beta_lad_profile ) THEN |
---|
| 853 | |
---|
| 854 | !-- Building output strings, starting with surface value |
---|
| 855 | WRITE ( leaf_area_density, '(F7.4)' ) lad_surface |
---|
| 856 | gradients = '------' |
---|
| 857 | slices = ' 0' |
---|
| 858 | coordinates = ' 0.0' |
---|
[4278] | 859 | DO i = 1, UBOUND(lad_vertical_gradient_level_ind, DIM=1) |
---|
| 860 | IF ( lad_vertical_gradient_level_ind(i) /= -9999 ) THEN |
---|
[1826] | 861 | |
---|
[4278] | 862 | WRITE (coor_chr,'(F7.2)') lad(lad_vertical_gradient_level_ind(i)) |
---|
| 863 | leaf_area_density = TRIM( leaf_area_density ) // ' ' // TRIM( coor_chr ) |
---|
[1826] | 864 | |
---|
[4278] | 865 | WRITE (coor_chr,'(F7.2)') lad_vertical_gradient(i) |
---|
| 866 | gradients = TRIM( gradients ) // ' ' // TRIM( coor_chr ) |
---|
[1826] | 867 | |
---|
[4278] | 868 | WRITE (coor_chr,'(I7)') lad_vertical_gradient_level_ind(i) |
---|
| 869 | slices = TRIM( slices ) // ' ' // TRIM( coor_chr ) |
---|
[1826] | 870 | |
---|
[4278] | 871 | WRITE (coor_chr,'(F7.1)') lad_vertical_gradient_level(i) |
---|
| 872 | coordinates = TRIM( coordinates ) // ' ' // TRIM( coor_chr ) |
---|
| 873 | ELSE |
---|
| 874 | EXIT |
---|
| 875 | ENDIF |
---|
[1826] | 876 | ENDDO |
---|
| 877 | |
---|
| 878 | WRITE ( io, 4 ) TRIM( coordinates ), TRIM( leaf_area_density ), & |
---|
| 879 | TRIM( gradients ), TRIM( slices ) |
---|
| 880 | |
---|
| 881 | ELSE |
---|
| 882 | |
---|
| 883 | WRITE ( leaf_area_density, '(F7.4)' ) lad_surface |
---|
| 884 | coordinates = ' 0.0' |
---|
| 885 | |
---|
| 886 | DO k = 1, pch_index |
---|
| 887 | |
---|
| 888 | WRITE (coor_chr,'(F7.2)') lad(k) |
---|
| 889 | leaf_area_density = TRIM( leaf_area_density ) // ' ' // & |
---|
| 890 | TRIM( coor_chr ) |
---|
| 891 | |
---|
| 892 | WRITE (coor_chr,'(F7.1)') zu(k) |
---|
| 893 | coordinates = TRIM( coordinates ) // ' ' // TRIM( coor_chr ) |
---|
| 894 | |
---|
| 895 | ENDDO |
---|
| 896 | |
---|
| 897 | WRITE ( io, 5 ) TRIM( coordinates ), TRIM( leaf_area_density ), & |
---|
| 898 | alpha_lad, beta_lad, lai_beta |
---|
| 899 | |
---|
| 900 | ENDIF |
---|
| 901 | |
---|
| 902 | 1 FORMAT (//' Vegetation canopy (drag) model:'/ & |
---|
| 903 | ' ------------------------------'// & |
---|
| 904 | ' Canopy mode: ', A / & |
---|
| 905 | ' Canopy height: ',F6.2,'m (',I4,' grid points)' / & |
---|
| 906 | ' Leaf drag coefficient: ',F6.2 /) |
---|
| 907 | 2 FORMAT (/ ' Scalar exchange coefficient: ',F6.2 / & |
---|
| 908 | ' Scalar concentration at leaf surfaces in kg/m**3: ',F6.2 /) |
---|
| 909 | 3 FORMAT (' Predefined constant heatflux at the top of the vegetation: ',F6.2, & |
---|
| 910 | ' K m/s') |
---|
| 911 | 4 FORMAT (/ ' Characteristic levels of the leaf area density:'// & |
---|
| 912 | ' Height: ',A,' m'/ & |
---|
| 913 | ' Leaf area density: ',A,' m**2/m**3'/ & |
---|
| 914 | ' Gradient: ',A,' m**2/m**4'/ & |
---|
| 915 | ' Gridpoint: ',A) |
---|
| 916 | 5 FORMAT (//' Characteristic levels of the leaf area density and coefficients:'& |
---|
| 917 | // ' Height: ',A,' m'/ & |
---|
| 918 | ' Leaf area density: ',A,' m**2/m**3'/ & |
---|
| 919 | ' Coefficient alpha: ',F6.2 / & |
---|
| 920 | ' Coefficient beta: ',F6.2 / & |
---|
| 921 | ' Leaf area index: ',F6.2,' m**2/m**2' /) |
---|
| 922 | |
---|
| 923 | END SUBROUTINE pcm_header |
---|
| 924 | |
---|
| 925 | |
---|
| 926 | !------------------------------------------------------------------------------! |
---|
| 927 | ! Description: |
---|
| 928 | ! ------------ |
---|
[1682] | 929 | !> Initialization of the plant canopy model |
---|
[138] | 930 | !------------------------------------------------------------------------------! |
---|
[1826] | 931 | SUBROUTINE pcm_init |
---|
[1484] | 932 | |
---|
| 933 | |
---|
| 934 | USE control_parameters, & |
---|
[3614] | 935 | ONLY: message_string, ocean_mode |
---|
[1484] | 936 | |
---|
[4302] | 937 | USE indices, & |
---|
| 938 | ONLY: wall_flags_0 |
---|
| 939 | |
---|
[2696] | 940 | USE netcdf_data_input_mod, & |
---|
| 941 | ONLY: leaf_area_density_f |
---|
| 942 | |
---|
[4302] | 943 | USE pegrid |
---|
| 944 | |
---|
[2232] | 945 | USE surface_mod, & |
---|
| 946 | ONLY: surf_def_h, surf_lsm_h, surf_usm_h |
---|
[1484] | 947 | |
---|
| 948 | IMPLICIT NONE |
---|
| 949 | |
---|
[2007] | 950 | INTEGER(iwp) :: i !< running index |
---|
| 951 | INTEGER(iwp) :: j !< running index |
---|
| 952 | INTEGER(iwp) :: k !< running index |
---|
[2232] | 953 | INTEGER(iwp) :: m !< running index |
---|
[1484] | 954 | |
---|
[4258] | 955 | REAL(wp) :: canopy_height !< canopy height for lad-profile construction |
---|
[2007] | 956 | REAL(wp) :: gradient !< gradient for lad-profile construction |
---|
[4258] | 957 | REAL(wp) :: int_bpdf !< vertical integral for lad-profile construction |
---|
| 958 | REAL(wp) :: lad_max !< maximum LAD value in the model domain, used to perform a check |
---|
[3241] | 959 | |
---|
[3885] | 960 | IF ( debug_output ) CALL debug_message( 'pcm_init', 'start' ) |
---|
[1484] | 961 | ! |
---|
| 962 | !-- Allocate one-dimensional arrays for the computation of the |
---|
| 963 | !-- leaf area density (lad) profile |
---|
| 964 | ALLOCATE( lad(0:nz+1), pre_lad(0:nz+1) ) |
---|
| 965 | lad = 0.0_wp |
---|
| 966 | pre_lad = 0.0_wp |
---|
| 967 | |
---|
| 968 | ! |
---|
[1826] | 969 | !-- Set flag that indicates that the lad-profile shall be calculated by using |
---|
| 970 | !-- a beta probability density function |
---|
| 971 | IF ( alpha_lad /= 9999999.9_wp .AND. beta_lad /= 9999999.9_wp ) THEN |
---|
| 972 | calc_beta_lad_profile = .TRUE. |
---|
| 973 | ENDIF |
---|
| 974 | |
---|
| 975 | |
---|
| 976 | ! |
---|
[1484] | 977 | !-- Compute the profile of leaf area density used in the plant |
---|
| 978 | !-- canopy model. The profile can either be constructed from |
---|
| 979 | !-- prescribed vertical gradients of the leaf area density or by |
---|
| 980 | !-- using a beta probability density function (see e.g. Markkanen et al., |
---|
| 981 | !-- 2003: Boundary-Layer Meteorology, 106, 437-459) |
---|
| 982 | IF ( .NOT. calc_beta_lad_profile ) THEN |
---|
| 983 | |
---|
| 984 | ! |
---|
| 985 | !-- Use vertical gradients for lad-profile construction |
---|
| 986 | i = 1 |
---|
| 987 | gradient = 0.0_wp |
---|
| 988 | |
---|
[3294] | 989 | IF ( .NOT. ocean_mode ) THEN |
---|
[1484] | 990 | |
---|
| 991 | lad(0) = lad_surface |
---|
| 992 | lad_vertical_gradient_level_ind(1) = 0 |
---|
| 993 | |
---|
| 994 | DO k = 1, pch_index |
---|
| 995 | IF ( i < 11 ) THEN |
---|
| 996 | IF ( lad_vertical_gradient_level(i) < zu(k) .AND. & |
---|
| 997 | lad_vertical_gradient_level(i) >= 0.0_wp ) THEN |
---|
| 998 | gradient = lad_vertical_gradient(i) |
---|
| 999 | lad_vertical_gradient_level_ind(i) = k - 1 |
---|
| 1000 | i = i + 1 |
---|
| 1001 | ENDIF |
---|
| 1002 | ENDIF |
---|
| 1003 | IF ( gradient /= 0.0_wp ) THEN |
---|
| 1004 | IF ( k /= 1 ) THEN |
---|
| 1005 | lad(k) = lad(k-1) + dzu(k) * gradient |
---|
| 1006 | ELSE |
---|
| 1007 | lad(k) = lad_surface + dzu(k) * gradient |
---|
| 1008 | ENDIF |
---|
| 1009 | ELSE |
---|
| 1010 | lad(k) = lad(k-1) |
---|
| 1011 | ENDIF |
---|
| 1012 | ENDDO |
---|
| 1013 | |
---|
| 1014 | ENDIF |
---|
| 1015 | |
---|
| 1016 | ! |
---|
| 1017 | !-- In case of no given leaf area density gradients, choose a vanishing |
---|
| 1018 | !-- gradient. This information is used for the HEADER and the RUN_CONTROL |
---|
| 1019 | !-- file. |
---|
| 1020 | IF ( lad_vertical_gradient_level(1) == -9999999.9_wp ) THEN |
---|
| 1021 | lad_vertical_gradient_level(1) = 0.0_wp |
---|
| 1022 | ENDIF |
---|
| 1023 | |
---|
| 1024 | ELSE |
---|
| 1025 | |
---|
| 1026 | ! |
---|
| 1027 | !-- Use beta function for lad-profile construction |
---|
| 1028 | int_bpdf = 0.0_wp |
---|
[3065] | 1029 | canopy_height = zw(pch_index) |
---|
[1484] | 1030 | |
---|
[2232] | 1031 | DO k = 0, pch_index |
---|
[1484] | 1032 | int_bpdf = int_bpdf + & |
---|
[1826] | 1033 | ( ( ( zw(k) / canopy_height )**( alpha_lad-1.0_wp ) ) * & |
---|
| 1034 | ( ( 1.0_wp - ( zw(k) / canopy_height ) )**( & |
---|
| 1035 | beta_lad-1.0_wp ) ) & |
---|
| 1036 | * ( ( zw(k+1)-zw(k) ) / canopy_height ) ) |
---|
[1484] | 1037 | ENDDO |
---|
| 1038 | |
---|
| 1039 | ! |
---|
| 1040 | !-- Preliminary lad profile (defined on w-grid) |
---|
[2232] | 1041 | DO k = 0, pch_index |
---|
[1826] | 1042 | pre_lad(k) = lai_beta * & |
---|
| 1043 | ( ( ( zw(k) / canopy_height )**( alpha_lad-1.0_wp ) ) & |
---|
| 1044 | * ( ( 1.0_wp - ( zw(k) / canopy_height ) )**( & |
---|
| 1045 | beta_lad-1.0_wp ) ) / int_bpdf & |
---|
| 1046 | ) / canopy_height |
---|
[1484] | 1047 | ENDDO |
---|
| 1048 | |
---|
| 1049 | ! |
---|
| 1050 | !-- Final lad profile (defined on scalar-grid level, since most prognostic |
---|
| 1051 | !-- quantities are defined there, hence, less interpolation is required |
---|
| 1052 | !-- when calculating the canopy tendencies) |
---|
| 1053 | lad(0) = pre_lad(0) |
---|
[2232] | 1054 | DO k = 1, pch_index |
---|
[1484] | 1055 | lad(k) = 0.5 * ( pre_lad(k-1) + pre_lad(k) ) |
---|
[4302] | 1056 | ENDDO |
---|
[1484] | 1057 | |
---|
| 1058 | ENDIF |
---|
| 1059 | |
---|
| 1060 | ! |
---|
[2213] | 1061 | !-- Allocate 3D-array for the leaf area density (lad_s). |
---|
[1484] | 1062 | ALLOCATE( lad_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 1063 | ! |
---|
| 1064 | !-- Initialize canopy parameters cdc (canopy drag coefficient), |
---|
| 1065 | !-- lsec (leaf scalar exchange coefficient), lsc (leaf surface concentration) |
---|
| 1066 | !-- with the prescribed values |
---|
| 1067 | cdc = canopy_drag_coeff |
---|
| 1068 | lsec = leaf_scalar_exch_coeff |
---|
| 1069 | lsc = leaf_surface_conc |
---|
| 1070 | |
---|
| 1071 | ! |
---|
| 1072 | !-- Initialization of the canopy coverage in the model domain: |
---|
| 1073 | !-- Setting the parameter canopy_mode = 'block' initializes a canopy, which |
---|
| 1074 | !-- fully covers the domain surface |
---|
| 1075 | SELECT CASE ( TRIM( canopy_mode ) ) |
---|
| 1076 | |
---|
| 1077 | CASE( 'block' ) |
---|
| 1078 | |
---|
| 1079 | DO i = nxlg, nxrg |
---|
| 1080 | DO j = nysg, nyng |
---|
| 1081 | lad_s(:,j,i) = lad(:) |
---|
| 1082 | ENDDO |
---|
| 1083 | ENDDO |
---|
| 1084 | |
---|
[2007] | 1085 | CASE ( 'read_from_file_3d' ) |
---|
| 1086 | ! |
---|
[2696] | 1087 | !-- Initialize LAD with data from file. If LAD is given in NetCDF file, |
---|
| 1088 | !-- use these values, else take LAD profiles from ASCII file. |
---|
| 1089 | !-- Please note, in NetCDF file LAD is only given up to the maximum |
---|
| 1090 | !-- canopy top, indicated by leaf_area_density_f%nz. |
---|
| 1091 | lad_s = 0.0_wp |
---|
| 1092 | IF ( leaf_area_density_f%from_file ) THEN |
---|
| 1093 | ! |
---|
| 1094 | !-- Set also pch_index, used to be the upper bound of the vertical |
---|
| 1095 | !-- loops. Therefore, use the global top of the canopy layer. |
---|
| 1096 | pch_index = leaf_area_density_f%nz - 1 |
---|
| 1097 | |
---|
| 1098 | DO i = nxl, nxr |
---|
| 1099 | DO j = nys, nyn |
---|
| 1100 | DO k = 0, leaf_area_density_f%nz - 1 |
---|
[3864] | 1101 | IF ( leaf_area_density_f%var(k,j,i) /= & |
---|
| 1102 | leaf_area_density_f%fill ) & |
---|
[2696] | 1103 | lad_s(k,j,i) = leaf_area_density_f%var(k,j,i) |
---|
| 1104 | ENDDO |
---|
[4302] | 1105 | ! |
---|
| 1106 | !-- Check if resolved vegetation is mapped onto buildings. |
---|
| 1107 | !-- Even if the user defines LAD only for non-building covered |
---|
| 1108 | !-- grid points, the filter process of topography may cause |
---|
| 1109 | !-- that LAD overlaps with buildings. This case, an |
---|
| 1110 | !-- informative message is given and the LAD field is set to |
---|
| 1111 | !-- zero at these |
---|
| 1112 | IF ( ANY( lad_s(:,j,i) /= 0.0_wp ) .AND. & |
---|
| 1113 | ANY( BTEST( wall_flags_0(:,j,i), 6 ) ) ) THEN |
---|
| 1114 | lad_s(:,j,i) = 0.0_wp |
---|
| 1115 | WRITE( message_string, * ) & |
---|
| 1116 | 'Resolved plant-canopy is ' // & |
---|
| 1117 | 'is defined on top of a building ' //& |
---|
| 1118 | '- lad is omitted at this grid ' //& |
---|
| 1119 | 'point: (i,j) = ', i, j |
---|
| 1120 | CALL message( 'pcm_init', 'PA0313', 0, 0, myid, 6, 0 ) |
---|
| 1121 | ENDIF |
---|
[2696] | 1122 | ENDDO |
---|
| 1123 | ENDDO |
---|
| 1124 | CALL exchange_horiz( lad_s, nbgp ) |
---|
| 1125 | ! |
---|
| 1126 | ! ASCII file |
---|
[2007] | 1127 | !-- Initialize canopy parameters cdc (canopy drag coefficient), |
---|
| 1128 | !-- lsec (leaf scalar exchange coefficient), lsc (leaf surface concentration) |
---|
| 1129 | !-- from file which contains complete 3D data (separate vertical profiles for |
---|
| 1130 | !-- each location). |
---|
[2696] | 1131 | ELSE |
---|
| 1132 | CALL pcm_read_plant_canopy_3d |
---|
| 1133 | ENDIF |
---|
[2007] | 1134 | |
---|
[1484] | 1135 | CASE DEFAULT |
---|
| 1136 | ! |
---|
[2007] | 1137 | !-- The DEFAULT case is reached either if the parameter |
---|
| 1138 | !-- canopy mode contains a wrong character string or if the |
---|
| 1139 | !-- user has coded a special case in the user interface. |
---|
| 1140 | !-- There, the subroutine user_init_plant_canopy checks |
---|
| 1141 | !-- which of these two conditions applies. |
---|
| 1142 | CALL user_init_plant_canopy |
---|
[1484] | 1143 | |
---|
| 1144 | END SELECT |
---|
[2696] | 1145 | ! |
---|
[4258] | 1146 | !-- Check that at least one grid point has an LAD /= 0, else this may |
---|
| 1147 | !-- cause errors in the radiation model. |
---|
| 1148 | lad_max = MAXVAL( lad_s ) |
---|
| 1149 | #if defined( __parallel ) |
---|
| 1150 | CALL MPI_ALLREDUCE( MPI_IN_PLACE, lad_max, 1, MPI_REAL, MPI_MAX, & |
---|
| 1151 | comm2d, ierr) |
---|
| 1152 | #endif |
---|
| 1153 | IF ( lad_max <= 0.0_wp ) THEN |
---|
| 1154 | message_string = 'Plant-canopy model is switched-on but no ' // & |
---|
| 1155 | 'plant canopy is present in the model domain.' |
---|
| 1156 | CALL message( 'pcm_init', 'PA0685', 1, 2, 0, 6, 0 ) |
---|
| 1157 | ENDIF |
---|
| 1158 | |
---|
| 1159 | ! |
---|
[2696] | 1160 | !-- Initialize 2D index array indicating canopy top index. |
---|
| 1161 | ALLOCATE( pch_index_ji(nysg:nyng,nxlg:nxrg) ) |
---|
| 1162 | pch_index_ji = 0 |
---|
[4187] | 1163 | |
---|
[2696] | 1164 | DO i = nxl, nxr |
---|
| 1165 | DO j = nys, nyn |
---|
| 1166 | DO k = 0, pch_index |
---|
| 1167 | IF ( lad_s(k,j,i) /= 0 ) pch_index_ji(j,i) = k |
---|
| 1168 | ENDDO |
---|
[1484] | 1169 | ! |
---|
[2696] | 1170 | !-- Check whether topography and local vegetation on top exceed |
---|
| 1171 | !-- height of the model domain. |
---|
[4168] | 1172 | k = topo_top_ind(j,i,0) |
---|
[2696] | 1173 | IF ( k + pch_index_ji(j,i) >= nzt + 1 ) THEN |
---|
| 1174 | message_string = 'Local vegetation height on top of ' // & |
---|
| 1175 | 'topography exceeds height of model domain.' |
---|
[4187] | 1176 | CALL message( 'pcm_init', 'PA0674', 2, 2, 0, 6, 0 ) |
---|
[2696] | 1177 | ENDIF |
---|
| 1178 | |
---|
| 1179 | ENDDO |
---|
| 1180 | ENDDO |
---|
| 1181 | |
---|
| 1182 | CALL exchange_horiz_2d_int( pch_index_ji, nys, nyn, nxl, nxr, nbgp ) |
---|
[3497] | 1183 | ! |
---|
[3449] | 1184 | !-- Calculate global pch_index value (index of top of plant canopy from ground) |
---|
[3497] | 1185 | pch_index = MAXVAL( pch_index_ji ) |
---|
[4187] | 1186 | |
---|
| 1187 | |
---|
[3497] | 1188 | ! |
---|
[3449] | 1189 | !-- Exchange pch_index from all processors |
---|
| 1190 | #if defined( __parallel ) |
---|
[3497] | 1191 | CALL MPI_ALLREDUCE( MPI_IN_PLACE, pch_index, 1, MPI_INTEGER, & |
---|
| 1192 | MPI_MAX, comm2d, ierr) |
---|
[3449] | 1193 | #endif |
---|
| 1194 | |
---|
| 1195 | !-- Allocation of arrays pc_heating_rate, pc_transpiration_rate and pc_latent_rate |
---|
| 1196 | ALLOCATE( pc_heating_rate(0:pch_index,nysg:nyng,nxlg:nxrg) ) |
---|
[4221] | 1197 | pc_heating_rate = 0.0_wp |
---|
| 1198 | |
---|
[3449] | 1199 | IF ( humidity ) THEN |
---|
| 1200 | ALLOCATE( pc_transpiration_rate(0:pch_index,nysg:nyng,nxlg:nxrg) ) |
---|
| 1201 | pc_transpiration_rate = 0.0_wp |
---|
| 1202 | ALLOCATE( pc_latent_rate(0:pch_index,nysg:nyng,nxlg:nxrg) ) |
---|
| 1203 | pc_latent_rate = 0.0_wp |
---|
| 1204 | ENDIF |
---|
[2696] | 1205 | ! |
---|
[2011] | 1206 | !-- Initialization of the canopy heat source distribution due to heating |
---|
| 1207 | !-- of the canopy layers by incoming solar radiation, in case that a non-zero |
---|
| 1208 | !-- value is set for the canopy top heat flux (cthf), which equals the |
---|
| 1209 | !-- available net radiation at canopy top. |
---|
| 1210 | !-- The heat source distribution is calculated by a decaying exponential |
---|
| 1211 | !-- function of the downward cumulative leaf area index (cum_lai_hf), |
---|
| 1212 | !-- assuming that the foliage inside the plant canopy is heated by solar |
---|
| 1213 | !-- radiation penetrating the canopy layers according to the distribution |
---|
| 1214 | !-- of net radiation as suggested by Brown & Covey (1966; Agric. Meteorol. 3, |
---|
| 1215 | !-- 73â96). This approach has been applied e.g. by Shaw & Schumann (1992; |
---|
[2213] | 1216 | !-- Bound.-Layer Meteorol. 61, 47â64). |
---|
[3449] | 1217 | !-- When using the radiation_interactions, canopy heating (pc_heating_rate) |
---|
| 1218 | !-- and plant canopy transpiration (pc_transpiration_rate, pc_latent_rate) |
---|
| 1219 | !-- are calculated in the RTM after the calculation of radiation. |
---|
| 1220 | !-- We cannot use variable radiation_interactions here to determine the situation |
---|
| 1221 | !-- as it is assigned in init_3d_model after the call of pcm_init. |
---|
| 1222 | IF ( cthf /= 0.0_wp ) THEN |
---|
[2213] | 1223 | |
---|
[3449] | 1224 | ALLOCATE( cum_lai_hf(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1484] | 1225 | ! |
---|
[2011] | 1226 | !-- Piecewise calculation of the cumulative leaf area index by vertical |
---|
[1484] | 1227 | !-- integration of the leaf area density |
---|
| 1228 | cum_lai_hf(:,:,:) = 0.0_wp |
---|
| 1229 | DO i = nxlg, nxrg |
---|
| 1230 | DO j = nysg, nyng |
---|
[2696] | 1231 | DO k = pch_index_ji(j,i)-1, 0, -1 |
---|
| 1232 | IF ( k == pch_index_ji(j,i)-1 ) THEN |
---|
[1484] | 1233 | cum_lai_hf(k,j,i) = cum_lai_hf(k+1,j,i) + & |
---|
| 1234 | ( 0.5_wp * lad_s(k+1,j,i) * & |
---|
| 1235 | ( zw(k+1) - zu(k+1) ) ) + & |
---|
| 1236 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+1,j,i) + & |
---|
| 1237 | lad_s(k,j,i) ) + & |
---|
| 1238 | lad_s(k+1,j,i) ) * & |
---|
| 1239 | ( zu(k+1) - zw(k) ) ) |
---|
| 1240 | ELSE |
---|
| 1241 | cum_lai_hf(k,j,i) = cum_lai_hf(k+1,j,i) + & |
---|
| 1242 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+2,j,i) + & |
---|
| 1243 | lad_s(k+1,j,i) ) + & |
---|
| 1244 | lad_s(k+1,j,i) ) * & |
---|
| 1245 | ( zw(k+1) - zu(k+1) ) ) + & |
---|
| 1246 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+1,j,i) + & |
---|
| 1247 | lad_s(k,j,i) ) + & |
---|
| 1248 | lad_s(k+1,j,i) ) * & |
---|
| 1249 | ( zu(k+1) - zw(k) ) ) |
---|
| 1250 | ENDIF |
---|
| 1251 | ENDDO |
---|
| 1252 | ENDDO |
---|
| 1253 | ENDDO |
---|
| 1254 | |
---|
[4278] | 1255 | ! |
---|
[2232] | 1256 | !-- In areas with canopy the surface value of the canopy heat |
---|
| 1257 | !-- flux distribution overrides the surface heat flux (shf) |
---|
| 1258 | !-- Start with default surface type |
---|
| 1259 | DO m = 1, surf_def_h(0)%ns |
---|
[4278] | 1260 | i = surf_def_h(0)%i(m) |
---|
| 1261 | j = surf_def_h(0)%j(m) |
---|
[2232] | 1262 | k = surf_def_h(0)%k(m) |
---|
| 1263 | IF ( cum_lai_hf(0,j,i) /= 0.0_wp ) & |
---|
| 1264 | surf_def_h(0)%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) ) |
---|
| 1265 | ENDDO |
---|
[1484] | 1266 | ! |
---|
[2232] | 1267 | !-- Natural surfaces |
---|
| 1268 | DO m = 1, surf_lsm_h%ns |
---|
[4278] | 1269 | i = surf_lsm_h%i(m) |
---|
| 1270 | j = surf_lsm_h%j(m) |
---|
[2232] | 1271 | k = surf_lsm_h%k(m) |
---|
| 1272 | IF ( cum_lai_hf(0,j,i) /= 0.0_wp ) & |
---|
| 1273 | surf_lsm_h%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) ) |
---|
| 1274 | ENDDO |
---|
| 1275 | ! |
---|
| 1276 | !-- Urban surfaces |
---|
| 1277 | DO m = 1, surf_usm_h%ns |
---|
[4278] | 1278 | i = surf_usm_h%i(m) |
---|
| 1279 | j = surf_usm_h%j(m) |
---|
[2232] | 1280 | k = surf_usm_h%k(m) |
---|
| 1281 | IF ( cum_lai_hf(0,j,i) /= 0.0_wp ) & |
---|
| 1282 | surf_usm_h%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) ) |
---|
| 1283 | ENDDO |
---|
| 1284 | ! |
---|
| 1285 | ! |
---|
[2011] | 1286 | !-- Calculation of the heating rate (K/s) within the different layers of |
---|
[2232] | 1287 | !-- the plant canopy. Calculation is only necessary in areas covered with |
---|
| 1288 | !-- canopy. |
---|
| 1289 | !-- Within the different canopy layers the plant-canopy heating |
---|
| 1290 | !-- rate (pc_heating_rate) is calculated as the vertical |
---|
| 1291 | !-- divergence of the canopy heat fluxes at the top and bottom |
---|
| 1292 | !-- of the respective layer |
---|
[1484] | 1293 | DO i = nxlg, nxrg |
---|
| 1294 | DO j = nysg, nyng |
---|
[2696] | 1295 | DO k = 1, pch_index_ji(j,i) |
---|
[2232] | 1296 | IF ( cum_lai_hf(0,j,i) /= 0.0_wp ) THEN |
---|
[3022] | 1297 | pc_heating_rate(k,j,i) = cthf * & |
---|
| 1298 | ( exp(-ext_coef*cum_lai_hf(k,j,i)) - & |
---|
[2232] | 1299 | exp(-ext_coef*cum_lai_hf(k-1,j,i) ) ) / dzw(k) |
---|
| 1300 | ENDIF |
---|
| 1301 | ENDDO |
---|
[1721] | 1302 | ENDDO |
---|
| 1303 | ENDDO |
---|
[1484] | 1304 | |
---|
| 1305 | ENDIF |
---|
| 1306 | |
---|
[3885] | 1307 | IF ( debug_output ) CALL debug_message( 'pcm_init', 'end' ) |
---|
[1484] | 1308 | |
---|
[3685] | 1309 | |
---|
[1826] | 1310 | END SUBROUTINE pcm_init |
---|
[1484] | 1311 | |
---|
| 1312 | |
---|
[2007] | 1313 | !------------------------------------------------------------------------------! |
---|
| 1314 | ! Description: |
---|
| 1315 | ! ------------ |
---|
[2932] | 1316 | !> Parin for &plant_canopy_parameters for plant canopy model |
---|
[2007] | 1317 | !------------------------------------------------------------------------------! |
---|
| 1318 | SUBROUTINE pcm_parin |
---|
[1484] | 1319 | |
---|
[2746] | 1320 | USE control_parameters, & |
---|
[2932] | 1321 | ONLY: message_string, plant_canopy |
---|
[2007] | 1322 | |
---|
| 1323 | IMPLICIT NONE |
---|
| 1324 | |
---|
| 1325 | CHARACTER (LEN=80) :: line !< dummy string that contains the current line of the parameter file |
---|
| 1326 | |
---|
[2932] | 1327 | NAMELIST /plant_canopy_parameters/ & |
---|
| 1328 | alpha_lad, beta_lad, canopy_drag_coeff, & |
---|
| 1329 | canopy_mode, cthf, & |
---|
[2977] | 1330 | lad_surface, lad_type_coef, & |
---|
[2932] | 1331 | lad_vertical_gradient, & |
---|
| 1332 | lad_vertical_gradient_level, & |
---|
| 1333 | lai_beta, & |
---|
| 1334 | leaf_scalar_exch_coeff, & |
---|
[3449] | 1335 | leaf_surface_conc, pch_index, & |
---|
| 1336 | plant_canopy_transpiration |
---|
[2932] | 1337 | |
---|
[2007] | 1338 | NAMELIST /canopy_par/ alpha_lad, beta_lad, canopy_drag_coeff, & |
---|
| 1339 | canopy_mode, cthf, & |
---|
[2977] | 1340 | lad_surface, lad_type_coef, & |
---|
[2007] | 1341 | lad_vertical_gradient, & |
---|
| 1342 | lad_vertical_gradient_level, & |
---|
| 1343 | lai_beta, & |
---|
| 1344 | leaf_scalar_exch_coeff, & |
---|
[3449] | 1345 | leaf_surface_conc, pch_index, & |
---|
| 1346 | plant_canopy_transpiration |
---|
[3246] | 1347 | |
---|
[2007] | 1348 | line = ' ' |
---|
[3246] | 1349 | |
---|
[2007] | 1350 | ! |
---|
[4258] | 1351 | !-- Try to find plant-canopy model package |
---|
[2007] | 1352 | REWIND ( 11 ) |
---|
| 1353 | line = ' ' |
---|
[3248] | 1354 | DO WHILE ( INDEX( line, '&plant_canopy_parameters' ) == 0 ) |
---|
[3246] | 1355 | READ ( 11, '(A)', END=12 ) line |
---|
[2007] | 1356 | ENDDO |
---|
| 1357 | BACKSPACE ( 11 ) |
---|
| 1358 | |
---|
| 1359 | ! |
---|
| 1360 | !-- Read user-defined namelist |
---|
[3246] | 1361 | READ ( 11, plant_canopy_parameters, ERR = 10 ) |
---|
[2932] | 1362 | |
---|
| 1363 | ! |
---|
[4258] | 1364 | !-- Set flag that indicates that the plant-canopy model is switched on |
---|
[2932] | 1365 | plant_canopy = .TRUE. |
---|
[3246] | 1366 | |
---|
| 1367 | GOTO 14 |
---|
| 1368 | |
---|
| 1369 | 10 BACKSPACE( 11 ) |
---|
[3248] | 1370 | READ( 11 , '(A)') line |
---|
| 1371 | CALL parin_fail_message( 'plant_canopy_parameters', line ) |
---|
[2932] | 1372 | ! |
---|
| 1373 | !-- Try to find old namelist |
---|
[3246] | 1374 | 12 REWIND ( 11 ) |
---|
[2932] | 1375 | line = ' ' |
---|
[3248] | 1376 | DO WHILE ( INDEX( line, '&canopy_par' ) == 0 ) |
---|
[3246] | 1377 | READ ( 11, '(A)', END=14 ) line |
---|
[2932] | 1378 | ENDDO |
---|
| 1379 | BACKSPACE ( 11 ) |
---|
| 1380 | |
---|
| 1381 | ! |
---|
| 1382 | !-- Read user-defined namelist |
---|
[3246] | 1383 | READ ( 11, canopy_par, ERR = 13, END = 14 ) |
---|
[2007] | 1384 | |
---|
[2932] | 1385 | message_string = 'namelist canopy_par is deprecated and will be ' // & |
---|
[3046] | 1386 | 'removed in near future. Please use namelist ' // & |
---|
[2932] | 1387 | 'plant_canopy_parameters instead' |
---|
| 1388 | CALL message( 'pcm_parin', 'PA0487', 0, 1, 0, 6, 0 ) |
---|
[3246] | 1389 | |
---|
[2007] | 1390 | ! |
---|
[4258] | 1391 | !-- Set flag that indicates that the plant-canopy model is switched on |
---|
[2007] | 1392 | plant_canopy = .TRUE. |
---|
| 1393 | |
---|
[3246] | 1394 | GOTO 14 |
---|
[2007] | 1395 | |
---|
[3246] | 1396 | 13 BACKSPACE( 11 ) |
---|
[3248] | 1397 | READ( 11 , '(A)') line |
---|
| 1398 | CALL parin_fail_message( 'canopy_par', line ) |
---|
[3246] | 1399 | |
---|
| 1400 | 14 CONTINUE |
---|
| 1401 | |
---|
| 1402 | |
---|
[2007] | 1403 | END SUBROUTINE pcm_parin |
---|
| 1404 | |
---|
| 1405 | |
---|
| 1406 | |
---|
[1484] | 1407 | !------------------------------------------------------------------------------! |
---|
| 1408 | ! Description: |
---|
| 1409 | ! ------------ |
---|
[2007] | 1410 | ! |
---|
| 1411 | !> Loads 3D plant canopy data from file. File format is as follows: |
---|
| 1412 | !> |
---|
| 1413 | !> num_levels |
---|
[2977] | 1414 | !> dtype,x,y,pctype,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1) |
---|
| 1415 | !> dtype,x,y,pctype,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1) |
---|
| 1416 | !> dtype,x,y,pctype,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1) |
---|
[2007] | 1417 | !> ... |
---|
| 1418 | !> |
---|
| 1419 | !> i.e. first line determines number of levels and further lines represent plant |
---|
| 1420 | !> canopy data, one line per column and variable. In each data line, |
---|
| 1421 | !> dtype represents variable to be set: |
---|
| 1422 | !> |
---|
| 1423 | !> dtype=1: leaf area density (lad_s) |
---|
[2213] | 1424 | !> dtype=2....n: some additional plant canopy input data quantity |
---|
[2007] | 1425 | !> |
---|
| 1426 | !> Zeros are added automatically above num_levels until top of domain. Any |
---|
| 1427 | !> non-specified (x,y) columns have zero values as default. |
---|
| 1428 | !------------------------------------------------------------------------------! |
---|
| 1429 | SUBROUTINE pcm_read_plant_canopy_3d |
---|
[2213] | 1430 | |
---|
| 1431 | USE control_parameters, & |
---|
[3241] | 1432 | ONLY: coupling_char, message_string |
---|
[2007] | 1433 | |
---|
[2213] | 1434 | USE indices, & |
---|
| 1435 | ONLY: nbgp |
---|
| 1436 | |
---|
| 1437 | IMPLICIT NONE |
---|
[2007] | 1438 | |
---|
[2213] | 1439 | INTEGER(iwp) :: dtype !< type of input data (1=lad) |
---|
[2977] | 1440 | INTEGER(iwp) :: pctype !< type of plant canopy (deciduous,non-deciduous,...) |
---|
[2213] | 1441 | INTEGER(iwp) :: i, j !< running index |
---|
| 1442 | INTEGER(iwp) :: nzp !< number of vertical layers of plant canopy |
---|
[3337] | 1443 | INTEGER(iwp) :: nzpltop !< |
---|
| 1444 | INTEGER(iwp) :: nzpl !< |
---|
| 1445 | INTEGER(iwp) :: kk !< |
---|
[2213] | 1446 | |
---|
| 1447 | REAL(wp), DIMENSION(:), ALLOCATABLE :: col !< vertical column of input data |
---|
[2007] | 1448 | |
---|
[2213] | 1449 | ! |
---|
| 1450 | !-- Initialize lad_s array |
---|
| 1451 | lad_s = 0.0_wp |
---|
| 1452 | |
---|
| 1453 | ! |
---|
| 1454 | !-- Open and read plant canopy input data |
---|
[2977] | 1455 | OPEN(152, FILE='PLANT_CANOPY_DATA_3D' // TRIM( coupling_char ), & |
---|
| 1456 | ACCESS='SEQUENTIAL', ACTION='READ', STATUS='OLD', & |
---|
| 1457 | FORM='FORMATTED', ERR=515) |
---|
| 1458 | READ(152, *, ERR=516, END=517) nzp !< read first line = number of vertical layers |
---|
[3337] | 1459 | nzpltop = MIN(nzt+1, nzb+nzp-1) |
---|
| 1460 | nzpl = nzpltop - nzb + 1 !< no. of layers to assign |
---|
[2977] | 1461 | ALLOCATE( col(0:nzp-1) ) |
---|
[2007] | 1462 | |
---|
[2213] | 1463 | DO |
---|
[2977] | 1464 | READ(152, *, ERR=516, END=517) dtype, i, j, pctype, col(:) |
---|
| 1465 | IF ( i < nxlg .OR. i > nxrg .OR. j < nysg .OR. j > nyng ) CYCLE |
---|
| 1466 | |
---|
| 1467 | SELECT CASE (dtype) |
---|
| 1468 | CASE( 1 ) !< leaf area density |
---|
[2213] | 1469 | ! |
---|
[2977] | 1470 | !-- This is just the pure canopy layer assumed to be grounded to |
---|
| 1471 | !-- a flat domain surface. At locations where plant canopy sits |
---|
| 1472 | !-- on top of any kind of topography, the vertical plant column |
---|
| 1473 | !-- must be "lifted", which is done in SUBROUTINE pcm_tendency. |
---|
| 1474 | IF ( pctype < 0 .OR. pctype > 10 ) THEN !< incorrect plant canopy type |
---|
| 1475 | WRITE( message_string, * ) 'Incorrect type of plant canopy. ' // & |
---|
| 1476 | 'Allowed values 0 <= pctype <= 10, ' // & |
---|
| 1477 | 'but pctype is ', pctype |
---|
| 1478 | CALL message( 'pcm_read_plant_canopy_3d', 'PA0349', 1, 2, 0, 6, 0 ) |
---|
| 1479 | ENDIF |
---|
[4168] | 1480 | kk = topo_top_ind(j,i,0) |
---|
[3337] | 1481 | lad_s(nzb:nzpltop-kk, j, i) = col(kk:nzpl-1)*lad_type_coef(pctype) |
---|
[2977] | 1482 | CASE DEFAULT |
---|
| 1483 | WRITE(message_string, '(a,i2,a)') & |
---|
| 1484 | 'Unknown record type in file PLANT_CANOPY_DATA_3D: "', dtype, '"' |
---|
| 1485 | CALL message( 'pcm_read_plant_canopy_3d', 'PA0530', 1, 2, 0, 6, 0 ) |
---|
| 1486 | END SELECT |
---|
[2213] | 1487 | ENDDO |
---|
[2007] | 1488 | |
---|
[2213] | 1489 | 515 message_string = 'error opening file PLANT_CANOPY_DATA_3D' |
---|
| 1490 | CALL message( 'pcm_read_plant_canopy_3d', 'PA0531', 1, 2, 0, 6, 0 ) |
---|
[2007] | 1491 | |
---|
[2213] | 1492 | 516 message_string = 'error reading file PLANT_CANOPY_DATA_3D' |
---|
| 1493 | CALL message( 'pcm_read_plant_canopy_3d', 'PA0532', 1, 2, 0, 6, 0 ) |
---|
| 1494 | |
---|
| 1495 | 517 CLOSE(152) |
---|
[2977] | 1496 | DEALLOCATE( col ) |
---|
[2213] | 1497 | |
---|
| 1498 | CALL exchange_horiz( lad_s, nbgp ) |
---|
[2007] | 1499 | |
---|
| 1500 | END SUBROUTINE pcm_read_plant_canopy_3d |
---|
| 1501 | |
---|
| 1502 | |
---|
| 1503 | |
---|
| 1504 | !------------------------------------------------------------------------------! |
---|
| 1505 | ! Description: |
---|
| 1506 | ! ------------ |
---|
[1682] | 1507 | !> Calculation of the tendency terms, accounting for the effect of the plant |
---|
| 1508 | !> canopy on momentum and scalar quantities. |
---|
| 1509 | !> |
---|
| 1510 | !> The canopy is located where the leaf area density lad_s(k,j,i) > 0.0 |
---|
[1826] | 1511 | !> (defined on scalar grid), as initialized in subroutine pcm_init. |
---|
[1682] | 1512 | !> The lad on the w-grid is vertically interpolated from the surrounding |
---|
| 1513 | !> lad_s. The upper boundary of the canopy is defined on the w-grid at |
---|
| 1514 | !> k = pch_index. Here, the lad is zero. |
---|
| 1515 | !> |
---|
| 1516 | !> The canopy drag must be limited (previously accounted for by calculation of |
---|
| 1517 | !> a limiting canopy timestep for the determination of the maximum LES timestep |
---|
| 1518 | !> in subroutine timestep), since it is physically impossible that the canopy |
---|
| 1519 | !> drag alone can locally change the sign of a velocity component. This |
---|
| 1520 | !> limitation is realized by calculating preliminary tendencies and velocities. |
---|
| 1521 | !> It is subsequently checked if the preliminary new velocity has a different |
---|
| 1522 | !> sign than the current velocity. If so, the tendency is limited in a way that |
---|
| 1523 | !> the velocity can at maximum be reduced to zero by the canopy drag. |
---|
| 1524 | !> |
---|
| 1525 | !> |
---|
| 1526 | !> Call for all grid points |
---|
[1484] | 1527 | !------------------------------------------------------------------------------! |
---|
[1826] | 1528 | SUBROUTINE pcm_tendency( component ) |
---|
[138] | 1529 | |
---|
| 1530 | |
---|
[1320] | 1531 | USE control_parameters, & |
---|
[1484] | 1532 | ONLY: dt_3d, message_string |
---|
[1320] | 1533 | |
---|
| 1534 | USE kinds |
---|
| 1535 | |
---|
[138] | 1536 | IMPLICIT NONE |
---|
| 1537 | |
---|
[1682] | 1538 | INTEGER(iwp) :: component !< prognostic variable (u,v,w,pt,q,e) |
---|
| 1539 | INTEGER(iwp) :: i !< running index |
---|
| 1540 | INTEGER(iwp) :: j !< running index |
---|
| 1541 | INTEGER(iwp) :: k !< running index |
---|
[2232] | 1542 | INTEGER(iwp) :: k_wall !< vertical index of topography top |
---|
[1721] | 1543 | INTEGER(iwp) :: kk !< running index for flat lad arrays |
---|
[1484] | 1544 | |
---|
[1682] | 1545 | REAL(wp) :: ddt_3d !< inverse of the LES timestep (dt_3d) |
---|
| 1546 | REAL(wp) :: lad_local !< local lad value |
---|
| 1547 | REAL(wp) :: pre_tend !< preliminary tendency |
---|
| 1548 | REAL(wp) :: pre_u !< preliminary u-value |
---|
| 1549 | REAL(wp) :: pre_v !< preliminary v-value |
---|
| 1550 | REAL(wp) :: pre_w !< preliminary w-value |
---|
[1484] | 1551 | |
---|
| 1552 | |
---|
| 1553 | ddt_3d = 1.0_wp / dt_3d |
---|
[138] | 1554 | |
---|
| 1555 | ! |
---|
[1484] | 1556 | !-- Compute drag for the three velocity components and the SGS-TKE: |
---|
[138] | 1557 | SELECT CASE ( component ) |
---|
| 1558 | |
---|
| 1559 | ! |
---|
| 1560 | !-- u-component |
---|
| 1561 | CASE ( 1 ) |
---|
| 1562 | DO i = nxlu, nxr |
---|
| 1563 | DO j = nys, nyn |
---|
[2232] | 1564 | ! |
---|
| 1565 | !-- Determine topography-top index on u-grid |
---|
[4168] | 1566 | k_wall = topo_top_ind(j,i,1) |
---|
[2696] | 1567 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[1484] | 1568 | |
---|
[2232] | 1569 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1484] | 1570 | ! |
---|
| 1571 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 1572 | !-- the lad on the u-grid at index (k,j,i) is equal to |
---|
| 1573 | !-- lad_s(k,j,i), rather than being interpolated from the |
---|
| 1574 | !-- surrounding lad_s, because this would yield smaller lad |
---|
| 1575 | !-- at the canopy boundaries than inside of the canopy. |
---|
| 1576 | !-- For the same reason, the lad at the rightmost(i+1)canopy |
---|
| 1577 | !-- boundary on the u-grid equals lad_s(k,j,i). |
---|
[1721] | 1578 | lad_local = lad_s(kk,j,i) |
---|
| 1579 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j,i-1) > 0.0_wp )& |
---|
| 1580 | THEN |
---|
| 1581 | lad_local = lad_s(kk,j,i-1) |
---|
[1484] | 1582 | ENDIF |
---|
| 1583 | |
---|
| 1584 | pre_tend = 0.0_wp |
---|
| 1585 | pre_u = 0.0_wp |
---|
| 1586 | ! |
---|
| 1587 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1588 | pre_tend = - cdc * & |
---|
| 1589 | lad_local * & |
---|
| 1590 | SQRT( u(k,j,i)**2 + & |
---|
| 1591 | ( 0.25_wp * ( v(k,j,i-1) + & |
---|
| 1592 | v(k,j,i) + & |
---|
| 1593 | v(k,j+1,i) + & |
---|
| 1594 | v(k,j+1,i-1) ) & |
---|
| 1595 | )**2 + & |
---|
| 1596 | ( 0.25_wp * ( w(k-1,j,i-1) + & |
---|
| 1597 | w(k-1,j,i) + & |
---|
| 1598 | w(k,j,i-1) + & |
---|
| 1599 | w(k,j,i) ) & |
---|
| 1600 | )**2 & |
---|
| 1601 | ) * & |
---|
| 1602 | u(k,j,i) |
---|
| 1603 | |
---|
| 1604 | ! |
---|
| 1605 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1606 | pre_u = u(k,j,i) + dt_3d * pre_tend |
---|
| 1607 | ! |
---|
| 1608 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1609 | !-- and in case the signs are different, limit the tendency |
---|
| 1610 | IF ( SIGN(pre_u,u(k,j,i)) /= pre_u ) THEN |
---|
| 1611 | pre_tend = - u(k,j,i) * ddt_3d |
---|
| 1612 | ELSE |
---|
| 1613 | pre_tend = pre_tend |
---|
| 1614 | ENDIF |
---|
| 1615 | ! |
---|
| 1616 | !-- Calculate final tendency |
---|
| 1617 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1618 | |
---|
[138] | 1619 | ENDDO |
---|
| 1620 | ENDDO |
---|
| 1621 | ENDDO |
---|
| 1622 | |
---|
| 1623 | ! |
---|
| 1624 | !-- v-component |
---|
| 1625 | CASE ( 2 ) |
---|
| 1626 | DO i = nxl, nxr |
---|
| 1627 | DO j = nysv, nyn |
---|
[2232] | 1628 | ! |
---|
| 1629 | !-- Determine topography-top index on v-grid |
---|
[4168] | 1630 | k_wall = topo_top_ind(j,i,2) |
---|
[2317] | 1631 | |
---|
[2696] | 1632 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[1484] | 1633 | |
---|
[2232] | 1634 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1484] | 1635 | ! |
---|
| 1636 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 1637 | !-- the lad on the v-grid at index (k,j,i) is equal to |
---|
| 1638 | !-- lad_s(k,j,i), rather than being interpolated from the |
---|
| 1639 | !-- surrounding lad_s, because this would yield smaller lad |
---|
| 1640 | !-- at the canopy boundaries than inside of the canopy. |
---|
| 1641 | !-- For the same reason, the lad at the northmost(j+1) canopy |
---|
| 1642 | !-- boundary on the v-grid equals lad_s(k,j,i). |
---|
[1721] | 1643 | lad_local = lad_s(kk,j,i) |
---|
| 1644 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j-1,i) > 0.0_wp )& |
---|
| 1645 | THEN |
---|
| 1646 | lad_local = lad_s(kk,j-1,i) |
---|
[1484] | 1647 | ENDIF |
---|
| 1648 | |
---|
| 1649 | pre_tend = 0.0_wp |
---|
| 1650 | pre_v = 0.0_wp |
---|
| 1651 | ! |
---|
| 1652 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1653 | pre_tend = - cdc * & |
---|
| 1654 | lad_local * & |
---|
| 1655 | SQRT( ( 0.25_wp * ( u(k,j-1,i) + & |
---|
| 1656 | u(k,j-1,i+1) + & |
---|
| 1657 | u(k,j,i) + & |
---|
| 1658 | u(k,j,i+1) ) & |
---|
| 1659 | )**2 + & |
---|
| 1660 | v(k,j,i)**2 + & |
---|
| 1661 | ( 0.25_wp * ( w(k-1,j-1,i) + & |
---|
| 1662 | w(k-1,j,i) + & |
---|
| 1663 | w(k,j-1,i) + & |
---|
| 1664 | w(k,j,i) ) & |
---|
| 1665 | )**2 & |
---|
| 1666 | ) * & |
---|
| 1667 | v(k,j,i) |
---|
| 1668 | |
---|
| 1669 | ! |
---|
| 1670 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1671 | pre_v = v(k,j,i) + dt_3d * pre_tend |
---|
| 1672 | ! |
---|
| 1673 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1674 | !-- and in case the signs are different, limit the tendency |
---|
| 1675 | IF ( SIGN(pre_v,v(k,j,i)) /= pre_v ) THEN |
---|
| 1676 | pre_tend = - v(k,j,i) * ddt_3d |
---|
| 1677 | ELSE |
---|
| 1678 | pre_tend = pre_tend |
---|
| 1679 | ENDIF |
---|
| 1680 | ! |
---|
| 1681 | !-- Calculate final tendency |
---|
| 1682 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1683 | |
---|
[138] | 1684 | ENDDO |
---|
| 1685 | ENDDO |
---|
| 1686 | ENDDO |
---|
| 1687 | |
---|
| 1688 | ! |
---|
| 1689 | !-- w-component |
---|
| 1690 | CASE ( 3 ) |
---|
| 1691 | DO i = nxl, nxr |
---|
| 1692 | DO j = nys, nyn |
---|
[2232] | 1693 | ! |
---|
| 1694 | !-- Determine topography-top index on w-grid |
---|
[4168] | 1695 | k_wall = topo_top_ind(j,i,3) |
---|
[2317] | 1696 | |
---|
[2696] | 1697 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) - 1 |
---|
[1484] | 1698 | |
---|
[2232] | 1699 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1721] | 1700 | |
---|
[1484] | 1701 | pre_tend = 0.0_wp |
---|
| 1702 | pre_w = 0.0_wp |
---|
| 1703 | ! |
---|
| 1704 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1705 | pre_tend = - cdc * & |
---|
| 1706 | (0.5_wp * & |
---|
[1721] | 1707 | ( lad_s(kk+1,j,i) + lad_s(kk,j,i) )) * & |
---|
[1484] | 1708 | SQRT( ( 0.25_wp * ( u(k,j,i) + & |
---|
| 1709 | u(k,j,i+1) + & |
---|
| 1710 | u(k+1,j,i) + & |
---|
| 1711 | u(k+1,j,i+1) ) & |
---|
| 1712 | )**2 + & |
---|
| 1713 | ( 0.25_wp * ( v(k,j,i) + & |
---|
| 1714 | v(k,j+1,i) + & |
---|
| 1715 | v(k+1,j,i) + & |
---|
| 1716 | v(k+1,j+1,i) ) & |
---|
| 1717 | )**2 + & |
---|
| 1718 | w(k,j,i)**2 & |
---|
| 1719 | ) * & |
---|
| 1720 | w(k,j,i) |
---|
| 1721 | ! |
---|
| 1722 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1723 | pre_w = w(k,j,i) + dt_3d * pre_tend |
---|
| 1724 | ! |
---|
| 1725 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1726 | !-- and in case the signs are different, limit the tendency |
---|
| 1727 | IF ( SIGN(pre_w,w(k,j,i)) /= pre_w ) THEN |
---|
| 1728 | pre_tend = - w(k,j,i) * ddt_3d |
---|
| 1729 | ELSE |
---|
| 1730 | pre_tend = pre_tend |
---|
| 1731 | ENDIF |
---|
| 1732 | ! |
---|
| 1733 | !-- Calculate final tendency |
---|
| 1734 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1735 | |
---|
[138] | 1736 | ENDDO |
---|
| 1737 | ENDDO |
---|
| 1738 | ENDDO |
---|
| 1739 | |
---|
| 1740 | ! |
---|
[153] | 1741 | !-- potential temperature |
---|
[138] | 1742 | CASE ( 4 ) |
---|
[3449] | 1743 | IF ( humidity ) THEN |
---|
| 1744 | DO i = nxl, nxr |
---|
| 1745 | DO j = nys, nyn |
---|
| 1746 | !-- Determine topography-top index on scalar-grid |
---|
[4168] | 1747 | k_wall = topo_top_ind(j,i,0) |
---|
[3449] | 1748 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
| 1749 | kk = k - k_wall !- lad arrays are defined flat |
---|
| 1750 | tend(k,j,i) = tend(k,j,i) + pc_heating_rate(kk,j,i) - pc_latent_rate(kk,j,i) |
---|
| 1751 | ENDDO |
---|
[153] | 1752 | ENDDO |
---|
| 1753 | ENDDO |
---|
[3449] | 1754 | ELSE |
---|
| 1755 | DO i = nxl, nxr |
---|
| 1756 | DO j = nys, nyn |
---|
| 1757 | !-- Determine topography-top index on scalar-grid |
---|
[4168] | 1758 | k_wall = topo_top_ind(j,i,0) |
---|
[3449] | 1759 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
| 1760 | kk = k - k_wall !- lad arrays are defined flat |
---|
| 1761 | tend(k,j,i) = tend(k,j,i) + pc_heating_rate(kk,j,i) |
---|
| 1762 | ENDDO |
---|
| 1763 | ENDDO |
---|
| 1764 | ENDDO |
---|
| 1765 | ENDIF |
---|
[153] | 1766 | |
---|
| 1767 | ! |
---|
[1960] | 1768 | !-- humidity |
---|
[153] | 1769 | CASE ( 5 ) |
---|
| 1770 | DO i = nxl, nxr |
---|
| 1771 | DO j = nys, nyn |
---|
[2232] | 1772 | ! |
---|
| 1773 | !-- Determine topography-top index on scalar-grid |
---|
[4168] | 1774 | k_wall = topo_top_ind(j,i,0) |
---|
[2317] | 1775 | |
---|
[2696] | 1776 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1777 | |
---|
| 1778 | kk = k - k_wall !- lad arrays are defined flat |
---|
[3014] | 1779 | |
---|
[3449] | 1780 | IF ( .NOT. plant_canopy_transpiration ) THEN |
---|
| 1781 | ! pc_transpiration_rate is calculated in radiation model |
---|
| 1782 | ! in case of plant_canopy_transpiration = .T. |
---|
| 1783 | ! to include also the dependecy to the radiation |
---|
| 1784 | ! in the plant canopy box |
---|
[3582] | 1785 | pc_transpiration_rate(kk,j,i) = - lsec & |
---|
| 1786 | * lad_s(kk,j,i) * & |
---|
| 1787 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1788 | u(k,j,i+1) ) & |
---|
| 1789 | )**2 + & |
---|
| 1790 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1791 | v(k,j+1,i) ) & |
---|
| 1792 | )**2 + & |
---|
| 1793 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 1794 | w(k,j,i) ) & |
---|
| 1795 | )**2 & |
---|
| 1796 | ) * & |
---|
[3449] | 1797 | ( q(k,j,i) - lsc ) |
---|
| 1798 | ENDIF |
---|
| 1799 | |
---|
[3014] | 1800 | tend(k,j,i) = tend(k,j,i) + pc_transpiration_rate(kk,j,i) |
---|
[153] | 1801 | ENDDO |
---|
| 1802 | ENDDO |
---|
| 1803 | ENDDO |
---|
| 1804 | |
---|
| 1805 | ! |
---|
| 1806 | !-- sgs-tke |
---|
| 1807 | CASE ( 6 ) |
---|
| 1808 | DO i = nxl, nxr |
---|
| 1809 | DO j = nys, nyn |
---|
[2232] | 1810 | ! |
---|
| 1811 | !-- Determine topography-top index on scalar-grid |
---|
[4168] | 1812 | k_wall = topo_top_ind(j,i,0) |
---|
[2317] | 1813 | |
---|
[2696] | 1814 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1815 | |
---|
| 1816 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1484] | 1817 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1818 | 2.0_wp * cdc * & |
---|
[1721] | 1819 | lad_s(kk,j,i) * & |
---|
[1484] | 1820 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1821 | u(k,j,i+1) ) & |
---|
| 1822 | )**2 + & |
---|
| 1823 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1824 | v(k,j+1,i) ) & |
---|
| 1825 | )**2 + & |
---|
| 1826 | ( 0.5_wp * ( w(k,j,i) + & |
---|
| 1827 | w(k+1,j,i) ) & |
---|
| 1828 | )**2 & |
---|
| 1829 | ) * & |
---|
| 1830 | e(k,j,i) |
---|
[138] | 1831 | ENDDO |
---|
| 1832 | ENDDO |
---|
| 1833 | ENDDO |
---|
[1960] | 1834 | ! |
---|
| 1835 | !-- scalar concentration |
---|
| 1836 | CASE ( 7 ) |
---|
| 1837 | DO i = nxl, nxr |
---|
| 1838 | DO j = nys, nyn |
---|
[2232] | 1839 | ! |
---|
| 1840 | !-- Determine topography-top index on scalar-grid |
---|
[4168] | 1841 | k_wall = topo_top_ind(j,i,0) |
---|
[2317] | 1842 | |
---|
[2696] | 1843 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1844 | |
---|
| 1845 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1960] | 1846 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1847 | lsec * & |
---|
| 1848 | lad_s(kk,j,i) * & |
---|
| 1849 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1850 | u(k,j,i+1) ) & |
---|
| 1851 | )**2 + & |
---|
| 1852 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1853 | v(k,j+1,i) ) & |
---|
| 1854 | )**2 + & |
---|
| 1855 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 1856 | w(k,j,i) ) & |
---|
| 1857 | )**2 & |
---|
| 1858 | ) * & |
---|
| 1859 | ( s(k,j,i) - lsc ) |
---|
| 1860 | ENDDO |
---|
| 1861 | ENDDO |
---|
| 1862 | ENDDO |
---|
[1484] | 1863 | |
---|
| 1864 | |
---|
[1960] | 1865 | |
---|
[138] | 1866 | CASE DEFAULT |
---|
| 1867 | |
---|
[257] | 1868 | WRITE( message_string, * ) 'wrong component: ', component |
---|
[1826] | 1869 | CALL message( 'pcm_tendency', 'PA0279', 1, 2, 0, 6, 0 ) |
---|
[138] | 1870 | |
---|
| 1871 | END SELECT |
---|
| 1872 | |
---|
[1826] | 1873 | END SUBROUTINE pcm_tendency |
---|
[138] | 1874 | |
---|
| 1875 | |
---|
| 1876 | !------------------------------------------------------------------------------! |
---|
[1484] | 1877 | ! Description: |
---|
| 1878 | ! ------------ |
---|
[1682] | 1879 | !> Calculation of the tendency terms, accounting for the effect of the plant |
---|
| 1880 | !> canopy on momentum and scalar quantities. |
---|
| 1881 | !> |
---|
| 1882 | !> The canopy is located where the leaf area density lad_s(k,j,i) > 0.0 |
---|
[1826] | 1883 | !> (defined on scalar grid), as initialized in subroutine pcm_init. |
---|
[1682] | 1884 | !> The lad on the w-grid is vertically interpolated from the surrounding |
---|
| 1885 | !> lad_s. The upper boundary of the canopy is defined on the w-grid at |
---|
| 1886 | !> k = pch_index. Here, the lad is zero. |
---|
| 1887 | !> |
---|
| 1888 | !> The canopy drag must be limited (previously accounted for by calculation of |
---|
| 1889 | !> a limiting canopy timestep for the determination of the maximum LES timestep |
---|
| 1890 | !> in subroutine timestep), since it is physically impossible that the canopy |
---|
| 1891 | !> drag alone can locally change the sign of a velocity component. This |
---|
| 1892 | !> limitation is realized by calculating preliminary tendencies and velocities. |
---|
| 1893 | !> It is subsequently checked if the preliminary new velocity has a different |
---|
| 1894 | !> sign than the current velocity. If so, the tendency is limited in a way that |
---|
| 1895 | !> the velocity can at maximum be reduced to zero by the canopy drag. |
---|
| 1896 | !> |
---|
| 1897 | !> |
---|
| 1898 | !> Call for grid point i,j |
---|
[138] | 1899 | !------------------------------------------------------------------------------! |
---|
[1826] | 1900 | SUBROUTINE pcm_tendency_ij( i, j, component ) |
---|
[138] | 1901 | |
---|
| 1902 | |
---|
[1320] | 1903 | USE control_parameters, & |
---|
[1484] | 1904 | ONLY: dt_3d, message_string |
---|
[1320] | 1905 | |
---|
| 1906 | USE kinds |
---|
| 1907 | |
---|
[138] | 1908 | IMPLICIT NONE |
---|
| 1909 | |
---|
[1682] | 1910 | INTEGER(iwp) :: component !< prognostic variable (u,v,w,pt,q,e) |
---|
| 1911 | INTEGER(iwp) :: i !< running index |
---|
| 1912 | INTEGER(iwp) :: j !< running index |
---|
| 1913 | INTEGER(iwp) :: k !< running index |
---|
[2232] | 1914 | INTEGER(iwp) :: k_wall !< vertical index of topography top |
---|
[1721] | 1915 | INTEGER(iwp) :: kk !< running index for flat lad arrays |
---|
[138] | 1916 | |
---|
[1682] | 1917 | REAL(wp) :: ddt_3d !< inverse of the LES timestep (dt_3d) |
---|
| 1918 | REAL(wp) :: lad_local !< local lad value |
---|
| 1919 | REAL(wp) :: pre_tend !< preliminary tendency |
---|
| 1920 | REAL(wp) :: pre_u !< preliminary u-value |
---|
| 1921 | REAL(wp) :: pre_v !< preliminary v-value |
---|
| 1922 | REAL(wp) :: pre_w !< preliminary w-value |
---|
[1484] | 1923 | |
---|
| 1924 | |
---|
| 1925 | ddt_3d = 1.0_wp / dt_3d |
---|
[138] | 1926 | ! |
---|
[1484] | 1927 | !-- Compute drag for the three velocity components and the SGS-TKE |
---|
[142] | 1928 | SELECT CASE ( component ) |
---|
[138] | 1929 | |
---|
| 1930 | ! |
---|
[142] | 1931 | !-- u-component |
---|
[1484] | 1932 | CASE ( 1 ) |
---|
[2232] | 1933 | ! |
---|
| 1934 | !-- Determine topography-top index on u-grid |
---|
[4168] | 1935 | k_wall = topo_top_ind(j,i,1) |
---|
[2696] | 1936 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[2317] | 1937 | |
---|
[2696] | 1938 | kk = k - k_wall !- lad arrays are defined flat |
---|
[138] | 1939 | |
---|
| 1940 | ! |
---|
[1484] | 1941 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 1942 | !-- the lad on the u-grid at index (k,j,i) is equal to lad_s(k,j,i), |
---|
| 1943 | !-- rather than being interpolated from the surrounding lad_s, |
---|
| 1944 | !-- because this would yield smaller lad at the canopy boundaries |
---|
| 1945 | !-- than inside of the canopy. |
---|
| 1946 | !-- For the same reason, the lad at the rightmost(i+1)canopy |
---|
| 1947 | !-- boundary on the u-grid equals lad_s(k,j,i). |
---|
[1721] | 1948 | lad_local = lad_s(kk,j,i) |
---|
| 1949 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j,i-1) > 0.0_wp ) THEN |
---|
| 1950 | lad_local = lad_s(kk,j,i-1) |
---|
[1484] | 1951 | ENDIF |
---|
| 1952 | |
---|
| 1953 | pre_tend = 0.0_wp |
---|
| 1954 | pre_u = 0.0_wp |
---|
| 1955 | ! |
---|
| 1956 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1957 | pre_tend = - cdc * & |
---|
| 1958 | lad_local * & |
---|
| 1959 | SQRT( u(k,j,i)**2 + & |
---|
| 1960 | ( 0.25_wp * ( v(k,j,i-1) + & |
---|
| 1961 | v(k,j,i) + & |
---|
| 1962 | v(k,j+1,i) + & |
---|
| 1963 | v(k,j+1,i-1) ) & |
---|
| 1964 | )**2 + & |
---|
| 1965 | ( 0.25_wp * ( w(k-1,j,i-1) + & |
---|
| 1966 | w(k-1,j,i) + & |
---|
| 1967 | w(k,j,i-1) + & |
---|
| 1968 | w(k,j,i) ) & |
---|
| 1969 | )**2 & |
---|
| 1970 | ) * & |
---|
| 1971 | u(k,j,i) |
---|
| 1972 | |
---|
| 1973 | ! |
---|
| 1974 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1975 | pre_u = u(k,j,i) + dt_3d * pre_tend |
---|
| 1976 | ! |
---|
| 1977 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1978 | !-- and in case the signs are different, limit the tendency |
---|
| 1979 | IF ( SIGN(pre_u,u(k,j,i)) /= pre_u ) THEN |
---|
| 1980 | pre_tend = - u(k,j,i) * ddt_3d |
---|
| 1981 | ELSE |
---|
| 1982 | pre_tend = pre_tend |
---|
| 1983 | ENDIF |
---|
| 1984 | ! |
---|
| 1985 | !-- Calculate final tendency |
---|
| 1986 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1987 | ENDDO |
---|
| 1988 | |
---|
| 1989 | |
---|
| 1990 | ! |
---|
[142] | 1991 | !-- v-component |
---|
[1484] | 1992 | CASE ( 2 ) |
---|
[2232] | 1993 | ! |
---|
| 1994 | !-- Determine topography-top index on v-grid |
---|
[4168] | 1995 | k_wall = topo_top_ind(j,i,2) |
---|
[2317] | 1996 | |
---|
[2696] | 1997 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[138] | 1998 | |
---|
[2232] | 1999 | kk = k - k_wall !- lad arrays are defined flat |
---|
[138] | 2000 | ! |
---|
[1484] | 2001 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 2002 | !-- the lad on the v-grid at index (k,j,i) is equal to lad_s(k,j,i), |
---|
| 2003 | !-- rather than being interpolated from the surrounding lad_s, |
---|
| 2004 | !-- because this would yield smaller lad at the canopy boundaries |
---|
| 2005 | !-- than inside of the canopy. |
---|
| 2006 | !-- For the same reason, the lad at the northmost(j+1)canopy |
---|
| 2007 | !-- boundary on the v-grid equals lad_s(k,j,i). |
---|
[1721] | 2008 | lad_local = lad_s(kk,j,i) |
---|
| 2009 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j-1,i) > 0.0_wp ) THEN |
---|
| 2010 | lad_local = lad_s(kk,j-1,i) |
---|
[1484] | 2011 | ENDIF |
---|
| 2012 | |
---|
| 2013 | pre_tend = 0.0_wp |
---|
| 2014 | pre_v = 0.0_wp |
---|
| 2015 | ! |
---|
| 2016 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 2017 | pre_tend = - cdc * & |
---|
| 2018 | lad_local * & |
---|
| 2019 | SQRT( ( 0.25_wp * ( u(k,j-1,i) + & |
---|
| 2020 | u(k,j-1,i+1) + & |
---|
| 2021 | u(k,j,i) + & |
---|
| 2022 | u(k,j,i+1) ) & |
---|
| 2023 | )**2 + & |
---|
| 2024 | v(k,j,i)**2 + & |
---|
| 2025 | ( 0.25_wp * ( w(k-1,j-1,i) + & |
---|
| 2026 | w(k-1,j,i) + & |
---|
| 2027 | w(k,j-1,i) + & |
---|
| 2028 | w(k,j,i) ) & |
---|
| 2029 | )**2 & |
---|
| 2030 | ) * & |
---|
| 2031 | v(k,j,i) |
---|
| 2032 | |
---|
| 2033 | ! |
---|
| 2034 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 2035 | pre_v = v(k,j,i) + dt_3d * pre_tend |
---|
| 2036 | ! |
---|
| 2037 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 2038 | !-- and in case the signs are different, limit the tendency |
---|
| 2039 | IF ( SIGN(pre_v,v(k,j,i)) /= pre_v ) THEN |
---|
| 2040 | pre_tend = - v(k,j,i) * ddt_3d |
---|
| 2041 | ELSE |
---|
| 2042 | pre_tend = pre_tend |
---|
| 2043 | ENDIF |
---|
| 2044 | ! |
---|
| 2045 | !-- Calculate final tendency |
---|
| 2046 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 2047 | ENDDO |
---|
| 2048 | |
---|
| 2049 | |
---|
| 2050 | ! |
---|
[142] | 2051 | !-- w-component |
---|
[1484] | 2052 | CASE ( 3 ) |
---|
[2232] | 2053 | ! |
---|
| 2054 | !-- Determine topography-top index on w-grid |
---|
[4168] | 2055 | k_wall = topo_top_ind(j,i,3) |
---|
[2317] | 2056 | |
---|
[2696] | 2057 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) - 1 |
---|
[138] | 2058 | |
---|
[2232] | 2059 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1721] | 2060 | |
---|
[1484] | 2061 | pre_tend = 0.0_wp |
---|
| 2062 | pre_w = 0.0_wp |
---|
[138] | 2063 | ! |
---|
[1484] | 2064 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 2065 | pre_tend = - cdc * & |
---|
| 2066 | (0.5_wp * & |
---|
[1721] | 2067 | ( lad_s(kk+1,j,i) + lad_s(kk,j,i) )) * & |
---|
[1484] | 2068 | SQRT( ( 0.25_wp * ( u(k,j,i) + & |
---|
| 2069 | u(k,j,i+1) + & |
---|
| 2070 | u(k+1,j,i) + & |
---|
| 2071 | u(k+1,j,i+1) ) & |
---|
| 2072 | )**2 + & |
---|
| 2073 | ( 0.25_wp * ( v(k,j,i) + & |
---|
| 2074 | v(k,j+1,i) + & |
---|
| 2075 | v(k+1,j,i) + & |
---|
| 2076 | v(k+1,j+1,i) ) & |
---|
| 2077 | )**2 + & |
---|
| 2078 | w(k,j,i)**2 & |
---|
| 2079 | ) * & |
---|
| 2080 | w(k,j,i) |
---|
| 2081 | ! |
---|
| 2082 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 2083 | pre_w = w(k,j,i) + dt_3d * pre_tend |
---|
| 2084 | ! |
---|
| 2085 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 2086 | !-- and in case the signs are different, limit the tendency |
---|
| 2087 | IF ( SIGN(pre_w,w(k,j,i)) /= pre_w ) THEN |
---|
| 2088 | pre_tend = - w(k,j,i) * ddt_3d |
---|
| 2089 | ELSE |
---|
| 2090 | pre_tend = pre_tend |
---|
| 2091 | ENDIF |
---|
| 2092 | ! |
---|
| 2093 | !-- Calculate final tendency |
---|
| 2094 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 2095 | ENDDO |
---|
| 2096 | |
---|
| 2097 | ! |
---|
[153] | 2098 | !-- potential temperature |
---|
| 2099 | CASE ( 4 ) |
---|
[2232] | 2100 | ! |
---|
| 2101 | !-- Determine topography-top index on scalar grid |
---|
[4168] | 2102 | k_wall = topo_top_ind(j,i,0) |
---|
[2317] | 2103 | |
---|
[3449] | 2104 | IF ( humidity ) THEN |
---|
| 2105 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
| 2106 | kk = k - k_wall !- lad arrays are defined flat |
---|
[3582] | 2107 | tend(k,j,i) = tend(k,j,i) + pc_heating_rate(kk,j,i) - & |
---|
| 2108 | pc_latent_rate(kk,j,i) |
---|
[3449] | 2109 | ENDDO |
---|
| 2110 | ELSE |
---|
| 2111 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
| 2112 | kk = k - k_wall !- lad arrays are defined flat |
---|
| 2113 | tend(k,j,i) = tend(k,j,i) + pc_heating_rate(kk,j,i) |
---|
| 2114 | ENDDO |
---|
| 2115 | ENDIF |
---|
[153] | 2116 | |
---|
| 2117 | ! |
---|
[1960] | 2118 | !-- humidity |
---|
[153] | 2119 | CASE ( 5 ) |
---|
[2232] | 2120 | ! |
---|
| 2121 | !-- Determine topography-top index on scalar grid |
---|
[4168] | 2122 | k_wall = topo_top_ind(j,i,0) |
---|
[2317] | 2123 | |
---|
[2696] | 2124 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[3014] | 2125 | kk = k - k_wall !- lad arrays are defined flat |
---|
[3449] | 2126 | IF ( .NOT. plant_canopy_transpiration ) THEN |
---|
| 2127 | ! pc_transpiration_rate is calculated in radiation model |
---|
| 2128 | ! in case of plant_canopy_transpiration = .T. |
---|
| 2129 | ! to include also the dependecy to the radiation |
---|
| 2130 | ! in the plant canopy box |
---|
[3582] | 2131 | pc_transpiration_rate(kk,j,i) = - lsec & |
---|
| 2132 | * lad_s(kk,j,i) * & |
---|
| 2133 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 2134 | u(k,j,i+1) ) & |
---|
| 2135 | )**2 + & |
---|
| 2136 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 2137 | v(k,j+1,i) ) & |
---|
| 2138 | )**2 + & |
---|
| 2139 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 2140 | w(k,j,i) ) & |
---|
| 2141 | )**2 & |
---|
| 2142 | ) * & |
---|
[3449] | 2143 | ( q(k,j,i) - lsc ) |
---|
| 2144 | ENDIF |
---|
[2232] | 2145 | |
---|
[3014] | 2146 | tend(k,j,i) = tend(k,j,i) + pc_transpiration_rate(kk,j,i) |
---|
| 2147 | |
---|
[153] | 2148 | ENDDO |
---|
| 2149 | |
---|
| 2150 | ! |
---|
[142] | 2151 | !-- sgs-tke |
---|
[1484] | 2152 | CASE ( 6 ) |
---|
[2232] | 2153 | ! |
---|
| 2154 | !-- Determine topography-top index on scalar grid |
---|
[4168] | 2155 | k_wall = topo_top_ind(j,i,0) |
---|
[2317] | 2156 | |
---|
[2696] | 2157 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 2158 | |
---|
| 2159 | kk = k - k_wall |
---|
[1484] | 2160 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 2161 | 2.0_wp * cdc * & |
---|
[1721] | 2162 | lad_s(kk,j,i) * & |
---|
[1484] | 2163 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 2164 | u(k,j,i+1) ) & |
---|
| 2165 | )**2 + & |
---|
| 2166 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 2167 | v(k,j+1,i) ) & |
---|
| 2168 | )**2 + & |
---|
| 2169 | ( 0.5_wp * ( w(k,j,i) + & |
---|
| 2170 | w(k+1,j,i) ) & |
---|
| 2171 | )**2 & |
---|
| 2172 | ) * & |
---|
| 2173 | e(k,j,i) |
---|
| 2174 | ENDDO |
---|
[1960] | 2175 | |
---|
| 2176 | ! |
---|
| 2177 | !-- scalar concentration |
---|
| 2178 | CASE ( 7 ) |
---|
[2232] | 2179 | ! |
---|
| 2180 | !-- Determine topography-top index on scalar grid |
---|
[4168] | 2181 | k_wall = topo_top_ind(j,i,0) |
---|
[2317] | 2182 | |
---|
[2696] | 2183 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 2184 | |
---|
| 2185 | kk = k - k_wall |
---|
[1960] | 2186 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 2187 | lsec * & |
---|
| 2188 | lad_s(kk,j,i) * & |
---|
| 2189 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 2190 | u(k,j,i+1) ) & |
---|
| 2191 | )**2 + & |
---|
| 2192 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 2193 | v(k,j+1,i) ) & |
---|
| 2194 | )**2 + & |
---|
| 2195 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 2196 | w(k,j,i) ) & |
---|
| 2197 | )**2 & |
---|
| 2198 | ) * & |
---|
| 2199 | ( s(k,j,i) - lsc ) |
---|
| 2200 | ENDDO |
---|
[138] | 2201 | |
---|
[142] | 2202 | CASE DEFAULT |
---|
[138] | 2203 | |
---|
[257] | 2204 | WRITE( message_string, * ) 'wrong component: ', component |
---|
[1826] | 2205 | CALL message( 'pcm_tendency', 'PA0279', 1, 2, 0, 6, 0 ) |
---|
[138] | 2206 | |
---|
[142] | 2207 | END SELECT |
---|
[138] | 2208 | |
---|
[1826] | 2209 | END SUBROUTINE pcm_tendency_ij |
---|
[138] | 2210 | |
---|
[2007] | 2211 | |
---|
| 2212 | |
---|
[138] | 2213 | END MODULE plant_canopy_model_mod |
---|