1 | !> @file radiation_model_mod.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
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-2017 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: radiation_model_mod.f90 2604 2017-11-06 13:29:00Z raasch $ |
---|
27 | ! bugfix for calculation of effective radius using morrison microphysics |
---|
28 | ! |
---|
29 | ! 2601 2017-11-02 16:22:46Z scharf |
---|
30 | ! added emissivity to namelist |
---|
31 | ! |
---|
32 | ! 2575 2017-10-24 09:57:58Z maronga |
---|
33 | ! Bugfix: calculation of shortwave and longwave albedos for RRTMG swapped |
---|
34 | ! |
---|
35 | ! 2547 2017-10-16 12:41:56Z schwenkel |
---|
36 | ! extended by cloud_droplets option, minor bugfix and correct calculation of |
---|
37 | ! cloud droplet number concentration |
---|
38 | ! |
---|
39 | ! 2544 2017-10-13 18:09:32Z maronga |
---|
40 | ! Moved date and time quantitis to separate module date_and_time_mod |
---|
41 | ! |
---|
42 | ! 2512 2017-10-04 08:26:59Z raasch |
---|
43 | ! upper bounds of cross section and 3d output changed from nx+1,ny+1 to nx,ny |
---|
44 | ! no output of ghost layer data |
---|
45 | ! |
---|
46 | ! 2504 2017-09-27 10:36:13Z maronga |
---|
47 | ! Updates pavement types and albedo parameters |
---|
48 | ! |
---|
49 | ! 2328 2017-08-03 12:34:22Z maronga |
---|
50 | ! Emissivity can now be set individually for each pixel. |
---|
51 | ! Albedo type can be inferred from land surface model. |
---|
52 | ! Added default albedo type for bare soil |
---|
53 | ! |
---|
54 | ! 2318 2017-07-20 17:27:44Z suehring |
---|
55 | ! Get topography top index via Function call |
---|
56 | ! |
---|
57 | ! 2317 2017-07-20 17:27:19Z suehring |
---|
58 | ! Improved syntax layout |
---|
59 | ! |
---|
60 | ! 2298 2017-06-29 09:28:18Z raasch |
---|
61 | ! type of write_binary changed from CHARACTER to LOGICAL |
---|
62 | ! |
---|
63 | ! 2296 2017-06-28 07:53:56Z maronga |
---|
64 | ! Added output of rad_sw_out for radiation_scheme = 'constant' |
---|
65 | ! |
---|
66 | ! 2270 2017-06-09 12:18:47Z maronga |
---|
67 | ! Numbering changed (2 timeseries removed) |
---|
68 | ! |
---|
69 | ! 2249 2017-06-06 13:58:01Z sward |
---|
70 | ! Allow for RRTMG runs without humidity/cloud physics |
---|
71 | ! |
---|
72 | ! 2248 2017-06-06 13:52:54Z sward |
---|
73 | ! Error no changed |
---|
74 | ! |
---|
75 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
76 | ! |
---|
77 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
78 | ! Adjustments to new topography concept |
---|
79 | ! Bugfix in read restart |
---|
80 | ! |
---|
81 | ! 2200 2017-04-11 11:37:51Z suehring |
---|
82 | ! Bugfix in call of exchange_horiz_2d and read restart data |
---|
83 | ! |
---|
84 | ! 2163 2017-03-01 13:23:15Z schwenkel |
---|
85 | ! Bugfix in radiation_check_data_output |
---|
86 | ! |
---|
87 | ! 2157 2017-02-22 15:10:35Z suehring |
---|
88 | ! Bugfix in read_restart data |
---|
89 | ! |
---|
90 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
91 | ! Removed CALL of auxiliary SUBROUTINE get_usm_info, |
---|
92 | ! flag urban_surface is now defined in module control_parameters. |
---|
93 | ! |
---|
94 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
95 | ! Added calculation of solar directional vector for new urban surface |
---|
96 | ! model, |
---|
97 | ! accounted for urban_surface model in radiation_check_parameters, |
---|
98 | ! correction of comments for zenith angle. |
---|
99 | ! |
---|
100 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
101 | ! Forced header and separation lines into 80 columns |
---|
102 | ! |
---|
103 | ! 1976 2016-07-27 13:28:04Z maronga |
---|
104 | ! Output of 2D/3D/masked data is now directly done within this module. The |
---|
105 | ! radiation schemes have been simplified for better usability so that |
---|
106 | ! rad_lw_in, rad_lw_out, rad_sw_in, and rad_sw_out are available independent of |
---|
107 | ! the radiation code used. |
---|
108 | ! |
---|
109 | ! 1856 2016-04-13 12:56:17Z maronga |
---|
110 | ! Bugfix: allocation of rad_lw_out for radiation_scheme = 'clear-sky' |
---|
111 | ! |
---|
112 | ! 1853 2016-04-11 09:00:35Z maronga |
---|
113 | ! Added routine for radiation_scheme = constant. |
---|
114 | ! |
---|
115 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
116 | ! Adapted for modularization of microphysics |
---|
117 | ! |
---|
118 | ! 1826 2016-04-07 12:01:39Z maronga |
---|
119 | ! Further modularization. |
---|
120 | ! |
---|
121 | ! 1788 2016-03-10 11:01:04Z maronga |
---|
122 | ! Added new albedo class for pavements / roads. |
---|
123 | ! |
---|
124 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
125 | ! palm-netcdf-module removed in order to avoid a circular module dependency, |
---|
126 | ! netcdf-variables moved to netcdf-module, new routine netcdf_handle_error_rad |
---|
127 | ! added |
---|
128 | ! |
---|
129 | ! 1757 2016-02-22 15:49:32Z maronga |
---|
130 | ! Added parameter unscheduled_radiation_calls. Bugfix: interpolation of sounding |
---|
131 | ! profiles for pressure and temperature above the LES domain. |
---|
132 | ! |
---|
133 | ! 1709 2015-11-04 14:47:01Z maronga |
---|
134 | ! Bugfix: set initial value for rrtm_lwuflx_dt to zero, small formatting |
---|
135 | ! corrections |
---|
136 | ! |
---|
137 | ! 1701 2015-11-02 07:43:04Z maronga |
---|
138 | ! Bugfixes: wrong index for output of timeseries, setting of nz_snd_end |
---|
139 | ! |
---|
140 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
141 | ! Added option for spin-up runs without radiation (skip_time_do_radiation). Bugfix |
---|
142 | ! in calculation of pressure profiles. Bugfix in calculation of trace gas profiles. |
---|
143 | ! Added output of radiative heating rates. |
---|
144 | ! |
---|
145 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
146 | ! Code annotations made doxygen readable |
---|
147 | ! |
---|
148 | ! 1606 2015-06-29 10:43:37Z maronga |
---|
149 | ! Added preprocessor directive __netcdf to allow for compiling without netCDF. |
---|
150 | ! Note, however, that RRTMG cannot be used without netCDF. |
---|
151 | ! |
---|
152 | ! 1590 2015-05-08 13:56:27Z maronga |
---|
153 | ! Bugfix: definition of character strings requires same length for all elements |
---|
154 | ! |
---|
155 | ! 1587 2015-05-04 14:19:01Z maronga |
---|
156 | ! Added albedo class for snow |
---|
157 | ! |
---|
158 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
159 | ! Added support for RRTMG |
---|
160 | ! |
---|
161 | ! 1571 2015-03-12 16:12:49Z maronga |
---|
162 | ! Added missing KIND attribute. Removed upper-case variable names |
---|
163 | ! |
---|
164 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
165 | ! Added support for data output. Various variables have been renamed. Added |
---|
166 | ! interface for different radiation schemes (currently: clear-sky, constant, and |
---|
167 | ! RRTM (not yet implemented). |
---|
168 | ! |
---|
169 | ! 1496 2014-12-02 17:25:50Z maronga |
---|
170 | ! Initial revision |
---|
171 | ! |
---|
172 | ! |
---|
173 | ! Description: |
---|
174 | ! ------------ |
---|
175 | !> Radiation models and interfaces |
---|
176 | !> @todo move variable definitions used in radiation_init only to the subroutine |
---|
177 | !> as they are no longer required after initialization. |
---|
178 | !> @todo Output of full column vertical profiles used in RRTMG |
---|
179 | !> @todo Output of other rrtm arrays (such as volume mixing ratios) |
---|
180 | !> @todo Adapt for use with topography |
---|
181 | !> |
---|
182 | !> @note Many variables have a leading dummy dimension (0:0) in order to |
---|
183 | !> match the assume-size shape expected by the RRTMG model. |
---|
184 | !------------------------------------------------------------------------------! |
---|
185 | MODULE radiation_model_mod |
---|
186 | |
---|
187 | USE arrays_3d, & |
---|
188 | ONLY: dzw, hyp, nc, pt, q, ql, zu, zw |
---|
189 | |
---|
190 | USE cloud_parameters, & |
---|
191 | ONLY: cp, l_d_cp, rho_l |
---|
192 | |
---|
193 | USE constants, & |
---|
194 | ONLY: pi |
---|
195 | |
---|
196 | USE control_parameters, & |
---|
197 | ONLY: cloud_droplets, cloud_physics, g, initializing_actions, & |
---|
198 | latitude, longitude, large_scale_forcing, lsf_surf, & |
---|
199 | microphysics_morrison, pt_surface, rho_surface, & |
---|
200 | surface_pressure, time_since_reference_point |
---|
201 | |
---|
202 | USE date_and_time_mod, & |
---|
203 | ONLY: calc_date_and_time, d_hours_day, d_seconds_hour, day_of_year, & |
---|
204 | time_utc |
---|
205 | |
---|
206 | USE indices, & |
---|
207 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
208 | |
---|
209 | USE kinds |
---|
210 | |
---|
211 | USE microphysics_mod, & |
---|
212 | ONLY: na_init, nc_const, sigma_gc |
---|
213 | |
---|
214 | #if defined ( __netcdf ) |
---|
215 | USE NETCDF |
---|
216 | #endif |
---|
217 | |
---|
218 | #if defined ( __rrtmg ) |
---|
219 | USE parrrsw, & |
---|
220 | ONLY: naerec, nbndsw |
---|
221 | |
---|
222 | USE parrrtm, & |
---|
223 | ONLY: nbndlw |
---|
224 | |
---|
225 | USE rrtmg_lw_init, & |
---|
226 | ONLY: rrtmg_lw_ini |
---|
227 | |
---|
228 | USE rrtmg_sw_init, & |
---|
229 | ONLY: rrtmg_sw_ini |
---|
230 | |
---|
231 | USE rrtmg_lw_rad, & |
---|
232 | ONLY: rrtmg_lw |
---|
233 | |
---|
234 | USE rrtmg_sw_rad, & |
---|
235 | ONLY: rrtmg_sw |
---|
236 | #endif |
---|
237 | USE surface_mod, & |
---|
238 | ONLY: get_topography_top_index |
---|
239 | |
---|
240 | IMPLICIT NONE |
---|
241 | |
---|
242 | CHARACTER(10) :: radiation_scheme = 'clear-sky' ! 'constant', 'clear-sky', or 'rrtmg' |
---|
243 | |
---|
244 | ! |
---|
245 | !-- Predefined Land surface classes (albedo_type) after Briegleb (1992) |
---|
246 | CHARACTER(37), DIMENSION(0:33), PARAMETER :: albedo_type_name = (/ & |
---|
247 | 'user defined ', & ! 0 |
---|
248 | 'ocean ', & ! 1 |
---|
249 | 'mixed farming, tall grassland ', & ! 2 |
---|
250 | 'tall/medium grassland ', & ! 3 |
---|
251 | 'evergreen shrubland ', & ! 4 |
---|
252 | 'short grassland/meadow/shrubland ', & ! 5 |
---|
253 | 'evergreen needleleaf forest ', & ! 6 |
---|
254 | 'mixed deciduous evergreen forest ', & ! 7 |
---|
255 | 'deciduous forest ', & ! 8 |
---|
256 | 'tropical evergreen broadleaved forest', & ! 9 |
---|
257 | 'medium/tall grassland/woodland ', & ! 10 |
---|
258 | 'desert, sandy ', & ! 11 |
---|
259 | 'desert, rocky ', & ! 12 |
---|
260 | 'tundra ', & ! 13 |
---|
261 | 'land ice ', & ! 14 |
---|
262 | 'sea ice ', & ! 15 |
---|
263 | 'snow ', & ! 16 |
---|
264 | 'bare soil ', & ! 17 |
---|
265 | 'asphalt/concrete mix ', & ! 18 |
---|
266 | 'asphalt (asphalt concrete) ', & ! 19 |
---|
267 | 'concrete (Portland concrete) ', & ! 20 |
---|
268 | 'sett ', & ! 21 |
---|
269 | 'paving stones ', & ! 22 |
---|
270 | 'cobblestone ', & ! 23 |
---|
271 | 'metal ', & ! 24 |
---|
272 | 'wood ', & ! 25 |
---|
273 | 'gravel ', & ! 26 |
---|
274 | 'fine gravel ', & ! 27 |
---|
275 | 'pebblestone ', & ! 28 |
---|
276 | 'woodchips ', & ! 29 |
---|
277 | 'tartan (sports) ', & ! 30 |
---|
278 | 'artifical turf (sports) ', & ! 31 |
---|
279 | 'clay (sports) ', & ! 32 |
---|
280 | 'building (dummy) ' & ! 33 |
---|
281 | /) |
---|
282 | |
---|
283 | |
---|
284 | INTEGER(iwp) :: albedo_type = 9999999, & !< Albedo surface type |
---|
285 | dots_rad = 0 !< starting index for timeseries output |
---|
286 | |
---|
287 | LOGICAL :: unscheduled_radiation_calls = .TRUE., & !< flag parameter indicating whether additional calls of the radiation code are allowed |
---|
288 | constant_albedo = .FALSE., & !< flag parameter indicating whether the albedo may change depending on zenith |
---|
289 | force_radiation_call = .FALSE., & !< flag parameter for unscheduled radiation calls |
---|
290 | lw_radiation = .TRUE., & !< flag parameter indicating whether longwave radiation shall be calculated |
---|
291 | radiation = .FALSE., & !< flag parameter indicating whether the radiation model is used |
---|
292 | sun_up = .TRUE., & !< flag parameter indicating whether the sun is up or down |
---|
293 | sw_radiation = .TRUE., & !< flag parameter indicing whether shortwave radiation shall be calculated |
---|
294 | sun_direction = .FALSE. !< flag parameter indicing whether solar direction shall be calculated |
---|
295 | |
---|
296 | |
---|
297 | REAL(wp), PARAMETER :: sigma_sb = 5.67037321E-8_wp, & !< Stefan-Boltzmann constant |
---|
298 | solar_constant = 1368.0_wp !< solar constant at top of atmosphere |
---|
299 | |
---|
300 | REAL(wp) :: albedo = 9999999.9_wp, & !< NAMELIST alpha |
---|
301 | albedo_lw_dif = 9999999.9_wp, & !< NAMELIST aldif |
---|
302 | albedo_lw_dir = 9999999.9_wp, & !< NAMELIST aldir |
---|
303 | albedo_sw_dif = 9999999.9_wp, & !< NAMELIST asdif |
---|
304 | albedo_sw_dir = 9999999.9_wp, & !< NAMELIST asdir |
---|
305 | decl_1, & !< declination coef. 1 |
---|
306 | decl_2, & !< declination coef. 2 |
---|
307 | decl_3, & !< declination coef. 3 |
---|
308 | dt_radiation = 0.0_wp, & !< radiation model timestep |
---|
309 | emissivity = 9999999.9_wp, & !< NAMELIST surface emissivity |
---|
310 | lon = 0.0_wp, & !< longitude in radians |
---|
311 | lat = 0.0_wp, & !< latitude in radians |
---|
312 | net_radiation = 0.0_wp, & !< net radiation at surface |
---|
313 | skip_time_do_radiation = 0.0_wp, & !< Radiation model is not called before this time |
---|
314 | sky_trans, & !< sky transmissivity |
---|
315 | time_radiation = 0.0_wp !< time since last call of radiation code |
---|
316 | |
---|
317 | |
---|
318 | REAL(wp), DIMENSION(0:0) :: zenith, & !< cosine of solar zenith angle |
---|
319 | sun_dir_lat, & !< solar directional vector in latitudes |
---|
320 | sun_dir_lon !< solar directional vector in longitudes |
---|
321 | |
---|
322 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: & |
---|
323 | alpha, & !< surface broadband albedo (used for clear-sky scheme) |
---|
324 | emis, & !< surface broadband emissivity |
---|
325 | rad_lw_out_change_0, & !< change in LW out due to change in surface temperature |
---|
326 | rad_net, & !< net radiation at the surface |
---|
327 | rad_net_av !< average of rad_net |
---|
328 | |
---|
329 | ! |
---|
330 | !-- Land surface albedos for solar zenith angle of 60° after Briegleb (1992) |
---|
331 | !-- (shortwave, longwave, broadband): sw, lw, bb, |
---|
332 | REAL(wp), DIMENSION(0:2,1:33), PARAMETER :: albedo_pars = RESHAPE( (/& |
---|
333 | 0.06_wp, 0.06_wp, 0.06_wp, & ! 1 |
---|
334 | 0.09_wp, 0.28_wp, 0.19_wp, & ! 2 |
---|
335 | 0.11_wp, 0.33_wp, 0.23_wp, & ! 3 |
---|
336 | 0.11_wp, 0.33_wp, 0.23_wp, & ! 4 |
---|
337 | 0.14_wp, 0.34_wp, 0.25_wp, & ! 5 |
---|
338 | 0.06_wp, 0.22_wp, 0.14_wp, & ! 6 |
---|
339 | 0.06_wp, 0.27_wp, 0.17_wp, & ! 7 |
---|
340 | 0.06_wp, 0.31_wp, 0.19_wp, & ! 8 |
---|
341 | 0.06_wp, 0.22_wp, 0.14_wp, & ! 9 |
---|
342 | 0.06_wp, 0.28_wp, 0.18_wp, & ! 10 |
---|
343 | 0.35_wp, 0.51_wp, 0.43_wp, & ! 11 |
---|
344 | 0.24_wp, 0.40_wp, 0.32_wp, & ! 12 |
---|
345 | 0.10_wp, 0.27_wp, 0.19_wp, & ! 13 |
---|
346 | 0.90_wp, 0.65_wp, 0.77_wp, & ! 14 |
---|
347 | 0.90_wp, 0.65_wp, 0.77_wp, & ! 15 |
---|
348 | 0.95_wp, 0.70_wp, 0.82_wp, & ! 16 |
---|
349 | 0.08_wp, 0.08_wp, 0.08_wp, & ! 17 |
---|
350 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 18 |
---|
351 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 19 |
---|
352 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 20 |
---|
353 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 21 |
---|
354 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 22 |
---|
355 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 23 |
---|
356 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 24 |
---|
357 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 25 |
---|
358 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 26 |
---|
359 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 27 |
---|
360 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 28 |
---|
361 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 29 |
---|
362 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 30 |
---|
363 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 31 |
---|
364 | 0.17_wp, 0.17_wp, 0.17_wp, & ! 32 |
---|
365 | 0.17_wp, 0.17_wp, 0.17_wp & ! 33 |
---|
366 | /), (/ 3, 33 /) ) |
---|
367 | |
---|
368 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET :: & |
---|
369 | rad_lw_cs_hr, & !< longwave clear sky radiation heating rate (K/s) |
---|
370 | rad_lw_cs_hr_av, & !< average of rad_lw_cs_hr |
---|
371 | rad_lw_hr, & !< longwave radiation heating rate (K/s) |
---|
372 | rad_lw_hr_av, & !< average of rad_sw_hr |
---|
373 | rad_lw_in, & !< incoming longwave radiation (W/m2) |
---|
374 | rad_lw_in_av, & !< average of rad_lw_in |
---|
375 | rad_lw_out, & !< outgoing longwave radiation (W/m2) |
---|
376 | rad_lw_out_av, & !< average of rad_lw_out |
---|
377 | rad_sw_cs_hr, & !< shortwave clear sky radiation heating rate (K/s) |
---|
378 | rad_sw_cs_hr_av, & !< average of rad_sw_cs_hr |
---|
379 | rad_sw_hr, & !< shortwave radiation heating rate (K/s) |
---|
380 | rad_sw_hr_av, & !< average of rad_sw_hr |
---|
381 | rad_sw_in, & !< incoming shortwave radiation (W/m2) |
---|
382 | rad_sw_in_av, & !< average of rad_sw_in |
---|
383 | rad_sw_out, & !< outgoing shortwave radiation (W/m2) |
---|
384 | rad_sw_out_av !< average of rad_sw_out |
---|
385 | |
---|
386 | |
---|
387 | ! |
---|
388 | !-- Variables and parameters used in RRTMG only |
---|
389 | #if defined ( __rrtmg ) |
---|
390 | CHARACTER(LEN=12) :: rrtm_input_file = "RAD_SND_DATA" !< name of the NetCDF input file (sounding data) |
---|
391 | |
---|
392 | |
---|
393 | ! |
---|
394 | !-- Flag parameters for RRTMGS (should not be changed) |
---|
395 | INTEGER(iwp), PARAMETER :: rrtm_idrv = 1, & !< flag for longwave upward flux calculation option (0,1) |
---|
396 | rrtm_inflglw = 2, & !< flag for lw cloud optical properties (0,1,2) |
---|
397 | rrtm_iceflglw = 0, & !< flag for lw ice particle specifications (0,1,2,3) |
---|
398 | rrtm_liqflglw = 1, & !< flag for lw liquid droplet specifications |
---|
399 | rrtm_inflgsw = 2, & !< flag for sw cloud optical properties (0,1,2) |
---|
400 | rrtm_iceflgsw = 0, & !< flag for sw ice particle specifications (0,1,2,3) |
---|
401 | rrtm_liqflgsw = 1 !< flag for sw liquid droplet specifications |
---|
402 | |
---|
403 | ! |
---|
404 | !-- The following variables should be only changed with care, as this will |
---|
405 | !-- require further setting of some variables, which is currently not |
---|
406 | !-- implemented (aerosols, ice phase). |
---|
407 | INTEGER(iwp) :: nzt_rad, & !< upper vertical limit for radiation calculations |
---|
408 | rrtm_icld = 0, & !< cloud flag (0: clear sky column, 1: cloudy column) |
---|
409 | rrtm_iaer = 0 !< aerosol option flag (0: no aerosol layers, for lw only: 6 (requires setting of rrtm_sw_ecaer), 10: one or more aerosol layers (not implemented) |
---|
410 | |
---|
411 | INTEGER(iwp) :: nc_stat !< local variable for storin the result of netCDF calls for error message handling |
---|
412 | |
---|
413 | LOGICAL :: snd_exists = .FALSE. !< flag parameter to check whether a user-defined input files exists |
---|
414 | |
---|
415 | REAL(wp), PARAMETER :: mol_mass_air_d_wv = 1.607793_wp !< molecular weight dry air / water vapor |
---|
416 | |
---|
417 | REAL(wp), DIMENSION(:), ALLOCATABLE :: hyp_snd, & !< hypostatic pressure from sounding data (hPa) |
---|
418 | q_snd, & !< specific humidity from sounding data (kg/kg) - dummy at the moment |
---|
419 | rrtm_tsfc, & !< dummy array for storing surface temperature |
---|
420 | t_snd !< actual temperature from sounding data (hPa) |
---|
421 | |
---|
422 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: aldif, & !< longwave diffuse albedo solar angle of 60° |
---|
423 | aldir, & !< longwave direct albedo solar angle of 60° |
---|
424 | asdif, & !< shortwave diffuse albedo solar angle of 60° |
---|
425 | asdir, & !< shortwave direct albedo solar angle of 60° |
---|
426 | rrtm_ccl4vmr, & !< CCL4 volume mixing ratio (g/mol) |
---|
427 | rrtm_cfc11vmr, & !< CFC11 volume mixing ratio (g/mol) |
---|
428 | rrtm_cfc12vmr, & !< CFC12 volume mixing ratio (g/mol) |
---|
429 | rrtm_cfc22vmr, & !< CFC22 volume mixing ratio (g/mol) |
---|
430 | rrtm_ch4vmr, & !< CH4 volume mixing ratio |
---|
431 | rrtm_cicewp, & !< in-cloud ice water path (g/m²) |
---|
432 | rrtm_cldfr, & !< cloud fraction (0,1) |
---|
433 | rrtm_cliqwp, & !< in-cloud liquid water path (g/m²) |
---|
434 | rrtm_co2vmr, & !< CO2 volume mixing ratio (g/mol) |
---|
435 | rrtm_emis, & !< surface emissivity (0-1) |
---|
436 | rrtm_h2ovmr, & !< H2O volume mixing ratio |
---|
437 | rrtm_n2ovmr, & !< N2O volume mixing ratio |
---|
438 | rrtm_o2vmr, & !< O2 volume mixing ratio |
---|
439 | rrtm_o3vmr, & !< O3 volume mixing ratio |
---|
440 | rrtm_play, & !< pressure layers (hPa, zu-grid) |
---|
441 | rrtm_plev, & !< pressure layers (hPa, zw-grid) |
---|
442 | rrtm_reice, & !< cloud ice effective radius (microns) |
---|
443 | rrtm_reliq, & !< cloud water drop effective radius (microns) |
---|
444 | rrtm_tlay, & !< actual temperature (K, zu-grid) |
---|
445 | rrtm_tlev, & !< actual temperature (K, zw-grid) |
---|
446 | rrtm_lwdflx, & !< RRTM output of incoming longwave radiation flux (W/m2) |
---|
447 | rrtm_lwdflxc, & !< RRTM output of outgoing clear sky longwave radiation flux (W/m2) |
---|
448 | rrtm_lwuflx, & !< RRTM output of outgoing longwave radiation flux (W/m2) |
---|
449 | rrtm_lwuflxc, & !< RRTM output of incoming clear sky longwave radiation flux (W/m2) |
---|
450 | rrtm_lwuflx_dt, & !< RRTM output of incoming clear sky longwave radiation flux (W/m2) |
---|
451 | rrtm_lwuflxc_dt,& !< RRTM output of outgoing clear sky longwave radiation flux (W/m2) |
---|
452 | rrtm_lwhr, & !< RRTM output of longwave radiation heating rate (K/d) |
---|
453 | rrtm_lwhrc, & !< RRTM output of incoming longwave clear sky radiation heating rate (K/d) |
---|
454 | rrtm_swdflx, & !< RRTM output of incoming shortwave radiation flux (W/m2) |
---|
455 | rrtm_swdflxc, & !< RRTM output of outgoing clear sky shortwave radiation flux (W/m2) |
---|
456 | rrtm_swuflx, & !< RRTM output of outgoing shortwave radiation flux (W/m2) |
---|
457 | rrtm_swuflxc, & !< RRTM output of incoming clear sky shortwave radiation flux (W/m2) |
---|
458 | rrtm_swhr, & !< RRTM output of shortwave radiation heating rate (K/d) |
---|
459 | rrtm_swhrc !< RRTM output of incoming shortwave clear sky radiation heating rate (K/d) |
---|
460 | |
---|
461 | ! |
---|
462 | !-- Definition of arrays that are currently not used for calling RRTMG (due to setting of flag parameters) |
---|
463 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: rad_lw_cs_in, & !< incoming clear sky longwave radiation (W/m2) (not used) |
---|
464 | rad_lw_cs_out, & !< outgoing clear sky longwave radiation (W/m2) (not used) |
---|
465 | rad_sw_cs_in, & !< incoming clear sky shortwave radiation (W/m2) (not used) |
---|
466 | rad_sw_cs_out, & !< outgoing clear sky shortwave radiation (W/m2) (not used) |
---|
467 | rrtm_aldif, & !< surface albedo for longwave diffuse radiation |
---|
468 | rrtm_aldir, & !< surface albedo for longwave direct radiation |
---|
469 | rrtm_asdif, & !< surface albedo for shortwave diffuse radiation |
---|
470 | rrtm_asdir, & !< surface albedo for shortwave direct radiation |
---|
471 | rrtm_lw_tauaer, & !< lw aerosol optical depth |
---|
472 | rrtm_lw_taucld, & !< lw in-cloud optical depth |
---|
473 | rrtm_sw_taucld, & !< sw in-cloud optical depth |
---|
474 | rrtm_sw_ssacld, & !< sw in-cloud single scattering albedo |
---|
475 | rrtm_sw_asmcld, & !< sw in-cloud asymmetry parameter |
---|
476 | rrtm_sw_fsfcld, & !< sw in-cloud forward scattering fraction |
---|
477 | rrtm_sw_tauaer, & !< sw aerosol optical depth |
---|
478 | rrtm_sw_ssaaer, & !< sw aerosol single scattering albedo |
---|
479 | rrtm_sw_asmaer, & !< sw aerosol asymmetry parameter |
---|
480 | rrtm_sw_ecaer !< sw aerosol optical detph at 0.55 microns (rrtm_iaer = 6 only) |
---|
481 | |
---|
482 | #endif |
---|
483 | |
---|
484 | INTERFACE radiation_check_data_output |
---|
485 | MODULE PROCEDURE radiation_check_data_output |
---|
486 | END INTERFACE radiation_check_data_output |
---|
487 | |
---|
488 | INTERFACE radiation_check_data_output_pr |
---|
489 | MODULE PROCEDURE radiation_check_data_output_pr |
---|
490 | END INTERFACE radiation_check_data_output_pr |
---|
491 | |
---|
492 | INTERFACE radiation_check_parameters |
---|
493 | MODULE PROCEDURE radiation_check_parameters |
---|
494 | END INTERFACE radiation_check_parameters |
---|
495 | |
---|
496 | INTERFACE radiation_clearsky |
---|
497 | MODULE PROCEDURE radiation_clearsky |
---|
498 | END INTERFACE radiation_clearsky |
---|
499 | |
---|
500 | INTERFACE radiation_constant |
---|
501 | MODULE PROCEDURE radiation_constant |
---|
502 | END INTERFACE radiation_constant |
---|
503 | |
---|
504 | INTERFACE radiation_control |
---|
505 | MODULE PROCEDURE radiation_control |
---|
506 | END INTERFACE radiation_control |
---|
507 | |
---|
508 | INTERFACE radiation_3d_data_averaging |
---|
509 | MODULE PROCEDURE radiation_3d_data_averaging |
---|
510 | END INTERFACE radiation_3d_data_averaging |
---|
511 | |
---|
512 | INTERFACE radiation_data_output_2d |
---|
513 | MODULE PROCEDURE radiation_data_output_2d |
---|
514 | END INTERFACE radiation_data_output_2d |
---|
515 | |
---|
516 | INTERFACE radiation_data_output_3d |
---|
517 | MODULE PROCEDURE radiation_data_output_3d |
---|
518 | END INTERFACE radiation_data_output_3d |
---|
519 | |
---|
520 | INTERFACE radiation_data_output_mask |
---|
521 | MODULE PROCEDURE radiation_data_output_mask |
---|
522 | END INTERFACE radiation_data_output_mask |
---|
523 | |
---|
524 | INTERFACE radiation_define_netcdf_grid |
---|
525 | MODULE PROCEDURE radiation_define_netcdf_grid |
---|
526 | END INTERFACE radiation_define_netcdf_grid |
---|
527 | |
---|
528 | INTERFACE radiation_header |
---|
529 | MODULE PROCEDURE radiation_header |
---|
530 | END INTERFACE radiation_header |
---|
531 | |
---|
532 | INTERFACE radiation_init |
---|
533 | MODULE PROCEDURE radiation_init |
---|
534 | END INTERFACE radiation_init |
---|
535 | |
---|
536 | INTERFACE radiation_parin |
---|
537 | MODULE PROCEDURE radiation_parin |
---|
538 | END INTERFACE radiation_parin |
---|
539 | |
---|
540 | INTERFACE radiation_rrtmg |
---|
541 | MODULE PROCEDURE radiation_rrtmg |
---|
542 | END INTERFACE radiation_rrtmg |
---|
543 | |
---|
544 | INTERFACE radiation_tendency |
---|
545 | MODULE PROCEDURE radiation_tendency |
---|
546 | MODULE PROCEDURE radiation_tendency_ij |
---|
547 | END INTERFACE radiation_tendency |
---|
548 | |
---|
549 | INTERFACE radiation_read_restart_data |
---|
550 | MODULE PROCEDURE radiation_read_restart_data |
---|
551 | END INTERFACE radiation_read_restart_data |
---|
552 | |
---|
553 | INTERFACE radiation_last_actions |
---|
554 | MODULE PROCEDURE radiation_last_actions |
---|
555 | END INTERFACE radiation_last_actions |
---|
556 | |
---|
557 | SAVE |
---|
558 | |
---|
559 | PRIVATE |
---|
560 | |
---|
561 | ! |
---|
562 | !-- Public functions / NEEDS SORTING |
---|
563 | PUBLIC radiation_check_data_output, radiation_check_data_output_pr, & |
---|
564 | radiation_check_parameters, radiation_control, & |
---|
565 | radiation_header, radiation_init, radiation_parin, & |
---|
566 | radiation_3d_data_averaging, radiation_tendency, & |
---|
567 | radiation_data_output_2d, radiation_data_output_3d, & |
---|
568 | radiation_define_netcdf_grid, radiation_last_actions, & |
---|
569 | radiation_read_restart_data, radiation_data_output_mask |
---|
570 | |
---|
571 | ! |
---|
572 | !-- Public variables and constants / NEEDS SORTING |
---|
573 | PUBLIC albedo, albedo_type, decl_1, decl_2, decl_3, dots_rad, dt_radiation, emissivity, force_radiation_call,& |
---|
574 | lat, lon, rad_net, rad_net_av, radiation, radiation_scheme, rad_lw_in, & |
---|
575 | rad_lw_in_av, rad_lw_out, rad_lw_out_av, rad_lw_out_change_0, & |
---|
576 | rad_lw_cs_hr, rad_lw_cs_hr_av, rad_lw_hr, rad_lw_hr_av, rad_sw_in, & |
---|
577 | rad_sw_in_av, rad_sw_out, rad_sw_out_av, rad_sw_cs_hr, & |
---|
578 | rad_sw_cs_hr_av, rad_sw_hr, rad_sw_hr_av, sigma_sb, & |
---|
579 | skip_time_do_radiation, solar_constant, time_radiation, & |
---|
580 | unscheduled_radiation_calls, zenith, calc_zenith, sun_direction, & |
---|
581 | sun_dir_lat, sun_dir_lon |
---|
582 | |
---|
583 | |
---|
584 | #if defined ( __rrtmg ) |
---|
585 | PUBLIC rrtm_aldif, rrtm_aldir, rrtm_asdif, rrtm_asdir |
---|
586 | #endif |
---|
587 | |
---|
588 | CONTAINS |
---|
589 | |
---|
590 | |
---|
591 | !------------------------------------------------------------------------------! |
---|
592 | ! Description: |
---|
593 | ! ------------ |
---|
594 | !> This subroutine controls the calls of the radiation schemes |
---|
595 | !------------------------------------------------------------------------------! |
---|
596 | SUBROUTINE radiation_control |
---|
597 | |
---|
598 | |
---|
599 | IMPLICIT NONE |
---|
600 | |
---|
601 | |
---|
602 | SELECT CASE ( TRIM( radiation_scheme ) ) |
---|
603 | |
---|
604 | CASE ( 'constant' ) |
---|
605 | CALL radiation_constant |
---|
606 | |
---|
607 | CASE ( 'clear-sky' ) |
---|
608 | CALL radiation_clearsky |
---|
609 | |
---|
610 | CASE ( 'rrtmg' ) |
---|
611 | CALL radiation_rrtmg |
---|
612 | |
---|
613 | CASE DEFAULT |
---|
614 | |
---|
615 | END SELECT |
---|
616 | |
---|
617 | |
---|
618 | END SUBROUTINE radiation_control |
---|
619 | |
---|
620 | !------------------------------------------------------------------------------! |
---|
621 | ! Description: |
---|
622 | ! ------------ |
---|
623 | !> Check data output for radiation model |
---|
624 | !------------------------------------------------------------------------------! |
---|
625 | SUBROUTINE radiation_check_data_output( var, unit, i, ilen, k ) |
---|
626 | |
---|
627 | |
---|
628 | USE control_parameters, & |
---|
629 | ONLY: data_output, message_string |
---|
630 | |
---|
631 | IMPLICIT NONE |
---|
632 | |
---|
633 | CHARACTER (LEN=*) :: unit !< |
---|
634 | CHARACTER (LEN=*) :: var !< |
---|
635 | |
---|
636 | INTEGER(iwp) :: i |
---|
637 | INTEGER(iwp) :: ilen |
---|
638 | INTEGER(iwp) :: k |
---|
639 | |
---|
640 | SELECT CASE ( TRIM( var ) ) |
---|
641 | |
---|
642 | CASE ( 'rad_lw_cs_hr', 'rad_lw_hr', 'rad_sw_cs_hr', 'rad_sw_hr' ) |
---|
643 | IF ( .NOT. radiation .OR. radiation_scheme /= 'rrtmg' ) THEN |
---|
644 | message_string = '"output of "' // TRIM( var ) // '" requi' // & |
---|
645 | 'res radiation = .TRUE. and ' // & |
---|
646 | 'radiation_scheme = "rrtmg"' |
---|
647 | CALL message( 'check_parameters', 'PA0406', 1, 2, 0, 6, 0 ) |
---|
648 | ENDIF |
---|
649 | unit = 'K/h' |
---|
650 | |
---|
651 | CASE ( 'rad_lw_in', 'rad_lw_out', 'rad_sw_in', 'rad_sw_out' ) |
---|
652 | IF ( .NOT. radiation .OR. radiation_scheme /= 'rrtmg' ) THEN |
---|
653 | message_string = '"output of "' // TRIM( var ) // '" requi' // & |
---|
654 | 'res radiation = .TRUE. and ' // & |
---|
655 | 'radiation_scheme = "rrtmg"' |
---|
656 | CALL message( 'check_parameters', 'PA0406', 1, 2, 0, 6, 0 ) |
---|
657 | ENDIF |
---|
658 | unit = 'W/m2' |
---|
659 | |
---|
660 | CASE ( 'rad_net*', 'rrtm_aldif*', 'rrtm_aldir*', 'rrtm_asdif*', & |
---|
661 | 'rrtm_asdir*' ) |
---|
662 | IF ( k == 0 .OR. data_output(i)(ilen-2:ilen) /= '_xy' ) THEN |
---|
663 | message_string = 'illegal value for data_output: "' // & |
---|
664 | TRIM( var ) // '" & only 2d-horizontal ' // & |
---|
665 | 'cross sections are allowed for this value' |
---|
666 | CALL message( 'check_parameters', 'PA0111', 1, 2, 0, 6, 0 ) |
---|
667 | ENDIF |
---|
668 | IF ( .NOT. radiation .OR. radiation_scheme /= "rrtmg" ) THEN |
---|
669 | IF ( TRIM( var ) == 'rrtm_aldif*' .OR. & |
---|
670 | TRIM( var ) == 'rrtm_aldir*' .OR. & |
---|
671 | TRIM( var ) == 'rrtm_asdif*' .OR. & |
---|
672 | TRIM( var ) == 'rrtm_asdir*' ) & |
---|
673 | THEN |
---|
674 | message_string = 'output of "' // TRIM( var ) // '" require'& |
---|
675 | // 's radiation = .TRUE. and radiation_sch'& |
---|
676 | // 'eme = "rrtmg"' |
---|
677 | CALL message( 'check_parameters', 'PA0409', 1, 2, 0, 6, 0 ) |
---|
678 | ENDIF |
---|
679 | ENDIF |
---|
680 | |
---|
681 | IF ( TRIM( var ) == 'rad_net*' ) unit = 'W/m2' |
---|
682 | IF ( TRIM( var ) == 'rrtm_aldif*' ) unit = '' |
---|
683 | IF ( TRIM( var ) == 'rrtm_aldir*' ) unit = '' |
---|
684 | IF ( TRIM( var ) == 'rrtm_asdif*' ) unit = '' |
---|
685 | IF ( TRIM( var ) == 'rrtm_asdir*' ) unit = '' |
---|
686 | |
---|
687 | CASE DEFAULT |
---|
688 | unit = 'illegal' |
---|
689 | |
---|
690 | END SELECT |
---|
691 | |
---|
692 | |
---|
693 | END SUBROUTINE radiation_check_data_output |
---|
694 | |
---|
695 | !------------------------------------------------------------------------------! |
---|
696 | ! Description: |
---|
697 | ! ------------ |
---|
698 | !> Check data output of profiles for radiation model |
---|
699 | !------------------------------------------------------------------------------! |
---|
700 | SUBROUTINE radiation_check_data_output_pr( variable, var_count, unit, & |
---|
701 | dopr_unit ) |
---|
702 | |
---|
703 | USE arrays_3d, & |
---|
704 | ONLY: zu |
---|
705 | |
---|
706 | USE control_parameters, & |
---|
707 | ONLY: data_output_pr, message_string |
---|
708 | |
---|
709 | USE indices |
---|
710 | |
---|
711 | USE profil_parameter |
---|
712 | |
---|
713 | USE statistics |
---|
714 | |
---|
715 | IMPLICIT NONE |
---|
716 | |
---|
717 | CHARACTER (LEN=*) :: unit !< |
---|
718 | CHARACTER (LEN=*) :: variable !< |
---|
719 | CHARACTER (LEN=*) :: dopr_unit !< local value of dopr_unit |
---|
720 | |
---|
721 | INTEGER(iwp) :: user_pr_index !< |
---|
722 | INTEGER(iwp) :: var_count !< |
---|
723 | |
---|
724 | SELECT CASE ( TRIM( variable ) ) |
---|
725 | |
---|
726 | CASE ( 'rad_net' ) |
---|
727 | IF ( ( .NOT. radiation ) .OR. radiation_scheme == 'constant' )& |
---|
728 | THEN |
---|
729 | message_string = 'data_output_pr = ' // & |
---|
730 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
731 | 'not available for radiation = .FALSE. or ' //& |
---|
732 | 'radiation_scheme = "constant"' |
---|
733 | CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 ) |
---|
734 | ELSE |
---|
735 | dopr_index(var_count) = 99 |
---|
736 | dopr_unit = 'W/m2' |
---|
737 | hom(:,2,99,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
738 | unit = dopr_unit |
---|
739 | ENDIF |
---|
740 | |
---|
741 | CASE ( 'rad_lw_in' ) |
---|
742 | IF ( ( .NOT. radiation) .OR. radiation_scheme == 'constant' ) & |
---|
743 | THEN |
---|
744 | message_string = 'data_output_pr = ' // & |
---|
745 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
746 | 'not available for radiation = .FALSE. or ' //& |
---|
747 | 'radiation_scheme = "constant"' |
---|
748 | CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 ) |
---|
749 | ELSE |
---|
750 | dopr_index(var_count) = 100 |
---|
751 | dopr_unit = 'W/m2' |
---|
752 | hom(:,2,100,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
753 | unit = dopr_unit |
---|
754 | ENDIF |
---|
755 | |
---|
756 | CASE ( 'rad_lw_out' ) |
---|
757 | IF ( ( .NOT. radiation ) .OR. radiation_scheme == 'constant' ) & |
---|
758 | THEN |
---|
759 | message_string = 'data_output_pr = ' // & |
---|
760 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
761 | 'not available for radiation = .FALSE. or ' //& |
---|
762 | 'radiation_scheme = "constant"' |
---|
763 | CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 ) |
---|
764 | ELSE |
---|
765 | dopr_index(var_count) = 101 |
---|
766 | dopr_unit = 'W/m2' |
---|
767 | hom(:,2,101,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
768 | unit = dopr_unit |
---|
769 | ENDIF |
---|
770 | |
---|
771 | CASE ( 'rad_sw_in' ) |
---|
772 | IF ( ( .NOT. radiation ) .OR. radiation_scheme == 'constant' ) & |
---|
773 | THEN |
---|
774 | message_string = 'data_output_pr = ' // & |
---|
775 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
776 | 'not available for radiation = .FALSE. or ' //& |
---|
777 | 'radiation_scheme = "constant"' |
---|
778 | CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 ) |
---|
779 | ELSE |
---|
780 | dopr_index(var_count) = 102 |
---|
781 | dopr_unit = 'W/m2' |
---|
782 | hom(:,2,102,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
783 | unit = dopr_unit |
---|
784 | ENDIF |
---|
785 | |
---|
786 | CASE ( 'rad_sw_out') |
---|
787 | IF ( ( .NOT. radiation ) .OR. radiation_scheme == 'constant' )& |
---|
788 | THEN |
---|
789 | message_string = 'data_output_pr = ' // & |
---|
790 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
791 | 'not available for radiation = .FALSE. or ' //& |
---|
792 | 'radiation_scheme = "constant"' |
---|
793 | CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 ) |
---|
794 | ELSE |
---|
795 | dopr_index(var_count) = 103 |
---|
796 | dopr_unit = 'W/m2' |
---|
797 | hom(:,2,103,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
798 | unit = dopr_unit |
---|
799 | ENDIF |
---|
800 | |
---|
801 | CASE ( 'rad_lw_cs_hr' ) |
---|
802 | IF ( ( .NOT. radiation ) .OR. radiation_scheme /= 'rrtmg' ) & |
---|
803 | THEN |
---|
804 | message_string = 'data_output_pr = ' // & |
---|
805 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
806 | 'not available for radiation = .FALSE. or ' //& |
---|
807 | 'radiation_scheme /= "rrtmg"' |
---|
808 | CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 ) |
---|
809 | ELSE |
---|
810 | dopr_index(var_count) = 104 |
---|
811 | dopr_unit = 'K/h' |
---|
812 | hom(:,2,104,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
813 | unit = dopr_unit |
---|
814 | ENDIF |
---|
815 | |
---|
816 | CASE ( 'rad_lw_hr' ) |
---|
817 | IF ( ( .NOT. radiation ) .OR. radiation_scheme /= 'rrtmg' ) & |
---|
818 | THEN |
---|
819 | message_string = 'data_output_pr = ' // & |
---|
820 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
821 | 'not available for radiation = .FALSE. or ' //& |
---|
822 | 'radiation_scheme /= "rrtmg"' |
---|
823 | CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 ) |
---|
824 | ELSE |
---|
825 | dopr_index(var_count) = 105 |
---|
826 | dopr_unit = 'K/h' |
---|
827 | hom(:,2,105,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
828 | unit = dopr_unit |
---|
829 | ENDIF |
---|
830 | |
---|
831 | CASE ( 'rad_sw_cs_hr' ) |
---|
832 | IF ( ( .NOT. radiation ) .OR. radiation_scheme /= 'rrtmg' ) & |
---|
833 | THEN |
---|
834 | message_string = 'data_output_pr = ' // & |
---|
835 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
836 | 'not available for radiation = .FALSE. or ' //& |
---|
837 | 'radiation_scheme /= "rrtmg"' |
---|
838 | CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 ) |
---|
839 | ELSE |
---|
840 | dopr_index(var_count) = 106 |
---|
841 | dopr_unit = 'K/h' |
---|
842 | hom(:,2,106,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
843 | unit = dopr_unit |
---|
844 | ENDIF |
---|
845 | |
---|
846 | CASE ( 'rad_sw_hr' ) |
---|
847 | IF ( ( .NOT. radiation ) .OR. radiation_scheme /= 'rrtmg' ) & |
---|
848 | THEN |
---|
849 | message_string = 'data_output_pr = ' // & |
---|
850 | TRIM( data_output_pr(var_count) ) // ' is' // & |
---|
851 | 'not available for radiation = .FALSE. or ' //& |
---|
852 | 'radiation_scheme /= "rrtmg"' |
---|
853 | CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 ) |
---|
854 | ELSE |
---|
855 | dopr_index(var_count) = 107 |
---|
856 | dopr_unit = 'K/h' |
---|
857 | hom(:,2,107,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
858 | unit = dopr_unit |
---|
859 | ENDIF |
---|
860 | |
---|
861 | |
---|
862 | CASE DEFAULT |
---|
863 | unit = 'illegal' |
---|
864 | |
---|
865 | END SELECT |
---|
866 | |
---|
867 | |
---|
868 | END SUBROUTINE radiation_check_data_output_pr |
---|
869 | |
---|
870 | |
---|
871 | !------------------------------------------------------------------------------! |
---|
872 | ! Description: |
---|
873 | ! ------------ |
---|
874 | !> Check parameters routine for radiation model |
---|
875 | !------------------------------------------------------------------------------! |
---|
876 | SUBROUTINE radiation_check_parameters |
---|
877 | |
---|
878 | USE control_parameters, & |
---|
879 | ONLY: message_string, topography, urban_surface |
---|
880 | |
---|
881 | |
---|
882 | IMPLICIT NONE |
---|
883 | |
---|
884 | |
---|
885 | IF ( radiation_scheme /= 'constant' .AND. & |
---|
886 | radiation_scheme /= 'clear-sky' .AND. & |
---|
887 | radiation_scheme /= 'rrtmg' ) THEN |
---|
888 | message_string = 'unknown radiation_scheme = '// & |
---|
889 | TRIM( radiation_scheme ) |
---|
890 | CALL message( 'check_parameters', 'PA0405', 1, 2, 0, 6, 0 ) |
---|
891 | ELSEIF ( radiation_scheme == 'rrtmg' ) THEN |
---|
892 | #if ! defined ( __rrtmg ) |
---|
893 | message_string = 'radiation_scheme = "rrtmg" requires ' // & |
---|
894 | 'compilation of PALM with pre-processor ' // & |
---|
895 | 'directive -D__rrtmg' |
---|
896 | CALL message( 'check_parameters', 'PA0407', 1, 2, 0, 6, 0 ) |
---|
897 | #endif |
---|
898 | #if defined ( __rrtmg ) && ! defined( __netcdf ) |
---|
899 | message_string = 'radiation_scheme = "rrtmg" requires ' // & |
---|
900 | 'the use of NetCDF (preprocessor directive ' // & |
---|
901 | '-D__netcdf' |
---|
902 | CALL message( 'check_parameters', 'PA0412', 1, 2, 0, 6, 0 ) |
---|
903 | #endif |
---|
904 | |
---|
905 | ENDIF |
---|
906 | |
---|
907 | IF ( albedo_type == 0 .AND. albedo == 9999999.9_wp .AND. & |
---|
908 | radiation_scheme == 'clear-sky') THEN |
---|
909 | message_string = 'radiation_scheme = "clear-sky" in combination' // & |
---|
910 | 'with albedo_type = 0 requires setting of albedo'// & |
---|
911 | ' /= 9999999.9' |
---|
912 | CALL message( 'check_parameters', 'PA0410', 1, 2, 0, 6, 0 ) |
---|
913 | ENDIF |
---|
914 | |
---|
915 | IF ( albedo_type == 0 .AND. radiation_scheme == 'rrtmg' .AND. & |
---|
916 | ( albedo_lw_dif == 9999999.9_wp .OR. albedo_lw_dir == 9999999.9_wp& |
---|
917 | .OR. albedo_sw_dif == 9999999.9_wp .OR. albedo_sw_dir == 9999999.9_wp& |
---|
918 | ) ) THEN |
---|
919 | message_string = 'radiation_scheme = "rrtmg" in combination' // & |
---|
920 | 'with albedo_type = 0 requires setting of ' // & |
---|
921 | 'albedo_lw_dif /= 9999999.9' // & |
---|
922 | 'albedo_lw_dir /= 9999999.9' // & |
---|
923 | 'albedo_sw_dif /= 9999999.9 and' // & |
---|
924 | 'albedo_sw_dir /= 9999999.9' |
---|
925 | CALL message( 'check_parameters', 'PA0411', 1, 2, 0, 6, 0 ) |
---|
926 | ENDIF |
---|
927 | |
---|
928 | ! |
---|
929 | !-- The following paramter check is temporarily extended by the urban_surface |
---|
930 | !-- flag, until a better solution comes up to omit this check in case of |
---|
931 | !-- urban surface model is used. |
---|
932 | IF ( topography /= 'flat' .AND. .NOT. urban_surface ) THEN |
---|
933 | message_string = 'radiation scheme cannot be used ' // & |
---|
934 | 'in combination with topography /= "flat"' |
---|
935 | CALL message( 'check_parameters', 'PA0414', 1, 2, 0, 6, 0 ) |
---|
936 | ENDIF |
---|
937 | |
---|
938 | END SUBROUTINE radiation_check_parameters |
---|
939 | |
---|
940 | |
---|
941 | !------------------------------------------------------------------------------! |
---|
942 | ! Description: |
---|
943 | ! ------------ |
---|
944 | !> Initialization of the radiation model |
---|
945 | !------------------------------------------------------------------------------! |
---|
946 | SUBROUTINE radiation_init |
---|
947 | |
---|
948 | IMPLICIT NONE |
---|
949 | |
---|
950 | ! |
---|
951 | !-- Allocate array for storing emissivity |
---|
952 | IF ( .NOT. ALLOCATED ( emis ) ) THEN |
---|
953 | ALLOCATE ( emis(nysg:nyng,nxlg:nxrg) ) |
---|
954 | emis = emissivity |
---|
955 | ENDIF |
---|
956 | |
---|
957 | ! |
---|
958 | !-- Allocate array for storing the surface net radiation |
---|
959 | IF ( .NOT. ALLOCATED ( rad_net ) ) THEN |
---|
960 | ALLOCATE ( rad_net(nysg:nyng,nxlg:nxrg) ) |
---|
961 | rad_net = 0.0_wp |
---|
962 | ENDIF |
---|
963 | |
---|
964 | ! |
---|
965 | !-- Allocate array for storing the surface net radiation |
---|
966 | IF ( .NOT. ALLOCATED ( rad_lw_out_change_0 ) ) THEN |
---|
967 | ALLOCATE ( rad_lw_out_change_0(nysg:nyng,nxlg:nxrg) ) |
---|
968 | rad_lw_out_change_0 = 0.0_wp |
---|
969 | ENDIF |
---|
970 | |
---|
971 | ! |
---|
972 | !-- Fix net radiation in case of radiation_scheme = 'constant' |
---|
973 | IF ( radiation_scheme == 'constant' ) THEN |
---|
974 | rad_net = net_radiation |
---|
975 | ! radiation = .FALSE. |
---|
976 | ! |
---|
977 | !-- Calculate orbital constants |
---|
978 | ELSE |
---|
979 | decl_1 = SIN(23.45_wp * pi / 180.0_wp) |
---|
980 | decl_2 = 2.0_wp * pi / 365.0_wp |
---|
981 | decl_3 = decl_2 * 81.0_wp |
---|
982 | lat = latitude * pi / 180.0_wp |
---|
983 | lon = longitude * pi / 180.0_wp |
---|
984 | ENDIF |
---|
985 | |
---|
986 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
987 | radiation_scheme == 'constant') THEN |
---|
988 | |
---|
989 | ALLOCATE ( alpha(nysg:nyng,nxlg:nxrg) ) |
---|
990 | |
---|
991 | IF ( .NOT. ALLOCATED ( rad_sw_in ) ) THEN |
---|
992 | ALLOCATE ( rad_sw_in(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
993 | ENDIF |
---|
994 | IF ( .NOT. ALLOCATED ( rad_sw_out ) ) THEN |
---|
995 | ALLOCATE ( rad_sw_out(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
996 | ENDIF |
---|
997 | |
---|
998 | IF ( .NOT. ALLOCATED ( rad_sw_in_av ) ) THEN |
---|
999 | ALLOCATE ( rad_sw_in_av(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1000 | ENDIF |
---|
1001 | IF ( .NOT. ALLOCATED ( rad_sw_out_av ) ) THEN |
---|
1002 | ALLOCATE ( rad_sw_out_av(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1003 | ENDIF |
---|
1004 | |
---|
1005 | IF ( .NOT. ALLOCATED ( rad_lw_in ) ) THEN |
---|
1006 | ALLOCATE ( rad_lw_in(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1007 | ENDIF |
---|
1008 | IF ( .NOT. ALLOCATED ( rad_lw_out ) ) THEN |
---|
1009 | ALLOCATE ( rad_lw_out(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1010 | ENDIF |
---|
1011 | |
---|
1012 | IF ( .NOT. ALLOCATED ( rad_lw_in_av ) ) THEN |
---|
1013 | ALLOCATE ( rad_lw_in_av(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1014 | ENDIF |
---|
1015 | IF ( .NOT. ALLOCATED ( rad_lw_out_av ) ) THEN |
---|
1016 | ALLOCATE ( rad_lw_out_av(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1017 | ENDIF |
---|
1018 | |
---|
1019 | rad_sw_in = 0.0_wp |
---|
1020 | rad_sw_out = 0.0_wp |
---|
1021 | rad_lw_in = 0.0_wp |
---|
1022 | rad_lw_out = 0.0_wp |
---|
1023 | |
---|
1024 | ! |
---|
1025 | !-- Overwrite albedo if manually set in parameter file |
---|
1026 | IF ( albedo_type /= 0 .AND. albedo_type /= 9999999 .AND. albedo == 9999999.9_wp ) THEN |
---|
1027 | albedo = albedo_pars(2,albedo_type) |
---|
1028 | ENDIF |
---|
1029 | ! |
---|
1030 | !-- Write albedo to 2d array alpha to allow surface heterogeneities |
---|
1031 | alpha = albedo |
---|
1032 | |
---|
1033 | ! |
---|
1034 | !-- Initialization actions for RRTMG |
---|
1035 | ELSEIF ( radiation_scheme == 'rrtmg' ) THEN |
---|
1036 | #if defined ( __rrtmg ) |
---|
1037 | ! |
---|
1038 | !-- Allocate albedos |
---|
1039 | ALLOCATE ( rrtm_aldif(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1040 | ALLOCATE ( rrtm_aldir(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1041 | ALLOCATE ( rrtm_asdif(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1042 | ALLOCATE ( rrtm_asdir(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
1043 | ALLOCATE ( aldif(nysg:nyng,nxlg:nxrg) ) |
---|
1044 | ALLOCATE ( aldir(nysg:nyng,nxlg:nxrg) ) |
---|
1045 | ALLOCATE ( asdif(nysg:nyng,nxlg:nxrg) ) |
---|
1046 | ALLOCATE ( asdir(nysg:nyng,nxlg:nxrg) ) |
---|
1047 | |
---|
1048 | IF ( albedo_type /= 0 ) THEN |
---|
1049 | IF ( albedo_sw_dif == 9999999.9_wp ) THEN |
---|
1050 | albedo_sw_dif = albedo_pars(0,albedo_type) |
---|
1051 | albedo_sw_dir = albedo_sw_dif |
---|
1052 | ENDIF |
---|
1053 | IF ( albedo_lw_dif == 9999999.9_wp ) THEN |
---|
1054 | albedo_lw_dif = albedo_pars(1,albedo_type) |
---|
1055 | albedo_lw_dir = albedo_lw_dif |
---|
1056 | ENDIF |
---|
1057 | ENDIF |
---|
1058 | |
---|
1059 | aldif(:,:) = albedo_lw_dif |
---|
1060 | aldir(:,:) = albedo_lw_dir |
---|
1061 | asdif(:,:) = albedo_sw_dif |
---|
1062 | asdir(:,:) = albedo_sw_dir |
---|
1063 | ! |
---|
1064 | !-- Calculate initial values of current (cosine of) the zenith angle and |
---|
1065 | !-- whether the sun is up |
---|
1066 | CALL calc_zenith |
---|
1067 | ! |
---|
1068 | !-- Calculate initial surface albedo |
---|
1069 | IF ( .NOT. constant_albedo ) THEN |
---|
1070 | CALL calc_albedo |
---|
1071 | ELSE |
---|
1072 | rrtm_aldif(0,:,:) = aldif(:,:) |
---|
1073 | rrtm_aldir(0,:,:) = aldir(:,:) |
---|
1074 | rrtm_asdif(0,:,:) = asdif(:,:) |
---|
1075 | rrtm_asdir(0,:,:) = asdir(:,:) |
---|
1076 | ENDIF |
---|
1077 | |
---|
1078 | ! |
---|
1079 | !-- Allocate surface emissivity |
---|
1080 | ALLOCATE ( rrtm_emis(0:0,1:nbndlw+1) ) |
---|
1081 | rrtm_emis = emissivity |
---|
1082 | |
---|
1083 | ! |
---|
1084 | !-- Allocate 3d arrays of radiative fluxes and heating rates |
---|
1085 | IF ( .NOT. ALLOCATED ( rad_sw_in ) ) THEN |
---|
1086 | ALLOCATE ( rad_sw_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1087 | rad_sw_in = 0.0_wp |
---|
1088 | ENDIF |
---|
1089 | |
---|
1090 | IF ( .NOT. ALLOCATED ( rad_sw_in_av ) ) THEN |
---|
1091 | ALLOCATE ( rad_sw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1092 | ENDIF |
---|
1093 | |
---|
1094 | IF ( .NOT. ALLOCATED ( rad_sw_out ) ) THEN |
---|
1095 | ALLOCATE ( rad_sw_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1096 | rad_sw_out = 0.0_wp |
---|
1097 | ENDIF |
---|
1098 | |
---|
1099 | IF ( .NOT. ALLOCATED ( rad_sw_out_av ) ) THEN |
---|
1100 | ALLOCATE ( rad_sw_out_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1101 | ENDIF |
---|
1102 | |
---|
1103 | IF ( .NOT. ALLOCATED ( rad_sw_hr ) ) THEN |
---|
1104 | ALLOCATE ( rad_sw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1105 | rad_sw_hr = 0.0_wp |
---|
1106 | ENDIF |
---|
1107 | |
---|
1108 | IF ( .NOT. ALLOCATED ( rad_sw_hr_av ) ) THEN |
---|
1109 | ALLOCATE ( rad_sw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1110 | rad_sw_hr_av = 0.0_wp |
---|
1111 | ENDIF |
---|
1112 | |
---|
1113 | IF ( .NOT. ALLOCATED ( rad_sw_cs_hr ) ) THEN |
---|
1114 | ALLOCATE ( rad_sw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1115 | rad_sw_cs_hr = 0.0_wp |
---|
1116 | ENDIF |
---|
1117 | |
---|
1118 | IF ( .NOT. ALLOCATED ( rad_sw_cs_hr_av ) ) THEN |
---|
1119 | ALLOCATE ( rad_sw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1120 | rad_sw_cs_hr_av = 0.0_wp |
---|
1121 | ENDIF |
---|
1122 | |
---|
1123 | IF ( .NOT. ALLOCATED ( rad_lw_in ) ) THEN |
---|
1124 | ALLOCATE ( rad_lw_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1125 | rad_lw_in = 0.0_wp |
---|
1126 | ENDIF |
---|
1127 | |
---|
1128 | IF ( .NOT. ALLOCATED ( rad_lw_in_av ) ) THEN |
---|
1129 | ALLOCATE ( rad_lw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1130 | ENDIF |
---|
1131 | |
---|
1132 | IF ( .NOT. ALLOCATED ( rad_lw_out ) ) THEN |
---|
1133 | ALLOCATE ( rad_lw_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1134 | rad_lw_out = 0.0_wp |
---|
1135 | ENDIF |
---|
1136 | |
---|
1137 | IF ( .NOT. ALLOCATED ( rad_lw_out_av ) ) THEN |
---|
1138 | ALLOCATE ( rad_lw_out_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1139 | ENDIF |
---|
1140 | |
---|
1141 | IF ( .NOT. ALLOCATED ( rad_lw_hr ) ) THEN |
---|
1142 | ALLOCATE ( rad_lw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1143 | rad_lw_hr = 0.0_wp |
---|
1144 | ENDIF |
---|
1145 | |
---|
1146 | IF ( .NOT. ALLOCATED ( rad_lw_hr_av ) ) THEN |
---|
1147 | ALLOCATE ( rad_lw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1148 | rad_lw_hr_av = 0.0_wp |
---|
1149 | ENDIF |
---|
1150 | |
---|
1151 | IF ( .NOT. ALLOCATED ( rad_lw_cs_hr ) ) THEN |
---|
1152 | ALLOCATE ( rad_lw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1153 | rad_lw_cs_hr = 0.0_wp |
---|
1154 | ENDIF |
---|
1155 | |
---|
1156 | IF ( .NOT. ALLOCATED ( rad_lw_cs_hr_av ) ) THEN |
---|
1157 | ALLOCATE ( rad_lw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1158 | rad_lw_cs_hr_av = 0.0_wp |
---|
1159 | ENDIF |
---|
1160 | |
---|
1161 | ALLOCATE ( rad_sw_cs_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1162 | ALLOCATE ( rad_sw_cs_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1163 | rad_sw_cs_in = 0.0_wp |
---|
1164 | rad_sw_cs_out = 0.0_wp |
---|
1165 | |
---|
1166 | ALLOCATE ( rad_lw_cs_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1167 | ALLOCATE ( rad_lw_cs_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
1168 | rad_lw_cs_in = 0.0_wp |
---|
1169 | rad_lw_cs_out = 0.0_wp |
---|
1170 | |
---|
1171 | ! |
---|
1172 | !-- Allocate dummy array for storing surface temperature |
---|
1173 | ALLOCATE ( rrtm_tsfc(1) ) |
---|
1174 | |
---|
1175 | ! |
---|
1176 | !-- Initialize RRTMG |
---|
1177 | IF ( lw_radiation ) CALL rrtmg_lw_ini ( cp ) |
---|
1178 | IF ( sw_radiation ) CALL rrtmg_sw_ini ( cp ) |
---|
1179 | |
---|
1180 | ! |
---|
1181 | !-- Set input files for RRTMG |
---|
1182 | INQUIRE(FILE="RAD_SND_DATA", EXIST=snd_exists) |
---|
1183 | IF ( .NOT. snd_exists ) THEN |
---|
1184 | rrtm_input_file = "rrtmg_lw.nc" |
---|
1185 | ENDIF |
---|
1186 | |
---|
1187 | ! |
---|
1188 | !-- Read vertical layers for RRTMG from sounding data |
---|
1189 | !-- The routine provides nzt_rad, hyp_snd(1:nzt_rad), |
---|
1190 | !-- t_snd(nzt+2:nzt_rad), rrtm_play(1:nzt_rad), rrtm_plev(1_nzt_rad+1), |
---|
1191 | !-- rrtm_tlay(nzt+2:nzt_rad), rrtm_tlev(nzt+2:nzt_rad+1) |
---|
1192 | CALL read_sounding_data |
---|
1193 | |
---|
1194 | ! |
---|
1195 | !-- Read trace gas profiles from file. This routine provides |
---|
1196 | !-- the rrtm_ arrays (1:nzt_rad+1) |
---|
1197 | CALL read_trace_gas_data |
---|
1198 | #endif |
---|
1199 | ENDIF |
---|
1200 | |
---|
1201 | ! |
---|
1202 | !-- Perform user actions if required |
---|
1203 | CALL user_init_radiation |
---|
1204 | |
---|
1205 | ! |
---|
1206 | !-- Calculate radiative fluxes at model start |
---|
1207 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
1208 | |
---|
1209 | SELECT CASE ( radiation_scheme ) |
---|
1210 | CASE ( 'rrtmg' ) |
---|
1211 | CALL radiation_rrtmg |
---|
1212 | CASE ( 'clear-sky' ) |
---|
1213 | CALL radiation_clearsky |
---|
1214 | CASE ( 'constant' ) |
---|
1215 | CALL radiation_constant |
---|
1216 | CASE DEFAULT |
---|
1217 | END SELECT |
---|
1218 | |
---|
1219 | ENDIF |
---|
1220 | |
---|
1221 | RETURN |
---|
1222 | |
---|
1223 | END SUBROUTINE radiation_init |
---|
1224 | |
---|
1225 | |
---|
1226 | !------------------------------------------------------------------------------! |
---|
1227 | ! Description: |
---|
1228 | ! ------------ |
---|
1229 | !> A simple clear sky radiation model |
---|
1230 | !------------------------------------------------------------------------------! |
---|
1231 | SUBROUTINE radiation_clearsky |
---|
1232 | |
---|
1233 | |
---|
1234 | IMPLICIT NONE |
---|
1235 | |
---|
1236 | INTEGER(iwp) :: i, j, k !< loop indices |
---|
1237 | REAL(wp) :: exn, & !< Exner functions at surface |
---|
1238 | exn1, & !< Exner functions at first grid level |
---|
1239 | pt1 !< potential temperature at first grid level |
---|
1240 | |
---|
1241 | ! |
---|
1242 | !-- Calculate current zenith angle |
---|
1243 | CALL calc_zenith |
---|
1244 | |
---|
1245 | ! |
---|
1246 | !-- Calculate sky transmissivity |
---|
1247 | sky_trans = 0.6_wp + 0.2_wp * zenith(0) |
---|
1248 | |
---|
1249 | ! |
---|
1250 | !-- Calculate value of the Exner function |
---|
1251 | exn = (surface_pressure / 1000.0_wp )**0.286_wp |
---|
1252 | ! |
---|
1253 | !-- Calculate radiation fluxes and net radiation (rad_net) for each grid |
---|
1254 | !-- point |
---|
1255 | DO i = nxlg, nxrg |
---|
1256 | DO j = nysg, nyng |
---|
1257 | ! |
---|
1258 | !-- Obtain vertical index of topography top |
---|
1259 | k = get_topography_top_index( j, i, 's' ) |
---|
1260 | |
---|
1261 | exn1 = (hyp(k+1) / 100000.0_wp )**0.286_wp |
---|
1262 | |
---|
1263 | rad_sw_in(0,j,i) = solar_constant * sky_trans * zenith(0) |
---|
1264 | rad_sw_out(0,j,i) = alpha(j,i) * rad_sw_in(0,j,i) |
---|
1265 | rad_lw_out(0,j,i) = emis(j,i) * sigma_sb * (pt(k,j,i) * exn)**4 |
---|
1266 | |
---|
1267 | IF ( cloud_physics .OR. cloud_droplets ) THEN |
---|
1268 | pt1 = pt(k+1,j,i) + l_d_cp / exn1 * ql(k+1,j,i) |
---|
1269 | rad_lw_in(0,j,i) = 0.8_wp * sigma_sb * (pt1 * exn1)**4 |
---|
1270 | ELSE |
---|
1271 | rad_lw_in(0,j,i) = 0.8_wp * sigma_sb * (pt(k+1,j,i) * exn1)**4 |
---|
1272 | ENDIF |
---|
1273 | |
---|
1274 | rad_net(j,i) = rad_sw_in(0,j,i) - rad_sw_out(0,j,i) & |
---|
1275 | + rad_lw_in(0,j,i) - rad_lw_out(0,j,i) |
---|
1276 | |
---|
1277 | |
---|
1278 | rad_lw_out_change_0(j,i) = 3.0_wp * sigma_sb * emis(j,i) & |
---|
1279 | * (pt(k,j,i) * exn) ** 3 |
---|
1280 | |
---|
1281 | ENDDO |
---|
1282 | ENDDO |
---|
1283 | |
---|
1284 | END SUBROUTINE radiation_clearsky |
---|
1285 | |
---|
1286 | |
---|
1287 | !------------------------------------------------------------------------------! |
---|
1288 | ! Description: |
---|
1289 | ! ------------ |
---|
1290 | !> This scheme keeps the prescribed net radiation constant during the run |
---|
1291 | !------------------------------------------------------------------------------! |
---|
1292 | SUBROUTINE radiation_constant |
---|
1293 | |
---|
1294 | |
---|
1295 | IMPLICIT NONE |
---|
1296 | |
---|
1297 | INTEGER(iwp) :: i, j, k !< loop indices |
---|
1298 | REAL(wp) :: exn, & !< Exner functions at surface |
---|
1299 | exn1, & !< Exner functions at first grid level |
---|
1300 | pt1 !< potential temperature at first grid level |
---|
1301 | |
---|
1302 | ! |
---|
1303 | !-- Calculate value of the Exner function |
---|
1304 | exn = (surface_pressure / 1000.0_wp )**0.286_wp |
---|
1305 | ! |
---|
1306 | !-- Prescribe net radiation and estimate the remaining radiative fluxes |
---|
1307 | DO i = nxlg, nxrg |
---|
1308 | DO j = nysg, nyng |
---|
1309 | ! |
---|
1310 | !-- Obtain vertical index of topography top. So far it is identical to |
---|
1311 | !-- nzb. |
---|
1312 | k = get_topography_top_index( j, i, 's' ) |
---|
1313 | |
---|
1314 | rad_net(j,i) = net_radiation |
---|
1315 | |
---|
1316 | exn1 = (hyp(k+1) / 100000.0_wp )**0.286_wp |
---|
1317 | |
---|
1318 | IF ( cloud_physics .OR. cloud_droplets ) THEN |
---|
1319 | pt1 = pt(k+1,j,i) + l_d_cp / exn1 * ql(k+1,j,i) |
---|
1320 | rad_lw_in(0,j,i) = 0.8_wp * sigma_sb * (pt1 * exn1)**4 |
---|
1321 | ELSE |
---|
1322 | rad_lw_in(0,j,i) = 0.8_wp * sigma_sb * (pt(k+1,j,i) * exn1)**4 |
---|
1323 | ENDIF |
---|
1324 | |
---|
1325 | rad_lw_out(0,j,i) = emis(j,i) * sigma_sb * (pt(k,j,i) * exn)**4 |
---|
1326 | |
---|
1327 | rad_sw_in(0,j,i) = ( rad_net(j,i) - rad_lw_in(0,j,i) & |
---|
1328 | + rad_lw_out(0,j,i) ) & |
---|
1329 | / ( 1.0_wp - alpha(j,i) ) |
---|
1330 | |
---|
1331 | rad_sw_out(0,j,i) = alpha(j,i) * rad_sw_in(0,j,i) |
---|
1332 | |
---|
1333 | ENDDO |
---|
1334 | ENDDO |
---|
1335 | |
---|
1336 | END SUBROUTINE radiation_constant |
---|
1337 | |
---|
1338 | !------------------------------------------------------------------------------! |
---|
1339 | ! Description: |
---|
1340 | ! ------------ |
---|
1341 | !> Header output for radiation model |
---|
1342 | !------------------------------------------------------------------------------! |
---|
1343 | SUBROUTINE radiation_header ( io ) |
---|
1344 | |
---|
1345 | |
---|
1346 | IMPLICIT NONE |
---|
1347 | |
---|
1348 | INTEGER(iwp), INTENT(IN) :: io !< Unit of the output file |
---|
1349 | |
---|
1350 | |
---|
1351 | |
---|
1352 | ! |
---|
1353 | !-- Write radiation model header |
---|
1354 | WRITE( io, 3 ) |
---|
1355 | |
---|
1356 | IF ( radiation_scheme == "constant" ) THEN |
---|
1357 | WRITE( io, 4 ) net_radiation |
---|
1358 | ELSEIF ( radiation_scheme == "clear-sky" ) THEN |
---|
1359 | WRITE( io, 5 ) |
---|
1360 | ELSEIF ( radiation_scheme == "rrtmg" ) THEN |
---|
1361 | WRITE( io, 6 ) |
---|
1362 | IF ( .NOT. lw_radiation ) WRITE( io, 10 ) |
---|
1363 | IF ( .NOT. sw_radiation ) WRITE( io, 11 ) |
---|
1364 | ENDIF |
---|
1365 | |
---|
1366 | IF ( albedo_type == 0 ) THEN |
---|
1367 | WRITE( io, 7 ) albedo |
---|
1368 | ELSE |
---|
1369 | WRITE( io, 8 ) TRIM( albedo_type_name(albedo_type) ) |
---|
1370 | ENDIF |
---|
1371 | IF ( constant_albedo ) THEN |
---|
1372 | WRITE( io, 9 ) |
---|
1373 | ENDIF |
---|
1374 | |
---|
1375 | WRITE( io, 12 ) dt_radiation |
---|
1376 | |
---|
1377 | |
---|
1378 | 3 FORMAT (//' Radiation model information:'/ & |
---|
1379 | ' ----------------------------'/) |
---|
1380 | 4 FORMAT (' --> Using constant net radiation: net_radiation = ', F6.2, & |
---|
1381 | // 'W/m**2') |
---|
1382 | 5 FORMAT (' --> Simple radiation scheme for clear sky is used (no clouds,',& |
---|
1383 | ' default)') |
---|
1384 | 6 FORMAT (' --> RRTMG scheme is used') |
---|
1385 | 7 FORMAT (/' User-specific surface albedo: albedo =', F6.3) |
---|
1386 | 8 FORMAT (/' Albedo is set for land surface type: ', A) |
---|
1387 | 9 FORMAT (/' --> Albedo is fixed during the run') |
---|
1388 | 10 FORMAT (/' --> Longwave radiation is disabled') |
---|
1389 | 11 FORMAT (/' --> Shortwave radiation is disabled.') |
---|
1390 | 12 FORMAT (' Timestep: dt_radiation = ', F6.2, ' s') |
---|
1391 | |
---|
1392 | |
---|
1393 | END SUBROUTINE radiation_header |
---|
1394 | |
---|
1395 | |
---|
1396 | !------------------------------------------------------------------------------! |
---|
1397 | ! Description: |
---|
1398 | ! ------------ |
---|
1399 | !> Parin for &radiation_par for radiation model |
---|
1400 | !------------------------------------------------------------------------------! |
---|
1401 | SUBROUTINE radiation_parin |
---|
1402 | |
---|
1403 | |
---|
1404 | IMPLICIT NONE |
---|
1405 | |
---|
1406 | CHARACTER (LEN=80) :: line !< dummy string that contains the current line of the parameter file |
---|
1407 | |
---|
1408 | NAMELIST /radiation_par/ albedo, albedo_type, albedo_lw_dir, & |
---|
1409 | albedo_lw_dif, albedo_sw_dir, albedo_sw_dif, & |
---|
1410 | constant_albedo, dt_radiation, emissivity, & |
---|
1411 | lw_radiation, net_radiation, & |
---|
1412 | radiation_scheme, skip_time_do_radiation, & |
---|
1413 | sw_radiation, unscheduled_radiation_calls |
---|
1414 | |
---|
1415 | line = ' ' |
---|
1416 | |
---|
1417 | ! |
---|
1418 | !-- Try to find radiation model package |
---|
1419 | REWIND ( 11 ) |
---|
1420 | line = ' ' |
---|
1421 | DO WHILE ( INDEX( line, '&radiation_par' ) == 0 ) |
---|
1422 | READ ( 11, '(A)', END=10 ) line |
---|
1423 | ENDDO |
---|
1424 | BACKSPACE ( 11 ) |
---|
1425 | |
---|
1426 | ! |
---|
1427 | !-- Read user-defined namelist |
---|
1428 | READ ( 11, radiation_par ) |
---|
1429 | |
---|
1430 | ! |
---|
1431 | !-- Set flag that indicates that the radiation model is switched on |
---|
1432 | radiation = .TRUE. |
---|
1433 | |
---|
1434 | 10 CONTINUE |
---|
1435 | |
---|
1436 | |
---|
1437 | END SUBROUTINE radiation_parin |
---|
1438 | |
---|
1439 | |
---|
1440 | !------------------------------------------------------------------------------! |
---|
1441 | ! Description: |
---|
1442 | ! ------------ |
---|
1443 | !> Implementation of the RRTMG radiation_scheme |
---|
1444 | !------------------------------------------------------------------------------! |
---|
1445 | SUBROUTINE radiation_rrtmg |
---|
1446 | |
---|
1447 | USE indices, & |
---|
1448 | ONLY: nbgp |
---|
1449 | |
---|
1450 | USE particle_attributes, & |
---|
1451 | ONLY: grid_particles, number_of_particles, particles, & |
---|
1452 | particle_advection_start, prt_count |
---|
1453 | |
---|
1454 | IMPLICIT NONE |
---|
1455 | |
---|
1456 | #if defined ( __rrtmg ) |
---|
1457 | |
---|
1458 | INTEGER(iwp) :: i, j, k, n !< loop indices |
---|
1459 | |
---|
1460 | REAL(wp) :: nc_rad, & !< number concentration of cloud droplets |
---|
1461 | s_r2, & !< weighted sum over all droplets with r^2 |
---|
1462 | s_r3 !< weighted sum over all droplets with r^3 |
---|
1463 | |
---|
1464 | ! |
---|
1465 | !-- Calculate current (cosine of) zenith angle and whether the sun is up |
---|
1466 | CALL calc_zenith |
---|
1467 | ! |
---|
1468 | !-- Calculate surface albedo |
---|
1469 | IF ( .NOT. constant_albedo ) THEN |
---|
1470 | CALL calc_albedo |
---|
1471 | ENDIF |
---|
1472 | |
---|
1473 | ! |
---|
1474 | !-- Prepare input data for RRTMG |
---|
1475 | |
---|
1476 | ! |
---|
1477 | !-- In case of large scale forcing with surface data, calculate new pressure |
---|
1478 | !-- profile. nzt_rad might be modified by these calls and all required arrays |
---|
1479 | !-- will then be re-allocated |
---|
1480 | IF ( large_scale_forcing .AND. lsf_surf ) THEN |
---|
1481 | CALL read_sounding_data |
---|
1482 | CALL read_trace_gas_data |
---|
1483 | ENDIF |
---|
1484 | ! |
---|
1485 | !-- Loop over all grid points |
---|
1486 | DO i = nxl, nxr |
---|
1487 | DO j = nys, nyn |
---|
1488 | |
---|
1489 | ! |
---|
1490 | !-- Prepare profiles of temperature and H2O volume mixing ratio |
---|
1491 | rrtm_tlev(0,nzb+1) = pt(nzb,j,i) * ( surface_pressure & |
---|
1492 | / 1000.0_wp )**0.286_wp |
---|
1493 | |
---|
1494 | |
---|
1495 | IF ( cloud_physics ) THEN |
---|
1496 | DO k = nzb+1, nzt+1 |
---|
1497 | rrtm_tlay(0,k) = pt(k,j,i) * ( (hyp(k) ) / 100000.0_wp & |
---|
1498 | )**0.286_wp + l_d_cp * ql(k,j,i) |
---|
1499 | rrtm_h2ovmr(0,k) = mol_mass_air_d_wv * (q(k,j,i) - ql(k,j,i)) |
---|
1500 | ENDDO |
---|
1501 | ELSEIF ( cloud_droplets ) THEN |
---|
1502 | DO k = nzb+1, nzt+1 |
---|
1503 | rrtm_tlay(0,k) = pt(k,j,i) * ( (hyp(k) ) / 100000.0_wp & |
---|
1504 | )**0.286_wp + l_d_cp * ql(k,j,i) |
---|
1505 | rrtm_h2ovmr(0,k) = mol_mass_air_d_wv * q(k,j,i) |
---|
1506 | ENDDO |
---|
1507 | ELSE |
---|
1508 | DO k = nzb+1, nzt+1 |
---|
1509 | rrtm_tlay(0,k) = pt(k,j,i) * ( (hyp(k) ) / 100000.0_wp & |
---|
1510 | )**0.286_wp |
---|
1511 | rrtm_h2ovmr(0,k) = 0.0_wp |
---|
1512 | ENDDO |
---|
1513 | ENDIF |
---|
1514 | |
---|
1515 | ! |
---|
1516 | !-- Avoid temperature/humidity jumps at the top of the LES domain by |
---|
1517 | !-- linear interpolation from nzt+2 to nzt+7 |
---|
1518 | DO k = nzt+2, nzt+7 |
---|
1519 | rrtm_tlay(0,k) = rrtm_tlay(0,nzt+1) & |
---|
1520 | + ( rrtm_tlay(0,nzt+8) - rrtm_tlay(0,nzt+1) ) & |
---|
1521 | / ( rrtm_play(0,nzt+8) - rrtm_play(0,nzt+1) ) & |
---|
1522 | * ( rrtm_play(0,k) - rrtm_play(0,nzt+1) ) |
---|
1523 | |
---|
1524 | rrtm_h2ovmr(0,k) = rrtm_h2ovmr(0,nzt+1) & |
---|
1525 | + ( rrtm_h2ovmr(0,nzt+8) - rrtm_h2ovmr(0,nzt+1) )& |
---|
1526 | / ( rrtm_play(0,nzt+8) - rrtm_play(0,nzt+1) )& |
---|
1527 | * ( rrtm_play(0,k) - rrtm_play(0,nzt+1) ) |
---|
1528 | |
---|
1529 | ENDDO |
---|
1530 | |
---|
1531 | !-- Linear interpolate to zw grid |
---|
1532 | DO k = nzb+2, nzt+8 |
---|
1533 | rrtm_tlev(0,k) = rrtm_tlay(0,k-1) + (rrtm_tlay(0,k) - & |
---|
1534 | rrtm_tlay(0,k-1)) & |
---|
1535 | / ( rrtm_play(0,k) - rrtm_play(0,k-1) ) & |
---|
1536 | * ( rrtm_plev(0,k) - rrtm_play(0,k-1) ) |
---|
1537 | ENDDO |
---|
1538 | |
---|
1539 | |
---|
1540 | ! |
---|
1541 | !-- Calculate liquid water path and cloud fraction for each column. |
---|
1542 | !-- Note that LWP is required in g/m² instead of kg/kg m. |
---|
1543 | rrtm_cldfr = 0.0_wp |
---|
1544 | rrtm_reliq = 0.0_wp |
---|
1545 | rrtm_cliqwp = 0.0_wp |
---|
1546 | rrtm_icld = 0 |
---|
1547 | |
---|
1548 | IF ( cloud_physics .OR. cloud_droplets ) THEN |
---|
1549 | DO k = nzb+1, nzt+1 |
---|
1550 | rrtm_cliqwp(0,k) = ql(k,j,i) * 1000.0_wp * & |
---|
1551 | (rrtm_plev(0,k) - rrtm_plev(0,k+1)) & |
---|
1552 | * 100.0_wp / g |
---|
1553 | |
---|
1554 | IF ( rrtm_cliqwp(0,k) > 0.0_wp ) THEN |
---|
1555 | rrtm_cldfr(0,k) = 1.0_wp |
---|
1556 | IF ( rrtm_icld == 0 ) rrtm_icld = 1 |
---|
1557 | |
---|
1558 | ! |
---|
1559 | !-- Calculate cloud droplet effective radius |
---|
1560 | IF ( cloud_physics ) THEN |
---|
1561 | ! |
---|
1562 | !-- Calculete effective droplet radius. In case of using |
---|
1563 | !-- cloud_scheme = 'morrison' and a non reasonable number |
---|
1564 | !-- of cloud droplets the inital aerosol number |
---|
1565 | !-- concentration is considered. |
---|
1566 | IF ( microphysics_morrison ) THEN |
---|
1567 | IF ( nc(k,j,i) > 1.0E-20_wp ) THEN |
---|
1568 | nc_rad = nc(k,j,i) |
---|
1569 | ELSE |
---|
1570 | nc_rad = na_init |
---|
1571 | ENDIF |
---|
1572 | ELSE |
---|
1573 | nc_rad = nc_const |
---|
1574 | ENDIF |
---|
1575 | |
---|
1576 | rrtm_reliq(0,k) = 1.0E6_wp * ( 3.0_wp * ql(k,j,i) & |
---|
1577 | * rho_surface & |
---|
1578 | / ( 4.0_wp * pi * nc_rad * rho_l )& |
---|
1579 | )**0.33333333333333_wp & |
---|
1580 | * EXP( LOG( sigma_gc )**2 ) |
---|
1581 | |
---|
1582 | ELSEIF ( cloud_droplets ) THEN |
---|
1583 | number_of_particles = prt_count(k,j,i) |
---|
1584 | |
---|
1585 | IF (number_of_particles <= 0) CYCLE |
---|
1586 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
1587 | s_r2 = 0.0_wp |
---|
1588 | s_r3 = 0.0_wp |
---|
1589 | |
---|
1590 | DO n = 1, number_of_particles |
---|
1591 | IF ( particles(n)%particle_mask ) THEN |
---|
1592 | s_r2 = s_r2 + particles(n)%radius**2 * & |
---|
1593 | particles(n)%weight_factor |
---|
1594 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
1595 | particles(n)%weight_factor |
---|
1596 | ENDIF |
---|
1597 | ENDDO |
---|
1598 | |
---|
1599 | IF ( s_r2 > 0.0_wp ) rrtm_reliq(0,k) = s_r3 / s_r2 |
---|
1600 | |
---|
1601 | ENDIF |
---|
1602 | |
---|
1603 | ! |
---|
1604 | !-- Limit effective radius |
---|
1605 | IF ( rrtm_reliq(0,k) > 0.0_wp ) THEN |
---|
1606 | rrtm_reliq(0,k) = MAX(rrtm_reliq(0,k),2.5_wp) |
---|
1607 | rrtm_reliq(0,k) = MIN(rrtm_reliq(0,k),60.0_wp) |
---|
1608 | ENDIF |
---|
1609 | ENDIF |
---|
1610 | ENDDO |
---|
1611 | ENDIF |
---|
1612 | |
---|
1613 | ! |
---|
1614 | !-- Set surface temperature |
---|
1615 | rrtm_tsfc = pt(nzb,j,i) * (surface_pressure / 1000.0_wp )**0.286_wp |
---|
1616 | |
---|
1617 | ! |
---|
1618 | !-- Set surface emissivity |
---|
1619 | rrtm_emis = emis(j,i) |
---|
1620 | |
---|
1621 | IF ( lw_radiation ) THEN |
---|
1622 | CALL rrtmg_lw( 1, nzt_rad , rrtm_icld , rrtm_idrv ,& |
---|
1623 | rrtm_play , rrtm_plev , rrtm_tlay , rrtm_tlev ,& |
---|
1624 | rrtm_tsfc , rrtm_h2ovmr , rrtm_o3vmr , rrtm_co2vmr ,& |
---|
1625 | rrtm_ch4vmr , rrtm_n2ovmr , rrtm_o2vmr , rrtm_cfc11vmr ,& |
---|
1626 | rrtm_cfc12vmr , rrtm_cfc22vmr, rrtm_ccl4vmr , rrtm_emis ,& |
---|
1627 | rrtm_inflglw , rrtm_iceflglw, rrtm_liqflglw, rrtm_cldfr ,& |
---|
1628 | rrtm_lw_taucld , rrtm_cicewp , rrtm_cliqwp , rrtm_reice ,& |
---|
1629 | rrtm_reliq , rrtm_lw_tauaer, & |
---|
1630 | rrtm_lwuflx , rrtm_lwdflx , rrtm_lwhr , & |
---|
1631 | rrtm_lwuflxc , rrtm_lwdflxc , rrtm_lwhrc , & |
---|
1632 | rrtm_lwuflx_dt , rrtm_lwuflxc_dt ) |
---|
1633 | |
---|
1634 | ! |
---|
1635 | !-- Save fluxes |
---|
1636 | DO k = nzb, nzt+1 |
---|
1637 | rad_lw_in(k,j,i) = rrtm_lwdflx(0,k) |
---|
1638 | rad_lw_out(k,j,i) = rrtm_lwuflx(0,k) |
---|
1639 | ENDDO |
---|
1640 | |
---|
1641 | ! |
---|
1642 | !-- Save heating rates (convert from K/d to K/h) |
---|
1643 | DO k = nzb+1, nzt+1 |
---|
1644 | rad_lw_hr(k,j,i) = rrtm_lwhr(0,k) * d_hours_day |
---|
1645 | rad_lw_cs_hr(k,j,i) = rrtm_lwhrc(0,k) * d_hours_day |
---|
1646 | ENDDO |
---|
1647 | |
---|
1648 | ! |
---|
1649 | !-- Save change in LW heating rate |
---|
1650 | rad_lw_out_change_0(j,i) = rrtm_lwuflx_dt(0,nzb) |
---|
1651 | |
---|
1652 | ENDIF |
---|
1653 | |
---|
1654 | IF ( sw_radiation .AND. sun_up ) THEN |
---|
1655 | CALL rrtmg_sw( 1, nzt_rad , rrtm_icld , rrtm_iaer ,& |
---|
1656 | rrtm_play , rrtm_plev , rrtm_tlay , rrtm_tlev ,& |
---|
1657 | rrtm_tsfc , rrtm_h2ovmr , rrtm_o3vmr , rrtm_co2vmr ,& |
---|
1658 | rrtm_ch4vmr , rrtm_n2ovmr , rrtm_o2vmr , rrtm_asdir(:,j,i),& |
---|
1659 | rrtm_asdif(:,j,i), rrtm_aldir(:,j,i), rrtm_aldif(:,j,i), zenith,& |
---|
1660 | 0.0_wp , day_of_year , solar_constant, rrtm_inflgsw,& |
---|
1661 | rrtm_iceflgsw , rrtm_liqflgsw, rrtm_cldfr , rrtm_sw_taucld ,& |
---|
1662 | rrtm_sw_ssacld , rrtm_sw_asmcld, rrtm_sw_fsfcld, rrtm_cicewp ,& |
---|
1663 | rrtm_cliqwp , rrtm_reice , rrtm_reliq , rrtm_sw_tauaer ,& |
---|
1664 | rrtm_sw_ssaaer , rrtm_sw_asmaer , rrtm_sw_ecaer , & |
---|
1665 | rrtm_swuflx , rrtm_swdflx , rrtm_swhr , & |
---|
1666 | rrtm_swuflxc , rrtm_swdflxc , rrtm_swhrc ) |
---|
1667 | |
---|
1668 | ! |
---|
1669 | !-- Save fluxes |
---|
1670 | DO k = nzb, nzt+1 |
---|
1671 | rad_sw_in(k,j,i) = rrtm_swdflx(0,k) |
---|
1672 | rad_sw_out(k,j,i) = rrtm_swuflx(0,k) |
---|
1673 | ENDDO |
---|
1674 | |
---|
1675 | ! |
---|
1676 | !-- Save heating rates (convert from K/d to K/s) |
---|
1677 | DO k = nzb+1, nzt+1 |
---|
1678 | rad_sw_hr(k,j,i) = rrtm_swhr(0,k) * d_hours_day |
---|
1679 | rad_sw_cs_hr(k,j,i) = rrtm_swhrc(0,k) * d_hours_day |
---|
1680 | ENDDO |
---|
1681 | |
---|
1682 | ENDIF |
---|
1683 | |
---|
1684 | ! |
---|
1685 | !-- Calculate surface net radiation |
---|
1686 | rad_net(j,i) = rad_sw_in(nzb,j,i) - rad_sw_out(nzb,j,i) & |
---|
1687 | + rad_lw_in(nzb,j,i) - rad_lw_out(nzb,j,i) |
---|
1688 | |
---|
1689 | ENDDO |
---|
1690 | ENDDO |
---|
1691 | |
---|
1692 | CALL exchange_horiz( rad_lw_in, nbgp ) |
---|
1693 | CALL exchange_horiz( rad_lw_out, nbgp ) |
---|
1694 | CALL exchange_horiz( rad_lw_hr, nbgp ) |
---|
1695 | CALL exchange_horiz( rad_lw_cs_hr, nbgp ) |
---|
1696 | |
---|
1697 | CALL exchange_horiz( rad_sw_in, nbgp ) |
---|
1698 | CALL exchange_horiz( rad_sw_out, nbgp ) |
---|
1699 | CALL exchange_horiz( rad_sw_hr, nbgp ) |
---|
1700 | CALL exchange_horiz( rad_sw_cs_hr, nbgp ) |
---|
1701 | |
---|
1702 | CALL exchange_horiz_2d( rad_net ) |
---|
1703 | CALL exchange_horiz_2d( rad_lw_out_change_0 ) |
---|
1704 | #endif |
---|
1705 | |
---|
1706 | END SUBROUTINE radiation_rrtmg |
---|
1707 | |
---|
1708 | |
---|
1709 | !------------------------------------------------------------------------------! |
---|
1710 | ! Description: |
---|
1711 | ! ------------ |
---|
1712 | !> Calculate the cosine of the zenith angle (variable is called zenith) |
---|
1713 | !------------------------------------------------------------------------------! |
---|
1714 | SUBROUTINE calc_zenith |
---|
1715 | |
---|
1716 | IMPLICIT NONE |
---|
1717 | |
---|
1718 | REAL(wp) :: declination, & !< solar declination angle |
---|
1719 | hour_angle !< solar hour angle |
---|
1720 | ! |
---|
1721 | !-- Calculate current day and time based on the initial values and simulation |
---|
1722 | !-- time |
---|
1723 | CALL calc_date_and_time |
---|
1724 | |
---|
1725 | ! |
---|
1726 | !-- Calculate solar declination and hour angle |
---|
1727 | declination = ASIN( decl_1 * SIN(decl_2 * REAL(day_of_year, KIND=wp) - decl_3) ) |
---|
1728 | hour_angle = 2.0_wp * pi * (time_utc / 86400.0_wp) + lon - pi |
---|
1729 | |
---|
1730 | ! |
---|
1731 | !-- Calculate cosine of solar zenith angle |
---|
1732 | zenith(0) = SIN(lat) * SIN(declination) + COS(lat) * COS(declination) & |
---|
1733 | * COS(hour_angle) |
---|
1734 | zenith(0) = MAX(0.0_wp,zenith(0)) |
---|
1735 | |
---|
1736 | ! |
---|
1737 | !-- Calculate solar directional vector |
---|
1738 | IF ( sun_direction ) THEN |
---|
1739 | |
---|
1740 | ! |
---|
1741 | !-- Direction in longitudes equals to sin(solar_azimuth) * sin(zenith) |
---|
1742 | sun_dir_lon(0) = -SIN(hour_angle) * COS(declination) |
---|
1743 | |
---|
1744 | ! |
---|
1745 | !-- Direction in latitues equals to cos(solar_azimuth) * sin(zenith) |
---|
1746 | sun_dir_lat(0) = SIN(declination) * COS(lat) - COS(hour_angle) & |
---|
1747 | * COS(declination) * SIN(lat) |
---|
1748 | ENDIF |
---|
1749 | |
---|
1750 | ! |
---|
1751 | !-- Check if the sun is up (otheriwse shortwave calculations can be skipped) |
---|
1752 | IF ( zenith(0) > 0.0_wp ) THEN |
---|
1753 | sun_up = .TRUE. |
---|
1754 | ELSE |
---|
1755 | sun_up = .FALSE. |
---|
1756 | END IF |
---|
1757 | |
---|
1758 | END SUBROUTINE calc_zenith |
---|
1759 | |
---|
1760 | #if defined ( __rrtmg ) && defined ( __netcdf ) |
---|
1761 | !------------------------------------------------------------------------------! |
---|
1762 | ! Description: |
---|
1763 | ! ------------ |
---|
1764 | !> Calculates surface albedo components based on Briegleb (1992) and |
---|
1765 | !> Briegleb et al. (1986) |
---|
1766 | !------------------------------------------------------------------------------! |
---|
1767 | SUBROUTINE calc_albedo |
---|
1768 | |
---|
1769 | IMPLICIT NONE |
---|
1770 | |
---|
1771 | IF ( sun_up ) THEN |
---|
1772 | ! |
---|
1773 | !-- Ocean |
---|
1774 | IF ( albedo_type == 1 ) THEN |
---|
1775 | rrtm_aldir(0,:,:) = 0.026_wp / ( zenith(0)**1.7_wp + 0.065_wp ) & |
---|
1776 | + 0.15_wp * ( zenith(0) - 0.1_wp ) & |
---|
1777 | * ( zenith(0) - 0.5_wp ) & |
---|
1778 | * ( zenith(0) - 1.0_wp ) |
---|
1779 | rrtm_asdir(0,:,:) = rrtm_aldir(0,:,:) |
---|
1780 | ! |
---|
1781 | !-- Snow |
---|
1782 | ELSEIF ( albedo_type == 16 ) THEN |
---|
1783 | IF ( zenith(0) < 0.5_wp ) THEN |
---|
1784 | rrtm_aldir(0,:,:) = 0.5_wp * (1.0_wp - aldif) & |
---|
1785 | * ( 3.0_wp / (1.0_wp + 4.0_wp & |
---|
1786 | * zenith(0))) - 1.0_wp |
---|
1787 | rrtm_asdir(0,:,:) = 0.5_wp * (1.0_wp - asdif) & |
---|
1788 | * ( 3.0_wp / (1.0_wp + 4.0_wp & |
---|
1789 | * zenith(0))) - 1.0_wp |
---|
1790 | |
---|
1791 | rrtm_aldir(0,:,:) = MIN(0.98_wp, rrtm_aldir(0,:,:)) |
---|
1792 | rrtm_asdir(0,:,:) = MIN(0.98_wp, rrtm_asdir(0,:,:)) |
---|
1793 | ELSE |
---|
1794 | rrtm_aldir(0,:,:) = aldif |
---|
1795 | rrtm_asdir(0,:,:) = asdif |
---|
1796 | ENDIF |
---|
1797 | ! |
---|
1798 | !-- Sea ice |
---|
1799 | ELSEIF ( albedo_type == 15 ) THEN |
---|
1800 | rrtm_aldir(0,:,:) = aldif |
---|
1801 | rrtm_asdir(0,:,:) = asdif |
---|
1802 | |
---|
1803 | ! |
---|
1804 | !-- Bare soil |
---|
1805 | ELSEIF ( albedo_type == 17 ) THEN |
---|
1806 | rrtm_aldir(0,:,:) = aldif |
---|
1807 | rrtm_asdir(0,:,:) = asdif |
---|
1808 | |
---|
1809 | ! |
---|
1810 | !-- For impermeable surfaces, use values from the lookup table |
---|
1811 | ELSEIF ( albedo_type > 17 ) THEN |
---|
1812 | rrtm_aldir(0,:,:) = aldif |
---|
1813 | rrtm_asdir(0,:,:) = asdif |
---|
1814 | ! |
---|
1815 | !-- Land surfaces |
---|
1816 | ELSE |
---|
1817 | SELECT CASE ( albedo_type ) |
---|
1818 | |
---|
1819 | ! |
---|
1820 | !-- Surface types with strong zenith dependence |
---|
1821 | CASE ( 1, 2, 3, 4, 11, 12, 13 ) |
---|
1822 | rrtm_aldir(0,:,:) = aldif * 1.4_wp / & |
---|
1823 | (1.0_wp + 0.8_wp * zenith(0)) |
---|
1824 | rrtm_asdir(0,:,:) = asdif * 1.4_wp / & |
---|
1825 | (1.0_wp + 0.8_wp * zenith(0)) |
---|
1826 | ! |
---|
1827 | !-- Surface types with weak zenith dependence |
---|
1828 | CASE ( 5, 6, 7, 8, 9, 10, 14 ) |
---|
1829 | rrtm_aldir(0,:,:) = aldif * 1.1_wp / & |
---|
1830 | (1.0_wp + 0.2_wp * zenith(0)) |
---|
1831 | rrtm_asdir(0,:,:) = asdif * 1.1_wp / & |
---|
1832 | (1.0_wp + 0.2_wp * zenith(0)) |
---|
1833 | |
---|
1834 | CASE DEFAULT |
---|
1835 | |
---|
1836 | END SELECT |
---|
1837 | ENDIF |
---|
1838 | ! |
---|
1839 | !-- Diffusive albedo is taken from Table 2 |
---|
1840 | rrtm_aldif(0,:,:) = aldif |
---|
1841 | rrtm_asdif(0,:,:) = asdif |
---|
1842 | |
---|
1843 | ELSE |
---|
1844 | |
---|
1845 | rrtm_aldir(0,:,:) = 0.0_wp |
---|
1846 | rrtm_asdir(0,:,:) = 0.0_wp |
---|
1847 | rrtm_aldif(0,:,:) = 0.0_wp |
---|
1848 | rrtm_asdif(0,:,:) = 0.0_wp |
---|
1849 | ENDIF |
---|
1850 | END SUBROUTINE calc_albedo |
---|
1851 | |
---|
1852 | !------------------------------------------------------------------------------! |
---|
1853 | ! Description: |
---|
1854 | ! ------------ |
---|
1855 | !> Read sounding data (pressure and temperature) from RADIATION_DATA. |
---|
1856 | !------------------------------------------------------------------------------! |
---|
1857 | SUBROUTINE read_sounding_data |
---|
1858 | |
---|
1859 | IMPLICIT NONE |
---|
1860 | |
---|
1861 | INTEGER(iwp) :: id, & !< NetCDF id of input file |
---|
1862 | id_dim_zrad, & !< pressure level id in the NetCDF file |
---|
1863 | id_var, & !< NetCDF variable id |
---|
1864 | k, & !< loop index |
---|
1865 | nz_snd, & !< number of vertical levels in the sounding data |
---|
1866 | nz_snd_start, & !< start vertical index for sounding data to be used |
---|
1867 | nz_snd_end !< end vertical index for souding data to be used |
---|
1868 | |
---|
1869 | REAL(wp) :: t_surface !< actual surface temperature |
---|
1870 | |
---|
1871 | REAL(wp), DIMENSION(:), ALLOCATABLE :: hyp_snd_tmp, & !< temporary hydrostatic pressure profile (sounding) |
---|
1872 | t_snd_tmp !< temporary temperature profile (sounding) |
---|
1873 | |
---|
1874 | ! |
---|
1875 | !-- In case of updates, deallocate arrays first (sufficient to check one |
---|
1876 | !-- array as the others are automatically allocated). This is required |
---|
1877 | !-- because nzt_rad might change during the update |
---|
1878 | IF ( ALLOCATED ( hyp_snd ) ) THEN |
---|
1879 | DEALLOCATE( hyp_snd ) |
---|
1880 | DEALLOCATE( t_snd ) |
---|
1881 | DEALLOCATE( q_snd ) |
---|
1882 | DEALLOCATE ( rrtm_play ) |
---|
1883 | DEALLOCATE ( rrtm_plev ) |
---|
1884 | DEALLOCATE ( rrtm_tlay ) |
---|
1885 | DEALLOCATE ( rrtm_tlev ) |
---|
1886 | |
---|
1887 | DEALLOCATE ( rrtm_h2ovmr ) |
---|
1888 | DEALLOCATE ( rrtm_cicewp ) |
---|
1889 | DEALLOCATE ( rrtm_cldfr ) |
---|
1890 | DEALLOCATE ( rrtm_cliqwp ) |
---|
1891 | DEALLOCATE ( rrtm_reice ) |
---|
1892 | DEALLOCATE ( rrtm_reliq ) |
---|
1893 | DEALLOCATE ( rrtm_lw_taucld ) |
---|
1894 | DEALLOCATE ( rrtm_lw_tauaer ) |
---|
1895 | |
---|
1896 | DEALLOCATE ( rrtm_lwdflx ) |
---|
1897 | DEALLOCATE ( rrtm_lwdflxc ) |
---|
1898 | DEALLOCATE ( rrtm_lwuflx ) |
---|
1899 | DEALLOCATE ( rrtm_lwuflxc ) |
---|
1900 | DEALLOCATE ( rrtm_lwuflx_dt ) |
---|
1901 | DEALLOCATE ( rrtm_lwuflxc_dt ) |
---|
1902 | DEALLOCATE ( rrtm_lwhr ) |
---|
1903 | DEALLOCATE ( rrtm_lwhrc ) |
---|
1904 | |
---|
1905 | DEALLOCATE ( rrtm_sw_taucld ) |
---|
1906 | DEALLOCATE ( rrtm_sw_ssacld ) |
---|
1907 | DEALLOCATE ( rrtm_sw_asmcld ) |
---|
1908 | DEALLOCATE ( rrtm_sw_fsfcld ) |
---|
1909 | DEALLOCATE ( rrtm_sw_tauaer ) |
---|
1910 | DEALLOCATE ( rrtm_sw_ssaaer ) |
---|
1911 | DEALLOCATE ( rrtm_sw_asmaer ) |
---|
1912 | DEALLOCATE ( rrtm_sw_ecaer ) |
---|
1913 | |
---|
1914 | DEALLOCATE ( rrtm_swdflx ) |
---|
1915 | DEALLOCATE ( rrtm_swdflxc ) |
---|
1916 | DEALLOCATE ( rrtm_swuflx ) |
---|
1917 | DEALLOCATE ( rrtm_swuflxc ) |
---|
1918 | DEALLOCATE ( rrtm_swhr ) |
---|
1919 | DEALLOCATE ( rrtm_swhrc ) |
---|
1920 | |
---|
1921 | ENDIF |
---|
1922 | |
---|
1923 | ! |
---|
1924 | !-- Open file for reading |
---|
1925 | nc_stat = NF90_OPEN( rrtm_input_file, NF90_NOWRITE, id ) |
---|
1926 | CALL netcdf_handle_error_rad( 'read_sounding_data', 549 ) |
---|
1927 | |
---|
1928 | ! |
---|
1929 | !-- Inquire dimension of z axis and save in nz_snd |
---|
1930 | nc_stat = NF90_INQ_DIMID( id, "Pressure", id_dim_zrad ) |
---|
1931 | nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim_zrad, len = nz_snd ) |
---|
1932 | CALL netcdf_handle_error_rad( 'read_sounding_data', 551 ) |
---|
1933 | |
---|
1934 | ! |
---|
1935 | ! !-- Allocate temporary array for storing pressure data |
---|
1936 | ALLOCATE( hyp_snd_tmp(1:nz_snd) ) |
---|
1937 | hyp_snd_tmp = 0.0_wp |
---|
1938 | |
---|
1939 | |
---|
1940 | !-- Read pressure from file |
---|
1941 | nc_stat = NF90_INQ_VARID( id, "Pressure", id_var ) |
---|
1942 | nc_stat = NF90_GET_VAR( id, id_var, hyp_snd_tmp(:), start = (/1/), & |
---|
1943 | count = (/nz_snd/) ) |
---|
1944 | CALL netcdf_handle_error_rad( 'read_sounding_data', 552 ) |
---|
1945 | |
---|
1946 | ! |
---|
1947 | !-- Allocate temporary array for storing temperature data |
---|
1948 | ALLOCATE( t_snd_tmp(1:nz_snd) ) |
---|
1949 | t_snd_tmp = 0.0_wp |
---|
1950 | |
---|
1951 | ! |
---|
1952 | !-- Read temperature from file |
---|
1953 | nc_stat = NF90_INQ_VARID( id, "ReferenceTemperature", id_var ) |
---|
1954 | nc_stat = NF90_GET_VAR( id, id_var, t_snd_tmp(:), start = (/1/), & |
---|
1955 | count = (/nz_snd/) ) |
---|
1956 | CALL netcdf_handle_error_rad( 'read_sounding_data', 553 ) |
---|
1957 | |
---|
1958 | ! |
---|
1959 | !-- Calculate start of sounding data |
---|
1960 | nz_snd_start = nz_snd + 1 |
---|
1961 | nz_snd_end = nz_snd + 1 |
---|
1962 | |
---|
1963 | ! |
---|
1964 | !-- Start filling vertical dimension at 10hPa above the model domain (hyp is |
---|
1965 | !-- in Pa, hyp_snd in hPa). |
---|
1966 | DO k = 1, nz_snd |
---|
1967 | IF ( hyp_snd_tmp(k) < ( hyp(nzt+1) - 1000.0_wp) * 0.01_wp ) THEN |
---|
1968 | nz_snd_start = k |
---|
1969 | EXIT |
---|
1970 | END IF |
---|
1971 | END DO |
---|
1972 | |
---|
1973 | IF ( nz_snd_start <= nz_snd ) THEN |
---|
1974 | nz_snd_end = nz_snd |
---|
1975 | END IF |
---|
1976 | |
---|
1977 | |
---|
1978 | ! |
---|
1979 | !-- Calculate of total grid points for RRTMG calculations |
---|
1980 | nzt_rad = nzt + nz_snd_end - nz_snd_start + 1 |
---|
1981 | |
---|
1982 | ! |
---|
1983 | !-- Save data above LES domain in hyp_snd, t_snd and q_snd |
---|
1984 | !-- Note: q_snd_tmp is not calculated at the moment (dry residual atmosphere) |
---|
1985 | ALLOCATE( hyp_snd(nzb+1:nzt_rad) ) |
---|
1986 | ALLOCATE( t_snd(nzb+1:nzt_rad) ) |
---|
1987 | ALLOCATE( q_snd(nzb+1:nzt_rad) ) |
---|
1988 | hyp_snd = 0.0_wp |
---|
1989 | t_snd = 0.0_wp |
---|
1990 | q_snd = 0.0_wp |
---|
1991 | |
---|
1992 | hyp_snd(nzt+2:nzt_rad) = hyp_snd_tmp(nz_snd_start+1:nz_snd_end) |
---|
1993 | t_snd(nzt+2:nzt_rad) = t_snd_tmp(nz_snd_start+1:nz_snd_end) |
---|
1994 | |
---|
1995 | nc_stat = NF90_CLOSE( id ) |
---|
1996 | |
---|
1997 | ! |
---|
1998 | !-- Calculate pressure levels on zu and zw grid. Sounding data is added at |
---|
1999 | !-- top of the LES domain. This routine does not consider horizontal or |
---|
2000 | !-- vertical variability of pressure and temperature |
---|
2001 | ALLOCATE ( rrtm_play(0:0,nzb+1:nzt_rad+1) ) |
---|
2002 | ALLOCATE ( rrtm_plev(0:0,nzb+1:nzt_rad+2) ) |
---|
2003 | |
---|
2004 | t_surface = pt_surface * ( surface_pressure / 1000.0_wp )**0.286_wp |
---|
2005 | DO k = nzb+1, nzt+1 |
---|
2006 | rrtm_play(0,k) = hyp(k) * 0.01_wp |
---|
2007 | rrtm_plev(0,k) = surface_pressure * ( (t_surface - g/cp * zw(k-1)) / & |
---|
2008 | t_surface )**(1.0_wp/0.286_wp) |
---|
2009 | ENDDO |
---|
2010 | |
---|
2011 | DO k = nzt+2, nzt_rad |
---|
2012 | rrtm_play(0,k) = hyp_snd(k) |
---|
2013 | rrtm_plev(0,k) = 0.5_wp * ( rrtm_play(0,k) + rrtm_play(0,k-1) ) |
---|
2014 | ENDDO |
---|
2015 | rrtm_plev(0,nzt_rad+1) = MAX( 0.5 * hyp_snd(nzt_rad), & |
---|
2016 | 1.5 * hyp_snd(nzt_rad) & |
---|
2017 | - 0.5 * hyp_snd(nzt_rad-1) ) |
---|
2018 | rrtm_plev(0,nzt_rad+2) = MIN( 1.0E-4_wp, & |
---|
2019 | 0.25_wp * rrtm_plev(0,nzt_rad+1) ) |
---|
2020 | |
---|
2021 | rrtm_play(0,nzt_rad+1) = 0.5 * rrtm_plev(0,nzt_rad+1) |
---|
2022 | |
---|
2023 | ! |
---|
2024 | !-- Calculate temperature/humidity levels at top of the LES domain. |
---|
2025 | !-- Currently, the temperature is taken from sounding data (might lead to a |
---|
2026 | !-- temperature jump at interface. To do: Humidity is currently not |
---|
2027 | !-- calculated above the LES domain. |
---|
2028 | ALLOCATE ( rrtm_tlay(0:0,nzb+1:nzt_rad+1) ) |
---|
2029 | ALLOCATE ( rrtm_tlev(0:0,nzb+1:nzt_rad+2) ) |
---|
2030 | ALLOCATE ( rrtm_h2ovmr(0:0,nzb+1:nzt_rad+1) ) |
---|
2031 | |
---|
2032 | DO k = nzt+8, nzt_rad |
---|
2033 | rrtm_tlay(0,k) = t_snd(k) |
---|
2034 | rrtm_h2ovmr(0,k) = q_snd(k) |
---|
2035 | ENDDO |
---|
2036 | rrtm_tlay(0,nzt_rad+1) = 2.0_wp * rrtm_tlay(0,nzt_rad) & |
---|
2037 | - rrtm_tlay(0,nzt_rad-1) |
---|
2038 | DO k = nzt+9, nzt_rad+1 |
---|
2039 | rrtm_tlev(0,k) = rrtm_tlay(0,k-1) + (rrtm_tlay(0,k) & |
---|
2040 | - rrtm_tlay(0,k-1)) & |
---|
2041 | / ( rrtm_play(0,k) - rrtm_play(0,k-1) ) & |
---|
2042 | * ( rrtm_plev(0,k) - rrtm_play(0,k-1) ) |
---|
2043 | ENDDO |
---|
2044 | rrtm_h2ovmr(0,nzt_rad+1) = rrtm_h2ovmr(0,nzt_rad) |
---|
2045 | |
---|
2046 | rrtm_tlev(0,nzt_rad+2) = 2.0_wp * rrtm_tlay(0,nzt_rad+1) & |
---|
2047 | - rrtm_tlev(0,nzt_rad) |
---|
2048 | ! |
---|
2049 | !-- Allocate remaining RRTMG arrays |
---|
2050 | ALLOCATE ( rrtm_cicewp(0:0,nzb+1:nzt_rad+1) ) |
---|
2051 | ALLOCATE ( rrtm_cldfr(0:0,nzb+1:nzt_rad+1) ) |
---|
2052 | ALLOCATE ( rrtm_cliqwp(0:0,nzb+1:nzt_rad+1) ) |
---|
2053 | ALLOCATE ( rrtm_reice(0:0,nzb+1:nzt_rad+1) ) |
---|
2054 | ALLOCATE ( rrtm_reliq(0:0,nzb+1:nzt_rad+1) ) |
---|
2055 | ALLOCATE ( rrtm_lw_taucld(1:nbndlw+1,0:0,nzb+1:nzt_rad+1) ) |
---|
2056 | ALLOCATE ( rrtm_lw_tauaer(0:0,nzb+1:nzt_rad+1,1:nbndlw+1) ) |
---|
2057 | ALLOCATE ( rrtm_sw_taucld(1:nbndsw+1,0:0,nzb+1:nzt_rad+1) ) |
---|
2058 | ALLOCATE ( rrtm_sw_ssacld(1:nbndsw+1,0:0,nzb+1:nzt_rad+1) ) |
---|
2059 | ALLOCATE ( rrtm_sw_asmcld(1:nbndsw+1,0:0,nzb+1:nzt_rad+1) ) |
---|
2060 | ALLOCATE ( rrtm_sw_fsfcld(1:nbndsw+1,0:0,nzb+1:nzt_rad+1) ) |
---|
2061 | ALLOCATE ( rrtm_sw_tauaer(0:0,nzb+1:nzt_rad+1,1:nbndsw+1) ) |
---|
2062 | ALLOCATE ( rrtm_sw_ssaaer(0:0,nzb+1:nzt_rad+1,1:nbndsw+1) ) |
---|
2063 | ALLOCATE ( rrtm_sw_asmaer(0:0,nzb+1:nzt_rad+1,1:nbndsw+1) ) |
---|
2064 | ALLOCATE ( rrtm_sw_ecaer(0:0,nzb+1:nzt_rad+1,1:naerec+1) ) |
---|
2065 | |
---|
2066 | ! |
---|
2067 | !-- The ice phase is currently not considered in PALM |
---|
2068 | rrtm_cicewp = 0.0_wp |
---|
2069 | rrtm_reice = 0.0_wp |
---|
2070 | |
---|
2071 | ! |
---|
2072 | !-- Set other parameters (move to NAMELIST parameters in the future) |
---|
2073 | rrtm_lw_tauaer = 0.0_wp |
---|
2074 | rrtm_lw_taucld = 0.0_wp |
---|
2075 | rrtm_sw_taucld = 0.0_wp |
---|
2076 | rrtm_sw_ssacld = 0.0_wp |
---|
2077 | rrtm_sw_asmcld = 0.0_wp |
---|
2078 | rrtm_sw_fsfcld = 0.0_wp |
---|
2079 | rrtm_sw_tauaer = 0.0_wp |
---|
2080 | rrtm_sw_ssaaer = 0.0_wp |
---|
2081 | rrtm_sw_asmaer = 0.0_wp |
---|
2082 | rrtm_sw_ecaer = 0.0_wp |
---|
2083 | |
---|
2084 | |
---|
2085 | ALLOCATE ( rrtm_swdflx(0:0,nzb:nzt_rad+1) ) |
---|
2086 | ALLOCATE ( rrtm_swuflx(0:0,nzb:nzt_rad+1) ) |
---|
2087 | ALLOCATE ( rrtm_swhr(0:0,nzb+1:nzt_rad+1) ) |
---|
2088 | ALLOCATE ( rrtm_swuflxc(0:0,nzb:nzt_rad+1) ) |
---|
2089 | ALLOCATE ( rrtm_swdflxc(0:0,nzb:nzt_rad+1) ) |
---|
2090 | ALLOCATE ( rrtm_swhrc(0:0,nzb+1:nzt_rad+1) ) |
---|
2091 | |
---|
2092 | rrtm_swdflx = 0.0_wp |
---|
2093 | rrtm_swuflx = 0.0_wp |
---|
2094 | rrtm_swhr = 0.0_wp |
---|
2095 | rrtm_swuflxc = 0.0_wp |
---|
2096 | rrtm_swdflxc = 0.0_wp |
---|
2097 | rrtm_swhrc = 0.0_wp |
---|
2098 | |
---|
2099 | ALLOCATE ( rrtm_lwdflx(0:0,nzb:nzt_rad+1) ) |
---|
2100 | ALLOCATE ( rrtm_lwuflx(0:0,nzb:nzt_rad+1) ) |
---|
2101 | ALLOCATE ( rrtm_lwhr(0:0,nzb+1:nzt_rad+1) ) |
---|
2102 | ALLOCATE ( rrtm_lwuflxc(0:0,nzb:nzt_rad+1) ) |
---|
2103 | ALLOCATE ( rrtm_lwdflxc(0:0,nzb:nzt_rad+1) ) |
---|
2104 | ALLOCATE ( rrtm_lwhrc(0:0,nzb+1:nzt_rad+1) ) |
---|
2105 | |
---|
2106 | rrtm_lwdflx = 0.0_wp |
---|
2107 | rrtm_lwuflx = 0.0_wp |
---|
2108 | rrtm_lwhr = 0.0_wp |
---|
2109 | rrtm_lwuflxc = 0.0_wp |
---|
2110 | rrtm_lwdflxc = 0.0_wp |
---|
2111 | rrtm_lwhrc = 0.0_wp |
---|
2112 | |
---|
2113 | ALLOCATE ( rrtm_lwuflx_dt(0:0,nzb:nzt_rad+1) ) |
---|
2114 | ALLOCATE ( rrtm_lwuflxc_dt(0:0,nzb:nzt_rad+1) ) |
---|
2115 | |
---|
2116 | rrtm_lwuflx_dt = 0.0_wp |
---|
2117 | rrtm_lwuflxc_dt = 0.0_wp |
---|
2118 | |
---|
2119 | END SUBROUTINE read_sounding_data |
---|
2120 | |
---|
2121 | |
---|
2122 | !------------------------------------------------------------------------------! |
---|
2123 | ! Description: |
---|
2124 | ! ------------ |
---|
2125 | !> Read trace gas data from file |
---|
2126 | !------------------------------------------------------------------------------! |
---|
2127 | SUBROUTINE read_trace_gas_data |
---|
2128 | |
---|
2129 | USE rrsw_ncpar |
---|
2130 | |
---|
2131 | IMPLICIT NONE |
---|
2132 | |
---|
2133 | INTEGER(iwp), PARAMETER :: num_trace_gases = 9 !< number of trace gases (absorbers) |
---|
2134 | |
---|
2135 | CHARACTER(LEN=5), DIMENSION(num_trace_gases), PARAMETER :: & !< trace gas names |
---|
2136 | trace_names = (/'O3 ', 'CO2 ', 'CH4 ', 'N2O ', 'O2 ', & |
---|
2137 | 'CFC11', 'CFC12', 'CFC22', 'CCL4 '/) |
---|
2138 | |
---|
2139 | INTEGER(iwp) :: id, & !< NetCDF id |
---|
2140 | k, & !< loop index |
---|
2141 | m, & !< loop index |
---|
2142 | n, & !< loop index |
---|
2143 | nabs, & !< number of absorbers |
---|
2144 | np, & !< number of pressure levels |
---|
2145 | id_abs, & !< NetCDF id of the respective absorber |
---|
2146 | id_dim, & !< NetCDF id of asborber's dimension |
---|
2147 | id_var !< NetCDf id ot the absorber |
---|
2148 | |
---|
2149 | REAL(wp) :: p_mls_l, p_mls_u, p_wgt_l, p_wgt_u, p_mls_m |
---|
2150 | |
---|
2151 | |
---|
2152 | REAL(wp), DIMENSION(:), ALLOCATABLE :: p_mls, & !< pressure levels for the absorbers |
---|
2153 | rrtm_play_tmp, & !< temporary array for pressure zu-levels |
---|
2154 | rrtm_plev_tmp, & !< temporary array for pressure zw-levels |
---|
2155 | trace_path_tmp !< temporary array for storing trace gas path data |
---|
2156 | |
---|
2157 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: trace_mls, & !< array for storing the absorber amounts |
---|
2158 | trace_mls_path, & !< array for storing trace gas path data |
---|
2159 | trace_mls_tmp !< temporary array for storing trace gas data |
---|
2160 | |
---|
2161 | |
---|
2162 | ! |
---|
2163 | !-- In case of updates, deallocate arrays first (sufficient to check one |
---|
2164 | !-- array as the others are automatically allocated) |
---|
2165 | IF ( ALLOCATED ( rrtm_o3vmr ) ) THEN |
---|
2166 | DEALLOCATE ( rrtm_o3vmr ) |
---|
2167 | DEALLOCATE ( rrtm_co2vmr ) |
---|
2168 | DEALLOCATE ( rrtm_ch4vmr ) |
---|
2169 | DEALLOCATE ( rrtm_n2ovmr ) |
---|
2170 | DEALLOCATE ( rrtm_o2vmr ) |
---|
2171 | DEALLOCATE ( rrtm_cfc11vmr ) |
---|
2172 | DEALLOCATE ( rrtm_cfc12vmr ) |
---|
2173 | DEALLOCATE ( rrtm_cfc22vmr ) |
---|
2174 | DEALLOCATE ( rrtm_ccl4vmr ) |
---|
2175 | ENDIF |
---|
2176 | |
---|
2177 | ! |
---|
2178 | !-- Allocate trace gas profiles |
---|
2179 | ALLOCATE ( rrtm_o3vmr(0:0,1:nzt_rad+1) ) |
---|
2180 | ALLOCATE ( rrtm_co2vmr(0:0,1:nzt_rad+1) ) |
---|
2181 | ALLOCATE ( rrtm_ch4vmr(0:0,1:nzt_rad+1) ) |
---|
2182 | ALLOCATE ( rrtm_n2ovmr(0:0,1:nzt_rad+1) ) |
---|
2183 | ALLOCATE ( rrtm_o2vmr(0:0,1:nzt_rad+1) ) |
---|
2184 | ALLOCATE ( rrtm_cfc11vmr(0:0,1:nzt_rad+1) ) |
---|
2185 | ALLOCATE ( rrtm_cfc12vmr(0:0,1:nzt_rad+1) ) |
---|
2186 | ALLOCATE ( rrtm_cfc22vmr(0:0,1:nzt_rad+1) ) |
---|
2187 | ALLOCATE ( rrtm_ccl4vmr(0:0,1:nzt_rad+1) ) |
---|
2188 | |
---|
2189 | ! |
---|
2190 | !-- Open file for reading |
---|
2191 | nc_stat = NF90_OPEN( rrtm_input_file, NF90_NOWRITE, id ) |
---|
2192 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 549 ) |
---|
2193 | ! |
---|
2194 | !-- Inquire dimension ids and dimensions |
---|
2195 | nc_stat = NF90_INQ_DIMID( id, "Pressure", id_dim ) |
---|
2196 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) |
---|
2197 | nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim, len = np) |
---|
2198 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) |
---|
2199 | |
---|
2200 | nc_stat = NF90_INQ_DIMID( id, "Absorber", id_dim ) |
---|
2201 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) |
---|
2202 | nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim, len = nabs ) |
---|
2203 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) |
---|
2204 | |
---|
2205 | |
---|
2206 | ! |
---|
2207 | !-- Allocate pressure, and trace gas arrays |
---|
2208 | ALLOCATE( p_mls(1:np) ) |
---|
2209 | ALLOCATE( trace_mls(1:num_trace_gases,1:np) ) |
---|
2210 | ALLOCATE( trace_mls_tmp(1:nabs,1:np) ) |
---|
2211 | |
---|
2212 | |
---|
2213 | nc_stat = NF90_INQ_VARID( id, "Pressure", id_var ) |
---|
2214 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) |
---|
2215 | nc_stat = NF90_GET_VAR( id, id_var, p_mls ) |
---|
2216 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) |
---|
2217 | |
---|
2218 | nc_stat = NF90_INQ_VARID( id, "AbsorberAmountMLS", id_var ) |
---|
2219 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) |
---|
2220 | nc_stat = NF90_GET_VAR( id, id_var, trace_mls_tmp ) |
---|
2221 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) |
---|
2222 | |
---|
2223 | |
---|
2224 | ! |
---|
2225 | !-- Write absorber amounts (mls) to trace_mls |
---|
2226 | DO n = 1, num_trace_gases |
---|
2227 | CALL getAbsorberIndex( TRIM( trace_names(n) ), id_abs ) |
---|
2228 | |
---|
2229 | trace_mls(n,1:np) = trace_mls_tmp(id_abs,1:np) |
---|
2230 | |
---|
2231 | ! |
---|
2232 | !-- Replace missing values by zero |
---|
2233 | WHERE ( trace_mls(n,:) > 2.0_wp ) |
---|
2234 | trace_mls(n,:) = 0.0_wp |
---|
2235 | END WHERE |
---|
2236 | END DO |
---|
2237 | |
---|
2238 | DEALLOCATE ( trace_mls_tmp ) |
---|
2239 | |
---|
2240 | nc_stat = NF90_CLOSE( id ) |
---|
2241 | CALL netcdf_handle_error_rad( 'read_trace_gas_data', 551 ) |
---|
2242 | |
---|
2243 | ! |
---|
2244 | !-- Add extra pressure level for calculations of the trace gas paths |
---|
2245 | ALLOCATE ( rrtm_play_tmp(1:nzt_rad+1) ) |
---|
2246 | ALLOCATE ( rrtm_plev_tmp(1:nzt_rad+2) ) |
---|
2247 | |
---|
2248 | rrtm_play_tmp(1:nzt_rad) = rrtm_play(0,1:nzt_rad) |
---|
2249 | rrtm_plev_tmp(1:nzt_rad+1) = rrtm_plev(0,1:nzt_rad+1) |
---|
2250 | rrtm_play_tmp(nzt_rad+1) = rrtm_plev(0,nzt_rad+1) * 0.5_wp |
---|
2251 | rrtm_plev_tmp(nzt_rad+2) = MIN( 1.0E-4_wp, 0.25_wp & |
---|
2252 | * rrtm_plev(0,nzt_rad+1) ) |
---|
2253 | |
---|
2254 | ! |
---|
2255 | !-- Calculate trace gas path (zero at surface) with interpolation to the |
---|
2256 | !-- sounding levels |
---|
2257 | ALLOCATE ( trace_mls_path(1:nzt_rad+2,1:num_trace_gases) ) |
---|
2258 | |
---|
2259 | trace_mls_path(nzb+1,:) = 0.0_wp |
---|
2260 | |
---|
2261 | DO k = nzb+2, nzt_rad+2 |
---|
2262 | DO m = 1, num_trace_gases |
---|
2263 | trace_mls_path(k,m) = trace_mls_path(k-1,m) |
---|
2264 | |
---|
2265 | ! |
---|
2266 | !-- When the pressure level is higher than the trace gas pressure |
---|
2267 | !-- level, assume that |
---|
2268 | IF ( rrtm_plev_tmp(k-1) > p_mls(1) ) THEN |
---|
2269 | |
---|
2270 | trace_mls_path(k,m) = trace_mls_path(k,m) + trace_mls(m,1) & |
---|
2271 | * ( rrtm_plev_tmp(k-1) & |
---|
2272 | - MAX( p_mls(1), rrtm_plev_tmp(k) ) & |
---|
2273 | ) / g |
---|
2274 | ENDIF |
---|
2275 | |
---|
2276 | ! |
---|
2277 | !-- Integrate for each sounding level from the contributing p_mls |
---|
2278 | !-- levels |
---|
2279 | DO n = 2, np |
---|
2280 | ! |
---|
2281 | !-- Limit p_mls so that it is within the model level |
---|
2282 | p_mls_u = MIN( rrtm_plev_tmp(k-1), & |
---|
2283 | MAX( rrtm_plev_tmp(k), p_mls(n) ) ) |
---|
2284 | p_mls_l = MIN( rrtm_plev_tmp(k-1), & |
---|
2285 | MAX( rrtm_plev_tmp(k), p_mls(n-1) ) ) |
---|
2286 | |
---|
2287 | IF ( p_mls_l > p_mls_u ) THEN |
---|
2288 | |
---|
2289 | ! |
---|
2290 | !-- Calculate weights for interpolation |
---|
2291 | p_mls_m = 0.5_wp * (p_mls_l + p_mls_u) |
---|
2292 | p_wgt_u = (p_mls(n-1) - p_mls_m) / (p_mls(n-1) - p_mls(n)) |
---|
2293 | p_wgt_l = (p_mls_m - p_mls(n)) / (p_mls(n-1) - p_mls(n)) |
---|
2294 | |
---|
2295 | ! |
---|
2296 | !-- Add level to trace gas path |
---|
2297 | trace_mls_path(k,m) = trace_mls_path(k,m) & |
---|
2298 | + ( p_wgt_u * trace_mls(m,n) & |
---|
2299 | + p_wgt_l * trace_mls(m,n-1) ) & |
---|
2300 | * (p_mls_l - p_mls_u) / g |
---|
2301 | ENDIF |
---|
2302 | ENDDO |
---|
2303 | |
---|
2304 | IF ( rrtm_plev_tmp(k) < p_mls(np) ) THEN |
---|
2305 | trace_mls_path(k,m) = trace_mls_path(k,m) + trace_mls(m,np) & |
---|
2306 | * ( MIN( rrtm_plev_tmp(k-1), p_mls(np) ) & |
---|
2307 | - rrtm_plev_tmp(k) & |
---|
2308 | ) / g |
---|
2309 | ENDIF |
---|
2310 | ENDDO |
---|
2311 | ENDDO |
---|
2312 | |
---|
2313 | |
---|
2314 | ! |
---|
2315 | !-- Prepare trace gas path profiles |
---|
2316 | ALLOCATE ( trace_path_tmp(1:nzt_rad+1) ) |
---|
2317 | |
---|
2318 | DO m = 1, num_trace_gases |
---|
2319 | |
---|
2320 | trace_path_tmp(1:nzt_rad+1) = ( trace_mls_path(2:nzt_rad+2,m) & |
---|
2321 | - trace_mls_path(1:nzt_rad+1,m) ) * g & |
---|
2322 | / ( rrtm_plev_tmp(1:nzt_rad+1) & |
---|
2323 | - rrtm_plev_tmp(2:nzt_rad+2) ) |
---|
2324 | |
---|
2325 | ! |
---|
2326 | !-- Save trace gas paths to the respective arrays |
---|
2327 | SELECT CASE ( TRIM( trace_names(m) ) ) |
---|
2328 | |
---|
2329 | CASE ( 'O3' ) |
---|
2330 | |
---|
2331 | rrtm_o3vmr(0,:) = trace_path_tmp(:) |
---|
2332 | |
---|
2333 | CASE ( 'CO2' ) |
---|
2334 | |
---|
2335 | rrtm_co2vmr(0,:) = trace_path_tmp(:) |
---|
2336 | |
---|
2337 | CASE ( 'CH4' ) |
---|
2338 | |
---|
2339 | rrtm_ch4vmr(0,:) = trace_path_tmp(:) |
---|
2340 | |
---|
2341 | CASE ( 'N2O' ) |
---|
2342 | |
---|
2343 | rrtm_n2ovmr(0,:) = trace_path_tmp(:) |
---|
2344 | |
---|
2345 | CASE ( 'O2' ) |
---|
2346 | |
---|
2347 | rrtm_o2vmr(0,:) = trace_path_tmp(:) |
---|
2348 | |
---|
2349 | CASE ( 'CFC11' ) |
---|
2350 | |
---|
2351 | rrtm_cfc11vmr(0,:) = trace_path_tmp(:) |
---|
2352 | |
---|
2353 | CASE ( 'CFC12' ) |
---|
2354 | |
---|
2355 | rrtm_cfc12vmr(0,:) = trace_path_tmp(:) |
---|
2356 | |
---|
2357 | CASE ( 'CFC22' ) |
---|
2358 | |
---|
2359 | rrtm_cfc22vmr(0,:) = trace_path_tmp(:) |
---|
2360 | |
---|
2361 | CASE ( 'CCL4' ) |
---|
2362 | |
---|
2363 | rrtm_ccl4vmr(0,:) = trace_path_tmp(:) |
---|
2364 | |
---|
2365 | CASE DEFAULT |
---|
2366 | |
---|
2367 | END SELECT |
---|
2368 | |
---|
2369 | ENDDO |
---|
2370 | |
---|
2371 | DEALLOCATE ( trace_path_tmp ) |
---|
2372 | DEALLOCATE ( trace_mls_path ) |
---|
2373 | DEALLOCATE ( rrtm_play_tmp ) |
---|
2374 | DEALLOCATE ( rrtm_plev_tmp ) |
---|
2375 | DEALLOCATE ( trace_mls ) |
---|
2376 | DEALLOCATE ( p_mls ) |
---|
2377 | |
---|
2378 | END SUBROUTINE read_trace_gas_data |
---|
2379 | |
---|
2380 | |
---|
2381 | SUBROUTINE netcdf_handle_error_rad( routine_name, errno ) |
---|
2382 | |
---|
2383 | USE control_parameters, & |
---|
2384 | ONLY: message_string |
---|
2385 | |
---|
2386 | USE NETCDF |
---|
2387 | |
---|
2388 | USE pegrid |
---|
2389 | |
---|
2390 | IMPLICIT NONE |
---|
2391 | |
---|
2392 | CHARACTER(LEN=6) :: message_identifier |
---|
2393 | CHARACTER(LEN=*) :: routine_name |
---|
2394 | |
---|
2395 | INTEGER(iwp) :: errno |
---|
2396 | |
---|
2397 | IF ( nc_stat /= NF90_NOERR ) THEN |
---|
2398 | |
---|
2399 | WRITE( message_identifier, '(''NC'',I4.4)' ) errno |
---|
2400 | message_string = TRIM( NF90_STRERROR( nc_stat ) ) |
---|
2401 | |
---|
2402 | CALL message( routine_name, message_identifier, 2, 2, 0, 6, 1 ) |
---|
2403 | |
---|
2404 | ENDIF |
---|
2405 | |
---|
2406 | END SUBROUTINE netcdf_handle_error_rad |
---|
2407 | #endif |
---|
2408 | |
---|
2409 | |
---|
2410 | !------------------------------------------------------------------------------! |
---|
2411 | ! Description: |
---|
2412 | ! ------------ |
---|
2413 | !> Calculate temperature tendency due to radiative cooling/heating. |
---|
2414 | !> Cache-optimized version. |
---|
2415 | !------------------------------------------------------------------------------! |
---|
2416 | SUBROUTINE radiation_tendency_ij ( i, j, tend ) |
---|
2417 | |
---|
2418 | USE cloud_parameters, & |
---|
2419 | ONLY: pt_d_t |
---|
2420 | |
---|
2421 | IMPLICIT NONE |
---|
2422 | |
---|
2423 | INTEGER(iwp) :: i, j, k !< loop indices |
---|
2424 | |
---|
2425 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: tend !< pt tendency term |
---|
2426 | |
---|
2427 | IF ( radiation_scheme == 'rrtmg' ) THEN |
---|
2428 | #if defined ( __rrtmg ) |
---|
2429 | ! |
---|
2430 | !-- Calculate tendency based on heating rate |
---|
2431 | DO k = nzb+1, nzt+1 |
---|
2432 | tend(k,j,i) = tend(k,j,i) + (rad_lw_hr(k,j,i) + rad_sw_hr(k,j,i)) & |
---|
2433 | * pt_d_t(k) * d_seconds_hour |
---|
2434 | ENDDO |
---|
2435 | #endif |
---|
2436 | ENDIF |
---|
2437 | |
---|
2438 | END SUBROUTINE radiation_tendency_ij |
---|
2439 | |
---|
2440 | |
---|
2441 | !------------------------------------------------------------------------------! |
---|
2442 | ! Description: |
---|
2443 | ! ------------ |
---|
2444 | !> Calculate temperature tendency due to radiative cooling/heating. |
---|
2445 | !> Vector-optimized version |
---|
2446 | !------------------------------------------------------------------------------! |
---|
2447 | SUBROUTINE radiation_tendency ( tend ) |
---|
2448 | |
---|
2449 | USE cloud_parameters, & |
---|
2450 | ONLY: pt_d_t |
---|
2451 | |
---|
2452 | USE indices, & |
---|
2453 | ONLY: nxl, nxr, nyn, nys |
---|
2454 | |
---|
2455 | IMPLICIT NONE |
---|
2456 | |
---|
2457 | INTEGER(iwp) :: i, j, k !< loop indices |
---|
2458 | |
---|
2459 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: tend !< pt tendency term |
---|
2460 | |
---|
2461 | IF ( radiation_scheme == 'rrtmg' ) THEN |
---|
2462 | #if defined ( __rrtmg ) |
---|
2463 | ! |
---|
2464 | !-- Calculate tendency based on heating rate |
---|
2465 | DO i = nxl, nxr |
---|
2466 | DO j = nys, nyn |
---|
2467 | DO k = nzb+1, nzt+1 |
---|
2468 | tend(k,j,i) = tend(k,j,i) + ( rad_lw_hr(k,j,i) & |
---|
2469 | + rad_sw_hr(k,j,i) ) * pt_d_t(k) & |
---|
2470 | * d_seconds_hour |
---|
2471 | ENDDO |
---|
2472 | ENDDO |
---|
2473 | ENDDO |
---|
2474 | #endif |
---|
2475 | ENDIF |
---|
2476 | |
---|
2477 | |
---|
2478 | END SUBROUTINE radiation_tendency |
---|
2479 | |
---|
2480 | !------------------------------------------------------------------------------! |
---|
2481 | ! |
---|
2482 | ! Description: |
---|
2483 | ! ------------ |
---|
2484 | !> Subroutine for averaging 3D data |
---|
2485 | !------------------------------------------------------------------------------! |
---|
2486 | SUBROUTINE radiation_3d_data_averaging( mode, variable ) |
---|
2487 | |
---|
2488 | |
---|
2489 | USE control_parameters |
---|
2490 | |
---|
2491 | USE indices |
---|
2492 | |
---|
2493 | USE kinds |
---|
2494 | |
---|
2495 | IMPLICIT NONE |
---|
2496 | |
---|
2497 | CHARACTER (LEN=*) :: mode !< |
---|
2498 | CHARACTER (LEN=*) :: variable !< |
---|
2499 | |
---|
2500 | INTEGER(iwp) :: i !< |
---|
2501 | INTEGER(iwp) :: j !< |
---|
2502 | INTEGER(iwp) :: k !< |
---|
2503 | |
---|
2504 | IF ( mode == 'allocate' ) THEN |
---|
2505 | |
---|
2506 | SELECT CASE ( TRIM( variable ) ) |
---|
2507 | |
---|
2508 | CASE ( 'rad_net*' ) |
---|
2509 | IF ( .NOT. ALLOCATED( rad_net_av ) ) THEN |
---|
2510 | ALLOCATE( rad_net_av(nysg:nyng,nxlg:nxrg) ) |
---|
2511 | ENDIF |
---|
2512 | rad_net_av = 0.0_wp |
---|
2513 | |
---|
2514 | CASE ( 'rad_lw_in' ) |
---|
2515 | IF ( .NOT. ALLOCATED( rad_lw_in_av ) ) THEN |
---|
2516 | ALLOCATE( rad_lw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
2517 | ENDIF |
---|
2518 | rad_lw_in_av = 0.0_wp |
---|
2519 | |
---|
2520 | CASE ( 'rad_lw_out' ) |
---|
2521 | IF ( .NOT. ALLOCATED( rad_lw_out_av ) ) THEN |
---|
2522 | ALLOCATE( rad_lw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
2523 | ENDIF |
---|
2524 | rad_lw_out_av = 0.0_wp |
---|
2525 | |
---|
2526 | CASE ( 'rad_lw_cs_hr' ) |
---|
2527 | IF ( .NOT. ALLOCATED( rad_lw_cs_hr_av ) ) THEN |
---|
2528 | ALLOCATE( rad_lw_cs_hr_av(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
2529 | ENDIF |
---|
2530 | rad_lw_cs_hr_av = 0.0_wp |
---|
2531 | |
---|
2532 | CASE ( 'rad_lw_hr' ) |
---|
2533 | IF ( .NOT. ALLOCATED( rad_lw_hr_av ) ) THEN |
---|
2534 | ALLOCATE( rad_lw_hr_av(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
2535 | ENDIF |
---|
2536 | rad_lw_hr_av = 0.0_wp |
---|
2537 | |
---|
2538 | CASE ( 'rad_sw_in' ) |
---|
2539 | IF ( .NOT. ALLOCATED( rad_sw_in_av ) ) THEN |
---|
2540 | ALLOCATE( rad_sw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
2541 | ENDIF |
---|
2542 | rad_sw_in_av = 0.0_wp |
---|
2543 | |
---|
2544 | CASE ( 'rad_sw_out' ) |
---|
2545 | IF ( .NOT. ALLOCATED( rad_sw_out_av ) ) THEN |
---|
2546 | ALLOCATE( rad_sw_out_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
2547 | ENDIF |
---|
2548 | rad_sw_out_av = 0.0_wp |
---|
2549 | |
---|
2550 | CASE ( 'rad_sw_cs_hr' ) |
---|
2551 | IF ( .NOT. ALLOCATED( rad_sw_cs_hr_av ) ) THEN |
---|
2552 | ALLOCATE( rad_sw_cs_hr_av(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
2553 | ENDIF |
---|
2554 | rad_sw_cs_hr_av = 0.0_wp |
---|
2555 | |
---|
2556 | CASE ( 'rad_sw_hr' ) |
---|
2557 | IF ( .NOT. ALLOCATED( rad_sw_hr_av ) ) THEN |
---|
2558 | ALLOCATE( rad_sw_hr_av(nzb+1:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
2559 | ENDIF |
---|
2560 | rad_sw_hr_av = 0.0_wp |
---|
2561 | |
---|
2562 | CASE DEFAULT |
---|
2563 | CONTINUE |
---|
2564 | |
---|
2565 | END SELECT |
---|
2566 | |
---|
2567 | ELSEIF ( mode == 'sum' ) THEN |
---|
2568 | |
---|
2569 | SELECT CASE ( TRIM( variable ) ) |
---|
2570 | |
---|
2571 | CASE ( 'rad_net*' ) |
---|
2572 | DO i = nxlg, nxrg |
---|
2573 | DO j = nysg, nyng |
---|
2574 | rad_net_av(j,i) = rad_net_av(j,i) + rad_net(j,i) |
---|
2575 | ENDDO |
---|
2576 | ENDDO |
---|
2577 | |
---|
2578 | CASE ( 'rad_lw_in' ) |
---|
2579 | DO i = nxlg, nxrg |
---|
2580 | DO j = nysg, nyng |
---|
2581 | DO k = nzb, nzt+1 |
---|
2582 | rad_lw_in_av(k,j,i) = rad_lw_in_av(k,j,i) + rad_lw_in(k,j,i) |
---|
2583 | ENDDO |
---|
2584 | ENDDO |
---|
2585 | ENDDO |
---|
2586 | |
---|
2587 | CASE ( 'rad_lw_out' ) |
---|
2588 | DO i = nxlg, nxrg |
---|
2589 | DO j = nysg, nyng |
---|
2590 | DO k = nzb, nzt+1 |
---|
2591 | rad_lw_out_av(k,j,i) = rad_lw_out_av(k,j,i) & |
---|
2592 | + rad_lw_out(k,j,i) |
---|
2593 | ENDDO |
---|
2594 | ENDDO |
---|
2595 | ENDDO |
---|
2596 | |
---|
2597 | CASE ( 'rad_lw_cs_hr' ) |
---|
2598 | DO i = nxlg, nxrg |
---|
2599 | DO j = nysg, nyng |
---|
2600 | DO k = nzb, nzt+1 |
---|
2601 | rad_lw_cs_hr_av(k,j,i) = rad_lw_cs_hr_av(k,j,i) & |
---|
2602 | + rad_lw_cs_hr(k,j,i) |
---|
2603 | ENDDO |
---|
2604 | ENDDO |
---|
2605 | ENDDO |
---|
2606 | |
---|
2607 | CASE ( 'rad_lw_hr' ) |
---|
2608 | DO i = nxlg, nxrg |
---|
2609 | DO j = nysg, nyng |
---|
2610 | DO k = nzb, nzt+1 |
---|
2611 | rad_lw_hr_av(k,j,i) = rad_lw_hr_av(k,j,i) & |
---|
2612 | + rad_lw_hr(k,j,i) |
---|
2613 | ENDDO |
---|
2614 | ENDDO |
---|
2615 | ENDDO |
---|
2616 | |
---|
2617 | CASE ( 'rad_sw_in' ) |
---|
2618 | DO i = nxlg, nxrg |
---|
2619 | DO j = nysg, nyng |
---|
2620 | DO k = nzb, nzt+1 |
---|
2621 | rad_sw_in_av(k,j,i) = rad_sw_in_av(k,j,i) & |
---|
2622 | + rad_sw_in(k,j,i) |
---|
2623 | ENDDO |
---|
2624 | ENDDO |
---|
2625 | ENDDO |
---|
2626 | |
---|
2627 | CASE ( 'rad_sw_out' ) |
---|
2628 | DO i = nxlg, nxrg |
---|
2629 | DO j = nysg, nyng |
---|
2630 | DO k = nzb, nzt+1 |
---|
2631 | rad_sw_out_av(k,j,i) = rad_sw_out_av(k,j,i) & |
---|
2632 | + rad_sw_out(k,j,i) |
---|
2633 | ENDDO |
---|
2634 | ENDDO |
---|
2635 | ENDDO |
---|
2636 | |
---|
2637 | CASE ( 'rad_sw_cs_hr' ) |
---|
2638 | DO i = nxlg, nxrg |
---|
2639 | DO j = nysg, nyng |
---|
2640 | DO k = nzb, nzt+1 |
---|
2641 | rad_sw_cs_hr_av(k,j,i) = rad_sw_cs_hr_av(k,j,i) & |
---|
2642 | + rad_sw_cs_hr(k,j,i) |
---|
2643 | ENDDO |
---|
2644 | ENDDO |
---|
2645 | ENDDO |
---|
2646 | |
---|
2647 | CASE ( 'rad_sw_hr' ) |
---|
2648 | DO i = nxlg, nxrg |
---|
2649 | DO j = nysg, nyng |
---|
2650 | DO k = nzb, nzt+1 |
---|
2651 | rad_sw_hr_av(k,j,i) = rad_sw_hr_av(k,j,i) & |
---|
2652 | + rad_sw_hr(k,j,i) |
---|
2653 | ENDDO |
---|
2654 | ENDDO |
---|
2655 | ENDDO |
---|
2656 | |
---|
2657 | CASE DEFAULT |
---|
2658 | CONTINUE |
---|
2659 | |
---|
2660 | END SELECT |
---|
2661 | |
---|
2662 | ELSEIF ( mode == 'average' ) THEN |
---|
2663 | |
---|
2664 | SELECT CASE ( TRIM( variable ) ) |
---|
2665 | |
---|
2666 | CASE ( 'rad_net*' ) |
---|
2667 | DO i = nxlg, nxrg |
---|
2668 | DO j = nysg, nyng |
---|
2669 | rad_net_av(j,i) = rad_net_av(j,i) / REAL( average_count_3d, & |
---|
2670 | KIND=wp ) |
---|
2671 | ENDDO |
---|
2672 | ENDDO |
---|
2673 | |
---|
2674 | CASE ( 'rad_lw_in' ) |
---|
2675 | DO i = nxlg, nxrg |
---|
2676 | DO j = nysg, nyng |
---|
2677 | DO k = nzb, nzt+1 |
---|
2678 | rad_lw_in_av(k,j,i) = rad_lw_in_av(k,j,i) & |
---|
2679 | / REAL( average_count_3d, KIND=wp ) |
---|
2680 | ENDDO |
---|
2681 | ENDDO |
---|
2682 | ENDDO |
---|
2683 | |
---|
2684 | CASE ( 'rad_lw_out' ) |
---|
2685 | DO i = nxlg, nxrg |
---|
2686 | DO j = nysg, nyng |
---|
2687 | DO k = nzb, nzt+1 |
---|
2688 | rad_lw_out_av(k,j,i) = rad_lw_out_av(k,j,i) & |
---|
2689 | / REAL( average_count_3d, KIND=wp ) |
---|
2690 | ENDDO |
---|
2691 | ENDDO |
---|
2692 | ENDDO |
---|
2693 | |
---|
2694 | CASE ( 'rad_lw_cs_hr' ) |
---|
2695 | DO i = nxlg, nxrg |
---|
2696 | DO j = nysg, nyng |
---|
2697 | DO k = nzb, nzt+1 |
---|
2698 | rad_lw_cs_hr_av(k,j,i) = rad_lw_cs_hr_av(k,j,i) & |
---|
2699 | / REAL( average_count_3d, KIND=wp ) |
---|
2700 | ENDDO |
---|
2701 | ENDDO |
---|
2702 | ENDDO |
---|
2703 | |
---|
2704 | CASE ( 'rad_lw_hr' ) |
---|
2705 | DO i = nxlg, nxrg |
---|
2706 | DO j = nysg, nyng |
---|
2707 | DO k = nzb, nzt+1 |
---|
2708 | rad_lw_hr_av(k,j,i) = rad_lw_hr_av(k,j,i) & |
---|
2709 | / REAL( average_count_3d, KIND=wp ) |
---|
2710 | ENDDO |
---|
2711 | ENDDO |
---|
2712 | ENDDO |
---|
2713 | |
---|
2714 | CASE ( 'rad_sw_in' ) |
---|
2715 | DO i = nxlg, nxrg |
---|
2716 | DO j = nysg, nyng |
---|
2717 | DO k = nzb, nzt+1 |
---|
2718 | rad_sw_in_av(k,j,i) = rad_sw_in_av(k,j,i) & |
---|
2719 | / REAL( average_count_3d, KIND=wp ) |
---|
2720 | ENDDO |
---|
2721 | ENDDO |
---|
2722 | ENDDO |
---|
2723 | |
---|
2724 | CASE ( 'rad_sw_out' ) |
---|
2725 | DO i = nxlg, nxrg |
---|
2726 | DO j = nysg, nyng |
---|
2727 | DO k = nzb, nzt+1 |
---|
2728 | rad_sw_out_av(k,j,i) = rad_sw_out_av(k,j,i) & |
---|
2729 | / REAL( average_count_3d, KIND=wp ) |
---|
2730 | ENDDO |
---|
2731 | ENDDO |
---|
2732 | ENDDO |
---|
2733 | |
---|
2734 | CASE ( 'rad_sw_cs_hr' ) |
---|
2735 | DO i = nxlg, nxrg |
---|
2736 | DO j = nysg, nyng |
---|
2737 | DO k = nzb, nzt+1 |
---|
2738 | rad_sw_cs_hr_av(k,j,i) = rad_sw_cs_hr_av(k,j,i) & |
---|
2739 | / REAL( average_count_3d, KIND=wp ) |
---|
2740 | ENDDO |
---|
2741 | ENDDO |
---|
2742 | ENDDO |
---|
2743 | |
---|
2744 | CASE ( 'rad_sw_hr' ) |
---|
2745 | DO i = nxlg, nxrg |
---|
2746 | DO j = nysg, nyng |
---|
2747 | DO k = nzb, nzt+1 |
---|
2748 | rad_sw_hr_av(k,j,i) = rad_sw_hr_av(k,j,i) & |
---|
2749 | / REAL( average_count_3d, KIND=wp ) |
---|
2750 | ENDDO |
---|
2751 | ENDDO |
---|
2752 | ENDDO |
---|
2753 | |
---|
2754 | END SELECT |
---|
2755 | |
---|
2756 | ENDIF |
---|
2757 | |
---|
2758 | END SUBROUTINE radiation_3d_data_averaging |
---|
2759 | |
---|
2760 | |
---|
2761 | !------------------------------------------------------------------------------! |
---|
2762 | ! |
---|
2763 | ! Description: |
---|
2764 | ! ------------ |
---|
2765 | !> Subroutine defining appropriate grid for netcdf variables. |
---|
2766 | !> It is called out from subroutine netcdf. |
---|
2767 | !------------------------------------------------------------------------------! |
---|
2768 | SUBROUTINE radiation_define_netcdf_grid( var, found, grid_x, grid_y, grid_z ) |
---|
2769 | |
---|
2770 | IMPLICIT NONE |
---|
2771 | |
---|
2772 | CHARACTER (LEN=*), INTENT(IN) :: var !< |
---|
2773 | LOGICAL, INTENT(OUT) :: found !< |
---|
2774 | CHARACTER (LEN=*), INTENT(OUT) :: grid_x !< |
---|
2775 | CHARACTER (LEN=*), INTENT(OUT) :: grid_y !< |
---|
2776 | CHARACTER (LEN=*), INTENT(OUT) :: grid_z !< |
---|
2777 | |
---|
2778 | found = .TRUE. |
---|
2779 | |
---|
2780 | |
---|
2781 | ! |
---|
2782 | !-- Check for the grid |
---|
2783 | SELECT CASE ( TRIM( var ) ) |
---|
2784 | |
---|
2785 | CASE ( 'rad_lw_cs_hr', 'rad_lw_hr', 'rad_sw_cs_hr', 'rad_sw_hr', & |
---|
2786 | 'rad_lw_cs_hr_xy', 'rad_lw_hr_xy', 'rad_sw_cs_hr_xy', & |
---|
2787 | 'rad_sw_hr_xy', 'rad_lw_cs_hr_xz', 'rad_lw_hr_xz', & |
---|
2788 | 'rad_sw_cs_hr_xz', 'rad_sw_hr_xz', 'rad_lw_cs_hr_yz', & |
---|
2789 | 'rad_lw_hr_yz', 'rad_sw_cs_hr_yz', 'rad_sw_hr_yz' ) |
---|
2790 | grid_x = 'x' |
---|
2791 | grid_y = 'y' |
---|
2792 | grid_z = 'zu' |
---|
2793 | |
---|
2794 | CASE ( 'rad_lw_in', 'rad_lw_out', 'rad_sw_in', 'rad_sw_out', & |
---|
2795 | 'rad_lw_in_xy', 'rad_lw_out_xy', 'rad_sw_in_xy','rad_sw_out_xy', & |
---|
2796 | 'rad_lw_in_xz', 'rad_lw_out_xz', 'rad_sw_in_xz','rad_sw_out_xz', & |
---|
2797 | 'rad_lw_in_yz', 'rad_lw_out_yz', 'rad_sw_in_yz','rad_sw_out_yz' ) |
---|
2798 | grid_x = 'x' |
---|
2799 | grid_y = 'y' |
---|
2800 | grid_z = 'zw' |
---|
2801 | |
---|
2802 | |
---|
2803 | CASE DEFAULT |
---|
2804 | found = .FALSE. |
---|
2805 | grid_x = 'none' |
---|
2806 | grid_y = 'none' |
---|
2807 | grid_z = 'none' |
---|
2808 | |
---|
2809 | END SELECT |
---|
2810 | |
---|
2811 | END SUBROUTINE radiation_define_netcdf_grid |
---|
2812 | |
---|
2813 | !------------------------------------------------------------------------------! |
---|
2814 | ! |
---|
2815 | ! Description: |
---|
2816 | ! ------------ |
---|
2817 | !> Subroutine defining 3D output variables |
---|
2818 | !------------------------------------------------------------------------------! |
---|
2819 | SUBROUTINE radiation_data_output_2d( av, variable, found, grid, mode, & |
---|
2820 | local_pf, two_d ) |
---|
2821 | |
---|
2822 | USE indices |
---|
2823 | |
---|
2824 | USE kinds |
---|
2825 | |
---|
2826 | |
---|
2827 | IMPLICIT NONE |
---|
2828 | |
---|
2829 | CHARACTER (LEN=*) :: grid !< |
---|
2830 | CHARACTER (LEN=*) :: mode !< |
---|
2831 | CHARACTER (LEN=*) :: variable !< |
---|
2832 | |
---|
2833 | INTEGER(iwp) :: av !< |
---|
2834 | INTEGER(iwp) :: i !< |
---|
2835 | INTEGER(iwp) :: j !< |
---|
2836 | INTEGER(iwp) :: k !< |
---|
2837 | |
---|
2838 | LOGICAL :: found !< |
---|
2839 | LOGICAL :: two_d !< flag parameter that indicates 2D variables (horizontal cross sections) |
---|
2840 | |
---|
2841 | REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) :: local_pf !< |
---|
2842 | |
---|
2843 | found = .TRUE. |
---|
2844 | |
---|
2845 | SELECT CASE ( TRIM( variable ) ) |
---|
2846 | |
---|
2847 | CASE ( 'rad_net*_xy' ) ! 2d-array |
---|
2848 | IF ( av == 0 ) THEN |
---|
2849 | DO i = nxl, nxr |
---|
2850 | DO j = nys, nyn |
---|
2851 | local_pf(i,j,nzb+1) = rad_net(j,i) |
---|
2852 | ENDDO |
---|
2853 | ENDDO |
---|
2854 | ELSE |
---|
2855 | DO i = nxl, nxr |
---|
2856 | DO j = nys, nyn |
---|
2857 | local_pf(i,j,nzb+1) = rad_net_av(j,i) |
---|
2858 | ENDDO |
---|
2859 | ENDDO |
---|
2860 | ENDIF |
---|
2861 | two_d = .TRUE. |
---|
2862 | grid = 'zu1' |
---|
2863 | |
---|
2864 | |
---|
2865 | CASE ( 'rad_lw_in_xy', 'rad_lw_in_xz', 'rad_lw_in_yz' ) |
---|
2866 | IF ( av == 0 ) THEN |
---|
2867 | DO i = nxl, nxr |
---|
2868 | DO j = nys, nyn |
---|
2869 | DO k = nzb, nzt+1 |
---|
2870 | local_pf(i,j,k) = rad_lw_in(k,j,i) |
---|
2871 | ENDDO |
---|
2872 | ENDDO |
---|
2873 | ENDDO |
---|
2874 | ELSE |
---|
2875 | DO i = nxl, nxr |
---|
2876 | DO j = nys, nyn |
---|
2877 | DO k = nzb, nzt+1 |
---|
2878 | local_pf(i,j,k) = rad_lw_in_av(k,j,i) |
---|
2879 | ENDDO |
---|
2880 | ENDDO |
---|
2881 | ENDDO |
---|
2882 | ENDIF |
---|
2883 | IF ( mode == 'xy' ) grid = 'zu' |
---|
2884 | |
---|
2885 | CASE ( 'rad_lw_out_xy', 'rad_lw_out_xz', 'rad_lw_out_yz' ) |
---|
2886 | IF ( av == 0 ) THEN |
---|
2887 | DO i = nxl, nxr |
---|
2888 | DO j = nys, nyn |
---|
2889 | DO k = nzb, nzt+1 |
---|
2890 | local_pf(i,j,k) = rad_lw_out(k,j,i) |
---|
2891 | ENDDO |
---|
2892 | ENDDO |
---|
2893 | ENDDO |
---|
2894 | ELSE |
---|
2895 | DO i = nxl, nxr |
---|
2896 | DO j = nys, nyn |
---|
2897 | DO k = nzb, nzt+1 |
---|
2898 | local_pf(i,j,k) = rad_lw_out_av(k,j,i) |
---|
2899 | ENDDO |
---|
2900 | ENDDO |
---|
2901 | ENDDO |
---|
2902 | ENDIF |
---|
2903 | IF ( mode == 'xy' ) grid = 'zu' |
---|
2904 | |
---|
2905 | CASE ( 'rad_lw_cs_hr_xy', 'rad_lw_cs_hr_xz', 'rad_lw_cs_hr_yz' ) |
---|
2906 | IF ( av == 0 ) THEN |
---|
2907 | DO i = nxl, nxr |
---|
2908 | DO j = nys, nyn |
---|
2909 | DO k = nzb, nzt+1 |
---|
2910 | local_pf(i,j,k) = rad_lw_cs_hr(k,j,i) |
---|
2911 | ENDDO |
---|
2912 | ENDDO |
---|
2913 | ENDDO |
---|
2914 | ELSE |
---|
2915 | DO i = nxl, nxr |
---|
2916 | DO j = nys, nyn |
---|
2917 | DO k = nzb, nzt+1 |
---|
2918 | local_pf(i,j,k) = rad_lw_cs_hr_av(k,j,i) |
---|
2919 | ENDDO |
---|
2920 | ENDDO |
---|
2921 | ENDDO |
---|
2922 | ENDIF |
---|
2923 | IF ( mode == 'xy' ) grid = 'zw' |
---|
2924 | |
---|
2925 | CASE ( 'rad_lw_hr_xy', 'rad_lw_hr_xz', 'rad_lw_hr_yz' ) |
---|
2926 | IF ( av == 0 ) THEN |
---|
2927 | DO i = nxl, nxr |
---|
2928 | DO j = nys, nyn |
---|
2929 | DO k = nzb, nzt+1 |
---|
2930 | local_pf(i,j,k) = rad_lw_hr(k,j,i) |
---|
2931 | ENDDO |
---|
2932 | ENDDO |
---|
2933 | ENDDO |
---|
2934 | ELSE |
---|
2935 | DO i = nxl, nxr |
---|
2936 | DO j = nys, nyn |
---|
2937 | DO k = nzb, nzt+1 |
---|
2938 | local_pf(i,j,k) = rad_lw_hr_av(k,j,i) |
---|
2939 | ENDDO |
---|
2940 | ENDDO |
---|
2941 | ENDDO |
---|
2942 | ENDIF |
---|
2943 | IF ( mode == 'xy' ) grid = 'zw' |
---|
2944 | |
---|
2945 | CASE ( 'rad_sw_in_xy', 'rad_sw_in_xz', 'rad_sw_in_yz' ) |
---|
2946 | IF ( av == 0 ) THEN |
---|
2947 | DO i = nxl, nxr |
---|
2948 | DO j = nys, nyn |
---|
2949 | DO k = nzb, nzt+1 |
---|
2950 | local_pf(i,j,k) = rad_sw_in(k,j,i) |
---|
2951 | ENDDO |
---|
2952 | ENDDO |
---|
2953 | ENDDO |
---|
2954 | ELSE |
---|
2955 | DO i = nxl, nxr |
---|
2956 | DO j = nys, nyn |
---|
2957 | DO k = nzb, nzt+1 |
---|
2958 | local_pf(i,j,k) = rad_sw_in_av(k,j,i) |
---|
2959 | ENDDO |
---|
2960 | ENDDO |
---|
2961 | ENDDO |
---|
2962 | ENDIF |
---|
2963 | IF ( mode == 'xy' ) grid = 'zu' |
---|
2964 | |
---|
2965 | CASE ( 'rad_sw_out_xy', 'rad_sw_out_xz', 'rad_sw_out_yz' ) |
---|
2966 | IF ( av == 0 ) THEN |
---|
2967 | DO i = nxl, nxr |
---|
2968 | DO j = nys, nyn |
---|
2969 | DO k = nzb, nzt+1 |
---|
2970 | local_pf(i,j,k) = rad_sw_out(k,j,i) |
---|
2971 | ENDDO |
---|
2972 | ENDDO |
---|
2973 | ENDDO |
---|
2974 | ELSE |
---|
2975 | DO i = nxl, nxr |
---|
2976 | DO j = nys, nyn |
---|
2977 | DO k = nzb, nzt+1 |
---|
2978 | local_pf(i,j,k) = rad_sw_out_av(k,j,i) |
---|
2979 | ENDDO |
---|
2980 | ENDDO |
---|
2981 | ENDDO |
---|
2982 | ENDIF |
---|
2983 | IF ( mode == 'xy' ) grid = 'zu' |
---|
2984 | |
---|
2985 | CASE ( 'rad_sw_cs_hr_xy', 'rad_sw_cs_hr_xz', 'rad_sw_cs_hr_yz' ) |
---|
2986 | IF ( av == 0 ) THEN |
---|
2987 | DO i = nxl, nxr |
---|
2988 | DO j = nys, nyn |
---|
2989 | DO k = nzb, nzt+1 |
---|
2990 | local_pf(i,j,k) = rad_sw_cs_hr(k,j,i) |
---|
2991 | ENDDO |
---|
2992 | ENDDO |
---|
2993 | ENDDO |
---|
2994 | ELSE |
---|
2995 | DO i = nxl, nxr |
---|
2996 | DO j = nys, nyn |
---|
2997 | DO k = nzb, nzt+1 |
---|
2998 | local_pf(i,j,k) = rad_sw_cs_hr_av(k,j,i) |
---|
2999 | ENDDO |
---|
3000 | ENDDO |
---|
3001 | ENDDO |
---|
3002 | ENDIF |
---|
3003 | IF ( mode == 'xy' ) grid = 'zw' |
---|
3004 | |
---|
3005 | CASE ( 'rad_sw_hr_xy', 'rad_sw_hr_xz', 'rad_sw_hr_yz' ) |
---|
3006 | IF ( av == 0 ) THEN |
---|
3007 | DO i = nxl, nxr |
---|
3008 | DO j = nys, nyn |
---|
3009 | DO k = nzb, nzt+1 |
---|
3010 | local_pf(i,j,k) = rad_sw_hr(k,j,i) |
---|
3011 | ENDDO |
---|
3012 | ENDDO |
---|
3013 | ENDDO |
---|
3014 | ELSE |
---|
3015 | DO i = nxl, nxr |
---|
3016 | DO j = nys, nyn |
---|
3017 | DO k = nzb, nzt+1 |
---|
3018 | local_pf(i,j,k) = rad_sw_hr_av(k,j,i) |
---|
3019 | ENDDO |
---|
3020 | ENDDO |
---|
3021 | ENDDO |
---|
3022 | ENDIF |
---|
3023 | IF ( mode == 'xy' ) grid = 'zw' |
---|
3024 | |
---|
3025 | CASE DEFAULT |
---|
3026 | found = .FALSE. |
---|
3027 | grid = 'none' |
---|
3028 | |
---|
3029 | END SELECT |
---|
3030 | |
---|
3031 | END SUBROUTINE radiation_data_output_2d |
---|
3032 | |
---|
3033 | |
---|
3034 | !------------------------------------------------------------------------------! |
---|
3035 | ! |
---|
3036 | ! Description: |
---|
3037 | ! ------------ |
---|
3038 | !> Subroutine defining 3D output variables |
---|
3039 | !------------------------------------------------------------------------------! |
---|
3040 | SUBROUTINE radiation_data_output_3d( av, variable, found, local_pf ) |
---|
3041 | |
---|
3042 | |
---|
3043 | USE indices |
---|
3044 | |
---|
3045 | USE kinds |
---|
3046 | |
---|
3047 | |
---|
3048 | IMPLICIT NONE |
---|
3049 | |
---|
3050 | CHARACTER (LEN=*) :: variable !< |
---|
3051 | |
---|
3052 | INTEGER(iwp) :: av !< |
---|
3053 | INTEGER(iwp) :: i !< |
---|
3054 | INTEGER(iwp) :: j !< |
---|
3055 | INTEGER(iwp) :: k !< |
---|
3056 | |
---|
3057 | LOGICAL :: found !< |
---|
3058 | |
---|
3059 | REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) :: local_pf !< |
---|
3060 | |
---|
3061 | |
---|
3062 | found = .TRUE. |
---|
3063 | |
---|
3064 | |
---|
3065 | SELECT CASE ( TRIM( variable ) ) |
---|
3066 | |
---|
3067 | CASE ( 'rad_sw_in' ) |
---|
3068 | IF ( av == 0 ) THEN |
---|
3069 | DO i = nxl, nxr |
---|
3070 | DO j = nys, nyn |
---|
3071 | DO k = nzb, nzt+1 |
---|
3072 | local_pf(i,j,k) = rad_sw_in(k,j,i) |
---|
3073 | ENDDO |
---|
3074 | ENDDO |
---|
3075 | ENDDO |
---|
3076 | ELSE |
---|
3077 | DO i = nxl, nxr |
---|
3078 | DO j = nys, nyn |
---|
3079 | DO k = nzb, nzt+1 |
---|
3080 | local_pf(i,j,k) = rad_sw_in_av(k,j,i) |
---|
3081 | ENDDO |
---|
3082 | ENDDO |
---|
3083 | ENDDO |
---|
3084 | ENDIF |
---|
3085 | |
---|
3086 | CASE ( 'rad_sw_out' ) |
---|
3087 | IF ( av == 0 ) THEN |
---|
3088 | DO i = nxl, nxr |
---|
3089 | DO j = nys, nyn |
---|
3090 | DO k = nzb, nzt+1 |
---|
3091 | local_pf(i,j,k) = rad_sw_out(k,j,i) |
---|
3092 | ENDDO |
---|
3093 | ENDDO |
---|
3094 | ENDDO |
---|
3095 | ELSE |
---|
3096 | DO i = nxl, nxr |
---|
3097 | DO j = nys, nyn |
---|
3098 | DO k = nzb, nzt+1 |
---|
3099 | local_pf(i,j,k) = rad_sw_out_av(k,j,i) |
---|
3100 | ENDDO |
---|
3101 | ENDDO |
---|
3102 | ENDDO |
---|
3103 | ENDIF |
---|
3104 | |
---|
3105 | CASE ( 'rad_sw_cs_hr' ) |
---|
3106 | IF ( av == 0 ) THEN |
---|
3107 | DO i = nxl, nxr |
---|
3108 | DO j = nys, nyn |
---|
3109 | DO k = nzb, nzt+1 |
---|
3110 | local_pf(i,j,k) = rad_sw_cs_hr(k,j,i) |
---|
3111 | ENDDO |
---|
3112 | ENDDO |
---|
3113 | ENDDO |
---|
3114 | ELSE |
---|
3115 | DO i = nxl, nxr |
---|
3116 | DO j = nys, nyn |
---|
3117 | DO k = nzb, nzt+1 |
---|
3118 | local_pf(i,j,k) = rad_sw_cs_hr_av(k,j,i) |
---|
3119 | ENDDO |
---|
3120 | ENDDO |
---|
3121 | ENDDO |
---|
3122 | ENDIF |
---|
3123 | |
---|
3124 | CASE ( 'rad_sw_hr' ) |
---|
3125 | IF ( av == 0 ) THEN |
---|
3126 | DO i = nxl, nxr |
---|
3127 | DO j = nys, nyn |
---|
3128 | DO k = nzb, nzt+1 |
---|
3129 | local_pf(i,j,k) = rad_sw_hr(k,j,i) |
---|
3130 | ENDDO |
---|
3131 | ENDDO |
---|
3132 | ENDDO |
---|
3133 | ELSE |
---|
3134 | DO i = nxl, nxr |
---|
3135 | DO j = nys, nyn |
---|
3136 | DO k = nzb, nzt+1 |
---|
3137 | local_pf(i,j,k) = rad_sw_hr_av(k,j,i) |
---|
3138 | ENDDO |
---|
3139 | ENDDO |
---|
3140 | ENDDO |
---|
3141 | ENDIF |
---|
3142 | |
---|
3143 | CASE ( 'rad_lw_in' ) |
---|
3144 | IF ( av == 0 ) THEN |
---|
3145 | DO i = nxl, nxr |
---|
3146 | DO j = nys, nyn |
---|
3147 | DO k = nzb, nzt+1 |
---|
3148 | local_pf(i,j,k) = rad_lw_in(k,j,i) |
---|
3149 | ENDDO |
---|
3150 | ENDDO |
---|
3151 | ENDDO |
---|
3152 | ELSE |
---|
3153 | DO i = nxl, nxr |
---|
3154 | DO j = nys, nyn |
---|
3155 | DO k = nzb, nzt+1 |
---|
3156 | local_pf(i,j,k) = rad_lw_in_av(k,j,i) |
---|
3157 | ENDDO |
---|
3158 | ENDDO |
---|
3159 | ENDDO |
---|
3160 | ENDIF |
---|
3161 | |
---|
3162 | CASE ( 'rad_lw_out' ) |
---|
3163 | IF ( av == 0 ) THEN |
---|
3164 | DO i = nxl, nxr |
---|
3165 | DO j = nys, nyn |
---|
3166 | DO k = nzb, nzt+1 |
---|
3167 | local_pf(i,j,k) = rad_lw_out(k,j,i) |
---|
3168 | ENDDO |
---|
3169 | ENDDO |
---|
3170 | ENDDO |
---|
3171 | ELSE |
---|
3172 | DO i = nxl, nxr |
---|
3173 | DO j = nys, nyn |
---|
3174 | DO k = nzb, nzt+1 |
---|
3175 | local_pf(i,j,k) = rad_lw_out_av(k,j,i) |
---|
3176 | ENDDO |
---|
3177 | ENDDO |
---|
3178 | ENDDO |
---|
3179 | ENDIF |
---|
3180 | |
---|
3181 | CASE ( 'rad_lw_cs_hr' ) |
---|
3182 | IF ( av == 0 ) THEN |
---|
3183 | DO i = nxl, nxr |
---|
3184 | DO j = nys, nyn |
---|
3185 | DO k = nzb, nzt+1 |
---|
3186 | local_pf(i,j,k) = rad_lw_cs_hr(k,j,i) |
---|
3187 | ENDDO |
---|
3188 | ENDDO |
---|
3189 | ENDDO |
---|
3190 | ELSE |
---|
3191 | DO i = nxl, nxr |
---|
3192 | DO j = nys, nyn |
---|
3193 | DO k = nzb, nzt+1 |
---|
3194 | local_pf(i,j,k) = rad_lw_cs_hr_av(k,j,i) |
---|
3195 | ENDDO |
---|
3196 | ENDDO |
---|
3197 | ENDDO |
---|
3198 | ENDIF |
---|
3199 | |
---|
3200 | CASE ( 'rad_lw_hr' ) |
---|
3201 | IF ( av == 0 ) THEN |
---|
3202 | DO i = nxl, nxr |
---|
3203 | DO j = nys, nyn |
---|
3204 | DO k = nzb, nzt+1 |
---|
3205 | local_pf(i,j,k) = rad_lw_hr(k,j,i) |
---|
3206 | ENDDO |
---|
3207 | ENDDO |
---|
3208 | ENDDO |
---|
3209 | ELSE |
---|
3210 | DO i = nxl, nxr |
---|
3211 | DO j = nys, nyn |
---|
3212 | DO k = nzb, nzt+1 |
---|
3213 | local_pf(i,j,k) = rad_lw_hr_av(k,j,i) |
---|
3214 | ENDDO |
---|
3215 | ENDDO |
---|
3216 | ENDDO |
---|
3217 | ENDIF |
---|
3218 | |
---|
3219 | CASE DEFAULT |
---|
3220 | found = .FALSE. |
---|
3221 | |
---|
3222 | END SELECT |
---|
3223 | |
---|
3224 | |
---|
3225 | END SUBROUTINE radiation_data_output_3d |
---|
3226 | |
---|
3227 | !------------------------------------------------------------------------------! |
---|
3228 | ! |
---|
3229 | ! Description: |
---|
3230 | ! ------------ |
---|
3231 | !> Subroutine defining masked data output |
---|
3232 | !------------------------------------------------------------------------------! |
---|
3233 | SUBROUTINE radiation_data_output_mask( av, variable, found, local_pf ) |
---|
3234 | |
---|
3235 | USE control_parameters |
---|
3236 | |
---|
3237 | USE indices |
---|
3238 | |
---|
3239 | USE kinds |
---|
3240 | |
---|
3241 | |
---|
3242 | IMPLICIT NONE |
---|
3243 | |
---|
3244 | CHARACTER (LEN=*) :: variable !< |
---|
3245 | |
---|
3246 | INTEGER(iwp) :: av !< |
---|
3247 | INTEGER(iwp) :: i !< |
---|
3248 | INTEGER(iwp) :: j !< |
---|
3249 | INTEGER(iwp) :: k !< |
---|
3250 | |
---|
3251 | LOGICAL :: found !< |
---|
3252 | |
---|
3253 | REAL(wp), & |
---|
3254 | DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) :: & |
---|
3255 | local_pf !< |
---|
3256 | |
---|
3257 | |
---|
3258 | found = .TRUE. |
---|
3259 | |
---|
3260 | SELECT CASE ( TRIM( variable ) ) |
---|
3261 | |
---|
3262 | |
---|
3263 | CASE ( 'rad_lw_in' ) |
---|
3264 | IF ( av == 0 ) THEN |
---|
3265 | DO i = 1, mask_size_l(mid,1) |
---|
3266 | DO j = 1, mask_size_l(mid,2) |
---|
3267 | DO k = 1, mask_size_l(mid,3) |
---|
3268 | local_pf(i,j,k) = rad_lw_in(mask_k(mid,k), & |
---|
3269 | mask_j(mid,j),mask_i(mid,i)) |
---|
3270 | ENDDO |
---|
3271 | ENDDO |
---|
3272 | ENDDO |
---|
3273 | ELSE |
---|
3274 | DO i = 1, mask_size_l(mid,1) |
---|
3275 | DO j = 1, mask_size_l(mid,2) |
---|
3276 | DO k = 1, mask_size_l(mid,3) |
---|
3277 | local_pf(i,j,k) = rad_lw_in_av(mask_k(mid,k), & |
---|
3278 | mask_j(mid,j),mask_i(mid,i)) |
---|
3279 | ENDDO |
---|
3280 | ENDDO |
---|
3281 | ENDDO |
---|
3282 | ENDIF |
---|
3283 | |
---|
3284 | CASE ( 'rad_lw_out' ) |
---|
3285 | IF ( av == 0 ) THEN |
---|
3286 | DO i = 1, mask_size_l(mid,1) |
---|
3287 | DO j = 1, mask_size_l(mid,2) |
---|
3288 | DO k = 1, mask_size_l(mid,3) |
---|
3289 | local_pf(i,j,k) = rad_lw_out(mask_k(mid,k), & |
---|
3290 | mask_j(mid,j),mask_i(mid,i)) |
---|
3291 | ENDDO |
---|
3292 | ENDDO |
---|
3293 | ENDDO |
---|
3294 | ELSE |
---|
3295 | DO i = 1, mask_size_l(mid,1) |
---|
3296 | DO j = 1, mask_size_l(mid,2) |
---|
3297 | DO k = 1, mask_size_l(mid,3) |
---|
3298 | local_pf(i,j,k) = rad_lw_out_av(mask_k(mid,k), & |
---|
3299 | mask_j(mid,j),mask_i(mid,i)) |
---|
3300 | ENDDO |
---|
3301 | ENDDO |
---|
3302 | ENDDO |
---|
3303 | ENDIF |
---|
3304 | |
---|
3305 | CASE ( 'rad_lw_cs_hr' ) |
---|
3306 | IF ( av == 0 ) THEN |
---|
3307 | DO i = 1, mask_size_l(mid,1) |
---|
3308 | DO j = 1, mask_size_l(mid,2) |
---|
3309 | DO k = 1, mask_size_l(mid,3) |
---|
3310 | local_pf(i,j,k) = rad_lw_cs_hr(mask_k(mid,k), & |
---|
3311 | mask_j(mid,j),mask_i(mid,i)) |
---|
3312 | ENDDO |
---|
3313 | ENDDO |
---|
3314 | ENDDO |
---|
3315 | ELSE |
---|
3316 | DO i = 1, mask_size_l(mid,1) |
---|
3317 | DO j = 1, mask_size_l(mid,2) |
---|
3318 | DO k = 1, mask_size_l(mid,3) |
---|
3319 | local_pf(i,j,k) = rad_lw_cs_hr_av(mask_k(mid,k), & |
---|
3320 | mask_j(mid,j),mask_i(mid,i)) |
---|
3321 | ENDDO |
---|
3322 | ENDDO |
---|
3323 | ENDDO |
---|
3324 | ENDIF |
---|
3325 | |
---|
3326 | CASE ( 'rad_lw_hr' ) |
---|
3327 | IF ( av == 0 ) THEN |
---|
3328 | DO i = 1, mask_size_l(mid,1) |
---|
3329 | DO j = 1, mask_size_l(mid,2) |
---|
3330 | DO k = 1, mask_size_l(mid,3) |
---|
3331 | local_pf(i,j,k) = rad_lw_hr(mask_k(mid,k), & |
---|
3332 | mask_j(mid,j),mask_i(mid,i)) |
---|
3333 | ENDDO |
---|
3334 | ENDDO |
---|
3335 | ENDDO |
---|
3336 | ELSE |
---|
3337 | DO i = 1, mask_size_l(mid,1) |
---|
3338 | DO j = 1, mask_size_l(mid,2) |
---|
3339 | DO k = 1, mask_size_l(mid,3) |
---|
3340 | local_pf(i,j,k) = rad_lw_hr_av(mask_k(mid,k), & |
---|
3341 | mask_j(mid,j),mask_i(mid,i)) |
---|
3342 | ENDDO |
---|
3343 | ENDDO |
---|
3344 | ENDDO |
---|
3345 | ENDIF |
---|
3346 | |
---|
3347 | CASE ( 'rad_sw_in' ) |
---|
3348 | IF ( av == 0 ) THEN |
---|
3349 | DO i = 1, mask_size_l(mid,1) |
---|
3350 | DO j = 1, mask_size_l(mid,2) |
---|
3351 | DO k = 1, mask_size_l(mid,3) |
---|
3352 | local_pf(i,j,k) = rad_sw_in(mask_k(mid,k), & |
---|
3353 | mask_j(mid,j),mask_i(mid,i)) |
---|
3354 | ENDDO |
---|
3355 | ENDDO |
---|
3356 | ENDDO |
---|
3357 | ELSE |
---|
3358 | DO i = 1, mask_size_l(mid,1) |
---|
3359 | DO j = 1, mask_size_l(mid,2) |
---|
3360 | DO k = 1, mask_size_l(mid,3) |
---|
3361 | local_pf(i,j,k) = rad_sw_in_av(mask_k(mid,k), & |
---|
3362 | mask_j(mid,j),mask_i(mid,i)) |
---|
3363 | ENDDO |
---|
3364 | ENDDO |
---|
3365 | ENDDO |
---|
3366 | ENDIF |
---|
3367 | |
---|
3368 | CASE ( 'rad_sw_out' ) |
---|
3369 | IF ( av == 0 ) THEN |
---|
3370 | DO i = 1, mask_size_l(mid,1) |
---|
3371 | DO j = 1, mask_size_l(mid,2) |
---|
3372 | DO k = 1, mask_size_l(mid,3) |
---|
3373 | local_pf(i,j,k) = rad_sw_out(mask_k(mid,k), & |
---|
3374 | mask_j(mid,j),mask_i(mid,i)) |
---|
3375 | ENDDO |
---|
3376 | ENDDO |
---|
3377 | ENDDO |
---|
3378 | ELSE |
---|
3379 | DO i = 1, mask_size_l(mid,1) |
---|
3380 | DO j = 1, mask_size_l(mid,2) |
---|
3381 | DO k = 1, mask_size_l(mid,3) |
---|
3382 | local_pf(i,j,k) = rad_sw_out_av(mask_k(mid,k), & |
---|
3383 | mask_j(mid,j),mask_i(mid,i)) |
---|
3384 | ENDDO |
---|
3385 | ENDDO |
---|
3386 | ENDDO |
---|
3387 | ENDIF |
---|
3388 | |
---|
3389 | CASE ( 'rad_sw_cs_hr' ) |
---|
3390 | IF ( av == 0 ) THEN |
---|
3391 | DO i = 1, mask_size_l(mid,1) |
---|
3392 | DO j = 1, mask_size_l(mid,2) |
---|
3393 | DO k = 1, mask_size_l(mid,3) |
---|
3394 | local_pf(i,j,k) = rad_sw_cs_hr(mask_k(mid,k), & |
---|
3395 | mask_j(mid,j),mask_i(mid,i)) |
---|
3396 | ENDDO |
---|
3397 | ENDDO |
---|
3398 | ENDDO |
---|
3399 | ELSE |
---|
3400 | DO i = 1, mask_size_l(mid,1) |
---|
3401 | DO j = 1, mask_size_l(mid,2) |
---|
3402 | DO k = 1, mask_size_l(mid,3) |
---|
3403 | local_pf(i,j,k) = rad_sw_cs_hr_av(mask_k(mid,k), & |
---|
3404 | mask_j(mid,j),mask_i(mid,i)) |
---|
3405 | ENDDO |
---|
3406 | ENDDO |
---|
3407 | ENDDO |
---|
3408 | ENDIF |
---|
3409 | |
---|
3410 | CASE ( 'rad_sw_hr' ) |
---|
3411 | IF ( av == 0 ) THEN |
---|
3412 | DO i = 1, mask_size_l(mid,1) |
---|
3413 | DO j = 1, mask_size_l(mid,2) |
---|
3414 | DO k = 1, mask_size_l(mid,3) |
---|
3415 | local_pf(i,j,k) = rad_sw_hr(mask_k(mid,k), & |
---|
3416 | mask_j(mid,j),mask_i(mid,i)) |
---|
3417 | ENDDO |
---|
3418 | ENDDO |
---|
3419 | ENDDO |
---|
3420 | ELSE |
---|
3421 | DO i = 1, mask_size_l(mid,1) |
---|
3422 | DO j = 1, mask_size_l(mid,2) |
---|
3423 | DO k = 1, mask_size_l(mid,3) |
---|
3424 | local_pf(i,j,k) = rad_sw_hr_av(mask_k(mid,k), & |
---|
3425 | mask_j(mid,j),mask_i(mid,i)) |
---|
3426 | ENDDO |
---|
3427 | ENDDO |
---|
3428 | ENDDO |
---|
3429 | ENDIF |
---|
3430 | |
---|
3431 | CASE DEFAULT |
---|
3432 | found = .FALSE. |
---|
3433 | |
---|
3434 | END SELECT |
---|
3435 | |
---|
3436 | |
---|
3437 | END SUBROUTINE radiation_data_output_mask |
---|
3438 | |
---|
3439 | |
---|
3440 | !------------------------------------------------------------------------------! |
---|
3441 | ! |
---|
3442 | ! Description: |
---|
3443 | ! ------------ |
---|
3444 | !> Subroutine defines masked output variables |
---|
3445 | !------------------------------------------------------------------------------! |
---|
3446 | SUBROUTINE radiation_last_actions |
---|
3447 | |
---|
3448 | |
---|
3449 | USE control_parameters |
---|
3450 | |
---|
3451 | USE kinds |
---|
3452 | |
---|
3453 | IMPLICIT NONE |
---|
3454 | |
---|
3455 | IF ( write_binary ) THEN |
---|
3456 | IF ( ALLOCATED( rad_net ) ) THEN |
---|
3457 | WRITE ( 14 ) 'rad_net '; WRITE ( 14 ) rad_net |
---|
3458 | ENDIF |
---|
3459 | IF ( ALLOCATED( rad_net_av ) ) THEN |
---|
3460 | WRITE ( 14 ) 'rad_net_av '; WRITE ( 14 ) rad_net_av |
---|
3461 | ENDIF |
---|
3462 | IF ( ALLOCATED( rad_lw_in ) ) THEN |
---|
3463 | WRITE ( 14 ) 'rad_lw_in '; WRITE ( 14 ) rad_lw_in |
---|
3464 | ENDIF |
---|
3465 | IF ( ALLOCATED( rad_lw_in_av ) ) THEN |
---|
3466 | WRITE ( 14 ) 'rad_lw_in_av '; WRITE ( 14 ) rad_lw_in_av |
---|
3467 | ENDIF |
---|
3468 | IF ( ALLOCATED( rad_lw_out ) ) THEN |
---|
3469 | WRITE ( 14 ) 'rad_lw_out '; WRITE ( 14 ) rad_lw_out |
---|
3470 | ENDIF |
---|
3471 | IF ( ALLOCATED( rad_lw_out_av ) ) THEN |
---|
3472 | WRITE ( 14 ) 'rad_lw_out_av '; WRITE ( 14 ) rad_lw_out_av |
---|
3473 | ENDIF |
---|
3474 | IF ( ALLOCATED( rad_lw_out_change_0 ) ) THEN |
---|
3475 | WRITE ( 14 ) 'rad_lw_out_change_0 ' |
---|
3476 | WRITE ( 14 ) rad_lw_out_change_0 |
---|
3477 | ENDIF |
---|
3478 | IF ( ALLOCATED( rad_lw_cs_hr ) ) THEN |
---|
3479 | WRITE ( 14 ) 'rad_lw_cs_hr '; WRITE ( 14 ) rad_lw_cs_hr |
---|
3480 | ENDIF |
---|
3481 | IF ( ALLOCATED( rad_lw_cs_hr_av ) ) THEN |
---|
3482 | WRITE ( 14 ) 'rad_lw_cs_hr_av '; WRITE ( 14 ) rad_lw_cs_hr_av |
---|
3483 | ENDIF |
---|
3484 | IF ( ALLOCATED( rad_lw_hr ) ) THEN |
---|
3485 | WRITE ( 14 ) 'rad_lw_hr '; WRITE ( 14 ) rad_lw_hr |
---|
3486 | ENDIF |
---|
3487 | IF ( ALLOCATED( rad_lw_hr_av ) ) THEN |
---|
3488 | WRITE ( 14 ) 'rad_lw_hr_av '; WRITE ( 14 ) rad_lw_hr_av |
---|
3489 | ENDIF |
---|
3490 | IF ( ALLOCATED( rad_sw_in ) ) THEN |
---|
3491 | WRITE ( 14 ) 'rad_sw_in '; WRITE ( 14 ) rad_sw_in |
---|
3492 | ENDIF |
---|
3493 | IF ( ALLOCATED( rad_sw_in_av ) ) THEN |
---|
3494 | WRITE ( 14 ) 'rad_sw_in_av '; WRITE ( 14 ) rad_sw_in_av |
---|
3495 | ENDIF |
---|
3496 | IF ( ALLOCATED( rad_sw_out ) ) THEN |
---|
3497 | WRITE ( 14 ) 'rad_sw_out '; WRITE ( 14 ) rad_sw_out |
---|
3498 | ENDIF |
---|
3499 | IF ( ALLOCATED( rad_sw_out_av ) ) THEN |
---|
3500 | WRITE ( 14 ) 'rad_sw_out_av '; WRITE ( 14 ) rad_sw_out_av |
---|
3501 | ENDIF |
---|
3502 | IF ( ALLOCATED( rad_sw_cs_hr ) ) THEN |
---|
3503 | WRITE ( 14 ) 'rad_sw_cs_hr '; WRITE ( 14 ) rad_sw_cs_hr |
---|
3504 | ENDIF |
---|
3505 | IF ( ALLOCATED( rad_sw_cs_hr_av ) ) THEN |
---|
3506 | WRITE ( 14 ) 'rad_sw_cs_hr_av '; WRITE ( 14 ) rad_sw_cs_hr_av |
---|
3507 | ENDIF |
---|
3508 | IF ( ALLOCATED( rad_sw_hr ) ) THEN |
---|
3509 | WRITE ( 14 ) 'rad_sw_hr '; WRITE ( 14 ) rad_sw_hr |
---|
3510 | ENDIF |
---|
3511 | IF ( ALLOCATED( rad_sw_hr_av ) ) THEN |
---|
3512 | WRITE ( 14 ) 'rad_sw_hr_av '; WRITE ( 14 ) rad_sw_hr_av |
---|
3513 | ENDIF |
---|
3514 | |
---|
3515 | WRITE ( 14 ) '*** end rad *** ' |
---|
3516 | |
---|
3517 | ENDIF |
---|
3518 | |
---|
3519 | END SUBROUTINE radiation_last_actions |
---|
3520 | |
---|
3521 | |
---|
3522 | SUBROUTINE radiation_read_restart_data( i, nxlfa, nxl_on_file, nxrfa, & |
---|
3523 | nxr_on_file, nynfa, nyn_on_file, nysfa,& |
---|
3524 | nys_on_file, offset_xa, offset_ya, & |
---|
3525 | overlap_count, tmp_2d, tmp_3d ) |
---|
3526 | |
---|
3527 | |
---|
3528 | USE control_parameters |
---|
3529 | |
---|
3530 | USE indices |
---|
3531 | |
---|
3532 | USE kinds |
---|
3533 | |
---|
3534 | USE pegrid |
---|
3535 | |
---|
3536 | IMPLICIT NONE |
---|
3537 | |
---|
3538 | CHARACTER (LEN=20) :: field_char !< |
---|
3539 | |
---|
3540 | INTEGER(iwp) :: i !< |
---|
3541 | INTEGER(iwp) :: k !< |
---|
3542 | INTEGER(iwp) :: nxlc !< |
---|
3543 | INTEGER(iwp) :: nxlf !< |
---|
3544 | INTEGER(iwp) :: nxl_on_file !< |
---|
3545 | INTEGER(iwp) :: nxrc !< |
---|
3546 | INTEGER(iwp) :: nxrf !< |
---|
3547 | INTEGER(iwp) :: nxr_on_file !< |
---|
3548 | INTEGER(iwp) :: nync !< |
---|
3549 | INTEGER(iwp) :: nynf !< |
---|
3550 | INTEGER(iwp) :: nyn_on_file !< |
---|
3551 | INTEGER(iwp) :: nysc !< |
---|
3552 | INTEGER(iwp) :: nysf !< |
---|
3553 | INTEGER(iwp) :: nys_on_file !< |
---|
3554 | INTEGER(iwp) :: overlap_count !< |
---|
3555 | |
---|
3556 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxlfa !< |
---|
3557 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxrfa !< |
---|
3558 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nynfa !< |
---|
3559 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nysfa !< |
---|
3560 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_xa !< |
---|
3561 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_ya !< |
---|
3562 | |
---|
3563 | REAL(wp), & |
---|
3564 | DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
3565 | tmp_2d !< |
---|
3566 | |
---|
3567 | REAL(wp), & |
---|
3568 | DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
3569 | tmp_3d !< |
---|
3570 | |
---|
3571 | REAL(wp), & |
---|
3572 | DIMENSION(0:0,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::& |
---|
3573 | tmp_3d2 !< |
---|
3574 | |
---|
3575 | |
---|
3576 | |
---|
3577 | IF ( initializing_actions == 'read_restart_data' ) THEN |
---|
3578 | READ ( 13 ) field_char |
---|
3579 | |
---|
3580 | DO WHILE ( TRIM( field_char ) /= '*** end rad ***' ) |
---|
3581 | |
---|
3582 | DO k = 1, overlap_count |
---|
3583 | |
---|
3584 | nxlf = nxlfa(i,k) |
---|
3585 | nxlc = nxlfa(i,k) + offset_xa(i,k) |
---|
3586 | nxrf = nxrfa(i,k) |
---|
3587 | nxrc = nxrfa(i,k) + offset_xa(i,k) |
---|
3588 | nysf = nysfa(i,k) |
---|
3589 | nysc = nysfa(i,k) + offset_ya(i,k) |
---|
3590 | nynf = nynfa(i,k) |
---|
3591 | nync = nynfa(i,k) + offset_ya(i,k) |
---|
3592 | |
---|
3593 | |
---|
3594 | SELECT CASE ( TRIM( field_char ) ) |
---|
3595 | |
---|
3596 | CASE ( 'rad_net' ) |
---|
3597 | IF ( .NOT. ALLOCATED( rad_net ) ) THEN |
---|
3598 | ALLOCATE( rad_net(nysg:nyng,nxlg:nxrg) ) |
---|
3599 | ENDIF |
---|
3600 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
3601 | rad_net(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3602 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3603 | |
---|
3604 | CASE ( 'rad_net_av' ) |
---|
3605 | IF ( .NOT. ALLOCATED( rad_net_av ) ) THEN |
---|
3606 | ALLOCATE( rad_net_av(nysg:nyng,nxlg:nxrg) ) |
---|
3607 | ENDIF |
---|
3608 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
3609 | rad_net_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3610 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3611 | CASE ( 'rad_lw_in' ) |
---|
3612 | IF ( .NOT. ALLOCATED( rad_lw_in ) ) THEN |
---|
3613 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3614 | radiation_scheme == 'constant') THEN |
---|
3615 | ALLOCATE( rad_lw_in(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
3616 | ELSE |
---|
3617 | ALLOCATE( rad_lw_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3618 | ENDIF |
---|
3619 | ENDIF |
---|
3620 | IF ( k == 1 ) THEN |
---|
3621 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3622 | radiation_scheme == 'constant') THEN |
---|
3623 | READ ( 13 ) tmp_3d2 |
---|
3624 | rad_lw_in(0:0,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3625 | tmp_3d2(0:0,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3626 | ELSE |
---|
3627 | READ ( 13 ) tmp_3d |
---|
3628 | rad_lw_in(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3629 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3630 | ENDIF |
---|
3631 | ENDIF |
---|
3632 | |
---|
3633 | CASE ( 'rad_lw_in_av' ) |
---|
3634 | IF ( .NOT. ALLOCATED( rad_lw_in_av ) ) THEN |
---|
3635 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3636 | radiation_scheme == 'constant') THEN |
---|
3637 | ALLOCATE( rad_lw_in_av(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
3638 | ELSE |
---|
3639 | ALLOCATE( rad_lw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3640 | ENDIF |
---|
3641 | ENDIF |
---|
3642 | IF ( k == 1 ) THEN |
---|
3643 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3644 | radiation_scheme == 'constant') THEN |
---|
3645 | READ ( 13 ) tmp_3d2 |
---|
3646 | rad_lw_in_av(0:0,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3647 | tmp_3d2(0:0,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3648 | ELSE |
---|
3649 | READ ( 13 ) tmp_3d |
---|
3650 | rad_lw_in_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3651 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3652 | ENDIF |
---|
3653 | ENDIF |
---|
3654 | |
---|
3655 | CASE ( 'rad_lw_out' ) |
---|
3656 | IF ( .NOT. ALLOCATED( rad_lw_out ) ) THEN |
---|
3657 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3658 | radiation_scheme == 'constant') THEN |
---|
3659 | ALLOCATE( rad_lw_out(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
3660 | ELSE |
---|
3661 | ALLOCATE( rad_lw_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3662 | ENDIF |
---|
3663 | ENDIF |
---|
3664 | IF ( k == 1 ) THEN |
---|
3665 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3666 | radiation_scheme == 'constant') THEN |
---|
3667 | READ ( 13 ) tmp_3d2 |
---|
3668 | rad_lw_out(0:0,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3669 | tmp_3d2(0:0,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3670 | ELSE |
---|
3671 | READ ( 13 ) tmp_3d |
---|
3672 | rad_lw_out(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3673 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3674 | ENDIF |
---|
3675 | ENDIF |
---|
3676 | |
---|
3677 | CASE ( 'rad_lw_out_av' ) |
---|
3678 | IF ( .NOT. ALLOCATED( rad_lw_out_av ) ) THEN |
---|
3679 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3680 | radiation_scheme == 'constant') THEN |
---|
3681 | ALLOCATE( rad_lw_out_av(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
3682 | ELSE |
---|
3683 | ALLOCATE( rad_lw_out_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3684 | ENDIF |
---|
3685 | ENDIF |
---|
3686 | IF ( k == 1 ) THEN |
---|
3687 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3688 | radiation_scheme == 'constant') THEN |
---|
3689 | READ ( 13 ) tmp_3d2 |
---|
3690 | rad_lw_out_av(0:0,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3691 | tmp_3d2(0:0,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3692 | ELSE |
---|
3693 | READ ( 13 ) tmp_3d |
---|
3694 | rad_lw_out_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3695 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3696 | ENDIF |
---|
3697 | ENDIF |
---|
3698 | |
---|
3699 | CASE ( 'rad_lw_out_change_0' ) |
---|
3700 | IF ( .NOT. ALLOCATED( rad_lw_out_change_0 ) ) THEN |
---|
3701 | ALLOCATE( rad_lw_out_change_0(nysg:nyng,nxlg:nxrg) ) |
---|
3702 | ENDIF |
---|
3703 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
3704 | rad_lw_out_change_0(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)& |
---|
3705 | = tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3706 | |
---|
3707 | CASE ( 'rad_lw_cs_hr' ) |
---|
3708 | IF ( .NOT. ALLOCATED( rad_lw_cs_hr ) ) THEN |
---|
3709 | ALLOCATE( rad_lw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3710 | ENDIF |
---|
3711 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
3712 | rad_lw_cs_hr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3713 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3714 | |
---|
3715 | CASE ( 'rad_lw_cs_hr_av' ) |
---|
3716 | IF ( .NOT. ALLOCATED( rad_lw_cs_hr_av ) ) THEN |
---|
3717 | ALLOCATE( rad_lw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3718 | ENDIF |
---|
3719 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
3720 | rad_lw_cs_hr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3721 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3722 | |
---|
3723 | CASE ( 'rad_lw_hr' ) |
---|
3724 | IF ( .NOT. ALLOCATED( rad_lw_hr ) ) THEN |
---|
3725 | ALLOCATE( rad_lw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3726 | ENDIF |
---|
3727 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
3728 | rad_lw_hr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3729 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3730 | |
---|
3731 | CASE ( 'rad_lw_hr_av' ) |
---|
3732 | IF ( .NOT. ALLOCATED( rad_lw_hr_av ) ) THEN |
---|
3733 | ALLOCATE( rad_lw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3734 | ENDIF |
---|
3735 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
3736 | rad_lw_hr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3737 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3738 | |
---|
3739 | CASE ( 'rad_sw_in' ) |
---|
3740 | IF ( .NOT. ALLOCATED( rad_sw_in ) ) THEN |
---|
3741 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3742 | radiation_scheme == 'constant') THEN |
---|
3743 | ALLOCATE( rad_sw_in(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
3744 | ELSE |
---|
3745 | ALLOCATE( rad_sw_in(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3746 | ENDIF |
---|
3747 | ENDIF |
---|
3748 | IF ( k == 1 ) THEN |
---|
3749 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3750 | radiation_scheme == 'constant') THEN |
---|
3751 | READ ( 13 ) tmp_3d2 |
---|
3752 | rad_sw_in(0:0,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3753 | tmp_3d2(0:0,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3754 | ELSE |
---|
3755 | READ ( 13 ) tmp_3d |
---|
3756 | rad_sw_in(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3757 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3758 | ENDIF |
---|
3759 | ENDIF |
---|
3760 | |
---|
3761 | CASE ( 'rad_sw_in_av' ) |
---|
3762 | IF ( .NOT. ALLOCATED( rad_sw_in_av ) ) THEN |
---|
3763 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3764 | radiation_scheme == 'constant') THEN |
---|
3765 | ALLOCATE( rad_sw_in_av(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
3766 | ELSE |
---|
3767 | ALLOCATE( rad_sw_in_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3768 | ENDIF |
---|
3769 | ENDIF |
---|
3770 | IF ( k == 1 ) THEN |
---|
3771 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3772 | radiation_scheme == 'constant') THEN |
---|
3773 | READ ( 13 ) tmp_3d2 |
---|
3774 | rad_sw_in_av(0:0,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3775 | tmp_3d2(0:0,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3776 | ELSE |
---|
3777 | READ ( 13 ) tmp_3d |
---|
3778 | rad_sw_in_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3779 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3780 | ENDIF |
---|
3781 | ENDIF |
---|
3782 | |
---|
3783 | CASE ( 'rad_sw_out' ) |
---|
3784 | IF ( .NOT. ALLOCATED( rad_sw_out ) ) THEN |
---|
3785 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3786 | radiation_scheme == 'constant') THEN |
---|
3787 | ALLOCATE( rad_sw_out(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
3788 | ELSE |
---|
3789 | ALLOCATE( rad_sw_out(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3790 | ENDIF |
---|
3791 | ENDIF |
---|
3792 | IF ( k == 1 ) THEN |
---|
3793 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3794 | radiation_scheme == 'constant') THEN |
---|
3795 | READ ( 13 ) tmp_3d2 |
---|
3796 | rad_sw_out(0:0,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3797 | tmp_3d2(0:0,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3798 | ELSE |
---|
3799 | READ ( 13 ) tmp_3d |
---|
3800 | rad_sw_out(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3801 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3802 | ENDIF |
---|
3803 | ENDIF |
---|
3804 | |
---|
3805 | CASE ( 'rad_sw_out_av' ) |
---|
3806 | IF ( .NOT. ALLOCATED( rad_sw_out_av ) ) THEN |
---|
3807 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3808 | radiation_scheme == 'constant') THEN |
---|
3809 | ALLOCATE( rad_sw_out_av(0:0,nysg:nyng,nxlg:nxrg) ) |
---|
3810 | ELSE |
---|
3811 | ALLOCATE( rad_sw_out_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3812 | ENDIF |
---|
3813 | ENDIF |
---|
3814 | IF ( k == 1 ) THEN |
---|
3815 | IF ( radiation_scheme == 'clear-sky' .OR. & |
---|
3816 | radiation_scheme == 'constant') THEN |
---|
3817 | READ ( 13 ) tmp_3d2 |
---|
3818 | rad_sw_out_av(0:0,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3819 | tmp_3d2(0:0,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3820 | ELSE |
---|
3821 | READ ( 13 ) tmp_3d |
---|
3822 | rad_sw_out_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =& |
---|
3823 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3824 | ENDIF |
---|
3825 | ENDIF |
---|
3826 | |
---|
3827 | CASE ( 'rad_sw_cs_hr' ) |
---|
3828 | IF ( .NOT. ALLOCATED( rad_sw_cs_hr ) ) THEN |
---|
3829 | ALLOCATE( rad_sw_cs_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3830 | ENDIF |
---|
3831 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
3832 | rad_sw_cs_hr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3833 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3834 | |
---|
3835 | CASE ( 'rad_sw_cs_hr_av' ) |
---|
3836 | IF ( .NOT. ALLOCATED( rad_sw_cs_hr_av ) ) THEN |
---|
3837 | ALLOCATE( rad_sw_cs_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3838 | ENDIF |
---|
3839 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
3840 | rad_sw_cs_hr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3841 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3842 | |
---|
3843 | CASE ( 'rad_sw_hr' ) |
---|
3844 | IF ( .NOT. ALLOCATED( rad_sw_hr ) ) THEN |
---|
3845 | ALLOCATE( rad_sw_hr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3846 | ENDIF |
---|
3847 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
3848 | rad_sw_hr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3849 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3850 | |
---|
3851 | CASE ( 'rad_sw_hr_av' ) |
---|
3852 | IF ( .NOT. ALLOCATED( rad_sw_hr_av ) ) THEN |
---|
3853 | ALLOCATE( rad_sw_hr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
3854 | ENDIF |
---|
3855 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
3856 | rad_lw_hr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
3857 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
3858 | |
---|
3859 | CASE DEFAULT |
---|
3860 | WRITE( message_string, * ) 'unknown variable named "', & |
---|
3861 | TRIM( field_char ), '" found in', & |
---|
3862 | '&data from prior run on PE ', myid |
---|
3863 | CALL message( 'radiation_read_restart_data', 'PA0302', 1, 2, & |
---|
3864 | 0, 6, 0 ) |
---|
3865 | |
---|
3866 | END SELECT |
---|
3867 | |
---|
3868 | ENDDO |
---|
3869 | |
---|
3870 | READ ( 13 ) field_char |
---|
3871 | |
---|
3872 | ENDDO |
---|
3873 | ENDIF |
---|
3874 | |
---|
3875 | END SUBROUTINE radiation_read_restart_data |
---|
3876 | |
---|
3877 | |
---|
3878 | END MODULE radiation_model_mod |
---|