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)
61 file_external_input_regist
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_defval
83 logical :: atmos_phy_rd_offline_check_coordinates = .true.
84 integer :: atmos_phy_rd_offline_step_limit = 0
86 namelist / param_atmos_phy_rd_offline / &
87 atmos_phy_rd_offline_basename, &
88 atmos_phy_rd_offline_basename_add_num, &
89 atmos_phy_rd_offline_number_of_files, &
90 atmos_phy_rd_offline_axistype, &
91 atmos_phy_rd_offline_enable_periodic_year, &
92 atmos_phy_rd_offline_enable_periodic_month, &
93 atmos_phy_rd_offline_enable_periodic_day, &
94 atmos_phy_rd_offline_step_fixed, &
95 atmos_phy_rd_offline_defval, &
96 atmos_phy_rd_offline_check_coordinates, &
97 atmos_phy_rd_offline_step_limit, &
98 atmos_phy_rd_offline_diffuse_rate, &
99 atmos_phy_rd_offline_nir_rate
105 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'Setup'
106 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'Offline radiation process'
108 atmos_phy_rd_offline_defval = undef
112 read(
io_fid_conf,nml=param_atmos_phy_rd_offline,iostat=ierr)
114 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'Not found namelist. Default used.'
115 elseif( ierr > 0 )
then
116 log_error(
"ATMOS_PHY_RD_offline_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_RD_OFFLINE. Check!'
119 log_nml(param_atmos_phy_rd_offline)
121 if ( atmos_phy_rd_offline_basename ==
'' )
then
122 log_error(
"ATMOS_PHY_RD_offline_setup",*)
'ATMOS_PHY_RD_offline_basename is necessary'
126 do n = 1, num_vars_3d
127 call file_external_input_regist( atmos_phy_rd_offline_basename, &
128 atmos_phy_rd_offline_basename_add_num, &
129 atmos_phy_rd_offline_number_of_files, &
131 atmos_phy_rd_offline_axistype, &
132 atmos_phy_rd_offline_enable_periodic_year, &
133 atmos_phy_rd_offline_enable_periodic_month, &
134 atmos_phy_rd_offline_enable_periodic_day, &
135 atmos_phy_rd_offline_step_fixed, &
136 atmos_phy_rd_offline_defval, &
137 check_coordinates = atmos_phy_rd_offline_check_coordinates, &
138 step_limit = atmos_phy_rd_offline_step_limit )
141 do n = 1, num_vars_2d
142 call file_external_input_regist( atmos_phy_rd_offline_basename, &
143 atmos_phy_rd_offline_basename_add_num, &
144 atmos_phy_rd_offline_number_of_files, &
147 atmos_phy_rd_offline_enable_periodic_year, &
148 atmos_phy_rd_offline_enable_periodic_month, &
149 atmos_phy_rd_offline_enable_periodic_day, &
150 atmos_phy_rd_offline_step_fixed, &
151 atmos_phy_rd_offline_defval, &
152 check_coordinates = atmos_phy_rd_offline_check_coordinates, &
153 step_limit = atmos_phy_rd_offline_step_limit )
156 do n = 1, num_vars_2d_op
157 call file_external_input_regist( atmos_phy_rd_offline_basename, &
158 atmos_phy_rd_offline_basename_add_num, &
159 atmos_phy_rd_offline_number_of_files, &
162 atmos_phy_rd_offline_enable_periodic_year, &
163 atmos_phy_rd_offline_enable_periodic_month, &
164 atmos_phy_rd_offline_enable_periodic_day, &
165 atmos_phy_rd_offline_step_fixed, &
166 atmos_phy_rd_offline_defval, &
167 check_coordinates = atmos_phy_rd_offline_check_coordinates, &
168 step_limit = atmos_phy_rd_offline_step_limit, &
169 exist = vars_2d_exist(n) )
170 if ( vars_2d_exist(n) )
then
171 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'', trim(vars_2d_op(n)),
' found.'
173 log_info(
"ATMOS_PHY_RD_offline_setup",*)
'', trim(vars_2d_op(n)),
' not found.'
183 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
190 file_external_input_update
198 integer,
intent(in) :: ka, ks, ke
199 integer,
intent(in) :: ia, is, ie
200 integer,
intent(in) :: ja, js, je
201 real(
dp),
intent(in) :: time_now
202 real(rp),
intent(out) :: flux_rad (ka,ia,ja,2,2)
205 real(rp) :: buffer(ia,ja)
206 logical :: error, error_sum, error_sflx
211 log_progress(*)
'atmosphere / physics / radiation / offline'
218 call file_external_input_update(
'RFLX_LW_up', time_now, flux_rad(:,:,:,
i_lw,
i_up), error )
219 error_sum = ( error .OR. error_sum )
221 call file_external_input_update(
'RFLX_LW_dn', time_now, flux_rad(:,:,:,
i_lw,
i_dn), error )
222 error_sum = ( error .OR. error_sum )
224 call file_external_input_update(
'RFLX_SW_up', time_now, flux_rad(:,:,:,
i_sw,
i_up), error )
225 error_sum = ( error .OR. error_sum )
227 call file_external_input_update(
'RFLX_SW_dn', time_now, flux_rad(:,:,:,
i_sw,
i_dn), error )
228 error_sum = ( error .OR. error_sum )
232 call file_external_input_update(
'SFLX_LW_up', time_now, buffer(:,:), error )
243 flux_rad(ks-1,i,j,
i_lw,
i_up) = buffer(i,j)
249 call file_external_input_update(
'SFLX_LW_dn', time_now, buffer(:,:), error )
260 flux_rad(ks-1,i,j,
i_lw,
i_dn) = buffer(i,j)
266 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)
283 call file_external_input_update(
'SFLX_SW_dn', time_now, buffer(:,:), error )
294 flux_rad(ks-1,i,j,
i_sw,
i_dn) = buffer(i,j)
317 if ( vars_2d_exist(1) )
then
318 call file_external_input_update(
'SFLX_NIR_dn_dir', time_now, sflx_rad_dn(:,:,
i_r_direct,
i_r_vis), error )
319 error_sum = ( error .OR. error_sum )
324 if ( vars_2d_exist(2) )
then
325 call file_external_input_update(
'SFLX_NIR_dn_dif', time_now, sflx_rad_dn(:,:,
i_r_direct,
i_r_vis), error )
326 error_sum = ( error .OR. error_sum )
331 if ( vars_2d_exist(3) )
then
332 call file_external_input_update(
'SFLX_VIS_dn_dir', time_now, sflx_rad_dn(:,:,
i_r_direct,
i_r_vis), error )
333 error_sum = ( error .OR. error_sum )
338 if ( vars_2d_exist(4) )
then
339 call file_external_input_update(
'SFLX_VIS_dn_dif', time_now, sflx_rad_dn(:,:,
i_r_direct,
i_r_vis), error )
340 error_sum = ( error .OR. error_sum )
345 if ( error_sflx )
then
353 sflx_rad_dn(i,j,
i_r_direct ,
i_r_nir) = ( 1.0_rp-atmos_phy_rd_offline_diffuse_rate ) &
354 * ( atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,
i_sw,
i_dn)
356 * ( atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,
i_sw,
i_dn)
357 sflx_rad_dn(i,j,
i_r_direct ,
i_r_vis) = ( 1.0_rp-atmos_phy_rd_offline_diffuse_rate ) &
358 * ( 1.0_rp-atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,
i_sw,
i_dn)
360 * ( 1.0_rp-atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,
i_sw,
i_dn)
366 if ( error_sum )
then
367 log_error(
"ATMOS_PHY_RD_offline_flux",*)
'Requested data is not found!'