[1] | 1 | #if defined( __ibmy_special ) |
---|
| 2 | @PROCESS NOOPTimize |
---|
| 3 | #endif |
---|
| 4 | SUBROUTINE init_3d_model |
---|
| 5 | |
---|
| 6 | !------------------------------------------------------------------------------! |
---|
[254] | 7 | ! Current revisions: |
---|
[1] | 8 | ! ----------------- |
---|
[394] | 9 | ! var_ts is replaced by dots_max |
---|
[392] | 10 | ! |
---|
[394] | 11 | ! |
---|
[392] | 12 | ! Former revisions: |
---|
| 13 | ! ----------------- |
---|
| 14 | ! $Id: init_3d_model.f90 394 2009-09-29 14:34:24Z raasch $ |
---|
| 15 | ! |
---|
| 16 | ! 388 2009-09-23 09:40:33Z raasch |
---|
[388] | 17 | ! Initialization of prho added. |
---|
[359] | 18 | ! bugfix: correction of initial volume flow for non-flat topography |
---|
| 19 | ! bugfix: zero initialization of arrays within buildings for 'cyclic_fill' |
---|
[333] | 20 | ! bugfix: avoid that ngp_2dh_s_inner becomes zero |
---|
[328] | 21 | ! initializing_actions='read_data_for_recycling' renamed to 'cyclic_fill', now |
---|
| 22 | ! independent of turbulent_inflow |
---|
[254] | 23 | ! Output of messages replaced by message handling routine. |
---|
[240] | 24 | ! Set the starting level and the vertical smoothing factor used for |
---|
| 25 | ! the external pressure gradient |
---|
[254] | 26 | ! +conserve_volume_flow_mode: 'default', 'initial_profiles', 'inflow_profile' |
---|
[241] | 27 | ! and 'bulk_velocity' |
---|
[292] | 28 | ! If the inversion height calculated by the prerun is zero, |
---|
| 29 | ! inflow_damping_height must be explicitly specified. |
---|
[139] | 30 | ! |
---|
[198] | 31 | ! 181 2008-07-30 07:07:47Z raasch |
---|
| 32 | ! bugfix: zero assignments to tendency arrays in case of restarts, |
---|
| 33 | ! further extensions and modifications in the initialisation of the plant |
---|
| 34 | ! canopy model, |
---|
| 35 | ! allocation of hom_sum moved to parin, initialization of spectrum_x|y directly |
---|
| 36 | ! after allocating theses arrays, |
---|
| 37 | ! read data for recycling added as new initialization option, |
---|
| 38 | ! dummy allocation for diss |
---|
| 39 | ! |
---|
[139] | 40 | ! 138 2007-11-28 10:03:58Z letzel |
---|
[132] | 41 | ! New counter ngp_2dh_s_inner. |
---|
| 42 | ! Allow new case bc_uv_t = 'dirichlet_0' for channel flow. |
---|
| 43 | ! Corrected calculation of initial volume flow for 'set_1d-model_profiles' and |
---|
| 44 | ! 'set_constant_profiles' in case of buildings in the reference cross-sections. |
---|
[77] | 45 | ! |
---|
[110] | 46 | ! 108 2007-08-24 15:10:38Z letzel |
---|
| 47 | ! Flux initialization in case of coupled runs, +momentum fluxes at top boundary, |
---|
| 48 | ! +arrays for phase speed c_u, c_v, c_w, indices for u|v|w_m_l|r changed |
---|
| 49 | ! +qswst_remote in case of atmosphere model with humidity coupled to ocean |
---|
| 50 | ! Rayleigh damping for ocean, optionally calculate km and kh from initial |
---|
| 51 | ! TKE e_init |
---|
| 52 | ! |
---|
[98] | 53 | ! 97 2007-06-21 08:23:15Z raasch |
---|
| 54 | ! Initialization of salinity, call of init_ocean |
---|
| 55 | ! |
---|
[90] | 56 | ! 87 2007-05-22 15:46:47Z raasch |
---|
| 57 | ! var_hom and var_sum renamed pr_palm |
---|
| 58 | ! |
---|
[77] | 59 | ! 75 2007-03-22 09:54:05Z raasch |
---|
[73] | 60 | ! Arrays for radiation boundary conditions are allocated (u_m_l, u_m_r, etc.), |
---|
| 61 | ! bugfix for cases with the outflow damping layer extending over more than one |
---|
[75] | 62 | ! subdomain, moisture renamed humidity, |
---|
| 63 | ! new initializing action "by_user" calls user_init_3d_model, |
---|
[72] | 64 | ! precipitation_amount/rate, ts_value are allocated, +module netcdf_control, |
---|
[51] | 65 | ! initial velocities at nzb+1 are regarded for volume |
---|
| 66 | ! flow control in case they have been set zero before (to avoid small timesteps) |
---|
[75] | 67 | ! -uvmean_outflow, uxrp, vynp eliminated |
---|
[1] | 68 | ! |
---|
[39] | 69 | ! 19 2007-02-23 04:53:48Z raasch |
---|
| 70 | ! +handling of top fluxes |
---|
| 71 | ! |
---|
[3] | 72 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
| 73 | ! |
---|
[1] | 74 | ! Revision 1.49 2006/08/22 15:59:07 raasch |
---|
| 75 | ! No optimization of this file on the ibmy (Yonsei Univ.) |
---|
| 76 | ! |
---|
| 77 | ! Revision 1.1 1998/03/09 16:22:22 raasch |
---|
| 78 | ! Initial revision |
---|
| 79 | ! |
---|
| 80 | ! |
---|
| 81 | ! Description: |
---|
| 82 | ! ------------ |
---|
| 83 | ! Allocation of arrays and initialization of the 3D model via |
---|
| 84 | ! a) pre-run the 1D model |
---|
| 85 | ! or |
---|
| 86 | ! b) pre-set constant linear profiles |
---|
| 87 | ! or |
---|
| 88 | ! c) read values of a previous run |
---|
| 89 | !------------------------------------------------------------------------------! |
---|
| 90 | |
---|
| 91 | USE arrays_3d |
---|
| 92 | USE averaging |
---|
[72] | 93 | USE cloud_parameters |
---|
[1] | 94 | USE constants |
---|
| 95 | USE control_parameters |
---|
| 96 | USE cpulog |
---|
| 97 | USE indices |
---|
| 98 | USE interfaces |
---|
| 99 | USE model_1d |
---|
[51] | 100 | USE netcdf_control |
---|
[1] | 101 | USE particle_attributes |
---|
| 102 | USE pegrid |
---|
| 103 | USE profil_parameter |
---|
| 104 | USE random_function_mod |
---|
| 105 | USE statistics |
---|
| 106 | |
---|
| 107 | IMPLICIT NONE |
---|
| 108 | |
---|
[240] | 109 | INTEGER :: i, ind_array(1), j, k, sr |
---|
[1] | 110 | |
---|
| 111 | INTEGER, DIMENSION(:), ALLOCATABLE :: ngp_2dh_l, ngp_3d_inner_l |
---|
| 112 | |
---|
[132] | 113 | INTEGER, DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_outer_l, & |
---|
| 114 | ngp_2dh_s_inner_l |
---|
[1] | 115 | |
---|
[153] | 116 | REAL :: a, b |
---|
| 117 | |
---|
[1] | 118 | REAL, DIMENSION(1:2) :: volume_flow_area_l, volume_flow_initial_l |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | ! |
---|
| 122 | !-- Allocate arrays |
---|
| 123 | ALLOCATE( ngp_2dh(0:statistic_regions), ngp_2dh_l(0:statistic_regions), & |
---|
| 124 | ngp_3d(0:statistic_regions), & |
---|
| 125 | ngp_3d_inner(0:statistic_regions), & |
---|
| 126 | ngp_3d_inner_l(0:statistic_regions), & |
---|
| 127 | sums_divnew_l(0:statistic_regions), & |
---|
| 128 | sums_divold_l(0:statistic_regions) ) |
---|
[240] | 129 | ALLOCATE( dp_smooth_factor(nzb:nzt), rdf(nzb+1:nzt) ) |
---|
[143] | 130 | ALLOCATE( ngp_2dh_outer(nzb:nzt+1,0:statistic_regions), & |
---|
[1] | 131 | ngp_2dh_outer_l(nzb:nzt+1,0:statistic_regions), & |
---|
[132] | 132 | ngp_2dh_s_inner(nzb:nzt+1,0:statistic_regions), & |
---|
| 133 | ngp_2dh_s_inner_l(nzb:nzt+1,0:statistic_regions), & |
---|
[1] | 134 | rmask(nys-1:nyn+1,nxl-1:nxr+1,0:statistic_regions), & |
---|
[87] | 135 | sums(nzb:nzt+1,pr_palm+max_pr_user), & |
---|
| 136 | sums_l(nzb:nzt+1,pr_palm+max_pr_user,0:threads_per_task-1), & |
---|
[1] | 137 | sums_l_l(nzb:nzt+1,0:statistic_regions,0:threads_per_task-1), & |
---|
| 138 | sums_up_fraction_l(10,3,0:statistic_regions), & |
---|
[48] | 139 | sums_wsts_bc_l(nzb:nzt+1,0:statistic_regions), & |
---|
[394] | 140 | ts_value(dots_max,0:statistic_regions) ) |
---|
[1] | 141 | ALLOCATE( km_damp_x(nxl-1:nxr+1), km_damp_y(nys-1:nyn+1) ) |
---|
| 142 | |
---|
[19] | 143 | ALLOCATE( rif_1(nys-1:nyn+1,nxl-1:nxr+1), shf_1(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 144 | ts(nys-1:nyn+1,nxl-1:nxr+1), tswst_1(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 145 | us(nys-1:nyn+1,nxl-1:nxr+1), usws_1(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
[102] | 146 | uswst_1(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 147 | vsws_1(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 148 | vswst_1(nys-1:nyn+1,nxl-1:nxr+1), z0(nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[1] | 149 | |
---|
| 150 | IF ( timestep_scheme(1:5) /= 'runge' ) THEN |
---|
| 151 | ! |
---|
| 152 | !-- Leapfrog scheme needs two timelevels of diffusion quantities |
---|
[19] | 153 | ALLOCATE( rif_2(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 154 | shf_2(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 155 | tswst_2(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 156 | usws_2(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
[102] | 157 | uswst_2(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 158 | vswst_2(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
[1] | 159 | vsws_2(nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 160 | ENDIF |
---|
| 161 | |
---|
[75] | 162 | ALLOCATE( d(nzb+1:nzta,nys:nyna,nxl:nxra), & |
---|
| 163 | e_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 164 | e_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 165 | e_3(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 166 | kh_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 167 | km_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 168 | p(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 169 | pt_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 170 | pt_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 171 | pt_3(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 172 | tend(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 173 | u_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 174 | u_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 175 | u_3(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 176 | v_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 177 | v_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 178 | v_3(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 179 | w_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 180 | w_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
[1] | 181 | w_3(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 182 | |
---|
| 183 | IF ( timestep_scheme(1:5) /= 'runge' ) THEN |
---|
| 184 | ALLOCATE( kh_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 185 | km_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 186 | ENDIF |
---|
| 187 | |
---|
[75] | 188 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[1] | 189 | ! |
---|
[75] | 190 | !-- 2D-humidity/scalar arrays |
---|
[1] | 191 | ALLOCATE ( qs(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
[19] | 192 | qsws_1(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 193 | qswst_1(nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[1] | 194 | |
---|
| 195 | IF ( timestep_scheme(1:5) /= 'runge' ) THEN |
---|
[19] | 196 | ALLOCATE( qsws_2(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 197 | qswst_2(nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[1] | 198 | ENDIF |
---|
| 199 | ! |
---|
[75] | 200 | !-- 3D-humidity/scalar arrays |
---|
[1] | 201 | ALLOCATE( q_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 202 | q_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 203 | q_3(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 204 | |
---|
| 205 | ! |
---|
[75] | 206 | !-- 3D-arrays needed for humidity only |
---|
| 207 | IF ( humidity ) THEN |
---|
[1] | 208 | ALLOCATE( vpt_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 209 | |
---|
| 210 | IF ( timestep_scheme(1:5) /= 'runge' ) THEN |
---|
| 211 | ALLOCATE( vpt_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 212 | ENDIF |
---|
| 213 | |
---|
| 214 | IF ( cloud_physics ) THEN |
---|
| 215 | ! |
---|
| 216 | !-- Liquid water content |
---|
| 217 | ALLOCATE ( ql_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[72] | 218 | ! |
---|
| 219 | !-- Precipitation amount and rate (only needed if output is switched) |
---|
| 220 | ALLOCATE( precipitation_amount(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 221 | precipitation_rate(nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[1] | 222 | ENDIF |
---|
| 223 | |
---|
| 224 | IF ( cloud_droplets ) THEN |
---|
| 225 | ! |
---|
| 226 | !-- Liquid water content, change in liquid water content, |
---|
| 227 | !-- real volume of particles (with weighting), volume of particles |
---|
| 228 | ALLOCATE ( ql_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 229 | ql_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 230 | ql_v(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 231 | ql_vp(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 232 | ENDIF |
---|
| 233 | |
---|
| 234 | ENDIF |
---|
| 235 | |
---|
| 236 | ENDIF |
---|
| 237 | |
---|
[94] | 238 | IF ( ocean ) THEN |
---|
[95] | 239 | ALLOCATE( saswsb_1(nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 240 | saswst_1(nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[388] | 241 | ALLOCATE( prho_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 242 | rho_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 243 | sa_1(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 244 | sa_2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
[94] | 245 | sa_3(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[388] | 246 | prho => prho_1 |
---|
| 247 | rho => rho_1 ! routines calc_mean_profile and diffusion_e require |
---|
| 248 | ! density to be apointer |
---|
[108] | 249 | IF ( humidity_remote ) THEN |
---|
| 250 | ALLOCATE( qswst_remote(nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 251 | qswst_remote = 0.0 |
---|
| 252 | ENDIF |
---|
[94] | 253 | ENDIF |
---|
| 254 | |
---|
[1] | 255 | ! |
---|
| 256 | !-- 3D-array for storing the dissipation, needed for calculating the sgs |
---|
| 257 | !-- particle velocities |
---|
| 258 | IF ( use_sgs_for_particles ) THEN |
---|
| 259 | ALLOCATE ( diss(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[181] | 260 | ELSE |
---|
| 261 | ALLOCATE ( diss(2,2,2) ) ! required because diss is used as a |
---|
| 262 | ! formal parameter |
---|
[1] | 263 | ENDIF |
---|
| 264 | |
---|
| 265 | IF ( dt_dosp /= 9999999.9 ) THEN |
---|
| 266 | ALLOCATE( spectrum_x( 1:nx/2, 1:10, 1:10 ), & |
---|
| 267 | spectrum_y( 1:ny/2, 1:10, 1:10 ) ) |
---|
[146] | 268 | spectrum_x = 0.0 |
---|
| 269 | spectrum_y = 0.0 |
---|
[1] | 270 | ENDIF |
---|
| 271 | |
---|
| 272 | ! |
---|
[138] | 273 | !-- 3D-arrays for the leaf area density and the canopy drag coefficient |
---|
| 274 | IF ( plant_canopy ) THEN |
---|
| 275 | ALLOCATE ( lad_s(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 276 | lad_u(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 277 | lad_v(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 278 | lad_w(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 279 | cdc(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
[153] | 280 | |
---|
| 281 | IF ( passive_scalar ) THEN |
---|
| 282 | ALLOCATE ( sls(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 283 | sec(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 284 | ENDIF |
---|
| 285 | |
---|
| 286 | IF ( cthf /= 0.0 ) THEN |
---|
| 287 | ALLOCATE ( lai(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1), & |
---|
| 288 | canopy_heat_flux(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 289 | ENDIF |
---|
| 290 | |
---|
[138] | 291 | ENDIF |
---|
| 292 | |
---|
| 293 | ! |
---|
[51] | 294 | !-- 4D-array for storing the Rif-values at vertical walls |
---|
| 295 | IF ( topography /= 'flat' ) THEN |
---|
| 296 | ALLOCATE( rif_wall(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1,1:4) ) |
---|
| 297 | rif_wall = 0.0 |
---|
| 298 | ENDIF |
---|
| 299 | |
---|
| 300 | ! |
---|
| 301 | !-- Velocities at nzb+1 needed for volume flow control |
---|
| 302 | IF ( conserve_volume_flow ) THEN |
---|
| 303 | ALLOCATE( u_nzb_p1_for_vfc(nys:nyn), v_nzb_p1_for_vfc(nxl:nxr) ) |
---|
| 304 | u_nzb_p1_for_vfc = 0.0 |
---|
| 305 | v_nzb_p1_for_vfc = 0.0 |
---|
| 306 | ENDIF |
---|
| 307 | |
---|
| 308 | ! |
---|
[106] | 309 | !-- Arrays to store velocity data from t-dt and the phase speeds which |
---|
| 310 | !-- are needed for radiation boundary conditions |
---|
[73] | 311 | IF ( outflow_l ) THEN |
---|
[106] | 312 | ALLOCATE( u_m_l(nzb:nzt+1,nys-1:nyn+1,1:2), & |
---|
| 313 | v_m_l(nzb:nzt+1,nys-1:nyn+1,0:1), & |
---|
| 314 | w_m_l(nzb:nzt+1,nys-1:nyn+1,0:1) ) |
---|
[73] | 315 | ENDIF |
---|
| 316 | IF ( outflow_r ) THEN |
---|
[106] | 317 | ALLOCATE( u_m_r(nzb:nzt+1,nys-1:nyn+1,nx-1:nx), & |
---|
| 318 | v_m_r(nzb:nzt+1,nys-1:nyn+1,nx-1:nx), & |
---|
| 319 | w_m_r(nzb:nzt+1,nys-1:nyn+1,nx-1:nx) ) |
---|
[73] | 320 | ENDIF |
---|
[106] | 321 | IF ( outflow_l .OR. outflow_r ) THEN |
---|
| 322 | ALLOCATE( c_u(nzb:nzt+1,nys-1:nyn+1), c_v(nzb:nzt+1,nys-1:nyn+1), & |
---|
| 323 | c_w(nzb:nzt+1,nys-1:nyn+1) ) |
---|
| 324 | ENDIF |
---|
[73] | 325 | IF ( outflow_s ) THEN |
---|
[106] | 326 | ALLOCATE( u_m_s(nzb:nzt+1,0:1,nxl-1:nxr+1), & |
---|
| 327 | v_m_s(nzb:nzt+1,1:2,nxl-1:nxr+1), & |
---|
| 328 | w_m_s(nzb:nzt+1,0:1,nxl-1:nxr+1) ) |
---|
[73] | 329 | ENDIF |
---|
| 330 | IF ( outflow_n ) THEN |
---|
[106] | 331 | ALLOCATE( u_m_n(nzb:nzt+1,ny-1:ny,nxl-1:nxr+1), & |
---|
| 332 | v_m_n(nzb:nzt+1,ny-1:ny,nxl-1:nxr+1), & |
---|
| 333 | w_m_n(nzb:nzt+1,ny-1:ny,nxl-1:nxr+1) ) |
---|
[73] | 334 | ENDIF |
---|
[106] | 335 | IF ( outflow_s .OR. outflow_n ) THEN |
---|
| 336 | ALLOCATE( c_u(nzb:nzt+1,nxl-1:nxr+1), c_v(nzb:nzt+1,nxl-1:nxr+1), & |
---|
| 337 | c_w(nzb:nzt+1,nxl-1:nxr+1) ) |
---|
| 338 | ENDIF |
---|
[73] | 339 | |
---|
| 340 | ! |
---|
[1] | 341 | !-- Initial assignment of the pointers |
---|
| 342 | IF ( timestep_scheme(1:5) /= 'runge' ) THEN |
---|
| 343 | |
---|
[19] | 344 | rif_m => rif_1; rif => rif_2 |
---|
| 345 | shf_m => shf_1; shf => shf_2 |
---|
| 346 | tswst_m => tswst_1; tswst => tswst_2 |
---|
| 347 | usws_m => usws_1; usws => usws_2 |
---|
[102] | 348 | uswst_m => uswst_1; uswst => uswst_2 |
---|
[19] | 349 | vsws_m => vsws_1; vsws => vsws_2 |
---|
[102] | 350 | vswst_m => vswst_1; vswst => vswst_2 |
---|
[1] | 351 | e_m => e_1; e => e_2; e_p => e_3; te_m => e_3 |
---|
| 352 | kh_m => kh_1; kh => kh_2 |
---|
| 353 | km_m => km_1; km => km_2 |
---|
| 354 | pt_m => pt_1; pt => pt_2; pt_p => pt_3; tpt_m => pt_3 |
---|
| 355 | u_m => u_1; u => u_2; u_p => u_3; tu_m => u_3 |
---|
| 356 | v_m => v_1; v => v_2; v_p => v_3; tv_m => v_3 |
---|
| 357 | w_m => w_1; w => w_2; w_p => w_3; tw_m => w_3 |
---|
| 358 | |
---|
[75] | 359 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[19] | 360 | qsws_m => qsws_1; qsws => qsws_2 |
---|
| 361 | qswst_m => qswst_1; qswst => qswst_2 |
---|
[1] | 362 | q_m => q_1; q => q_2; q_p => q_3; tq_m => q_3 |
---|
[75] | 363 | IF ( humidity ) vpt_m => vpt_1; vpt => vpt_2 |
---|
[1] | 364 | IF ( cloud_physics ) ql => ql_1 |
---|
| 365 | IF ( cloud_droplets ) THEN |
---|
| 366 | ql => ql_1 |
---|
| 367 | ql_c => ql_2 |
---|
| 368 | ENDIF |
---|
| 369 | ENDIF |
---|
| 370 | |
---|
| 371 | ELSE |
---|
| 372 | |
---|
[19] | 373 | rif => rif_1 |
---|
| 374 | shf => shf_1 |
---|
| 375 | tswst => tswst_1 |
---|
| 376 | usws => usws_1 |
---|
[102] | 377 | uswst => uswst_1 |
---|
[19] | 378 | vsws => vsws_1 |
---|
[102] | 379 | vswst => vswst_1 |
---|
[19] | 380 | e => e_1; e_p => e_2; te_m => e_3; e_m => e_3 |
---|
| 381 | kh => kh_1 |
---|
| 382 | km => km_1 |
---|
| 383 | pt => pt_1; pt_p => pt_2; tpt_m => pt_3; pt_m => pt_3 |
---|
| 384 | u => u_1; u_p => u_2; tu_m => u_3; u_m => u_3 |
---|
| 385 | v => v_1; v_p => v_2; tv_m => v_3; v_m => v_3 |
---|
| 386 | w => w_1; w_p => w_2; tw_m => w_3; w_m => w_3 |
---|
[1] | 387 | |
---|
[75] | 388 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[1] | 389 | qsws => qsws_1 |
---|
[19] | 390 | qswst => qswst_1 |
---|
[94] | 391 | q => q_1; q_p => q_2; tq_m => q_3; q_m => q_3 |
---|
[75] | 392 | IF ( humidity ) vpt => vpt_1 |
---|
[1] | 393 | IF ( cloud_physics ) ql => ql_1 |
---|
| 394 | IF ( cloud_droplets ) THEN |
---|
| 395 | ql => ql_1 |
---|
| 396 | ql_c => ql_2 |
---|
| 397 | ENDIF |
---|
| 398 | ENDIF |
---|
| 399 | |
---|
[94] | 400 | IF ( ocean ) THEN |
---|
[95] | 401 | saswsb => saswsb_1 |
---|
[94] | 402 | saswst => saswst_1 |
---|
| 403 | sa => sa_1; sa_p => sa_2; tsa_m => sa_3 |
---|
| 404 | ENDIF |
---|
| 405 | |
---|
[1] | 406 | ENDIF |
---|
| 407 | |
---|
| 408 | ! |
---|
| 409 | !-- Initialize model variables |
---|
[147] | 410 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. & |
---|
[328] | 411 | TRIM( initializing_actions ) /= 'cyclic_fill' ) THEN |
---|
[1] | 412 | ! |
---|
| 413 | !-- First model run of a possible job queue. |
---|
| 414 | !-- Initial profiles of the variables must be computes. |
---|
| 415 | IF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN |
---|
| 416 | ! |
---|
| 417 | !-- Use solutions of the 1D model as initial profiles, |
---|
| 418 | !-- start 1D model |
---|
| 419 | CALL init_1d_model |
---|
| 420 | ! |
---|
| 421 | !-- Transfer initial profiles to the arrays of the 3D model |
---|
| 422 | DO i = nxl-1, nxr+1 |
---|
| 423 | DO j = nys-1, nyn+1 |
---|
| 424 | e(:,j,i) = e1d |
---|
| 425 | kh(:,j,i) = kh1d |
---|
| 426 | km(:,j,i) = km1d |
---|
| 427 | pt(:,j,i) = pt_init |
---|
| 428 | u(:,j,i) = u1d |
---|
| 429 | v(:,j,i) = v1d |
---|
| 430 | ENDDO |
---|
| 431 | ENDDO |
---|
| 432 | |
---|
[75] | 433 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[1] | 434 | DO i = nxl-1, nxr+1 |
---|
| 435 | DO j = nys-1, nyn+1 |
---|
| 436 | q(:,j,i) = q_init |
---|
| 437 | ENDDO |
---|
| 438 | ENDDO |
---|
| 439 | ENDIF |
---|
| 440 | |
---|
| 441 | IF ( .NOT. constant_diffusion ) THEN |
---|
| 442 | DO i = nxl-1, nxr+1 |
---|
| 443 | DO j = nys-1, nyn+1 |
---|
| 444 | e(:,j,i) = e1d |
---|
| 445 | ENDDO |
---|
| 446 | ENDDO |
---|
| 447 | ! |
---|
| 448 | !-- Store initial profiles for output purposes etc. |
---|
| 449 | hom(:,1,25,:) = SPREAD( l1d, 2, statistic_regions+1 ) |
---|
| 450 | |
---|
| 451 | IF ( prandtl_layer ) THEN |
---|
| 452 | rif = rif1d(nzb+1) |
---|
| 453 | ts = 0.0 ! could actually be computed more accurately in the |
---|
| 454 | ! 1D model. Update when opportunity arises. |
---|
| 455 | us = us1d |
---|
| 456 | usws = usws1d |
---|
| 457 | vsws = vsws1d |
---|
| 458 | ELSE |
---|
| 459 | ts = 0.0 ! must be set, because used in |
---|
| 460 | rif = 0.0 ! flowste |
---|
| 461 | us = 0.0 |
---|
| 462 | usws = 0.0 |
---|
| 463 | vsws = 0.0 |
---|
| 464 | ENDIF |
---|
| 465 | |
---|
| 466 | ELSE |
---|
| 467 | e = 0.0 ! must be set, because used in |
---|
| 468 | rif = 0.0 ! flowste |
---|
| 469 | ts = 0.0 |
---|
| 470 | us = 0.0 |
---|
| 471 | usws = 0.0 |
---|
| 472 | vsws = 0.0 |
---|
| 473 | ENDIF |
---|
[102] | 474 | uswst = top_momentumflux_u |
---|
| 475 | vswst = top_momentumflux_v |
---|
[1] | 476 | |
---|
| 477 | ! |
---|
| 478 | !-- In every case qs = 0.0 (see also pt) |
---|
| 479 | !-- This could actually be computed more accurately in the 1D model. |
---|
| 480 | !-- Update when opportunity arises! |
---|
[75] | 481 | IF ( humidity .OR. passive_scalar ) qs = 0.0 |
---|
[1] | 482 | |
---|
| 483 | ! |
---|
| 484 | !-- inside buildings set velocities back to zero |
---|
| 485 | IF ( topography /= 'flat' ) THEN |
---|
| 486 | DO i = nxl-1, nxr+1 |
---|
| 487 | DO j = nys-1, nyn+1 |
---|
| 488 | u(nzb:nzb_u_inner(j,i),j,i) = 0.0 |
---|
| 489 | v(nzb:nzb_v_inner(j,i),j,i) = 0.0 |
---|
| 490 | ENDDO |
---|
| 491 | ENDDO |
---|
[132] | 492 | IF ( conserve_volume_flow ) THEN |
---|
| 493 | IF ( nxr == nx ) THEN |
---|
| 494 | DO j = nys, nyn |
---|
| 495 | DO k = nzb + 1, nzb_u_inner(j,nx) |
---|
[359] | 496 | u_nzb_p1_for_vfc(j) = u_nzb_p1_for_vfc(j) + & |
---|
| 497 | u1d(k) * dzu(k) |
---|
[132] | 498 | ENDDO |
---|
| 499 | ENDDO |
---|
| 500 | ENDIF |
---|
| 501 | IF ( nyn == ny ) THEN |
---|
| 502 | DO i = nxl, nxr |
---|
| 503 | DO k = nzb + 1, nzb_v_inner(ny,i) |
---|
[359] | 504 | v_nzb_p1_for_vfc(i) = v_nzb_p1_for_vfc(i) + & |
---|
| 505 | v1d(k) * dzu(k) |
---|
[132] | 506 | ENDDO |
---|
| 507 | ENDDO |
---|
| 508 | ENDIF |
---|
| 509 | ENDIF |
---|
[1] | 510 | ! |
---|
| 511 | !-- WARNING: The extra boundary conditions set after running the |
---|
| 512 | !-- ------- 1D model impose an error on the divergence one layer |
---|
| 513 | !-- below the topography; need to correct later |
---|
| 514 | !-- ATTENTION: Provisional correction for Piacsek & Williams |
---|
| 515 | !-- --------- advection scheme: keep u and v zero one layer below |
---|
| 516 | !-- the topography. |
---|
| 517 | IF ( ibc_uv_b == 0 ) THEN |
---|
| 518 | ! |
---|
| 519 | !-- Satisfying the Dirichlet condition with an extra layer below |
---|
| 520 | !-- the surface where the u and v component change their sign. |
---|
| 521 | DO i = nxl-1, nxr+1 |
---|
| 522 | DO j = nys-1, nyn+1 |
---|
| 523 | IF ( nzb_u_inner(j,i) == 0 ) u(0,j,i) = -u(1,j,i) |
---|
| 524 | IF ( nzb_v_inner(j,i) == 0 ) v(0,j,i) = -v(1,j,i) |
---|
| 525 | ENDDO |
---|
| 526 | ENDDO |
---|
| 527 | |
---|
| 528 | ELSE |
---|
| 529 | ! |
---|
| 530 | !-- Neumann condition |
---|
| 531 | DO i = nxl-1, nxr+1 |
---|
| 532 | DO j = nys-1, nyn+1 |
---|
| 533 | IF ( nzb_u_inner(j,i) == 0 ) u(0,j,i) = u(1,j,i) |
---|
| 534 | IF ( nzb_v_inner(j,i) == 0 ) v(0,j,i) = v(1,j,i) |
---|
| 535 | ENDDO |
---|
| 536 | ENDDO |
---|
| 537 | |
---|
| 538 | ENDIF |
---|
| 539 | |
---|
| 540 | ENDIF |
---|
| 541 | |
---|
| 542 | ELSEIF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 ) & |
---|
| 543 | THEN |
---|
| 544 | ! |
---|
| 545 | !-- Use constructed initial profiles (velocity constant with height, |
---|
| 546 | !-- temperature profile with constant gradient) |
---|
| 547 | DO i = nxl-1, nxr+1 |
---|
| 548 | DO j = nys-1, nyn+1 |
---|
| 549 | pt(:,j,i) = pt_init |
---|
| 550 | u(:,j,i) = u_init |
---|
| 551 | v(:,j,i) = v_init |
---|
| 552 | ENDDO |
---|
| 553 | ENDDO |
---|
[75] | 554 | |
---|
[1] | 555 | ! |
---|
[292] | 556 | !-- Set initial horizontal velocities at the lowest computational grid |
---|
| 557 | !-- levels to zero in order to avoid too small time steps caused by the |
---|
| 558 | !-- diffusion limit in the initial phase of a run (at k=1, dz/2 occurs |
---|
| 559 | !-- in the limiting formula!). The original values are stored to be later |
---|
| 560 | !-- used for volume flow control. |
---|
[1] | 561 | DO i = nxl-1, nxr+1 |
---|
| 562 | DO j = nys-1, nyn+1 |
---|
| 563 | u(nzb:nzb_u_inner(j,i)+1,j,i) = 0.0 |
---|
| 564 | v(nzb:nzb_v_inner(j,i)+1,j,i) = 0.0 |
---|
| 565 | ENDDO |
---|
| 566 | ENDDO |
---|
[51] | 567 | IF ( conserve_volume_flow ) THEN |
---|
| 568 | IF ( nxr == nx ) THEN |
---|
| 569 | DO j = nys, nyn |
---|
[132] | 570 | DO k = nzb + 1, nzb_u_inner(j,nx) + 1 |
---|
[359] | 571 | u_nzb_p1_for_vfc(j) = u_nzb_p1_for_vfc(j) + & |
---|
| 572 | u_init(k) * dzu(k) |
---|
[132] | 573 | ENDDO |
---|
[51] | 574 | ENDDO |
---|
| 575 | ENDIF |
---|
| 576 | IF ( nyn == ny ) THEN |
---|
| 577 | DO i = nxl, nxr |
---|
[132] | 578 | DO k = nzb + 1, nzb_v_inner(ny,i) + 1 |
---|
[359] | 579 | v_nzb_p1_for_vfc(i) = v_nzb_p1_for_vfc(i) + & |
---|
| 580 | v_init(k) * dzu(k) |
---|
[132] | 581 | ENDDO |
---|
[51] | 582 | ENDDO |
---|
| 583 | ENDIF |
---|
| 584 | ENDIF |
---|
[1] | 585 | |
---|
[75] | 586 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[1] | 587 | DO i = nxl-1, nxr+1 |
---|
| 588 | DO j = nys-1, nyn+1 |
---|
| 589 | q(:,j,i) = q_init |
---|
| 590 | ENDDO |
---|
| 591 | ENDDO |
---|
| 592 | ENDIF |
---|
| 593 | |
---|
[94] | 594 | IF ( ocean ) THEN |
---|
| 595 | DO i = nxl-1, nxr+1 |
---|
| 596 | DO j = nys-1, nyn+1 |
---|
| 597 | sa(:,j,i) = sa_init |
---|
| 598 | ENDDO |
---|
| 599 | ENDDO |
---|
| 600 | ENDIF |
---|
[1] | 601 | |
---|
| 602 | IF ( constant_diffusion ) THEN |
---|
| 603 | km = km_constant |
---|
| 604 | kh = km / prandtl_number |
---|
[108] | 605 | e = 0.0 |
---|
| 606 | ELSEIF ( e_init > 0.0 ) THEN |
---|
| 607 | DO k = nzb+1, nzt |
---|
| 608 | km(k,:,:) = 0.1 * l_grid(k) * SQRT( e_init ) |
---|
| 609 | ENDDO |
---|
| 610 | km(nzb,:,:) = km(nzb+1,:,:) |
---|
| 611 | km(nzt+1,:,:) = km(nzt,:,:) |
---|
| 612 | kh = km / prandtl_number |
---|
| 613 | e = e_init |
---|
[1] | 614 | ELSE |
---|
[108] | 615 | IF ( .NOT. ocean ) THEN |
---|
| 616 | kh = 0.01 ! there must exist an initial diffusion, because |
---|
| 617 | km = 0.01 ! otherwise no TKE would be produced by the |
---|
| 618 | ! production terms, as long as not yet |
---|
| 619 | ! e = (u*/cm)**2 at k=nzb+1 |
---|
| 620 | ELSE |
---|
| 621 | kh = 0.00001 |
---|
| 622 | km = 0.00001 |
---|
| 623 | ENDIF |
---|
| 624 | e = 0.0 |
---|
[1] | 625 | ENDIF |
---|
[102] | 626 | rif = 0.0 |
---|
| 627 | ts = 0.0 |
---|
| 628 | us = 0.0 |
---|
| 629 | usws = 0.0 |
---|
| 630 | uswst = top_momentumflux_u |
---|
| 631 | vsws = 0.0 |
---|
| 632 | vswst = top_momentumflux_v |
---|
[75] | 633 | IF ( humidity .OR. passive_scalar ) qs = 0.0 |
---|
[1] | 634 | |
---|
| 635 | ! |
---|
| 636 | !-- Compute initial temperature field and other constants used in case |
---|
| 637 | !-- of a sloping surface |
---|
| 638 | IF ( sloping_surface ) CALL init_slope |
---|
| 639 | |
---|
[46] | 640 | ELSEIF ( INDEX(initializing_actions, 'by_user') /= 0 ) & |
---|
| 641 | THEN |
---|
| 642 | ! |
---|
| 643 | !-- Initialization will completely be done by the user |
---|
| 644 | CALL user_init_3d_model |
---|
| 645 | |
---|
[1] | 646 | ENDIF |
---|
| 647 | |
---|
| 648 | ! |
---|
[151] | 649 | !-- Apply channel flow boundary condition |
---|
[132] | 650 | IF ( TRIM( bc_uv_t ) == 'dirichlet_0' ) THEN |
---|
| 651 | |
---|
| 652 | u(nzt+1,:,:) = 0.0 |
---|
| 653 | v(nzt+1,:,:) = 0.0 |
---|
| 654 | |
---|
[151] | 655 | !-- For the Dirichlet condition to be correctly applied at the top, set |
---|
[132] | 656 | !-- ug and vg to zero there |
---|
| 657 | ug(nzt+1) = 0.0 |
---|
| 658 | vg(nzt+1) = 0.0 |
---|
| 659 | |
---|
| 660 | ENDIF |
---|
| 661 | |
---|
| 662 | ! |
---|
[1] | 663 | !-- Calculate virtual potential temperature |
---|
[75] | 664 | IF ( humidity ) vpt = pt * ( 1.0 + 0.61 * q ) |
---|
[1] | 665 | |
---|
| 666 | ! |
---|
| 667 | !-- Store initial profiles for output purposes etc. |
---|
| 668 | hom(:,1,5,:) = SPREAD( u(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 669 | hom(:,1,6,:) = SPREAD( v(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 670 | IF ( ibc_uv_b == 0 ) THEN |
---|
| 671 | hom(nzb,1,5,:) = -hom(nzb+1,1,5,:) ! due to satisfying the Dirichlet |
---|
| 672 | hom(nzb,1,6,:) = -hom(nzb+1,1,6,:) ! condition with an extra layer |
---|
| 673 | ! below the surface where the u and v component change their sign |
---|
| 674 | ENDIF |
---|
| 675 | hom(:,1,7,:) = SPREAD( pt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 676 | hom(:,1,23,:) = SPREAD( km(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 677 | hom(:,1,24,:) = SPREAD( kh(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 678 | |
---|
[97] | 679 | IF ( ocean ) THEN |
---|
| 680 | ! |
---|
| 681 | !-- Store initial salinity profile |
---|
| 682 | hom(:,1,26,:) = SPREAD( sa(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 683 | ENDIF |
---|
[1] | 684 | |
---|
[75] | 685 | IF ( humidity ) THEN |
---|
[1] | 686 | ! |
---|
| 687 | !-- Store initial profile of total water content, virtual potential |
---|
| 688 | !-- temperature |
---|
| 689 | hom(:,1,26,:) = SPREAD( q(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 690 | hom(:,1,29,:) = SPREAD( vpt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 691 | IF ( cloud_physics .OR. cloud_droplets ) THEN |
---|
| 692 | ! |
---|
| 693 | !-- Store initial profile of specific humidity and potential |
---|
| 694 | !-- temperature |
---|
| 695 | hom(:,1,27,:) = SPREAD( q(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 696 | hom(:,1,28,:) = SPREAD( pt(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 697 | ENDIF |
---|
| 698 | ENDIF |
---|
| 699 | |
---|
| 700 | IF ( passive_scalar ) THEN |
---|
| 701 | ! |
---|
| 702 | !-- Store initial scalar profile |
---|
| 703 | hom(:,1,26,:) = SPREAD( q(:,nys,nxl), 2, statistic_regions+1 ) |
---|
| 704 | ENDIF |
---|
| 705 | |
---|
| 706 | ! |
---|
[19] | 707 | !-- Initialize fluxes at bottom surface |
---|
[1] | 708 | IF ( use_surface_fluxes ) THEN |
---|
| 709 | |
---|
| 710 | IF ( constant_heatflux ) THEN |
---|
| 711 | ! |
---|
| 712 | !-- Heat flux is prescribed |
---|
| 713 | IF ( random_heatflux ) THEN |
---|
| 714 | CALL disturb_heatflux |
---|
| 715 | ELSE |
---|
| 716 | shf = surface_heatflux |
---|
| 717 | ! |
---|
| 718 | !-- Over topography surface_heatflux is replaced by wall_heatflux(0) |
---|
| 719 | IF ( TRIM( topography ) /= 'flat' ) THEN |
---|
| 720 | DO i = nxl-1, nxr+1 |
---|
| 721 | DO j = nys-1, nyn+1 |
---|
| 722 | IF ( nzb_s_inner(j,i) /= 0 ) THEN |
---|
| 723 | shf(j,i) = wall_heatflux(0) |
---|
| 724 | ENDIF |
---|
| 725 | ENDDO |
---|
| 726 | ENDDO |
---|
| 727 | ENDIF |
---|
| 728 | ENDIF |
---|
| 729 | IF ( ASSOCIATED( shf_m ) ) shf_m = shf |
---|
| 730 | ENDIF |
---|
| 731 | |
---|
| 732 | ! |
---|
| 733 | !-- Determine the near-surface water flux |
---|
[75] | 734 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[1] | 735 | IF ( constant_waterflux ) THEN |
---|
| 736 | qsws = surface_waterflux |
---|
| 737 | IF ( ASSOCIATED( qsws_m ) ) qsws_m = qsws |
---|
| 738 | ENDIF |
---|
| 739 | ENDIF |
---|
| 740 | |
---|
| 741 | ENDIF |
---|
| 742 | |
---|
| 743 | ! |
---|
[19] | 744 | !-- Initialize fluxes at top surface |
---|
[94] | 745 | !-- Currently, only the heatflux and salinity flux can be prescribed. |
---|
| 746 | !-- The latent flux is zero in this case! |
---|
[19] | 747 | IF ( use_top_fluxes ) THEN |
---|
| 748 | |
---|
| 749 | IF ( constant_top_heatflux ) THEN |
---|
| 750 | ! |
---|
| 751 | !-- Heat flux is prescribed |
---|
| 752 | tswst = top_heatflux |
---|
| 753 | IF ( ASSOCIATED( tswst_m ) ) tswst_m = tswst |
---|
| 754 | |
---|
[75] | 755 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[19] | 756 | qswst = 0.0 |
---|
| 757 | IF ( ASSOCIATED( qswst_m ) ) qswst_m = qswst |
---|
| 758 | ENDIF |
---|
[94] | 759 | |
---|
| 760 | IF ( ocean ) THEN |
---|
[95] | 761 | saswsb = bottom_salinityflux |
---|
[94] | 762 | saswst = top_salinityflux |
---|
| 763 | ENDIF |
---|
[102] | 764 | ENDIF |
---|
[19] | 765 | |
---|
[102] | 766 | ! |
---|
| 767 | !-- Initialization in case of a coupled model run |
---|
| 768 | IF ( coupling_mode == 'ocean_to_atmosphere' ) THEN |
---|
| 769 | tswst = 0.0 |
---|
| 770 | IF ( ASSOCIATED( tswst_m ) ) tswst_m = tswst |
---|
| 771 | ENDIF |
---|
| 772 | |
---|
[19] | 773 | ENDIF |
---|
| 774 | |
---|
| 775 | ! |
---|
[1] | 776 | !-- Initialize Prandtl layer quantities |
---|
| 777 | IF ( prandtl_layer ) THEN |
---|
| 778 | |
---|
| 779 | z0 = roughness_length |
---|
| 780 | |
---|
| 781 | IF ( .NOT. constant_heatflux ) THEN |
---|
| 782 | ! |
---|
| 783 | !-- Surface temperature is prescribed. Here the heat flux cannot be |
---|
| 784 | !-- simply estimated, because therefore rif, u* and theta* would have |
---|
| 785 | !-- to be computed by iteration. This is why the heat flux is assumed |
---|
| 786 | !-- to be zero before the first time step. It approaches its correct |
---|
| 787 | !-- value in the course of the first few time steps. |
---|
| 788 | shf = 0.0 |
---|
| 789 | IF ( ASSOCIATED( shf_m ) ) shf_m = 0.0 |
---|
| 790 | ENDIF |
---|
| 791 | |
---|
[75] | 792 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[1] | 793 | IF ( .NOT. constant_waterflux ) THEN |
---|
| 794 | qsws = 0.0 |
---|
| 795 | IF ( ASSOCIATED( qsws_m ) ) qsws_m = 0.0 |
---|
| 796 | ENDIF |
---|
| 797 | ENDIF |
---|
| 798 | |
---|
| 799 | ENDIF |
---|
| 800 | |
---|
| 801 | ! |
---|
[152] | 802 | !-- Calculate the initial volume flow at the right and north boundary |
---|
| 803 | IF ( conserve_volume_flow ) THEN |
---|
| 804 | |
---|
| 805 | volume_flow_initial_l = 0.0 |
---|
| 806 | volume_flow_area_l = 0.0 |
---|
| 807 | |
---|
| 808 | IF ( nxr == nx ) THEN |
---|
| 809 | DO j = nys, nyn |
---|
| 810 | DO k = nzb_2d(j,nx) + 1, nzt |
---|
| 811 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
| 812 | u(k,j,nx) * dzu(k) |
---|
| 813 | volume_flow_area_l(1) = volume_flow_area_l(1) + dzu(k) |
---|
| 814 | ENDDO |
---|
| 815 | ! |
---|
| 816 | !-- Correction if velocity at nzb+1 has been set zero further above |
---|
| 817 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
| 818 | u_nzb_p1_for_vfc(j) |
---|
| 819 | ENDDO |
---|
| 820 | ENDIF |
---|
| 821 | |
---|
| 822 | IF ( nyn == ny ) THEN |
---|
| 823 | DO i = nxl, nxr |
---|
| 824 | DO k = nzb_2d(ny,i) + 1, nzt |
---|
| 825 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
| 826 | v(k,ny,i) * dzu(k) |
---|
| 827 | volume_flow_area_l(2) = volume_flow_area_l(2) + dzu(k) |
---|
| 828 | ENDDO |
---|
| 829 | ! |
---|
| 830 | !-- Correction if velocity at nzb+1 has been set zero further above |
---|
| 831 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
| 832 | v_nzb_p1_for_vfc(i) |
---|
| 833 | ENDDO |
---|
| 834 | ENDIF |
---|
| 835 | |
---|
| 836 | #if defined( __parallel ) |
---|
| 837 | CALL MPI_ALLREDUCE( volume_flow_initial_l(1), volume_flow_initial(1),& |
---|
| 838 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 839 | CALL MPI_ALLREDUCE( volume_flow_area_l(1), volume_flow_area(1), & |
---|
| 840 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 841 | #else |
---|
| 842 | volume_flow_initial = volume_flow_initial_l |
---|
| 843 | volume_flow_area = volume_flow_area_l |
---|
[241] | 844 | #endif |
---|
| 845 | ! |
---|
| 846 | !-- In case of 'bulk_velocity' mode, volume_flow_initial is overridden |
---|
| 847 | !-- and calculated from u|v_bulk instead. |
---|
| 848 | IF ( TRIM( conserve_volume_flow_mode ) == 'bulk_velocity' ) THEN |
---|
| 849 | volume_flow_initial(1) = u_bulk * volume_flow_area(1) |
---|
| 850 | volume_flow_initial(2) = v_bulk * volume_flow_area(2) |
---|
| 851 | ENDIF |
---|
| 852 | |
---|
[152] | 853 | ENDIF |
---|
| 854 | |
---|
| 855 | ! |
---|
[1] | 856 | !-- For the moment, perturbation pressure and vertical velocity are zero |
---|
| 857 | p = 0.0; w = 0.0 |
---|
| 858 | |
---|
| 859 | ! |
---|
| 860 | !-- Initialize array sums (must be defined in first call of pres) |
---|
| 861 | sums = 0.0 |
---|
| 862 | |
---|
| 863 | ! |
---|
[72] | 864 | !-- Treating cloud physics, liquid water content and precipitation amount |
---|
| 865 | !-- are zero at beginning of the simulation |
---|
| 866 | IF ( cloud_physics ) THEN |
---|
| 867 | ql = 0.0 |
---|
| 868 | IF ( precipitation ) precipitation_amount = 0.0 |
---|
| 869 | ENDIF |
---|
[1] | 870 | |
---|
| 871 | ! |
---|
| 872 | !-- Impose vortex with vertical axis on the initial velocity profile |
---|
| 873 | IF ( INDEX( initializing_actions, 'initialize_vortex' ) /= 0 ) THEN |
---|
| 874 | CALL init_rankine |
---|
| 875 | ENDIF |
---|
| 876 | |
---|
| 877 | ! |
---|
| 878 | !-- Impose temperature anomaly (advection test only) |
---|
| 879 | IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 ) THEN |
---|
| 880 | CALL init_pt_anomaly |
---|
| 881 | ENDIF |
---|
| 882 | |
---|
| 883 | ! |
---|
| 884 | !-- If required, change the surface temperature at the start of the 3D run |
---|
| 885 | IF ( pt_surface_initial_change /= 0.0 ) THEN |
---|
| 886 | pt(nzb,:,:) = pt(nzb,:,:) + pt_surface_initial_change |
---|
| 887 | ENDIF |
---|
| 888 | |
---|
| 889 | ! |
---|
| 890 | !-- If required, change the surface humidity/scalar at the start of the 3D |
---|
| 891 | !-- run |
---|
[75] | 892 | IF ( ( humidity .OR. passive_scalar ) .AND. & |
---|
[1] | 893 | q_surface_initial_change /= 0.0 ) THEN |
---|
| 894 | q(nzb,:,:) = q(nzb,:,:) + q_surface_initial_change |
---|
| 895 | ENDIF |
---|
| 896 | |
---|
| 897 | ! |
---|
| 898 | !-- Initialize the random number generator (from numerical recipes) |
---|
| 899 | CALL random_function_ini |
---|
| 900 | |
---|
| 901 | ! |
---|
| 902 | !-- Impose random perturbation on the horizontal velocity field and then |
---|
| 903 | !-- remove the divergences from the velocity field |
---|
| 904 | IF ( create_disturbances ) THEN |
---|
[75] | 905 | CALL disturb_field( nzb_u_inner, tend, u ) |
---|
| 906 | CALL disturb_field( nzb_v_inner, tend, v ) |
---|
[1] | 907 | n_sor = nsor_ini |
---|
| 908 | CALL pres |
---|
| 909 | n_sor = nsor |
---|
| 910 | ENDIF |
---|
| 911 | |
---|
| 912 | ! |
---|
| 913 | !-- Once again set the perturbation pressure explicitly to zero in order to |
---|
| 914 | !-- assure that it does not generate any divergences in the first time step. |
---|
| 915 | !-- At t=0 the velocity field is free of divergence (as constructed above). |
---|
| 916 | !-- Divergences being created during a time step are not yet known and thus |
---|
| 917 | !-- cannot be corrected during the time step yet. |
---|
| 918 | p = 0.0 |
---|
| 919 | |
---|
| 920 | ! |
---|
| 921 | !-- Initialize old and new time levels. |
---|
| 922 | IF ( timestep_scheme(1:5) /= 'runge' ) THEN |
---|
| 923 | e_m = e; pt_m = pt; u_m = u; v_m = v; w_m = w; kh_m = kh; km_m = km |
---|
| 924 | ELSE |
---|
| 925 | te_m = 0.0; tpt_m = 0.0; tu_m = 0.0; tv_m = 0.0; tw_m = 0.0 |
---|
| 926 | ENDIF |
---|
| 927 | e_p = e; pt_p = pt; u_p = u; v_p = v; w_p = w |
---|
| 928 | |
---|
[75] | 929 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[1] | 930 | IF ( ASSOCIATED( q_m ) ) q_m = q |
---|
| 931 | IF ( timestep_scheme(1:5) == 'runge' ) tq_m = 0.0 |
---|
| 932 | q_p = q |
---|
[75] | 933 | IF ( humidity .AND. ASSOCIATED( vpt_m ) ) vpt_m = vpt |
---|
[1] | 934 | ENDIF |
---|
| 935 | |
---|
[94] | 936 | IF ( ocean ) THEN |
---|
| 937 | tsa_m = 0.0 |
---|
| 938 | sa_p = sa |
---|
| 939 | ENDIF |
---|
| 940 | |
---|
[73] | 941 | |
---|
[147] | 942 | ELSEIF ( TRIM( initializing_actions ) == 'read_restart_data' .OR. & |
---|
[328] | 943 | TRIM( initializing_actions ) == 'cyclic_fill' ) & |
---|
[1] | 944 | THEN |
---|
| 945 | ! |
---|
[328] | 946 | !-- When reading data for cyclic fill of 3D prerun data, first read |
---|
[147] | 947 | !-- some of the global variables from restart file |
---|
[328] | 948 | IF ( TRIM( initializing_actions ) == 'cyclic_fill' ) THEN |
---|
[151] | 949 | |
---|
[147] | 950 | WRITE (9,*) 'before read_parts_of_var_list' |
---|
| 951 | CALL local_flush( 9 ) |
---|
| 952 | CALL read_parts_of_var_list |
---|
| 953 | WRITE (9,*) 'after read_parts_of_var_list' |
---|
| 954 | CALL local_flush( 9 ) |
---|
| 955 | CALL close_file( 13 ) |
---|
[328] | 956 | |
---|
[151] | 957 | ! |
---|
[328] | 958 | !-- Initialization of the turbulence recycling method |
---|
| 959 | IF ( turbulent_inflow ) THEN |
---|
| 960 | ! |
---|
| 961 | !-- Store temporally and horizontally averaged vertical profiles to be |
---|
| 962 | !-- used as mean inflow profiles |
---|
| 963 | ALLOCATE( mean_inflow_profiles(nzb:nzt+1,5) ) |
---|
[151] | 964 | |
---|
[328] | 965 | mean_inflow_profiles(:,1) = hom_sum(:,1,0) ! u |
---|
| 966 | mean_inflow_profiles(:,2) = hom_sum(:,2,0) ! v |
---|
| 967 | mean_inflow_profiles(:,4) = hom_sum(:,4,0) ! pt |
---|
| 968 | mean_inflow_profiles(:,5) = hom_sum(:,8,0) ! e |
---|
[151] | 969 | |
---|
| 970 | ! |
---|
[328] | 971 | !-- Use these mean profiles for the inflow (provided that Dirichlet |
---|
| 972 | !-- conditions are used) |
---|
| 973 | IF ( inflow_l ) THEN |
---|
| 974 | DO j = nys-1, nyn+1 |
---|
| 975 | DO k = nzb, nzt+1 |
---|
| 976 | u(k,j,-1) = mean_inflow_profiles(k,1) |
---|
| 977 | v(k,j,-1) = mean_inflow_profiles(k,2) |
---|
| 978 | w(k,j,-1) = 0.0 |
---|
| 979 | pt(k,j,-1) = mean_inflow_profiles(k,4) |
---|
| 980 | e(k,j,-1) = mean_inflow_profiles(k,5) |
---|
| 981 | ENDDO |
---|
[151] | 982 | ENDDO |
---|
[328] | 983 | ENDIF |
---|
[151] | 984 | |
---|
| 985 | ! |
---|
[328] | 986 | !-- Calculate the damping factors to be used at the inflow. For a |
---|
| 987 | !-- turbulent inflow the turbulent fluctuations have to be limited |
---|
| 988 | !-- vertically because otherwise the turbulent inflow layer will grow |
---|
| 989 | !-- in time. |
---|
| 990 | IF ( inflow_damping_height == 9999999.9 ) THEN |
---|
[151] | 991 | ! |
---|
[328] | 992 | !-- Default: use the inversion height calculated by the prerun; if |
---|
| 993 | !-- this is zero, inflow_damping_height must be explicitly |
---|
| 994 | !-- specified. |
---|
| 995 | IF ( hom_sum(nzb+6,pr_palm,0) /= 0.0 ) THEN |
---|
| 996 | inflow_damping_height = hom_sum(nzb+6,pr_palm,0) |
---|
| 997 | ELSE |
---|
| 998 | WRITE( message_string, * ) 'inflow_damping_height must be ',& |
---|
| 999 | 'explicitly specified because&the inversion height ', & |
---|
| 1000 | 'calculated by the prerun is zero.' |
---|
| 1001 | CALL message( 'init_3d_model', 'PA0318', 1, 2, 0, 6, 0 ) |
---|
| 1002 | ENDIF |
---|
| 1003 | |
---|
[292] | 1004 | ENDIF |
---|
[151] | 1005 | |
---|
[328] | 1006 | IF ( inflow_damping_width == 9999999.9 ) THEN |
---|
[151] | 1007 | ! |
---|
[328] | 1008 | !-- Default for the transition range: one tenth of the undamped |
---|
| 1009 | !-- layer |
---|
| 1010 | inflow_damping_width = 0.1 * inflow_damping_height |
---|
[151] | 1011 | |
---|
[328] | 1012 | ENDIF |
---|
[151] | 1013 | |
---|
[328] | 1014 | ALLOCATE( inflow_damping_factor(nzb:nzt+1) ) |
---|
[151] | 1015 | |
---|
[328] | 1016 | DO k = nzb, nzt+1 |
---|
[151] | 1017 | |
---|
[328] | 1018 | IF ( zu(k) <= inflow_damping_height ) THEN |
---|
| 1019 | inflow_damping_factor(k) = 1.0 |
---|
| 1020 | ELSEIF ( zu(k) <= inflow_damping_height + & |
---|
| 1021 | inflow_damping_width ) THEN |
---|
| 1022 | inflow_damping_factor(k) = 1.0 - & |
---|
[151] | 1023 | ( zu(k) - inflow_damping_height ) / & |
---|
| 1024 | inflow_damping_width |
---|
[328] | 1025 | ELSE |
---|
| 1026 | inflow_damping_factor(k) = 0.0 |
---|
| 1027 | ENDIF |
---|
[151] | 1028 | |
---|
[328] | 1029 | ENDDO |
---|
| 1030 | ENDIF |
---|
[151] | 1031 | |
---|
[147] | 1032 | ENDIF |
---|
| 1033 | |
---|
[152] | 1034 | ! |
---|
[163] | 1035 | !-- Read binary data from restart file |
---|
| 1036 | WRITE (9,*) 'before read_3d_binary' |
---|
| 1037 | CALL local_flush( 9 ) |
---|
| 1038 | CALL read_3d_binary |
---|
| 1039 | WRITE (9,*) 'after read_3d_binary' |
---|
| 1040 | CALL local_flush( 9 ) |
---|
| 1041 | |
---|
| 1042 | ! |
---|
[359] | 1043 | !-- Inside buildings set velocities and TKE back to zero |
---|
| 1044 | IF ( TRIM( initializing_actions ) == 'cyclic_fill' .AND. & |
---|
| 1045 | topography /= 'flat' ) THEN |
---|
| 1046 | ! |
---|
| 1047 | !-- Correction of initial volume flow |
---|
| 1048 | IF ( conserve_volume_flow ) THEN |
---|
| 1049 | IF ( nxr == nx ) THEN |
---|
| 1050 | DO j = nys, nyn |
---|
| 1051 | DO k = nzb + 1, nzb_u_inner(j,nx) |
---|
| 1052 | u_nzb_p1_for_vfc(j) = u_nzb_p1_for_vfc(j) + & |
---|
| 1053 | u(k,j,nx) * dzu(k) |
---|
| 1054 | ENDDO |
---|
| 1055 | ENDDO |
---|
| 1056 | ENDIF |
---|
| 1057 | IF ( nyn == ny ) THEN |
---|
| 1058 | DO i = nxl, nxr |
---|
| 1059 | DO k = nzb + 1, nzb_v_inner(ny,i) |
---|
| 1060 | v_nzb_p1_for_vfc(i) = v_nzb_p1_for_vfc(i) + & |
---|
| 1061 | v(k,ny,i) * dzu(k) |
---|
| 1062 | ENDDO |
---|
| 1063 | ENDDO |
---|
| 1064 | ENDIF |
---|
| 1065 | ENDIF |
---|
| 1066 | |
---|
| 1067 | ! |
---|
| 1068 | !-- Inside buildings set velocities and TKE back to zero. |
---|
| 1069 | !-- Other scalars (pt, q, s, km, kh, p, sa, ...) are ignored at present, |
---|
| 1070 | !-- maybe revise later. |
---|
| 1071 | IF ( timestep_scheme(1:5) == 'runge' ) THEN |
---|
| 1072 | DO i = nxl-1, nxr+1 |
---|
| 1073 | DO j = nys-1, nyn+1 |
---|
| 1074 | u (nzb:nzb_u_inner(j,i),j,i) = 0.0 |
---|
| 1075 | v (nzb:nzb_v_inner(j,i),j,i) = 0.0 |
---|
| 1076 | w (nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1077 | e (nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1078 | u_m(nzb:nzb_u_inner(j,i),j,i) = 0.0 |
---|
| 1079 | v_m(nzb:nzb_v_inner(j,i),j,i) = 0.0 |
---|
| 1080 | w_m(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1081 | e_m(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1082 | tu_m(nzb:nzb_u_inner(j,i),j,i) = 0.0 |
---|
| 1083 | tv_m(nzb:nzb_v_inner(j,i),j,i) = 0.0 |
---|
| 1084 | tw_m(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1085 | te_m(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1086 | tpt_m(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1087 | ENDDO |
---|
| 1088 | ENDDO |
---|
| 1089 | ELSE |
---|
| 1090 | DO i = nxl-1, nxr+1 |
---|
| 1091 | DO j = nys-1, nyn+1 |
---|
| 1092 | u (nzb:nzb_u_inner(j,i),j,i) = 0.0 |
---|
| 1093 | v (nzb:nzb_v_inner(j,i),j,i) = 0.0 |
---|
| 1094 | w (nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1095 | e (nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1096 | u_m(nzb:nzb_u_inner(j,i),j,i) = 0.0 |
---|
| 1097 | v_m(nzb:nzb_v_inner(j,i),j,i) = 0.0 |
---|
| 1098 | w_m(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1099 | e_m(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1100 | u_p(nzb:nzb_u_inner(j,i),j,i) = 0.0 |
---|
| 1101 | v_p(nzb:nzb_v_inner(j,i),j,i) = 0.0 |
---|
| 1102 | w_p(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1103 | e_p(nzb:nzb_w_inner(j,i),j,i) = 0.0 |
---|
| 1104 | ENDDO |
---|
| 1105 | ENDDO |
---|
| 1106 | ENDIF |
---|
| 1107 | |
---|
| 1108 | ENDIF |
---|
| 1109 | |
---|
| 1110 | ! |
---|
[152] | 1111 | !-- Calculate the initial volume flow at the right and north boundary |
---|
[163] | 1112 | IF ( conserve_volume_flow .AND. & |
---|
[328] | 1113 | TRIM( initializing_actions ) == 'cyclic_fill' ) THEN |
---|
[151] | 1114 | |
---|
[152] | 1115 | volume_flow_initial_l = 0.0 |
---|
| 1116 | volume_flow_area_l = 0.0 |
---|
| 1117 | |
---|
| 1118 | IF ( nxr == nx ) THEN |
---|
| 1119 | DO j = nys, nyn |
---|
| 1120 | DO k = nzb_2d(j,nx) + 1, nzt |
---|
| 1121 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
| 1122 | u(k,j,nx) * dzu(k) |
---|
| 1123 | volume_flow_area_l(1) = volume_flow_area_l(1) + dzu(k) |
---|
| 1124 | ENDDO |
---|
[147] | 1125 | ! |
---|
[359] | 1126 | !-- Correction if velocity inside buildings has been set to zero |
---|
| 1127 | !-- further above |
---|
[152] | 1128 | volume_flow_initial_l(1) = volume_flow_initial_l(1) + & |
---|
| 1129 | u_nzb_p1_for_vfc(j) |
---|
| 1130 | ENDDO |
---|
| 1131 | ENDIF |
---|
| 1132 | |
---|
| 1133 | IF ( nyn == ny ) THEN |
---|
| 1134 | DO i = nxl, nxr |
---|
| 1135 | DO k = nzb_2d(ny,i) + 1, nzt |
---|
| 1136 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
| 1137 | v(k,ny,i) * dzu(k) |
---|
| 1138 | volume_flow_area_l(2) = volume_flow_area_l(2) + dzu(k) |
---|
| 1139 | ENDDO |
---|
| 1140 | ! |
---|
[359] | 1141 | !-- Correction if velocity inside buildings has been set to zero |
---|
| 1142 | !-- further above |
---|
[152] | 1143 | volume_flow_initial_l(2) = volume_flow_initial_l(2) + & |
---|
| 1144 | v_nzb_p1_for_vfc(i) |
---|
| 1145 | ENDDO |
---|
| 1146 | ENDIF |
---|
| 1147 | |
---|
| 1148 | #if defined( __parallel ) |
---|
| 1149 | CALL MPI_ALLREDUCE( volume_flow_initial_l(1), volume_flow_initial(1),& |
---|
| 1150 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1151 | CALL MPI_ALLREDUCE( volume_flow_area_l(1), volume_flow_area(1), & |
---|
| 1152 | 2, MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1153 | #else |
---|
| 1154 | volume_flow_initial = volume_flow_initial_l |
---|
| 1155 | volume_flow_area = volume_flow_area_l |
---|
| 1156 | #endif |
---|
| 1157 | ENDIF |
---|
| 1158 | |
---|
| 1159 | |
---|
| 1160 | ! |
---|
[1] | 1161 | !-- Calculate initial temperature field and other constants used in case |
---|
| 1162 | !-- of a sloping surface |
---|
| 1163 | IF ( sloping_surface ) CALL init_slope |
---|
| 1164 | |
---|
| 1165 | ! |
---|
| 1166 | !-- Initialize new time levels (only done in order to set boundary values |
---|
| 1167 | !-- including ghost points) |
---|
| 1168 | e_p = e; pt_p = pt; u_p = u; v_p = v; w_p = w |
---|
[75] | 1169 | IF ( humidity .OR. passive_scalar ) q_p = q |
---|
[94] | 1170 | IF ( ocean ) sa_p = sa |
---|
[1] | 1171 | |
---|
[181] | 1172 | ! |
---|
| 1173 | !-- Allthough tendency arrays are set in prognostic_equations, they have |
---|
| 1174 | !-- have to be predefined here because they are used (but multiplied with 0) |
---|
| 1175 | !-- there before they are set. |
---|
| 1176 | IF ( timestep_scheme(1:5) == 'runge' ) THEN |
---|
| 1177 | te_m = 0.0; tpt_m = 0.0; tu_m = 0.0; tv_m = 0.0; tw_m = 0.0 |
---|
| 1178 | IF ( humidity .OR. passive_scalar ) tq_m = 0.0 |
---|
| 1179 | IF ( ocean ) tsa_m = 0.0 |
---|
| 1180 | ENDIF |
---|
| 1181 | |
---|
[1] | 1182 | ELSE |
---|
| 1183 | ! |
---|
| 1184 | !-- Actually this part of the programm should not be reached |
---|
[254] | 1185 | message_string = 'unknown initializing problem' |
---|
| 1186 | CALL message( 'init_3d_model', 'PA0193', 1, 2, 0, 6, 0 ) |
---|
[1] | 1187 | ENDIF |
---|
| 1188 | |
---|
[151] | 1189 | |
---|
| 1190 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
[1] | 1191 | ! |
---|
[151] | 1192 | !-- Initialize old timelevels needed for radiation boundary conditions |
---|
| 1193 | IF ( outflow_l ) THEN |
---|
| 1194 | u_m_l(:,:,:) = u(:,:,1:2) |
---|
| 1195 | v_m_l(:,:,:) = v(:,:,0:1) |
---|
| 1196 | w_m_l(:,:,:) = w(:,:,0:1) |
---|
| 1197 | ENDIF |
---|
| 1198 | IF ( outflow_r ) THEN |
---|
| 1199 | u_m_r(:,:,:) = u(:,:,nx-1:nx) |
---|
| 1200 | v_m_r(:,:,:) = v(:,:,nx-1:nx) |
---|
| 1201 | w_m_r(:,:,:) = w(:,:,nx-1:nx) |
---|
| 1202 | ENDIF |
---|
| 1203 | IF ( outflow_s ) THEN |
---|
| 1204 | u_m_s(:,:,:) = u(:,0:1,:) |
---|
| 1205 | v_m_s(:,:,:) = v(:,1:2,:) |
---|
| 1206 | w_m_s(:,:,:) = w(:,0:1,:) |
---|
| 1207 | ENDIF |
---|
| 1208 | IF ( outflow_n ) THEN |
---|
| 1209 | u_m_n(:,:,:) = u(:,ny-1:ny,:) |
---|
| 1210 | v_m_n(:,:,:) = v(:,ny-1:ny,:) |
---|
| 1211 | w_m_n(:,:,:) = w(:,ny-1:ny,:) |
---|
| 1212 | ENDIF |
---|
| 1213 | |
---|
| 1214 | ENDIF |
---|
| 1215 | |
---|
| 1216 | ! |
---|
[138] | 1217 | !-- Initialization of the leaf area density |
---|
| 1218 | IF ( plant_canopy ) THEN |
---|
| 1219 | |
---|
| 1220 | SELECT CASE ( TRIM( canopy_mode ) ) |
---|
| 1221 | |
---|
| 1222 | CASE( 'block' ) |
---|
| 1223 | |
---|
| 1224 | DO i = nxl-1, nxr+1 |
---|
| 1225 | DO j = nys-1, nyn+1 |
---|
| 1226 | lad_s(:,j,i) = lad(:) |
---|
| 1227 | cdc(:,j,i) = drag_coefficient |
---|
[153] | 1228 | IF ( passive_scalar ) THEN |
---|
| 1229 | sls(:,j,i) = leaf_surface_concentration |
---|
| 1230 | sec(:,j,i) = scalar_exchange_coefficient |
---|
| 1231 | ENDIF |
---|
[138] | 1232 | ENDDO |
---|
| 1233 | ENDDO |
---|
| 1234 | |
---|
| 1235 | CASE DEFAULT |
---|
| 1236 | |
---|
| 1237 | ! |
---|
| 1238 | !-- The DEFAULT case is reached either if the parameter |
---|
| 1239 | !-- canopy mode contains a wrong character string or if the |
---|
| 1240 | !-- user has coded a special case in the user interface. |
---|
| 1241 | !-- There, the subroutine user_init_plant_canopy checks |
---|
| 1242 | !-- which of these two conditions applies. |
---|
| 1243 | CALL user_init_plant_canopy |
---|
| 1244 | |
---|
| 1245 | END SELECT |
---|
| 1246 | |
---|
| 1247 | CALL exchange_horiz( lad_s ) |
---|
| 1248 | CALL exchange_horiz( cdc ) |
---|
| 1249 | |
---|
[153] | 1250 | IF ( passive_scalar ) THEN |
---|
| 1251 | CALL exchange_horiz( sls ) |
---|
| 1252 | CALL exchange_horiz( sec ) |
---|
| 1253 | ENDIF |
---|
| 1254 | |
---|
| 1255 | ! |
---|
| 1256 | !-- Sharp boundaries of the plant canopy in horizontal directions |
---|
| 1257 | !-- In vertical direction the interpolation is retained, as the leaf |
---|
| 1258 | !-- area density is initialised by prescribing a vertical profile |
---|
| 1259 | !-- consisting of piecewise linear segments. The upper boundary |
---|
| 1260 | !-- of the plant canopy is now defined by lad_w(pch_index,:,:) = 0.0. |
---|
| 1261 | |
---|
[138] | 1262 | DO i = nxl, nxr |
---|
| 1263 | DO j = nys, nyn |
---|
| 1264 | DO k = nzb, nzt+1 |
---|
[153] | 1265 | IF ( lad_s(k,j,i) > 0.0 ) THEN |
---|
| 1266 | lad_u(k,j,i) = lad_s(k,j,i) |
---|
| 1267 | lad_u(k,j,i+1) = lad_s(k,j,i) |
---|
| 1268 | lad_v(k,j,i) = lad_s(k,j,i) |
---|
| 1269 | lad_v(k,j+1,i) = lad_s(k,j,i) |
---|
| 1270 | ENDIF |
---|
[138] | 1271 | ENDDO |
---|
| 1272 | DO k = nzb, nzt |
---|
| 1273 | lad_w(k,j,i) = 0.5 * ( lad_s(k+1,j,i) + lad_s(k,j,i) ) |
---|
| 1274 | ENDDO |
---|
| 1275 | ENDDO |
---|
| 1276 | ENDDO |
---|
| 1277 | |
---|
[153] | 1278 | lad_w(pch_index,:,:) = 0.0 |
---|
| 1279 | lad_w(nzt+1,:,:) = lad_w(nzt,:,:) |
---|
[138] | 1280 | |
---|
| 1281 | CALL exchange_horiz( lad_u ) |
---|
| 1282 | CALL exchange_horiz( lad_v ) |
---|
| 1283 | CALL exchange_horiz( lad_w ) |
---|
[153] | 1284 | |
---|
| 1285 | ! |
---|
| 1286 | !-- Initialisation of the canopy heat source distribution |
---|
| 1287 | IF ( cthf /= 0.0 ) THEN |
---|
| 1288 | ! |
---|
| 1289 | !-- Piecewise evaluation of the leaf area index by |
---|
| 1290 | !-- integration of the leaf area density |
---|
| 1291 | lai(:,:,:) = 0.0 |
---|
| 1292 | DO i = nxl-1, nxr+1 |
---|
| 1293 | DO j = nys-1, nyn+1 |
---|
| 1294 | DO k = pch_index-1, 0, -1 |
---|
| 1295 | lai(k,j,i) = lai(k+1,j,i) + & |
---|
| 1296 | ( 0.5 * ( lad_w(k+1,j,i) + & |
---|
| 1297 | lad_s(k+1,j,i) ) * & |
---|
| 1298 | ( zw(k+1) - zu(k+1) ) ) + & |
---|
| 1299 | ( 0.5 * ( lad_w(k,j,i) + & |
---|
| 1300 | lad_s(k+1,j,i) ) * & |
---|
| 1301 | ( zu(k+1) - zw(k) ) ) |
---|
| 1302 | ENDDO |
---|
| 1303 | ENDDO |
---|
| 1304 | ENDDO |
---|
| 1305 | |
---|
| 1306 | ! |
---|
| 1307 | !-- Evaluation of the upward kinematic vertical heat flux within the |
---|
| 1308 | !-- canopy |
---|
| 1309 | DO i = nxl-1, nxr+1 |
---|
| 1310 | DO j = nys-1, nyn+1 |
---|
| 1311 | DO k = 0, pch_index |
---|
| 1312 | canopy_heat_flux(k,j,i) = cthf * & |
---|
| 1313 | exp( -0.6 * lai(k,j,i) ) |
---|
| 1314 | ENDDO |
---|
| 1315 | ENDDO |
---|
| 1316 | ENDDO |
---|
| 1317 | |
---|
| 1318 | ! |
---|
| 1319 | !-- The near surface heat flux is derived from the heat flux |
---|
| 1320 | !-- distribution within the canopy |
---|
| 1321 | shf(:,:) = canopy_heat_flux(0,:,:) |
---|
| 1322 | |
---|
| 1323 | IF ( ASSOCIATED( shf_m ) ) shf_m = shf |
---|
| 1324 | |
---|
| 1325 | ENDIF |
---|
| 1326 | |
---|
[138] | 1327 | ENDIF |
---|
| 1328 | |
---|
| 1329 | ! |
---|
[1] | 1330 | !-- If required, initialize dvrp-software |
---|
| 1331 | IF ( dt_dvrp /= 9999999.9 ) CALL init_dvrp |
---|
| 1332 | |
---|
[96] | 1333 | IF ( ocean ) THEN |
---|
[1] | 1334 | ! |
---|
[96] | 1335 | !-- Initialize quantities needed for the ocean model |
---|
| 1336 | CALL init_ocean |
---|
[388] | 1337 | |
---|
[96] | 1338 | ELSE |
---|
| 1339 | ! |
---|
| 1340 | !-- Initialize quantities for handling cloud physics |
---|
| 1341 | !-- This routine must be called before init_particles, because |
---|
| 1342 | !-- otherwise, array pt_d_t, needed in data_output_dvrp (called by |
---|
| 1343 | !-- init_particles) is not defined. |
---|
| 1344 | CALL init_cloud_physics |
---|
| 1345 | ENDIF |
---|
[1] | 1346 | |
---|
| 1347 | ! |
---|
| 1348 | !-- If required, initialize particles |
---|
[63] | 1349 | IF ( particle_advection ) CALL init_particles |
---|
[1] | 1350 | |
---|
| 1351 | ! |
---|
| 1352 | !-- Initialize quantities for special advections schemes |
---|
| 1353 | CALL init_advec |
---|
| 1354 | |
---|
| 1355 | ! |
---|
| 1356 | !-- Initialize Rayleigh damping factors |
---|
| 1357 | rdf = 0.0 |
---|
| 1358 | IF ( rayleigh_damping_factor /= 0.0 ) THEN |
---|
[108] | 1359 | IF ( .NOT. ocean ) THEN |
---|
| 1360 | DO k = nzb+1, nzt |
---|
| 1361 | IF ( zu(k) >= rayleigh_damping_height ) THEN |
---|
| 1362 | rdf(k) = rayleigh_damping_factor * & |
---|
[1] | 1363 | ( SIN( pi * 0.5 * ( zu(k) - rayleigh_damping_height ) & |
---|
| 1364 | / ( zu(nzt) - rayleigh_damping_height ) )& |
---|
| 1365 | )**2 |
---|
[108] | 1366 | ENDIF |
---|
| 1367 | ENDDO |
---|
| 1368 | ELSE |
---|
| 1369 | DO k = nzt, nzb+1, -1 |
---|
| 1370 | IF ( zu(k) <= rayleigh_damping_height ) THEN |
---|
| 1371 | rdf(k) = rayleigh_damping_factor * & |
---|
| 1372 | ( SIN( pi * 0.5 * ( rayleigh_damping_height - zu(k) ) & |
---|
| 1373 | / ( rayleigh_damping_height - zu(nzb+1)))& |
---|
| 1374 | )**2 |
---|
| 1375 | ENDIF |
---|
| 1376 | ENDDO |
---|
| 1377 | ENDIF |
---|
[1] | 1378 | ENDIF |
---|
| 1379 | |
---|
| 1380 | ! |
---|
[240] | 1381 | !-- Initialize the starting level and the vertical smoothing factor used for |
---|
| 1382 | !-- the external pressure gradient |
---|
| 1383 | dp_smooth_factor = 1.0 |
---|
| 1384 | IF ( dp_external ) THEN |
---|
| 1385 | ! |
---|
| 1386 | !-- Set the starting level dp_level_ind_b only if it has not been set before |
---|
| 1387 | !-- (e.g. in init_grid). |
---|
| 1388 | IF ( dp_level_ind_b == 0 ) THEN |
---|
| 1389 | ind_array = MINLOC( ABS( dp_level_b - zu ) ) |
---|
| 1390 | dp_level_ind_b = ind_array(1) - 1 + nzb |
---|
| 1391 | ! MINLOC uses lower array bound 1 |
---|
| 1392 | ENDIF |
---|
| 1393 | IF ( dp_smooth ) THEN |
---|
| 1394 | dp_smooth_factor(:dp_level_ind_b) = 0.0 |
---|
| 1395 | DO k = dp_level_ind_b+1, nzt |
---|
| 1396 | dp_smooth_factor(k) = 0.5 * ( 1.0 + SIN( pi * & |
---|
| 1397 | ( REAL( k - dp_level_ind_b ) / & |
---|
| 1398 | REAL( nzt - dp_level_ind_b ) - 0.5 ) ) ) |
---|
| 1399 | ENDDO |
---|
| 1400 | ENDIF |
---|
| 1401 | ENDIF |
---|
| 1402 | |
---|
| 1403 | ! |
---|
[1] | 1404 | !-- Initialize diffusivities used within the outflow damping layer in case of |
---|
| 1405 | !-- non-cyclic lateral boundaries. A linear increase is assumed over the first |
---|
| 1406 | !-- half of the width of the damping layer |
---|
[73] | 1407 | IF ( bc_lr == 'dirichlet/radiation' ) THEN |
---|
[1] | 1408 | |
---|
| 1409 | DO i = nxl-1, nxr+1 |
---|
[73] | 1410 | IF ( i >= nx - outflow_damping_width ) THEN |
---|
| 1411 | km_damp_x(i) = km_damp_max * MIN( 1.0, & |
---|
| 1412 | ( i - ( nx - outflow_damping_width ) ) / & |
---|
| 1413 | REAL( outflow_damping_width/2 ) & |
---|
| 1414 | ) |
---|
| 1415 | ELSE |
---|
| 1416 | km_damp_x(i) = 0.0 |
---|
| 1417 | ENDIF |
---|
| 1418 | ENDDO |
---|
[1] | 1419 | |
---|
[73] | 1420 | ELSEIF ( bc_lr == 'radiation/dirichlet' ) THEN |
---|
[1] | 1421 | |
---|
[73] | 1422 | DO i = nxl-1, nxr+1 |
---|
| 1423 | IF ( i <= outflow_damping_width ) THEN |
---|
| 1424 | km_damp_x(i) = km_damp_max * MIN( 1.0, & |
---|
| 1425 | ( outflow_damping_width - i ) / & |
---|
| 1426 | REAL( outflow_damping_width/2 ) & |
---|
| 1427 | ) |
---|
| 1428 | ELSE |
---|
| 1429 | km_damp_x(i) = 0.0 |
---|
| 1430 | ENDIF |
---|
| 1431 | ENDDO |
---|
[1] | 1432 | |
---|
[73] | 1433 | ENDIF |
---|
[1] | 1434 | |
---|
[73] | 1435 | IF ( bc_ns == 'dirichlet/radiation' ) THEN |
---|
[1] | 1436 | |
---|
[73] | 1437 | DO j = nys-1, nyn+1 |
---|
| 1438 | IF ( j >= ny - outflow_damping_width ) THEN |
---|
| 1439 | km_damp_y(j) = km_damp_max * MIN( 1.0, & |
---|
| 1440 | ( j - ( ny - outflow_damping_width ) ) / & |
---|
| 1441 | REAL( outflow_damping_width/2 ) & |
---|
| 1442 | ) |
---|
| 1443 | ELSE |
---|
| 1444 | km_damp_y(j) = 0.0 |
---|
[1] | 1445 | ENDIF |
---|
| 1446 | ENDDO |
---|
| 1447 | |
---|
[73] | 1448 | ELSEIF ( bc_ns == 'radiation/dirichlet' ) THEN |
---|
[1] | 1449 | |
---|
| 1450 | DO j = nys-1, nyn+1 |
---|
[73] | 1451 | IF ( j <= outflow_damping_width ) THEN |
---|
| 1452 | km_damp_y(j) = km_damp_max * MIN( 1.0, & |
---|
| 1453 | ( outflow_damping_width - j ) / & |
---|
| 1454 | REAL( outflow_damping_width/2 ) & |
---|
| 1455 | ) |
---|
| 1456 | ELSE |
---|
| 1457 | km_damp_y(j) = 0.0 |
---|
[1] | 1458 | ENDIF |
---|
[73] | 1459 | ENDDO |
---|
[1] | 1460 | |
---|
| 1461 | ENDIF |
---|
| 1462 | |
---|
| 1463 | ! |
---|
| 1464 | !-- Initialize local summation arrays for UP flow_statistics. This is necessary |
---|
| 1465 | !-- because they may not yet have been initialized when they are called from |
---|
| 1466 | !-- flow_statistics (or - depending on the chosen model run - are never |
---|
| 1467 | !-- initialized) |
---|
| 1468 | sums_divnew_l = 0.0 |
---|
| 1469 | sums_divold_l = 0.0 |
---|
| 1470 | sums_l_l = 0.0 |
---|
| 1471 | sums_up_fraction_l = 0.0 |
---|
| 1472 | sums_wsts_bc_l = 0.0 |
---|
| 1473 | |
---|
| 1474 | ! |
---|
| 1475 | !-- Pre-set masks for regional statistics. Default is the total model domain. |
---|
| 1476 | rmask = 1.0 |
---|
| 1477 | |
---|
| 1478 | ! |
---|
[51] | 1479 | !-- User-defined initializing actions. Check afterwards, if maximum number |
---|
| 1480 | !-- of allowed timeseries is not exceeded |
---|
[1] | 1481 | CALL user_init |
---|
| 1482 | |
---|
[51] | 1483 | IF ( dots_num > dots_max ) THEN |
---|
[254] | 1484 | WRITE( message_string, * ) 'number of time series quantities exceeds', & |
---|
[274] | 1485 | ' its maximum of dots_max = ', dots_max, & |
---|
[254] | 1486 | ' &Please increase dots_max in modules.f90.' |
---|
| 1487 | CALL message( 'init_3d_model', 'PA0194', 1, 2, 0, 6, 0 ) |
---|
[51] | 1488 | ENDIF |
---|
| 1489 | |
---|
[1] | 1490 | ! |
---|
| 1491 | !-- Input binary data file is not needed anymore. This line must be placed |
---|
| 1492 | !-- after call of user_init! |
---|
| 1493 | CALL close_file( 13 ) |
---|
| 1494 | |
---|
| 1495 | ! |
---|
| 1496 | !-- Compute total sum of active mask grid points |
---|
| 1497 | !-- ngp_2dh: number of grid points of a horizontal cross section through the |
---|
| 1498 | !-- total domain |
---|
| 1499 | !-- ngp_3d: number of grid points of the total domain |
---|
[132] | 1500 | ngp_2dh_outer_l = 0 |
---|
| 1501 | ngp_2dh_outer = 0 |
---|
| 1502 | ngp_2dh_s_inner_l = 0 |
---|
| 1503 | ngp_2dh_s_inner = 0 |
---|
| 1504 | ngp_2dh_l = 0 |
---|
| 1505 | ngp_2dh = 0 |
---|
| 1506 | ngp_3d_inner_l = 0 |
---|
| 1507 | ngp_3d_inner = 0 |
---|
| 1508 | ngp_3d = 0 |
---|
| 1509 | ngp_sums = ( nz + 2 ) * ( pr_palm + max_pr_user ) |
---|
[1] | 1510 | |
---|
| 1511 | DO sr = 0, statistic_regions |
---|
| 1512 | DO i = nxl, nxr |
---|
| 1513 | DO j = nys, nyn |
---|
| 1514 | IF ( rmask(j,i,sr) == 1.0 ) THEN |
---|
| 1515 | ! |
---|
| 1516 | !-- All xy-grid points |
---|
| 1517 | ngp_2dh_l(sr) = ngp_2dh_l(sr) + 1 |
---|
| 1518 | ! |
---|
| 1519 | !-- xy-grid points above topography |
---|
| 1520 | DO k = nzb_s_outer(j,i), nz + 1 |
---|
| 1521 | ngp_2dh_outer_l(k,sr) = ngp_2dh_outer_l(k,sr) + 1 |
---|
| 1522 | ENDDO |
---|
[132] | 1523 | DO k = nzb_s_inner(j,i), nz + 1 |
---|
| 1524 | ngp_2dh_s_inner_l(k,sr) = ngp_2dh_s_inner_l(k,sr) + 1 |
---|
| 1525 | ENDDO |
---|
[1] | 1526 | ! |
---|
| 1527 | !-- All grid points of the total domain above topography |
---|
| 1528 | ngp_3d_inner_l(sr) = ngp_3d_inner_l(sr) + & |
---|
| 1529 | ( nz - nzb_s_inner(j,i) + 2 ) |
---|
| 1530 | ENDIF |
---|
| 1531 | ENDDO |
---|
| 1532 | ENDDO |
---|
| 1533 | ENDDO |
---|
| 1534 | |
---|
| 1535 | sr = statistic_regions + 1 |
---|
| 1536 | #if defined( __parallel ) |
---|
| 1537 | CALL MPI_ALLREDUCE( ngp_2dh_l(0), ngp_2dh(0), sr, MPI_INTEGER, MPI_SUM, & |
---|
| 1538 | comm2d, ierr ) |
---|
| 1539 | CALL MPI_ALLREDUCE( ngp_2dh_outer_l(0,0), ngp_2dh_outer(0,0), (nz+2)*sr, & |
---|
| 1540 | MPI_INTEGER, MPI_SUM, comm2d, ierr ) |
---|
[132] | 1541 | CALL MPI_ALLREDUCE( ngp_2dh_s_inner_l(0,0), ngp_2dh_s_inner(0,0), & |
---|
| 1542 | (nz+2)*sr, MPI_INTEGER, MPI_SUM, comm2d, ierr ) |
---|
[1] | 1543 | CALL MPI_ALLREDUCE( ngp_3d_inner_l(0), ngp_3d_inner(0), sr, MPI_INTEGER, & |
---|
| 1544 | MPI_SUM, comm2d, ierr ) |
---|
| 1545 | #else |
---|
[132] | 1546 | ngp_2dh = ngp_2dh_l |
---|
| 1547 | ngp_2dh_outer = ngp_2dh_outer_l |
---|
| 1548 | ngp_2dh_s_inner = ngp_2dh_s_inner_l |
---|
| 1549 | ngp_3d_inner = ngp_3d_inner_l |
---|
[1] | 1550 | #endif |
---|
| 1551 | |
---|
| 1552 | ngp_3d = ngp_2dh * ( nz + 2 ) |
---|
| 1553 | |
---|
| 1554 | ! |
---|
| 1555 | !-- Set a lower limit of 1 in order to avoid zero divisions in flow_statistics, |
---|
| 1556 | !-- buoyancy, etc. A zero value will occur for cases where all grid points of |
---|
| 1557 | !-- the respective subdomain lie below the surface topography |
---|
[333] | 1558 | ngp_2dh_outer = MAX( 1, ngp_2dh_outer(:,:) ) |
---|
| 1559 | ngp_3d_inner = MAX( 1, ngp_3d_inner(:) ) |
---|
| 1560 | ngp_2dh_s_inner = MAX( 1, ngp_2dh_s_inner(:,:) ) |
---|
[1] | 1561 | |
---|
| 1562 | DEALLOCATE( ngp_2dh_l, ngp_2dh_outer_l, ngp_3d_inner_l ) |
---|
| 1563 | |
---|
| 1564 | |
---|
| 1565 | END SUBROUTINE init_3d_model |
---|