1 | !> @file netcdf_data_input_mod.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
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. |
---|
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 | ! |
---|
17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! Some formatting adjustment |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: netcdf_data_input_mod.f90 3556 2018-11-22 14:11:57Z suehring $ |
---|
27 | ! variables documented and unused variables removed |
---|
28 | ! |
---|
29 | ! 3552 2018-11-22 10:28:35Z suehring |
---|
30 | ! Revise ghost point exchange and resizing of input variables |
---|
31 | ! |
---|
32 | ! 3542 2018-11-20 17:04:13Z suehring |
---|
33 | ! - read optional attributes from file |
---|
34 | ! - set default origin_time |
---|
35 | ! |
---|
36 | ! 3518 2018-11-12 18:10:23Z suehring |
---|
37 | ! Additional checks |
---|
38 | ! |
---|
39 | ! 3516 2018-11-12 15:49:39Z gronemeier |
---|
40 | ! bugfix: - difference in z coordinate between file and PALM must be <1e-6 |
---|
41 | !     - output of error 553 for all PEs |
---|
42 | ! |
---|
43 | ! 3498 2018-11-07 10:53:03Z gronemeier |
---|
44 | ! Bugfix: print error message by processor which encounters the error |
---|
45 | ! |
---|
46 | ! 3485 2018-11-03 17:09:40Z gronemeier |
---|
47 | ! - get central meridian from origin_lon if crs does not exist |
---|
48 | ! - set default origin_lon to 0 |
---|
49 | ! |
---|
50 | ! 3483 2018-11-02 14:19:26Z raasch |
---|
51 | ! bugfix: misplaced directives for netCDF fixed |
---|
52 | ! |
---|
53 | ! 3474 2018-10-30 21:07:39Z kanani |
---|
54 | ! Add UV exposure model input (Schrempf) |
---|
55 | ! |
---|
56 | ! 3472 2018-10-30 20:43:50Z suehring |
---|
57 | ! Salsa implemented |
---|
58 | ! |
---|
59 | ! 3464 2018-10-30 18:08:55Z kanani |
---|
60 | ! Define coordinate reference system (crs) and read from input dataset |
---|
61 | ! Revise default values for reference coordinates |
---|
62 | ! |
---|
63 | ! 3459 2018-10-30 15:04:11Z gronemeier |
---|
64 | ! from chemistry branch r3443, banzhafs, Russo: |
---|
65 | ! Uncommented lines on dimension of surface_fractions |
---|
66 | ! Removed par_emis_time_factor variable, moved to chem_emissions_mod |
---|
67 | ! Initialized nspec and other emission variables at time of declaration |
---|
68 | ! Modified EXPERT mode to PRE-PROCESSED mode |
---|
69 | ! Introduced Chemistry static netcdf file |
---|
70 | ! Added the routine for reading-in netcdf data for chemistry |
---|
71 | ! Added routines to get_variable interface specific for chemistry files |
---|
72 | ! |
---|
73 | ! 3429 2018-10-25 13:04:23Z knoop |
---|
74 | ! add default values of origin_x/y/z |
---|
75 | ! |
---|
76 | ! 3404 2018-10-23 13:29:11Z suehring |
---|
77 | ! Consider time-dependent geostrophic wind components in offline nesting |
---|
78 | ! |
---|
79 | ! 3376 2018-10-19 10:15:32Z suehring |
---|
80 | ! Additional check for consistent building initialization implemented |
---|
81 | ! |
---|
82 | ! 3347 2018-10-15 14:21:08Z suehring |
---|
83 | ! Subroutine renamed |
---|
84 | ! |
---|
85 | ! 3257 2018-09-17 17:11:46Z suehring |
---|
86 | ! (from branch resler) |
---|
87 | ! Formatting |
---|
88 | ! |
---|
89 | ! 3298 2018-10-02 12:21:11Z kanani |
---|
90 | ! Modified EXPERT mode to PRE-PROCESSED mode (Russo) |
---|
91 | ! Introduced Chemistry static netcdf file (Russo) |
---|
92 | ! Added the routine for reading-in netcdf data for chemistry (Russo) |
---|
93 | ! Added routines to get_variable interface specific for chemistry files (Russo) |
---|
94 | ! |
---|
95 | ! 3257 2018-09-17 17:11:46Z suehring |
---|
96 | ! Adjust checks for building_type and building_id, which is necessary after |
---|
97 | ! topography filtering (building_type and id can be modified by the filtering). |
---|
98 | ! |
---|
99 | ! 3254 2018-09-17 10:53:57Z suehring |
---|
100 | ! Additional check for surface_fractions and and checks for building_id and |
---|
101 | ! building_type extended. |
---|
102 | ! |
---|
103 | ! 3241 2018-09-12 15:02:00Z raasch |
---|
104 | ! unused variables removed |
---|
105 | ! |
---|
106 | ! 3215 2018-08-29 09:58:59Z suehring |
---|
107 | ! - Separate input of soil properties from input of atmospheric data. This |
---|
108 | !  enables input of soil properties also in child domains without any |
---|
109 | !  dependence on atmospheric input |
---|
110 | ! - Check for missing initial 1D/3D data in dynamic input file |
---|
111 | ! - Revise checks for matching grid spacing in model and input file |
---|
112 | ! - Bugfix, add netcdf4_parallel directive for collective read operation |
---|
113 | ! - Revise error message numbers |
---|
114 | ! |
---|
115 | ! 3209 2018-08-27 16:58:37Z suehring |
---|
116 | ! Read zsoil dimension length only if soil variables are provided |
---|
117 | ! |
---|
118 | ! 3183 2018-07-27 14:25:55Z suehring |
---|
119 | ! Adjust input of dynamic driver according to revised Inifor version. |
---|
120 | ! Replace simulated_time by time_since_reference_point. |
---|
121 | ! Rename variables in mesoscale-offline nesting mode. |
---|
122 | ! |
---|
123 | ! 3182 2018-07-27 13:36:03Z suehring |
---|
124 | ! Slightly revise check for surface_fraction in order to check only the relevant |
---|
125 | ! fractions |
---|
126 | ! |
---|
127 | ! 3103 2018-07-04 17:30:52Z suehring |
---|
128 | ! New check for negative terrain heights |
---|
129 | ! |
---|
130 | ! 3089 2018-06-27 13:20:38Z suehring |
---|
131 | ! Revise call for message routine in case of local data inconsistencies. |
---|
132 | ! |
---|
133 | ! 3054 2018-06-01 16:08:59Z gronemeier |
---|
134 | ! Bugfix: force an MPI abort if errors occur while reading building heights |
---|
135 | ! from ASCII file |
---|
136 | ! |
---|
137 | ! 3053 2018-06-01 12:59:07Z suehring |
---|
138 | ! Revise checks for variable surface_fraction |
---|
139 | ! |
---|
140 | ! 3051 2018-05-30 17:43:55Z suehring |
---|
141 | ! - Speed-up NetCDF input |
---|
142 | ! - Revise input routines and remove NetCDF input via IO-blocks since this is |
---|
143 | !  not working in parallel mode in case blocking collective read operations |
---|
144 | !  are done |
---|
145 | ! - Temporarily revoke renaming of input variables in dynamic driver (tend_ug, |
---|
146 | !  tend_vg, zsoil) in order to keep dynamic input file working with current |
---|
147 | !  model version |
---|
148 | ! - More detailed error messages created |
---|
149 | ! |
---|
150 | ! 3045 2018-05-28 07:55:41Z Giersch |
---|
151 | ! Error messages revised |
---|
152 | ! |
---|
153 | ! 3041 2018-05-25 10:39:54Z gronemeier |
---|
154 | ! Add data type for global file attributes |
---|
155 | ! Add read of global attributes of static driver |
---|
156 | ! |
---|
157 | ! 3037 2018-05-24 10:39:29Z gronemeier |
---|
158 | ! renamed 'depth' to 'zsoil' |
---|
159 | ! |
---|
160 | ! 3036 2018-05-24 10:18:26Z gronemeier |
---|
161 | ! Revision of input vars according to UC2 data standard |
---|
162 | ! - renamed 'orography_2D' to 'zt' |
---|
163 | ! - renamed 'buildings_2D' to 'buildings_2d' |
---|
164 | ! - renamed 'buildings_3D' to 'buildings_3d' |
---|
165 | ! - renamed 'leaf_are_density' to 'lad' |
---|
166 | ! - renamed 'basal_are_density' to 'bad' |
---|
167 | ! - renamed 'root_are_density_lad' to 'root_area_dens_r' |
---|
168 | ! - renamed 'root_are_density_lsm' to 'root_area_dens_s' |
---|
169 | ! - renamed 'ls_forcing_ug' to 'tend_ug' |
---|
170 | ! - renamed 'ls_forcing_vg' to 'tend_vg' |
---|
171 | ! |
---|
172 | ! 3019 2018-05-13 07:05:43Z maronga |
---|
173 | ! Improved reading speed of large NetCDF files |
---|
174 | ! |
---|
175 | ! 2963 2018-04-12 14:47:44Z suehring |
---|
176 | ! - Revise checks for static input variables. |
---|
177 | ! - Introduce index for vegetation/wall, pavement/green-wall and water/window |
---|
178 | !  surfaces, for clearer access of surface fraction, albedo, emissivity, etc. . |
---|
179 | ! |
---|
180 | ! 2958 2018-04-11 15:38:13Z suehring |
---|
181 | ! Synchronize longitude and latitude between nested model domains, values are |
---|
182 | ! taken from the root model. |
---|
183 | ! |
---|
184 | ! 2955 2018-04-09 15:14:01Z suehring |
---|
185 | ! Extend checks for consistent setting of buildings, its ID and type. |
---|
186 | ! Add log-points to measure CPU time of NetCDF data input. |
---|
187 | ! |
---|
188 | ! 2953 2018-04-09 11:26:02Z suehring |
---|
189 | ! Bugfix in checks for initialization data |
---|
190 | ! |
---|
191 | ! 2947 2018-04-04 18:01:41Z suehring |
---|
192 | ! Checks for dynamic input revised |
---|
193 | ! |
---|
194 | ! 2946 2018-04-04 17:01:23Z suehring |
---|
195 | ! Bugfix for revision 2945, perform checks only if dynamic input file is |
---|
196 | ! available. |
---|
197 | ! |
---|
198 | ! 2945 2018-04-04 16:27:14Z suehring |
---|
199 | ! - Mimic for topography input slightly revised, in order to enable consistency |
---|
200 | !  checks |
---|
201 | ! - Add checks for dimensions in dynamic input file and move already existing |
---|
202 | !  checks |
---|
203 | ! |
---|
204 | ! 2938 2018-03-27 15:52:42Z suehring |
---|
205 | ! Initial read of geostrophic wind components from dynamic driver. |
---|
206 | ! |
---|
207 | ! 2773 2018-01-30 14:12:54Z suehring |
---|
208 | ! Revise checks for surface_fraction. |
---|
209 | ! |
---|
210 | ! 2925 2018-03-23 14:54:11Z suehring |
---|
211 | ! Check for further inconsistent settings of surface_fractions. |
---|
212 | ! Some messages slightly rephrased and error numbers renamed. |
---|
213 | ! |
---|
214 | ! 2898 2018-03-15 13:03:01Z suehring |
---|
215 | ! Check if each building has a type. Further, check if dimensions in static |
---|
216 | ! input file match the model dimensions. |
---|
217 | ! |
---|
218 | ! 2897 2018-03-15 11:47:16Z suehring |
---|
219 | ! Relax restrictions for topography input, terrain and building heights can be |
---|
220 | ! input separately and are not mandatory any more. |
---|
221 | ! |
---|
222 | ! 2874 2018-03-13 10:55:42Z knoop |
---|
223 | ! Bugfix: wrong placement of netcdf cpp-macros fixed |
---|
224 | ! |
---|
225 | ! 2794 2018-02-07 14:09:43Z knoop |
---|
226 | ! Check if 3D building input is consistent to numeric grid. |
---|
227 | ! |
---|
228 | ! 2773 2018-01-30 14:12:54Z suehring |
---|
229 | ! - Enable initialization with 3D topography. |
---|
230 | ! - Move check for correct initialization in nesting mode to check_parameters. |
---|
231 | ! |
---|
232 | ! 2772 2018-01-29 13:10:35Z suehring |
---|
233 | ! Initialization of simulation independent on land-surface model. |
---|
234 | ! |
---|
235 | ! 2746 2018-01-15 12:06:04Z suehring |
---|
236 | ! Read plant-canopy variables independently on land-surface model usage |
---|
237 | ! |
---|
238 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
239 | ! Corrected "Former revisions" section |
---|
240 | ! |
---|
241 | ! 2711 2017-12-20 17:04:49Z suehring |
---|
242 | ! Rename subroutine close_file to avoid double-naming. |
---|
243 | ! |
---|
244 | ! 2700 2017-12-15 14:12:35Z suehring |
---|
245 | ! |
---|
246 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
247 | ! Initial revision (suehring) |
---|
248 | ! |
---|
249 | ! |
---|
250 | ! |
---|
251 | ! |
---|
252 | ! Authors: |
---|
253 | ! -------- |
---|
254 | ! @author Matthias Suehring |
---|
255 | ! |
---|
256 | ! Description: |
---|
257 | ! ------------ |
---|
258 | !> Modulue contains routines to input data according to Palm input data |
---|
259 | !> standart using dynamic and static input files. |
---|
260 | !> @todo - Chemistry: revise reading of netcdf file and ajdust formatting according to standard!!! |
---|
261 | !> @todo - Order input alphabetically |
---|
262 | !> @todo - Revise error messages and error numbers |
---|
263 | !> @todo - Input of missing quantities (chemical species, emission rates) |
---|
264 | !> @todo - Defninition and input of still missing variable attributes |
---|
265 | !> @todo - Input of initial geostrophic wind profiles with cyclic conditions. |
---|
266 | !------------------------------------------------------------------------------! |
---|
267 | Â MODULE netcdf_data_input_mod |
---|
268 | |
---|
269 |   USE control_parameters,                          & |
---|
270 |     ONLY: coupling_char, io_blocks, io_group |
---|
271 | |
---|
272 |   USE cpulog,                                & |
---|
273 |     ONLY: cpu_log, log_point_s |
---|
274 | |
---|
275 |   USE indices,                                & |
---|
276 | Â Â Â Â ONLY:Â nbgp |
---|
277 | |
---|
278 | Â Â USE kinds |
---|
279 | |
---|
280 | #if defined ( __netcdf ) |
---|
281 | Â Â USE NETCDF |
---|
282 | #endif |
---|
283 | |
---|
284 | Â Â USE pegrid |
---|
285 | |
---|
286 |   USE surface_mod,                              & |
---|
287 |     ONLY: ind_pav_green, ind_veg_wall, ind_wat_win |
---|
288 | ! |
---|
289 | !-- Define type for dimensions. |
---|
290 | Â Â TYPE dims_xy |
---|
291 |     INTEGER(iwp) :: nx               !< dimension length in x |
---|
292 |     INTEGER(iwp) :: ny               !< dimension length in y |
---|
293 |     INTEGER(iwp) :: nz               !< dimension length in z |
---|
294 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: x    !< dimension array in x |
---|
295 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: y    !< dimension array in y |
---|
296 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: z    !< dimension array in z |
---|
297 | Â Â END TYPE dims_xy |
---|
298 | ! |
---|
299 | !-- Define data type for nesting in larger-scale models like COSMO. |
---|
300 | !-- Data type comprises u, v, w, pt, and q at lateral and top boundaries. |
---|
301 | Â Â TYPE nest_offl_type |
---|
302 | |
---|
303 |     CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: var_names |
---|
304 | |
---|
305 |     INTEGER(iwp) :: nt   !< number of time levels in dynamic input file |
---|
306 |     INTEGER(iwp) :: nzu  !< number of vertical levels on scalar grid in dynamic input file |
---|
307 |     INTEGER(iwp) :: nzw  !< number of vertical levels on w grid in dynamic input file |
---|
308 |     INTEGER(iwp) :: tind  !< time index for reference time in mesoscale-offline nesting |
---|
309 |     INTEGER(iwp) :: tind_p !< time index for following time in mesoscale-offline nesting |
---|
310 | |
---|
311 |     LOGICAL   :: init     = .FALSE. !< flag indicating that offline nesting is already initialized |
---|
312 | |
---|
313 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: surface_pressure !< time dependent surface pressure |
---|
314 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: time       !< time levels in dynamic input file |
---|
315 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: zu_atmos     !< vertical levels at scalar grid in dynamic input file |
---|
316 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: zw_atmos     !< vertical levels at w grid in dynamic input file |
---|
317 | |
---|
318 |     REAL(wp), DIMENSION(:,:), ALLOCATABLE :: ug     !< domain-averaged geostrophic component |
---|
319 |     REAL(wp), DIMENSION(:,:), ALLOCATABLE :: vg     !< domain-averaged geostrophic component |
---|
320 | |
---|
321 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_left  !< u-component at left boundary |
---|
322 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_left  !< v-component at left boundary |
---|
323 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: w_left  !< w-component at left boundary |
---|
324 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: q_left  !< mixing ratio at left boundary |
---|
325 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pt_left !< potentital temperautre at left boundary |
---|
326 | |
---|
327 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_north !< u-component at north boundary |
---|
328 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_north !< v-component at north boundary |
---|
329 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: w_north !< w-component at north boundary |
---|
330 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: q_north !< mixing ratio at north boundary |
---|
331 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pt_north !< potentital temperautre at north boundary |
---|
332 | |
---|
333 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_right !< u-component at right boundary |
---|
334 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_right !< v-component at right boundary |
---|
335 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: w_right !< w-component at right boundary |
---|
336 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: q_right !< mixing ratio at right boundary |
---|
337 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pt_right !< potentital temperautre at right boundary |
---|
338 | |
---|
339 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_south !< u-component at south boundary |
---|
340 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_south !< v-component at south boundary |
---|
341 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: w_south !< w-component at south boundary |
---|
342 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: q_south !< mixing ratio at south boundary |
---|
343 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pt_south !< potentital temperautre at south boundary |
---|
344 | |
---|
345 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_top  !< u-component at top boundary |
---|
346 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_top  !< v-component at top boundary |
---|
347 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: w_top  !< w-component at top boundary |
---|
348 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: q_top  !< mixing ratio at top boundary |
---|
349 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: pt_top  !< potentital temperautre at top boundary |
---|
350 | |
---|
351 | Â Â END TYPE nest_offl_type |
---|
352 | |
---|
353 | Â Â TYPE init_type |
---|
354 | |
---|
355 |     CHARACTER(LEN=23) :: origin_time = '2000-01-01 00:00:00 +00' !< reference time of input data |
---|
356 | |
---|
357 |     INTEGER(iwp) :: lod_msoil !< level of detail - soil moisture |
---|
358 |     INTEGER(iwp) :: lod_pt  !< level of detail - pt |
---|
359 |     INTEGER(iwp) :: lod_q   !< level of detail - q |
---|
360 |     INTEGER(iwp) :: lod_tsoil !< level of detail - soil temperature |
---|
361 |     INTEGER(iwp) :: lod_u   !< level of detail - u-component |
---|
362 |     INTEGER(iwp) :: lod_v   !< level of detail - v-component |
---|
363 |     INTEGER(iwp) :: lod_w   !< level of detail - w-component |
---|
364 |     INTEGER(iwp) :: nx    !< number of scalar grid points along x in dynamic input file |
---|
365 |     INTEGER(iwp) :: nxu    !< number of u grid points along x in dynamic input file |
---|
366 |     INTEGER(iwp) :: ny    !< number of scalar grid points along y in dynamic input file |
---|
367 |     INTEGER(iwp) :: nyv    !< number of v grid points along y in dynamic input file |
---|
368 |     INTEGER(iwp) :: nzs    !< number of vertical soil levels in dynamic input file |
---|
369 |     INTEGER(iwp) :: nzu    !< number of vertical levels on scalar grid in dynamic input file |
---|
370 |     INTEGER(iwp) :: nzw    !< number of vertical levels on w grid in dynamic input file |
---|
371 | |
---|
372 |     LOGICAL :: from_file_msoil = .FALSE. !< flag indicating whether soil moisture is already initialized from file |
---|
373 |     LOGICAL :: from_file_pt   = .FALSE. !< flag indicating whether pt is already initialized from file |
---|
374 |     LOGICAL :: from_file_q   = .FALSE. !< flag indicating whether q is already initialized from file |
---|
375 |     LOGICAL :: from_file_tsoil = .FALSE. !< flag indicating whether soil temperature is already initialized from file |
---|
376 |     LOGICAL :: from_file_u   = .FALSE. !< flag indicating whether u is already initialized from file |
---|
377 |     LOGICAL :: from_file_ug   = .FALSE. !< flag indicating whether ug is already initialized from file |
---|
378 |     LOGICAL :: from_file_v   = .FALSE. !< flag indicating whether v is already initialized from file |
---|
379 |     LOGICAL :: from_file_vg   = .FALSE. !< flag indicating whether ug is already initialized from file |
---|
380 |     LOGICAL :: from_file_w   = .FALSE. !< flag indicating whether w is already initialized from file |
---|
381 | |
---|
382 |     REAL(wp) :: fill_msoil       !< fill value for soil moisture |
---|
383 |     REAL(wp) :: fill_pt         !< fill value for pt |
---|
384 |     REAL(wp) :: fill_q         !< fill value for q |
---|
385 |     REAL(wp) :: fill_tsoil       !< fill value for soil temperature |
---|
386 |     REAL(wp) :: fill_u         !< fill value for u |
---|
387 |     REAL(wp) :: fill_v         !< fill value for v |
---|
388 |     REAL(wp) :: fill_w         !< fill value for w |
---|
389 |     REAL(wp) :: latitude = 0.0_wp    !< latitude of the lower left corner |
---|
390 |     REAL(wp) :: longitude = 0.0_wp   !< longitude of the lower left corner |
---|
391 |     REAL(wp) :: origin_x = 500000.0_wp !< UTM easting of the lower left corner |
---|
392 |     REAL(wp) :: origin_y = 0.0_wp    !< UTM northing of the lower left corner |
---|
393 |     REAL(wp) :: origin_z = 0.0_wp    !< reference height of input data |
---|
394 |     REAL(wp) :: rotation_angle = 0.0_wp !< rotation angle of input data |
---|
395 | |
---|
396 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: msoil_1d   !< initial vertical profile of soil moisture |
---|
397 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: pt_init   !< initial vertical profile of pt |
---|
398 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: q_init    !< initial vertical profile of q |
---|
399 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: tsoil_1d   !< initial vertical profile of soil temperature |
---|
400 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: u_init    !< initial vertical profile of u |
---|
401 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: ug_init   !< initial vertical profile of ug |
---|
402 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: v_init    !< initial vertical profile of v |
---|
403 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: vg_init   !< initial vertical profile of ug |
---|
404 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: w_init    !< initial vertical profile of w |
---|
405 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: z_soil    !< vertical levels in soil in dynamic input file, used for interpolation |
---|
406 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: zu_atmos   !< vertical levels at scalar grid in dynamic input file, used for interpolation |
---|
407 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: zw_atmos   !< vertical levels at w grid in dynamic input file, used for interpolation |
---|
408 | |
---|
409 | |
---|
410 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: msoil_3d !< initial 3d soil moisture provide by Inifor and interpolated onto soil grid |
---|
411 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tsoil_3d !< initial 3d soil temperature provide by Inifor and interpolated onto soil grid |
---|
412 | |
---|
413 | Â Â END TYPE init_type |
---|
414 | |
---|
415 | !-- Data type for the general information of chemistry emissions, do not dependent on the particular chemical species |
---|
416 |   TYPE chem_emis_att_type |
---|
417 | |
---|
418 | Â Â Â Â !-DIMENSIONS |
---|
419 | Â Â Â Â INTEGER(iwp)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â nspec=0Â Â Â Â Â Â Â Â Â Â !< number of chem species for which emission values are provided |
---|
420 | Â Â Â Â INTEGER(iwp)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â ncat=0Â Â Â Â Â Â Â Â Â Â !< number of emission categories |
---|
421 | Â Â Â Â INTEGER(iwp)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â nvoc=0Â Â Â Â Â Â Â Â Â Â !< number of VOCs components |
---|
422 | Â Â Â Â INTEGER(iwp)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â npm=0Â Â Â Â Â Â Â Â Â Â Â !< number of PMs components |
---|
423 | Â Â Â Â INTEGER(iwp)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â nnox=2Â Â Â Â Â Â Â Â Â Â !< number of NOx components: NO and NO2 |
---|
424 | Â Â Â Â INTEGER(iwp)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â nsox=2Â Â Â Â Â Â Â Â Â Â !< number of SOx components: SO and SO4 |
---|
425 |     INTEGER(iwp)                 :: nhoursyear        !< number of hours of a specific year in the HOURLY mode |
---|
426 |                                          ! of the default mode |
---|
427 |     INTEGER(iwp)                 :: nmonthdayhour       !< number of month days and hours in the MDH mode |
---|
428 |                                          ! of the default mode |
---|
429 |     INTEGER(iwp)                 :: dt_emission        !< Number of emissions timesteps for one year |
---|
430 |                                          ! in the pre-processed emissions case |
---|
431 | Â Â Â Â !-- 1d emission input variables |
---|
432 |     CHARACTER (LEN=25),ALLOCATABLE, DIMENSION(:) :: pm_name          !< Names of PMs components |
---|
433 |     CHARACTER (LEN=25),ALLOCATABLE, DIMENSION(:) :: cat_name         !< Emission categories names |
---|
434 |     CHARACTER (LEN=25),ALLOCATABLE, DIMENSION(:) :: species_name       !< Names of emission chemical species |
---|
435 |     CHARACTER (LEN=25),ALLOCATABLE, DIMENSION(:) :: voc_name         !< Names of VOCs components |
---|
436 |     CHARACTER (LEN=25)              :: units           !< Units |
---|
437 | |
---|
438 |     INTEGER(iwp)                 :: i_hour          !< indices for assigning the emission values at different timesteps |
---|
439 |     INTEGER(iwp),ALLOCATABLE, DIMENSION(:)    :: cat_index         !< Index of emission categories |
---|
440 |     INTEGER(iwp),ALLOCATABLE, DIMENSION(:)    :: species_index       !< Index of emission chem species |
---|
441 | |
---|
442 |     REAL(wp),ALLOCATABLE, DIMENSION(:)      :: xm            !< Molecular masses of emission chem species |
---|
443 | |
---|
444 | Â Â Â Â !-- 2d emission input variables |
---|
445 |     REAL(wp),ALLOCATABLE, DIMENSION(:,:)     :: hourly_emis_time_factor  !< Time factors for HOURLY emissions (DEFAULT mode) |
---|
446 |     REAL(wp),ALLOCATABLE, DIMENSION(:,:)     :: mdh_emis_time_factor   !< Time factors for MDH emissions (DEFAULT mode) |
---|
447 |     REAL(wp),ALLOCATABLE, DIMENSION(:,:)     :: nox_comp         !< Composition of NO and NO2 |
---|
448 |     REAL(wp),ALLOCATABLE, DIMENSION(:,:)     :: sox_comp         !< Composition of SO2 and SO4 |
---|
449 |     REAL(wp),ALLOCATABLE, DIMENSION(:,:)     :: voc_comp         !< Composition of different VOC components (number not fixed) |
---|
450 | |
---|
451 | Â Â Â Â !-- 3d emission input variables |
---|
452 |     REAL(wp),ALLOCATABLE, DIMENSION(:,:,:)    :: pm_comp          !< Composition of different PMs components (number not fixed) |
---|
453 | Â |
---|
454 | Â Â END TYPE chem_emis_att_type |
---|
455 | |
---|
456 | |
---|
457 | !-- Data type for the values of chemistry emissions ERUSSO |
---|
458 |   TYPE chem_emis_val_type |
---|
459 | |
---|
460 |     !REAL(wp),ALLOCATABLE, DIMENSION(:,:)     :: stack_height       !< stack height |
---|
461 | |
---|
462 | Â Â Â Â !-- 3d emission input variables |
---|
463 |     REAL(wp),ALLOCATABLE, DIMENSION(:,:,:)   :: default_emission_data   !< Input Values emissions DEFAULT mode |
---|
464 | |
---|
465 | Â Â Â Â !-- 4d emission input variables |
---|
466 |     REAL(wp),ALLOCATABLE, DIMENSION(:,:,:,:)  :: preproc_emission_data   !< Input Values emissions PRE-PROCESSED mode |
---|
467 | |
---|
468 | Â Â END TYPE chem_emis_val_type |
---|
469 | |
---|
470 | ! |
---|
471 | !-- Define data structures for different input data types. |
---|
472 | !-- 8-bit Integer 2D |
---|
473 | Â Â TYPE int_2d_8bit |
---|
474 |     INTEGER(KIND=1) :: fill = -127           !< fill value |
---|
475 |     INTEGER(KIND=1), DIMENSION(:,:), ALLOCATABLE :: var !< respective variable |
---|
476 | |
---|
477 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
478 | Â Â END TYPE int_2d_8bit |
---|
479 | ! |
---|
480 | !-- 8-bit Integer 3D |
---|
481 | Â Â TYPE int_3d_8bit |
---|
482 |     INTEGER(KIND=1) :: fill = -127              !< fill value |
---|
483 |     INTEGER(KIND=1), DIMENSION(:,:,:), ALLOCATABLE :: var_3d !< respective variable |
---|
484 | |
---|
485 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
486 | Â Â END TYPE int_3d_8bit |
---|
487 | ! |
---|
488 | !-- 32-bit Integer 2D |
---|
489 | Â Â TYPE int_2d_32bit |
---|
490 |     INTEGER(iwp) :: fill = -9999           !< fill value |
---|
491 |     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: var !< respective variable |
---|
492 | |
---|
493 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
494 | Â Â END TYPE int_2d_32bit |
---|
495 | |
---|
496 | ! |
---|
497 | !-- Define data type to read 2D real variables |
---|
498 | Â Â TYPE real_2d |
---|
499 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
500 | |
---|
501 |     REAL(wp) :: fill = -9999.9_wp        !< fill value |
---|
502 |     REAL(wp), DIMENSION(:,:), ALLOCATABLE :: var !< respective variable |
---|
503 | Â Â END TYPE real_2d |
---|
504 | |
---|
505 | ! |
---|
506 | !-- Define data type to read 3D real variables |
---|
507 | Â Â TYPE real_3d |
---|
508 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
509 | |
---|
510 |     INTEGER(iwp) :: nz  !< number of grid points along vertical dimension |
---|
511 | |
---|
512 |     REAL(wp) :: fill = -9999.9_wp         !< fill value |
---|
513 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: var !< respective variable |
---|
514 | Â Â END TYPE real_3d |
---|
515 | ! |
---|
516 | !-- Define data structure where the dimension and type of the input depends |
---|
517 | !-- on the given level of detail. |
---|
518 | !-- For buildings, the input is either 2D float, or 3d byte. |
---|
519 | Â Â TYPE build_in |
---|
520 |     INTEGER(iwp)  :: lod = 1                !< level of detail |
---|
521 | Â Â Â Â INTEGER(KIND=1)Â ::Â fill2Â =Â -127Â Â Â Â Â Â Â Â Â Â Â Â Â !< fill value for lod = 2 |
---|
522 |     INTEGER(iwp)  :: nz                  !< number of vertical layers in file |
---|
523 |     INTEGER(KIND=1), DIMENSION(:,:,:), ALLOCATABLE :: var_3d !< 3d variable (lod = 2) |
---|
524 | |
---|
525 |     REAL(wp), DIMENSION(:), ALLOCATABLE :: z         !< vertical coordinate for 3D building, used for consistency check |
---|
526 | |
---|
527 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
528 | |
---|
529 |     REAL(wp)               :: fill1 = -9999.9_wp !< fill values for lod = 1 |
---|
530 |     REAL(wp), DIMENSION(:,:), ALLOCATABLE :: var_2d       !< 2d variable (lod = 1) |
---|
531 | Â Â END TYPE build_in |
---|
532 | |
---|
533 | ! |
---|
534 | !-- For soil_type, the input is either 2D or 3D one-byte integer. |
---|
535 | Â Â TYPE soil_in |
---|
536 |     INTEGER(iwp)                  :: lod = 1   !< level of detail |
---|
537 |     INTEGER(KIND=1)                :: fill = -127 !< fill value for lod = 2 |
---|
538 |     INTEGER(KIND=1), DIMENSION(:,:), ALLOCATABLE  :: var_2d    !< 2d variable (lod = 1) |
---|
539 |     INTEGER(KIND=1), DIMENSION(:,:,:), ALLOCATABLE :: var_3d    !< 3d variable (lod = 2) |
---|
540 | |
---|
541 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
542 | Â Â END TYPE soil_in |
---|
543 | |
---|
544 | ! |
---|
545 | !-- Define data type for fractions between surface types |
---|
546 | Â Â TYPE fracs |
---|
547 |     INTEGER(iwp)              :: nf       !< total number of fractions |
---|
548 |     INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nfracs     !< dimension array for fraction |
---|
549 | |
---|
550 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
551 | |
---|
552 |     REAL(wp)                :: fill = -9999.9_wp !< fill value |
---|
553 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: frac       !< respective fraction between different surface types |
---|
554 | Â Â END TYPE fracs |
---|
555 | ! |
---|
556 | !-- Data type for parameter lists, Depending on the given level of detail, |
---|
557 | !-- the input is 3D or 4D |
---|
558 | Â Â TYPE pars |
---|
559 |     INTEGER(iwp)              :: lod = 1     !< level of detail |
---|
560 |     INTEGER(iwp)              :: np       !< total number of parameters |
---|
561 |     INTEGER(iwp)              :: nz       !< vertical dimension - number of soil layers |
---|
562 |     INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: layers     !< dimension array for soil layers |
---|
563 |     INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: pars      !< dimension array for parameters |
---|
564 | |
---|
565 |     LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used |
---|
566 | |
---|
567 |     REAL(wp)                 :: fill = -9999.9_wp !< fill value |
---|
568 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE  :: pars_xy      !< respective parameters, level of detail = 1 |
---|
569 |     REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: pars_xyz     !< respective parameters, level of detail = 2 |
---|
570 | Â Â END TYPE pars |
---|
571 | ! |
---|
572 | !-- Define type for global file attributes |
---|
573 | !-- Please refer to the PALM data standard for a detailed description of each |
---|
574 | !-- attribute. |
---|
575 | Â Â TYPE global_atts_type |
---|
576 |     CHARACTER(LEN=12 ) :: acronym              !< acronym of institution |
---|
577 |     CHARACTER(LEN=7)  :: acronym_char = 'acronym'      !< name of attribute |
---|
578 |     CHARACTER(LEN=200) :: author               !< first name, last name, email adress |
---|
579 |     CHARACTER(LEN=6)  :: author_char = 'author'       !< name of attribute |
---|
580 |     CHARACTER(LEN=12 ) :: campaign = 'PALM-4U'        !< name of campaign |
---|
581 |     CHARACTER(LEN=8)  :: campaign_char = 'campaign'     !< name of attribute |
---|
582 |     CHARACTER(LEN=200) :: comment              !< comment to data |
---|
583 |     CHARACTER(LEN=7)  :: comment_char = 'comment'      !< name of attribute |
---|
584 |     CHARACTER(LEN=200) :: contact_person           !< first name, last name, email adress |
---|
585 |     CHARACTER(LEN=14) :: contact_person_char = 'contact_person' !< name of attribute |
---|
586 |     CHARACTER(LEN=200) :: conventions = 'CF-1.7'       !< netCDF convention |
---|
587 |     CHARACTER(LEN=11) :: conventions_char = 'Conventions'  !< name of attribute |
---|
588 |     CHARACTER(LEN=23 ) :: creation_time           !< creation time of data set |
---|
589 |     CHARACTER(LEN=13) :: creation_time_char = 'creation_time' !< name of attribute |
---|
590 |     CHARACTER(LEN=16 ) :: data_content            !< content of data set |
---|
591 |     CHARACTER(LEN=12) :: data_content_char = 'data_content' !< name of attribute |
---|
592 |     CHARACTER(LEN=200) :: dependencies            !< dependencies of data set |
---|
593 |     CHARACTER(LEN=12) :: dependencies_char = 'dependencies' !< name of attribute |
---|
594 |     CHARACTER(LEN=200) :: history              !< information about data processing |
---|
595 |     CHARACTER(LEN=7)  :: history_char = 'history'      !< name of attribute |
---|
596 |     CHARACTER(LEN=200) :: institution            !< name of responsible institution |
---|
597 |     CHARACTER(LEN=11) :: institution_char = 'institution'  !< name of attribute |
---|
598 |     CHARACTER(LEN=200) :: keywords              !< keywords of data set |
---|
599 |     CHARACTER(LEN=8)  :: keywords_char = 'keywords'     !< name of attribute |
---|
600 |     CHARACTER(LEN=200) :: licence              !< licence of data set |
---|
601 |     CHARACTER(LEN=7)  :: licence_char = 'licence'      !< name of attribute |
---|
602 |     CHARACTER(LEN=200) :: location              !< place which refers to data set |
---|
603 |     CHARACTER(LEN=8)  :: location_char = 'location'     !< name of attribute |
---|
604 |     CHARACTER(LEN=10) :: origin_lat_char = 'origin_lat'   !< name of attribute |
---|
605 |     CHARACTER(LEN=10) :: origin_lon_char = 'origin_lon'   !< name of attribute |
---|
606 |     CHARACTER(LEN=23 ) :: origin_time = '2000-01-01 00:00:00 +00' !< reference time |
---|
607 |     CHARACTER(LEN=11) :: origin_time_char = 'origin_time'  !< name of attribute |
---|
608 |     CHARACTER(LEN=8)  :: origin_x_char = 'origin_x'     !< name of attribute |
---|
609 |     CHARACTER(LEN=8)  :: origin_y_char = 'origin_y'     !< name of attribute |
---|
610 |     CHARACTER(LEN=8)  :: origin_z_char = 'origin_z'     !< name of attribute |
---|
611 |     CHARACTER(LEN=12) :: palm_version_char = 'palm_version' !< name of attribute |
---|
612 |     CHARACTER(LEN=200) :: references             !< literature referring to data set |
---|
613 |     CHARACTER(LEN=10) :: references_char = 'references'   !< name of attribute |
---|
614 |     CHARACTER(LEN=14) :: rotation_angle_char = 'rotation_angle' !< name of attribute |
---|
615 |     CHARACTER(LEN=12 ) :: site                !< name of model domain |
---|
616 |     CHARACTER(LEN=4)  :: site_char = 'site'         !< name of attribute |
---|
617 |     CHARACTER(LEN=200) :: source               !< source of data set |
---|
618 |     CHARACTER(LEN=6)  :: source_char = 'source'       !< name of attribute |
---|
619 |     CHARACTER(LEN=200) :: title               !< title of data set |
---|
620 |     CHARACTER(LEN=5)  :: title_char = 'title'        !< name of attribute |
---|
621 |     CHARACTER(LEN=7)  :: version_char = 'version'      !< name of attribute |
---|
622 | |
---|
623 |     INTEGER(iwp) :: version       !< version of data set |
---|
624 | |
---|
625 |     REAL(wp) :: origin_lat        !< latitude of lower left corner |
---|
626 |     REAL(wp) :: origin_lon        !< longitude of lower left corner |
---|
627 |     REAL(wp) :: origin_x         !< easting (UTM coordinate) of lower left corner |
---|
628 |     REAL(wp) :: origin_y         !< northing (UTM coordinate) of lower left corner |
---|
629 |     REAL(wp) :: origin_z         !< reference height |
---|
630 |     REAL(wp) :: palm_version       !< PALM version of data set |
---|
631 |     REAL(wp) :: rotation_angle      !< rotation angle of coordinate system of data set |
---|
632 | Â Â END TYPE global_atts_type |
---|
633 | ! |
---|
634 | !-- Define type for coordinate reference system (crs) |
---|
635 | Â Â TYPE crs_type |
---|
636 |     CHARACTER(LEN=200) :: epsg_code = 'EPSG:25831'          !< EPSG code |
---|
637 |     CHARACTER(LEN=200) :: grid_mapping_name = 'transverse_mercator' !< name of grid mapping |
---|
638 |     CHARACTER(LEN=200) :: long_name = 'coordinate reference system' !< name of variable crs |
---|
639 |     CHARACTER(LEN=200) :: units = 'm'                !< unit of crs |
---|
640 | |
---|
641 |     REAL(wp) :: false_easting = 500000.0_wp         !< false easting |
---|
642 |     REAL(wp) :: false_northing = 0.0_wp           !< false northing |
---|
643 |     REAL(wp) :: inverse_flattening = 298.257223563_wp    !< 1/f (default for WGS84) |
---|
644 |     REAL(wp) :: latitude_of_projection_origin = 0.0_wp    !< latitude of projection origin |
---|
645 |     REAL(wp) :: longitude_of_central_meridian = 3.0_wp    !< longitude of central meridian of UTM zone (default: zone 31) |
---|
646 |     REAL(wp) :: longitude_of_prime_meridian = 0.0_wp     !< longitude of prime meridian |
---|
647 |     REAL(wp) :: scale_factor_at_central_meridian = 0.9996_wp !< scale factor of UTM coordinates |
---|
648 |     REAL(wp) :: semi_major_axis = 6378137.0_wp        !< length of semi major axis (default for WGS84) |
---|
649 | Â Â END TYPE crs_type |
---|
650 | |
---|
651 | ! |
---|
652 | !-- Define variables |
---|
653 |   TYPE(crs_type)  :: coord_ref_sys !< coordinate reference system |
---|
654 | |
---|
655 |   TYPE(dims_xy)  :: dim_static   !< data structure for x, y-dimension in static input file |
---|
656 | |
---|
657 |   TYPE(nest_offl_type) :: nest_offl !< data structure for data input at lateral and top boundaries (provided by Inifor) |
---|
658 | |
---|
659 |   TYPE(init_type) :: init_3d  !< data structure for the initialization of the 3D flow and soil fields |
---|
660 |   TYPE(init_type) :: init_model !< data structure for the initialization of the model |
---|
661 | |
---|
662 | ! |
---|
663 | !-- Define 2D variables of type NC_BYTE |
---|
664 |   TYPE(int_2d_8bit) :: albedo_type_f   !< input variable for albedo type |
---|
665 |   TYPE(int_2d_8bit) :: building_type_f  !< input variable for building type |
---|
666 |   TYPE(int_2d_8bit) :: pavement_type_f  !< input variable for pavenment type |
---|
667 |   TYPE(int_2d_8bit) :: street_crossing_f !< input variable for water type |
---|
668 |   TYPE(int_2d_8bit) :: street_type_f   !< input variable for water type |
---|
669 |   TYPE(int_2d_8bit) :: vegetation_type_f !< input variable for vegetation type |
---|
670 |   TYPE(int_2d_8bit) :: water_type_f   !< input variable for water type |
---|
671 | ! |
---|
672 | !-- Define 3D variables of type NC_BYTE |
---|
673 |   TYPE(int_3d_8bit) :: building_obstruction_f  !< input variable for building obstruction |
---|
674 |   TYPE(int_3d_8bit) :: building_obstruction_full !< input variable for building obstruction |
---|
675 | ! |
---|
676 | !-- Define 2D variables of type NC_INT |
---|
677 |   TYPE(int_2d_32bit) :: building_id_f   !< input variable for building ID |
---|
678 | ! |
---|
679 | !-- Define 2D variables of type NC_FLOAT |
---|
680 |   TYPE(real_2d) :: terrain_height_f    !< input variable for terrain height |
---|
681 |   TYPE(real_2d) :: uvem_irradiance_f   !< input variable for uvem irradiance lookup table |
---|
682 |   TYPE(real_2d) :: uvem_integration_f   !< input variable for uvem integration |
---|
683 | ! |
---|
684 | !-- Define 3D variables of type NC_FLOAT |
---|
685 |   TYPE(real_3d) :: basal_area_density_f  !< input variable for basal area density - resolved vegetation |
---|
686 |   TYPE(real_3d) :: leaf_area_density_f   !< input variable for leaf area density - resolved vegetation |
---|
687 |   TYPE(real_3d) :: root_area_density_lad_f !< input variable for root area density - resolved vegetation |
---|
688 |   TYPE(real_3d) :: root_area_density_lsm_f !< input variable for root area density - parametrized vegetation |
---|
689 |   TYPE(real_3d) :: uvem_radiance_f     !< input variable for uvem radiance lookup table |
---|
690 |   TYPE(real_3d) :: uvem_projarea_f     !< input variable for uvem projection area lookup table |
---|
691 | ! |
---|
692 | !-- Define input variable for buildings |
---|
693 |   TYPE(build_in) :: buildings_f      !< input variable for buildings |
---|
694 | ! |
---|
695 | !-- Define input variables for soil_type |
---|
696 |   TYPE(soil_in) :: soil_type_f      !< input variable for soil type |
---|
697 | |
---|
698 |   TYPE(fracs) :: surface_fraction_f    !< input variable for surface fraction |
---|
699 | |
---|
700 |   TYPE(pars) :: albedo_pars_f       !< input variable for albedo parameters |
---|
701 |   TYPE(pars) :: building_pars_f      !< input variable for building parameters |
---|
702 |   TYPE(pars) :: pavement_pars_f      !< input variable for pavement parameters |
---|
703 |   TYPE(pars) :: pavement_subsurface_pars_f !< input variable for pavement parameters |
---|
704 |   TYPE(pars) :: soil_pars_f        !< input variable for soil parameters |
---|
705 |   TYPE(pars) :: vegetation_pars_f     !< input variable for vegetation parameters |
---|
706 |   TYPE(pars) :: water_pars_f        !< input variable for water parameters |
---|
707 | |
---|
708 |   TYPE(chem_emis_att_type)               :: chem_emis_att  !< Input Information of Chemistry Emission Data from netcdf |
---|
709 |   TYPE(chem_emis_val_type), ALLOCATABLE, DIMENSION(:) :: chem_emis    !< Input Chemistry Emission Data from netcdf |
---|
710 | |
---|
711 |   CHARACTER(LEN=3) :: char_lod = 'lod'     !< name of level-of-detail attribute in NetCDF file |
---|
712 | |
---|
713 |   CHARACTER(LEN=10) :: char_fill = '_FillValue'    !< name of fill value attribute in NetCDF file |
---|
714 | |
---|
715 |   CHARACTER(LEN=100) :: input_file_static = 'PIDS_STATIC' !< Name of file which comprises static input data |
---|
716 |   CHARACTER(LEN=100) :: input_file_dynamic = 'PIDS_DYNAMIC' !< Name of file which comprises dynamic input data |
---|
717 |   CHARACTER(LEN=100) :: input_file_chem  = 'PIDS_CHEM'  !< Name of file which comprises chemistry input data |
---|
718 |   CHARACTER(LEN=100) :: input_file_uvem  = 'PIDS_UVEM'  !< Name of file which comprises static uv_exposure model input data |
---|
719 |   CHARACTER(LEN=100) :: input_file_vm   = 'PIDS_VM'   !< Name of file which comprises virtual measurement data |
---|
720 | |
---|
721 |   CHARACTER (LEN=25), ALLOCATABLE, DIMENSION(:)  :: string_values !< output of string variables read from netcdf input files |
---|
722 | |
---|
723 |   INTEGER(iwp)                   :: id_emis    !< NetCDF id of input file for chemistry emissions: TBD: It has to be removed |
---|
724 | |
---|
725 |   INTEGER(iwp) :: nc_stat     !< return value of nf90 function call |
---|
726 | |
---|
727 |   LOGICAL :: input_pids_static = .FALSE.  !< Flag indicating whether Palm-input-data-standard file containing static information exists |
---|
728 |   LOGICAL :: input_pids_dynamic = .FALSE.  !< Flag indicating whether Palm-input-data-standard file containing dynamic information exists |
---|
729 |   LOGICAL :: input_pids_chem  = .FALSE.  !< Flag indicating whether Palm-input-data-standard file containing chemistry information exists |
---|
730 |   LOGICAL :: input_pids_uvem  = .FALSE.  !< Flag indicating whether uv-expoure-model input file containing static information exists |
---|
731 |   LOGICAL :: input_pids_vm   = .FALSE.  !< Flag indicating whether input file for virtual measurements exist |
---|
732 | |
---|
733 |   LOGICAL :: collective_read = .FALSE.   !< Enable NetCDF collective read |
---|
734 | |
---|
735 |   TYPE(global_atts_type) :: input_file_atts !< global attributes of input file |
---|
736 | |
---|
737 | Â Â SAVE |
---|
738 | |
---|
739 | Â Â PRIVATE |
---|
740 | |
---|
741 | Â Â INTERFACE netcdf_data_input_interpolate |
---|
742 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_interpolate_1d |
---|
743 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_interpolate_1d_soil |
---|
744 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_interpolate_2d |
---|
745 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_interpolate_3d |
---|
746 | Â Â END INTERFACE netcdf_data_input_interpolate |
---|
747 | |
---|
748 | Â Â INTERFACE netcdf_data_input_check_dynamic |
---|
749 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_check_dynamic |
---|
750 | Â Â END INTERFACE netcdf_data_input_check_dynamic |
---|
751 | |
---|
752 | Â Â INTERFACE netcdf_data_input_check_static |
---|
753 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_check_static |
---|
754 | Â Â END INTERFACE netcdf_data_input_check_static |
---|
755 | |
---|
756 |   INTERFACE netcdf_data_input_chemistry_data            |
---|
757 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_chemistry_data |
---|
758 | Â Â END INTERFACE netcdf_data_input_chemistry_data |
---|
759 | Â Â |
---|
760 |   INTERFACE netcdf_data_input_get_dimension_length            |
---|
761 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_get_dimension_length |
---|
762 | Â Â END INTERFACE netcdf_data_input_get_dimension_length |
---|
763 | |
---|
764 | Â Â INTERFACE netcdf_data_input_inquire_file |
---|
765 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_inquire_file |
---|
766 | Â Â END INTERFACE netcdf_data_input_inquire_file |
---|
767 | |
---|
768 | Â Â INTERFACE netcdf_data_input_init |
---|
769 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_init |
---|
770 | Â Â END INTERFACE netcdf_data_input_init |
---|
771 | Â Â |
---|
772 | Â Â INTERFACE netcdf_data_input_att |
---|
773 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_att_int |
---|
774 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_att_real |
---|
775 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_att_string |
---|
776 | Â Â END INTERFACE netcdf_data_input_att |
---|
777 | |
---|
778 | Â Â INTERFACE netcdf_data_input_init_3d |
---|
779 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_init_3d |
---|
780 | Â Â END INTERFACE netcdf_data_input_init_3d |
---|
781 | Â Â |
---|
782 | Â Â INTERFACE netcdf_data_input_init_lsm |
---|
783 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_init_lsm |
---|
784 | Â Â END INTERFACE netcdf_data_input_init_lsm |
---|
785 | |
---|
786 | Â Â INTERFACE netcdf_data_input_offline_nesting |
---|
787 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_offline_nesting |
---|
788 | Â Â END INTERFACE netcdf_data_input_offline_nesting |
---|
789 | |
---|
790 | Â Â INTERFACE netcdf_data_input_surface_data |
---|
791 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_surface_data |
---|
792 | Â Â END INTERFACE netcdf_data_input_surface_data |
---|
793 | |
---|
794 | Â Â INTERFACE netcdf_data_input_var |
---|
795 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_var_char |
---|
796 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_var_real_1d |
---|
797 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_var_real_2d |
---|
798 | Â Â END INTERFACE netcdf_data_input_var |
---|
799 | |
---|
800 | Â Â INTERFACE netcdf_data_input_uvem |
---|
801 | Â Â Â Â MODULE PROCEDUREÂ netcdf_data_input_uvem |
---|
802 | Â Â END INTERFACE netcdf_data_input_uvem |
---|
803 | |
---|
804 | Â Â INTERFACE get_variable |
---|
805 | Â Â Â Â MODULE PROCEDUREÂ get_variable_1d_char |
---|
806 | Â Â Â Â MODULE PROCEDUREÂ get_variable_1d_int |
---|
807 | Â Â Â Â MODULE PROCEDUREÂ get_variable_1d_real |
---|
808 | Â Â Â Â MODULE PROCEDUREÂ get_variable_2d_int8 |
---|
809 | Â Â Â Â MODULE PROCEDUREÂ get_variable_2d_int32 |
---|
810 | Â Â Â Â MODULE PROCEDUREÂ get_variable_2d_real |
---|
811 | Â Â Â Â MODULE PROCEDUREÂ get_variable_3d_int8 |
---|
812 | Â Â Â Â MODULE PROCEDUREÂ get_variable_3d_real |
---|
813 | Â Â Â Â MODULE PROCEDUREÂ get_variable_3d_real_dynamic |
---|
814 | Â Â Â Â MODULE PROCEDUREÂ get_variable_4d_to_3d_real |
---|
815 | Â Â Â Â MODULE PROCEDUREÂ get_variable_4d_real |
---|
816 | Â Â Â Â MODULE PROCEDUREÂ get_variable_5d_to_4d_real |
---|
817 |     MODULE PROCEDURE get_variable_string    |
---|
818 | Â Â END INTERFACE get_variable |
---|
819 | |
---|
820 | Â Â INTERFACE get_variable_pr |
---|
821 | Â Â Â Â MODULE PROCEDUREÂ get_variable_pr |
---|
822 | Â Â END INTERFACE get_variable_pr |
---|
823 | |
---|
824 | Â Â INTERFACE get_attribute |
---|
825 | Â Â Â Â MODULE PROCEDUREÂ get_attribute_real |
---|
826 | Â Â Â Â MODULE PROCEDUREÂ get_attribute_int8 |
---|
827 | Â Â Â Â MODULE PROCEDUREÂ get_attribute_int32 |
---|
828 | Â Â Â Â MODULE PROCEDUREÂ get_attribute_string |
---|
829 | Â Â END INTERFACE get_attribute |
---|
830 | |
---|
831 | ! |
---|
832 | !-- Public variables |
---|
833 |   PUBLIC albedo_pars_f, albedo_type_f, basal_area_density_f, buildings_f,  & |
---|
834 |       building_id_f, building_pars_f, building_type_f,          & |
---|
835 |       chem_emis, chem_emis_att, chem_emis_att_type, chem_emis_val_type,  & |
---|
836 |       coord_ref_sys,                           & |
---|
837 |       init_3d, init_model, input_file_atts, input_file_static,      & |
---|
838 |       input_pids_static,                         & |
---|
839 |       input_pids_dynamic, input_pids_vm, input_file_vm,          & |
---|
840 |       leaf_area_density_f, nest_offl,                   & |
---|
841 |       pavement_pars_f, pavement_subsurface_pars_f, pavement_type_f,    & |
---|
842 |       root_area_density_lad_f, root_area_density_lsm_f, soil_pars_f,   & |
---|
843 |       soil_type_f, street_crossing_f, street_type_f, surface_fraction_f, & |
---|
844 |       terrain_height_f, vegetation_pars_f, vegetation_type_f,       & |
---|
845 |       water_pars_f, water_type_f |
---|
846 | ! |
---|
847 | !-- Public uv exposure variables |
---|
848 |   PUBLIC building_obstruction_f, input_file_uvem, input_pids_uvem,      & |
---|
849 |       netcdf_data_input_uvem,                       & |
---|
850 |       uvem_integration_f, uvem_irradiance_f,               & |
---|
851 |       uvem_projarea_f, uvem_radiance_f |
---|
852 | |
---|
853 | ! |
---|
854 | !-- Public subroutines |
---|
855 |   PUBLIC netcdf_data_input_check_dynamic, netcdf_data_input_check_static,  & |
---|
856 |       netcdf_data_input_chemistry_data,                  & |
---|
857 |       netcdf_data_input_get_dimension_length,               & |
---|
858 |       netcdf_data_input_inquire_file,                   & |
---|
859 |       netcdf_data_input_init, netcdf_data_input_init_lsm,         & |
---|
860 |       netcdf_data_input_init_3d, netcdf_data_input_att,          & |
---|
861 |       netcdf_data_input_interpolate, netcdf_data_input_offline_nesting,  & |
---|
862 |       netcdf_data_input_surface_data, netcdf_data_input_topo,       & |
---|
863 |       netcdf_data_input_var, get_attribute, get_variable, open_read_file |
---|
864 | |
---|
865 | |
---|
866 | Â CONTAINS |
---|
867 | |
---|
868 | !------------------------------------------------------------------------------! |
---|
869 | ! Description: |
---|
870 | ! ------------ |
---|
871 | !> Inquires whether NetCDF input files according to Palm-input-data standard |
---|
872 | !> exist. Moreover, basic checks are performed. |
---|
873 | !------------------------------------------------------------------------------! |
---|
874 | Â Â SUBROUTINE netcdf_data_input_inquire_file |
---|
875 | |
---|
876 |     USE control_parameters,                         & |
---|
877 | Â Â Â Â Â Â ONLY:Â topo_no_distinct |
---|
878 | |
---|
879 | Â Â Â Â IMPLICIT NONE |
---|
880 | |
---|
881 | #if defined ( __netcdf ) |
---|
882 |     INQUIRE( FILE = TRIM( input_file_static )  // TRIM( coupling_char ),  & |
---|
883 |         EXIST = input_pids_static ) |
---|
884 |     INQUIRE( FILE = TRIM( input_file_dynamic ) // TRIM( coupling_char ),  & |
---|
885 |         EXIST = input_pids_dynamic ) |
---|
886 |     INQUIRE( FILE = TRIM( input_file_chem )  // TRIM( coupling_char ),  & |
---|
887 |         EXIST = input_pids_chem ) |
---|
888 |     INQUIRE( FILE = TRIM( input_file_uvem ) // TRIM( coupling_char ),    & |
---|
889 |         EXIST = input_pids_uvem ) |
---|
890 |     INQUIRE( FILE = TRIM( input_file_vm )   // TRIM( coupling_char ),  & |
---|
891 |         EXIST = input_pids_vm ) |
---|
892 | #endif |
---|
893 | |
---|
894 | ! |
---|
895 | !--Â Â As long as topography can be input via ASCII format, no distinction |
---|
896 | !--Â Â between building and terrain can be made. This case, classify all |
---|
897 | !--Â Â surfaces as default type. Same in case land-surface and urban-surface |
---|
898 | !--Â Â model are not applied. |
---|
899 |     IF ( .NOT. input_pids_static ) THEN |
---|
900 |      topo_no_distinct = .TRUE. |
---|
901 | Â Â Â Â ENDIF |
---|
902 | |
---|
903 | Â Â END SUBROUTINE netcdf_data_input_inquire_file |
---|
904 | |
---|
905 | !------------------------------------------------------------------------------! |
---|
906 | ! Description: |
---|
907 | ! ------------ |
---|
908 | !> Reads global attributes and coordinate reference system required for |
---|
909 | !> initialization of the model. |
---|
910 | !------------------------------------------------------------------------------! |
---|
911 | Â Â SUBROUTINE netcdf_data_input_init |
---|
912 | |
---|
913 | Â Â Â Â IMPLICIT NONE |
---|
914 | |
---|
915 |     INTEGER(iwp) :: id_mod   !< NetCDF id of input file |
---|
916 |     INTEGER(iwp) :: var_id_crs !< NetCDF id of variable crs |
---|
917 | |
---|
918 |     IF ( .NOT. input_pids_static ) RETURN |
---|
919 | |
---|
920 | #if defined ( __netcdf ) |
---|
921 | ! |
---|
922 | !--Â Â Open file in read-only mode |
---|
923 |     CALL open_read_file( TRIM( input_file_static ) //            & |
---|
924 |               TRIM( coupling_char ), id_mod ) |
---|
925 | ! |
---|
926 | !--Â Â Read global attributes |
---|
927 |     CALL get_attribute( id_mod, input_file_atts%origin_lat_char,      & |
---|
928 |               input_file_atts%origin_lat, .TRUE. ) |
---|
929 | |
---|
930 |     CALL get_attribute( id_mod, input_file_atts%origin_lon_char,      & |
---|
931 |               input_file_atts%origin_lon, .TRUE. ) |
---|
932 | |
---|
933 |     CALL get_attribute( id_mod, input_file_atts%origin_time_char,      & |
---|
934 |               input_file_atts%origin_time, .TRUE. ) |
---|
935 | |
---|
936 |     CALL get_attribute( id_mod, input_file_atts%origin_x_char,       & |
---|
937 |               input_file_atts%origin_x, .TRUE. ) |
---|
938 | |
---|
939 |     CALL get_attribute( id_mod, input_file_atts%origin_y_char,       & |
---|
940 |               input_file_atts%origin_y, .TRUE. ) |
---|
941 | |
---|
942 |     CALL get_attribute( id_mod, input_file_atts%origin_z_char,       & |
---|
943 |               input_file_atts%origin_z, .TRUE. ) |
---|
944 | |
---|
945 |     CALL get_attribute( id_mod, input_file_atts%rotation_angle_char,    & |
---|
946 |               input_file_atts%rotation_angle, .TRUE. ) |
---|
947 | |
---|
948 |     CALL get_attribute( id_mod, input_file_atts%author_char,        & |
---|
949 |               input_file_atts%author, .TRUE., no_abort=.FALSE. ) |
---|
950 |     CALL get_attribute( id_mod, input_file_atts%contact_person_char,    & |
---|
951 |               input_file_atts%contact_person, .TRUE., no_abort=.FALSE. ) |
---|
952 |     CALL get_attribute( id_mod, input_file_atts%institution_char,      & |
---|
953 |               input_file_atts%institution,  .TRUE., no_abort=.FALSE. ) |
---|
954 |     CALL get_attribute( id_mod, input_file_atts%acronym_char,        & |
---|
955 |               input_file_atts%acronym,    .TRUE., no_abort=.FALSE. ) |
---|
956 | |
---|
957 |     CALL get_attribute( id_mod, input_file_atts%campaign_char,       & |
---|
958 |               input_file_atts%campaign, .TRUE., no_abort=.FALSE. ) |
---|
959 |     CALL get_attribute( id_mod, input_file_atts%location_char,       & |
---|
960 |               input_file_atts%location, .TRUE., no_abort=.FALSE. ) |
---|
961 |     CALL get_attribute( id_mod, input_file_atts%site_char,         & |
---|
962 |               input_file_atts%site,   .TRUE., no_abort=.FALSE. ) |
---|
963 | |
---|
964 |     CALL get_attribute( id_mod, input_file_atts%source_char,        & |
---|
965 |               input_file_atts%source,   .TRUE., no_abort=.FALSE. ) |
---|
966 |     CALL get_attribute( id_mod, input_file_atts%references_char,      & |
---|
967 |               input_file_atts%references, .TRUE., no_abort=.FALSE. ) |
---|
968 |     CALL get_attribute( id_mod, input_file_atts%keywords_char,       & |
---|
969 |               input_file_atts%keywords,  .TRUE., no_abort=.FALSE. ) |
---|
970 |     CALL get_attribute( id_mod, input_file_atts%licence_char,        & |
---|
971 |               input_file_atts%licence,  .TRUE., no_abort=.FALSE. ) |
---|
972 |     CALL get_attribute( id_mod, input_file_atts%comment_char,        & |
---|
973 |               input_file_atts%comment,  .TRUE., no_abort=.FALSE. ) |
---|
974 | ! |
---|
975 | !--Â Â Read coordinate reference system if available |
---|
976 |     nc_stat = NF90_INQ_VARID( id_mod, 'crs', var_id_crs ) |
---|
977 |     IF ( nc_stat == NF90_NOERR ) THEN |
---|
978 |      CALL get_attribute( id_mod, 'epsg_code',               & |
---|
979 |                coord_ref_sys%epsg_code,             & |
---|
980 |                .FALSE., 'crs' ) |
---|
981 |      CALL get_attribute( id_mod, 'false_easting',             & |
---|
982 |                coord_ref_sys%false_easting,           & |
---|
983 |                .FALSE., 'crs' ) |
---|
984 |      CALL get_attribute( id_mod, 'false_northing',            & |
---|
985 |                coord_ref_sys%false_northing,          & |
---|
986 |                .FALSE., 'crs' ) |
---|
987 |      CALL get_attribute( id_mod, 'grid_mapping_name',           & |
---|
988 |                coord_ref_sys%grid_mapping_name,         & |
---|
989 |                .FALSE., 'crs' ) |
---|
990 |      CALL get_attribute( id_mod, 'inverse_flattening',          & |
---|
991 |                coord_ref_sys%inverse_flattening,        & |
---|
992 |                .FALSE., 'crs' ) |
---|
993 |      CALL get_attribute( id_mod, 'latitude_of_projection_origin',     & |
---|
994 |                coord_ref_sys%latitude_of_projection_origin,   & |
---|
995 |                .FALSE., 'crs' ) |
---|
996 |      CALL get_attribute( id_mod, 'long_name',               & |
---|
997 |                coord_ref_sys%long_name,             & |
---|
998 |                .FALSE., 'crs' ) |
---|
999 |      CALL get_attribute( id_mod, 'longitude_of_central_meridian',     & |
---|
1000 |                coord_ref_sys%longitude_of_central_meridian,   & |
---|
1001 |                .FALSE., 'crs' ) |
---|
1002 |      CALL get_attribute( id_mod, 'longitude_of_prime_meridian',      & |
---|
1003 |                coord_ref_sys%longitude_of_prime_meridian,    & |
---|
1004 |                .FALSE., 'crs' ) |
---|
1005 |      CALL get_attribute( id_mod, 'scale_factor_at_central_meridian',   & |
---|
1006 |                coord_ref_sys%scale_factor_at_central_meridian, & |
---|
1007 |                .FALSE., 'crs' ) |
---|
1008 |      CALL get_attribute( id_mod, 'semi_major_axis',            & |
---|
1009 |                coord_ref_sys%semi_major_axis,          & |
---|
1010 |                .FALSE., 'crs' ) |
---|
1011 |      CALL get_attribute( id_mod, 'units',                 & |
---|
1012 |                coord_ref_sys%units,               & |
---|
1013 |                .FALSE., 'crs' ) |
---|
1014 | Â Â Â Â ELSE |
---|
1015 | ! |
---|
1016 | !--Â Â Â Â Calculate central meridian from origin_lon |
---|
1017 |      coord_ref_sys%longitude_of_central_meridian = & |
---|
1018 |        CEILING( input_file_atts%origin_lon / 6.0_wp ) * 6.0_wp - 3.0_wp |
---|
1019 | Â Â Â Â ENDIF |
---|
1020 | ! |
---|
1021 | !--Â Â Finally, close input file |
---|
1022 |     CALL close_input_file( id_mod ) |
---|
1023 | #endif |
---|
1024 | ! |
---|
1025 | !--Â Â Copy latitude, longitude, origin_z, rotation angle on init type |
---|
1026 |     init_model%latitude    = input_file_atts%origin_lat |
---|
1027 |     init_model%longitude    = input_file_atts%origin_lon |
---|
1028 |     init_model%origin_time   = input_file_atts%origin_time |
---|
1029 |     init_model%origin_x    = input_file_atts%origin_x |
---|
1030 |     init_model%origin_y    = input_file_atts%origin_y |
---|
1031 |     init_model%origin_z    = input_file_atts%origin_z |
---|
1032 |     init_model%rotation_angle = input_file_atts%rotation_angle |
---|
1033 | Â Â Â Â Â Â |
---|
1034 | ! |
---|
1035 | !--Â Â In case of nested runs, each model domain might have different longitude |
---|
1036 | !--Â Â and latitude, which would result in different Coriolis parameters and |
---|
1037 | !--Â Â sun-zenith angles. To avoid this, longitude and latitude in each model |
---|
1038 | !--Â Â domain will be set to the values of the root model. Please note, this |
---|
1039 | !--Â Â synchronization is required already here. |
---|
1040 | #if defined( __parallel ) |
---|
1041 |     CALL MPI_BCAST( init_model%latitude, 1, MPI_REAL, 0,          & |
---|
1042 |             MPI_COMM_WORLD, ierr ) |
---|
1043 |     CALL MPI_BCAST( init_model%longitude, 1, MPI_REAL, 0,          & |
---|
1044 |             MPI_COMM_WORLD, ierr ) |
---|
1045 | #endif |
---|
1046 | |
---|
1047 | Â Â END SUBROUTINE netcdf_data_input_init |
---|
1048 | Â Â |
---|
1049 | !------------------------------------------------------------------------------! |
---|
1050 | ! Description: |
---|
1051 | ! ------------ |
---|
1052 | !> Read an array of characters. |
---|
1053 | !------------------------------------------------------------------------------! |
---|
1054 |   SUBROUTINE netcdf_data_input_var_char( val, search_string, id_mod ) |
---|
1055 | |
---|
1056 | Â Â Â Â IMPLICIT NONE |
---|
1057 | |
---|
1058 |     CHARACTER(LEN=*) :: search_string   !< name of the variable |
---|
1059 |     CHARACTER(LEN=*), DIMENSION(:) :: val !< variable which should be read |
---|
1060 | Â Â Â Â |
---|
1061 |     INTEGER(iwp) :: id_mod  !< NetCDF id of input file |
---|
1062 | |
---|
1063 | #if defined ( __netcdf ) |
---|
1064 | ! |
---|
1065 | !--Â Â Read variable |
---|
1066 |     CALL get_variable( id_mod, search_string, val ) |
---|
1067 | #endif      |
---|
1068 | |
---|
1069 | Â Â END SUBROUTINE netcdf_data_input_var_char |
---|
1070 | Â Â |
---|
1071 | !------------------------------------------------------------------------------! |
---|
1072 | ! Description: |
---|
1073 | ! ------------ |
---|
1074 | !> Read an 1D array of REAL values. |
---|
1075 | !------------------------------------------------------------------------------! |
---|
1076 |   SUBROUTINE netcdf_data_input_var_real_1d( val, search_string, id_mod ) |
---|
1077 | |
---|
1078 | Â Â Â Â IMPLICIT NONE |
---|
1079 | |
---|
1080 |     CHARACTER(LEN=*) :: search_string   !< name of the variable   |
---|
1081 | Â Â Â Â |
---|
1082 |     INTEGER(iwp) :: id_mod    !< NetCDF id of input file |
---|
1083 | Â Â Â Â |
---|
1084 |     REAL(wp), DIMENSION(:) :: val !< variable which should be read |
---|
1085 | |
---|
1086 | #if defined ( __netcdf ) |
---|
1087 | ! |
---|
1088 | !--Â Â Read variable |
---|
1089 |     CALL get_variable( id_mod, search_string, val ) |
---|
1090 | #endif      |
---|
1091 | |
---|
1092 | Â Â END SUBROUTINE netcdf_data_input_var_real_1d |
---|
1093 | Â Â |
---|
1094 | !------------------------------------------------------------------------------! |
---|
1095 | ! Description: |
---|
1096 | ! ------------ |
---|
1097 | !> Read an 1D array of REAL values. |
---|
1098 | !------------------------------------------------------------------------------! |
---|
1099 |   SUBROUTINE netcdf_data_input_var_real_2d( val, search_string,       & |
---|
1100 |                        id_mod, d1s, d1e, d2s, d2e ) |
---|
1101 | |
---|
1102 | Â Â Â Â IMPLICIT NONE |
---|
1103 | |
---|
1104 |     CHARACTER(LEN=*) :: search_string   !< name of the variable   |
---|
1105 | Â Â Â Â |
---|
1106 |     INTEGER(iwp) :: id_mod !< NetCDF id of input file |
---|
1107 |     INTEGER(iwp) :: d1e   !< end index of first dimension to be read |
---|
1108 |     INTEGER(iwp) :: d2e   !< end index of second dimension to be read |
---|
1109 |     INTEGER(iwp) :: d1s   !< start index of first dimension to be read |
---|
1110 |     INTEGER(iwp) :: d2s   !< start index of second dimension to be read |
---|
1111 | Â Â Â Â |
---|
1112 |     REAL(wp), DIMENSION(:,:) :: val !< variable which should be read |
---|
1113 | |
---|
1114 | #if defined ( __netcdf ) |
---|
1115 | ! |
---|
1116 | !--Â Â Read character variable |
---|
1117 |     CALL get_variable( id_mod, search_string, val, d1s, d1e, d2s, d2e ) |
---|
1118 | #endif      |
---|
1119 | |
---|
1120 | Â Â END SUBROUTINE netcdf_data_input_var_real_2d |
---|
1121 | Â Â |
---|
1122 | !------------------------------------------------------------------------------! |
---|
1123 | ! Description: |
---|
1124 | ! ------------ |
---|
1125 | !> Read a global string attribute |
---|
1126 | !------------------------------------------------------------------------------! |
---|
1127 |   SUBROUTINE netcdf_data_input_att_string( val, search_string, id_mod,    & |
---|
1128 |                        input_file, global, openclose,  & |
---|
1129 |                        variable_name ) |
---|
1130 | |
---|
1131 | Â Â Â Â IMPLICIT NONE |
---|
1132 | |
---|
1133 |     CHARACTER(LEN=*) :: search_string !< name of the attribue |
---|
1134 |     CHARACTER(LEN=*) :: val      !< attribute |
---|
1135 | Â Â Â Â |
---|
1136 |     CHARACTER(LEN=*) :: input_file  !< name of input file |
---|
1137 |     CHARACTER(LEN=*) :: openclose   !< string indicating whether NetCDF needs to be opend or closed |
---|
1138 |     CHARACTER(LEN=*) :: variable_name !< string indicating whether NetCDF needs to be opend or closed |
---|
1139 | Â Â Â Â |
---|
1140 |     INTEGER(iwp) :: id_mod  !< NetCDF id of input file |
---|
1141 | Â Â Â Â |
---|
1142 |     LOGICAL :: global         !< flag indicating a global or a variable's attribute |
---|
1143 | |
---|
1144 | #if defined ( __netcdf ) |
---|
1145 | ! |
---|
1146 | !--Â Â Open file in read-only mode if necessary |
---|
1147 |     IF ( openclose == 'open' ) THEN |
---|
1148 |      CALL open_read_file( TRIM( input_file ) // TRIM( coupling_char ), & |
---|
1149 |                  id_mod ) |
---|
1150 | Â Â Â Â ENDIF |
---|
1151 | ! |
---|
1152 | !--Â Â Read global attribute |
---|
1153 |     IF ( global ) THEN |
---|
1154 |      CALL get_attribute( id_mod, search_string, val, global ) |
---|
1155 | ! |
---|
1156 | !--Â Â Read variable attribute |
---|
1157 | Â Â Â Â ELSE |
---|
1158 |      CALL get_attribute( id_mod, search_string, val, global, variable_name ) |
---|
1159 | Â Â Â Â ENDIF |
---|
1160 | ! |
---|
1161 | !--Â Â Close input file |
---|
1162 |     IF ( openclose == 'close' ) CALL close_input_file( id_mod ) |
---|
1163 | #endif      |
---|
1164 | |
---|
1165 | Â Â END SUBROUTINE netcdf_data_input_att_string |
---|
1166 | Â Â |
---|
1167 | !------------------------------------------------------------------------------! |
---|
1168 | ! Description: |
---|
1169 | ! ------------ |
---|
1170 | !> Read a global integer attribute |
---|
1171 | !------------------------------------------------------------------------------! |
---|
1172 |   SUBROUTINE netcdf_data_input_att_int( val, search_string, id_mod,     & |
---|
1173 |                      input_file, global, openclose,    & |
---|
1174 |                      variable_name ) |
---|
1175 | |
---|
1176 | Â Â Â Â IMPLICIT NONE |
---|
1177 | |
---|
1178 |     CHARACTER(LEN=*) :: search_string !< name of the attribue |
---|
1179 | Â Â Â Â |
---|
1180 |     CHARACTER(LEN=*) :: input_file  !< name of input file |
---|
1181 |     CHARACTER(LEN=*) :: openclose   !< string indicating whether NetCDF needs to be opend or closed |
---|
1182 |     CHARACTER(LEN=*) :: variable_name !< string indicating whether NetCDF needs to be opend or closed |
---|
1183 | Â Â Â Â |
---|
1184 |     INTEGER(iwp) :: id_mod  !< NetCDF id of input file |
---|
1185 |     INTEGER(iwp) :: val   !< value of the attribute |
---|
1186 | Â Â Â Â |
---|
1187 |     LOGICAL :: global    !< flag indicating a global or a variable's attribute |
---|
1188 | |
---|
1189 | #if defined ( __netcdf ) |
---|
1190 | ! |
---|
1191 | !--Â Â Open file in read-only mode |
---|
1192 |     IF ( openclose == 'open' ) THEN |
---|
1193 |      CALL open_read_file( TRIM( input_file ) // TRIM( coupling_char ), & |
---|
1194 |                  id_mod ) |
---|
1195 | Â Â Â Â ENDIF |
---|
1196 | ! |
---|
1197 | !--Â Â Read global attribute |
---|
1198 |     IF ( global ) THEN |
---|
1199 |      CALL get_attribute( id_mod, search_string, val, global ) |
---|
1200 | ! |
---|
1201 | !--Â Â Read variable attribute |
---|
1202 | Â Â Â Â ELSE |
---|
1203 |      CALL get_attribute( id_mod, search_string, val, global, variable_name ) |
---|
1204 | Â Â Â Â ENDIF |
---|
1205 | ! |
---|
1206 | !--Â Â Finally, close input file |
---|
1207 |     IF ( openclose == 'close' ) CALL close_input_file( id_mod ) |
---|
1208 | #endif      |
---|
1209 | |
---|
1210 | Â Â END SUBROUTINE netcdf_data_input_att_int |
---|
1211 | Â Â |
---|
1212 | !------------------------------------------------------------------------------! |
---|
1213 | ! Description: |
---|
1214 | ! ------------ |
---|
1215 | !> Read a global real attribute |
---|
1216 | !------------------------------------------------------------------------------! |
---|
1217 |   SUBROUTINE netcdf_data_input_att_real( val, search_string, id_mod,     & |
---|
1218 |                       input_file, global, openclose,   & |
---|
1219 |                       variable_name ) |
---|
1220 | |
---|
1221 | Â Â Â Â IMPLICIT NONE |
---|
1222 | |
---|
1223 |     CHARACTER(LEN=*) :: search_string !< name of the attribue |
---|
1224 | Â Â Â Â |
---|
1225 |     CHARACTER(LEN=*) :: input_file  !< name of input file |
---|
1226 |     CHARACTER(LEN=*) :: openclose   !< string indicating whether NetCDF needs to be opend or closed |
---|
1227 |     CHARACTER(LEN=*) :: variable_name !< string indicating whether NetCDF needs to be opend or closed |
---|
1228 | Â Â Â Â |
---|
1229 |     INTEGER(iwp) :: id_mod      !< NetCDF id of input file |
---|
1230 | Â Â Â Â |
---|
1231 |     LOGICAL :: global         !< flag indicating a global or a variable's attribute |
---|
1232 | Â Â Â Â |
---|
1233 |     REAL(wp) :: val          !< value of the attribute |
---|
1234 | |
---|
1235 | #if defined ( __netcdf ) |
---|
1236 | ! |
---|
1237 | !--Â Â Open file in read-only mode |
---|
1238 |     IF ( openclose == 'open' ) THEN |
---|
1239 |      CALL open_read_file( TRIM( input_file ) // TRIM( coupling_char ), & |
---|
1240 |                  id_mod ) |
---|
1241 | Â Â Â Â ENDIF |
---|
1242 | ! |
---|
1243 | !--Â Â Read global attribute |
---|
1244 |     IF ( global ) THEN |
---|
1245 |      CALL get_attribute( id_mod, search_string, val, global ) |
---|
1246 | ! |
---|
1247 | !--Â Â Read variable attribute |
---|
1248 | Â Â Â Â ELSE |
---|
1249 |      CALL get_attribute( id_mod, search_string, val, global, variable_name ) |
---|
1250 | Â Â Â Â ENDIF |
---|
1251 | ! |
---|
1252 | !--Â Â Finally, close input file |
---|
1253 |     IF ( openclose == 'close' ) CALL close_input_file( id_mod ) |
---|
1254 | #endif      |
---|
1255 | |
---|
1256 | Â Â END SUBROUTINE netcdf_data_input_att_real |
---|
1257 | |
---|
1258 | !------------------------------------------------------------------------------! |
---|
1259 | ! Description: |
---|
1260 | ! ------------ |
---|
1261 | !> Reads Chemistry NETCDF Input data, such as emission values, emission species, etc. . |
---|
1262 | !------------------------------------------------------------------------------! |
---|
1263 | Â Â SUBROUTINE netcdf_data_input_chemistry_data(emt_att,emt) |
---|
1264 | |
---|
1265 |     USE chem_modules,                    & |
---|
1266 |       ONLY: do_emis, mode_emis, time_fac_type,      & |
---|
1267 |          surface_csflux_name |
---|
1268 | |
---|
1269 |     USE control_parameters,                 & |
---|
1270 | Â Â Â Â Â Â ONLY:Â message_string |
---|
1271 | |
---|
1272 |     USE indices,                      & |
---|
1273 |       ONLY: nz, nx, ny, nxl, nxr, nys, nyn, nzb, nzt |
---|
1274 | |
---|
1275 | Â Â Â Â IMPLICIT NONE |
---|
1276 | |
---|
1277 |     TYPE(chem_emis_att_type), INTENT(INOUT)                    :: emt_att |
---|
1278 |     TYPE(chem_emis_val_type), ALLOCATABLE, DIMENSION(:), INTENT(INOUT)       :: emt |
---|
1279 | Â Â |
---|
1280 | Â Â Â Â CHARACTERÂ (LEN=80)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â units=''Â Â Â Â Â Â Â !< units of chemistry inputs |
---|
1281 | Â |
---|
1282 |     INTEGER(iwp)                   :: ispec         !< index for number of emission species in input |
---|
1283 | |
---|
1284 |     INTEGER(iwp), ALLOCATABLE, DIMENSION(:)     :: dum_var        !< value of variable read from netcdf input |
---|
1285 |     INTEGER(iwp)                   :: errno         !< error number NF90_???? function |
---|
1286 |     INTEGER(iwp)                   :: id_var        !< variable id |
---|
1287 | !    INTEGER(iwp)                   :: id_emis        !< NetCDF id of input file |
---|
1288 |     INTEGER(iwp)                   :: num_vars       !< number of variables in netcdf input file |
---|
1289 | Â Â Â Â INTEGER(iwp)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â len_dims,len_dims_2Â Â !< Length of dimensions |
---|
1290 | |
---|
1291 | Â Â Â Â INTEGER(iwp)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ::Â max_string_length=25Â !< Variable for the maximum length of a string |
---|
1292 | Â |
---|
1293 |     CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE  :: var_names       !< Name of Variables |
---|
1294 | |
---|
1295 |     REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)     :: dum_var_3d      !< variable for storing temporary data of 3-dimensional |
---|
1296 |                                          ! variables read from netcdf for chemistry emissions |
---|
1297 | |
---|
1298 |     REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:)    :: dum_var_4d      !< variable for storing temporary data of 5-dimensional |
---|
1299 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â !< variables read from netcdf for chemistry emissions |
---|
1300 | !-- |
---|
1301 | Â Â Â Â !> Start the processing of the data |
---|
1302 |     CALL location_message( 'starting allocation of chemistry emissions arrays', .FALSE. ) |
---|
1303 | |
---|
1304 | Â Â Â Â !> Parameterized mode of the emissions |
---|
1305 |     IF (TRIM(mode_emis)=="PARAMETERIZED" .OR. TRIM(mode_emis)=="parameterized") THEN |
---|
1306 | |
---|
1307 | Â Â Â Â Â Â ispec=1 |
---|
1308 | Â Â Â Â Â Â emt_att%nspec=0 |
---|
1309 | |
---|
1310 | Â Â Â Â Â !number of species |
---|
1311 |       DO WHILE (TRIM( surface_csflux_name( ispec ) ) /= 'novalue' ) |
---|
1312 | |
---|
1313 | Â Â Â Â Â Â Â emt_att%nspec=emt_att%nspec+1 |
---|
1314 | Â Â Â Â Â Â Â ispec=ispec+1 |
---|
1315 | |
---|
1316 | Â Â Â Â Â Â ENDDO |
---|
1317 | |
---|
1318 | Â Â Â Â Â !-- allocate emission values data type arrays |
---|
1319 | Â Â Â Â Â ALLOCATE(emt(emt_att%nspec)) |
---|
1320 | |
---|
1321 | Â Â Â Â Â !-- Read EMISSION SPECIES NAMES |
---|
1322 | |
---|
1323 | Â Â Â Â Â !Assign values |
---|
1324 | Â Â Â Â Â ALLOCATE(emt_att%species_name(emt_att%nspec)) |
---|
1325 | Â |
---|
1326 | Â Â Â Â Â DO ispec=1,emt_att%nspec |
---|
1327 | Â Â Â Â Â Â emt_att%species_name(ispec)Â =Â TRIM(surface_csflux_name(ispec)) |
---|
1328 | Â Â Â Â Â ENDDO |
---|
1329 | |
---|
1330 | |
---|
1331 | Â Â Â Â !> DEFAULT AND PRE-PROCESSED MODE |
---|
1332 | Â Â Â Â ELSE |
---|
1333 | |
---|
1334 | #if defined ( __netcdf )    |
---|
1335 |      IF ( .NOT. input_pids_chem ) RETURN |
---|
1336 | |
---|
1337 | Â Â Â Â Â !-- Open file in read-only mode |
---|
1338 |      CALL open_read_file( TRIM( input_file_chem ) //            & |
---|
1339 |                 TRIM( coupling_char ), id_emis ) |
---|
1340 | Â Â Â Â Â !-- inquire number of variables |
---|
1341 |      CALL inquire_num_variables( id_emis, num_vars ) |
---|
1342 | |
---|
1343 | Â Â Â Â Â !-- Get General Dimension Lengths: only number of species and number of categories. |
---|
1344 |      !                 the other dimensions depend on the mode of the emissions or on the presence of specific components |
---|
1345 | Â Â Â Â Â !nspecies |
---|
1346 |      CALL netcdf_data_input_get_dimension_length( id_emis, emt_att%nspec, 'nspecies' ) |
---|
1347 | |
---|
1348 | Â |
---|
1349 | Â Â Â Â Â !-- Allocate emission values data type arrays |
---|
1350 | Â Â Â Â Â ALLOCATE(emt(1:emt_att%nspec)) |
---|
1351 | |
---|
1352 | |
---|
1353 | Â Â Â Â Â !-- Read EMISSION SPECIES NAMES |
---|
1354 | Â Â Â Â Â !Allocate Arrays |
---|
1355 | Â Â Â Â Â ALLOCATE(emt_att%species_name(emt_att%nspec))Â |
---|
1356 | |
---|
1357 | Â Â Â Â Â !Call get Variable |
---|
1358 |      CALL get_variable( id_emis, 'emission_name', string_values, emt_att%nspec ) |
---|
1359 | Â Â Â Â Â emt_att%species_name=string_values |
---|
1360 | Â Â Â Â Â ! If allocated, Deallocate var_string, an array only used for reading-in strings |
---|
1361 | Â Â Â Â Â IFÂ (ALLOCATED(string_values))Â DEALLOCATE(string_values)Â |
---|
1362 | |
---|
1363 | Â Â Â Â Â !-- Read EMISSION SPECIES INDEX |
---|
1364 | Â Â Â Â Â !Allocate Arrays |
---|
1365 | Â Â Â Â Â ALLOCATE(emt_att%species_index(emt_att%nspec)) |
---|
1366 | Â Â Â Â Â !Call get Variable |
---|
1367 |      CALL get_variable( id_emis, 'emission_index', emt_att%species_index ) |
---|
1368 | |
---|
1369 | |
---|
1370 | Â Â Â Â Â !-- Now the routine has to distinguish between DEFAULT and PRE-PROCESSED chemistry emission modes |
---|
1371 | |
---|
1372 |      IF (TRIM(mode_emis)=="DEFAULT" .OR. TRIM(mode_emis)=="default") THEN |
---|
1373 | Â |
---|
1374 | Â Â Â Â Â Â Â !number of categories |
---|
1375 |        CALL netcdf_data_input_get_dimension_length( id_emis, emt_att%ncat, 'ncat' ) |
---|
1376 | |
---|
1377 | Â Â Â Â Â Â Â !-- Read EMISSION CATEGORIES INDEX |
---|
1378 | Â Â Â Â Â Â Â !Allocate Arrays |
---|
1379 | Â Â Â Â Â Â Â ALLOCATE(emt_att%cat_index(emt_att%ncat)) |
---|
1380 | Â Â Â Â Â Â Â !Call get Variable |
---|
1381 |        CALL get_variable( id_emis, 'emission_cat_index', emt_att%cat_index ) |
---|
1382 | |
---|
1383 | Â |
---|
1384 | Â Â Â Â Â Â Â DO ispec=1,emt_att%nspec |
---|
1385 | Â Â Â Â Â Â Â Â !-- EMISSION_VOC_NAME (1-DIMENSIONAL) |
---|
1386 |         IF (TRIM(emt_att%species_name(ispec))=="VOC" .OR. TRIM(emt_att%species_name(ispec))=="voc") THEN |
---|
1387 | Â Â Â Â Â Â Â Â Â Â !Allocate Array |
---|
1388 |           CALL netcdf_data_input_get_dimension_length( id_emis, emt_att%nvoc, 'nvoc' ) |
---|
1389 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt_att%voc_name(1:emt_att%nvoc)) |
---|
1390 | Â Â Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1391 |           CALL get_variable( id_emis,"emission_voc_name",string_values, emt_att%nvoc) |
---|
1392 | Â Â Â Â Â Â Â Â Â Â emt_att%voc_name=string_values |
---|
1393 | Â Â Â Â Â Â Â Â Â Â IFÂ (ALLOCATED(string_values))Â DEALLOCATE(string_values) |
---|
1394 | Â |
---|
1395 | Â Â Â Â Â Â Â Â !-- COMPOSITION VOC (2-DIMENSIONAL) |
---|
1396 | Â Â Â Â Â Â Â Â Â Â !Allocate Array |
---|
1397 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt_att%voc_comp(1:emt_att%ncat,1:emt_att%nvoc)) |
---|
1398 | Â Â Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1399 | !        CALL get_variable(id_emis,"composition_voc",emt%voc_comp,1,1,emt%ncat,emt%nvoc) |
---|
1400 | Â Â Â Â Â Â Â Â Â Â CALL get_variable(id_emis,"composition_voc",emt_att%voc_comp,1,emt_att%ncat,1,emt_att%nvoc) |
---|
1401 | Â Â Â Â Â Â Â Â ENDIF |
---|
1402 | |
---|
1403 | Â Â Â Â Â Â Â Â !-- EMISSION_PM_NAME (1-DIMENSIONAL) |
---|
1404 |         IF (TRIM(emt_att%species_name(ispec))=="PM" .OR. TRIM(emt_att%species_name(ispec))=="pm") THEN |
---|
1405 |           CALL netcdf_data_input_get_dimension_length( id_emis, emt_att%npm, 'npm' ) |
---|
1406 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt_att%pm_name(1:emt_att%npm)) |
---|
1407 | Â Â Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1408 |           CALL get_variable( id_emis,"pm_name",string_values, emt_att%npm) |
---|
1409 | Â Â Â Â Â Â Â Â Â Â emt_att%pm_name=string_values |
---|
1410 | Â Â Â Â Â Â Â Â Â Â IFÂ (ALLOCATED(string_values))Â DEALLOCATE(string_values)Â Â Â |
---|
1411 | |
---|
1412 | Â Â Â Â Â Â Â Â !-- COMPOSITION PM (3-DIMENSIONAL) |
---|
1413 | Â Â Â Â Â Â Â Â Â Â !Allocate |
---|
1414 | Â Â Â Â Â Â Â Â Â Â len_dims=3Â !> number of PMs: PM1, PM2.5 and PM10 |
---|
1415 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt_att%pm_comp(1:emt_att%ncat,1:emt_att%npm,1:len_dims)) |
---|
1416 | Â Â Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1417 | Â Â Â Â Â Â Â Â Â Â CALL get_variable(id_emis,"composition_pm",emt_att%pm_comp,1,emt_att%ncat,1,emt_att%npm,1,len_dims)Â Â Â Â Â Â Â Â Â Â |
---|
1418 | Â Â Â Â Â Â Â Â ENDIF |
---|
1419 | |
---|
1420 | Â Â Â Â Â Â Â Â !-- COMPOSITION_NOX (2-DIMENSIONAL) |
---|
1421 |         IF (TRIM(emt_att%species_name(ispec))=="NOx" .OR. TRIM(emt_att%species_name(ispec))=="nox") THEN |
---|
1422 | Â Â Â Â Â Â Â Â Â Â !Allocate array |
---|
1423 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt_att%nox_comp(1:emt_att%ncat,1:emt_att%nnox)) |
---|
1424 | Â Â Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1425 | Â Â Â Â Â Â Â Â Â Â CALL get_variable(id_emis,"composition_nox",emt_att%nox_comp,1,emt_att%ncat,1,emt_att%nnox) |
---|
1426 | Â Â Â Â Â Â Â Â ENDIF |
---|
1427 | |
---|
1428 | Â Â Â Â Â Â Â Â !-- COMPOSITION-SOX (2-DIMENSIONAL) |
---|
1429 |         IF (TRIM(emt_att%species_name(ispec))=="SOx" .OR. TRIM(emt_att%species_name(ispec))=="sox") THEN |
---|
1430 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt_att%sox_comp(1:emt_att%ncat,1:emt_att%nsox)) |
---|
1431 | Â Â Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1432 | Â Â Â Â Â Â Â Â Â Â CALL get_variable(id_emis,"composition_sox",emt_att%sox_comp,1,emt_att%ncat,1,emt_att%nsox) |
---|
1433 | Â Â Â Â Â Â Â Â ENDIF |
---|
1434 | Â Â Â Â Â Â Â ENDDOÂ !>ispec |
---|
1435 | |
---|
1436 | !-- For reading the emission time factors, the distinction between HOUR and MDH data is necessary |
---|
1437 | Â Â Â |
---|
1438 | Â Â Â Â Â Â Â !-- EMISSION_TIME_SCALING_FACTORS |
---|
1439 | Â Â Â Â Â Â Â Â !-- HOURÂ Â |
---|
1440 |        IF (TRIM(time_fac_type)=="HOUR" .OR. TRIM(time_fac_type)=="hour") THEN |
---|
1441 | Â Â Â Â Â Â Â Â !-- Allocate Array |
---|
1442 |         CALL netcdf_data_input_get_dimension_length( id_emis, emt_att%nhoursyear, 'nhoursyear' ) |
---|
1443 | Â Â Â Â Â Â Â Â ALLOCATE(emt_att%hourly_emis_time_factor(1:emt_att%ncat,1:emt_att%nhoursyear)) |
---|
1444 | Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1445 |         CALL get_variable(id_emis,"emission_time_factors",emt_att%hourly_emis_time_factor,1,  & |
---|
1446 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â emt_att%ncat,1,emt_att%nhoursyear) |
---|
1447 | |
---|
1448 | Â Â Â Â Â Â Â Â !-- MDH |
---|
1449 |        ELSE IF (TRIM(time_fac_type) == "MDH" .OR. TRIM(time_fac_type) == "mdh") THEN |
---|
1450 | Â Â Â Â Â Â Â Â !-- Allocate Array |
---|
1451 |         CALL netcdf_data_input_get_dimension_length( id_emis, emt_att%nmonthdayhour, 'nmonthdayhour' ) |
---|
1452 | Â Â Â Â Â Â Â Â ALLOCATE(emt_att%mdh_emis_time_factor(1:emt_att%ncat,1:emt_att%nmonthdayhour)) |
---|
1453 | Â Â Â Â Â Â Â Â !-- Read-in Variable |
---|
1454 |         CALL get_variable(id_emis,"emission_time_factors",emt_att%mdh_emis_time_factor,1,    & |
---|
1455 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â emt_att%ncat,1,emt_att%nmonthdayhour) |
---|
1456 | |
---|
1457 | Â Â Â Â Â Â Â ELSE |
---|
1458 | |
---|
1459 |        message_string = 'We are in the DEFAULT chemistry emissions mode: '      //     & |
---|
1460 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'Â Â Â !no time-factor type specified!'Â Â Â Â Â Â Â Â Â Â Â Â //Â Â Â Â Â & |
---|
1461 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'Please, specify the value of time_fac_type:'Â Â Â Â Â Â Â Â Â //Â Â Â Â Â & |
---|
1462 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'Â Â Â Â Â either "MDH" or "HOUR"'Â Â Â Â Â Â Â Â Â |
---|
1463 |        CALL message( 'netcdf_data_input_chemistry_data', 'CM0200', 2, 2, 0, 6, 0 ) |
---|
1464 | Â |
---|
1465 | |
---|
1466 | Â Â Â Â Â Â Â ENDIF |
---|
1467 | |
---|
1468 | Â Â Â Â Â Â Â !-- Finally read-in the emission values and their units (DEFAULT mode) |
---|
1469 | |
---|
1470 | Â Â Â Â Â Â Â DO ispec=1,emt_att%nspec |
---|
1471 | |
---|
1472 |         IF ( .NOT. ALLOCATED( emt(ispec)%default_emission_data ) )               & |
---|
1473 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt(ispec)%default_emission_data(1:emt_att%ncat,1:ny+1,1:nx+1)) |
---|
1474 | |
---|
1475 | Â Â Â Â Â Â Â Â ALLOCATE(dum_var_3d(1:emt_att%ncat,nys+1:nyn+1,nxl+1:nxr+1)) |
---|
1476 | |
---|
1477 | Â Â Â Â Â Â Â Â CALL get_variable(id_emis,"emission_values",dum_var_3d,ispec,1,emt_att%ncat,nys,nyn,nxl,nxr)Â Â Â Â Â |
---|
1478 | |
---|
1479 | Â Â Â Â Â Â Â Â emt(ispec)%default_emission_data(:,nys+1:nyn+1,nxl+1:nxr+1)Â =Â Â Â Â Â Â Â Â Â Â Â Â Â Â & |
---|
1480 | Â Â Â Â Â Â Â Â Â Â dum_var_3d(1:emt_att%ncat,nys+1:nyn+1,nxl+1:nxr+1) |
---|
1481 | |
---|
1482 | Â Â Â Â Â Â Â Â DEALLOCATEÂ (dum_var_3d) |
---|
1483 | |
---|
1484 | Â Â Â Â Â Â Â ENDDO |
---|
1485 | |
---|
1486 | Â Â Â Â Â Â Â !-- UNITS |
---|
1487 | Â Â Â Â Â Â Â CALL get_attribute(id_emis,"units",emt_att%units,.FALSE.,"emission_values") |
---|
1488 | |
---|
1489 | |
---|
1490 | Â Â Â Â Â !-- PRE-PROCESSED MODE -- |
---|
1491 | |
---|
1492 |      ELSE IF (TRIM(mode_emis)=="PRE-PROCESSED" .OR. TRIM(mode_emis)=="pre-processed") THEN |
---|
1493 | Â Â Â Â Â !-- In the PRE-PROCESSED mode, only the VOC names, the VOC_composition, the emission values and their units remain to be read at this point |
---|
1494 | |
---|
1495 | Â Â Â Â Â Â Â DO ispec=1,emt_att%nspec |
---|
1496 | |
---|
1497 | Â Â Â Â Â Â Â !-- EMISSION_VOC_NAME (1-DIMENSIONAL) |
---|
1498 |         IF (TRIM(emt_att%species_name(ispec))=="VOC" .OR. TRIM(emt_att%species_name(ispec))=="voc") THEN |
---|
1499 | Â Â Â Â Â Â Â Â Â Â !Allocate Array |
---|
1500 |           CALL netcdf_data_input_get_dimension_length( id_emis, emt_att%nvoc, 'nvoc' ) |
---|
1501 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt_att%voc_name(1:emt_att%nvoc)) |
---|
1502 | Â Â Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1503 |           CALL get_variable( id_emis,"emission_voc_name",string_values, emt_att%nvoc) |
---|
1504 | Â Â Â Â Â Â Â Â Â Â emt_att%voc_name=string_values |
---|
1505 | Â Â Â Â Â Â Â Â Â Â IFÂ (ALLOCATED(string_values))Â DEALLOCATE(string_values) |
---|
1506 | Â |
---|
1507 | Â Â Â Â Â Â Â !-- COMPOSITION VOC (2-DIMENSIONAL) |
---|
1508 | Â Â Â Â Â Â Â Â Â Â !Allocate Array |
---|
1509 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt_att%voc_comp(1:emt_att%ncat,1:emt_att%nvoc)) |
---|
1510 | Â Â Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1511 | Â Â Â Â Â Â Â Â Â Â CALL get_variable(id_emis,"composition_voc",emt_att%voc_comp,1,emt_att%ncat,1,emt_att%nvoc) |
---|
1512 | Â Â Â Â Â Â Â Â ENDIF |
---|
1513 | Â |
---|
1514 | Â Â Â Â Â Â Â ENDDOÂ !> ispec |
---|
1515 | |
---|
1516 | Â Â Â Â Â Â Â !-- EMISSION_VALUES (4-DIMENSIONAL) |
---|
1517 | Â Â Â Â Â Â Â !Calculate temporal dimension length |
---|
1518 |        CALL netcdf_data_input_get_dimension_length( id_emis, emt_att%dt_emission, 'time' )  |
---|
1519 | Â Â Â Â Â |
---|
1520 | |
---|
1521 | Â Â Â Â Â Â Â DO ispec=1,emt_att%nspec |
---|
1522 | |
---|
1523 |         !Allocation for the entire domain has to be done only for the first processor between all the subdomains   |
---|
1524 |         IF ( .NOT. ALLOCATED( emt(ispec)%preproc_emission_data ) )               & |
---|
1525 | Â Â Â Â Â Â Â Â Â Â ALLOCATE(emt(ispec)%preproc_emission_data(emt_att%dt_emission,1,1:ny+1,1:nx+1)) |
---|
1526 | |
---|
1527 | Â Â Â Â Â Â Â Â !> allocate variable where to pass emission values read from netcdf |
---|
1528 | Â Â Â Â Â Â Â Â ALLOCATE(dum_var_4d(1:emt_att%dt_emission,1,nys+1:nyn+1,nxl+1:nxr+1)) |
---|
1529 | |
---|
1530 | Â Â Â Â Â Â Â Â !Read-in Variable |
---|
1531 | Â Â Â Â Â Â Â Â CALL get_variable(id_emis,"emission_values",dum_var_4d,ispec,1,emt_att%dt_emission,1,1,nys,nyn,nxl,nxr)Â Â Â Â Â |
---|
1532 | |
---|
1533 | Â Â Â |
---|
1534 | Â Â Â Â Â Â Â Â emt(ispec)%preproc_emission_data(:,1,nys+1:nyn+1,nxl+1:nxr+1)Â =Â Â Â Â Â Â Â Â Â Â Â Â Â & |
---|
1535 | Â Â Â Â Â Â Â Â Â Â Â dum_var_4d(1:emt_att%dt_emission,1,nys+1:nyn+1,nxl+1:nxr+1) |
---|
1536 | |
---|
1537 |         DEALLOCATE ( dum_var_4d ) |
---|
1538 | |
---|
1539 | Â Â Â Â Â Â Â ENDDO |
---|
1540 | |
---|
1541 | Â Â Â Â Â Â Â !-- UNITS |
---|
1542 | Â Â Â Â Â Â Â CALL get_attribute(id_emis,"units",emt_att%units,.FALSE.,"emission_values") |
---|
1543 | Â Â Â Â |
---|
1544 | Â Â Â Â Â ENDIF |
---|
1545 | |
---|
1546 |     CALL close_input_file( id_emis ) |
---|
1547 | |
---|
1548 | #endif |
---|
1549 | Â Â Â Â ENDIF |
---|
1550 | |
---|
1551 | Â Â END SUBROUTINE netcdf_data_input_chemistry_data |
---|
1552 | |
---|
1553 | !------------------------------------------------------------------------------! |
---|
1554 | ! Description: |
---|
1555 | ! ------------ |
---|
1556 | !> Reads surface classification data, such as vegetation and soil type, etc. . |
---|
1557 | !------------------------------------------------------------------------------! |
---|
1558 | Â Â SUBROUTINE netcdf_data_input_surface_data |
---|
1559 | |
---|
1560 |     USE control_parameters,                         & |
---|
1561 |       ONLY: bc_lr_cyc, bc_ns_cyc, land_surface, plant_canopy,      & |
---|
1562 | Â Â Â Â Â Â Â Â Â urban_surface |
---|
1563 | |
---|
1564 |     USE indices,                              & |
---|
1565 |       ONLY: nbgp, nx, nxl, nxr,ny, nyn, nys |
---|
1566 | |
---|
1567 | |
---|
1568 | Â Â Â Â IMPLICIT NONE |
---|
1569 | |
---|
1570 |     CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: var_names !< variable names in static input file |
---|
1571 | |
---|
1572 |     INTEGER(iwp) :: id_surf  !< NetCDF id of input file |
---|
1573 |     INTEGER(iwp) :: k     !< running index along z-direction |
---|
1574 | Â Â Â Â INTEGER(iwp)Â ::Â k2Â Â Â Â !< running index |
---|
1575 |     INTEGER(iwp) :: num_vars !< number of variables in input file |
---|
1576 |     INTEGER(iwp) :: nz_soil  !< number of soil layers in file |
---|
1577 | |
---|
1578 | ! |
---|
1579 | !--Â Â If not static input file is available, skip this routine |
---|
1580 |     IF ( .NOT. input_pids_static ) RETURN |
---|
1581 | ! |
---|
1582 | !--Â Â Measure CPU time |
---|
1583 |     CALL cpu_log( log_point_s(82), 'NetCDF input', 'start' ) |
---|
1584 | ! |
---|
1585 | !--Â Â Read plant canopy variables. |
---|
1586 |     IF ( plant_canopy ) THEN |
---|
1587 | #if defined ( __netcdf ) |
---|
1588 | ! |
---|
1589 | !--Â Â Â Â Open file in read-only mode |
---|
1590 |      CALL open_read_file( TRIM( input_file_static ) //          & |
---|
1591 |                 TRIM( coupling_char ) , id_surf ) |
---|
1592 | ! |
---|
1593 | !--Â Â Â Â At first, inquire all variable names. |
---|
1594 | !--Â Â Â Â This will be used to check whether an optional input variable |
---|
1595 | !--Â Â Â Â exist or not. |
---|
1596 |      CALL inquire_num_variables( id_surf, num_vars ) |
---|
1597 | |
---|
1598 | Â Â Â Â Â ALLOCATE(Â var_names(1:num_vars)Â ) |
---|
1599 |      CALL inquire_variable_names( id_surf, var_names ) |
---|
1600 | |
---|
1601 | ! |
---|
1602 | !--Â Â Â Â Read leaf area density - resolved vegetation |
---|
1603 |      IF ( check_existence( var_names, 'lad' ) ) THEN |
---|
1604 |        leaf_area_density_f%from_file = .TRUE. |
---|
1605 |        CALL get_attribute( id_surf, char_fill,              & |
---|
1606 |                  leaf_area_density_f%fill,           & |
---|
1607 |                  .FALSE., 'lad' ) |
---|
1608 | ! |
---|
1609 | !--Â Â Â Â Â Inquire number of vertical vegetation layer |
---|
1610 |        CALL netcdf_data_input_get_dimension_length( id_surf,       & |
---|
1611 |                          leaf_area_density_f%nz,    & |
---|
1612 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'zlad'Â ) |
---|
1613 | ! |
---|
1614 | !--Â Â Â Â Â Allocate variable for leaf-area density |
---|
1615 |        ALLOCATE( leaf_area_density_f%var( 0:leaf_area_density_f%nz-1,  & |
---|
1616 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1617 | |
---|
1618 |        CALL get_variable( id_surf, 'lad', leaf_area_density_f%var,    & |
---|
1619 |                 nxl, nxr, nys, nyn,              & |
---|
1620 |                 0, leaf_area_density_f%nz-1 ) |
---|
1621 | |
---|
1622 | Â Â Â Â Â ELSE |
---|
1623 |        leaf_area_density_f%from_file = .FALSE. |
---|
1624 | Â Â Â Â Â ENDIF |
---|
1625 | |
---|
1626 | ! |
---|
1627 | !--Â Â Â Â Read basal area density - resolved vegetation |
---|
1628 |      IF ( check_existence( var_names, 'bad' ) ) THEN |
---|
1629 |        basal_area_density_f%from_file = .TRUE. |
---|
1630 |        CALL get_attribute( id_surf, char_fill,              & |
---|
1631 |                  basal_area_density_f%fill,          & |
---|
1632 |                  .FALSE., 'bad' ) |
---|
1633 | ! |
---|
1634 | !--Â Â Â Â Â Inquire number of vertical vegetation layer |
---|
1635 |        CALL netcdf_data_input_get_dimension_length( id_surf,       & |
---|
1636 |                          basal_area_density_f%nz,   & |
---|
1637 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'zlad'Â ) |
---|
1638 | ! |
---|
1639 | !--Â Â Â Â Â Allocate variable |
---|
1640 |        ALLOCATE( basal_area_density_f%var(0:basal_area_density_f%nz-1,  & |
---|
1641 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1642 | |
---|
1643 |        CALL get_variable( id_surf, 'bad', basal_area_density_f%var,   & |
---|
1644 |                 nxl, nxr, nys, nyn,              & |
---|
1645 |                 0, basal_area_density_f%nz-1 ) |
---|
1646 | Â Â Â Â Â ELSE |
---|
1647 |        basal_area_density_f%from_file = .FALSE. |
---|
1648 | Â Â Â Â Â ENDIF |
---|
1649 | |
---|
1650 | ! |
---|
1651 | !--Â Â Â Â Read root area density - resolved vegetation |
---|
1652 |      IF ( check_existence( var_names, 'root_area_dens_r' ) ) THEN |
---|
1653 |        root_area_density_lad_f%from_file = .TRUE. |
---|
1654 |        CALL get_attribute( id_surf, char_fill,              & |
---|
1655 |                  root_area_density_lad_f%fill,         & |
---|
1656 |                  .FALSE., 'root_area_dens_r' ) |
---|
1657 | ! |
---|
1658 | !--Â Â Â Â Â Inquire number of vertical soil layers |
---|
1659 |        CALL netcdf_data_input_get_dimension_length( id_surf,       & |
---|
1660 |                           root_area_density_lad_f%nz, & |
---|
1661 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'zsoil'Â ) |
---|
1662 | ! |
---|
1663 | !--Â Â Â Â Â Allocate variable |
---|
1664 |        ALLOCATE( root_area_density_lad_f%var               & |
---|
1665 |                      (0:root_area_density_lad_f%nz-1,   & |
---|
1666 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1667 | |
---|
1668 |        CALL get_variable( id_surf, 'root_area_dens_r',          & |
---|
1669 |                 root_area_density_lad_f%var,          & |
---|
1670 |                 nxl, nxr, nys, nyn,              & |
---|
1671 |                 0, root_area_density_lad_f%nz-1 ) |
---|
1672 | Â Â Â Â Â ELSE |
---|
1673 |        root_area_density_lad_f%from_file = .FALSE. |
---|
1674 | Â Â Â Â Â ENDIF |
---|
1675 | ! |
---|
1676 | !--Â Â Â Â Finally, close input file |
---|
1677 |      CALL close_input_file( id_surf ) |
---|
1678 | #endif |
---|
1679 | Â Â Â Â ENDIF |
---|
1680 | ! |
---|
1681 | !--Â Â Deallocate variable list. Will be re-allocated in case further |
---|
1682 | !--Â Â variables are read from file. |
---|
1683 |     IF ( ALLOCATED( var_names ) ) DEALLOCATE( var_names ) |
---|
1684 | ! |
---|
1685 | !--Â Â Skip the following if no land-surface or urban-surface module are |
---|
1686 | !--Â Â applied. This case, no one of the following variables is used anyway. |
---|
1687 |     IF ( .NOT. land_surface .AND. .NOT. urban_surface ) RETURN |
---|
1688 | |
---|
1689 | #if defined ( __netcdf ) |
---|
1690 | ! |
---|
1691 | !--Â Â Open file in read-only mode |
---|
1692 |     CALL open_read_file( TRIM( input_file_static ) //            & |
---|
1693 |               TRIM( coupling_char ) , id_surf ) |
---|
1694 | ! |
---|
1695 | !--Â Â Inquire all variable names. |
---|
1696 | !--Â Â This will be used to check whether an optional input variable exist |
---|
1697 | !--Â Â or not. |
---|
1698 |     CALL inquire_num_variables( id_surf, num_vars ) |
---|
1699 | |
---|
1700 | Â Â Â Â ALLOCATE(Â var_names(1:num_vars)Â ) |
---|
1701 |     CALL inquire_variable_names( id_surf, var_names ) |
---|
1702 | ! |
---|
1703 | !--Â Â Read vegetation type and required attributes |
---|
1704 |     IF ( check_existence( var_names, 'vegetation_type' ) ) THEN |
---|
1705 |      vegetation_type_f%from_file = .TRUE. |
---|
1706 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1707 |                vegetation_type_f%fill,             & |
---|
1708 |                .FALSE., 'vegetation_type' ) |
---|
1709 | |
---|
1710 | Â Â Â Â Â ALLOCATEÂ (Â vegetation_type_f%var(nys:nyn,nxl:nxr)Â ) |
---|
1711 | |
---|
1712 |      CALL get_variable( id_surf, 'vegetation_type',            & |
---|
1713 |                vegetation_type_f%var, nxl, nxr, nys, nyn ) |
---|
1714 | Â Â Â Â ELSE |
---|
1715 |      vegetation_type_f%from_file = .FALSE. |
---|
1716 | Â Â Â Â ENDIF |
---|
1717 | |
---|
1718 | ! |
---|
1719 | !--Â Â Read soil type and required attributes |
---|
1720 |     IF ( check_existence( var_names, 'soil_type' ) ) THEN |
---|
1721 |        soil_type_f%from_file = .TRUE. |
---|
1722 | ! |
---|
1723 | !--Â Â Â Â Note, lod is currently not on file; skip for the moment |
---|
1724 | !      CALL get_attribute( id_surf, char_lod,            & |
---|
1725 | !                   soil_type_f%lod,         & |
---|
1726 | !                   .FALSE., 'soil_type' ) |
---|
1727 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1728 |                soil_type_f%fill,                & |
---|
1729 |                .FALSE., 'soil_type' ) |
---|
1730 | |
---|
1731 |      IF ( soil_type_f%lod == 1 ) THEN |
---|
1732 | |
---|
1733 | Â Â Â Â Â Â Â ALLOCATEÂ (Â soil_type_f%var_2d(nys:nyn,nxl:nxr)Â ) |
---|
1734 | |
---|
1735 |        CALL get_variable( id_surf, 'soil_type', soil_type_f%var_2d,   & |
---|
1736 |                 nxl, nxr, nys, nyn ) |
---|
1737 | |
---|
1738 |      ELSEIF ( soil_type_f%lod == 2 ) THEN |
---|
1739 | ! |
---|
1740 | !--Â Â Â Â Â Obtain number of soil layers from file. |
---|
1741 |        CALL netcdf_data_input_get_dimension_length( id_surf, nz_soil,  & |
---|
1742 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'zsoil'Â ) |
---|
1743 | |
---|
1744 | Â Â Â Â Â Â Â ALLOCATEÂ (Â soil_type_f%var_3d(0:nz_soil,nys:nyn,nxl:nxr)Â ) |
---|
1745 | |
---|
1746 |        CALL get_variable( id_surf, 'soil_type', soil_type_f%var_3d,   & |
---|
1747 |                 nxl, nxr, nys, nyn, 0, nz_soil ) |
---|
1748 | Â |
---|
1749 | Â Â Â Â Â ENDIF |
---|
1750 | Â Â Â Â ELSE |
---|
1751 |      soil_type_f%from_file = .FALSE. |
---|
1752 | Â Â Â Â ENDIF |
---|
1753 | |
---|
1754 | ! |
---|
1755 | !--Â Â Read pavement type and required attributes |
---|
1756 |     IF ( check_existence( var_names, 'pavement_type' ) ) THEN |
---|
1757 |      pavement_type_f%from_file = .TRUE. |
---|
1758 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1759 |                pavement_type_f%fill, .FALSE.,          & |
---|
1760 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'pavement_type'Â ) |
---|
1761 | |
---|
1762 | Â Â Â Â Â ALLOCATEÂ (Â pavement_type_f%var(nys:nyn,nxl:nxr)Â ) |
---|
1763 | |
---|
1764 |      CALL get_variable( id_surf, 'pavement_type', pavement_type_f%var,  & |
---|
1765 |                nxl, nxr, nys, nyn ) |
---|
1766 | Â Â Â Â ELSE |
---|
1767 |      pavement_type_f%from_file = .FALSE. |
---|
1768 | Â Â Â Â ENDIF |
---|
1769 | |
---|
1770 | ! |
---|
1771 | !--Â Â Read water type and required attributes |
---|
1772 |     IF ( check_existence( var_names, 'water_type' ) ) THEN |
---|
1773 |      water_type_f%from_file = .TRUE. |
---|
1774 |      CALL get_attribute( id_surf, char_fill, water_type_f%fill,      & |
---|
1775 |                .FALSE., 'water_type' ) |
---|
1776 | |
---|
1777 | Â Â Â Â Â ALLOCATEÂ (Â water_type_f%var(nys:nyn,nxl:nxr)Â ) |
---|
1778 | |
---|
1779 |      CALL get_variable( id_surf, 'water_type', water_type_f%var,     & |
---|
1780 |                nxl, nxr, nys, nyn ) |
---|
1781 | |
---|
1782 | Â Â Â Â ELSE |
---|
1783 |      water_type_f%from_file = .FALSE. |
---|
1784 | Â Â Â Â ENDIF |
---|
1785 | ! |
---|
1786 | !--Â Â Read relative surface fractions of vegetation, pavement and water. |
---|
1787 |     IF ( check_existence( var_names, 'surface_fraction' ) ) THEN |
---|
1788 |      surface_fraction_f%from_file = .TRUE. |
---|
1789 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1790 |                surface_fraction_f%fill,             & |
---|
1791 |                .FALSE., 'surface_fraction' ) |
---|
1792 | ! |
---|
1793 | !--Â Â Â Â Inquire number of surface fractions |
---|
1794 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
1795 |                             surface_fraction_f%nf, & |
---|
1796 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'nsurface_fraction'Â ) |
---|
1797 | ! |
---|
1798 | !--Â Â Â Â Allocate dimension array and input array for surface fractions |
---|
1799 | Â Â Â Â Â ALLOCATE(Â surface_fraction_f%nfracs(0:surface_fraction_f%nf-1)Â ) |
---|
1800 |      ALLOCATE( surface_fraction_f%frac(0:surface_fraction_f%nf-1,     & |
---|
1801 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1802 | ! |
---|
1803 | !--Â Â Â Â Get dimension of surface fractions |
---|
1804 |      CALL get_variable( id_surf, 'nsurface_fraction',           & |
---|
1805 |                surface_fraction_f%nfracs ) |
---|
1806 | ! |
---|
1807 | !--Â Â Â Â Read surface fractions |
---|
1808 |      CALL get_variable( id_surf, 'surface_fraction',           & |
---|
1809 |                surface_fraction_f%frac, nxl, nxr, nys, nyn,   & |
---|
1810 |                0, surface_fraction_f%nf-1 ) |
---|
1811 | Â Â Â Â ELSE |
---|
1812 |      surface_fraction_f%from_file = .FALSE. |
---|
1813 | Â Â Â Â ENDIF |
---|
1814 | ! |
---|
1815 | !--Â Â Read building parameters and related information |
---|
1816 |     IF ( check_existence( var_names, 'building_pars' ) ) THEN |
---|
1817 |      building_pars_f%from_file = .TRUE. |
---|
1818 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1819 |                building_pars_f%fill,              & |
---|
1820 |                .FALSE., 'building_pars' ) |
---|
1821 | ! |
---|
1822 | !--Â Â Â Â Inquire number of building parameters |
---|
1823 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
1824 |                             building_pars_f%np,   & |
---|
1825 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'nbuilding_pars'Â ) |
---|
1826 | ! |
---|
1827 | !--Â Â Â Â Allocate dimension array and input array for building parameters |
---|
1828 | Â Â Â Â Â ALLOCATE(Â building_pars_f%pars(0:building_pars_f%np-1)Â ) |
---|
1829 |      ALLOCATE( building_pars_f%pars_xy(0:building_pars_f%np-1,      & |
---|
1830 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1831 | ! |
---|
1832 | !--Â Â Â Â Get dimension of building parameters |
---|
1833 |      CALL get_variable( id_surf, 'nbuilding_pars',            & |
---|
1834 |                building_pars_f%pars ) |
---|
1835 | ! |
---|
1836 | !--Â Â Â Â Read building_pars |
---|
1837 |      CALL get_variable( id_surf, 'building_pars',             & |
---|
1838 |                building_pars_f%pars_xy, nxl, nxr, nys, nyn,   & |
---|
1839 |                0, building_pars_f%np-1 ) |
---|
1840 | Â Â Â Â ELSE |
---|
1841 |      building_pars_f%from_file = .FALSE. |
---|
1842 | Â Â Â Â ENDIF |
---|
1843 | |
---|
1844 | ! |
---|
1845 | !--Â Â Read albedo type and required attributes |
---|
1846 |     IF ( check_existence( var_names, 'albedo_type' ) ) THEN |
---|
1847 |      albedo_type_f%from_file = .TRUE. |
---|
1848 |      CALL get_attribute( id_surf, char_fill, albedo_type_f%fill,     & |
---|
1849 |                .FALSE., 'albedo_type' ) |
---|
1850 | |
---|
1851 | Â Â Â Â Â ALLOCATEÂ (Â albedo_type_f%var(nys:nyn,nxl:nxr)Â ) |
---|
1852 | Â Â Â Â Â |
---|
1853 |      CALL get_variable( id_surf, 'albedo_type', albedo_type_f%var,    & |
---|
1854 |                nxl, nxr, nys, nyn ) |
---|
1855 | Â Â Â Â ELSE |
---|
1856 |      albedo_type_f%from_file = .FALSE. |
---|
1857 | Â Â Â Â ENDIF |
---|
1858 | ! |
---|
1859 | !--Â Â Read albedo parameters and related information |
---|
1860 |     IF ( check_existence( var_names, 'albedo_pars' ) ) THEN |
---|
1861 |      albedo_pars_f%from_file = .TRUE. |
---|
1862 |      CALL get_attribute( id_surf, char_fill, albedo_pars_f%fill,     & |
---|
1863 |                .FALSE., 'albedo_pars' ) |
---|
1864 | ! |
---|
1865 | !--Â Â Â Â Inquire number of albedo parameters |
---|
1866 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
1867 |                             albedo_pars_f%np,    & |
---|
1868 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'nalbedo_pars'Â ) |
---|
1869 | ! |
---|
1870 | !--Â Â Â Â Allocate dimension array and input array for albedo parameters |
---|
1871 | Â Â Â Â Â ALLOCATE(Â albedo_pars_f%pars(0:albedo_pars_f%np-1)Â ) |
---|
1872 |      ALLOCATE( albedo_pars_f%pars_xy(0:albedo_pars_f%np-1,        & |
---|
1873 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1874 | ! |
---|
1875 | !--Â Â Â Â Get dimension of albedo parameters |
---|
1876 |      CALL get_variable( id_surf, 'nalbedo_pars', albedo_pars_f%pars ) |
---|
1877 | |
---|
1878 |      CALL get_variable( id_surf, 'albedo_pars', albedo_pars_f%pars_xy,  & |
---|
1879 |                nxl, nxr, nys, nyn,                & |
---|
1880 |                0, albedo_pars_f%np-1 ) |
---|
1881 | Â Â Â Â ELSE |
---|
1882 |      albedo_pars_f%from_file = .FALSE. |
---|
1883 | Â Â Â Â ENDIF |
---|
1884 | |
---|
1885 | ! |
---|
1886 | !--Â Â Read pavement parameters and related information |
---|
1887 |     IF ( check_existence( var_names, 'pavement_pars' ) ) THEN |
---|
1888 |      pavement_pars_f%from_file = .TRUE. |
---|
1889 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1890 |                pavement_pars_f%fill,              & |
---|
1891 |                .FALSE., 'pavement_pars' ) |
---|
1892 | ! |
---|
1893 | !--Â Â Â Â Inquire number of pavement parameters |
---|
1894 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
1895 |                             pavement_pars_f%np,   & |
---|
1896 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'npavement_pars'Â ) |
---|
1897 | ! |
---|
1898 | !--Â Â Â Â Allocate dimension array and input array for pavement parameters |
---|
1899 | Â Â Â Â Â ALLOCATE(Â pavement_pars_f%pars(0:pavement_pars_f%np-1)Â ) |
---|
1900 |      ALLOCATE( pavement_pars_f%pars_xy(0:pavement_pars_f%np-1,      & |
---|
1901 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1902 | ! |
---|
1903 | !--Â Â Â Â Get dimension of pavement parameters |
---|
1904 |      CALL get_variable( id_surf, 'npavement_pars', pavement_pars_f%pars ) |
---|
1905 | |
---|
1906 |      CALL get_variable( id_surf, 'pavement_pars', pavement_pars_f%pars_xy,& |
---|
1907 |                nxl, nxr, nys, nyn,                & |
---|
1908 |                0, pavement_pars_f%np-1 ) |
---|
1909 | Â Â Â Â ELSE |
---|
1910 |      pavement_pars_f%from_file = .FALSE. |
---|
1911 | Â Â Â Â ENDIF |
---|
1912 | |
---|
1913 | ! |
---|
1914 | !--Â Â Read pavement subsurface parameters and related information |
---|
1915 |     IF ( check_existence( var_names, 'pavement_subsurface_pars' ) )     & |
---|
1916 | Â Â Â Â THEN |
---|
1917 |      pavement_subsurface_pars_f%from_file = .TRUE. |
---|
1918 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1919 |                pavement_subsurface_pars_f%fill,         & |
---|
1920 |                .FALSE., 'pavement_subsurface_pars' ) |
---|
1921 | ! |
---|
1922 | !--Â Â Â Â Inquire number of parameters |
---|
1923 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
1924 |                         pavement_subsurface_pars_f%np, & |
---|
1925 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'npavement_subsurface_pars'Â ) |
---|
1926 | ! |
---|
1927 | !--Â Â Â Â Inquire number of soil layers |
---|
1928 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
1929 |                         pavement_subsurface_pars_f%nz, & |
---|
1930 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'zsoil'Â ) |
---|
1931 | ! |
---|
1932 | !--Â Â Â Â Allocate dimension array and input array for pavement parameters |
---|
1933 |      ALLOCATE( pavement_subsurface_pars_f%pars              & |
---|
1934 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â (0:pavement_subsurface_pars_f%np-1)Â ) |
---|
1935 |      ALLOCATE( pavement_subsurface_pars_f%pars_xyz            & |
---|
1936 |               (0:pavement_subsurface_pars_f%np-1,        & |
---|
1937 |                0:pavement_subsurface_pars_f%nz-1,        & |
---|
1938 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1939 | ! |
---|
1940 | !--Â Â Â Â Get dimension of pavement parameters |
---|
1941 |      CALL get_variable( id_surf, 'npavement_subsurface_pars',       & |
---|
1942 |                pavement_subsurface_pars_f%pars ) |
---|
1943 | |
---|
1944 |      CALL get_variable( id_surf, 'pavement_subsurface_pars',       & |
---|
1945 |                pavement_subsurface_pars_f%pars_xyz,       & |
---|
1946 |                nxl, nxr, nys, nyn,                & |
---|
1947 |                0, pavement_subsurface_pars_f%nz-1,        & |
---|
1948 |                0, pavement_subsurface_pars_f%np-1 ) |
---|
1949 | Â Â Â Â ELSE |
---|
1950 |      pavement_subsurface_pars_f%from_file = .FALSE. |
---|
1951 | Â Â Â Â ENDIF |
---|
1952 | |
---|
1953 | |
---|
1954 | ! |
---|
1955 | !--Â Â Read vegetation parameters and related information |
---|
1956 |     IF ( check_existence( var_names, 'vegetation_pars' ) ) THEN |
---|
1957 |      vegetation_pars_f%from_file = .TRUE. |
---|
1958 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1959 |                vegetation_pars_f%fill,             & |
---|
1960 |                .FALSE., 'vegetation_pars' ) |
---|
1961 | ! |
---|
1962 | !--Â Â Â Â Inquire number of vegetation parameters |
---|
1963 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
1964 |                             vegetation_pars_f%np,  & |
---|
1965 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'nvegetation_pars'Â ) |
---|
1966 | ! |
---|
1967 | !--Â Â Â Â Allocate dimension array and input array for surface fractions |
---|
1968 | Â Â Â Â Â ALLOCATE(Â vegetation_pars_f%pars(0:vegetation_pars_f%np-1)Â ) |
---|
1969 |      ALLOCATE( vegetation_pars_f%pars_xy(0:vegetation_pars_f%np-1,    & |
---|
1970 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
1971 | ! |
---|
1972 | !--Â Â Â Â Get dimension of the parameters |
---|
1973 |      CALL get_variable( id_surf, 'nvegetation_pars',           & |
---|
1974 |                vegetation_pars_f%pars ) |
---|
1975 | |
---|
1976 |      CALL get_variable( id_surf, 'vegetation_pars',            & |
---|
1977 |                vegetation_pars_f%pars_xy, nxl, nxr, nys, nyn,  & |
---|
1978 |                0, vegetation_pars_f%np-1 ) |
---|
1979 | Â Â Â Â ELSE |
---|
1980 |      vegetation_pars_f%from_file = .FALSE. |
---|
1981 | Â Â Â Â ENDIF |
---|
1982 | |
---|
1983 | ! |
---|
1984 | !--Â Â Read root parameters/distribution and related information |
---|
1985 |     IF ( check_existence( var_names, 'soil_pars' ) ) THEN |
---|
1986 |      soil_pars_f%from_file = .TRUE. |
---|
1987 |      CALL get_attribute( id_surf, char_fill,               & |
---|
1988 |                soil_pars_f%fill,                & |
---|
1989 |                .FALSE., 'soil_pars' ) |
---|
1990 | |
---|
1991 |      CALL get_attribute( id_surf, char_lod,                & |
---|
1992 |                soil_pars_f%lod,                 & |
---|
1993 |                .FALSE., 'soil_pars' ) |
---|
1994 | |
---|
1995 | ! |
---|
1996 | !--Â Â Â Â Inquire number of soil parameters |
---|
1997 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
1998 |                             soil_pars_f%np,     & |
---|
1999 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'nsoil_pars'Â ) |
---|
2000 | ! |
---|
2001 | !--Â Â Â Â Read parameters array |
---|
2002 | Â Â Â Â Â ALLOCATE(Â soil_pars_f%pars(0:soil_pars_f%np-1)Â ) |
---|
2003 |      CALL get_variable( id_surf, 'nsoil_pars', soil_pars_f%pars ) |
---|
2004 | |
---|
2005 | ! |
---|
2006 | !--Â Â Â Â In case of level of detail 2, also inquire number of vertical |
---|
2007 | !--Â Â Â Â soil layers, allocate memory and read the respective dimension |
---|
2008 |      IF ( soil_pars_f%lod == 2 ) THEN |
---|
2009 |        CALL netcdf_data_input_get_dimension_length( id_surf,       & |
---|
2010 |                              soil_pars_f%nz,   & |
---|
2011 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'zsoil'Â ) |
---|
2012 | |
---|
2013 | Â Â Â Â Â Â Â ALLOCATE(Â soil_pars_f%layers(0:soil_pars_f%nz-1)Â ) |
---|
2014 |        CALL get_variable( id_surf, 'zsoil', soil_pars_f%layers ) |
---|
2015 | |
---|
2016 | Â Â Â Â Â ENDIF |
---|
2017 | |
---|
2018 | ! |
---|
2019 | !--Â Â Â Â Read soil parameters, depending on level of detail |
---|
2020 |      IF ( soil_pars_f%lod == 1 ) THEN |
---|
2021 |        ALLOCATE( soil_pars_f%pars_xy(0:soil_pars_f%np-1,         & |
---|
2022 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
2023 | Â Â Â Â Â Â Â Â Â |
---|
2024 |        CALL get_variable( id_surf, 'soil_pars', soil_pars_f%pars_xy,   & |
---|
2025 |                 nxl, nxr, nys, nyn, 0, soil_pars_f%np-1 ) |
---|
2026 | |
---|
2027 |      ELSEIF ( soil_pars_f%lod == 2 ) THEN |
---|
2028 |        ALLOCATE( soil_pars_f%pars_xyz(0:soil_pars_f%np-1,        & |
---|
2029 |                       0:soil_pars_f%nz-1,        & |
---|
2030 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
2031 |        CALL get_variable( id_surf, 'soil_pars',             & |
---|
2032 |                 soil_pars_f%pars_xyz,             & |
---|
2033 |                 nxl, nxr, nys, nyn, 0, soil_pars_f%nz-1,    & |
---|
2034 |                 0, soil_pars_f%np-1 ) |
---|
2035 | |
---|
2036 | Â Â Â Â Â ENDIF |
---|
2037 | Â Â Â Â ELSE |
---|
2038 |      soil_pars_f%from_file = .FALSE. |
---|
2039 | Â Â Â Â ENDIF |
---|
2040 | |
---|
2041 | ! |
---|
2042 | !--Â Â Read water parameters and related information |
---|
2043 |     IF ( check_existence( var_names, 'water_pars' ) ) THEN |
---|
2044 |      water_pars_f%from_file = .TRUE. |
---|
2045 |      CALL get_attribute( id_surf, char_fill,               & |
---|
2046 |                water_pars_f%fill,                & |
---|
2047 |                .FALSE., 'water_pars' ) |
---|
2048 | ! |
---|
2049 | !--Â Â Â Â Inquire number of water parameters |
---|
2050 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
2051 |                             water_pars_f%np,    & |
---|
2052 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'nwater_pars'Â ) |
---|
2053 | ! |
---|
2054 | !--Â Â Â Â Allocate dimension array and input array for water parameters |
---|
2055 | Â Â Â Â Â ALLOCATE(Â water_pars_f%pars(0:water_pars_f%np-1)Â ) |
---|
2056 |      ALLOCATE( water_pars_f%pars_xy(0:water_pars_f%np-1,         & |
---|
2057 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
2058 | ! |
---|
2059 | !--Â Â Â Â Get dimension of water parameters |
---|
2060 |      CALL get_variable( id_surf, 'nwater_pars', water_pars_f%pars ) |
---|
2061 | |
---|
2062 |      CALL get_variable( id_surf, 'water_pars', water_pars_f%pars_xy,   & |
---|
2063 |                nxl, nxr, nys, nyn, 0, water_pars_f%np-1 ) |
---|
2064 | Â Â Â Â ELSE |
---|
2065 |      water_pars_f%from_file = .FALSE. |
---|
2066 | Â Â Â Â ENDIF |
---|
2067 | ! |
---|
2068 | !--Â Â Read root area density - parametrized vegetation |
---|
2069 |     IF ( check_existence( var_names, 'root_area_dens_s' ) ) THEN |
---|
2070 |      root_area_density_lsm_f%from_file = .TRUE. |
---|
2071 |      CALL get_attribute( id_surf, char_fill,               & |
---|
2072 |                root_area_density_lsm_f%fill,          & |
---|
2073 |                .FALSE., 'root_area_dens_s' ) |
---|
2074 | ! |
---|
2075 | !--Â Â Â Â Obtain number of soil layers from file and allocate variable |
---|
2076 |      CALL netcdf_data_input_get_dimension_length( id_surf,        & |
---|
2077 |                           root_area_density_lsm_f%nz, & |
---|
2078 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'zsoil'Â ) |
---|
2079 |      ALLOCATE( root_area_density_lsm_f%var                & |
---|
2080 |                     (0:root_area_density_lsm_f%nz-1,    & |
---|
2081 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
2082 | |
---|
2083 | ! |
---|
2084 | !--Â Â Â Â Read root-area density |
---|
2085 |      CALL get_variable( id_surf, 'root_area_dens_s',           & |
---|
2086 |                root_area_density_lsm_f%var,           & |
---|
2087 |                nxl, nxr, nys, nyn,                & |
---|
2088 |                0, root_area_density_lsm_f%nz-1 ) |
---|
2089 | |
---|
2090 | Â Â Â Â ELSE |
---|
2091 |      root_area_density_lsm_f%from_file = .FALSE. |
---|
2092 | Â Â Â Â ENDIF |
---|
2093 | ! |
---|
2094 | !--Â Â Read street type and street crossing |
---|
2095 |     IF ( check_existence( var_names, 'street_type' ) ) THEN |
---|
2096 |      street_type_f%from_file = .TRUE. |
---|
2097 |      CALL get_attribute( id_surf, char_fill,               & |
---|
2098 |                street_type_f%fill, .FALSE.,           & |
---|
2099 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'street_type'Â ) |
---|
2100 | |
---|
2101 | Â Â Â Â Â ALLOCATEÂ (Â street_type_f%var(nys:nyn,nxl:nxr)Â ) |
---|
2102 | Â Â Â Â Â |
---|
2103 |      CALL get_variable( id_surf, 'street_type', street_type_f%var,    & |
---|
2104 |                nxl, nxr, nys, nyn ) |
---|
2105 | Â Â Â Â ELSE |
---|
2106 |      street_type_f%from_file = .FALSE. |
---|
2107 | Â Â Â Â ENDIF |
---|
2108 | |
---|
2109 |     IF ( check_existence( var_names, 'street_crossing' ) ) THEN |
---|
2110 |      street_crossing_f%from_file = .TRUE. |
---|
2111 |      CALL get_attribute( id_surf, char_fill,               & |
---|
2112 |                street_crossing_f%fill, .FALSE.,         & |
---|
2113 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'street_crossing'Â ) |
---|
2114 | |
---|
2115 | Â Â Â Â Â ALLOCATEÂ (Â street_crossing_f%var(nys:nyn,nxl:nxr)Â ) |
---|
2116 | |
---|
2117 |      CALL get_variable( id_surf, 'street_crossing',            & |
---|
2118 |                street_crossing_f%var, nxl, nxr, nys, nyn ) |
---|
2119 | |
---|
2120 | Â Â Â Â ELSE |
---|
2121 |      street_crossing_f%from_file = .FALSE. |
---|
2122 | Â Â Â Â ENDIF |
---|
2123 | ! |
---|
2124 | !--Â Â Still missing: root_resolved and building_surface_pars. |
---|
2125 | !--Â Â Will be implemented as soon as they are available. |
---|
2126 | |
---|
2127 | ! |
---|
2128 | !--Â Â Finally, close input file |
---|
2129 |     CALL close_input_file( id_surf ) |
---|
2130 | #endif |
---|
2131 | ! |
---|
2132 | !--Â Â End of CPU measurement |
---|
2133 |     CALL cpu_log( log_point_s(82), 'NetCDF input', 'stop' ) |
---|
2134 | ! |
---|
2135 | !--Â Â Exchange ghost points for surface variables. Therefore, resize |
---|
2136 | !--Â Â variables. |
---|
2137 |     IF ( albedo_type_f%from_file ) THEN |
---|
2138 |      CALL resize_array_2d_int8( albedo_type_f%var, nys, nyn, nxl, nxr ) |
---|
2139 |      CALL exchange_horiz_2d_byte( albedo_type_f%var, nys, nyn, nxl, nxr, & |
---|
2140 |                     nbgp ) |
---|
2141 | Â Â Â Â ENDIF |
---|
2142 |     IF ( pavement_type_f%from_file ) THEN |
---|
2143 |      CALL resize_array_2d_int8( pavement_type_f%var, nys, nyn, nxl, nxr ) |
---|
2144 |      CALL exchange_horiz_2d_byte( pavement_type_f%var, nys, nyn, nxl, nxr,& |
---|
2145 |                     nbgp ) |
---|
2146 | Â Â Â Â ENDIF |
---|
2147 |     IF ( soil_type_f%from_file .AND. ALLOCATED( soil_type_f%var_2d ) ) THEN |
---|
2148 |      CALL resize_array_2d_int8( soil_type_f%var_2d, nys, nyn, nxl, nxr ) |
---|
2149 |      CALL exchange_horiz_2d_byte( soil_type_f%var_2d, nys, nyn, nxl, nxr, & |
---|
2150 |                     nbgp ) |
---|
2151 | Â Â Â Â ENDIF |
---|
2152 |     IF ( vegetation_type_f%from_file ) THEN |
---|
2153 |      CALL resize_array_2d_int8( vegetation_type_f%var, nys, nyn, nxl, nxr ) |
---|
2154 |      CALL exchange_horiz_2d_byte( vegetation_type_f%var, nys, nyn, nxl,  & |
---|
2155 |                     nxr, nbgp ) |
---|
2156 | Â Â Â Â ENDIF |
---|
2157 |     IF ( water_type_f%from_file ) THEN |
---|
2158 |      CALL resize_array_2d_int8( water_type_f%var, nys, nyn, nxl, nxr ) |
---|
2159 |      CALL exchange_horiz_2d_byte( water_type_f%var, nys, nyn, nxl, nxr,  & |
---|
2160 |                     nbgp ) |
---|
2161 | Â Â Â Â ENDIF |
---|
2162 | ! |
---|
2163 | !--Â Â Exchange ghost points for 3/4-D variables. For the sake of simplicity, |
---|
2164 | !--Â Â loop further dimensions to use 2D exchange routines. Unfortunately this |
---|
2165 | !--Â Â is necessary, else new MPI-data types need to be introduced just for |
---|
2166 | !--Â Â 2 variables. |
---|
2167 |     IF ( soil_type_f%from_file .AND. ALLOCATED( soil_type_f%var_3d ) )  & |
---|
2168 | Â Â Â Â THEN |
---|
2169 |      CALL resize_array_3d_int8( soil_type_f%var_3d, 0, nz_soil,      & |
---|
2170 |                    nys, nyn, nxl, nxr ) |
---|
2171 |      DO k = 0, nz_soil |
---|
2172 | Â Â Â Â Â Â Â CALL exchange_horiz_2d_int(Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &Â |
---|
2173 |             soil_type_f%var_3d(k,:,:), nys, nyn, nxl, nxr, nbgp ) |
---|
2174 | Â Â Â Â Â ENDDO |
---|
2175 | Â Â Â Â ENDIF |
---|
2176 | |
---|
2177 |     IF ( surface_fraction_f%from_file ) THEN |
---|
2178 |      CALL resize_array_3d_real( surface_fraction_f%frac,         & |
---|
2179 |                    0, surface_fraction_f%nf-1,        & |
---|
2180 |                    nys, nyn, nxl, nxr ) |
---|
2181 |      DO k = 0, surface_fraction_f%nf-1 |
---|
2182 |        CALL exchange_horiz_2d( surface_fraction_f%frac(k,:,:), nbgp ) |
---|
2183 | Â Â Â Â Â ENDDO |
---|
2184 | Â Â Â Â ENDIF |
---|
2185 | |
---|
2186 |     IF ( building_pars_f%from_file ) THEN     |
---|
2187 |      CALL resize_array_3d_real( building_pars_f%pars_xy,         & |
---|
2188 |                    0, building_pars_f%np-1,         & |
---|
2189 |                    nys, nyn, nxl, nxr ) |
---|
2190 |      DO k = 0, building_pars_f%np-1 |
---|
2191 |        CALL exchange_horiz_2d( building_pars_f%pars_xy(k,:,:), nbgp ) |
---|
2192 | Â Â Â Â Â ENDDO |
---|
2193 | Â Â Â Â ENDIF |
---|
2194 | |
---|
2195 |     IF ( albedo_pars_f%from_file ) THEN     |
---|
2196 |      CALL resize_array_3d_real( albedo_pars_f%pars_xy,          & |
---|
2197 |                    0, albedo_pars_f%np-1,          & |
---|
2198 |                    nys, nyn, nxl, nxr ) |
---|
2199 |      DO k = 0, albedo_pars_f%np-1 |
---|
2200 |        CALL exchange_horiz_2d( albedo_pars_f%pars_xy(k,:,:), nbgp ) |
---|
2201 | Â Â Â Â Â ENDDO |
---|
2202 | Â Â Â Â ENDIF |
---|
2203 | |
---|
2204 |     IF ( pavement_pars_f%from_file ) THEN     |
---|
2205 |      CALL resize_array_3d_real( pavement_pars_f%pars_xy,         & |
---|
2206 |                    0, pavement_pars_f%np-1,         & |
---|
2207 |                    nys, nyn, nxl, nxr ) |
---|
2208 |      DO k = 0, pavement_pars_f%np-1 |
---|
2209 |        CALL exchange_horiz_2d( pavement_pars_f%pars_xy(k,:,:), nbgp ) |
---|
2210 | Â Â Â Â Â ENDDO |
---|
2211 | Â Â Â Â ENDIF |
---|
2212 | |
---|
2213 |     IF ( vegetation_pars_f%from_file ) THEN |
---|
2214 |      CALL resize_array_3d_real( vegetation_pars_f%pars_xy,        & |
---|
2215 |                    0, vegetation_pars_f%np-1,        & |
---|
2216 |                    nys, nyn, nxl, nxr ) |
---|
2217 |      DO k = 0, vegetation_pars_f%np-1 |
---|
2218 |        CALL exchange_horiz_2d( vegetation_pars_f%pars_xy(k,:,:), nbgp ) |
---|
2219 | Â Â Â Â Â ENDDO |
---|
2220 | Â Â Â Â ENDIF |
---|
2221 | |
---|
2222 |     IF ( water_pars_f%from_file ) THEN |
---|
2223 |      CALL resize_array_3d_real( water_pars_f%pars_xy,           & |
---|
2224 |                    0, water_pars_f%np-1,           & |
---|
2225 |                    nys, nyn, nxl, nxr ) |
---|
2226 |      DO k = 0, water_pars_f%np-1 |
---|
2227 |        CALL exchange_horiz_2d( water_pars_f%pars_xy(k,:,:), nbgp ) |
---|
2228 | Â Â Â Â Â ENDDO |
---|
2229 | Â Â Â Â ENDIF |
---|
2230 | |
---|
2231 |     IF ( root_area_density_lsm_f%from_file ) THEN |
---|
2232 |      CALL resize_array_3d_real( root_area_density_lsm_f%var,       & |
---|
2233 |                    0, root_area_density_lsm_f%nz-1,     & |
---|
2234 |                    nys, nyn, nxl, nxr ) |
---|
2235 |      DO k = 0, root_area_density_lsm_f%nz-1 |
---|
2236 |        CALL exchange_horiz_2d( root_area_density_lsm_f%var(k,:,:), nbgp ) |
---|
2237 | Â Â Â Â Â ENDDO |
---|
2238 | Â Â Â Â ENDIF |
---|
2239 | |
---|
2240 |     IF ( soil_pars_f%from_file ) THEN |
---|
2241 |      IF ( soil_pars_f%lod == 1 ) THEN |
---|
2242 | Â Â Â Â Â |
---|
2243 |        CALL resize_array_3d_real( soil_pars_f%pars_xy,          & |
---|
2244 |                     0, soil_pars_f%np-1,          & |
---|
2245 |                     nys, nyn, nxl, nxr ) |
---|
2246 |        DO k = 0, soil_pars_f%np-1 |
---|
2247 |         CALL exchange_horiz_2d( soil_pars_f%pars_xy(k,:,:), nbgp ) |
---|
2248 | Â Â Â Â Â Â Â ENDDO |
---|
2249 | Â Â Â Â Â Â Â |
---|
2250 |      ELSEIF ( soil_pars_f%lod == 2 ) THEN |
---|
2251 |        CALL resize_array_4d_real( soil_pars_f%pars_xyz,         & |
---|
2252 |                     0, soil_pars_f%np-1,          & |
---|
2253 |                     0, soil_pars_f%nz-1,          & |
---|
2254 |                     nys, nyn, nxl, nxr ) |
---|
2255 | |
---|
2256 |        DO k2 = 0, soil_pars_f%nz-1 |
---|
2257 |         DO k = 0, soil_pars_f%np-1 |
---|
2258 |           CALL exchange_horiz_2d( soil_pars_f%pars_xyz(k,k2,:,:),   & |
---|
2259 |                       nbgp ) |
---|
2260 | Â Â Â Â Â Â Â Â ENDDO |
---|
2261 | Â Â Â Â Â Â Â ENDDO |
---|
2262 | Â Â Â Â Â ENDIF |
---|
2263 | Â Â Â Â ENDIF |
---|
2264 | |
---|
2265 |     IF ( pavement_subsurface_pars_f%from_file ) THEN     |
---|
2266 |      CALL resize_array_4d_real( pavement_subsurface_pars_f%pars_xyz,   & |
---|
2267 |                    0, pavement_subsurface_pars_f%np-1,    & |
---|
2268 |                    0, pavement_subsurface_pars_f%nz-1,    & |
---|
2269 |                    nys, nyn, nxl, nxr ) |
---|
2270 | |
---|
2271 |      DO k2 = 0, pavement_subsurface_pars_f%nz-1 |
---|
2272 |        DO k = 0, pavement_subsurface_pars_f%np-1 |
---|
2273 | Â Â Â Â Â Â Â Â CALL exchange_horiz_2d(Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â & |
---|
2274 |               pavement_subsurface_pars_f%pars_xyz(k,k2,:,:), nbgp ) |
---|
2275 | Â Â Â Â Â Â Â ENDDO |
---|
2276 | Â Â Â Â Â ENDDO |
---|
2277 | Â Â Â Â ENDIF |
---|
2278 | |
---|
2279 | Â Â END SUBROUTINE netcdf_data_input_surface_data |
---|
2280 | |
---|
2281 | !------------------------------------------------------------------------------! |
---|
2282 | ! Description: |
---|
2283 | ! ------------ |
---|
2284 | !> Reads uvem lookup table information. |
---|
2285 | !------------------------------------------------------------------------------! |
---|
2286 | Â Â SUBROUTINE netcdf_data_input_uvem |
---|
2287 | Â Â Â Â |
---|
2288 |     USE indices,                              & |
---|
2289 |       ONLY: nxl, nxr, nyn, nys |
---|
2290 | |
---|
2291 | Â Â Â Â IMPLICIT NONE |
---|
2292 | |
---|
2293 |     CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: var_names !< variable names in static input file |
---|
2294 | |
---|
2295 | |
---|
2296 |     INTEGER(iwp) :: id_uvem    !< NetCDF id of uvem lookup table input file |
---|
2297 |     INTEGER(iwp) :: nli = 35   !< dimension length of lookup table in x |
---|
2298 |     INTEGER(iwp) :: nlj = 9   !< dimension length of lookup table in y |
---|
2299 |     INTEGER(iwp) :: nlk = 90   !< dimension length of lookup table in z |
---|
2300 |     INTEGER(iwp) :: num_vars   !< number of variables in netcdf input file |
---|
2301 | ! |
---|
2302 | !--Â Â Input via uv exposure model lookup table input |
---|
2303 |     IF ( input_pids_uvem ) THEN |
---|
2304 | |
---|
2305 | #if defined ( __netcdf ) |
---|
2306 | ! |
---|
2307 | !--Â Â Â Â Open file in read-only mode |
---|
2308 |      CALL open_read_file( TRIM( input_file_uvem ) //          & |
---|
2309 |                 TRIM( coupling_char ), id_uvem ) |
---|
2310 | ! |
---|
2311 | !--Â Â Â Â At first, inquire all variable names. |
---|
2312 | !--Â Â Â Â This will be used to check whether an input variable exist or not. |
---|
2313 |      CALL inquire_num_variables( id_uvem, num_vars ) |
---|
2314 | ! |
---|
2315 | !--Â Â Â Â Allocate memory to store variable names and inquire them. |
---|
2316 | Â Â Â Â Â ALLOCATE(Â var_names(1:num_vars)Â ) |
---|
2317 |      CALL inquire_variable_names( id_uvem, var_names ) |
---|
2318 | ! |
---|
2319 | !--Â Â Â Â uvem integration |
---|
2320 |      IF ( check_existence( var_names, 'int_factors' ) ) THEN |
---|
2321 |        uvem_integration_f%from_file = .TRUE. |
---|
2322 | ! |
---|
2323 | !--Â Â Â Â Â Input 2D uvem integration. |
---|
2324 | Â Â Â Â Â Â Â ALLOCATEÂ (Â uvem_integration_f%var(0:nlj,0:nli)Â ) |
---|
2325 | Â Â Â Â Â Â Â |
---|
2326 |        CALL get_variable( id_uvem, 'int_factors', uvem_integration_f%var, 0, nli, 0, nlj ) |
---|
2327 | Â Â Â Â Â ELSE |
---|
2328 |        uvem_integration_f%from_file = .FALSE. |
---|
2329 | Â Â Â Â Â ENDIF |
---|
2330 | ! |
---|
2331 | !--Â Â Â Â uvem irradiance |
---|
2332 |      IF ( check_existence( var_names, 'irradiance' ) ) THEN |
---|
2333 |        uvem_irradiance_f%from_file = .TRUE. |
---|
2334 | ! |
---|
2335 | !--Â Â Â Â Â Input 2D uvem irradiance. |
---|
2336 |        ALLOCATE ( uvem_irradiance_f%var(0:nlk, 0:2) ) |
---|
2337 | Â Â Â Â Â Â Â |
---|
2338 |        CALL get_variable( id_uvem, 'irradiance', uvem_irradiance_f%var, 0, 2, 0, nlk ) |
---|
2339 | Â Â Â Â Â ELSE |
---|
2340 |        uvem_irradiance_f%from_file = .FALSE. |
---|
2341 | Â Â Â Â Â ENDIF |
---|
2342 | ! |
---|
2343 | !--Â Â Â Â uvem porjection areas |
---|
2344 |      IF ( check_existence( var_names, 'projarea' ) ) THEN |
---|
2345 |        uvem_projarea_f%from_file = .TRUE. |
---|
2346 | ! |
---|
2347 | !--Â Â Â Â Â Input 3D uvem projection area (human geometgry) |
---|
2348 | Â Â Â Â Â Â Â ALLOCATEÂ (Â uvem_projarea_f%var(0:2,0:nlj,0:nli)Â ) |
---|
2349 | Â Â Â Â Â Â |
---|
2350 |        CALL get_variable( id_uvem, 'projarea', uvem_projarea_f%var, 0, nli, 0, nlj, 0, 2 ) |
---|
2351 | Â Â Â Â Â ELSE |
---|
2352 |        uvem_projarea_f%from_file = .FALSE. |
---|
2353 | Â Â Â Â Â ENDIF |
---|
2354 | ! |
---|
2355 | !--Â Â Â Â uvem radiance |
---|
2356 |      IF ( check_existence( var_names, 'radiance' ) ) THEN |
---|
2357 |        uvem_radiance_f%from_file = .TRUE. |
---|
2358 | ! |
---|
2359 | !--Â Â Â Â Â Input 3D uvem radiance |
---|
2360 | Â Â Â Â Â Â Â ALLOCATEÂ (Â uvem_radiance_f%var(0:nlk,0:nlj,0:nli)Â ) |
---|
2361 | Â Â Â Â Â Â Â |
---|
2362 |        CALL get_variable( id_uvem, 'radiance', uvem_radiance_f%var, 0, nli, 0, nlj, 0, nlk ) |
---|
2363 | Â Â Â Â Â ELSE |
---|
2364 |        uvem_radiance_f%from_file = .FALSE. |
---|
2365 | Â Â Â Â Â ENDIF |
---|
2366 | ! |
---|
2367 | !--Â Â Â Â Read building obstruction |
---|
2368 |      IF ( check_existence( var_names, 'obstruction' ) ) THEN |
---|
2369 |        building_obstruction_full%from_file = .TRUE. |
---|
2370 | !--Â Â Â Â Â Input 3D uvem building obstruction |
---|
2371 | Â Â Â Â Â Â Â ALLOCATEÂ (Â building_obstruction_full%var_3d(0:44,0:2,0:2)Â ) |
---|
2372 |        CALL get_variable( id_uvem, 'obstruction', building_obstruction_full%var_3d,0, 2, 0, 2, 0, 44 )    |
---|
2373 | Â Â Â Â Â ELSE |
---|
2374 |        building_obstruction_full%from_file = .FALSE. |
---|
2375 | Â Â Â Â Â ENDIF |
---|
2376 | ! |
---|
2377 |      IF ( check_existence( var_names, 'obstruction' ) ) THEN |
---|
2378 |        building_obstruction_f%from_file = .TRUE. |
---|
2379 | ! |
---|
2380 | !--Â Â Â Â Â Input 3D uvem building obstruction |
---|
2381 | Â Â Â Â Â Â Â ALLOCATEÂ (Â building_obstruction_f%var_3d(0:44,nys:nyn,nxl:nxr)Â ) |
---|
2382 | ! |
---|
2383 |        CALL get_variable( id_uvem, 'obstruction', building_obstruction_f%var_3d,   & |
---|
2384 |                 nxl, nxr, nys, nyn, 0, 44 )    |
---|
2385 | Â Â Â Â Â ELSE |
---|
2386 |        building_obstruction_f%from_file = .FALSE. |
---|
2387 | Â Â Â Â Â ENDIF |
---|
2388 | ! |
---|
2389 | !--Â Â Â Â Close uvem lookup table input file |
---|
2390 |      CALL close_input_file( id_uvem ) |
---|
2391 | #else |
---|
2392 | Â Â Â Â Â CONTINUE |
---|
2393 | #endif |
---|
2394 | Â Â Â Â ENDIF |
---|
2395 | Â Â END SUBROUTINE netcdf_data_input_uvem |
---|
2396 | |
---|
2397 | !------------------------------------------------------------------------------! |
---|
2398 | ! Description: |
---|
2399 | ! ------------ |
---|
2400 | !> Reads orography and building information. |
---|
2401 | !------------------------------------------------------------------------------! |
---|
2402 | Â Â SUBROUTINE netcdf_data_input_topo |
---|
2403 | |
---|
2404 |     USE control_parameters,                         & |
---|
2405 |       ONLY: bc_lr_cyc, bc_ns_cyc, message_string, topography |
---|
2406 | |
---|
2407 |     USE indices,                              & |
---|
2408 |       ONLY: nbgp, nx, nxl, nxr, ny, nyn, nys, nzb |
---|
2409 | |
---|
2410 | |
---|
2411 | Â Â Â Â IMPLICIT NONE |
---|
2412 | |
---|
2413 |     CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: var_names !< variable names in static input file |
---|
2414 | |
---|
2415 | |
---|
2416 |     INTEGER(iwp) :: i       !< running index along x-direction |
---|
2417 |     INTEGER(iwp) :: ii      !< running index for IO blocks |
---|
2418 |     INTEGER(iwp) :: id_topo    !< NetCDF id of topograhy input file |
---|
2419 |     INTEGER(iwp) :: j       !< running index along y-direction |
---|
2420 |     INTEGER(iwp) :: num_vars   !< number of variables in netcdf input file |
---|
2421 |     INTEGER(iwp) :: skip_n_rows  !< counting variable to skip rows while reading topography file |
---|
2422 | |
---|
2423 |     REAL(wp) :: dum      !< dummy variable to skip columns while reading topography file |
---|
2424 | ! |
---|
2425 | !--Â Â CPU measurement |
---|
2426 |     CALL cpu_log( log_point_s(83), 'NetCDF/ASCII input topo', 'start' ) |
---|
2427 | |
---|
2428 | ! |
---|
2429 | !--Â Â Input via palm-input data standard |
---|
2430 |     IF ( input_pids_static ) THEN |
---|
2431 | #if defined ( __netcdf ) |
---|
2432 | ! |
---|
2433 | !--Â Â Â Â Open file in read-only mode |
---|
2434 |      CALL open_read_file( TRIM( input_file_static ) //          & |
---|
2435 |                 TRIM( coupling_char ), id_topo ) |
---|
2436 | ! |
---|
2437 | !--Â Â Â Â At first, inquire all variable names. |
---|
2438 | !--    This will be used to check whether an input variable exist |
---|
2439 | !--Â Â Â Â or not. |
---|
2440 |      CALL inquire_num_variables( id_topo, num_vars ) |
---|
2441 | ! |
---|
2442 | !--Â Â Â Â Allocate memory to store variable names and inquire them. |
---|
2443 | Â Â Â Â Â ALLOCATE(Â var_names(1:num_vars)Â ) |
---|
2444 |      CALL inquire_variable_names( id_topo, var_names ) |
---|
2445 | ! |
---|
2446 | !--Â Â Â Â Read x, y - dimensions. Only required for consistency checks. |
---|
2447 |      CALL netcdf_data_input_get_dimension_length( id_topo, dim_static%nx, 'x' ) |
---|
2448 |      CALL netcdf_data_input_get_dimension_length( id_topo, dim_static%ny, 'y' ) |
---|
2449 | Â Â Â Â Â ALLOCATE(Â dim_static%x(0:dim_static%nx-1)Â ) |
---|
2450 | Â Â Â Â Â ALLOCATE(Â dim_static%y(0:dim_static%ny-1)Â ) |
---|
2451 |      CALL get_variable( id_topo, 'x', dim_static%x ) |
---|
2452 |      CALL get_variable( id_topo, 'y', dim_static%y ) |
---|
2453 | ! |
---|
2454 | !--Â Â Â Â Terrain height. First, get variable-related _FillValue attribute |
---|
2455 |      IF ( check_existence( var_names, 'zt' ) ) THEN |
---|
2456 |        terrain_height_f%from_file = .TRUE. |
---|
2457 |        CALL get_attribute( id_topo, char_fill, terrain_height_f%fill,  & |
---|
2458 |                  .FALSE., 'zt' ) |
---|
2459 | ! |
---|
2460 | !--Â Â Â Â Â Input 2D terrain height. |
---|
2461 | Â Â Â Â Â Â Â ALLOCATEÂ (Â terrain_height_f%var(nys:nyn,nxl:nxr)Â ) |
---|
2462 | Â Â Â Â Â Â Â |
---|
2463 |        CALL get_variable( id_topo, 'zt', terrain_height_f%var,      & |
---|
2464 |                 nxl, nxr, nys, nyn ) |
---|
2465 | |
---|
2466 | Â Â Â Â Â ELSE |
---|
2467 |        terrain_height_f%from_file = .FALSE. |
---|
2468 | Â Â Â Â Â ENDIF |
---|
2469 | |
---|
2470 | ! |
---|
2471 | !--Â Â Â Â Read building height. First, read its _FillValue attribute, |
---|
2472 | !--Â Â Â Â as well as lod attribute |
---|
2473 |      buildings_f%from_file = .FALSE. |
---|
2474 |      IF ( check_existence( var_names, 'buildings_2d' ) ) THEN |
---|
2475 |        buildings_f%from_file = .TRUE. |
---|
2476 |        CALL get_attribute( id_topo, char_lod, buildings_f%lod,      & |
---|
2477 |                  .FALSE., 'buildings_2d' ) |
---|
2478 | |
---|
2479 |        CALL get_attribute( id_topo, char_fill, buildings_f%fill1,    & |
---|
2480 |                  .FALSE., 'buildings_2d' ) |
---|
2481 | |
---|
2482 | ! |
---|
2483 | !--Â Â Â Â Â Read 2D buildings |
---|
2484 |        IF ( buildings_f%lod == 1 ) THEN |
---|
2485 | Â Â Â Â Â Â Â Â ALLOCATEÂ (Â buildings_f%var_2d(nys:nyn,nxl:nxr)Â ) |
---|
2486 | |
---|
2487 |         CALL get_variable( id_topo, 'buildings_2d',          & |
---|
2488 |                   buildings_f%var_2d,             & |
---|
2489 |                   nxl, nxr, nys, nyn ) |
---|
2490 | Â Â Â Â Â Â Â ELSE |
---|
2491 |         message_string = 'NetCDF attribute lod ' //          & |
---|
2492 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â '(level of detail) is not set 'Â //Â Â Â Â Â Â & |
---|
2493 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'properly for buildings_2d.' |
---|
2494 |         CALL message( 'netcdf_data_input_mod', 'PA0540',        & |
---|
2495 |                 1, 2, 0, 6, 0 ) |
---|
2496 | Â Â Â Â Â Â Â ENDIF |
---|
2497 | Â Â Â Â Â ENDIF |
---|
2498 | ! |
---|
2499 | !--Â Â Â Â If available, also read 3D building information. If both are |
---|
2500 | !--Â Â Â Â available, use 3D information. |
---|
2501 |      IF ( check_existence( var_names, 'buildings_3d' ) ) THEN |
---|
2502 |        buildings_f%from_file = .TRUE. |
---|
2503 |        CALL get_attribute( id_topo, char_lod, buildings_f%lod,      & |
---|
2504 |                  .FALSE., 'buildings_3d' )   |
---|
2505 | |
---|
2506 |        CALL get_attribute( id_topo, char_fill, buildings_f%fill2,    & |
---|
2507 |                  .FALSE., 'buildings_3d' ) |
---|
2508 | |
---|
2509 |        CALL netcdf_data_input_get_dimension_length( id_topo,       & |
---|
2510 |                              buildings_f%nz, 'z' ) |
---|
2511 | ! |
---|
2512 | !--Â Â Â Â Â Read 3D buildings |
---|
2513 |        IF ( buildings_f%lod == 2 ) THEN |
---|
2514 | Â Â Â Â Â Â Â Â ALLOCATE(Â buildings_f%z(nzb:buildings_f%nz-1)Â ) |
---|
2515 |         CALL get_variable( id_topo, 'z', buildings_f%z ) |
---|
2516 | |
---|
2517 |         ALLOCATE( buildings_f%var_3d(nzb:buildings_f%nz-1,       & |
---|
2518 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nys:nyn,nxl:nxr)Â ) |
---|
2519 |         buildings_f%var_3d = 0 |
---|
2520 | Â Â Â Â Â Â Â Â |
---|
2521 |         CALL get_variable( id_topo, 'buildings_3d',          & |
---|
2522 |                   buildings_f%var_3d,             & |
---|
2523 |                   nxl, nxr, nys, nyn, 0, buildings_f%nz-1 ) |
---|
2524 | Â Â Â Â Â Â Â ELSE |
---|
2525 |         message_string = 'NetCDF attribute lod ' //          & |
---|
2526 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â '(level of detail) is not set 'Â //Â Â Â Â Â Â & |
---|
2527 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'properly for buildings_3d.' |
---|
2528 |         CALL message( 'netcdf_data_input_mod', 'PA0541',        & |
---|
2529 |                 1, 2, 0, 6, 0 ) |
---|
2530 | Â Â Â Â Â Â Â ENDIF |
---|
2531 | Â Â Â Â Â ENDIF |
---|
2532 | ! |
---|
2533 | !--Â Â Â Â Read building IDs and its FillValue attribute. Further required |
---|
2534 | !--Â Â Â Â for mapping buildings on top of orography. |
---|
2535 |      IF ( check_existence( var_names, 'building_id' ) ) THEN |
---|
2536 |        building_id_f%from_file = .TRUE. |
---|
2537 |        CALL get_attribute( id_topo, char_fill,              & |
---|
2538 |                  building_id_f%fill, .FALSE.,         & |
---|
2539 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'building_id'Â ) |
---|
2540 | |
---|
2541 | Â Â Â Â Â Â Â ALLOCATEÂ (Â building_id_f%var(nys:nyn,nxl:nxr)Â ) |
---|
2542 | Â Â Â Â Â Â Â |
---|
2543 |        CALL get_variable( id_topo, 'building_id', building_id_f%var,   & |
---|
2544 |                 nxl, nxr, nys, nyn ) |
---|
2545 | Â Â Â Â Â ELSE |
---|
2546 |        building_id_f%from_file = .FALSE. |
---|
2547 | Â Â Â Â Â ENDIF |
---|
2548 | ! |
---|
2549 | !--Â Â Â Â Read building_type and required attributes. |
---|
2550 |      IF ( check_existence( var_names, 'building_type' ) ) THEN |
---|
2551 |        building_type_f%from_file = .TRUE. |
---|
2552 |        CALL get_attribute( id_topo, char_fill,              & |
---|
2553 |                  building_type_f%fill, .FALSE.,        & |
---|
2554 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'building_type'Â ) |
---|
2555 | |
---|
2556 | Â Â Â Â Â Â Â ALLOCATEÂ (Â building_type_f%var(nys:nyn,nxl:nxr)Â ) |
---|
2557 | |
---|
2558 |        CALL get_variable( id_topo, 'building_type', building_type_f%var, & |
---|
2559 |                 nxl, nxr, nys, nyn ) |
---|
2560 | |
---|
2561 | Â Â Â Â Â ELSE |
---|
2562 |        building_type_f%from_file = .FALSE. |
---|
2563 | Â Â Â Â Â ENDIF |
---|
2564 | ! |
---|
2565 | !--Â Â Â Â Close topography input file |
---|
2566 |      CALL close_input_file( id_topo ) |
---|
2567 | #else |
---|
2568 | Â Â Â Â Â CONTINUE |
---|
2569 | #endif |
---|
2570 | ! |
---|
2571 | !--Â Â ASCII input |
---|
2572 |     ELSEIF ( TRIM( topography ) == 'read_from_file' ) THEN |
---|
2573 | Â Â Â Â Â Â Â |
---|
2574 |      DO ii = 0, io_blocks-1 |
---|
2575 |        IF ( ii == io_group ) THEN |
---|
2576 | |
---|
2577 |         OPEN( 90, FILE='TOPOGRAPHY_DATA'//TRIM( coupling_char ),    & |
---|
2578 |            STATUS='OLD', FORM='FORMATTED', ERR=10 ) |
---|
2579 | ! |
---|
2580 | !--Â Â Â Â Â Â Â Read topography PE-wise. Rows are read from nyn to nys, columns |
---|
2581 | !--Â Â Â Â Â Â Â are read from nxl to nxr. At first, ny-nyn rows need to be skipped. |
---|
2582 |         skip_n_rows = 0 |
---|
2583 |         DO WHILE ( skip_n_rows < ny - nyn ) |
---|
2584 |           READ( 90, * ) |
---|
2585 |           skip_n_rows = skip_n_rows + 1 |
---|
2586 | Â Â Â Â Â Â Â Â ENDDO |
---|
2587 | ! |
---|
2588 | !--Â Â Â Â Â Â Â Read data from nyn to nys and nxl to nxr. Therefore, skip |
---|
2589 | !--Â Â Â Â Â Â Â column until nxl-1 is reached |
---|
2590 | Â Â Â Â Â Â Â Â ALLOCATEÂ (Â buildings_f%var_2d(nys:nyn,nxl:nxr)Â ) |
---|
2591 |         DO j = nyn, nys, -1 |
---|
2592 |           READ( 90, *, ERR=11, END=11 )                & |
---|
2593 |                   ( dum, i = 0, nxl-1 ),           & |
---|
2594 |                   ( buildings_f%var_2d(j,i), i = nxl, nxr ) |
---|
2595 | Â Â Â Â Â Â Â Â ENDDO |
---|
2596 | |
---|
2597 | Â Â Â Â Â Â Â Â GOTO 12 |
---|
2598 | |
---|
2599 |  10       message_string = 'file TOPOGRAPHY_DATA'//           & |
---|
2600 |                  TRIM( coupling_char )// ' does not exist' |
---|
2601 |         CALL message( 'netcdf_data_input_mod', 'PA0208', 1, 2, 0, 6, 0 ) |
---|
2602 | |
---|
2603 |  11       message_string = 'errors in file TOPOGRAPHY_DATA'//      & |
---|
2604 |                  TRIM( coupling_char ) |
---|
2605 |         CALL message( 'netcdf_data_input_mod', 'PA0209', 2, 2, 0, 6, 0 ) |
---|
2606 | |
---|
2607 | Â 12Â Â Â Â Â Â Â CLOSE(Â 90Â ) |
---|
2608 |         buildings_f%from_file = .TRUE. |
---|
2609 | |
---|
2610 | Â Â Â Â Â Â Â ENDIF |
---|
2611 | #if defined( __parallel ) |
---|
2612 |        CALL MPI_BARRIER( comm2d, ierr ) |
---|
2613 | #endif |
---|
2614 | Â Â Â Â Â ENDDO |
---|
2615 | |
---|
2616 | Â Â Â Â ENDIF |
---|
2617 | ! |
---|
2618 | !--Â Â End of CPU measurement |
---|
2619 |     CALL cpu_log( log_point_s(83), 'NetCDF/ASCII input topo', 'stop' ) |
---|
2620 | ! |
---|
2621 | !--Â Â Check for minimum requirement to setup building topography. If buildings |
---|
2622 | !--Â Â are provided, also an ID and a type are required. |
---|
2623 | !--Â Â Note, doing this check in check_parameters |
---|
2624 | !--Â Â will be too late (data will be used for grid inititialization before). |
---|
2625 |     IF ( input_pids_static ) THEN |
---|
2626 |      IF ( buildings_f%from_file .AND.                  & |
---|
2627 |         .NOT. building_id_f%from_file ) THEN |
---|
2628 |        message_string = 'If building heigths are prescribed in ' //   & |
---|
2629 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'static input file, also an ID is required.' |
---|
2630 |        CALL message( 'netcdf_data_input_mod', 'PA0542', 1, 2, 0, 6, 0 ) |
---|
2631 | Â Â Â Â Â ENDIF |
---|
2632 | Â Â Â Â ENDIF |
---|
2633 | ! |
---|
2634 | !--Â Â In case no terrain height is provided by static input file, allocate |
---|
2635 | !--Â Â array nevertheless and set terrain height to 0, which simplifies |
---|
2636 | !--Â Â topography initialization. |
---|
2637 |     IF ( .NOT. terrain_height_f%from_file ) THEN |
---|
2638 | Â Â Â Â Â ALLOCATEÂ (Â terrain_height_f%var(nys:nyn,nxl:nxr)Â ) |
---|
2639 |      terrain_height_f%var = 0.0_wp |
---|
2640 | Â Â Â Â ENDIF |
---|
2641 | ! |
---|
2642 | !--Â Â Finally, exchange 1 ghost point for building ID and type. |
---|
2643 | !--Â Â In case of non-cyclic boundary conditions set Neumann conditions at the |
---|
2644 | !--Â Â lateral boundaries. |
---|
2645 |     IF ( building_id_f%from_file ) THEN |
---|
2646 |      CALL resize_array_2d_int32( building_id_f%var, nys, nyn, nxl, nxr ) |
---|
2647 |      CALL exchange_horiz_2d_int( building_id_f%var, nys, nyn, nxl, nxr,  & |
---|
2648 |                    nbgp ) |
---|
2649 | Â Â Â Â ENDIF |
---|
2650 | |
---|
2651 |     IF ( building_type_f%from_file ) THEN |
---|
2652 |      CALL resize_array_2d_int8( building_type_f%var, nys, nyn, nxl, nxr ) |
---|
2653 |      CALL exchange_horiz_2d_byte( building_type_f%var, nys, nyn, nxl, nxr,  & |
---|
2654 |                     nbgp ) |
---|
2655 | Â Â Â Â ENDIF |
---|
2656 | |
---|
2657 | Â Â END SUBROUTINE netcdf_data_input_topo |
---|
2658 | |
---|
2659 | !------------------------------------------------------------------------------! |
---|
2660 | ! Description: |
---|
2661 | ! ------------ |
---|
2662 | !> Reads initialization data of u, v, w, pt, q, geostrophic wind components, |
---|
2663 | !> as well as soil moisture and soil temperature, derived from larger-scale |
---|
2664 | !> model (COSMO) by Inifor. |
---|
2665 | !------------------------------------------------------------------------------! |
---|
2666 | Â Â SUBROUTINE netcdf_data_input_init_3d |
---|
2667 | |
---|
2668 |     USE arrays_3d,                             & |
---|
2669 |       ONLY: q, pt, u, v, w, zu, zw |
---|
2670 | |
---|
2671 |     USE control_parameters,                         & |
---|
2672 |       ONLY: bc_lr_cyc, bc_ns_cyc, humidity, message_string, neutral |
---|
2673 | |
---|
2674 |     USE indices,                              & |
---|
2675 |       ONLY: nx, nxl, nxlu, nxr, ny, nyn, nys, nysv, nzb, nz, nzt |
---|
2676 | |
---|
2677 | Â Â Â Â IMPLICIT NONE |
---|
2678 | |
---|
2679 |     CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: var_names |
---|
2680 | |
---|
2681 |     LOGICAL   :: dynamic_3d = .TRUE. !< flag indicating that 3D data is read from dynamic file |
---|
2682 | Â Â Â Â |
---|
2683 |     INTEGER(iwp) :: id_dynamic !< NetCDF id of dynamic input file |
---|
2684 |     INTEGER(iwp) :: num_vars  !< number of variables in netcdf input file |
---|
2685 | |
---|
2686 |     LOGICAL   :: check_passed !< flag indicating if a check passed |
---|
2687 | |
---|
2688 | ! |
---|
2689 | !--Â Â Skip routine if no input file with dynamic input data is available. |
---|
2690 |     IF ( .NOT. input_pids_dynamic ) RETURN |
---|
2691 | ! |
---|
2692 | !--Â Â Please note, Inifor is designed to provide initial data for u and v for |
---|
2693 | !--Â Â the prognostic grid points in case of lateral Dirichlet conditions. |
---|
2694 | !--Â Â This means that Inifor provides data from nxlu:nxr (for u) and |
---|
2695 | !--Â Â from nysv:nyn (for v) at the left and south domain boundary, respectively. |
---|
2696 | !--Â Â However, as work-around for the moment, PALM will run with cyclic |
---|
2697 | !--Â Â conditions and will be initialized with data provided by Inifor |
---|
2698 | !--Â Â boundaries in case of Dirichlet. |
---|
2699 | !--Â Â Hence, simply set set nxlu/nysv to 1 (will be reset to its original value |
---|
2700 | !--Â Â at the end of this routine. |
---|
2701 |     IF ( bc_lr_cyc .AND. nxl == 0 ) nxlu = 1 |
---|
2702 |     IF ( bc_ns_cyc .AND. nys == 0 ) nysv = 1 |
---|
2703 | |
---|
2704 | ! |
---|
2705 | !--Â Â CPU measurement |
---|
2706 |     CALL cpu_log( log_point_s(85), 'NetCDF input init', 'start' ) |
---|
2707 | |
---|
2708 | #if defined ( __netcdf ) |
---|
2709 | ! |
---|
2710 | !--Â Â Open file in read-only mode |
---|
2711 |     CALL open_read_file( TRIM( input_file_dynamic ) //           & |
---|
2712 |               TRIM( coupling_char ), id_dynamic ) |
---|
2713 | |
---|
2714 | ! |
---|
2715 | !--Â Â At first, inquire all variable names. |
---|
2716 |     CALL inquire_num_variables( id_dynamic, num_vars ) |
---|
2717 | ! |
---|
2718 | !--Â Â Allocate memory to store variable names. |
---|
2719 | Â Â Â Â ALLOCATE(Â var_names(1:num_vars)Â ) |
---|
2720 |     CALL inquire_variable_names( id_dynamic, var_names ) |
---|
2721 | ! |
---|
2722 | !--Â Â Read vertical dimension of scalar und w grid. |
---|
2723 |     CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%nzu, 'z'   ) |
---|
2724 |     CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%nzw, 'zw'  ) |
---|
2725 | ! |
---|
2726 | !--Â Â Read also the horizontal dimensions. These are used just used fo |
---|
2727 | !--Â Â checking the compatibility with the PALM grid before reading. |
---|
2728 |     CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%nx, 'x' ) |
---|
2729 |     CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%nxu, 'xu' ) |
---|
2730 |     CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%ny, 'y' ) |
---|
2731 |     CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%nyv, 'yv' ) |
---|
2732 | |
---|
2733 | ! |
---|
2734 | !--Â Â Check for correct horizontal and vertical dimension. Please note, |
---|
2735 | !--Â Â checks are performed directly here and not called from |
---|
2736 | !--Â Â check_parameters as some varialbes are still not allocated there. |
---|
2737 | !--Â Â Moreover, please note, u- and v-grid has 1 grid point less on |
---|
2738 | !--Â Â Inifor grid. |
---|
2739 |     IF ( init_3d%nx-1 /= nx .OR. init_3d%nxu-1 /= nx - 1 .OR.      & |
---|
2740 |       init_3d%ny-1 /= ny .OR. init_3d%nyv-1 /= ny - 1 ) THEN |
---|
2741 |      message_string = 'Number of inifor horizontal grid points '//    & |
---|
2742 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'does not match the number of numeric grid '//Â Â Â & |
---|
2743 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'points.' |
---|
2744 |      CALL message( 'netcdf_data_input_mod', 'PA0543', 1, 2, 0, 6, 0 ) |
---|
2745 | Â Â Â Â ENDIF |
---|
2746 | |
---|
2747 |     IF ( init_3d%nzu /= nz ) THEN |
---|
2748 |      message_string = 'Number of inifor vertical grid points ' //     & |
---|
2749 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'does not match the number of numeric grid '//Â Â Â & |
---|
2750 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'points.' |
---|
2751 |      CALL message( 'netcdf_data_input_mod', 'PA0543', 1, 2, 0, 6, 0 ) |
---|
2752 | Â Â Â Â ENDIF |
---|
2753 | ! |
---|
2754 | !--Â Â Read vertical dimensions. Later, these are required for eventual |
---|
2755 | !--Â Â inter- and extrapolations of the initialization data. |
---|
2756 |     IF ( check_existence( var_names, 'z' ) ) THEN |
---|
2757 | Â Â Â Â Â ALLOCATE(Â init_3d%zu_atmos(1:init_3d%nzu)Â ) |
---|
2758 |      CALL get_variable( id_dynamic, 'z', init_3d%zu_atmos ) |
---|
2759 | Â Â Â Â ENDIF |
---|
2760 |     IF ( check_existence( var_names, 'zw' ) ) THEN |
---|
2761 | Â Â Â Â Â ALLOCATE(Â init_3d%zw_atmos(1:init_3d%nzw)Â ) |
---|
2762 |      CALL get_variable( id_dynamic, 'zw', init_3d%zw_atmos ) |
---|
2763 | Â Â Â Â ENDIF |
---|
2764 | ! |
---|
2765 | !--Â Â Check for consistency between vertical coordinates in dynamic |
---|
2766 | !--Â Â driver and numeric grid. |
---|
2767 | !--Â Â Please note, depending on compiler options both may be |
---|
2768 | !--Â Â equal up to a certain threshold, and differences between |
---|
2769 | !--Â Â the numeric grid and vertical coordinate in the driver can built- |
---|
2770 | !--Â Â up to 10E-1-10E-0 m. For this reason, the check is performed not |
---|
2771 | !--Â Â for exactly matching values. |
---|
2772 | Â Â Â Â IFÂ (Â ANY(Â ABS(Â zu(1:nzt)Â Â -Â init_3d%zu_atmos(1:init_3d%nzu)Â )Â Â & |
---|
2773 |            > 10E-1 ) .OR.                  & |
---|
2774 | Â Â Â Â Â Â ANY(Â ABS(Â zw(1:nzt-1)Â -Â init_3d%zw_atmos(1:init_3d%nzw)Â )Â Â & |
---|
2775 | Â Â Â Â Â Â Â Â Â Â Â >Â 10E-1Â )Â )Â THEN |
---|
2776 |      message_string = 'Vertical grid in dynamic driver does not '// & |
---|
2777 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'match the numeric grid.' |
---|
2778 |      CALL message( 'netcdf_data_input_mod', 'PA0543', 1, 2, 0, 6, 0 ) |
---|
2779 | Â Â Â Â ENDIF |
---|
2780 | ! |
---|
2781 | !--Â Â Read initial geostrophic wind components at |
---|
2782 | !--Â Â t = 0 (index 1 in file). |
---|
2783 |     IF ( check_existence( var_names, 'ls_forcing_ug' ) ) THEN |
---|
2784 | Â Â Â Â Â ALLOCATE(Â init_3d%ug_init(nzb:nzt+1)Â ) |
---|
2785 |      init_3d%ug_init = 0.0_wp |
---|
2786 | |
---|
2787 |      CALL get_variable_pr( id_dynamic, 'ls_forcing_ug', 1,     & |
---|
2788 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%ug_init(1:nzt)Â ) |
---|
2789 | ! |
---|
2790 | !--Â Â Â Â Set top-boundary condition (Neumann) |
---|
2791 | Â Â Â Â Â init_3d%ug_init(nzt+1)Â =Â init_3d%ug_init(nzt) |
---|
2792 | |
---|
2793 |      init_3d%from_file_ug = .TRUE. |
---|
2794 | Â Â Â Â ELSE |
---|
2795 |      init_3d%from_file_ug = .FALSE. |
---|
2796 | Â Â Â Â ENDIF |
---|
2797 |     IF ( check_existence( var_names, 'ls_forcing_vg' ) ) THEN |
---|
2798 | Â Â Â Â Â ALLOCATE(Â init_3d%vg_init(nzb:nzt+1)Â ) |
---|
2799 |      init_3d%vg_init = 0.0_wp |
---|
2800 | |
---|
2801 |      CALL get_variable_pr( id_dynamic, 'ls_forcing_vg', 1,     & |
---|
2802 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%vg_init(1:nzt)Â ) |
---|
2803 | ! |
---|
2804 | !--Â Â Â Â Set top-boundary condition (Neumann) |
---|
2805 | Â Â Â Â Â init_3d%vg_init(nzt+1)Â =Â init_3d%vg_init(nzt) |
---|
2806 | |
---|
2807 |      init_3d%from_file_vg = .TRUE. |
---|
2808 | Â Â Â Â ELSE |
---|
2809 |      init_3d%from_file_vg = .FALSE. |
---|
2810 | Â Â Â Â ENDIF |
---|
2811 | ! |
---|
2812 | !--Â Â Read inital 3D data of u, v, w, pt and q, |
---|
2813 | !--Â Â derived from COSMO model. Read PE-wise yz-slices. |
---|
2814 | !--Â Â Please note, the u-, v- and w-component are defined on different |
---|
2815 | !--Â Â grids with one element less in the x-, y-, |
---|
2816 | !--Â Â and z-direction, respectively. Hence, reading is subdivided |
---|
2817 | !--  into separate loops. |
---|
2818 | !--Â Â Read u-component |
---|
2819 |     IF ( check_existence( var_names, 'init_atmosphere_u' ) ) THEN |
---|
2820 | ! |
---|
2821 | !--Â Â Â Â Read attributes for the fill value and level-of-detail |
---|
2822 |      CALL get_attribute( id_dynamic, char_fill, init_3d%fill_u,      & |
---|
2823 |                .FALSE., 'init_atmosphere_u' ) |
---|
2824 |      CALL get_attribute( id_dynamic, char_lod, init_3d%lod_u,       & |
---|
2825 |                .FALSE., 'init_atmosphere_u' ) |
---|
2826 | ! |
---|
2827 | !--Â Â Â Â level-of-detail 1 - read initialization profile |
---|
2828 |      IF ( init_3d%lod_u == 1 ) THEN |
---|
2829 | Â Â Â Â Â Â Â ALLOCATE(Â init_3d%u_init(nzb:nzt+1)Â ) |
---|
2830 |        init_3d%u_init = 0.0_wp |
---|
2831 | |
---|
2832 |        CALL get_variable( id_dynamic, 'init_atmosphere_u',        & |
---|
2833 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%u_init(nzb+1:nzt)Â ) |
---|
2834 | ! |
---|
2835 | !--Â Â Â Â Â Set top-boundary condition (Neumann) |
---|
2836 | Â Â Â Â Â Â Â init_3d%u_init(nzt+1)Â =Â init_3d%u_init(nzt) |
---|
2837 | ! |
---|
2838 | !--Â Â Â Â level-of-detail 2 - read 3D initialization data |
---|
2839 |      ELSEIF ( init_3d%lod_u == 2 ) THEN |
---|
2840 |        CALL get_variable( id_dynamic, 'init_atmosphere_u',        & |
---|
2841 |                 u(nzb+1:nzt,nys:nyn,nxlu:nxr),         & |
---|
2842 |                 nxlu, nys+1, nzb+1,              & |
---|
2843 |                 nxr-nxlu+1, nyn-nys+1, init_3d%nzu,      & |
---|
2844 |                 dynamic_3d ) |
---|
2845 | ! |
---|
2846 | !--Â Â Â Â Â Set value at leftmost model grid point nxl = 0. This is because |
---|
2847 | !--Â Â Â Â Â Inifor provides data only from 1:nx-1 since it assumes non-cyclic |
---|
2848 | !--Â Â Â Â Â conditions. |
---|
2849 |        IF ( nxl == 0 )                          & |
---|
2850 | Â Â Â Â Â Â Â Â u(nzb+1:nzt,nys:nyn,nxl)Â =Â u(nzb+1:nzt,nys:nyn,nxlu) |
---|
2851 | ! |
---|
2852 | !--Â Â Â Â Â Set bottom and top-boundary |
---|
2853 | Â Â Â Â Â Â Â u(nzb,:,:)Â Â =Â u(nzb+1,:,:) |
---|
2854 | Â Â Â Â Â Â Â u(nzt+1,:,:)Â =Â u(nzt,:,:) |
---|
2855 | Â Â Â Â Â Â Â |
---|
2856 | Â Â Â Â Â ENDIF |
---|
2857 |      init_3d%from_file_u = .TRUE. |
---|
2858 | Â Â Â Â ELSE |
---|
2859 |      message_string = 'Missing initial data for u-component' |
---|
2860 |      CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 ) |
---|
2861 | Â Â Â Â ENDIF |
---|
2862 | ! |
---|
2863 | !--Â Â Read v-component |
---|
2864 |     IF ( check_existence( var_names, 'init_atmosphere_v' ) ) THEN |
---|
2865 | ! |
---|
2866 | !--Â Â Â Â Read attributes for the fill value and level-of-detail |
---|
2867 |      CALL get_attribute( id_dynamic, char_fill, init_3d%fill_v,      & |
---|
2868 |                .FALSE., 'init_atmosphere_v' ) |
---|
2869 |      CALL get_attribute( id_dynamic, char_lod, init_3d%lod_v,       & |
---|
2870 |                .FALSE., 'init_atmosphere_v' ) |
---|
2871 | ! |
---|
2872 | !--Â Â Â Â level-of-detail 1 - read initialization profile |
---|
2873 |      IF ( init_3d%lod_v == 1 ) THEN |
---|
2874 | Â Â Â Â Â Â Â ALLOCATE(Â init_3d%v_init(nzb:nzt+1)Â ) |
---|
2875 |        init_3d%v_init = 0.0_wp |
---|
2876 | |
---|
2877 |        CALL get_variable( id_dynamic, 'init_atmosphere_v',        & |
---|
2878 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%v_init(nzb+1:nzt)Â ) |
---|
2879 | ! |
---|
2880 | !--Â Â Â Â Â Set top-boundary condition (Neumann) |
---|
2881 | Â Â Â Â Â Â Â init_3d%v_init(nzt+1)Â =Â init_3d%v_init(nzt) |
---|
2882 | ! |
---|
2883 | !--Â Â Â Â level-of-detail 2 - read 3D initialization data |
---|
2884 |      ELSEIF ( init_3d%lod_v == 2 ) THEN |
---|
2885 | Â Â Â Â Â |
---|
2886 |        CALL get_variable( id_dynamic, 'init_atmosphere_v',        & |
---|
2887 |                 v(nzb+1:nzt,nysv:nyn,nxl:nxr),         & |
---|
2888 |                 nxl+1, nysv, nzb+1,              & |
---|
2889 |                 nxr-nxl+1, nyn-nysv+1, init_3d%nzu,      & |
---|
2890 |                 dynamic_3d ) |
---|
2891 | ! |
---|
2892 | !--Â Â Â Â Â Set value at southmost model grid point nys = 0. This is because |
---|
2893 | !--Â Â Â Â Â Inifor provides data only from 1:ny-1 since it assumes non-cyclic |
---|
2894 | !--Â Â Â Â Â conditions. |
---|
2895 |        IF ( nys == 0 )                          & |
---|
2896 | Â Â Â Â Â Â Â Â v(nzb+1:nzt,nys,nxl:nxr)Â =Â v(nzb+1:nzt,nysv,nxl:nxr)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
2897 | ! |
---|
2898 | !--Â Â Â Â Â Set bottom and top-boundary |
---|
2899 | Â Â Â Â Â Â Â v(nzb,:,:)Â Â =Â v(nzb+1,:,:) |
---|
2900 | Â Â Â Â Â Â Â v(nzt+1,:,:)Â =Â v(nzt,:,:) |
---|
2901 | Â Â Â Â Â Â Â |
---|
2902 | Â Â Â Â Â ENDIF |
---|
2903 |      init_3d%from_file_v = .TRUE. |
---|
2904 | Â Â Â Â ELSE |
---|
2905 |      message_string = 'Missing initial data for v-component' |
---|
2906 |      CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 ) |
---|
2907 | Â Â Â Â ENDIF |
---|
2908 | ! |
---|
2909 | !--Â Â Read w-component |
---|
2910 |     IF ( check_existence( var_names, 'init_atmosphere_w' ) ) THEN |
---|
2911 | ! |
---|
2912 | !--Â Â Â Â Read attributes for the fill value and level-of-detail |
---|
2913 |      CALL get_attribute( id_dynamic, char_fill, init_3d%fill_w,      & |
---|
2914 |                .FALSE., 'init_atmosphere_w' ) |
---|
2915 |      CALL get_attribute( id_dynamic, char_lod, init_3d%lod_w,       & |
---|
2916 |                .FALSE., 'init_atmosphere_w' ) |
---|
2917 | ! |
---|
2918 | !--Â Â Â Â level-of-detail 1 - read initialization profile |
---|
2919 |      IF ( init_3d%lod_w == 1 ) THEN |
---|
2920 | Â Â Â Â Â Â Â ALLOCATE(Â init_3d%w_init(nzb:nzt+1)Â ) |
---|
2921 |        init_3d%w_init = 0.0_wp |
---|
2922 | |
---|
2923 |        CALL get_variable( id_dynamic, 'init_atmosphere_w',        & |
---|
2924 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%w_init(nzb+1:nzt-1)Â ) |
---|
2925 | ! |
---|
2926 | !--Â Â Â Â Â Set top-boundary condition (Neumann) |
---|
2927 | Â Â Â Â Â Â Â init_3d%w_init(nzt:nzt+1)Â =Â init_3d%w_init(nzt-1) |
---|
2928 | ! |
---|
2929 | !--Â Â Â Â level-of-detail 2 - read 3D initialization data |
---|
2930 |      ELSEIF ( init_3d%lod_w == 2 ) THEN |
---|
2931 | |
---|
2932 |        CALL get_variable( id_dynamic, 'init_atmosphere_w',        & |
---|
2933 |                 w(nzb+1:nzt-1,nys:nyn,nxl:nxr),         & |
---|
2934 |                 nxl+1, nys+1, nzb+1,              & |
---|
2935 |                 nxr-nxl+1, nyn-nys+1, init_3d%nzw,       & |
---|
2936 |                 dynamic_3d ) |
---|
2937 | ! |
---|
2938 | !--     Set bottom and top-boundary                |
---|
2939 |        w(nzb,:,:)  = 0.0_wp |
---|
2940 | Â Â Â Â Â Â Â w(nzt,:,:)Â Â =Â w(nzt-1,:,:) |
---|
2941 | Â Â Â Â Â Â Â w(nzt+1,:,:)Â =Â w(nzt-1,:,:) |
---|
2942 | |
---|
2943 | Â Â Â Â Â ENDIF |
---|
2944 |      init_3d%from_file_w = .TRUE. |
---|
2945 | Â Â Â Â ELSE |
---|
2946 |      message_string = 'Missing initial data for w-component' |
---|
2947 |      CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 ) |
---|
2948 | Â Â Â Â ENDIF |
---|
2949 | ! |
---|
2950 | !--Â Â Read potential temperature |
---|
2951 |     IF ( .NOT. neutral ) THEN |
---|
2952 |      IF ( check_existence( var_names, 'init_atmosphere_pt' ) ) THEN |
---|
2953 | ! |
---|
2954 | !--Â Â Â Â Â Read attributes for the fill value and level-of-detail |
---|
2955 |        CALL get_attribute( id_dynamic, char_fill, init_3d%fill_pt,    & |
---|
2956 |                  .FALSE., 'init_atmosphere_pt' ) |
---|
2957 |        CALL get_attribute( id_dynamic, char_lod, init_3d%lod_pt,     & |
---|
2958 |                  .FALSE., 'init_atmosphere_pt' ) |
---|
2959 | ! |
---|
2960 | !--Â Â Â Â Â level-of-detail 1 - read initialization profile |
---|
2961 |        IF ( init_3d%lod_pt == 1 ) THEN |
---|
2962 | Â Â Â Â Â Â Â Â ALLOCATE(Â init_3d%pt_init(nzb:nzt+1)Â ) |
---|
2963 | |
---|
2964 |         CALL get_variable( id_dynamic, 'init_atmosphere_pt',      & |
---|
2965 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%pt_init(nzb+1:nzt)Â ) |
---|
2966 | ! |
---|
2967 | !--Â Â Â Â Â Â Â Set Neumann top and surface boundary condition for initial |
---|
2968 | !--Â Â Â Â Â Â Â profil |
---|
2969 | Â Â Â Â Â Â Â Â init_3d%pt_init(nzb)Â Â =Â init_3d%pt_init(nzb+1) |
---|
2970 | Â Â Â Â Â Â Â Â init_3d%pt_init(nzt+1)Â =Â init_3d%pt_init(nzt) |
---|
2971 | ! |
---|
2972 | !--Â Â Â Â Â level-of-detail 2 - read 3D initialization data |
---|
2973 |        ELSEIF ( init_3d%lod_pt == 2 ) THEN |
---|
2974 | |
---|
2975 |         CALL get_variable( id_dynamic, 'init_atmosphere_pt',      & |
---|
2976 |                   pt(nzb+1:nzt,nys:nyn,nxl:nxr),       & |
---|
2977 |                   nxl+1, nys+1, nzb+1,            & |
---|
2978 |                   nxr-nxl+1, nyn-nys+1, init_3d%nzu,     & |
---|
2979 |                   dynamic_3d ) |
---|
2980 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
2981 | ! |
---|
2982 | !--Â Â Â Â Â Â Â Set bottom and top-boundary |
---|
2983 | Â Â Â Â Â Â Â Â pt(nzb,:,:)Â Â =Â pt(nzb+1,:,:) |
---|
2984 | Â Â Â Â Â Â Â Â pt(nzt+1,:,:)Â =Â pt(nzt,:,:)Â Â Â Â Â Â Â |
---|
2985 | |
---|
2986 | Â Â Â Â Â Â Â ENDIF |
---|
2987 |        init_3d%from_file_pt = .TRUE. |
---|
2988 | Â Â Â Â Â ELSE |
---|
2989 |        message_string = 'Missing initial data for ' //          & |
---|
2990 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'potential temperature' |
---|
2991 |        CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 ) |
---|
2992 | Â Â Â Â Â ENDIF |
---|
2993 | Â Â Â Â ENDIF |
---|
2994 | ! |
---|
2995 | !--Â Â Read mixing ratio |
---|
2996 |     IF ( humidity ) THEN |
---|
2997 |      IF ( check_existence( var_names, 'init_atmosphere_qv' ) ) THEN |
---|
2998 | ! |
---|
2999 | !--Â Â Â Â Â Read attributes for the fill value and level-of-detail |
---|
3000 |        CALL get_attribute( id_dynamic, char_fill, init_3d%fill_q,    & |
---|
3001 |                  .FALSE., 'init_atmosphere_qv' ) |
---|
3002 |        CALL get_attribute( id_dynamic, char_lod, init_3d%lod_q,     & |
---|
3003 |                  .FALSE., 'init_atmosphere_qv' ) |
---|
3004 | ! |
---|
3005 | !--Â Â Â Â Â level-of-detail 1 - read initialization profile |
---|
3006 |        IF ( init_3d%lod_q == 1 ) THEN |
---|
3007 | Â Â Â Â Â Â Â Â ALLOCATE(Â init_3d%q_init(nzb:nzt+1)Â ) |
---|
3008 | |
---|
3009 |         CALL get_variable( id_dynamic, 'init_atmosphere_qv',      & |
---|
3010 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%q_init(nzb+1:nzt)Â ) |
---|
3011 | ! |
---|
3012 | !--Â Â Â Â Â Â Â Set bottom and top boundary condition (Neumann) |
---|
3013 | Â Â Â Â Â Â Â Â init_3d%q_init(nzb)Â Â =Â init_3d%q_init(nzb+1) |
---|
3014 | Â Â Â Â Â Â Â Â init_3d%q_init(nzt+1)Â =Â init_3d%q_init(nzt) |
---|
3015 | ! |
---|
3016 | !--Â Â Â Â Â level-of-detail 2 - read 3D initialization data |
---|
3017 |        ELSEIF ( init_3d%lod_q == 2 ) THEN |
---|
3018 | Â Â Â Â Â Â Â |
---|
3019 |         CALL get_variable( id_dynamic, 'init_atmosphere_qv',      & |
---|
3020 |                   q(nzb+1:nzt,nys:nyn,nxl:nxr),        & |
---|
3021 |                   nxl+1, nys+1, nzb+1,            & |
---|
3022 |                   nxr-nxl+1, nyn-nys+1, init_3d%nzu,     & |
---|
3023 |                   dynamic_3d ) |
---|
3024 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3025 | ! |
---|
3026 | !--Â Â Â Â Â Â Â Set bottom and top-boundary |
---|
3027 | Â Â Â Â Â Â Â Â q(nzb,:,:)Â Â =Â q(nzb+1,:,:) |
---|
3028 | Â Â Â Â Â Â Â Â q(nzt+1,:,:)Â =Â q(nzt,:,:) |
---|
3029 | Â Â Â Â Â Â Â Â |
---|
3030 | Â Â Â Â Â Â Â ENDIF |
---|
3031 |        init_3d%from_file_q = .TRUE. |
---|
3032 | Â Â Â Â Â ELSE |
---|
3033 |        message_string = 'Missing initial data for ' //          & |
---|
3034 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'mixing ratio' |
---|
3035 |        CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 ) |
---|
3036 | Â Â Â Â Â ENDIF |
---|
3037 | Â Â Â Â ENDIF |
---|
3038 | ! |
---|
3039 | !--Â Â Close input file |
---|
3040 |     CALL close_input_file( id_dynamic ) |
---|
3041 | #endif |
---|
3042 | ! |
---|
3043 | !--Â Â End of CPU measurement |
---|
3044 |     CALL cpu_log( log_point_s(85), 'NetCDF input init', 'stop' ) |
---|
3045 | ! |
---|
3046 | !--Â Â Finally, check if the input data has any fill values. Please note, |
---|
3047 | !--Â Â checks depend on the LOD of the input data. |
---|
3048 |     IF ( init_3d%from_file_u ) THEN |
---|
3049 |      check_passed = .TRUE. |
---|
3050 |      IF ( init_3d%lod_u == 1 ) THEN |
---|
3051 |        IF ( ANY( init_3d%u_init(nzb+1:nzt+1) == init_3d%fill_u ) )    & |
---|
3052 |         check_passed = .FALSE. |
---|
3053 |      ELSEIF ( init_3d%lod_u == 2 ) THEN |
---|
3054 |        IF ( ANY( u(nzb+1:nzt+1,nys:nyn,nxlu:nxr) == init_3d%fill_u ) )  & |
---|
3055 |         check_passed = .FALSE. |
---|
3056 | Â Â Â Â Â ENDIF |
---|
3057 |      IF ( .NOT. check_passed ) THEN |
---|
3058 |        message_string = 'NetCDF input for init_atmosphere_u must ' //  & |
---|
3059 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'not contain any _FillValues' |
---|
3060 |        CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 ) |
---|
3061 | Â Â Â Â Â ENDIF |
---|
3062 | Â Â Â Â ENDIF |
---|
3063 | |
---|
3064 |     IF ( init_3d%from_file_v ) THEN |
---|
3065 |      check_passed = .TRUE. |
---|
3066 |      IF ( init_3d%lod_v == 1 ) THEN |
---|
3067 |        IF ( ANY( init_3d%v_init(nzb+1:nzt+1) == init_3d%fill_v ) )    & |
---|
3068 |         check_passed = .FALSE. |
---|
3069 |      ELSEIF ( init_3d%lod_v == 2 ) THEN |
---|
3070 |        IF ( ANY( v(nzb+1:nzt+1,nysv:nyn,nxl:nxr) == init_3d%fill_v ) )  & |
---|
3071 |         check_passed = .FALSE. |
---|
3072 | Â Â Â Â Â ENDIF |
---|
3073 |      IF ( .NOT. check_passed ) THEN |
---|
3074 |        message_string = 'NetCDF input for init_atmosphere_v must ' //  & |
---|
3075 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'not contain any _FillValues' |
---|
3076 |        CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 ) |
---|
3077 | Â Â Â Â Â ENDIF |
---|
3078 | Â Â Â Â ENDIF |
---|
3079 | |
---|
3080 |     IF ( init_3d%from_file_w ) THEN |
---|
3081 |      check_passed = .TRUE. |
---|
3082 |      IF ( init_3d%lod_w == 1 ) THEN |
---|
3083 |        IF ( ANY( init_3d%w_init(nzb+1:nzt) == init_3d%fill_w ) )     & |
---|
3084 |         check_passed = .FALSE. |
---|
3085 |      ELSEIF ( init_3d%lod_w == 2 ) THEN |
---|
3086 |        IF ( ANY( w(nzb+1:nzt,nys:nyn,nxl:nxr) == init_3d%fill_w ) )   & |
---|
3087 |         check_passed = .FALSE. |
---|
3088 | Â Â Â Â Â ENDIF |
---|
3089 |      IF ( .NOT. check_passed ) THEN |
---|
3090 |        message_string = 'NetCDF input for init_atmosphere_w must ' //  & |
---|
3091 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'not contain any _FillValues' |
---|
3092 |        CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 ) |
---|
3093 | Â Â Â Â Â ENDIF |
---|
3094 | Â Â Â Â ENDIF |
---|
3095 | |
---|
3096 |     IF ( init_3d%from_file_pt ) THEN |
---|
3097 |      check_passed = .TRUE. |
---|
3098 |      IF ( init_3d%lod_pt == 1 ) THEN |
---|
3099 |        IF ( ANY( init_3d%pt_init(nzb+1:nzt+1) == init_3d%fill_pt ) )   & |
---|
3100 |         check_passed = .FALSE. |
---|
3101 |      ELSEIF ( init_3d%lod_pt == 2 ) THEN |
---|
3102 |        IF ( ANY( pt(nzb+1:nzt+1,nys:nyn,nxl:nxr) == init_3d%fill_pt ) ) & |
---|
3103 |         check_passed = .FALSE. |
---|
3104 | Â Â Â Â Â ENDIF |
---|
3105 |      IF ( .NOT. check_passed ) THEN |
---|
3106 |        message_string = 'NetCDF input for init_atmosphere_pt must ' //  & |
---|
3107 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'not contain any _FillValues' |
---|
3108 |        CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 ) |
---|
3109 | Â Â Â Â Â ENDIF |
---|
3110 | Â Â Â Â ENDIF |
---|
3111 | |
---|
3112 |     IF ( init_3d%from_file_q ) THEN |
---|
3113 |      check_passed = .TRUE. |
---|
3114 |      IF ( init_3d%lod_q == 1 ) THEN |
---|
3115 |        IF ( ANY( init_3d%q_init(nzb+1:nzt+1) == init_3d%fill_q ) )    & |
---|
3116 |         check_passed = .FALSE. |
---|
3117 |      ELSEIF ( init_3d%lod_q == 2 ) THEN |
---|
3118 |        IF ( ANY( q(nzb+1:nzt+1,nys:nyn,nxl:nxr) == init_3d%fill_q ) )  & |
---|
3119 |         check_passed = .FALSE. |
---|
3120 | Â Â Â Â Â ENDIF |
---|
3121 |      IF ( .NOT. check_passed ) THEN |
---|
3122 |        message_string = 'NetCDF input for init_atmosphere_q must ' //  & |
---|
3123 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'not contain any _FillValues' |
---|
3124 |        CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 ) |
---|
3125 | Â Â Â Â Â ENDIF |
---|
3126 | Â Â Â Â ENDIF |
---|
3127 | ! |
---|
3128 | !--Â Â Workaround for cyclic conditions. Please see above for further explanation. |
---|
3129 |     IF ( bc_lr_cyc .AND. nxl == 0 ) nxlu = nxl |
---|
3130 |     IF ( bc_ns_cyc .AND. nys == 0 ) nysv = nys |
---|
3131 | |
---|
3132 | Â Â END SUBROUTINE netcdf_data_input_init_3d |
---|
3133 | Â Â |
---|
3134 | !------------------------------------------------------------------------------! |
---|
3135 | ! Description: |
---|
3136 | ! ------------ |
---|
3137 | !> Reads initialization data of u, v, w, pt, q, geostrophic wind components, |
---|
3138 | !> as well as soil moisture and soil temperature, derived from larger-scale |
---|
3139 | !> model (COSMO) by Inifor. |
---|
3140 | !------------------------------------------------------------------------------! |
---|
3141 | Â Â SUBROUTINE netcdf_data_input_init_lsm |
---|
3142 | |
---|
3143 |     USE control_parameters,                         & |
---|
3144 | Â Â Â Â Â Â ONLY:Â message_string |
---|
3145 | |
---|
3146 |     USE indices,                              & |
---|
3147 |       ONLY: nx, nxl, nxr, ny, nyn, nys |
---|
3148 | |
---|
3149 | Â Â Â Â IMPLICIT NONE |
---|
3150 | |
---|
3151 |     CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: var_names !< string containing all variables on file |
---|
3152 | Â Â Â |
---|
3153 |     INTEGER(iwp) :: id_dynamic !< NetCDF id of dynamic input file |
---|
3154 |     INTEGER(iwp) :: num_vars  !< number of variables in netcdf input file |
---|
3155 | |
---|
3156 | ! |
---|
3157 | !--Â Â Skip routine if no input file with dynamic input data is available. |
---|
3158 |     IF ( .NOT. input_pids_dynamic ) RETURN |
---|
3159 | ! |
---|
3160 | !--Â Â CPU measurement |
---|
3161 |     CALL cpu_log( log_point_s(85), 'NetCDF input init', 'start' ) |
---|
3162 | |
---|
3163 | #if defined ( __netcdf ) |
---|
3164 | ! |
---|
3165 | !--Â Â Open file in read-only mode |
---|
3166 |     CALL open_read_file( TRIM( input_file_dynamic ) //           & |
---|
3167 |               TRIM( coupling_char ), id_dynamic ) |
---|
3168 | |
---|
3169 | ! |
---|
3170 | !--Â Â At first, inquire all variable names. |
---|
3171 |     CALL inquire_num_variables( id_dynamic, num_vars ) |
---|
3172 | ! |
---|
3173 | !--Â Â Allocate memory to store variable names. |
---|
3174 | Â Â Â Â ALLOCATE(Â var_names(1:num_vars)Â ) |
---|
3175 |     CALL inquire_variable_names( id_dynamic, var_names ) |
---|
3176 | ! |
---|
3177 | !--Â Â Read vertical dimension for soil depth. |
---|
3178 |     IF ( check_existence( var_names, 'zsoil' ) )              & |
---|
3179 |      CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%nzs,& |
---|
3180 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'zsoil'Â ) |
---|
3181 | ! |
---|
3182 | !--Â Â Read also the horizontal dimensions required for soil initialization. |
---|
3183 | !--Â Â Please note, in case of non-nested runs or in case of root domain, |
---|
3184 | !--Â Â these data is already available, but will be read again for the sake |
---|
3185 | !--Â Â of clearness. |
---|
3186 |     CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%nx,  & |
---|
3187 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'x'Â ) |
---|
3188 |     CALL netcdf_data_input_get_dimension_length( id_dynamic, init_3d%ny,  & |
---|
3189 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'y'Â ) |
---|
3190 | ! |
---|
3191 | !--Â Â Check for correct horizontal and vertical dimension. Please note, |
---|
3192 | !--Â Â in case of non-nested runs or in case of root domain, these checks |
---|
3193 | !--Â Â are already performed |
---|
3194 |     IF ( init_3d%nx-1 /= nx .OR. init_3d%ny-1 /= ny ) THEN |
---|
3195 |      message_string = 'Number of inifor horizontal grid points '//    & |
---|
3196 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'does not match the number of numeric grid points.' |
---|
3197 |      CALL message( 'netcdf_data_input_mod', 'PA0543', 1, 2, 0, 6, 0 ) |
---|
3198 | Â Â Â Â ENDIF |
---|
3199 | ! |
---|
3200 | !--Â Â Read vertical dimensions. Later, these are required for eventual |
---|
3201 | !--Â Â inter- and extrapolations of the initialization data. |
---|
3202 |     IF ( check_existence( var_names, 'zsoil' ) ) THEN |
---|
3203 | Â Â Â Â Â ALLOCATE(Â init_3d%z_soil(1:init_3d%nzs)Â ) |
---|
3204 |      CALL get_variable( id_dynamic, 'zsoil', init_3d%z_soil ) |
---|
3205 | Â Â Â Â ENDIF |
---|
3206 | ! |
---|
3207 | !--Â Â Read initial data for soil moisture |
---|
3208 |     IF ( check_existence( var_names, 'init_soil_m' ) ) THEN |
---|
3209 | ! |
---|
3210 | !--Â Â Â Â Read attributes for the fill value and level-of-detail |
---|
3211 |      CALL get_attribute( id_dynamic, char_fill,              & |
---|
3212 |                init_3d%fill_msoil,               & |
---|
3213 |                .FALSE., 'init_soil_m' ) |
---|
3214 |      CALL get_attribute( id_dynamic, char_lod,              & |
---|
3215 |                init_3d%lod_msoil,                & |
---|
3216 |                .FALSE., 'init_soil_m' ) |
---|
3217 | ! |
---|
3218 | !--Â Â Â Â level-of-detail 1 - read initialization profile |
---|
3219 |      IF ( init_3d%lod_msoil == 1 ) THEN |
---|
3220 | Â Â Â Â Â Â Â ALLOCATE(Â init_3d%msoil_1d(0:init_3d%nzs-1)Â ) |
---|
3221 | |
---|
3222 |        CALL get_variable( id_dynamic, 'init_soil_m',           & |
---|
3223 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%msoil_1d(0:init_3d%nzs-1)Â ) |
---|
3224 | ! |
---|
3225 | !--Â Â Â Â level-of-detail 2 - read 3D initialization data |
---|
3226 |      ELSEIF ( init_3d%lod_msoil == 2 ) THEN |
---|
3227 | Â Â Â Â Â Â Â ALLOCATEÂ (Â init_3d%msoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr)Â ) |
---|
3228 | |
---|
3229 |       CALL get_variable( id_dynamic, 'init_soil_m',           &  |
---|
3230 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%msoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr),& |
---|
3231 |                nxl, nxr, nys, nyn, 0, init_3d%nzs-1 ) |
---|
3232 | |
---|
3233 | Â Â Â Â Â ENDIF |
---|
3234 |      init_3d%from_file_msoil = .TRUE. |
---|
3235 | Â Â Â Â ENDIF |
---|
3236 | ! |
---|
3237 | !--Â Â Read soil temperature |
---|
3238 |     IF ( check_existence( var_names, 'init_soil_t' ) ) THEN |
---|
3239 | ! |
---|
3240 | !--Â Â Â Â Read attributes for the fill value and level-of-detail |
---|
3241 |      CALL get_attribute( id_dynamic, char_fill,              & |
---|
3242 |                init_3d%fill_tsoil,               & |
---|
3243 |                .FALSE., 'init_soil_t' ) |
---|
3244 |      CALL get_attribute( id_dynamic, char_lod,              & |
---|
3245 |                init_3d%lod_tsoil,                & |
---|
3246 |                .FALSE., 'init_soil_t' ) |
---|
3247 | ! |
---|
3248 | !--Â Â Â Â level-of-detail 1 - read initialization profile |
---|
3249 |      IF ( init_3d%lod_tsoil == 1 ) THEN |
---|
3250 | Â Â Â Â Â Â Â ALLOCATE(Â init_3d%tsoil_1d(0:init_3d%nzs-1)Â ) |
---|
3251 | |
---|
3252 |        CALL get_variable( id_dynamic, 'init_soil_t',           & |
---|
3253 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%tsoil_1d(0:init_3d%nzs-1)Â ) |
---|
3254 | |
---|
3255 | ! |
---|
3256 | !--Â Â Â Â level-of-detail 2 - read 3D initialization data |
---|
3257 |      ELSEIF ( init_3d%lod_tsoil == 2 ) THEN |
---|
3258 | Â Â Â Â Â Â Â ALLOCATEÂ (Â init_3d%tsoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr)Â ) |
---|
3259 | Â Â Â Â Â Â Â |
---|
3260 |        CALL get_variable( id_dynamic, 'init_soil_t',           &  |
---|
3261 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â init_3d%tsoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr),& |
---|
3262 |                nxl, nxr, nys, nyn, 0, init_3d%nzs-1 ) |
---|
3263 | Â Â Â Â Â ENDIF |
---|
3264 |      init_3d%from_file_tsoil = .TRUE. |
---|
3265 | Â Â Â Â ENDIF |
---|
3266 | ! |
---|
3267 | !--Â Â Close input file |
---|
3268 |     CALL close_input_file( id_dynamic ) |
---|
3269 | #endif |
---|
3270 | ! |
---|
3271 | !--Â Â End of CPU measurement |
---|
3272 |     CALL cpu_log( log_point_s(85), 'NetCDF input init', 'stop' ) |
---|
3273 | |
---|
3274 |   END SUBROUTINE netcdf_data_input_init_lsm  |
---|
3275 | |
---|
3276 | !------------------------------------------------------------------------------! |
---|
3277 | ! Description: |
---|
3278 | ! ------------ |
---|
3279 | !> Reads data at lateral and top boundaries derived from larger-scale model |
---|
3280 | !> (COSMO) by Inifor. |
---|
3281 | !------------------------------------------------------------------------------! |
---|
3282 | Â Â SUBROUTINE netcdf_data_input_offline_nesting |
---|
3283 | |
---|
3284 |     USE control_parameters,                         & |
---|
3285 |       ONLY: bc_dirichlet_l, bc_dirichlet_n, bc_dirichlet_r,       & |
---|
3286 |          bc_dirichlet_s, humidity, neutral, nesting_offline,     & |
---|
3287 | Â Â Â Â Â Â Â Â Â time_since_reference_point |
---|
3288 | |
---|
3289 |     USE indices,                              & |
---|
3290 |       ONLY: nxl, nxlu, nxr, nyn, nys, nysv, nzb, nzt |
---|
3291 | |
---|
3292 | Â Â Â Â IMPLICIT NONE |
---|
3293 | Â Â Â Â |
---|
3294 |     INTEGER(iwp) :: id_dynamic !< NetCDF id of dynamic input file |
---|
3295 |     INTEGER(iwp) :: num_vars  !< number of variables in netcdf input file |
---|
3296 |     INTEGER(iwp) :: t     !< running index time dimension |
---|
3297 | ! |
---|
3298 | !--Â Â Skip input if no forcing from larger-scale models is applied. |
---|
3299 |     IF ( .NOT. nesting_offline ) RETURN |
---|
3300 | |
---|
3301 | ! |
---|
3302 | !--Â Â CPU measurement |
---|
3303 |     CALL cpu_log( log_point_s(86), 'NetCDF input forcing', 'start' ) |
---|
3304 | |
---|
3305 | #if defined ( __netcdf ) |
---|
3306 | ! |
---|
3307 | !--Â Â Open file in read-only mode |
---|
3308 |     CALL open_read_file( TRIM( input_file_dynamic ) //           & |
---|
3309 |               TRIM( coupling_char ), id_dynamic ) |
---|
3310 | ! |
---|
3311 | !--Â Â Initialize INIFOR forcing. |
---|
3312 |     IF ( .NOT. nest_offl%init ) THEN |
---|
3313 | ! |
---|
3314 | !--Â Â Â Â At first, inquire all variable names. |
---|
3315 |      CALL inquire_num_variables( id_dynamic, num_vars ) |
---|
3316 | ! |
---|
3317 | !--Â Â Â Â Allocate memory to store variable names. |
---|
3318 | Â Â Â Â Â ALLOCATE(Â nest_offl%var_names(1:num_vars)Â ) |
---|
3319 |      CALL inquire_variable_names( id_dynamic, nest_offl%var_names ) |
---|
3320 | ! |
---|
3321 | !--Â Â Â Â Read time dimension, allocate memory and finally read time array |
---|
3322 |      CALL netcdf_data_input_get_dimension_length( id_dynamic,       & |
---|
3323 |                             nest_offl%nt, 'time' ) |
---|
3324 | |
---|
3325 |      IF ( check_existence( nest_offl%var_names, 'time' ) ) THEN |
---|
3326 | Â Â Â Â Â Â Â ALLOCATE(Â nest_offl%time(0:nest_offl%nt-1)Â ) |
---|
3327 |        CALL get_variable( id_dynamic, 'time', nest_offl%time ) |
---|
3328 | Â Â Â Â Â ENDIF |
---|
3329 | ! |
---|
3330 | !--Â Â Â Â Read vertical dimension of scalar und w grid |
---|
3331 |      CALL netcdf_data_input_get_dimension_length( id_dynamic,       & |
---|
3332 |                             nest_offl%nzu, 'z' ) |
---|
3333 |      CALL netcdf_data_input_get_dimension_length( id_dynamic,       & |
---|
3334 |                             nest_offl%nzw, 'zw' ) |
---|
3335 | |
---|
3336 |      IF ( check_existence( nest_offl%var_names, 'z' ) ) THEN |
---|
3337 | Â Â Â Â Â Â Â ALLOCATE(Â nest_offl%zu_atmos(1:nest_offl%nzu)Â ) |
---|
3338 |        CALL get_variable( id_dynamic, 'z', nest_offl%zu_atmos ) |
---|
3339 | Â Â Â Â Â ENDIF |
---|
3340 |      IF ( check_existence( nest_offl%var_names, 'zw' ) ) THEN |
---|
3341 | Â Â Â Â Â Â Â ALLOCATE(Â nest_offl%zw_atmos(1:nest_offl%nzw)Â ) |
---|
3342 |        CALL get_variable( id_dynamic, 'zw', nest_offl%zw_atmos ) |
---|
3343 | Â Â Â Â Â ENDIF |
---|
3344 | |
---|
3345 | ! |
---|
3346 | !--Â Â Â Â Read surface pressure |
---|
3347 |      IF ( check_existence( nest_offl%var_names,              & |
---|
3348 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'surface_forcing_surface_pressure'Â )Â )Â THEN |
---|
3349 | Â Â Â Â Â Â Â ALLOCATE(Â nest_offl%surface_pressure(0:nest_offl%nt-1)Â ) |
---|
3350 |        CALL get_variable( id_dynamic,                  & |
---|
3351 |                 'surface_forcing_surface_pressure',      & |
---|
3352 |                 nest_offl%surface_pressure ) |
---|
3353 | Â Â Â Â Â ENDIF |
---|
3354 | ! |
---|
3355 | !--Â Â Â Â Set control flag to indicate that initialization is already done |
---|
3356 |      nest_offl%init = .TRUE. |
---|
3357 | |
---|
3358 | Â Â Â Â ENDIF |
---|
3359 | |
---|
3360 | ! |
---|
3361 | !--Â Â Obtain time index for current input starting at 0. |
---|
3362 | !--Â Â @todo: At the moment INIFOR and simulated time correspond |
---|
3363 | !--Â Â Â Â Â Â to each other. If required, adjust to daytime. |
---|
3364 |     nest_offl%tind = MINLOC( ABS( nest_offl%time -             & |
---|
3365 |                    time_since_reference_point ), DIM = 1 )  & |
---|
3366 | Â Â Â Â Â Â Â Â Â Â Â Â -Â 1 |
---|
3367 |     nest_offl%tind_p = nest_offl%tind + 1    |
---|
3368 | ! |
---|
3369 | !--Â Â Read geostrophic wind components |
---|
3370 |     DO t = nest_offl%tind, nest_offl%tind_p |
---|
3371 |      CALL get_variable_pr( id_dynamic, 'ls_forcing_ug', t+1,       & |
---|
3372 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nest_offl%ug(t-nest_offl%tind,nzb+1:nzt)Â ) |
---|
3373 |      CALL get_variable_pr( id_dynamic, 'ls_forcing_vg', t+1,       & |
---|
3374 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nest_offl%vg(t-nest_offl%tind,nzb+1:nzt)Â ) |
---|
3375 | Â Â Â Â ENDDO |
---|
3376 | ! |
---|
3377 | !--Â Â Read data at lateral and top boundaries. Please note, at left and |
---|
3378 | !--Â Â right domain boundary, yz-layers are read for u, v, w, pt and q. |
---|
3379 | !--Â Â For the v-component, the data starts at nysv, while for the other |
---|
3380 | !--Â Â quantities the data starts at nys. This is equivalent at the north |
---|
3381 | !--Â Â and south domain boundary for the u-component. |
---|
3382 | !--Â Â Further, lateral data is not accessed by parallel IO, indicated by the |
---|
3383 | !--Â Â last passed flag in the subroutine get_variable(). This is because |
---|
3384 | !--Â Â not every PE participates in this collective blocking read operation. |
---|
3385 |     IF ( bc_dirichlet_l ) THEN |
---|
3386 |      CALL get_variable( id_dynamic, 'ls_forcing_left_u',         & |
---|
3387 |               nest_offl%u_left(0:1,nzb+1:nzt,nys:nyn),      & |
---|
3388 |               nys+1, nzb+1, nest_offl%tind+1,           & |
---|
3389 |               nyn-nys+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3390 | Â Â Â |
---|
3391 |      CALL get_variable( id_dynamic, 'ls_forcing_left_v',         & |
---|
3392 |               nest_offl%v_left(0:1,nzb+1:nzt,nysv:nyn),      & |
---|
3393 |               nysv, nzb+1, nest_offl%tind+1,           & |
---|
3394 |               nyn-nysv+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3395 | |
---|
3396 |      CALL get_variable( id_dynamic, 'ls_forcing_left_w',         & |
---|
3397 |               nest_offl%w_left(0:1,nzb+1:nzt-1,nys:nyn),     & |
---|
3398 |               nys+1, nzb+1, nest_offl%tind+1,           & |
---|
3399 |               nyn-nys+1, nest_offl%nzw, 2, .FALSE. ) |
---|
3400 | |
---|
3401 |      IF ( .NOT. neutral ) THEN |
---|
3402 |        CALL get_variable( id_dynamic, 'ls_forcing_left_pt',       & |
---|
3403 |               nest_offl%pt_left(0:1,nzb+1:nzt,nys:nyn),      & |
---|
3404 |               nys+1, nzb+1, nest_offl%tind+1,           & |
---|
3405 |               nyn-nys+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3406 | Â Â Â Â Â ENDIF |
---|
3407 | |
---|
3408 |      IF ( humidity ) THEN |
---|
3409 |        CALL get_variable( id_dynamic, 'ls_forcing_left_qv',       & |
---|
3410 |               nest_offl%q_left(0:1,nzb+1:nzt,nys:nyn),      & |
---|
3411 |               nys+1, nzb+1, nest_offl%tind+1,           & |
---|
3412 |               nyn-nys+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3413 | Â Â Â Â Â ENDIF |
---|
3414 | |
---|
3415 | Â Â Â Â ENDIF |
---|
3416 | |
---|
3417 |     IF ( bc_dirichlet_r ) THEN |
---|
3418 |      CALL get_variable( id_dynamic, 'ls_forcing_right_u',         & |
---|
3419 |               nest_offl%u_right(0:1,nzb+1:nzt,nys:nyn),      & |
---|
3420 |               nys+1, nzb+1, nest_offl%tind+1,           & |
---|
3421 |               nyn-nys+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3422 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3423 |      CALL get_variable( id_dynamic, 'ls_forcing_right_v',         & |
---|
3424 |               nest_offl%v_right(0:1,nzb+1:nzt,nysv:nyn),     & |
---|
3425 |               nysv, nzb+1, nest_offl%tind+1,           & |
---|
3426 |               nyn-nysv+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3427 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3428 |      CALL get_variable( id_dynamic, 'ls_forcing_right_w',         & |
---|
3429 |               nest_offl%w_right(0:1,nzb+1:nzt-1,nys:nyn),     & |
---|
3430 |               nys+1, nzb+1, nest_offl%tind+1,           & |
---|
3431 |               nyn-nys+1, nest_offl%nzw, 2, .FALSE. ) |
---|
3432 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3433 |      IF ( .NOT. neutral ) THEN |
---|
3434 |        CALL get_variable( id_dynamic, 'ls_forcing_right_pt',       & |
---|
3435 |               nest_offl%pt_right(0:1,nzb+1:nzt,nys:nyn),     & |
---|
3436 |               nys+1, nzb+1, nest_offl%tind+1,           & |
---|
3437 |               nyn-nys+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3438 | Â Â Â Â Â ENDIF |
---|
3439 |      IF ( humidity ) THEN |
---|
3440 |        CALL get_variable( id_dynamic, 'ls_forcing_right_qv',       & |
---|
3441 |               nest_offl%q_right(0:1,nzb+1:nzt,nys:nyn),      & |
---|
3442 |               nys+1, nzb+1, nest_offl%tind+1,           & |
---|
3443 |               nyn-nys+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3444 | Â Â Â Â Â ENDIF |
---|
3445 | Â Â Â Â ENDIF |
---|
3446 | |
---|
3447 |     IF ( bc_dirichlet_n ) THEN |
---|
3448 | Â Â Â Â |
---|
3449 |      CALL get_variable( id_dynamic, 'ls_forcing_north_u',         & |
---|
3450 |               nest_offl%u_north(0:1,nzb+1:nzt,nxlu:nxr),     & |
---|
3451 |               nxlu, nzb+1, nest_offl%tind+1,           & |
---|
3452 |               nxr-nxlu+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3453 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3454 |      CALL get_variable( id_dynamic, 'ls_forcing_north_v',         & |
---|
3455 |               nest_offl%v_north(0:1,nzb+1:nzt,nxl:nxr),      & |
---|
3456 |               nxl+1, nzb+1, nest_offl%tind+1,           & |
---|
3457 |               nxr-nxl+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3458 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3459 |      CALL get_variable( id_dynamic, 'ls_forcing_north_w',         & |
---|
3460 |               nest_offl%w_north(0:1,nzb+1:nzt-1,nxl:nxr),     & |
---|
3461 |               nxl+1, nzb+1, nest_offl%tind+1,           & |
---|
3462 |               nxr-nxl+1, nest_offl%nzw, 2, .FALSE. ) |
---|
3463 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3464 |      IF ( .NOT. neutral ) THEN |
---|
3465 |        CALL get_variable( id_dynamic, 'ls_forcing_north_pt',       & |
---|
3466 |               nest_offl%pt_north(0:1,nzb+1:nzt,nxl:nxr),     & |
---|
3467 |               nxl+1, nzb+1, nest_offl%tind+1,           & |
---|
3468 |               nxr-nxl+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3469 | Â Â Â Â Â ENDIF |
---|
3470 |      IF ( humidity ) THEN |
---|
3471 |        CALL get_variable( id_dynamic, 'ls_forcing_north_qv',       & |
---|
3472 |               nest_offl%q_north(0:1,nzb+1:nzt,nxl:nxr),      & |
---|
3473 |               nxl+1, nzb+1, nest_offl%tind+1,           & |
---|
3474 |               nxr-nxl+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3475 | Â Â Â Â Â ENDIF |
---|
3476 | Â Â Â Â ENDIF |
---|
3477 | |
---|
3478 |     IF ( bc_dirichlet_s ) THEN |
---|
3479 |      CALL get_variable( id_dynamic, 'ls_forcing_south_u',         & |
---|
3480 |               nest_offl%u_south(0:1,nzb+1:nzt,nxlu:nxr),     & |
---|
3481 |               nxlu, nzb+1, nest_offl%tind+1,           & |
---|
3482 |               nxr-nxlu+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3483 | |
---|
3484 |      CALL get_variable( id_dynamic, 'ls_forcing_south_v',         & |
---|
3485 |               nest_offl%v_south(0:1,nzb+1:nzt,nxl:nxr),      & |
---|
3486 |               nxl+1, nzb+1, nest_offl%tind+1,           & |
---|
3487 |               nxr-nxl+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3488 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3489 |      CALL get_variable( id_dynamic, 'ls_forcing_south_w',         & |
---|
3490 |               nest_offl%w_south(0:1,nzb+1:nzt-1,nxl:nxr),     & |
---|
3491 |               nxl+1, nzb+1, nest_offl%tind+1,           & |
---|
3492 |               nxr-nxl+1, nest_offl%nzw, 2, .FALSE. ) |
---|
3493 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3494 |      IF ( .NOT. neutral ) THEN |
---|
3495 |        CALL get_variable( id_dynamic, 'ls_forcing_south_pt',       & |
---|
3496 |               nest_offl%pt_south(0:1,nzb+1:nzt,nxl:nxr),     & |
---|
3497 |               nxl+1, nzb+1, nest_offl%tind+1,           & |
---|
3498 |               nxr-nxl+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3499 | Â Â Â Â Â ENDIF |
---|
3500 |      IF ( humidity ) THEN |
---|
3501 |        CALL get_variable( id_dynamic, 'ls_forcing_south_qv',       & |
---|
3502 |               nest_offl%q_south(0:1,nzb+1:nzt,nxl:nxr),      & |
---|
3503 |               nxl+1, nzb+1, nest_offl%tind+1,           & |
---|
3504 |               nxr-nxl+1, nest_offl%nzu, 2, .FALSE. ) |
---|
3505 | Â Â Â Â Â ENDIF |
---|
3506 | Â Â Â Â ENDIF |
---|
3507 | |
---|
3508 | ! |
---|
3509 | !--Â Â Top boundary |
---|
3510 |     CALL get_variable( id_dynamic, 'ls_forcing_top_u',           & |
---|
3511 |                nest_offl%u_top(0:1,nys:nyn,nxlu:nxr),      & |
---|
3512 |                nxlu, nys+1, nest_offl%tind+1,          & |
---|
3513 |                nxr-nxlu+1, nyn-nys+1, 2, .TRUE. ) |
---|
3514 | |
---|
3515 |     CALL get_variable( id_dynamic, 'ls_forcing_top_v',           & |
---|
3516 |                nest_offl%v_top(0:1,nysv:nyn,nxl:nxr),      & |
---|
3517 |                nxl+1, nysv, nest_offl%tind+1,          & |
---|
3518 |                nxr-nxl+1, nyn-nysv+1, 2, .TRUE. ) |
---|
3519 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3520 |     CALL get_variable( id_dynamic, 'ls_forcing_top_w',           & |
---|
3521 |                nest_offl%w_top(0:1,nys:nyn,nxl:nxr),       & |
---|
3522 |                nxl+1, nys+1, nest_offl%tind+1,          & |
---|
3523 |                nxr-nxl+1, nyn-nys+1, 2, .TRUE. ) |
---|
3524 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
---|
3525 |     IF ( .NOT. neutral ) THEN |
---|
3526 |      CALL get_variable( id_dynamic, 'ls_forcing_top_pt',         & |
---|
3527 |                 nest_offl%pt_top(0:1,nys:nyn,nxl:nxr),     & |
---|
3528 |                 nxl+1, nys+1, nest_offl%tind+1,        & |
---|
3529 |                 nxr-nxl+1, nyn-nys+1, 2, .TRUE. ) |
---|
3530 | Â Â Â Â ENDIF |
---|
3531 |     IF ( humidity ) THEN |
---|
3532 |      CALL get_variable( id_dynamic, 'ls_forcing_top_qv',         & |
---|
3533 |                 nest_offl%q_top(0:1,nys:nyn,nxl:nxr),     & |
---|
3534 |                 nxl+1, nys+1, nest_offl%tind+1,        & |
---|
3535 |                 nxr-nxl+1, nyn-nys+1, 2, .TRUE. ) |
---|
3536 | Â Â Â Â ENDIF |
---|
3537 | |
---|
3538 | ! |
---|
3539 | !--Â Â Close input file |
---|
3540 |     CALL close_input_file( id_dynamic ) |
---|
3541 | #endif |
---|
3542 | ! |
---|
3543 | !--Â Â End of CPU measurement |
---|
3544 |     CALL cpu_log( log_point_s(86), 'NetCDF input forcing', 'stop' ) |
---|
3545 | |
---|
3546 | Â Â END SUBROUTINE netcdf_data_input_offline_nesting |
---|
3547 | |
---|
3548 | |
---|
3549 | !------------------------------------------------------------------------------! |
---|
3550 | ! Description: |
---|
3551 | ! ------------ |
---|
3552 | !> Checks input file for consistency and minimum requirements. |
---|
3553 | !------------------------------------------------------------------------------! |
---|
3554 | Â Â SUBROUTINE netcdf_data_input_check_dynamic |
---|
3555 | |
---|
3556 |     USE control_parameters,                         & |
---|
3557 |       ONLY: initializing_actions, message_string, nesting_offline |
---|
3558 | |
---|
3559 | Â Â Â Â IMPLICIT NONE |
---|
3560 | |
---|
3561 | ! |
---|
3562 | !--Â Â In case of forcing, check whether dynamic input file is present |
---|
3563 |     IF ( .NOT. input_pids_dynamic .AND. nesting_offline ) THEN |
---|
3564 |      message_string = 'nesting_offline = .TRUE. requires dynamic ' //  & |
---|
3565 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'input file 'Â //Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â & |
---|
3566 |               TRIM( input_file_dynamic ) // TRIM( coupling_char ) |
---|
3567 |      CALL message( 'netcdf_data_input_mod', 'PA0546', 1, 2, 0, 6, 0 ) |
---|
3568 | Â Â Â Â ENDIF |
---|
3569 | ! |
---|
3570 | !--Â Â Dynamic input file must also be present if initialization via inifor is |
---|
3571 | !--Â Â prescribed. |
---|
3572 |     IF ( .NOT. input_pids_dynamic .AND.                  & |
---|
3573 |       TRIM( initializing_actions ) == 'inifor' ) THEN |
---|
3574 |      message_string = 'initializing_actions = inifor requires dynamic ' //& |
---|
3575 |               'input file ' // TRIM( input_file_dynamic ) //   & |
---|
3576 |               TRIM( coupling_char ) |
---|
3577 |      CALL message( 'netcdf_data_input_mod', 'PA0547', 1, 2, 0, 6, 0 ) |
---|
3578 | Â Â Â Â ENDIF |
---|
3579 | |
---|
3580 | Â Â END SUBROUTINE netcdf_data_input_check_dynamic |
---|
3581 | |
---|
3582 | !------------------------------------------------------------------------------! |
---|
3583 | ! Description: |
---|
3584 | ! ------------ |
---|
3585 | !> Checks input file for consistency and minimum requirements. |
---|
3586 | !------------------------------------------------------------------------------! |
---|
3587 | Â Â SUBROUTINE netcdf_data_input_check_static |
---|
3588 | |
---|
3589 |     USE arrays_3d,                             & |
---|
3590 | Â Â Â Â Â Â ONLY:Â zu |
---|
3591 | |
---|
3592 |     USE control_parameters,                         & |
---|
3593 |       ONLY: land_surface, message_string, urban_surface |
---|
3594 | |
---|
3595 |     USE grid_variables,                           & |
---|
3596 |       ONLY: dx, dy |
---|
3597 | |
---|
3598 |     USE indices,                              & |
---|
3599 |       ONLY: nx, nxl, nxr, ny, nyn, nys |
---|
3600 | |
---|
3601 | Â Â Â Â IMPLICIT NONE |
---|
3602 | |
---|
3603 |     INTEGER(iwp) :: i   !< loop index along x-direction |
---|
3604 |     INTEGER(iwp) :: j   !< loop index along y-direction |
---|
3605 |     INTEGER(iwp) :: n_surf !< number of different surface types at given location |
---|
3606 | |
---|
3607 |     LOGICAL   :: check_passed !< flag indicating if a check passed |
---|
3608 | |
---|
3609 | ! |
---|
3610 | !--Â Â Return if no static input file is available |
---|
3611 |     IF ( .NOT. input_pids_static ) RETURN |
---|
3612 | ! |
---|
3613 | !--Â Â Check whether dimension size in input file matches the model dimensions |
---|
3614 |     IF ( dim_static%nx-1 /= nx .OR. dim_static%ny-1 /= ny ) THEN |
---|
3615 |      message_string = 'Static input file: horizontal dimension in ' //  & |
---|
3616 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'x- and/or y-direction 'Â //Â Â Â Â Â Â Â Â Â Â Â Â Â & |
---|
3617 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'do not match the respective model dimension' |
---|
3618 |      CALL message( 'netcdf_data_input_mod', 'PA0548', 1, 2, 0, 6, 0 ) |
---|
3619 | Â Â Â Â ENDIF |
---|
3620 | ! |
---|
3621 | !--Â Â Check if grid spacing of provided input data matches the respective |
---|
3622 | !--Â Â grid spacing in the model. |
---|
3623 |     IF ( ABS( dim_static%x(1) - dim_static%x(0) - dx ) > 10E-6_wp .OR.   & |
---|
3624 |       ABS( dim_static%y(1) - dim_static%y(0) - dy ) > 10E-6_wp ) THEN |
---|
3625 |      message_string = 'Static input file: horizontal grid spacing ' //  & |
---|
3626 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'in x- and/or y-direction 'Â //Â Â Â Â Â Â Â Â Â Â Â & |
---|
3627 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'do not match the respective model grid spacing.' |
---|
3628 |      CALL message( 'netcdf_data_input_mod', 'PA0549', 1, 2, 0, 6, 0 ) |
---|
3629 | Â Â Â Â ENDIF |
---|
3630 | ! |
---|
3631 | !--Â Â Check for correct dimension of surface_fractions, should run from 0-2. |
---|
3632 |     IF ( surface_fraction_f%from_file ) THEN |
---|
3633 | Â Â Â Â Â IFÂ (Â surface_fraction_f%nf-1Â >Â 2Â )Â THEN |
---|
3634 |        message_string = 'nsurface_fraction must not be larger than 3.' |
---|
3635 |        CALL message( 'netcdf_data_input_mod', 'PA0580', 1, 2, 0, 6, 0 ) |
---|
3636 | Â Â Â Â Â ENDIF |
---|
3637 | Â Â Â Â ENDIF |
---|
3638 | ! |
---|
3639 | !--Â Â Check orography for fill-values. For the moment, give an error message. |
---|
3640 | !--Â Â More advanced methods, e.g. a nearest neighbor algorithm as used in GIS |
---|
3641 | !--Â Â systems might be implemented later. |
---|
3642 | !--Â Â Please note, if no terrain height is provided, it is set to 0. |
---|
3643 |     IF ( ANY( terrain_height_f%var == terrain_height_f%fill ) ) THEN |
---|
3644 |      message_string = 'NetCDF variable zt is not ' //           & |
---|
3645 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'allowed to have missing data' |
---|
3646 |      CALL message( 'netcdf_data_input_mod', 'PA0550', 2, 2, myid, 6, 0 ) |
---|
3647 | Â Â Â Â ENDIF |
---|
3648 | ! |
---|
3649 | !--Â Â Check for negative terrain heights |
---|
3650 |     IF ( ANY( terrain_height_f%var < 0.0_wp ) ) THEN |
---|
3651 |      message_string = 'NetCDF variable zt is not ' //           & |
---|
3652 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'allowed to have negative values' |
---|
3653 |      CALL message( 'netcdf_data_input_mod', 'PA0551', 2, 2, myid, 6, 0 ) |
---|
3654 | Â Â Â Â ENDIF |
---|
3655 | ! |
---|
3656 | !--Â Â If 3D buildings are read, check if building information is consistent |
---|
3657 | !--Â Â to numeric grid. |
---|
3658 |     IF ( buildings_f%from_file ) THEN |
---|
3659 |      IF ( buildings_f%lod == 2 ) THEN |
---|
3660 |        IF ( buildings_f%nz > SIZE( zu ) ) THEN |
---|
3661 |         message_string = 'Reading 3D building data - too much ' //   & |
---|
3662 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'data points along the vertical coordinate.' |
---|
3663 |         CALL message( 'netcdf_data_input_mod', 'PA0552', 2, 2, 0, 6, 0 ) |
---|
3664 | Â Â Â Â Â Â Â ENDIF |
---|
3665 | |
---|
3666 | Â Â Â Â Â Â Â IFÂ (Â ANY(Â ABS(Â buildings_f%z(0:buildings_f%nz-1)Â -Â Â Â Â Â Â Â Â & |
---|
3667 |             zu(0:buildings_f%nz-1) ) > 1E-6_wp ) ) THEN |
---|
3668 |         message_string = 'Reading 3D building data - vertical ' //   & |
---|
3669 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'coordinate do not match numeric grid.' |
---|
3670 |         CALL message( 'netcdf_data_input_mod', 'PA0553', 2, 2, myid, 6, 0 ) |
---|
3671 | Â Â Â Â Â Â Â ENDIF |
---|
3672 | Â Â Â Â Â ENDIF |
---|
3673 | Â Â Â Â ENDIF |
---|
3674 | |
---|
3675 | ! |
---|
3676 | !--Â Â Skip further checks concerning buildings and natural surface properties |
---|
3677 | !--Â Â if no urban surface and land surface model are applied. |
---|
3678 |     IF ( .NOT. land_surface .AND. .NOT. urban_surface ) RETURN |
---|
3679 | ! |
---|
3680 | !--Â Â Check for minimum requirement of surface-classification data in case |
---|
3681 | !--Â Â static input file is used. |
---|
3682 |     IF ( ( .NOT. vegetation_type_f%from_file .OR.             & |
---|
3683 |        .NOT. pavement_type_f%from_file  .OR.             & |
---|
3684 |        .NOT. water_type_f%from_file    .OR.             & |
---|
3685 |        .NOT. soil_type_f%from_file       ) .OR.          & |
---|
3686 |        ( urban_surface .AND. .NOT. building_type_f%from_file ) ) THEN |
---|
3687 |      message_string = 'Minimum requirement for surface classification ' //& |
---|
3688 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'is not fulfilled. At least 'Â //Â Â Â Â Â Â Â Â Â Â & |
---|
3689 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'vegetation_type, pavement_type, 'Â //Â Â Â Â Â Â Â Â & |
---|
3690 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'soil_type and water_type are '//Â Â Â Â Â Â Â Â Â Â & |
---|
3691 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'required. If urban-surface model is applied, 'Â //Â & |
---|
3692 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'also building_type ist required' |
---|
3693 |      CALL message( 'netcdf_data_input_mod', 'PA0554', 1, 2, 0, 6, 0 ) |
---|
3694 | Â Â Â Â ENDIF |
---|
3695 | ! |
---|
3696 | !--Â Â Check for general availability of input variables. |
---|
3697 | !--Â Â If vegetation_type is 0 at any location, vegetation_pars as well as |
---|
3698 | !--Â Â root_area_dens_s are required. |
---|
3699 |     IF ( vegetation_type_f%from_file ) THEN |
---|
3700 |      IF ( ANY( vegetation_type_f%var == 0 ) ) THEN |
---|
3701 |        IF ( .NOT. vegetation_pars_f%from_file ) THEN |
---|
3702 |         message_string = 'If vegetation_type = 0 at any location, ' // & |
---|
3703 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'vegetation_pars is required' |
---|
3704 |         CALL message( 'netcdf_data_input_mod', 'PA0555', 2, 2, -1, 6, 0 ) |
---|
3705 | Â Â Â Â Â Â Â ENDIF |
---|
3706 |        IF ( .NOT. root_area_density_lsm_f%from_file ) THEN |
---|
3707 |         message_string = 'If vegetation_type = 0 at any location, ' // & |
---|
3708 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'root_area_dens_s is required' |
---|
3709 |         CALL message( 'netcdf_data_input_mod', 'PA0556', 2, 2, myid, 6, 0 ) |
---|
3710 | Â Â Â Â Â Â Â ENDIF |
---|
3711 | Â Â Â Â Â ENDIF |
---|
3712 | Â Â Â Â ENDIF |
---|
3713 | ! |
---|
3714 | !--Â Â If soil_type is zero at any location, soil_pars is required. |
---|
3715 |     IF ( soil_type_f%from_file ) THEN |
---|
3716 |      check_passed = .TRUE. |
---|
3717 |      IF ( ALLOCATED( soil_type_f%var_2d ) ) THEN |
---|
3718 |        IF ( ANY( soil_type_f%var_2d == 0 ) ) THEN |
---|
3719 |         IF ( .NOT. soil_pars_f%from_file ) check_passed = .FALSE. |
---|
3720 | Â Â Â Â Â Â Â ENDIF |
---|
3721 | Â Â Â Â Â ELSE |
---|
3722 |        IF ( ANY( soil_type_f%var_3d == 0 ) ) THEN |
---|
3723 |         IF ( .NOT. soil_pars_f%from_file ) check_passed = .FALSE. |
---|
3724 | Â Â Â Â Â Â Â ENDIF |
---|
3725 | Â Â Â Â Â ENDIF |
---|
3726 |      IF ( .NOT. check_passed ) THEN |
---|
3727 |        message_string = 'If soil_type = 0 at any location, ' //     & |
---|
3728 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'soil_pars is required' |
---|
3729 |        CALL message( 'netcdf_data_input_mod', 'PA0557', 2, 2, myid, 6, 0 ) |
---|
3730 | Â Â Â Â Â ENDIF |
---|
3731 | Â Â Â Â ENDIF |
---|
3732 | ! |
---|
3733 | !--Â Â Buildings require a type in case of urban-surface model. |
---|
3734 |     IF ( buildings_f%from_file .AND. .NOT. building_type_f%from_file ) THEN |
---|
3735 |      message_string = 'If buildings are provided, also building_type ' // & |
---|
3736 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'is required' |
---|
3737 |      CALL message( 'netcdf_data_input_mod', 'PA0581', 2, 2, myid, 6, 0 ) |
---|
3738 | Â Â Â Â ENDIF |
---|
3739 | ! |
---|
3740 | !--Â Â Buildings require an ID. |
---|
3741 |     IF ( buildings_f%from_file .AND. .NOT. building_id_f%from_file ) THEN |
---|
3742 |      message_string = 'If buildings are provided, also building_id ' //  & |
---|
3743 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'is required' |
---|
3744 |      CALL message( 'netcdf_data_input_mod', 'PA0582', 2, 2, myid, 6, 0 ) |
---|
3745 | Â Â Â Â ENDIF |
---|
3746 | ! |
---|
3747 | !--Â Â If building_type is zero at any location, building_pars is required. |
---|
3748 |     IF ( building_type_f%from_file ) THEN |
---|
3749 |      IF ( ANY( building_type_f%var == 0 ) ) THEN |
---|
3750 |        IF ( .NOT. building_pars_f%from_file ) THEN |
---|
3751 |         message_string = 'If building_type = 0 at any location, ' //  & |
---|
3752 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'building_pars is required' |
---|
3753 |         CALL message( 'netcdf_data_input_mod', 'PA0558', 2, 2, myid, 6, 0 ) |
---|
3754 | Â Â Â Â Â Â Â ENDIF |
---|
3755 | Â Â Â Â Â ENDIF |
---|
3756 | Â Â Â Â ENDIF |
---|
3757 | ! |
---|
3758 | !--Â Â If building_type is provided, also building_id is needed (due to the |
---|
3759 | !--Â Â filtering algorithm). |
---|
3760 |     IF ( building_type_f%from_file .AND. .NOT. building_id_f%from_file ) & |
---|
3761 | Â Â Â Â THEN |
---|
3762 |      message_string = 'If building_type is provided, also building_id '// & |
---|
3763 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'is required' |
---|
3764 |      CALL message( 'netcdf_data_input_mod', 'PA0519', 2, 2, myid, 6, 0 ) |
---|
3765 | Â Â Â Â ENDIFÂ Â Â Â |
---|
3766 | ! |
---|
3767 | !--Â Â If albedo_type is zero at any location, albedo_pars is required. |
---|
3768 |     IF ( albedo_type_f%from_file ) THEN |
---|
3769 |      IF ( ANY( albedo_type_f%var == 0 ) ) THEN |
---|
3770 |        IF ( .NOT. albedo_pars_f%from_file ) THEN |
---|
3771 |         message_string = 'If albedo_type = 0 at any location, ' //   & |
---|
3772 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'albedo_pars is required' |
---|
3773 |         CALL message( 'netcdf_data_input_mod', 'PA0559', 2, 2, myid, 6, 0 ) |
---|
3774 | Â Â Â Â Â Â Â ENDIF |
---|
3775 | Â Â Â Â Â ENDIF |
---|
3776 | Â Â Â Â ENDIF |
---|
3777 | ! |
---|
3778 | !--Â Â If pavement_type is zero at any location, pavement_pars is required. |
---|
3779 |     IF ( pavement_type_f%from_file ) THEN |
---|
3780 |      IF ( ANY( pavement_type_f%var == 0 ) ) THEN |
---|
3781 |        IF ( .NOT. pavement_pars_f%from_file ) THEN |
---|
3782 |         message_string = 'If pavement_type = 0 at any location, ' //  & |
---|
3783 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'pavement_pars is required' |
---|
3784 |         CALL message( 'netcdf_data_input_mod', 'PA0560', 2, 2, myid, 6, 0 ) |
---|
3785 | Â Â Â Â Â Â Â ENDIF |
---|
3786 | Â Â Â Â Â ENDIF |
---|
3787 | Â Â Â Â ENDIF |
---|
3788 | ! |
---|
3789 | !--Â Â If pavement_type is zero at any location, also pavement_subsurface_pars |
---|
3790 | !--Â Â is required. |
---|
3791 |     IF ( pavement_type_f%from_file ) THEN |
---|
3792 |      IF ( ANY( pavement_type_f%var == 0 ) ) THEN |
---|
3793 |        IF ( .NOT. pavement_subsurface_pars_f%from_file ) THEN |
---|
3794 |         message_string = 'If pavement_type = 0 at any location, ' //  & |
---|
3795 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'pavement_subsurface_pars is required' |
---|
3796 |         CALL message( 'netcdf_data_input_mod', 'PA0561', 2, 2, myid, 6, 0 ) |
---|
3797 | Â Â Â Â Â Â Â ENDIF |
---|
3798 | Â Â Â Â Â ENDIF |
---|
3799 | Â Â Â Â ENDIF |
---|
3800 | ! |
---|
3801 | !--Â Â If water_type is zero at any location, water_pars is required. |
---|
3802 |     IF ( water_type_f%from_file ) THEN |
---|
3803 |      IF ( ANY( water_type_f%var == 0 ) ) THEN |
---|
3804 |        IF ( .NOT. water_pars_f%from_file ) THEN |
---|
3805 |         message_string = 'If water_type = 0 at any location, ' //   & |
---|
3806 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'water_pars is required' |
---|
3807 |         CALL message( 'netcdf_data_input_mod', 'PA0562', 2, 2,myid, 6, 0 ) |
---|
3808 | Â Â Â Â Â Â Â ENDIF |
---|
3809 | Â Â Â Â Â ENDIF |
---|
3810 | Â Â Â Â ENDIF |
---|
3811 | ! |
---|
3812 | !--Â Â Check for local consistency of the input data. |
---|
3813 |     DO i = nxl, nxr |
---|
3814 |      DO j = nys, nyn |
---|
3815 | ! |
---|
3816 | !--Â Â Â Â Â For each (y,x)-location at least one of the parameters |
---|
3817 | !--Â Â Â Â Â vegetation_type, pavement_type, building_type, or water_type |
---|
3818 | !--     must be set to a nonÂÂmissing value. |
---|
3819 |        IF ( vegetation_type_f%var(j,i) == vegetation_type_f%fill .AND. & |
---|
3820 |          pavement_type_f%var(j,i)  == pavement_type_f%fill  .AND. & |
---|
3821 |          building_type_f%var(j,i)  == building_type_f%fill  .AND. & |
---|
3822 |          water_type_f%var(j,i)   == water_type_f%fill ) THEN |
---|
3823 |         WRITE( message_string, * ) 'At least one of the parameters '// & |
---|
3824 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'vegetation_type, pavement_type, 'Â Â Â //Â Â Â & |
---|
3825 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'building_type, or water_type must be set '//Â & |
---|
3826 |                  'to a non-missing value. Grid point: ', j, i |
---|
3827 |         CALL message( 'netcdf_data_input_mod', 'PA0563', 2, 2, myid, 6, 0 ) |
---|
3828 | Â Â Â Â Â Â Â ENDIF |
---|
3829 | ! |
---|
3830 | !--Â Â Â Â Â Note that a soil_type is required for each location (y,x) where |
---|
3831 | !--     either vegetation_type or pavement_type is a nonÂÂmissing value. |
---|
3832 |        IF ( ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill .OR. & |
---|
3833 |           pavement_type_f%var(j,i)  /= pavement_type_f%fill ) ) THEN |
---|
3834 |         check_passed = .TRUE. |
---|
3835 |         IF ( ALLOCATED( soil_type_f%var_2d ) ) THEN |
---|
3836 |           IF ( soil_type_f%var_2d(j,i) == soil_type_f%fill )     & |
---|
3837 |            check_passed = .FALSE. |
---|
3838 | Â Â Â Â Â Â Â Â ELSE |
---|
3839 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â soil_type_f%var_3d(:,j,i)Â ==Â soil_type_f%fill)Â )Â & |
---|
3840 |            check_passed = .FALSE. |
---|
3841 | Â Â Â Â Â Â Â Â ENDIF |
---|
3842 | |
---|
3843 |         IF ( .NOT. check_passed ) THEN |
---|
3844 |           message_string = 'soil_type is required for each '//    & |
---|
3845 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'location (y,x) where vegetation_type or 'Â //Â & |
---|
3846 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'pavement_type is a non-missing value.' |
---|
3847 |           CALL message( 'netcdf_data_input_mod', 'PA0564',      & |
---|
3848 |                  2, 2, myid, 6, 0 ) |
---|
3849 | Â Â Â Â Â Â Â Â ENDIF |
---|
3850 | Â Â Â Â Â Â Â ENDIF |
---|
3851 | ! |
---|
3852 | !--Â Â Â Â Â Check for consistency of surface fraction. If more than one type |
---|
3853 | !--Â Â Â Â Â is set, surface fraction need to be given and the sum must not |
---|
3854 | !--Â Â Â Â Â be larger than 1. |
---|
3855 |        n_surf = 0 |
---|
3856 |        IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )    & |
---|
3857 |         n_surf = n_surf + 1 |
---|
3858 |        IF ( water_type_f%var(j,i)   /= water_type_f%fill )      & |
---|
3859 |         n_surf = n_surf + 1 |
---|
3860 |        IF ( pavement_type_f%var(j,i)  /= pavement_type_f%fill )     & |
---|
3861 |         n_surf = n_surf + 1 |
---|
3862 | |
---|
3863 |        IF ( n_surf > 1 ) THEN |
---|
3864 |         IF ( .NOT. surface_fraction_f%from_file ) THEN |
---|
3865 |           message_string = 'If more than one surface type is ' //   & |
---|
3866 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'given at a location, surface_fraction 'Â //Â Â & |
---|
3867 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'must be provided.' |
---|
3868 |           CALL message( 'netcdf_data_input_mod', 'PA0565',      & |
---|
3869 |                  2, 2, myid, 6, 0 ) |
---|
3870 | Â Â Â Â Â Â Â Â ELSEIFÂ (Â ANYÂ (Â surface_fraction_f%frac(:,j,i)Â ==Â Â Â Â Â Â Â Â & |
---|
3871 |                 surface_fraction_f%fill ) ) THEN |
---|
3872 |           message_string = 'If more than one surface type is ' //   & |
---|
3873 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'given at a location, surface_fraction 'Â //Â Â & |
---|
3874 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'must be provided.' |
---|
3875 |           CALL message( 'netcdf_data_input_mod', 'PA0565',      & |
---|
3876 |                  2, 2, myid, 6, 0 ) |
---|
3877 | Â Â Â Â Â Â Â Â ENDIF |
---|
3878 | Â Â Â Â Â Â Â ENDIF |
---|
3879 | ! |
---|
3880 | !--Â Â Â Â Â Check for further mismatches. e.g. relative fractions exceed 1 or |
---|
3881 | !--Â Â Â Â Â vegetation_type is set but surface vegetation fraction is zero, |
---|
3882 | !--Â Â Â Â Â etc.. |
---|
3883 |        IF ( surface_fraction_f%from_file ) THEN |
---|
3884 | ! |
---|
3885 | !--Â Â Â Â Â Â Â Sum of relative fractions must not exceed 1. |
---|
3886 |         IF ( SUM ( surface_fraction_f%frac(0:2,j,i) ) > 1.0_wp ) THEN |
---|
3887 |           message_string = 'surface_fraction must not exceed 1' |
---|
3888 |           CALL message( 'netcdf_data_input_mod', 'PA0566',      & |
---|
3889 |                  2, 2, myid, 6, 0 ) |
---|
3890 | Â Â Â Â Â Â Â Â ENDIF |
---|
3891 | ! |
---|
3892 | !--Â Â Â Â Â Â Â Relative fraction for a type must not be zero at locations where |
---|
3893 | !--Â Â Â Â Â Â Â this type is set. |
---|
3894 | Â Â Â Â Â Â Â Â IFÂ (Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â & |
---|
3895 |          ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill .AND.& |
---|
3896 |          ( surface_fraction_f%frac(ind_veg_wall,j,i) == 0.0_wp .OR.  & |
---|
3897 | Â Â Â Â Â Â Â Â Â Â surface_fraction_f%frac(ind_veg_wall,j,i)Â ==Â Â Â Â Â Â Â Â & |
---|
3898 |                            surface_fraction_f%fill ) & |
---|
3899 |          ) .OR.                           & |
---|
3900 |          ( pavement_type_f%var(j,i) /= pavement_type_f%fill   .AND. & |
---|
3901 |          ( surface_fraction_f%frac(ind_pav_green,j,i) == 0.0_wp .OR.  & |
---|
3902 | Â Â Â Â Â Â Â Â Â Â surface_fraction_f%frac(ind_pav_green,j,i)Â ==Â Â Â Â Â Â Â Â & |
---|
3903 |                            surface_fraction_f%fill ) & |
---|
3904 |          ) .OR.                           & |
---|
3905 |          ( water_type_f%var(j,i) /= water_type_f%fill      .AND. & |
---|
3906 |          ( surface_fraction_f%frac(ind_wat_win,j,i) == 0.0_wp .OR.   & |
---|
3907 | Â Â Â Â Â Â Â Â Â Â surface_fraction_f%frac(ind_wat_win,j,i)Â ==Â Â Â Â Â Â Â Â Â & |
---|
3908 |                            surface_fraction_f%fill ) & |
---|
3909 | Â Â Â Â Â Â Â Â Â )Â )Â THEN |
---|
3910 |           WRITE( message_string, * ) 'Mismatch in setting of '   // & |
---|
3911 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'surface_fraction. Vegetation-, pavement-, or '//Â & |
---|
3912 |                'water surface is given at (i,j) = ( ', i, j,   & |
---|
3913 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ' ), but surface fraction is 0 for the given type.' |
---|
3914 |           CALL message( 'netcdf_data_input_mod', 'PA0567',      & |
---|
3915 |                  2, 2, myid, 6, 0 ) |
---|
3916 | Â Â Â Â Â Â Â Â ENDIF |
---|
3917 | ! |
---|
3918 | !--Â Â Â Â Â Â Â Relative fraction for a type must not contain non-zero values |
---|
3919 | !--Â Â Â Â Â Â Â if this type is not set. |
---|
3920 | Â Â Â Â Â Â Â Â IFÂ (Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â & |
---|
3921 |          ( vegetation_type_f%var(j,i) == vegetation_type_f%fill .AND.& |
---|
3922 |          ( surface_fraction_f%frac(ind_veg_wall,j,i) /= 0.0_wp .AND.  & |
---|
3923 | Â Â Â Â Â Â Â Â Â Â surface_fraction_f%frac(ind_veg_wall,j,i)Â /=Â Â Â Â Â Â Â Â & |
---|
3924 |                            surface_fraction_f%fill ) & |
---|
3925 |          ) .OR.                           & |
---|
3926 |          ( pavement_type_f%var(j,i) == pavement_type_f%fill   .AND. & |
---|
3927 |          ( surface_fraction_f%frac(ind_pav_green,j,i) /= 0.0_wp .AND. & |
---|
3928 | Â Â Â Â Â Â Â Â Â Â surface_fraction_f%frac(ind_pav_green,j,i)Â /=Â Â Â Â Â Â Â Â & |
---|
3929 |                            surface_fraction_f%fill ) & |
---|
3930 |          ) .OR.                           & |
---|
3931 |          ( water_type_f%var(j,i) == water_type_f%fill      .AND. & |
---|
3932 |          ( surface_fraction_f%frac(ind_wat_win,j,i) /= 0.0_wp .AND.  & |
---|
3933 | Â Â Â Â Â Â Â Â Â Â surface_fraction_f%frac(ind_wat_win,j,i)Â /=Â Â Â Â Â Â Â Â Â & |
---|
3934 |                            surface_fraction_f%fill ) & |
---|
3935 | Â Â Â Â Â Â Â Â Â )Â )Â THEN |
---|
3936 |           WRITE( message_string, * ) 'Mismatch in setting of '   // & |
---|
3937 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'surface_fraction. Vegetation-, pavement-, or '//Â & |
---|
3938 |                'water surface is not given at (i,j) = ( ', i, j, & |
---|
3939 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ' ), but surface fraction is not 0 for the 'Â //Â Â & |
---|
3940 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'given type.' |
---|
3941 |           CALL message( 'netcdf_data_input_mod', 'PA0568',      & |
---|
3942 |                  2, 2, myid, 6, 0 ) |
---|
3943 | Â Â Â Â Â Â Â Â ENDIF |
---|
3944 | Â Â Â Â Â Â Â ENDIF |
---|
3945 | ! |
---|
3946 | !--Â Â Â Â Â Check vegetation_pars. If vegetation_type is 0, all parameters |
---|
3947 | !--Â Â Â Â Â need to be set, otherwise, single parameters set by |
---|
3948 | !--Â Â Â Â Â vegetation_type can be overwritten. |
---|
3949 |        IF ( vegetation_type_f%from_file ) THEN |
---|
3950 | Â Â Â Â Â Â Â Â IFÂ (Â vegetation_type_f%var(j,i)Â ==Â 0Â )Â THEN |
---|
3951 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â vegetation_pars_f%pars_xy(:,j,i)Â ==Â Â Â Â Â Â Â Â & |
---|
3952 |                vegetation_pars_f%fill ) ) THEN |
---|
3953 |            message_string = 'If vegetation_type(y,x) = 0, all ' // & |
---|
3954 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'parameters of vegetation_pars at '//Â Â & |
---|
3955 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'this location must be set.' |
---|
3956 |            CALL message( 'netcdf_data_input_mod', 'PA0569',     & |
---|
3957 |                    2, 2, myid, 6, 0 ) |
---|
3958 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
3959 | Â Â Â Â Â Â Â Â ENDIF |
---|
3960 | Â Â Â Â Â Â Â ENDIF |
---|
3961 | ! |
---|
3962 | !--Â Â Â Â Â Check root distribution. If vegetation_type is 0, all levels must |
---|
3963 | !--Â Â Â Â Â be set. |
---|
3964 |        IF ( vegetation_type_f%from_file ) THEN |
---|
3965 | Â Â Â Â Â Â Â Â IFÂ (Â vegetation_type_f%var(j,i)Â ==Â 0Â )Â THEN |
---|
3966 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â root_area_density_lsm_f%var(:,j,i)Â ==Â Â Â Â Â Â Â & |
---|
3967 |                root_area_density_lsm_f%fill ) ) THEN |
---|
3968 |            message_string = 'If vegetation_type(y,x) = 0, all ' // & |
---|
3969 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'levels of root_area_dens_s 'Â //Â Â Â Â & |
---|
3970 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'must be set at this location.' |
---|
3971 |            CALL message( 'netcdf_data_input_mod', 'PA0570',     & |
---|
3972 |                    2, 2, myid, 6, 0 ) |
---|
3973 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
3974 | Â Â Â Â Â Â Â Â ENDIF |
---|
3975 | Â Â Â Â Â Â Â ENDIF |
---|
3976 | ! |
---|
3977 | !--Â Â Â Â Â Check soil parameters. If soil_type is 0, all parameters |
---|
3978 | !--Â Â Â Â Â must be set. |
---|
3979 |        IF ( soil_type_f%from_file ) THEN |
---|
3980 |         check_passed = .TRUE. |
---|
3981 |         IF ( ALLOCATED( soil_type_f%var_2d ) ) THEN |
---|
3982 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â soil_type_f%var_2d(j,i)Â ==Â 0Â )Â THEN |
---|
3983 | Â Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â soil_pars_f%pars_xy(:,j,i)Â ==Â Â Â Â Â Â Â Â Â & |
---|
3984 |                 soil_pars_f%fill ) ) check_passed = .FALSE. |
---|
3985 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
3986 | Â Â Â Â Â Â Â Â ELSE |
---|
3987 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â soil_type_f%var_3d(:,j,i)Â ==Â 0Â )Â )Â THEN |
---|
3988 | Â Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â soil_pars_f%pars_xy(:,j,i)Â ==Â Â Â Â Â Â Â Â Â & |
---|
3989 |                 soil_pars_f%fill ) ) check_passed = .FALSE. |
---|
3990 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
3991 | Â Â Â Â Â Â Â Â ENDIF |
---|
3992 |         IF ( .NOT. check_passed ) THEN |
---|
3993 |           message_string = 'If soil_type(y,x) = 0, all levels of ' //& |
---|
3994 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'soil_pars at this location must be set.' |
---|
3995 |           CALL message( 'netcdf_data_input_mod', 'PA0571',      & |
---|
3996 |                  2, 2, myid, 6, 0 ) |
---|
3997 | Â Â Â Â Â Â Â Â ENDIF |
---|
3998 | Â Â Â Â Â Â Â ENDIF |
---|
3999 | |
---|
4000 | ! |
---|
4001 | !--Â Â Â Â Â Check building parameters. If building_type is 0, all parameters |
---|
4002 | !--Â Â Â Â Â must be set. |
---|
4003 |        IF ( building_type_f%from_file ) THEN |
---|
4004 | Â Â Â Â Â Â Â Â IFÂ (Â building_type_f%var(j,i)Â ==Â 0Â )Â THEN |
---|
4005 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â building_pars_f%pars_xy(:,j,i)Â ==Â Â Â Â Â Â Â Â Â & |
---|
4006 |                building_pars_f%fill ) ) THEN |
---|
4007 |            message_string = 'If building_type(y,x) = 0, all ' //  & |
---|
4008 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'parameters of building_pars at this '//& |
---|
4009 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'location must be set.' |
---|
4010 |            CALL message( 'netcdf_data_input_mod', 'PA0572',     & |
---|
4011 |                    2, 2, myid, 6, 0 ) |
---|
4012 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4013 | Â Â Â Â Â Â Â Â ENDIF |
---|
4014 | Â Â Â Â Â Â Â ENDIF |
---|
4015 | ! |
---|
4016 | !--Â Â Â Â Â Check if building_type is set at each building and vice versa. |
---|
4017 |        IF ( building_type_f%from_file .AND. buildings_f%from_file ) THEN |
---|
4018 |         IF ( buildings_f%lod == 1 ) THEN |
---|
4019 |           IF ( buildings_f%var_2d(j,i) /= buildings_f%fill1 .AND.  & |
---|
4020 |             building_type_f%var(j,i) == building_type_f%fill ) THEN |
---|
4021 |            WRITE( message_string, * ) 'Each location where a ' //  & |
---|
4022 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'building is set requires a type 'Â //Â & |
---|
4023 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â '( and vice versa ) in case the 'Â //Â & |
---|
4024 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'urban-surface model is applied. 'Â //Â & |
---|
4025 |                      'i, j = ', i, j |
---|
4026 |            CALL message( 'netcdf_data_input_mod', 'PA0573',     & |
---|
4027 |                    2, 2, myid, 6, 0 ) |
---|
4028 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4029 | Â Â Â Â Â Â Â Â ENDIF |
---|
4030 |         IF ( buildings_f%lod == 2 ) THEN |
---|
4031 |           IF ( ANY( buildings_f%var_3d(:,j,i) == 1 ) .AND.      & |
---|
4032 |             building_type_f%var(j,i) == building_type_f%fill ) THEN |
---|
4033 |            WRITE( message_string, * ) 'Each location where a ' //  & |
---|
4034 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'building is set requires a type 'Â //Â & |
---|
4035 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â '( and vice versa ) in case the 'Â //Â & |
---|
4036 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'urban-surface model is applied. 'Â //Â & |
---|
4037 |                      'i, j = ', i, j |
---|
4038 |            CALL message( 'netcdf_data_input_mod', 'PA0573',     & |
---|
4039 |                    2, 2, myid, 6, 0 ) |
---|
4040 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4041 | Â Â Â Â Â Â Â Â ENDIF |
---|
4042 | Â Â Â Â Â Â Â ENDIF |
---|
4043 | ! |
---|
4044 | !--Â Â Â Â Â Check if at each location where a building is present also an ID |
---|
4045 | !--Â Â Â Â Â is set and vice versa. |
---|
4046 |        IF ( buildings_f%from_file ) THEN |
---|
4047 |         IF ( buildings_f%lod == 1 ) THEN |
---|
4048 |           IF ( buildings_f%var_2d(j,i) /= buildings_f%fill1 .AND.  & |
---|
4049 |             building_id_f%var(j,i) == building_id_f%fill ) THEN |
---|
4050 |            WRITE( message_string, * ) 'Each location where a ' //  & |
---|
4051 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'building is set requires an ID 'Â //Â & |
---|
4052 |                      '( and vice versa ). i, j = ', i, j |
---|
4053 |            CALL message( 'netcdf_data_input_mod', 'PA0574',     & |
---|
4054 |                    2, 2, myid, 6, 0 ) |
---|
4055 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4056 |         ELSEIF ( buildings_f%lod == 2 ) THEN |
---|
4057 |           IF ( ANY( buildings_f%var_3d(:,j,i) == 1 ) .AND.      & |
---|
4058 |             building_id_f%var(j,i) == building_id_f%fill ) THEN |
---|
4059 |            WRITE( message_string, * ) 'Each location where a ' //  & |
---|
4060 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'building is set requires an ID 'Â //Â & |
---|
4061 |                      '( and vice versa ). i, j = ', i, j |
---|
4062 |            CALL message( 'netcdf_data_input_mod', 'PA0574',     & |
---|
4063 |                    2, 2, myid, 6, 0 ) |
---|
4064 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4065 | Â Â Â Â Â Â Â Â ENDIF |
---|
4066 | Â Â Â Â Â Â Â ENDIF |
---|
4067 | ! |
---|
4068 | !--Â Â Â Â Â Check if building ID is set where a bulding is defined. |
---|
4069 |        IF ( buildings_f%from_file ) THEN |
---|
4070 |         IF ( buildings_f%lod == 1 ) THEN |
---|
4071 |           IF ( buildings_f%var_2d(j,i) /= buildings_f%fill1 .AND.  & |
---|
4072 |             building_id_f%var(j,i) == building_id_f%fill ) THEN |
---|
4073 |            WRITE( message_string, * ) 'Each building grid point '// & |
---|
4074 |                          'requires an ID.', i, j |
---|
4075 |            CALL message( 'netcdf_data_input_mod', 'PA0575',     & |
---|
4076 |                    2, 2, myid, 6, 0 ) |
---|
4077 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4078 |         ELSEIF ( buildings_f%lod == 2 ) THEN |
---|
4079 |           IF ( ANY( buildings_f%var_3d(:,j,i) == 1 ) .AND.      & |
---|
4080 |             building_id_f%var(j,i) == building_id_f%fill ) THEN |
---|
4081 |            WRITE( message_string, * ) 'Each building grid point '// & |
---|
4082 |                          'requires an ID.', i, j |
---|
4083 |            CALL message( 'netcdf_data_input_mod', 'PA0575',     & |
---|
4084 |                    2, 2, myid, 6, 0 ) |
---|
4085 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4086 | Â Â Â Â Â Â Â Â ENDIF |
---|
4087 | Â Â Â Â Â Â Â ENDIF |
---|
4088 | ! |
---|
4089 | !--Â Â Â Â Â Check albedo parameters. If albedo_type is 0, all parameters |
---|
4090 | !--Â Â Â Â Â must be set. |
---|
4091 |        IF ( albedo_type_f%from_file ) THEN |
---|
4092 | Â Â Â Â Â Â Â Â IFÂ (Â albedo_type_f%var(j,i)Â ==Â 0Â )Â THEN |
---|
4093 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â albedo_pars_f%pars_xy(:,j,i)Â ==Â Â Â Â Â Â Â Â Â Â & |
---|
4094 |                albedo_pars_f%fill ) ) THEN |
---|
4095 |            message_string = 'If albedo_type(y,x) = 0, all ' //   & |
---|
4096 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'parameters of albedo_pars at this 'Â //Â & |
---|
4097 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'location must be set.' |
---|
4098 |            CALL message( 'netcdf_data_input_mod', 'PA0576',     & |
---|
4099 |                    2, 2, myid, 6, 0 ) |
---|
4100 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4101 | Â Â Â Â Â Â Â Â ENDIF |
---|
4102 | Â Â Â Â Â Â Â ENDIF |
---|
4103 | |
---|
4104 | ! |
---|
4105 | !--Â Â Â Â Â Check pavement parameters. If pavement_type is 0, all parameters |
---|
4106 | !--Â Â Â Â Â of pavement_pars must be set at this location. |
---|
4107 |        IF ( pavement_type_f%from_file ) THEN |
---|
4108 | Â Â Â Â Â Â Â Â IFÂ (Â pavement_type_f%var(j,i)Â ==Â 0Â )Â THEN |
---|
4109 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â pavement_pars_f%pars_xy(:,j,i)Â ==Â Â Â Â Â Â Â Â Â & |
---|
4110 |                pavement_pars_f%fill ) ) THEN |
---|
4111 |            message_string = 'If pavement_type(y,x) = 0, all ' //  & |
---|
4112 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'parameters of pavement_pars at this '//& |
---|
4113 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'location must be set.' |
---|
4114 |            CALL message( 'netcdf_data_input_mod', 'PA0577',     & |
---|
4115 |                    2, 2, myid, 6, 0 ) |
---|
4116 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4117 | Â Â Â Â Â Â Â Â ENDIF |
---|
4118 | Â Â Â Â Â Â Â ENDIF |
---|
4119 | ! |
---|
4120 | !--Â Â Â Â Â Check pavement-subsurface parameters. If pavement_type is 0, |
---|
4121 | !--     all parameters of pavement_subsurface_pars must be set at this |
---|
4122 | !--Â Â Â Â Â location. |
---|
4123 |        IF ( pavement_type_f%from_file ) THEN |
---|
4124 | Â Â Â Â Â Â Â Â IFÂ (Â pavement_type_f%var(j,i)Â ==Â 0Â )Â THEN |
---|
4125 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â pavement_subsurface_pars_f%pars_xyz(:,:,j,i)Â ==Â Â & |
---|
4126 |                pavement_subsurface_pars_f%fill ) ) THEN |
---|
4127 |            message_string = 'If pavement_type(y,x) = 0, all ' //  & |
---|
4128 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'parameters of 'Â Â Â Â Â Â Â Â Â //Â Â & |
---|
4129 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'pavement_subsurface_pars at this '//Â Â & |
---|
4130 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'location must be set.' |
---|
4131 |            CALL message( 'netcdf_data_input_mod', 'PA0578',     & |
---|
4132 |                    2, 2, myid, 6, 0 ) |
---|
4133 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4134 | Â Â Â Â Â Â Â Â ENDIF |
---|
4135 | Â Â Â Â Â Â Â ENDIF |
---|
4136 | |
---|
4137 | ! |
---|
4138 | !--Â Â Â Â Â Check water parameters. If water_type is 0, all parameters |
---|
4139 | !--     must be set at this location. |
---|
4140 |        IF ( water_type_f%from_file ) THEN |
---|
4141 | Â Â Â Â Â Â Â Â IFÂ (Â water_type_f%var(j,i)Â ==Â 0Â )Â THEN |
---|
4142 | Â Â Â Â Â Â Â Â Â Â IFÂ (Â ANY(Â water_pars_f%pars_xy(:,j,i)Â ==Â Â Â Â Â Â Â Â Â Â & |
---|
4143 |                water_pars_f%fill ) ) THEN |
---|
4144 |            message_string = 'If water_type(y,x) = 0, all ' //    & |
---|
4145 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'parameters of water_pars at this 'Â //Â & |
---|
4146 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'location must be set.' |
---|
4147 |            CALL message( 'netcdf_data_input_mod', 'PA0579',     & |
---|
4148 |                    2, 2, myid, 6, 0 ) |
---|
4149 | Â Â Â Â Â Â Â Â Â Â ENDIF |
---|
4150 | Â Â Â Â Â Â Â Â ENDIF |
---|
4151 | Â Â Â Â Â Â Â ENDIF |
---|
4152 | |
---|
4153 | Â Â Â Â Â ENDDO |
---|
4154 | Â Â Â Â ENDDO |
---|
4155 | |
---|
4156 | Â Â END SUBROUTINE netcdf_data_input_check_static |
---|
4157 | |
---|
4158 | !------------------------------------------------------------------------------! |
---|
4159 | ! Description: |
---|
4160 | ! ------------ |
---|
4161 | !> Resize 8-bit 2D Integer array: (nys:nyn,nxl:nxr) -> (nysg:nyng,nxlg:nxrg) |
---|
4162 | !------------------------------------------------------------------------------! |
---|
4163 |   SUBROUTINE resize_array_2d_int8( var, js, je, is, ie ) |
---|
4164 | Â Â |
---|
4165 | Â Â Â Â IMPLICIT NONE |
---|
4166 | |
---|
4167 |     INTEGER(iwp) :: je !< upper index bound along y direction |
---|
4168 |     INTEGER(iwp) :: js !< lower index bound along y direction |
---|
4169 |     INTEGER(iwp) :: ie !< upper index bound along x direction |
---|
4170 |     INTEGER(iwp) :: is !< lower index bound along x direction |
---|
4171 | Â Â Â Â |
---|
4172 |     INTEGER(KIND=1), DIMENSION(:,:), ALLOCATABLE :: var   !< treated variable |
---|
4173 |     INTEGER(KIND=1), DIMENSION(:,:), ALLOCATABLE :: var_tmp !< temporary copy |
---|
4174 | ! |
---|
4175 | !--Â Â Allocate temporary variable |
---|
4176 | Â Â Â Â ALLOCATE(Â var_tmp(js-nbgp:je+nbgp,is-nbgp:ie+nbgp)Â ) |
---|
4177 | ! |
---|
4178 | !--Â Â Temporary copy of the variable |
---|
4179 | Â Â Â Â var_tmp(js:je,is:ie)Â =Â var(js:je,is:ie) |
---|
4180 | ! |
---|
4181 | !--Â Â Resize the array |
---|
4182 |     DEALLOCATE( var ) |
---|
4183 | Â Â Â Â ALLOCATE(Â var(js-nbgp:je+nbgp,is-nbgp:ie+nbgp)Â ) |
---|
4184 | ! |
---|
4185 | !--Â Â Transfer temporary copy back to original array |
---|
4186 | Â Â Â Â var(js:je,is:ie)Â =Â var_tmp(js:je,is:ie) |
---|
4187 | |
---|
4188 | Â Â END SUBROUTINE resize_array_2d_int8 |
---|
4189 | Â Â |
---|
4190 | !------------------------------------------------------------------------------! |
---|
4191 | ! Description: |
---|
4192 | ! ------------ |
---|
4193 | !> Resize 32-bit 2D Integer array: (nys:nyn,nxl:nxr) -> (nysg:nyng,nxlg:nxrg) |
---|
4194 | !------------------------------------------------------------------------------! |
---|
4195 |   SUBROUTINE resize_array_2d_int32( var, js, je, is, ie ) |
---|
4196 | |
---|
4197 | Â Â Â Â IMPLICIT NONE |
---|
4198 | Â Â Â Â |
---|
4199 |     INTEGER(iwp) :: je !< upper index bound along y direction |
---|
4200 |     INTEGER(iwp) :: js !< lower index bound along y direction |
---|
4201 |     INTEGER(iwp) :: ie !< upper index bound along x direction |
---|
4202 |     INTEGER(iwp) :: is !< lower index bound along x direction |
---|
4203 | |
---|
4204 |     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: var   !< treated variable |
---|
4205 |     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: var_tmp !< temporary copy |
---|
4206 | ! |
---|
4207 | !--Â Â Allocate temporary variable |
---|
4208 | Â Â Â Â ALLOCATE(Â var_tmp(js-nbgp:je+nbgp,is-nbgp:ie+nbgp)Â ) |
---|
4209 | ! |
---|
4210 | !--Â Â Temporary copy of the variable |
---|
4211 | Â Â Â Â var_tmp(js:je,is:ie)Â =Â var(js:je,is:ie) |
---|
4212 | ! |
---|
4213 | !--Â Â Resize the array |
---|
4214 |     DEALLOCATE( var ) |
---|
4215 | Â Â Â Â ALLOCATE(Â var(js-nbgp:je+nbgp,is-nbgp:ie+nbgp)Â ) |
---|
4216 | ! |
---|
4217 | !--Â Â Transfer temporary copy back to original array |
---|
4218 | Â Â Â Â var(js:je,is:ie)Â =Â var_tmp(js:je,is:ie) |
---|
4219 | |
---|
4220 | Â Â END SUBROUTINE resize_array_2d_int32 |
---|
4221 | Â Â |
---|
4222 | !------------------------------------------------------------------------------! |
---|
4223 | ! Description: |
---|
4224 | ! ------------ |
---|
4225 | !> Resize 8-bit 3D Integer array: (:,nys:nyn,nxl:nxr) -> (:,nysg:nyng,nxlg:nxrg) |
---|
4226 | !------------------------------------------------------------------------------! |
---|
4227 |   SUBROUTINE resize_array_3d_int8( var, ks, ke, js, je, is, ie ) |
---|
4228 | |
---|
4229 | Â Â Â Â IMPLICIT NONE |
---|
4230 | |
---|
4231 |     INTEGER(iwp) :: je !< upper index bound along y direction |
---|
4232 |     INTEGER(iwp) :: js !< lower index bound along y direction |
---|
4233 |     INTEGER(iwp) :: ie !< upper index bound along x direction |
---|
4234 |     INTEGER(iwp) :: is !< lower index bound along x direction |
---|
4235 |     INTEGER(iwp) :: ke !< upper bound of treated array in z-direction |
---|
4236 |     INTEGER(iwp) :: ks !< lower bound of treated array in z-direction |
---|
4237 | Â Â Â Â |
---|
4238 |     INTEGER(KIND=1), DIMENSION(:,:,:), ALLOCATABLE :: var   !< treated variable |
---|
4239 |     INTEGER(KIND=1), DIMENSION(:,:,:), ALLOCATABLE :: var_tmp !< temporary copy |
---|
4240 | ! |
---|
4241 | !--Â Â Allocate temporary variable |
---|
4242 | Â Â Â Â ALLOCATE(Â var_tmp(ks:ke,js-nbgp:je+nbgp,is-nbgp:ie+nbgp)Â ) |
---|
4243 | ! |
---|
4244 | !--Â Â Temporary copy of the variable |
---|
4245 | Â Â Â Â var_tmp(ks:ke,js:je,is:ie)Â =Â var(ks:ke,js:je,is:ie) |
---|
4246 | ! |
---|
4247 | !--Â Â Resize the array |
---|
4248 |     DEALLOCATE( var ) |
---|
4249 | Â Â Â Â ALLOCATE(Â var(ks:ke,js-nbgp:je+nbgp,is-nbgp:ie+nbgp)Â ) |
---|
4250 | ! |
---|
4251 | !--Â Â Transfer temporary copy back to original array |
---|
4252 | Â Â Â Â var(ks:ke,js:je,is:ie)Â =Â var_tmp(ks:ke,js:je,is:ie) |
---|
4253 | |
---|
4254 | Â Â END SUBROUTINE resize_array_3d_int8 |
---|
4255 | Â Â |
---|
4256 | !------------------------------------------------------------------------------! |
---|
4257 | ! Description: |
---|
4258 | ! ------------ |
---|
4259 | !> Resize 3D Real array: (:,nys:nyn,nxl:nxr) -> (:,nysg:nyng,nxlg:nxrg) |
---|
4260 | !------------------------------------------------------------------------------! |
---|
4261 |   SUBROUTINE resize_array_3d_real( var, ks, ke, js, je, is, ie ) |
---|
4262 | |
---|
4263 | Â Â Â Â IMPLICIT NONE |
---|
4264 | |
---|
4265 |     INTEGER(iwp) :: je !< upper index bound along y direction |
---|
4266 |     INTEGER(iwp) :: js !< lower index bound along y direction |
---|
4267 |     INTEGER(iwp) :: ie !< upper index bound along x direction |
---|
4268 |     INTEGER(iwp) :: is !< lower index bound along x direction |
---|
4269 |     INTEGER(iwp) :: ke !< upper bound of treated array in z-direction |
---|
4270 |     INTEGER(iwp) :: ks !< lower bound of treated array in z-direction |
---|
4271 | Â Â Â Â |
---|
4272 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: var   !< treated variable |
---|
4273 |     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: var_tmp !< temporary copy |
---|
4274 | ! |
---|
4275 | !--Â Â Allocate temporary variable |
---|
4276 | Â Â Â Â ALLOCATE(Â var_tmp(ks:ke,js-nbgp:je+nbgp,is-nbgp:ie+nbgp)Â ) |
---|
4277 | ! |
---|
4278 | !--Â Â Temporary copy of the variable |
---|
4279 | Â Â Â Â var_tmp(ks:ke,js:je,is:ie)Â =Â var(ks:ke,js:je,is:ie) |
---|
4280 | ! |
---|
4281 | !--Â Â Resize the array |
---|
4282 |     DEALLOCATE( var ) |
---|
4283 | Â Â Â Â ALLOCATE(Â var(ks:ke,js-nbgp:je+nbgp,is-nbgp:ie+nbgp)Â ) |
---|
4284 | ! |
---|
4285 | !--Â Â Transfer temporary copy back to original array |
---|
4286 | Â Â Â Â var(ks:ke,js:je,is:ie)Â =Â var_tmp(ks:ke,js:je,is:ie) |
---|
4287 | |
---|
4288 | Â Â END SUBROUTINE resize_array_3d_real |
---|
4289 | Â Â |
---|
4290 | !------------------------------------------------------------------------------! |
---|
4291 | ! Description: |
---|
4292 | ! ------------ |
---|
4293 | !> Resize 4D Real array: (:,:,nys:nyn,nxl:nxr) -> (:,nysg:nyng,nxlg:nxrg) |
---|
4294 | !------------------------------------------------------------------------------! |
---|
4295 |   SUBROUTINE resize_array_4d_real( var, k1s, k1e, k2s, k2e, js, je, is, ie ) |
---|
4296 | |
---|
4297 | Â Â Â Â IMPLICIT NONE |
---|
4298 | Â Â Â Â |
---|
4299 |     INTEGER(iwp) :: je !< upper index bound along y direction |
---|
4300 |     INTEGER(iwp) :: js !< lower index bound along y direction |
---|
4301 |     INTEGER(iwp) :: ie !< upper index bound along x direction |
---|
4302 |     INTEGER(iwp) :: is !< lower index bound along x direction |
---|
4303 |     INTEGER(iwp) :: k1e !< upper bound of treated array in z-direction |
---|
4304 |     INTEGER(iwp) :: k1s !< lower bound of treated array in z-direction |
---|
4305 |     INTEGER(iwp) :: k2e !< upper bound of treated array along parameter space |
---|
4306 | Â Â Â Â |
---|