45 integer,
private,
parameter :: num_vars_3d = 4
46 integer,
private,
parameter :: num_vars_2d = 4
47 integer,
private,
parameter :: num_vars_2d_op = 4
49 real(RP),
private :: ATMOS_PHY_RD_offline_diffuse_rate = 0.5_rp
50 real(RP),
private :: ATMOS_PHY_RD_offline_NIR_rate = 0.5_rp
52 logical,
private :: vars_2d_exist(num_vars_2d_op)
66 character(len=H_SHORT) :: vars_3d (num_vars_3d)
67 character(len=H_SHORT) :: vars_2d (num_vars_2d)
68 character(len=H_SHORT) :: vars_2d_op(num_vars_2d_op)
70 data vars_3d /
'RFLX_LW_up',
'RFLX_LW_dn',
'RFLX_SW_up',
'RFLX_SW_dn' /
71 data vars_2d /
'SFLX_LW_up',
'SFLX_LW_dn',
'SFLX_SW_up',
'SFLX_SW_dn' /
72 data vars_2d_op /
'SFLX_NIR_dn_dir',
'SFLX_NIR_dn_dif',
'SFLX_VIS_dn_dir',
'SFLX_VIS_dn_dif' /
74 character(len=H_LONG) :: atmos_phy_rd_offline_basename =
''
75 logical :: atmos_phy_rd_offline_basename_add_num = .false.
76 integer :: atmos_phy_rd_offline_number_of_files = 1
77 character(len=H_SHORT) :: atmos_phy_rd_offline_axistype =
'XYZ'
78 logical :: atmos_phy_rd_offline_enable_periodic_year = .false.
79 logical :: atmos_phy_rd_offline_enable_periodic_month = .false.
80 logical :: atmos_phy_rd_offline_enable_periodic_day = .false.
81 integer :: atmos_phy_rd_offline_step_fixed = 0
82 real(rp) :: atmos_phy_rd_offline_offset = 0.0_rp
83 real(rp) :: atmos_phy_rd_offline_defval
84 logical :: atmos_phy_rd_offline_check_coordinates = .true.
85 integer :: atmos_phy_rd_offline_step_limit = 0
87 namelist / param_atmos_phy_rd_offline / &
88 atmos_phy_rd_offline_basename, &
89 atmos_phy_rd_offline_basename_add_num, &
90 atmos_phy_rd_offline_number_of_files, &
91 atmos_phy_rd_offline_axistype, &
92 atmos_phy_rd_offline_enable_periodic_year, &
93 atmos_phy_rd_offline_enable_periodic_month, &
94 atmos_phy_rd_offline_enable_periodic_day, &
95 atmos_phy_rd_offline_step_fixed, &
96 atmos_phy_rd_offline_offset, &
97 atmos_phy_rd_offline_defval, &
98 atmos_phy_rd_offline_check_coordinates, &
99 atmos_phy_rd_offline_step_limit, &
100 atmos_phy_rd_offline_diffuse_rate, &
101 atmos_phy_rd_offline_nir_rate
107 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'Setup'
108 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'Offline radiation process'
110 atmos_phy_rd_offline_defval = undef
114 read(
io_fid_conf,nml=param_atmos_phy_rd_offline,iostat=ierr)
116 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'Not found namelist. Default used.'
117 elseif( ierr > 0 )
then
118 log_error(
"ATMOS_PHY_RD_offline_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_RD_OFFLINE. Check!'
121 log_nml(param_atmos_phy_rd_offline)
123 if ( atmos_phy_rd_offline_basename ==
'' )
then
124 log_error(
"ATMOS_PHY_RD_offline_setup",*)
'ATMOS_PHY_RD_offline_basename is necessary'
128 do n = 1, num_vars_3d
130 atmos_phy_rd_offline_basename_add_num, &
131 atmos_phy_rd_offline_number_of_files, &
133 atmos_phy_rd_offline_axistype, &
134 atmos_phy_rd_offline_enable_periodic_year, &
135 atmos_phy_rd_offline_enable_periodic_month, &
136 atmos_phy_rd_offline_enable_periodic_day, &
137 atmos_phy_rd_offline_step_fixed, &
138 atmos_phy_rd_offline_offset, &
139 atmos_phy_rd_offline_defval, &
140 check_coordinates = atmos_phy_rd_offline_check_coordinates, &
141 step_limit = atmos_phy_rd_offline_step_limit )
144 do n = 1, num_vars_2d
146 atmos_phy_rd_offline_basename_add_num, &
147 atmos_phy_rd_offline_number_of_files, &
150 atmos_phy_rd_offline_enable_periodic_year, &
151 atmos_phy_rd_offline_enable_periodic_month, &
152 atmos_phy_rd_offline_enable_periodic_day, &
153 atmos_phy_rd_offline_step_fixed, &
154 atmos_phy_rd_offline_offset, &
155 atmos_phy_rd_offline_defval, &
156 check_coordinates = atmos_phy_rd_offline_check_coordinates, &
157 step_limit = atmos_phy_rd_offline_step_limit )
160 do n = 1, num_vars_2d_op
162 atmos_phy_rd_offline_basename_add_num, &
163 atmos_phy_rd_offline_number_of_files, &
166 atmos_phy_rd_offline_enable_periodic_year, &
167 atmos_phy_rd_offline_enable_periodic_month, &
168 atmos_phy_rd_offline_enable_periodic_day, &
169 atmos_phy_rd_offline_step_fixed, &
170 atmos_phy_rd_offline_offset, &
171 atmos_phy_rd_offline_defval, &
172 check_coordinates = atmos_phy_rd_offline_check_coordinates, &
173 step_limit = atmos_phy_rd_offline_step_limit, &
174 exist = vars_2d_exist(n) )
175 if ( vars_2d_exist(n) )
then
176 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'', trim(vars_2d_op(n)),
' found.'
178 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'', trim(vars_2d_op(n)),
' not found.'
188 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
195 file_external_input_update
203 integer,
intent(in) :: ka, ks, ke
204 integer,
intent(in) :: ia, is, ie
205 integer,
intent(in) :: ja, js, je
206 real(
dp),
intent(in) :: time_now
207 real(rp),
intent(out) :: flux_rad (ka,ia,ja,2,2)
210 real(rp) :: buffer(ia,ja)
211 logical :: error, error_sum, error_sflx
216 log_progress(*)
'atmosphere / physics / radiation / offline'
223 call file_external_input_update(
'RFLX_LW_up', time_now, flux_rad(:,:,:,
i_lw,
i_up), error )
224 error_sum = ( error .OR. error_sum )
226 call file_external_input_update(
'RFLX_LW_dn', time_now, flux_rad(:,:,:,
i_lw,
i_dn), error )
227 error_sum = ( error .OR. error_sum )
229 call file_external_input_update(
'RFLX_SW_up', time_now, flux_rad(:,:,:,
i_sw,
i_up), error )
230 error_sum = ( error .OR. error_sum )
232 call file_external_input_update(
'RFLX_SW_dn', time_now, flux_rad(:,:,:,
i_sw,
i_dn), error )
233 error_sum = ( error .OR. error_sum )
237 call file_external_input_update(
'SFLX_LW_up', time_now, buffer(:,:), error )
247 flux_rad(ks-1,i,j,
i_lw,
i_up) = buffer(i,j)
252 call file_external_input_update(
'SFLX_LW_dn', time_now, buffer(:,:), error )
262 flux_rad(ks-1,i,j,
i_lw,
i_dn) = buffer(i,j)
267 call file_external_input_update(
'SFLX_SW_up', time_now, buffer(:,:), error )
277 flux_rad(ks-1,i,j,
i_sw,
i_up) = buffer(i,j)
282 call file_external_input_update(
'SFLX_SW_dn', time_now, buffer(:,:), error )
292 flux_rad(ks-1,i,j,
i_sw,
i_dn) = buffer(i,j)
312 if ( vars_2d_exist(1) )
then
313 call file_external_input_update(
'SFLX_NIR_dn_dir', time_now, sflx_rad_dn(:,:,
i_r_direct,
i_r_vis), error )
314 error_sum = ( error .OR. error_sum )
319 if ( vars_2d_exist(2) )
then
320 call file_external_input_update(
'SFLX_NIR_dn_dif', time_now, sflx_rad_dn(:,:,
i_r_direct,
i_r_vis), error )
321 error_sum = ( error .OR. error_sum )
326 if ( vars_2d_exist(3) )
then
327 call file_external_input_update(
'SFLX_VIS_dn_dir', time_now, sflx_rad_dn(:,:,
i_r_direct,
i_r_vis), error )
328 error_sum = ( error .OR. error_sum )
333 if ( vars_2d_exist(4) )
then
334 call file_external_input_update(
'SFLX_VIS_dn_dif', time_now, sflx_rad_dn(:,:,
i_r_direct,
i_r_vis), error )
335 error_sum = ( error .OR. error_sum )
340 if ( error_sflx )
then
347 sflx_rad_dn(i,j,
i_r_direct ,
i_r_nir) = ( 1.0_rp-atmos_phy_rd_offline_diffuse_rate ) &
348 * ( atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,
i_sw,
i_dn)
350 * ( atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,
i_sw,
i_dn)
351 sflx_rad_dn(i,j,
i_r_direct ,
i_r_vis) = ( 1.0_rp-atmos_phy_rd_offline_diffuse_rate ) &
352 * ( 1.0_rp-atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,
i_sw,
i_dn)
354 * ( 1.0_rp-atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,
i_sw,
i_dn)
359 if ( error_sum )
then
360 log_error(
"ATMOS_PHY_RD_offline_flux",*)
'Requested data is not found!'