[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 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[257] | 20 | ! Current revisions: |
---|
[138] | 21 | ! ----------------- |
---|
[2214] | 22 | ! |
---|
[2701] | 23 | ! |
---|
[2214] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: plant_canopy_model_mod.f90 2746 2018-01-15 12:06:04Z suehring $ |
---|
[2746] | 27 | ! Move flag plant canopy to modules |
---|
| 28 | ! |
---|
| 29 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 30 | ! Corrected "Former revisions" section |
---|
| 31 | ! |
---|
| 32 | ! 2701 2017-12-15 15:40:50Z suehring |
---|
| 33 | ! Changes from last commit documented |
---|
| 34 | ! |
---|
| 35 | ! 2698 2017-12-14 18:46:24Z suehring |
---|
[2701] | 36 | ! Bugfix in get_topography_top_index |
---|
| 37 | ! |
---|
[2716] | 38 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 39 | ! Change in file header (GPL part) |
---|
[2696] | 40 | ! Bugfix for vertical loop index pch_index in case of Netcdf input |
---|
| 41 | ! Introduce 2D index array incorporate canopy top index |
---|
| 42 | ! Check if canopy on top of topography do not exceed vertical dimension |
---|
| 43 | ! Add check for canopy_mode in case of Netcdf input. |
---|
| 44 | ! Enable _FillValue output for 3d quantities |
---|
| 45 | ! Bugfix in reading of PIDS leaf area density (MS) |
---|
| 46 | ! |
---|
| 47 | ! 2669 2017-12-06 16:03:27Z raasch |
---|
[2669] | 48 | ! coupling_char removed |
---|
| 49 | ! |
---|
| 50 | ! 2512 2017-10-04 08:26:59Z raasch |
---|
[2512] | 51 | ! upper bounds of 3d output changed from nx+1,ny+1 to nx,ny |
---|
| 52 | ! no output of ghost layer data |
---|
| 53 | ! |
---|
| 54 | ! 2318 2017-07-20 17:27:44Z suehring |
---|
[2318] | 55 | ! Get topography top index via Function call |
---|
| 56 | ! |
---|
| 57 | ! 2317 2017-07-20 17:27:19Z suehring |
---|
[2274] | 58 | ! Changed error messages |
---|
| 59 | ! |
---|
| 60 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
[2214] | 61 | ! |
---|
[2233] | 62 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 63 | ! Adjustments to new topography concept |
---|
| 64 | ! |
---|
[2214] | 65 | ! 2213 2017-04-24 15:10:35Z kanani |
---|
[2213] | 66 | ! Bugfix: exchange of ghost points in array pc_heating_rate needed for output |
---|
| 67 | ! of pcm_heatrate, onetime ghost point exchange of lad_s after initialization. |
---|
| 68 | ! Formatting and clean-up of subroutine pcm_read_plant_canopy_3d, |
---|
| 69 | ! minor re-organization of canopy-heating initialization. |
---|
[2008] | 70 | ! |
---|
[2210] | 71 | ! 2209 2017-04-19 09:34:46Z kanani |
---|
| 72 | ! Added 3d output of leaf area density (pcm_lad) and canopy |
---|
| 73 | ! heat rate (pcm_heatrate) |
---|
| 74 | ! |
---|
[2025] | 75 | ! 2024 2016-10-12 16:42:37Z kanani |
---|
| 76 | ! Added missing lad_s initialization |
---|
| 77 | ! |
---|
[2012] | 78 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
| 79 | ! Renamed canopy_heat_flux to pc_heating_rate, since the original meaning/ |
---|
| 80 | ! calculation of the quantity has changed, related to the urban surface model |
---|
| 81 | ! and similar future applications. |
---|
| 82 | ! |
---|
[2008] | 83 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
[2007] | 84 | ! Added SUBROUTINE pcm_read_plant_canopy_3d for reading 3d plant canopy data |
---|
| 85 | ! from file (new case canopy_mode=read_from_file_3d) in the course of |
---|
| 86 | ! introduction of urban surface model, |
---|
| 87 | ! introduced variable ext_coef, |
---|
| 88 | ! resorted SUBROUTINEs to alphabetical order |
---|
[1827] | 89 | ! |
---|
[2001] | 90 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 91 | ! Forced header and separation lines into 80 columns |
---|
| 92 | ! |
---|
[1961] | 93 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
| 94 | ! Separate humidity and passive scalar |
---|
| 95 | ! |
---|
[1954] | 96 | ! 1953 2016-06-21 09:28:42Z suehring |
---|
| 97 | ! Bugfix, lad_s and lad must be public |
---|
| 98 | ! |
---|
[1827] | 99 | ! 1826 2016-04-07 12:01:39Z maronga |
---|
| 100 | ! Further modularization |
---|
| 101 | ! |
---|
[1722] | 102 | ! 1721 2015-11-16 12:56:48Z raasch |
---|
| 103 | ! bugfixes: shf is reduced in areas covered with canopy only, |
---|
| 104 | ! canopy is set on top of topography |
---|
| 105 | ! |
---|
[1683] | 106 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 107 | ! Code annotations made doxygen readable |
---|
| 108 | ! |
---|
[1485] | 109 | ! 1484 2014-10-21 10:53:05Z kanani |
---|
[1484] | 110 | ! Changes due to new module structure of the plant canopy model: |
---|
| 111 | ! module plant_canopy_model_mod now contains a subroutine for the |
---|
[1826] | 112 | ! initialization of the canopy model (pcm_init), |
---|
[1484] | 113 | ! limitation of the canopy drag (previously accounted for by calculation of |
---|
| 114 | ! a limiting canopy timestep for the determination of the maximum LES timestep |
---|
| 115 | ! in subroutine timestep) is now realized by the calculation of pre-tendencies |
---|
[1826] | 116 | ! and preliminary velocities in subroutine pcm_tendency, |
---|
| 117 | ! some redundant MPI communication removed in subroutine pcm_init |
---|
[1484] | 118 | ! (was previously in init_3d_model), |
---|
| 119 | ! unnecessary 3d-arrays lad_u, lad_v, lad_w removed - lad information on the |
---|
| 120 | ! respective grid is now provided only by lad_s (e.g. in the calculation of |
---|
| 121 | ! the tendency terms or of cum_lai_hf), |
---|
| 122 | ! drag_coefficient, lai, leaf_surface_concentration, |
---|
| 123 | ! scalar_exchange_coefficient, sec and sls renamed to canopy_drag_coeff, |
---|
| 124 | ! cum_lai_hf, leaf_surface_conc, leaf_scalar_exch_coeff, lsec and lsc, |
---|
| 125 | ! respectively, |
---|
| 126 | ! unnecessary 3d-arrays cdc, lsc and lsec now defined as single-value constants, |
---|
| 127 | ! USE-statements and ONLY-lists modified accordingly |
---|
[1341] | 128 | ! |
---|
| 129 | ! 1340 2014-03-25 19:45:13Z kanani |
---|
| 130 | ! REAL constants defined as wp-kind |
---|
| 131 | ! |
---|
[1321] | 132 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 133 | ! ONLY-attribute added to USE-statements, |
---|
| 134 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 135 | ! kinds are defined in new module kinds, |
---|
| 136 | ! old module precision_kind is removed, |
---|
| 137 | ! revision history before 2012 removed, |
---|
| 138 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 139 | ! all variable declaration statements |
---|
[153] | 140 | ! |
---|
[1037] | 141 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 142 | ! code put under GPL (PALM 3.9) |
---|
| 143 | ! |
---|
[139] | 144 | ! 138 2007-11-28 10:03:58Z letzel |
---|
| 145 | ! Initial revision |
---|
| 146 | ! |
---|
[138] | 147 | ! Description: |
---|
| 148 | ! ------------ |
---|
[1682] | 149 | !> 1) Initialization of the canopy model, e.g. construction of leaf area density |
---|
[1826] | 150 | !> profile (subroutine pcm_init). |
---|
[1682] | 151 | !> 2) Calculation of sinks and sources of momentum, heat and scalar concentration |
---|
[1826] | 152 | !> due to canopy elements (subroutine pcm_tendency). |
---|
[138] | 153 | !------------------------------------------------------------------------------! |
---|
[1682] | 154 | MODULE plant_canopy_model_mod |
---|
| 155 | |
---|
[1484] | 156 | USE arrays_3d, & |
---|
[2232] | 157 | ONLY: dzu, dzw, e, q, s, tend, u, v, w, zu, zw |
---|
[138] | 158 | |
---|
[1484] | 159 | USE indices, & |
---|
| 160 | ONLY: nbgp, nxl, nxlg, nxlu, nxr, nxrg, nyn, nyng, nys, nysg, nysv, & |
---|
[2317] | 161 | nz, nzb, nzt |
---|
[1484] | 162 | |
---|
| 163 | USE kinds |
---|
| 164 | |
---|
[2317] | 165 | USE surface_mod, & |
---|
[2698] | 166 | ONLY: get_topography_top_index_ji |
---|
[1484] | 167 | |
---|
[2317] | 168 | |
---|
[1484] | 169 | IMPLICIT NONE |
---|
| 170 | |
---|
| 171 | |
---|
[1682] | 172 | CHARACTER (LEN=20) :: canopy_mode = 'block' !< canopy coverage |
---|
[1484] | 173 | |
---|
[2696] | 174 | INTEGER(iwp) :: pch_index = 0 !< plant canopy height/top index |
---|
| 175 | INTEGER(iwp) :: lad_vertical_gradient_level_ind(10) = -9999 !< lad-profile levels (index) |
---|
[1484] | 176 | |
---|
[2696] | 177 | INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: pch_index_ji !< local plant canopy top |
---|
| 178 | |
---|
[1682] | 179 | LOGICAL :: calc_beta_lad_profile = .FALSE. !< switch for calc. of lad from beta func. |
---|
[2696] | 180 | LOGICAL :: usm_lad_rma = .TRUE. !< use MPI RMA to access LAD for raytracing (instead of global array) |
---|
[1484] | 181 | |
---|
[2696] | 182 | REAL(wp) :: alpha_lad = 9999999.9_wp !< coefficient for lad calculation |
---|
| 183 | REAL(wp) :: beta_lad = 9999999.9_wp !< coefficient for lad calculation |
---|
| 184 | REAL(wp) :: canopy_drag_coeff = 0.0_wp !< canopy drag coefficient (parameter) |
---|
| 185 | REAL(wp) :: cdc = 0.0_wp !< canopy drag coeff. (abbreviation used in equations) |
---|
| 186 | REAL(wp) :: cthf = 0.0_wp !< canopy top heat flux |
---|
| 187 | REAL(wp) :: dt_plant_canopy = 0.0_wp !< timestep account. for canopy drag |
---|
| 188 | REAL(wp) :: ext_coef = 0.6_wp !< extinction coefficient |
---|
| 189 | REAL(wp) :: lad_surface = 0.0_wp !< lad surface value |
---|
| 190 | REAL(wp) :: lai_beta = 0.0_wp !< leaf area index (lai) for lad calc. |
---|
| 191 | REAL(wp) :: leaf_scalar_exch_coeff = 0.0_wp !< canopy scalar exchange coeff. |
---|
| 192 | REAL(wp) :: leaf_surface_conc = 0.0_wp !< leaf surface concentration |
---|
| 193 | REAL(wp) :: lsec = 0.0_wp !< leaf scalar exchange coeff. |
---|
| 194 | REAL(wp) :: lsc = 0.0_wp !< leaf surface concentration |
---|
| 195 | REAL(wp) :: prototype_lad !< prototype leaf area density for computing effective optical depth |
---|
[1484] | 196 | |
---|
[2696] | 197 | REAL(wp) :: lad_vertical_gradient(10) = 0.0_wp !< lad gradient |
---|
| 198 | REAL(wp) :: lad_vertical_gradient_level(10) = -9999999.9_wp !< lad-prof. levels (in m) |
---|
[1484] | 199 | |
---|
[1682] | 200 | REAL(wp), DIMENSION(:), ALLOCATABLE :: lad !< leaf area density |
---|
| 201 | REAL(wp), DIMENSION(:), ALLOCATABLE :: pre_lad !< preliminary lad |
---|
[1484] | 202 | |
---|
| 203 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: & |
---|
[2011] | 204 | pc_heating_rate !< plant canopy heating rate |
---|
[1682] | 205 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: cum_lai_hf !< cumulative lai for heatflux calc. |
---|
| 206 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: lad_s !< lad on scalar-grid |
---|
[1484] | 207 | |
---|
| 208 | |
---|
| 209 | SAVE |
---|
| 210 | |
---|
| 211 | |
---|
[138] | 212 | PRIVATE |
---|
[1826] | 213 | |
---|
| 214 | ! |
---|
| 215 | !-- Public functions |
---|
[2209] | 216 | PUBLIC pcm_check_data_output, pcm_check_parameters, pcm_data_output_3d, & |
---|
| 217 | pcm_define_netcdf_grid, pcm_header, pcm_init, pcm_parin, pcm_tendency |
---|
[138] | 218 | |
---|
[1826] | 219 | ! |
---|
| 220 | !-- Public variables and constants |
---|
[2011] | 221 | PUBLIC pc_heating_rate, canopy_mode, cthf, dt_plant_canopy, lad, lad_s, & |
---|
[2746] | 222 | pch_index, prototype_lad, usm_lad_rma |
---|
[2007] | 223 | |
---|
[1484] | 224 | |
---|
[2209] | 225 | INTERFACE pcm_check_data_output |
---|
| 226 | MODULE PROCEDURE pcm_check_data_output |
---|
| 227 | END INTERFACE pcm_check_data_output |
---|
| 228 | |
---|
[1826] | 229 | INTERFACE pcm_check_parameters |
---|
| 230 | MODULE PROCEDURE pcm_check_parameters |
---|
[2209] | 231 | END INTERFACE pcm_check_parameters |
---|
| 232 | |
---|
| 233 | INTERFACE pcm_data_output_3d |
---|
| 234 | MODULE PROCEDURE pcm_data_output_3d |
---|
| 235 | END INTERFACE pcm_data_output_3d |
---|
| 236 | |
---|
| 237 | INTERFACE pcm_define_netcdf_grid |
---|
| 238 | MODULE PROCEDURE pcm_define_netcdf_grid |
---|
| 239 | END INTERFACE pcm_define_netcdf_grid |
---|
[1826] | 240 | |
---|
| 241 | INTERFACE pcm_header |
---|
| 242 | MODULE PROCEDURE pcm_header |
---|
| 243 | END INTERFACE pcm_header |
---|
| 244 | |
---|
| 245 | INTERFACE pcm_init |
---|
| 246 | MODULE PROCEDURE pcm_init |
---|
| 247 | END INTERFACE pcm_init |
---|
[138] | 248 | |
---|
[1826] | 249 | INTERFACE pcm_parin |
---|
| 250 | MODULE PROCEDURE pcm_parin |
---|
[2007] | 251 | END INTERFACE pcm_parin |
---|
| 252 | |
---|
| 253 | INTERFACE pcm_read_plant_canopy_3d |
---|
| 254 | MODULE PROCEDURE pcm_read_plant_canopy_3d |
---|
| 255 | END INTERFACE pcm_read_plant_canopy_3d |
---|
[1826] | 256 | |
---|
| 257 | INTERFACE pcm_tendency |
---|
| 258 | MODULE PROCEDURE pcm_tendency |
---|
| 259 | MODULE PROCEDURE pcm_tendency_ij |
---|
| 260 | END INTERFACE pcm_tendency |
---|
[1484] | 261 | |
---|
| 262 | |
---|
[138] | 263 | CONTAINS |
---|
| 264 | |
---|
[2209] | 265 | |
---|
| 266 | !------------------------------------------------------------------------------! |
---|
| 267 | ! Description: |
---|
| 268 | ! ------------ |
---|
| 269 | !> Check data output for plant canopy model |
---|
| 270 | !------------------------------------------------------------------------------! |
---|
| 271 | SUBROUTINE pcm_check_data_output( var, unit ) |
---|
[1826] | 272 | |
---|
[2209] | 273 | |
---|
| 274 | USE control_parameters, & |
---|
| 275 | ONLY: data_output, message_string |
---|
| 276 | |
---|
| 277 | IMPLICIT NONE |
---|
| 278 | |
---|
| 279 | CHARACTER (LEN=*) :: unit !< |
---|
| 280 | CHARACTER (LEN=*) :: var !< |
---|
| 281 | |
---|
| 282 | |
---|
| 283 | SELECT CASE ( TRIM( var ) ) |
---|
| 284 | |
---|
| 285 | CASE ( 'pcm_heatrate' ) |
---|
| 286 | unit = 'K s-1' |
---|
| 287 | |
---|
| 288 | CASE ( 'pcm_lad' ) |
---|
| 289 | unit = 'm2 m-3' |
---|
| 290 | |
---|
| 291 | |
---|
| 292 | CASE DEFAULT |
---|
| 293 | unit = 'illegal' |
---|
| 294 | |
---|
| 295 | END SELECT |
---|
| 296 | |
---|
| 297 | |
---|
| 298 | END SUBROUTINE pcm_check_data_output |
---|
| 299 | |
---|
| 300 | |
---|
[1826] | 301 | !------------------------------------------------------------------------------! |
---|
| 302 | ! Description: |
---|
| 303 | ! ------------ |
---|
| 304 | !> Check parameters routine for plant canopy model |
---|
| 305 | !------------------------------------------------------------------------------! |
---|
| 306 | SUBROUTINE pcm_check_parameters |
---|
[138] | 307 | |
---|
[1826] | 308 | USE control_parameters, & |
---|
[2696] | 309 | ONLY: cloud_physics, coupling_char, message_string, & |
---|
| 310 | microphysics_seifert |
---|
| 311 | |
---|
| 312 | USE netcdf_data_input_mod, & |
---|
| 313 | ONLY: input_file_static, input_pids_static |
---|
[1826] | 314 | |
---|
| 315 | |
---|
| 316 | IMPLICIT NONE |
---|
| 317 | |
---|
| 318 | |
---|
| 319 | IF ( canopy_drag_coeff == 0.0_wp ) THEN |
---|
| 320 | message_string = 'plant_canopy = .TRUE. requires a non-zero drag '// & |
---|
| 321 | 'coefficient & given value is canopy_drag_coeff = 0.0' |
---|
| 322 | CALL message( 'check_parameters', 'PA0041', 1, 2, 0, 6, 0 ) |
---|
| 323 | ENDIF |
---|
| 324 | |
---|
| 325 | IF ( ( alpha_lad /= 9999999.9_wp .AND. beta_lad == 9999999.9_wp ) .OR.& |
---|
| 326 | beta_lad /= 9999999.9_wp .AND. alpha_lad == 9999999.9_wp ) THEN |
---|
| 327 | message_string = 'using the beta function for the construction ' // & |
---|
| 328 | 'of the leaf area density profile requires ' // & |
---|
| 329 | 'both alpha_lad and beta_lad to be /= 9999999.9' |
---|
| 330 | CALL message( 'check_parameters', 'PA0118', 1, 2, 0, 6, 0 ) |
---|
| 331 | ENDIF |
---|
| 332 | |
---|
| 333 | IF ( calc_beta_lad_profile .AND. lai_beta == 0.0_wp ) THEN |
---|
| 334 | message_string = 'using the beta function for the construction ' // & |
---|
| 335 | 'of the leaf area density profile requires ' // & |
---|
| 336 | 'a non-zero lai_beta, but given value is ' // & |
---|
| 337 | 'lai_beta = 0.0' |
---|
| 338 | CALL message( 'check_parameters', 'PA0119', 1, 2, 0, 6, 0 ) |
---|
| 339 | ENDIF |
---|
| 340 | |
---|
| 341 | IF ( calc_beta_lad_profile .AND. lad_surface /= 0.0_wp ) THEN |
---|
[2274] | 342 | message_string = 'simultaneous setting of alpha_lad /= 9999999.9 '// & |
---|
| 343 | 'combined with beta_lad /= 9999999.9 ' // & |
---|
[1826] | 344 | 'and lad_surface /= 0.0 is not possible, ' // & |
---|
| 345 | 'use either vertical gradients or the beta ' // & |
---|
| 346 | 'function for the construction of the leaf area '// & |
---|
| 347 | 'density profile' |
---|
| 348 | CALL message( 'check_parameters', 'PA0120', 1, 2, 0, 6, 0 ) |
---|
| 349 | ENDIF |
---|
| 350 | |
---|
| 351 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
| 352 | message_string = 'plant_canopy = .TRUE. requires cloud_scheme /=' // & |
---|
| 353 | ' seifert_beheng' |
---|
| 354 | CALL message( 'check_parameters', 'PA0360', 1, 2, 0, 6, 0 ) |
---|
| 355 | ENDIF |
---|
[2696] | 356 | ! |
---|
| 357 | !-- If dynamic input file is used, canopy need to be read from file |
---|
| 358 | IF ( input_pids_static .AND. & |
---|
| 359 | TRIM( canopy_mode ) /= 'read_from_file_3d' ) THEN |
---|
| 360 | message_string = 'Usage of dynamic input file ' // & |
---|
| 361 | TRIM( input_file_static ) // & |
---|
| 362 | TRIM( coupling_char ) // ' requires ' // & |
---|
| 363 | 'canopy_mode = read_from_file_3d' |
---|
| 364 | CALL message( 'check_parameters', 'PA0999', 1, 2, 0, 6, 0 ) |
---|
| 365 | ENDIF |
---|
[1826] | 366 | |
---|
| 367 | |
---|
| 368 | END SUBROUTINE pcm_check_parameters |
---|
| 369 | |
---|
| 370 | |
---|
[138] | 371 | !------------------------------------------------------------------------------! |
---|
[2209] | 372 | ! |
---|
[1484] | 373 | ! Description: |
---|
| 374 | ! ------------ |
---|
[2209] | 375 | !> Subroutine defining 3D output variables |
---|
| 376 | !------------------------------------------------------------------------------! |
---|
[2696] | 377 | SUBROUTINE pcm_data_output_3d( av, variable, found, local_pf, fill_value ) |
---|
[2209] | 378 | |
---|
| 379 | USE control_parameters, & |
---|
| 380 | ONLY : nz_do3d |
---|
| 381 | |
---|
| 382 | USE indices |
---|
| 383 | |
---|
| 384 | USE kinds |
---|
| 385 | |
---|
| 386 | |
---|
| 387 | IMPLICIT NONE |
---|
| 388 | |
---|
| 389 | CHARACTER (LEN=*) :: variable !< |
---|
| 390 | |
---|
[2696] | 391 | INTEGER(iwp) :: av !< |
---|
| 392 | INTEGER(iwp) :: i !< |
---|
| 393 | INTEGER(iwp) :: j !< |
---|
| 394 | INTEGER(iwp) :: k !< |
---|
| 395 | INTEGER(iwp) :: k_topo !< topography top index |
---|
[2209] | 396 | |
---|
| 397 | LOGICAL :: found !< |
---|
| 398 | |
---|
[2696] | 399 | REAL(wp) :: fill_value |
---|
[2512] | 400 | REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb:nz_do3d) :: local_pf !< |
---|
[2209] | 401 | |
---|
| 402 | |
---|
| 403 | found = .TRUE. |
---|
| 404 | |
---|
[2696] | 405 | local_pf = REAL( fill_value, KIND = 4 ) |
---|
[2209] | 406 | |
---|
| 407 | SELECT CASE ( TRIM( variable ) ) |
---|
| 408 | |
---|
| 409 | CASE ( 'pcm_heatrate' ) |
---|
| 410 | IF ( av == 0 ) THEN |
---|
[2512] | 411 | DO i = nxl, nxr |
---|
| 412 | DO j = nys, nyn |
---|
[2696] | 413 | IF ( pch_index_ji(j,i) /= 0 ) THEN |
---|
[2698] | 414 | k_topo = get_topography_top_index_ji( j, i, 's' ) |
---|
[2696] | 415 | DO k = k_topo, k_topo + pch_index_ji(j,i) |
---|
| 416 | local_pf(i,j,k) = pc_heating_rate(k-k_topo,j,i) |
---|
| 417 | ENDDO |
---|
| 418 | ENDIF |
---|
[2209] | 419 | ENDDO |
---|
| 420 | ENDDO |
---|
| 421 | ENDIF |
---|
| 422 | |
---|
| 423 | |
---|
| 424 | CASE ( 'pcm_lad' ) |
---|
| 425 | IF ( av == 0 ) THEN |
---|
[2512] | 426 | DO i = nxl, nxr |
---|
| 427 | DO j = nys, nyn |
---|
[2696] | 428 | IF ( pch_index_ji(j,i) /= 0 ) THEN |
---|
[2698] | 429 | k_topo = get_topography_top_index_ji( j, i, 's' ) |
---|
[2696] | 430 | DO k = k_topo, k_topo + pch_index_ji(j,i) |
---|
| 431 | local_pf(i,j,k) = lad_s(k-k_topo,j,i) |
---|
| 432 | ENDDO |
---|
| 433 | ENDIF |
---|
[2209] | 434 | ENDDO |
---|
| 435 | ENDDO |
---|
| 436 | ENDIF |
---|
| 437 | |
---|
| 438 | |
---|
| 439 | CASE DEFAULT |
---|
| 440 | found = .FALSE. |
---|
| 441 | |
---|
| 442 | END SELECT |
---|
| 443 | |
---|
| 444 | |
---|
| 445 | END SUBROUTINE pcm_data_output_3d |
---|
| 446 | |
---|
| 447 | !------------------------------------------------------------------------------! |
---|
| 448 | ! |
---|
| 449 | ! Description: |
---|
| 450 | ! ------------ |
---|
| 451 | !> Subroutine defining appropriate grid for netcdf variables. |
---|
| 452 | !> It is called from subroutine netcdf. |
---|
| 453 | !------------------------------------------------------------------------------! |
---|
| 454 | SUBROUTINE pcm_define_netcdf_grid( var, found, grid_x, grid_y, grid_z ) |
---|
| 455 | |
---|
| 456 | IMPLICIT NONE |
---|
| 457 | |
---|
| 458 | CHARACTER (LEN=*), INTENT(IN) :: var !< |
---|
| 459 | LOGICAL, INTENT(OUT) :: found !< |
---|
| 460 | CHARACTER (LEN=*), INTENT(OUT) :: grid_x !< |
---|
| 461 | CHARACTER (LEN=*), INTENT(OUT) :: grid_y !< |
---|
| 462 | CHARACTER (LEN=*), INTENT(OUT) :: grid_z !< |
---|
| 463 | |
---|
| 464 | found = .TRUE. |
---|
| 465 | |
---|
| 466 | ! |
---|
| 467 | !-- Check for the grid |
---|
| 468 | SELECT CASE ( TRIM( var ) ) |
---|
| 469 | |
---|
| 470 | CASE ( 'pcm_heatrate', 'pcm_lad' ) |
---|
| 471 | grid_x = 'x' |
---|
| 472 | grid_y = 'y' |
---|
| 473 | grid_z = 'zu' |
---|
| 474 | |
---|
| 475 | CASE DEFAULT |
---|
| 476 | found = .FALSE. |
---|
| 477 | grid_x = 'none' |
---|
| 478 | grid_y = 'none' |
---|
| 479 | grid_z = 'none' |
---|
| 480 | END SELECT |
---|
| 481 | |
---|
| 482 | END SUBROUTINE pcm_define_netcdf_grid |
---|
| 483 | |
---|
| 484 | |
---|
| 485 | !------------------------------------------------------------------------------! |
---|
| 486 | ! Description: |
---|
| 487 | ! ------------ |
---|
[1826] | 488 | !> Header output for plant canopy model |
---|
| 489 | !------------------------------------------------------------------------------! |
---|
| 490 | SUBROUTINE pcm_header ( io ) |
---|
| 491 | |
---|
| 492 | USE control_parameters, & |
---|
| 493 | ONLY: dz, passive_scalar |
---|
| 494 | |
---|
| 495 | |
---|
| 496 | IMPLICIT NONE |
---|
| 497 | |
---|
| 498 | CHARACTER (LEN=10) :: coor_chr !< |
---|
| 499 | |
---|
| 500 | CHARACTER (LEN=86) :: coordinates !< |
---|
| 501 | CHARACTER (LEN=86) :: gradients !< |
---|
| 502 | CHARACTER (LEN=86) :: leaf_area_density !< |
---|
| 503 | CHARACTER (LEN=86) :: slices !< |
---|
| 504 | |
---|
| 505 | INTEGER(iwp) :: i !< |
---|
| 506 | INTEGER(iwp), INTENT(IN) :: io !< Unit of the output file |
---|
| 507 | INTEGER(iwp) :: k !< |
---|
| 508 | |
---|
| 509 | REAL(wp) :: canopy_height !< canopy height (in m) |
---|
| 510 | |
---|
| 511 | canopy_height = pch_index * dz |
---|
| 512 | |
---|
| 513 | WRITE ( io, 1 ) canopy_mode, canopy_height, pch_index, & |
---|
| 514 | canopy_drag_coeff |
---|
| 515 | IF ( passive_scalar ) THEN |
---|
| 516 | WRITE ( io, 2 ) leaf_scalar_exch_coeff, & |
---|
| 517 | leaf_surface_conc |
---|
| 518 | ENDIF |
---|
| 519 | |
---|
| 520 | ! |
---|
| 521 | !-- Heat flux at the top of vegetation |
---|
| 522 | WRITE ( io, 3 ) cthf |
---|
| 523 | |
---|
| 524 | ! |
---|
| 525 | !-- Leaf area density profile, calculated either from given vertical |
---|
| 526 | !-- gradients or from beta probability density function. |
---|
| 527 | IF ( .NOT. calc_beta_lad_profile ) THEN |
---|
| 528 | |
---|
| 529 | !-- Building output strings, starting with surface value |
---|
| 530 | WRITE ( leaf_area_density, '(F7.4)' ) lad_surface |
---|
| 531 | gradients = '------' |
---|
| 532 | slices = ' 0' |
---|
| 533 | coordinates = ' 0.0' |
---|
| 534 | i = 1 |
---|
| 535 | DO WHILE ( i < 11 .AND. lad_vertical_gradient_level_ind(i) & |
---|
| 536 | /= -9999 ) |
---|
| 537 | |
---|
| 538 | WRITE (coor_chr,'(F7.2)') lad(lad_vertical_gradient_level_ind(i)) |
---|
| 539 | leaf_area_density = TRIM( leaf_area_density ) // ' ' // & |
---|
| 540 | TRIM( coor_chr ) |
---|
| 541 | |
---|
| 542 | WRITE (coor_chr,'(F7.2)') lad_vertical_gradient(i) |
---|
| 543 | gradients = TRIM( gradients ) // ' ' // TRIM( coor_chr ) |
---|
| 544 | |
---|
| 545 | WRITE (coor_chr,'(I7)') lad_vertical_gradient_level_ind(i) |
---|
| 546 | slices = TRIM( slices ) // ' ' // TRIM( coor_chr ) |
---|
| 547 | |
---|
| 548 | WRITE (coor_chr,'(F7.1)') lad_vertical_gradient_level(i) |
---|
| 549 | coordinates = TRIM( coordinates ) // ' ' // TRIM( coor_chr ) |
---|
| 550 | |
---|
| 551 | i = i + 1 |
---|
| 552 | ENDDO |
---|
| 553 | |
---|
| 554 | WRITE ( io, 4 ) TRIM( coordinates ), TRIM( leaf_area_density ), & |
---|
| 555 | TRIM( gradients ), TRIM( slices ) |
---|
| 556 | |
---|
| 557 | ELSE |
---|
| 558 | |
---|
| 559 | WRITE ( leaf_area_density, '(F7.4)' ) lad_surface |
---|
| 560 | coordinates = ' 0.0' |
---|
| 561 | |
---|
| 562 | DO k = 1, pch_index |
---|
| 563 | |
---|
| 564 | WRITE (coor_chr,'(F7.2)') lad(k) |
---|
| 565 | leaf_area_density = TRIM( leaf_area_density ) // ' ' // & |
---|
| 566 | TRIM( coor_chr ) |
---|
| 567 | |
---|
| 568 | WRITE (coor_chr,'(F7.1)') zu(k) |
---|
| 569 | coordinates = TRIM( coordinates ) // ' ' // TRIM( coor_chr ) |
---|
| 570 | |
---|
| 571 | ENDDO |
---|
| 572 | |
---|
| 573 | WRITE ( io, 5 ) TRIM( coordinates ), TRIM( leaf_area_density ), & |
---|
| 574 | alpha_lad, beta_lad, lai_beta |
---|
| 575 | |
---|
| 576 | ENDIF |
---|
| 577 | |
---|
| 578 | 1 FORMAT (//' Vegetation canopy (drag) model:'/ & |
---|
| 579 | ' ------------------------------'// & |
---|
| 580 | ' Canopy mode: ', A / & |
---|
| 581 | ' Canopy height: ',F6.2,'m (',I4,' grid points)' / & |
---|
| 582 | ' Leaf drag coefficient: ',F6.2 /) |
---|
| 583 | 2 FORMAT (/ ' Scalar exchange coefficient: ',F6.2 / & |
---|
| 584 | ' Scalar concentration at leaf surfaces in kg/m**3: ',F6.2 /) |
---|
| 585 | 3 FORMAT (' Predefined constant heatflux at the top of the vegetation: ',F6.2, & |
---|
| 586 | ' K m/s') |
---|
| 587 | 4 FORMAT (/ ' Characteristic levels of the leaf area density:'// & |
---|
| 588 | ' Height: ',A,' m'/ & |
---|
| 589 | ' Leaf area density: ',A,' m**2/m**3'/ & |
---|
| 590 | ' Gradient: ',A,' m**2/m**4'/ & |
---|
| 591 | ' Gridpoint: ',A) |
---|
| 592 | 5 FORMAT (//' Characteristic levels of the leaf area density and coefficients:'& |
---|
| 593 | // ' Height: ',A,' m'/ & |
---|
| 594 | ' Leaf area density: ',A,' m**2/m**3'/ & |
---|
| 595 | ' Coefficient alpha: ',F6.2 / & |
---|
| 596 | ' Coefficient beta: ',F6.2 / & |
---|
| 597 | ' Leaf area index: ',F6.2,' m**2/m**2' /) |
---|
| 598 | |
---|
| 599 | END SUBROUTINE pcm_header |
---|
| 600 | |
---|
| 601 | |
---|
| 602 | !------------------------------------------------------------------------------! |
---|
| 603 | ! Description: |
---|
| 604 | ! ------------ |
---|
[1682] | 605 | !> Initialization of the plant canopy model |
---|
[138] | 606 | !------------------------------------------------------------------------------! |
---|
[1826] | 607 | SUBROUTINE pcm_init |
---|
[1484] | 608 | |
---|
| 609 | |
---|
| 610 | USE control_parameters, & |
---|
[2669] | 611 | ONLY: dz, humidity, io_blocks, io_group, message_string, ocean, & |
---|
| 612 | passive_scalar, urban_surface |
---|
[1484] | 613 | |
---|
[2696] | 614 | USE netcdf_data_input_mod, & |
---|
| 615 | ONLY: leaf_area_density_f |
---|
| 616 | |
---|
[2232] | 617 | USE surface_mod, & |
---|
| 618 | ONLY: surf_def_h, surf_lsm_h, surf_usm_h |
---|
[1484] | 619 | |
---|
| 620 | IMPLICIT NONE |
---|
| 621 | |
---|
[2007] | 622 | CHARACTER(10) :: pct |
---|
| 623 | |
---|
| 624 | INTEGER(iwp) :: i !< running index |
---|
| 625 | INTEGER(iwp) :: ii !< index |
---|
| 626 | INTEGER(iwp) :: j !< running index |
---|
| 627 | INTEGER(iwp) :: k !< running index |
---|
[2232] | 628 | INTEGER(iwp) :: m !< running index |
---|
[1484] | 629 | |
---|
[2007] | 630 | REAL(wp) :: int_bpdf !< vertical integral for lad-profile construction |
---|
| 631 | REAL(wp) :: dzh !< vertical grid spacing in units of canopy height |
---|
| 632 | REAL(wp) :: gradient !< gradient for lad-profile construction |
---|
| 633 | REAL(wp) :: canopy_height !< canopy height for lad-profile construction |
---|
| 634 | REAL(wp) :: pcv(nzb:nzt+1) !< |
---|
| 635 | |
---|
[1484] | 636 | ! |
---|
| 637 | !-- Allocate one-dimensional arrays for the computation of the |
---|
| 638 | !-- leaf area density (lad) profile |
---|
| 639 | ALLOCATE( lad(0:nz+1), pre_lad(0:nz+1) ) |
---|
| 640 | lad = 0.0_wp |
---|
| 641 | pre_lad = 0.0_wp |
---|
| 642 | |
---|
| 643 | ! |
---|
[1826] | 644 | !-- Set flag that indicates that the lad-profile shall be calculated by using |
---|
| 645 | !-- a beta probability density function |
---|
| 646 | IF ( alpha_lad /= 9999999.9_wp .AND. beta_lad /= 9999999.9_wp ) THEN |
---|
| 647 | calc_beta_lad_profile = .TRUE. |
---|
| 648 | ENDIF |
---|
| 649 | |
---|
| 650 | |
---|
| 651 | ! |
---|
[1484] | 652 | !-- Compute the profile of leaf area density used in the plant |
---|
| 653 | !-- canopy model. The profile can either be constructed from |
---|
| 654 | !-- prescribed vertical gradients of the leaf area density or by |
---|
| 655 | !-- using a beta probability density function (see e.g. Markkanen et al., |
---|
| 656 | !-- 2003: Boundary-Layer Meteorology, 106, 437-459) |
---|
| 657 | IF ( .NOT. calc_beta_lad_profile ) THEN |
---|
| 658 | |
---|
| 659 | ! |
---|
| 660 | !-- Use vertical gradients for lad-profile construction |
---|
| 661 | i = 1 |
---|
| 662 | gradient = 0.0_wp |
---|
| 663 | |
---|
| 664 | IF ( .NOT. ocean ) THEN |
---|
| 665 | |
---|
| 666 | lad(0) = lad_surface |
---|
| 667 | lad_vertical_gradient_level_ind(1) = 0 |
---|
| 668 | |
---|
| 669 | DO k = 1, pch_index |
---|
| 670 | IF ( i < 11 ) THEN |
---|
| 671 | IF ( lad_vertical_gradient_level(i) < zu(k) .AND. & |
---|
| 672 | lad_vertical_gradient_level(i) >= 0.0_wp ) THEN |
---|
| 673 | gradient = lad_vertical_gradient(i) |
---|
| 674 | lad_vertical_gradient_level_ind(i) = k - 1 |
---|
| 675 | i = i + 1 |
---|
| 676 | ENDIF |
---|
| 677 | ENDIF |
---|
| 678 | IF ( gradient /= 0.0_wp ) THEN |
---|
| 679 | IF ( k /= 1 ) THEN |
---|
| 680 | lad(k) = lad(k-1) + dzu(k) * gradient |
---|
| 681 | ELSE |
---|
| 682 | lad(k) = lad_surface + dzu(k) * gradient |
---|
| 683 | ENDIF |
---|
| 684 | ELSE |
---|
| 685 | lad(k) = lad(k-1) |
---|
| 686 | ENDIF |
---|
| 687 | ENDDO |
---|
| 688 | |
---|
| 689 | ENDIF |
---|
| 690 | |
---|
| 691 | ! |
---|
| 692 | !-- In case of no given leaf area density gradients, choose a vanishing |
---|
| 693 | !-- gradient. This information is used for the HEADER and the RUN_CONTROL |
---|
| 694 | !-- file. |
---|
| 695 | IF ( lad_vertical_gradient_level(1) == -9999999.9_wp ) THEN |
---|
| 696 | lad_vertical_gradient_level(1) = 0.0_wp |
---|
| 697 | ENDIF |
---|
| 698 | |
---|
| 699 | ELSE |
---|
| 700 | |
---|
| 701 | ! |
---|
| 702 | !-- Use beta function for lad-profile construction |
---|
| 703 | int_bpdf = 0.0_wp |
---|
| 704 | canopy_height = pch_index * dz |
---|
| 705 | |
---|
[2232] | 706 | DO k = 0, pch_index |
---|
[1484] | 707 | int_bpdf = int_bpdf + & |
---|
[1826] | 708 | ( ( ( zw(k) / canopy_height )**( alpha_lad-1.0_wp ) ) * & |
---|
| 709 | ( ( 1.0_wp - ( zw(k) / canopy_height ) )**( & |
---|
| 710 | beta_lad-1.0_wp ) ) & |
---|
| 711 | * ( ( zw(k+1)-zw(k) ) / canopy_height ) ) |
---|
[1484] | 712 | ENDDO |
---|
| 713 | |
---|
| 714 | ! |
---|
| 715 | !-- Preliminary lad profile (defined on w-grid) |
---|
[2232] | 716 | DO k = 0, pch_index |
---|
[1826] | 717 | pre_lad(k) = lai_beta * & |
---|
| 718 | ( ( ( zw(k) / canopy_height )**( alpha_lad-1.0_wp ) ) & |
---|
| 719 | * ( ( 1.0_wp - ( zw(k) / canopy_height ) )**( & |
---|
| 720 | beta_lad-1.0_wp ) ) / int_bpdf & |
---|
| 721 | ) / canopy_height |
---|
[1484] | 722 | ENDDO |
---|
| 723 | |
---|
| 724 | ! |
---|
| 725 | !-- Final lad profile (defined on scalar-grid level, since most prognostic |
---|
| 726 | !-- quantities are defined there, hence, less interpolation is required |
---|
| 727 | !-- when calculating the canopy tendencies) |
---|
| 728 | lad(0) = pre_lad(0) |
---|
[2232] | 729 | DO k = 1, pch_index |
---|
[1484] | 730 | lad(k) = 0.5 * ( pre_lad(k-1) + pre_lad(k) ) |
---|
| 731 | ENDDO |
---|
| 732 | |
---|
| 733 | ENDIF |
---|
| 734 | |
---|
| 735 | ! |
---|
[2213] | 736 | !-- Allocate 3D-array for the leaf area density (lad_s). |
---|
[1484] | 737 | ALLOCATE( lad_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 738 | |
---|
| 739 | ! |
---|
| 740 | !-- Initialize canopy parameters cdc (canopy drag coefficient), |
---|
| 741 | !-- lsec (leaf scalar exchange coefficient), lsc (leaf surface concentration) |
---|
| 742 | !-- with the prescribed values |
---|
| 743 | cdc = canopy_drag_coeff |
---|
| 744 | lsec = leaf_scalar_exch_coeff |
---|
| 745 | lsc = leaf_surface_conc |
---|
| 746 | |
---|
| 747 | ! |
---|
| 748 | !-- Initialization of the canopy coverage in the model domain: |
---|
| 749 | !-- Setting the parameter canopy_mode = 'block' initializes a canopy, which |
---|
| 750 | !-- fully covers the domain surface |
---|
| 751 | SELECT CASE ( TRIM( canopy_mode ) ) |
---|
| 752 | |
---|
| 753 | CASE( 'block' ) |
---|
| 754 | |
---|
| 755 | DO i = nxlg, nxrg |
---|
| 756 | DO j = nysg, nyng |
---|
| 757 | lad_s(:,j,i) = lad(:) |
---|
| 758 | ENDDO |
---|
| 759 | ENDDO |
---|
| 760 | |
---|
[2007] | 761 | CASE ( 'read_from_file_3d' ) |
---|
| 762 | ! |
---|
[2696] | 763 | !-- Initialize LAD with data from file. If LAD is given in NetCDF file, |
---|
| 764 | !-- use these values, else take LAD profiles from ASCII file. |
---|
| 765 | !-- Please note, in NetCDF file LAD is only given up to the maximum |
---|
| 766 | !-- canopy top, indicated by leaf_area_density_f%nz. |
---|
| 767 | lad_s = 0.0_wp |
---|
| 768 | IF ( leaf_area_density_f%from_file ) THEN |
---|
| 769 | ! |
---|
| 770 | !-- Set also pch_index, used to be the upper bound of the vertical |
---|
| 771 | !-- loops. Therefore, use the global top of the canopy layer. |
---|
| 772 | pch_index = leaf_area_density_f%nz - 1 |
---|
| 773 | |
---|
| 774 | DO i = nxl, nxr |
---|
| 775 | DO j = nys, nyn |
---|
| 776 | DO k = 0, leaf_area_density_f%nz - 1 |
---|
| 777 | IF ( leaf_area_density_f%var(k,j,i) /= & |
---|
| 778 | leaf_area_density_f%fill ) & |
---|
| 779 | lad_s(k,j,i) = leaf_area_density_f%var(k,j,i) |
---|
| 780 | ENDDO |
---|
| 781 | ENDDO |
---|
| 782 | ENDDO |
---|
| 783 | CALL exchange_horiz( lad_s, nbgp ) |
---|
| 784 | ! |
---|
| 785 | ! ASCII file |
---|
[2007] | 786 | !-- Initialize canopy parameters cdc (canopy drag coefficient), |
---|
| 787 | !-- lsec (leaf scalar exchange coefficient), lsc (leaf surface concentration) |
---|
| 788 | !-- from file which contains complete 3D data (separate vertical profiles for |
---|
| 789 | !-- each location). |
---|
[2696] | 790 | ELSE |
---|
| 791 | CALL pcm_read_plant_canopy_3d |
---|
| 792 | ENDIF |
---|
[2007] | 793 | |
---|
[1484] | 794 | CASE DEFAULT |
---|
| 795 | ! |
---|
[2007] | 796 | !-- The DEFAULT case is reached either if the parameter |
---|
| 797 | !-- canopy mode contains a wrong character string or if the |
---|
| 798 | !-- user has coded a special case in the user interface. |
---|
| 799 | !-- There, the subroutine user_init_plant_canopy checks |
---|
| 800 | !-- which of these two conditions applies. |
---|
| 801 | CALL user_init_plant_canopy |
---|
[1484] | 802 | |
---|
| 803 | END SELECT |
---|
[2696] | 804 | ! |
---|
| 805 | !-- Initialize 2D index array indicating canopy top index. |
---|
| 806 | ALLOCATE( pch_index_ji(nysg:nyng,nxlg:nxrg) ) |
---|
| 807 | pch_index_ji = 0 |
---|
[1484] | 808 | |
---|
[2696] | 809 | DO i = nxl, nxr |
---|
| 810 | DO j = nys, nyn |
---|
| 811 | DO k = 0, pch_index |
---|
| 812 | IF ( lad_s(k,j,i) /= 0 ) pch_index_ji(j,i) = k |
---|
| 813 | ENDDO |
---|
[1484] | 814 | ! |
---|
[2696] | 815 | !-- Check whether topography and local vegetation on top exceed |
---|
| 816 | !-- height of the model domain. |
---|
[2698] | 817 | k = get_topography_top_index_ji( j, i, 's' ) |
---|
[2696] | 818 | IF ( k + pch_index_ji(j,i) >= nzt + 1 ) THEN |
---|
| 819 | message_string = 'Local vegetation height on top of ' // & |
---|
| 820 | 'topography exceeds height of model domain.' |
---|
| 821 | CALL message( 'pcm_init', 'PA0999', 2, 2, 0, 6, 0 ) |
---|
| 822 | ENDIF |
---|
| 823 | |
---|
| 824 | ENDDO |
---|
| 825 | ENDDO |
---|
| 826 | |
---|
| 827 | CALL exchange_horiz_2d_int( pch_index_ji, nys, nyn, nxl, nxr, nbgp ) |
---|
| 828 | |
---|
| 829 | ! |
---|
[2011] | 830 | !-- Initialization of the canopy heat source distribution due to heating |
---|
| 831 | !-- of the canopy layers by incoming solar radiation, in case that a non-zero |
---|
| 832 | !-- value is set for the canopy top heat flux (cthf), which equals the |
---|
| 833 | !-- available net radiation at canopy top. |
---|
| 834 | !-- The heat source distribution is calculated by a decaying exponential |
---|
| 835 | !-- function of the downward cumulative leaf area index (cum_lai_hf), |
---|
| 836 | !-- assuming that the foliage inside the plant canopy is heated by solar |
---|
| 837 | !-- radiation penetrating the canopy layers according to the distribution |
---|
| 838 | !-- of net radiation as suggested by Brown & Covey (1966; Agric. Meteorol. 3, |
---|
| 839 | !-- 73â96). This approach has been applied e.g. by Shaw & Schumann (1992; |
---|
[2213] | 840 | !-- Bound.-Layer Meteorol. 61, 47â64). |
---|
| 841 | !-- When using the urban surface model (USM), canopy heating (pc_heating_rate) |
---|
| 842 | !-- by radiation is calculated in the USM. |
---|
| 843 | IF ( cthf /= 0.0_wp .AND. .NOT. urban_surface) THEN |
---|
| 844 | |
---|
| 845 | ALLOCATE( cum_lai_hf(nzb:nzt+1,nysg:nyng,nxlg:nxrg), & |
---|
| 846 | pc_heating_rate(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1484] | 847 | ! |
---|
[2011] | 848 | !-- Piecewise calculation of the cumulative leaf area index by vertical |
---|
[1484] | 849 | !-- integration of the leaf area density |
---|
| 850 | cum_lai_hf(:,:,:) = 0.0_wp |
---|
| 851 | DO i = nxlg, nxrg |
---|
| 852 | DO j = nysg, nyng |
---|
[2696] | 853 | DO k = pch_index_ji(j,i)-1, 0, -1 |
---|
| 854 | IF ( k == pch_index_ji(j,i)-1 ) THEN |
---|
[1484] | 855 | cum_lai_hf(k,j,i) = cum_lai_hf(k+1,j,i) + & |
---|
| 856 | ( 0.5_wp * lad_s(k+1,j,i) * & |
---|
| 857 | ( zw(k+1) - zu(k+1) ) ) + & |
---|
| 858 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+1,j,i) + & |
---|
| 859 | lad_s(k,j,i) ) + & |
---|
| 860 | lad_s(k+1,j,i) ) * & |
---|
| 861 | ( zu(k+1) - zw(k) ) ) |
---|
| 862 | ELSE |
---|
| 863 | cum_lai_hf(k,j,i) = cum_lai_hf(k+1,j,i) + & |
---|
| 864 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+2,j,i) + & |
---|
| 865 | lad_s(k+1,j,i) ) + & |
---|
| 866 | lad_s(k+1,j,i) ) * & |
---|
| 867 | ( zw(k+1) - zu(k+1) ) ) + & |
---|
| 868 | ( 0.5_wp * ( 0.5_wp * ( lad_s(k+1,j,i) + & |
---|
| 869 | lad_s(k,j,i) ) + & |
---|
| 870 | lad_s(k+1,j,i) ) * & |
---|
| 871 | ( zu(k+1) - zw(k) ) ) |
---|
| 872 | ENDIF |
---|
| 873 | ENDDO |
---|
| 874 | ENDDO |
---|
| 875 | ENDDO |
---|
| 876 | |
---|
[2232] | 877 | ! |
---|
| 878 | !-- In areas with canopy the surface value of the canopy heat |
---|
| 879 | !-- flux distribution overrides the surface heat flux (shf) |
---|
| 880 | !-- Start with default surface type |
---|
| 881 | DO m = 1, surf_def_h(0)%ns |
---|
| 882 | k = surf_def_h(0)%k(m) |
---|
| 883 | IF ( cum_lai_hf(0,j,i) /= 0.0_wp ) & |
---|
| 884 | surf_def_h(0)%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) ) |
---|
| 885 | ENDDO |
---|
[1484] | 886 | ! |
---|
[2232] | 887 | !-- Natural surfaces |
---|
| 888 | DO m = 1, surf_lsm_h%ns |
---|
| 889 | k = surf_lsm_h%k(m) |
---|
| 890 | IF ( cum_lai_hf(0,j,i) /= 0.0_wp ) & |
---|
| 891 | surf_lsm_h%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) ) |
---|
| 892 | ENDDO |
---|
| 893 | ! |
---|
| 894 | !-- Urban surfaces |
---|
| 895 | DO m = 1, surf_usm_h%ns |
---|
| 896 | k = surf_usm_h%k(m) |
---|
| 897 | IF ( cum_lai_hf(0,j,i) /= 0.0_wp ) & |
---|
| 898 | surf_usm_h%shf(m) = cthf * exp( -ext_coef * cum_lai_hf(0,j,i) ) |
---|
| 899 | ENDDO |
---|
| 900 | ! |
---|
| 901 | ! |
---|
[2011] | 902 | !-- Calculation of the heating rate (K/s) within the different layers of |
---|
[2232] | 903 | !-- the plant canopy. Calculation is only necessary in areas covered with |
---|
| 904 | !-- canopy. |
---|
| 905 | !-- Within the different canopy layers the plant-canopy heating |
---|
| 906 | !-- rate (pc_heating_rate) is calculated as the vertical |
---|
| 907 | !-- divergence of the canopy heat fluxes at the top and bottom |
---|
| 908 | !-- of the respective layer |
---|
[1484] | 909 | DO i = nxlg, nxrg |
---|
| 910 | DO j = nysg, nyng |
---|
[2696] | 911 | DO k = 1, pch_index_ji(j,i) |
---|
[2232] | 912 | IF ( cum_lai_hf(0,j,i) /= 0.0_wp ) THEN |
---|
| 913 | pc_heating_rate(k,j,i) = cthf * & |
---|
| 914 | ( exp(-ext_coef*cum_lai_hf(k,j,i)) - & |
---|
| 915 | exp(-ext_coef*cum_lai_hf(k-1,j,i) ) ) / dzw(k) |
---|
| 916 | ENDIF |
---|
| 917 | ENDDO |
---|
[1721] | 918 | ENDDO |
---|
| 919 | ENDDO |
---|
[1484] | 920 | |
---|
| 921 | ENDIF |
---|
| 922 | |
---|
| 923 | |
---|
| 924 | |
---|
[1826] | 925 | END SUBROUTINE pcm_init |
---|
[1484] | 926 | |
---|
| 927 | |
---|
[2007] | 928 | !------------------------------------------------------------------------------! |
---|
| 929 | ! Description: |
---|
| 930 | ! ------------ |
---|
| 931 | !> Parin for &canopy_par for plant canopy model |
---|
| 932 | !------------------------------------------------------------------------------! |
---|
| 933 | SUBROUTINE pcm_parin |
---|
[1484] | 934 | |
---|
[2746] | 935 | USE control_parameters, & |
---|
| 936 | ONLY: plant_canopy |
---|
[2007] | 937 | |
---|
| 938 | IMPLICIT NONE |
---|
| 939 | |
---|
| 940 | CHARACTER (LEN=80) :: line !< dummy string that contains the current line of the parameter file |
---|
| 941 | |
---|
| 942 | NAMELIST /canopy_par/ alpha_lad, beta_lad, canopy_drag_coeff, & |
---|
| 943 | canopy_mode, cthf, & |
---|
| 944 | lad_surface, & |
---|
| 945 | lad_vertical_gradient, & |
---|
| 946 | lad_vertical_gradient_level, & |
---|
| 947 | lai_beta, & |
---|
| 948 | leaf_scalar_exch_coeff, & |
---|
| 949 | leaf_surface_conc, pch_index |
---|
| 950 | |
---|
| 951 | line = ' ' |
---|
| 952 | |
---|
| 953 | ! |
---|
| 954 | !-- Try to find radiation model package |
---|
| 955 | REWIND ( 11 ) |
---|
| 956 | line = ' ' |
---|
| 957 | DO WHILE ( INDEX( line, '&canopy_par' ) == 0 ) |
---|
| 958 | READ ( 11, '(A)', END=10 ) line |
---|
| 959 | ENDDO |
---|
| 960 | BACKSPACE ( 11 ) |
---|
| 961 | |
---|
| 962 | ! |
---|
| 963 | !-- Read user-defined namelist |
---|
| 964 | READ ( 11, canopy_par ) |
---|
| 965 | |
---|
| 966 | ! |
---|
| 967 | !-- Set flag that indicates that the radiation model is switched on |
---|
| 968 | plant_canopy = .TRUE. |
---|
| 969 | |
---|
| 970 | 10 CONTINUE |
---|
| 971 | |
---|
| 972 | |
---|
| 973 | END SUBROUTINE pcm_parin |
---|
| 974 | |
---|
| 975 | |
---|
| 976 | |
---|
[1484] | 977 | !------------------------------------------------------------------------------! |
---|
| 978 | ! Description: |
---|
| 979 | ! ------------ |
---|
[2007] | 980 | ! |
---|
| 981 | !> Loads 3D plant canopy data from file. File format is as follows: |
---|
| 982 | !> |
---|
| 983 | !> num_levels |
---|
| 984 | !> dtype,x,y,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1) |
---|
| 985 | !> dtype,x,y,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1) |
---|
| 986 | !> dtype,x,y,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1) |
---|
| 987 | !> ... |
---|
| 988 | !> |
---|
| 989 | !> i.e. first line determines number of levels and further lines represent plant |
---|
| 990 | !> canopy data, one line per column and variable. In each data line, |
---|
| 991 | !> dtype represents variable to be set: |
---|
| 992 | !> |
---|
| 993 | !> dtype=1: leaf area density (lad_s) |
---|
[2213] | 994 | !> dtype=2....n: some additional plant canopy input data quantity |
---|
[2007] | 995 | !> |
---|
| 996 | !> Zeros are added automatically above num_levels until top of domain. Any |
---|
| 997 | !> non-specified (x,y) columns have zero values as default. |
---|
| 998 | !------------------------------------------------------------------------------! |
---|
| 999 | SUBROUTINE pcm_read_plant_canopy_3d |
---|
[2213] | 1000 | |
---|
| 1001 | USE control_parameters, & |
---|
| 1002 | ONLY: message_string, passive_scalar |
---|
[2007] | 1003 | |
---|
[2213] | 1004 | USE indices, & |
---|
| 1005 | ONLY: nbgp |
---|
| 1006 | |
---|
| 1007 | IMPLICIT NONE |
---|
[2007] | 1008 | |
---|
[2213] | 1009 | INTEGER(iwp) :: dtype !< type of input data (1=lad) |
---|
| 1010 | INTEGER(iwp) :: i, j !< running index |
---|
| 1011 | INTEGER(iwp) :: nzp !< number of vertical layers of plant canopy |
---|
| 1012 | INTEGER(iwp) :: nzpltop !< |
---|
| 1013 | INTEGER(iwp) :: nzpl !< |
---|
| 1014 | |
---|
| 1015 | REAL(wp), DIMENSION(:), ALLOCATABLE :: col !< vertical column of input data |
---|
[2007] | 1016 | |
---|
[2213] | 1017 | ! |
---|
| 1018 | !-- Initialize lad_s array |
---|
| 1019 | lad_s = 0.0_wp |
---|
| 1020 | |
---|
| 1021 | ! |
---|
| 1022 | !-- Open and read plant canopy input data |
---|
| 1023 | OPEN(152, file='PLANT_CANOPY_DATA_3D', access='SEQUENTIAL', & |
---|
| 1024 | action='READ', status='OLD', form='FORMATTED', err=515) |
---|
| 1025 | READ(152, *, err=516, end=517) nzp !< read first line = number of vertical layers |
---|
| 1026 | |
---|
| 1027 | ALLOCATE(col(0:nzp-1)) |
---|
[2007] | 1028 | |
---|
[2213] | 1029 | DO |
---|
| 1030 | READ(152, *, err=516, end=517) dtype, i, j, col(:) |
---|
| 1031 | IF ( i < nxlg .or. i > nxrg .or. j < nysg .or. j > nyng ) CYCLE |
---|
[2007] | 1032 | |
---|
[2213] | 1033 | SELECT CASE (dtype) |
---|
| 1034 | CASE( 1 ) !< leaf area density |
---|
| 1035 | ! |
---|
| 1036 | !-- This is just the pure canopy layer assumed to be grounded to |
---|
| 1037 | !-- a flat domain surface. At locations where plant canopy sits |
---|
| 1038 | !-- on top of any kind of topography, the vertical plant column |
---|
| 1039 | !-- must be "lifted", which is done in SUBROUTINE pcm_tendency. |
---|
| 1040 | lad_s(0:nzp-1, j, i) = col(0:nzp-1) |
---|
| 1041 | |
---|
| 1042 | CASE DEFAULT |
---|
[2696] | 1043 | WRITE(message_string, '(a,i2,a)') & |
---|
[2213] | 1044 | 'Unknown record type in file PLANT_CANOPY_DATA_3D: "', dtype, '"' |
---|
| 1045 | CALL message( 'pcm_read_plant_canopy_3d', 'PA0530', 1, 2, 0, 6, 0 ) |
---|
| 1046 | END SELECT |
---|
| 1047 | ENDDO |
---|
[2007] | 1048 | |
---|
[2213] | 1049 | 515 message_string = 'error opening file PLANT_CANOPY_DATA_3D' |
---|
| 1050 | CALL message( 'pcm_read_plant_canopy_3d', 'PA0531', 1, 2, 0, 6, 0 ) |
---|
[2007] | 1051 | |
---|
[2213] | 1052 | 516 message_string = 'error reading file PLANT_CANOPY_DATA_3D' |
---|
| 1053 | CALL message( 'pcm_read_plant_canopy_3d', 'PA0532', 1, 2, 0, 6, 0 ) |
---|
| 1054 | |
---|
| 1055 | 517 CLOSE(152) |
---|
| 1056 | DEALLOCATE(col) |
---|
| 1057 | |
---|
| 1058 | CALL exchange_horiz( lad_s, nbgp ) |
---|
[2007] | 1059 | |
---|
| 1060 | END SUBROUTINE pcm_read_plant_canopy_3d |
---|
| 1061 | |
---|
| 1062 | |
---|
| 1063 | |
---|
| 1064 | !------------------------------------------------------------------------------! |
---|
| 1065 | ! Description: |
---|
| 1066 | ! ------------ |
---|
[1682] | 1067 | !> Calculation of the tendency terms, accounting for the effect of the plant |
---|
| 1068 | !> canopy on momentum and scalar quantities. |
---|
| 1069 | !> |
---|
| 1070 | !> The canopy is located where the leaf area density lad_s(k,j,i) > 0.0 |
---|
[1826] | 1071 | !> (defined on scalar grid), as initialized in subroutine pcm_init. |
---|
[1682] | 1072 | !> The lad on the w-grid is vertically interpolated from the surrounding |
---|
| 1073 | !> lad_s. The upper boundary of the canopy is defined on the w-grid at |
---|
| 1074 | !> k = pch_index. Here, the lad is zero. |
---|
| 1075 | !> |
---|
| 1076 | !> The canopy drag must be limited (previously accounted for by calculation of |
---|
| 1077 | !> a limiting canopy timestep for the determination of the maximum LES timestep |
---|
| 1078 | !> in subroutine timestep), since it is physically impossible that the canopy |
---|
| 1079 | !> drag alone can locally change the sign of a velocity component. This |
---|
| 1080 | !> limitation is realized by calculating preliminary tendencies and velocities. |
---|
| 1081 | !> It is subsequently checked if the preliminary new velocity has a different |
---|
| 1082 | !> sign than the current velocity. If so, the tendency is limited in a way that |
---|
| 1083 | !> the velocity can at maximum be reduced to zero by the canopy drag. |
---|
| 1084 | !> |
---|
| 1085 | !> |
---|
| 1086 | !> Call for all grid points |
---|
[1484] | 1087 | !------------------------------------------------------------------------------! |
---|
[1826] | 1088 | SUBROUTINE pcm_tendency( component ) |
---|
[138] | 1089 | |
---|
| 1090 | |
---|
[1320] | 1091 | USE control_parameters, & |
---|
[1484] | 1092 | ONLY: dt_3d, message_string |
---|
[1320] | 1093 | |
---|
| 1094 | USE kinds |
---|
| 1095 | |
---|
[138] | 1096 | IMPLICIT NONE |
---|
| 1097 | |
---|
[1682] | 1098 | INTEGER(iwp) :: component !< prognostic variable (u,v,w,pt,q,e) |
---|
| 1099 | INTEGER(iwp) :: i !< running index |
---|
| 1100 | INTEGER(iwp) :: j !< running index |
---|
| 1101 | INTEGER(iwp) :: k !< running index |
---|
[2232] | 1102 | INTEGER(iwp) :: k_wall !< vertical index of topography top |
---|
[1721] | 1103 | INTEGER(iwp) :: kk !< running index for flat lad arrays |
---|
[1484] | 1104 | |
---|
[1682] | 1105 | REAL(wp) :: ddt_3d !< inverse of the LES timestep (dt_3d) |
---|
| 1106 | REAL(wp) :: lad_local !< local lad value |
---|
| 1107 | REAL(wp) :: pre_tend !< preliminary tendency |
---|
| 1108 | REAL(wp) :: pre_u !< preliminary u-value |
---|
| 1109 | REAL(wp) :: pre_v !< preliminary v-value |
---|
| 1110 | REAL(wp) :: pre_w !< preliminary w-value |
---|
[1484] | 1111 | |
---|
| 1112 | |
---|
| 1113 | ddt_3d = 1.0_wp / dt_3d |
---|
[138] | 1114 | |
---|
| 1115 | ! |
---|
[1484] | 1116 | !-- Compute drag for the three velocity components and the SGS-TKE: |
---|
[138] | 1117 | SELECT CASE ( component ) |
---|
| 1118 | |
---|
| 1119 | ! |
---|
| 1120 | !-- u-component |
---|
| 1121 | CASE ( 1 ) |
---|
| 1122 | DO i = nxlu, nxr |
---|
| 1123 | DO j = nys, nyn |
---|
[2232] | 1124 | ! |
---|
| 1125 | !-- Determine topography-top index on u-grid |
---|
[2698] | 1126 | k_wall = get_topography_top_index_ji( j, i, 'u' ) |
---|
[2696] | 1127 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[1484] | 1128 | |
---|
[2232] | 1129 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1484] | 1130 | ! |
---|
| 1131 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 1132 | !-- the lad on the u-grid at index (k,j,i) is equal to |
---|
| 1133 | !-- lad_s(k,j,i), rather than being interpolated from the |
---|
| 1134 | !-- surrounding lad_s, because this would yield smaller lad |
---|
| 1135 | !-- at the canopy boundaries than inside of the canopy. |
---|
| 1136 | !-- For the same reason, the lad at the rightmost(i+1)canopy |
---|
| 1137 | !-- boundary on the u-grid equals lad_s(k,j,i). |
---|
[1721] | 1138 | lad_local = lad_s(kk,j,i) |
---|
| 1139 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j,i-1) > 0.0_wp )& |
---|
| 1140 | THEN |
---|
| 1141 | lad_local = lad_s(kk,j,i-1) |
---|
[1484] | 1142 | ENDIF |
---|
| 1143 | |
---|
| 1144 | pre_tend = 0.0_wp |
---|
| 1145 | pre_u = 0.0_wp |
---|
| 1146 | ! |
---|
| 1147 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1148 | pre_tend = - cdc * & |
---|
| 1149 | lad_local * & |
---|
| 1150 | SQRT( u(k,j,i)**2 + & |
---|
| 1151 | ( 0.25_wp * ( v(k,j,i-1) + & |
---|
| 1152 | v(k,j,i) + & |
---|
| 1153 | v(k,j+1,i) + & |
---|
| 1154 | v(k,j+1,i-1) ) & |
---|
| 1155 | )**2 + & |
---|
| 1156 | ( 0.25_wp * ( w(k-1,j,i-1) + & |
---|
| 1157 | w(k-1,j,i) + & |
---|
| 1158 | w(k,j,i-1) + & |
---|
| 1159 | w(k,j,i) ) & |
---|
| 1160 | )**2 & |
---|
| 1161 | ) * & |
---|
| 1162 | u(k,j,i) |
---|
| 1163 | |
---|
| 1164 | ! |
---|
| 1165 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1166 | pre_u = u(k,j,i) + dt_3d * pre_tend |
---|
| 1167 | ! |
---|
| 1168 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1169 | !-- and in case the signs are different, limit the tendency |
---|
| 1170 | IF ( SIGN(pre_u,u(k,j,i)) /= pre_u ) THEN |
---|
| 1171 | pre_tend = - u(k,j,i) * ddt_3d |
---|
| 1172 | ELSE |
---|
| 1173 | pre_tend = pre_tend |
---|
| 1174 | ENDIF |
---|
| 1175 | ! |
---|
| 1176 | !-- Calculate final tendency |
---|
| 1177 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1178 | |
---|
[138] | 1179 | ENDDO |
---|
| 1180 | ENDDO |
---|
| 1181 | ENDDO |
---|
| 1182 | |
---|
| 1183 | ! |
---|
| 1184 | !-- v-component |
---|
| 1185 | CASE ( 2 ) |
---|
| 1186 | DO i = nxl, nxr |
---|
| 1187 | DO j = nysv, nyn |
---|
[2232] | 1188 | ! |
---|
| 1189 | !-- Determine topography-top index on v-grid |
---|
[2698] | 1190 | k_wall = get_topography_top_index_ji( j, i, 'v' ) |
---|
[2317] | 1191 | |
---|
[2696] | 1192 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[1484] | 1193 | |
---|
[2232] | 1194 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1484] | 1195 | ! |
---|
| 1196 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 1197 | !-- the lad on the v-grid at index (k,j,i) is equal to |
---|
| 1198 | !-- lad_s(k,j,i), rather than being interpolated from the |
---|
| 1199 | !-- surrounding lad_s, because this would yield smaller lad |
---|
| 1200 | !-- at the canopy boundaries than inside of the canopy. |
---|
| 1201 | !-- For the same reason, the lad at the northmost(j+1) canopy |
---|
| 1202 | !-- boundary on the v-grid equals lad_s(k,j,i). |
---|
[1721] | 1203 | lad_local = lad_s(kk,j,i) |
---|
| 1204 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j-1,i) > 0.0_wp )& |
---|
| 1205 | THEN |
---|
| 1206 | lad_local = lad_s(kk,j-1,i) |
---|
[1484] | 1207 | ENDIF |
---|
| 1208 | |
---|
| 1209 | pre_tend = 0.0_wp |
---|
| 1210 | pre_v = 0.0_wp |
---|
| 1211 | ! |
---|
| 1212 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1213 | pre_tend = - cdc * & |
---|
| 1214 | lad_local * & |
---|
| 1215 | SQRT( ( 0.25_wp * ( u(k,j-1,i) + & |
---|
| 1216 | u(k,j-1,i+1) + & |
---|
| 1217 | u(k,j,i) + & |
---|
| 1218 | u(k,j,i+1) ) & |
---|
| 1219 | )**2 + & |
---|
| 1220 | v(k,j,i)**2 + & |
---|
| 1221 | ( 0.25_wp * ( w(k-1,j-1,i) + & |
---|
| 1222 | w(k-1,j,i) + & |
---|
| 1223 | w(k,j-1,i) + & |
---|
| 1224 | w(k,j,i) ) & |
---|
| 1225 | )**2 & |
---|
| 1226 | ) * & |
---|
| 1227 | v(k,j,i) |
---|
| 1228 | |
---|
| 1229 | ! |
---|
| 1230 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1231 | pre_v = v(k,j,i) + dt_3d * pre_tend |
---|
| 1232 | ! |
---|
| 1233 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1234 | !-- and in case the signs are different, limit the tendency |
---|
| 1235 | IF ( SIGN(pre_v,v(k,j,i)) /= pre_v ) THEN |
---|
| 1236 | pre_tend = - v(k,j,i) * ddt_3d |
---|
| 1237 | ELSE |
---|
| 1238 | pre_tend = pre_tend |
---|
| 1239 | ENDIF |
---|
| 1240 | ! |
---|
| 1241 | !-- Calculate final tendency |
---|
| 1242 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1243 | |
---|
[138] | 1244 | ENDDO |
---|
| 1245 | ENDDO |
---|
| 1246 | ENDDO |
---|
| 1247 | |
---|
| 1248 | ! |
---|
| 1249 | !-- w-component |
---|
| 1250 | CASE ( 3 ) |
---|
| 1251 | DO i = nxl, nxr |
---|
| 1252 | DO j = nys, nyn |
---|
[2232] | 1253 | ! |
---|
| 1254 | !-- Determine topography-top index on w-grid |
---|
[2698] | 1255 | k_wall = get_topography_top_index_ji( j, i, 'w' ) |
---|
[2317] | 1256 | |
---|
[2696] | 1257 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) - 1 |
---|
[1484] | 1258 | |
---|
[2232] | 1259 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1721] | 1260 | |
---|
[1484] | 1261 | pre_tend = 0.0_wp |
---|
| 1262 | pre_w = 0.0_wp |
---|
| 1263 | ! |
---|
| 1264 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1265 | pre_tend = - cdc * & |
---|
| 1266 | (0.5_wp * & |
---|
[1721] | 1267 | ( lad_s(kk+1,j,i) + lad_s(kk,j,i) )) * & |
---|
[1484] | 1268 | SQRT( ( 0.25_wp * ( u(k,j,i) + & |
---|
| 1269 | u(k,j,i+1) + & |
---|
| 1270 | u(k+1,j,i) + & |
---|
| 1271 | u(k+1,j,i+1) ) & |
---|
| 1272 | )**2 + & |
---|
| 1273 | ( 0.25_wp * ( v(k,j,i) + & |
---|
| 1274 | v(k,j+1,i) + & |
---|
| 1275 | v(k+1,j,i) + & |
---|
| 1276 | v(k+1,j+1,i) ) & |
---|
| 1277 | )**2 + & |
---|
| 1278 | w(k,j,i)**2 & |
---|
| 1279 | ) * & |
---|
| 1280 | w(k,j,i) |
---|
| 1281 | ! |
---|
| 1282 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1283 | pre_w = w(k,j,i) + dt_3d * pre_tend |
---|
| 1284 | ! |
---|
| 1285 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1286 | !-- and in case the signs are different, limit the tendency |
---|
| 1287 | IF ( SIGN(pre_w,w(k,j,i)) /= pre_w ) THEN |
---|
| 1288 | pre_tend = - w(k,j,i) * ddt_3d |
---|
| 1289 | ELSE |
---|
| 1290 | pre_tend = pre_tend |
---|
| 1291 | ENDIF |
---|
| 1292 | ! |
---|
| 1293 | !-- Calculate final tendency |
---|
| 1294 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1295 | |
---|
[138] | 1296 | ENDDO |
---|
| 1297 | ENDDO |
---|
| 1298 | ENDDO |
---|
| 1299 | |
---|
| 1300 | ! |
---|
[153] | 1301 | !-- potential temperature |
---|
[138] | 1302 | CASE ( 4 ) |
---|
| 1303 | DO i = nxl, nxr |
---|
| 1304 | DO j = nys, nyn |
---|
[2232] | 1305 | ! |
---|
| 1306 | !-- Determine topography-top index on scalar-grid |
---|
[2698] | 1307 | k_wall = get_topography_top_index_ji( j, i, 's' ) |
---|
[2317] | 1308 | |
---|
[2696] | 1309 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1310 | |
---|
| 1311 | kk = k - k_wall !- lad arrays are defined flat |
---|
[2011] | 1312 | tend(k,j,i) = tend(k,j,i) + pc_heating_rate(kk,j,i) |
---|
[153] | 1313 | ENDDO |
---|
| 1314 | ENDDO |
---|
| 1315 | ENDDO |
---|
| 1316 | |
---|
| 1317 | ! |
---|
[1960] | 1318 | !-- humidity |
---|
[153] | 1319 | CASE ( 5 ) |
---|
| 1320 | DO i = nxl, nxr |
---|
| 1321 | DO j = nys, nyn |
---|
[2232] | 1322 | ! |
---|
| 1323 | !-- Determine topography-top index on scalar-grid |
---|
[2698] | 1324 | k_wall = get_topography_top_index_ji( j, i, 's' ) |
---|
[2317] | 1325 | |
---|
[2696] | 1326 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1327 | |
---|
| 1328 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1484] | 1329 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1330 | lsec * & |
---|
[1721] | 1331 | lad_s(kk,j,i) * & |
---|
[1484] | 1332 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1333 | u(k,j,i+1) ) & |
---|
| 1334 | )**2 + & |
---|
| 1335 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1336 | v(k,j+1,i) ) & |
---|
| 1337 | )**2 + & |
---|
| 1338 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 1339 | w(k,j,i) ) & |
---|
| 1340 | )**2 & |
---|
| 1341 | ) * & |
---|
| 1342 | ( q(k,j,i) - lsc ) |
---|
[153] | 1343 | ENDDO |
---|
| 1344 | ENDDO |
---|
| 1345 | ENDDO |
---|
| 1346 | |
---|
| 1347 | ! |
---|
| 1348 | !-- sgs-tke |
---|
| 1349 | CASE ( 6 ) |
---|
| 1350 | DO i = nxl, nxr |
---|
| 1351 | DO j = nys, nyn |
---|
[2232] | 1352 | ! |
---|
| 1353 | !-- Determine topography-top index on scalar-grid |
---|
[2698] | 1354 | k_wall = get_topography_top_index_ji( j, i, 's' ) |
---|
[2317] | 1355 | |
---|
[2696] | 1356 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1357 | |
---|
| 1358 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1484] | 1359 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1360 | 2.0_wp * cdc * & |
---|
[1721] | 1361 | lad_s(kk,j,i) * & |
---|
[1484] | 1362 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1363 | u(k,j,i+1) ) & |
---|
| 1364 | )**2 + & |
---|
| 1365 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1366 | v(k,j+1,i) ) & |
---|
| 1367 | )**2 + & |
---|
| 1368 | ( 0.5_wp * ( w(k,j,i) + & |
---|
| 1369 | w(k+1,j,i) ) & |
---|
| 1370 | )**2 & |
---|
| 1371 | ) * & |
---|
| 1372 | e(k,j,i) |
---|
[138] | 1373 | ENDDO |
---|
| 1374 | ENDDO |
---|
| 1375 | ENDDO |
---|
[1960] | 1376 | ! |
---|
| 1377 | !-- scalar concentration |
---|
| 1378 | CASE ( 7 ) |
---|
| 1379 | DO i = nxl, nxr |
---|
| 1380 | DO j = nys, nyn |
---|
[2232] | 1381 | ! |
---|
| 1382 | !-- Determine topography-top index on scalar-grid |
---|
[2698] | 1383 | k_wall = get_topography_top_index_ji( j, i, 's' ) |
---|
[2317] | 1384 | |
---|
[2696] | 1385 | DO k = k_wall+1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1386 | |
---|
| 1387 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1960] | 1388 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1389 | lsec * & |
---|
| 1390 | lad_s(kk,j,i) * & |
---|
| 1391 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1392 | u(k,j,i+1) ) & |
---|
| 1393 | )**2 + & |
---|
| 1394 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1395 | v(k,j+1,i) ) & |
---|
| 1396 | )**2 + & |
---|
| 1397 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 1398 | w(k,j,i) ) & |
---|
| 1399 | )**2 & |
---|
| 1400 | ) * & |
---|
| 1401 | ( s(k,j,i) - lsc ) |
---|
| 1402 | ENDDO |
---|
| 1403 | ENDDO |
---|
| 1404 | ENDDO |
---|
[1484] | 1405 | |
---|
| 1406 | |
---|
[1960] | 1407 | |
---|
[138] | 1408 | CASE DEFAULT |
---|
| 1409 | |
---|
[257] | 1410 | WRITE( message_string, * ) 'wrong component: ', component |
---|
[1826] | 1411 | CALL message( 'pcm_tendency', 'PA0279', 1, 2, 0, 6, 0 ) |
---|
[138] | 1412 | |
---|
| 1413 | END SELECT |
---|
| 1414 | |
---|
[1826] | 1415 | END SUBROUTINE pcm_tendency |
---|
[138] | 1416 | |
---|
| 1417 | |
---|
| 1418 | !------------------------------------------------------------------------------! |
---|
[1484] | 1419 | ! Description: |
---|
| 1420 | ! ------------ |
---|
[1682] | 1421 | !> Calculation of the tendency terms, accounting for the effect of the plant |
---|
| 1422 | !> canopy on momentum and scalar quantities. |
---|
| 1423 | !> |
---|
| 1424 | !> The canopy is located where the leaf area density lad_s(k,j,i) > 0.0 |
---|
[1826] | 1425 | !> (defined on scalar grid), as initialized in subroutine pcm_init. |
---|
[1682] | 1426 | !> The lad on the w-grid is vertically interpolated from the surrounding |
---|
| 1427 | !> lad_s. The upper boundary of the canopy is defined on the w-grid at |
---|
| 1428 | !> k = pch_index. Here, the lad is zero. |
---|
| 1429 | !> |
---|
| 1430 | !> The canopy drag must be limited (previously accounted for by calculation of |
---|
| 1431 | !> a limiting canopy timestep for the determination of the maximum LES timestep |
---|
| 1432 | !> in subroutine timestep), since it is physically impossible that the canopy |
---|
| 1433 | !> drag alone can locally change the sign of a velocity component. This |
---|
| 1434 | !> limitation is realized by calculating preliminary tendencies and velocities. |
---|
| 1435 | !> It is subsequently checked if the preliminary new velocity has a different |
---|
| 1436 | !> sign than the current velocity. If so, the tendency is limited in a way that |
---|
| 1437 | !> the velocity can at maximum be reduced to zero by the canopy drag. |
---|
| 1438 | !> |
---|
| 1439 | !> |
---|
| 1440 | !> Call for grid point i,j |
---|
[138] | 1441 | !------------------------------------------------------------------------------! |
---|
[1826] | 1442 | SUBROUTINE pcm_tendency_ij( i, j, component ) |
---|
[138] | 1443 | |
---|
| 1444 | |
---|
[1320] | 1445 | USE control_parameters, & |
---|
[1484] | 1446 | ONLY: dt_3d, message_string |
---|
[1320] | 1447 | |
---|
| 1448 | USE kinds |
---|
| 1449 | |
---|
[138] | 1450 | IMPLICIT NONE |
---|
| 1451 | |
---|
[1682] | 1452 | INTEGER(iwp) :: component !< prognostic variable (u,v,w,pt,q,e) |
---|
| 1453 | INTEGER(iwp) :: i !< running index |
---|
| 1454 | INTEGER(iwp) :: j !< running index |
---|
| 1455 | INTEGER(iwp) :: k !< running index |
---|
[2232] | 1456 | INTEGER(iwp) :: k_wall !< vertical index of topography top |
---|
[1721] | 1457 | INTEGER(iwp) :: kk !< running index for flat lad arrays |
---|
[138] | 1458 | |
---|
[1682] | 1459 | REAL(wp) :: ddt_3d !< inverse of the LES timestep (dt_3d) |
---|
| 1460 | REAL(wp) :: lad_local !< local lad value |
---|
| 1461 | REAL(wp) :: pre_tend !< preliminary tendency |
---|
| 1462 | REAL(wp) :: pre_u !< preliminary u-value |
---|
| 1463 | REAL(wp) :: pre_v !< preliminary v-value |
---|
| 1464 | REAL(wp) :: pre_w !< preliminary w-value |
---|
[1484] | 1465 | |
---|
| 1466 | |
---|
| 1467 | ddt_3d = 1.0_wp / dt_3d |
---|
[138] | 1468 | ! |
---|
[1484] | 1469 | !-- Compute drag for the three velocity components and the SGS-TKE |
---|
[142] | 1470 | SELECT CASE ( component ) |
---|
[138] | 1471 | |
---|
| 1472 | ! |
---|
[142] | 1473 | !-- u-component |
---|
[1484] | 1474 | CASE ( 1 ) |
---|
[2232] | 1475 | ! |
---|
| 1476 | !-- Determine topography-top index on u-grid |
---|
[2698] | 1477 | k_wall = get_topography_top_index_ji( j, i, 'u' ) |
---|
[2696] | 1478 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[2317] | 1479 | |
---|
[2696] | 1480 | kk = k - k_wall !- lad arrays are defined flat |
---|
[138] | 1481 | |
---|
| 1482 | ! |
---|
[1484] | 1483 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 1484 | !-- the lad on the u-grid at index (k,j,i) is equal to lad_s(k,j,i), |
---|
| 1485 | !-- rather than being interpolated from the surrounding lad_s, |
---|
| 1486 | !-- because this would yield smaller lad at the canopy boundaries |
---|
| 1487 | !-- than inside of the canopy. |
---|
| 1488 | !-- For the same reason, the lad at the rightmost(i+1)canopy |
---|
| 1489 | !-- boundary on the u-grid equals lad_s(k,j,i). |
---|
[1721] | 1490 | lad_local = lad_s(kk,j,i) |
---|
| 1491 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j,i-1) > 0.0_wp ) THEN |
---|
| 1492 | lad_local = lad_s(kk,j,i-1) |
---|
[1484] | 1493 | ENDIF |
---|
| 1494 | |
---|
| 1495 | pre_tend = 0.0_wp |
---|
| 1496 | pre_u = 0.0_wp |
---|
| 1497 | ! |
---|
| 1498 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1499 | pre_tend = - cdc * & |
---|
| 1500 | lad_local * & |
---|
| 1501 | SQRT( u(k,j,i)**2 + & |
---|
| 1502 | ( 0.25_wp * ( v(k,j,i-1) + & |
---|
| 1503 | v(k,j,i) + & |
---|
| 1504 | v(k,j+1,i) + & |
---|
| 1505 | v(k,j+1,i-1) ) & |
---|
| 1506 | )**2 + & |
---|
| 1507 | ( 0.25_wp * ( w(k-1,j,i-1) + & |
---|
| 1508 | w(k-1,j,i) + & |
---|
| 1509 | w(k,j,i-1) + & |
---|
| 1510 | w(k,j,i) ) & |
---|
| 1511 | )**2 & |
---|
| 1512 | ) * & |
---|
| 1513 | u(k,j,i) |
---|
| 1514 | |
---|
| 1515 | ! |
---|
| 1516 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1517 | pre_u = u(k,j,i) + dt_3d * pre_tend |
---|
| 1518 | ! |
---|
| 1519 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1520 | !-- and in case the signs are different, limit the tendency |
---|
| 1521 | IF ( SIGN(pre_u,u(k,j,i)) /= pre_u ) THEN |
---|
| 1522 | pre_tend = - u(k,j,i) * ddt_3d |
---|
| 1523 | ELSE |
---|
| 1524 | pre_tend = pre_tend |
---|
| 1525 | ENDIF |
---|
| 1526 | ! |
---|
| 1527 | !-- Calculate final tendency |
---|
| 1528 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1529 | ENDDO |
---|
| 1530 | |
---|
| 1531 | |
---|
| 1532 | ! |
---|
[142] | 1533 | !-- v-component |
---|
[1484] | 1534 | CASE ( 2 ) |
---|
[2232] | 1535 | ! |
---|
| 1536 | !-- Determine topography-top index on v-grid |
---|
[2698] | 1537 | k_wall = get_topography_top_index_ji( j, i, 'v' ) |
---|
[2317] | 1538 | |
---|
[2696] | 1539 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[138] | 1540 | |
---|
[2232] | 1541 | kk = k - k_wall !- lad arrays are defined flat |
---|
[138] | 1542 | ! |
---|
[1484] | 1543 | !-- In order to create sharp boundaries of the plant canopy, |
---|
| 1544 | !-- the lad on the v-grid at index (k,j,i) is equal to lad_s(k,j,i), |
---|
| 1545 | !-- rather than being interpolated from the surrounding lad_s, |
---|
| 1546 | !-- because this would yield smaller lad at the canopy boundaries |
---|
| 1547 | !-- than inside of the canopy. |
---|
| 1548 | !-- For the same reason, the lad at the northmost(j+1)canopy |
---|
| 1549 | !-- boundary on the v-grid equals lad_s(k,j,i). |
---|
[1721] | 1550 | lad_local = lad_s(kk,j,i) |
---|
| 1551 | IF ( lad_local == 0.0_wp .AND. lad_s(kk,j-1,i) > 0.0_wp ) THEN |
---|
| 1552 | lad_local = lad_s(kk,j-1,i) |
---|
[1484] | 1553 | ENDIF |
---|
| 1554 | |
---|
| 1555 | pre_tend = 0.0_wp |
---|
| 1556 | pre_v = 0.0_wp |
---|
| 1557 | ! |
---|
| 1558 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1559 | pre_tend = - cdc * & |
---|
| 1560 | lad_local * & |
---|
| 1561 | SQRT( ( 0.25_wp * ( u(k,j-1,i) + & |
---|
| 1562 | u(k,j-1,i+1) + & |
---|
| 1563 | u(k,j,i) + & |
---|
| 1564 | u(k,j,i+1) ) & |
---|
| 1565 | )**2 + & |
---|
| 1566 | v(k,j,i)**2 + & |
---|
| 1567 | ( 0.25_wp * ( w(k-1,j-1,i) + & |
---|
| 1568 | w(k-1,j,i) + & |
---|
| 1569 | w(k,j-1,i) + & |
---|
| 1570 | w(k,j,i) ) & |
---|
| 1571 | )**2 & |
---|
| 1572 | ) * & |
---|
| 1573 | v(k,j,i) |
---|
| 1574 | |
---|
| 1575 | ! |
---|
| 1576 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1577 | pre_v = v(k,j,i) + dt_3d * pre_tend |
---|
| 1578 | ! |
---|
| 1579 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1580 | !-- and in case the signs are different, limit the tendency |
---|
| 1581 | IF ( SIGN(pre_v,v(k,j,i)) /= pre_v ) THEN |
---|
| 1582 | pre_tend = - v(k,j,i) * ddt_3d |
---|
| 1583 | ELSE |
---|
| 1584 | pre_tend = pre_tend |
---|
| 1585 | ENDIF |
---|
| 1586 | ! |
---|
| 1587 | !-- Calculate final tendency |
---|
| 1588 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1589 | ENDDO |
---|
| 1590 | |
---|
| 1591 | |
---|
| 1592 | ! |
---|
[142] | 1593 | !-- w-component |
---|
[1484] | 1594 | CASE ( 3 ) |
---|
[2232] | 1595 | ! |
---|
| 1596 | !-- Determine topography-top index on w-grid |
---|
[2698] | 1597 | k_wall = get_topography_top_index_ji( j, i, 'w' ) |
---|
[2317] | 1598 | |
---|
[2696] | 1599 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) - 1 |
---|
[138] | 1600 | |
---|
[2232] | 1601 | kk = k - k_wall !- lad arrays are defined flat |
---|
[1721] | 1602 | |
---|
[1484] | 1603 | pre_tend = 0.0_wp |
---|
| 1604 | pre_w = 0.0_wp |
---|
[138] | 1605 | ! |
---|
[1484] | 1606 | !-- Calculate preliminary value (pre_tend) of the tendency |
---|
| 1607 | pre_tend = - cdc * & |
---|
| 1608 | (0.5_wp * & |
---|
[1721] | 1609 | ( lad_s(kk+1,j,i) + lad_s(kk,j,i) )) * & |
---|
[1484] | 1610 | SQRT( ( 0.25_wp * ( u(k,j,i) + & |
---|
| 1611 | u(k,j,i+1) + & |
---|
| 1612 | u(k+1,j,i) + & |
---|
| 1613 | u(k+1,j,i+1) ) & |
---|
| 1614 | )**2 + & |
---|
| 1615 | ( 0.25_wp * ( v(k,j,i) + & |
---|
| 1616 | v(k,j+1,i) + & |
---|
| 1617 | v(k+1,j,i) + & |
---|
| 1618 | v(k+1,j+1,i) ) & |
---|
| 1619 | )**2 + & |
---|
| 1620 | w(k,j,i)**2 & |
---|
| 1621 | ) * & |
---|
| 1622 | w(k,j,i) |
---|
| 1623 | ! |
---|
| 1624 | !-- Calculate preliminary new velocity, based on pre_tend |
---|
| 1625 | pre_w = w(k,j,i) + dt_3d * pre_tend |
---|
| 1626 | ! |
---|
| 1627 | !-- Compare sign of old velocity and new preliminary velocity, |
---|
| 1628 | !-- and in case the signs are different, limit the tendency |
---|
| 1629 | IF ( SIGN(pre_w,w(k,j,i)) /= pre_w ) THEN |
---|
| 1630 | pre_tend = - w(k,j,i) * ddt_3d |
---|
| 1631 | ELSE |
---|
| 1632 | pre_tend = pre_tend |
---|
| 1633 | ENDIF |
---|
| 1634 | ! |
---|
| 1635 | !-- Calculate final tendency |
---|
| 1636 | tend(k,j,i) = tend(k,j,i) + pre_tend |
---|
| 1637 | ENDDO |
---|
| 1638 | |
---|
| 1639 | ! |
---|
[153] | 1640 | !-- potential temperature |
---|
| 1641 | CASE ( 4 ) |
---|
[2232] | 1642 | ! |
---|
| 1643 | !-- Determine topography-top index on scalar grid |
---|
[2698] | 1644 | k_wall = get_topography_top_index_ji( j, i, 's' ) |
---|
[2317] | 1645 | |
---|
[2696] | 1646 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1647 | kk = k - k_wall !- lad arrays are defined flat |
---|
[2011] | 1648 | tend(k,j,i) = tend(k,j,i) + pc_heating_rate(kk,j,i) |
---|
[153] | 1649 | ENDDO |
---|
| 1650 | |
---|
| 1651 | |
---|
| 1652 | ! |
---|
[1960] | 1653 | !-- humidity |
---|
[153] | 1654 | CASE ( 5 ) |
---|
[2232] | 1655 | ! |
---|
| 1656 | !-- Determine topography-top index on scalar grid |
---|
[2698] | 1657 | k_wall = get_topography_top_index_ji( j, i, 's' ) |
---|
[2317] | 1658 | |
---|
[2696] | 1659 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1660 | |
---|
| 1661 | kk = k - k_wall |
---|
[1484] | 1662 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1663 | lsec * & |
---|
[1721] | 1664 | lad_s(kk,j,i) * & |
---|
[1484] | 1665 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1666 | u(k,j,i+1) ) & |
---|
| 1667 | )**2 + & |
---|
| 1668 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1669 | v(k,j+1,i) ) & |
---|
| 1670 | )**2 + & |
---|
| 1671 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 1672 | w(k,j,i) ) & |
---|
| 1673 | )**2 & |
---|
| 1674 | ) * & |
---|
| 1675 | ( q(k,j,i) - lsc ) |
---|
[153] | 1676 | ENDDO |
---|
| 1677 | |
---|
| 1678 | ! |
---|
[142] | 1679 | !-- sgs-tke |
---|
[1484] | 1680 | CASE ( 6 ) |
---|
[2232] | 1681 | ! |
---|
| 1682 | !-- Determine topography-top index on scalar grid |
---|
[2698] | 1683 | k_wall = get_topography_top_index_ji( j, i, 's' ) |
---|
[2317] | 1684 | |
---|
[2696] | 1685 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1686 | |
---|
| 1687 | kk = k - k_wall |
---|
[1484] | 1688 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1689 | 2.0_wp * cdc * & |
---|
[1721] | 1690 | lad_s(kk,j,i) * & |
---|
[1484] | 1691 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1692 | u(k,j,i+1) ) & |
---|
| 1693 | )**2 + & |
---|
| 1694 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1695 | v(k,j+1,i) ) & |
---|
| 1696 | )**2 + & |
---|
| 1697 | ( 0.5_wp * ( w(k,j,i) + & |
---|
| 1698 | w(k+1,j,i) ) & |
---|
| 1699 | )**2 & |
---|
| 1700 | ) * & |
---|
| 1701 | e(k,j,i) |
---|
| 1702 | ENDDO |
---|
[1960] | 1703 | |
---|
| 1704 | ! |
---|
| 1705 | !-- scalar concentration |
---|
| 1706 | CASE ( 7 ) |
---|
[2232] | 1707 | ! |
---|
| 1708 | !-- Determine topography-top index on scalar grid |
---|
[2698] | 1709 | k_wall = get_topography_top_index_ji( j, i, 's' ) |
---|
[2317] | 1710 | |
---|
[2696] | 1711 | DO k = k_wall + 1, k_wall + pch_index_ji(j,i) |
---|
[2232] | 1712 | |
---|
| 1713 | kk = k - k_wall |
---|
[1960] | 1714 | tend(k,j,i) = tend(k,j,i) - & |
---|
| 1715 | lsec * & |
---|
| 1716 | lad_s(kk,j,i) * & |
---|
| 1717 | SQRT( ( 0.5_wp * ( u(k,j,i) + & |
---|
| 1718 | u(k,j,i+1) ) & |
---|
| 1719 | )**2 + & |
---|
| 1720 | ( 0.5_wp * ( v(k,j,i) + & |
---|
| 1721 | v(k,j+1,i) ) & |
---|
| 1722 | )**2 + & |
---|
| 1723 | ( 0.5_wp * ( w(k-1,j,i) + & |
---|
| 1724 | w(k,j,i) ) & |
---|
| 1725 | )**2 & |
---|
| 1726 | ) * & |
---|
| 1727 | ( s(k,j,i) - lsc ) |
---|
| 1728 | ENDDO |
---|
[138] | 1729 | |
---|
[142] | 1730 | CASE DEFAULT |
---|
[138] | 1731 | |
---|
[257] | 1732 | WRITE( message_string, * ) 'wrong component: ', component |
---|
[1826] | 1733 | CALL message( 'pcm_tendency', 'PA0279', 1, 2, 0, 6, 0 ) |
---|
[138] | 1734 | |
---|
[142] | 1735 | END SELECT |
---|
[138] | 1736 | |
---|
[1826] | 1737 | END SUBROUTINE pcm_tendency_ij |
---|
[138] | 1738 | |
---|
[2007] | 1739 | |
---|
| 1740 | |
---|
[138] | 1741 | END MODULE plant_canopy_model_mod |
---|