SCALE-RM
Functions/Subroutines
scale_atmos_phy_rd_offline Module Reference

module atmosphere / physics / radiation / offline More...

Functions/Subroutines

subroutine, public atmos_phy_rd_offline_setup
 Setup. More...
 
subroutine, public atmos_phy_rd_offline_flux (KA, KS, KE, IA, IS, IE, JA, JS, JE, time_now, flux_rad, SFLX_rad_dn)
 Radiation main. More...
 

Detailed Description

module atmosphere / physics / radiation / offline

Description
Atmospheric radiation transfer process for offline usage (input radiation flux from the file)
Author
Team SCALE
NAMELIST
  • PARAM_ATMOS_PHY_RD_OFFLINE
    nametypedefault valuecomment
    ATMOS_PHY_RD_OFFLINE_BASENAME character(len=H_LONG) ''
    ATMOS_PHY_RD_OFFLINE_BASENAME_ADD_NUM logical .false.
    ATMOS_PHY_RD_OFFLINE_NUMBER_OF_FILES integer 1
    ATMOS_PHY_RD_OFFLINE_AXISTYPE character(len=H_SHORT) 'XYZ'
    ATMOS_PHY_RD_OFFLINE_ENABLE_PERIODIC_YEAR logical .false.
    ATMOS_PHY_RD_OFFLINE_ENABLE_PERIODIC_MONTH logical .false.
    ATMOS_PHY_RD_OFFLINE_ENABLE_PERIODIC_DAY logical .false.
    ATMOS_PHY_RD_OFFLINE_STEP_FIXED integer 0
    ATMOS_PHY_RD_OFFLINE_OFFSET real(RP) 0.0_RP
    ATMOS_PHY_RD_OFFLINE_DEFVAL real(RP) = UNDEF
    ATMOS_PHY_RD_OFFLINE_CHECK_COORDINATES logical .true.
    ATMOS_PHY_RD_OFFLINE_STEP_LIMIT integer 0
    ATMOS_PHY_RD_OFFLINE_DIFFUSE_RATE real(RP) 0.5_RP
    ATMOS_PHY_RD_OFFLINE_NIR_RATE real(RP) 0.5_RP

History Output
No history output

Function/Subroutine Documentation

◆ atmos_phy_rd_offline_setup()

subroutine, public scale_atmos_phy_rd_offline::atmos_phy_rd_offline_setup

Setup.

Definition at line 58 of file scale_atmos_phy_rd_offline.F90.

58  use scale_prc, only: &
59  prc_abort
60  use scale_file_external_input, only: &
62  use scale_const, only: &
63  undef => const_undef
64  implicit none
65 
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)
69 
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' /
73 
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 ! = UNDEF
84  logical :: ATMOS_PHY_RD_offline_check_coordinates = .true.
85  integer :: ATMOS_PHY_RD_offline_step_limit = 0
86 
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
102 
103  integer :: n, ierr
104  !---------------------------------------------------------------------------
105 
106  log_newline
107  log_info("ATMOS_PHY_RD_offline_setup",*) 'Setup'
108  log_info("ATMOS_PHY_RD_offline_setup",*) 'Offline radiation process'
109 
110  atmos_phy_rd_offline_defval = undef
111 
112  !--- read namelist
113  rewind(io_fid_conf)
114  read(io_fid_conf,nml=param_atmos_phy_rd_offline,iostat=ierr)
115  if( ierr < 0 ) then !--- missing
116  log_info("ATMOS_PHY_RD_offline_setup",*) 'Not found namelist. Default used.'
117  elseif( ierr > 0 ) then !--- fatal error
118  log_error("ATMOS_PHY_RD_offline_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_RD_OFFLINE. Check!'
119  call prc_abort
120  endif
121  log_nml(param_atmos_phy_rd_offline)
122 
123  if ( atmos_phy_rd_offline_basename == '' ) then
124  log_error("ATMOS_PHY_RD_offline_setup",*) 'ATMOS_PHY_RD_offline_basename is necessary'
125  call prc_abort
126  end if
127 
128  do n = 1, num_vars_3d
129  call file_external_input_regist( atmos_phy_rd_offline_basename, & ! [IN]
130  atmos_phy_rd_offline_basename_add_num, & ! [IN]
131  atmos_phy_rd_offline_number_of_files, & ! [IN]
132  vars_3d(n), & ! [IN]
133  atmos_phy_rd_offline_axistype, & ! [IN]
134  atmos_phy_rd_offline_enable_periodic_year, & ! [IN]
135  atmos_phy_rd_offline_enable_periodic_month, & ! [IN]
136  atmos_phy_rd_offline_enable_periodic_day, & ! [IN]
137  atmos_phy_rd_offline_step_fixed, & ! [IN]
138  atmos_phy_rd_offline_offset, & ! [IN]
139  atmos_phy_rd_offline_defval, & ! [IN]
140  check_coordinates = atmos_phy_rd_offline_check_coordinates, & ! [IN]
141  step_limit = atmos_phy_rd_offline_step_limit ) ! [IN]
142  end do
143 
144  do n = 1, num_vars_2d
145  call file_external_input_regist( atmos_phy_rd_offline_basename, & ! [IN]
146  atmos_phy_rd_offline_basename_add_num, & ! [IN]
147  atmos_phy_rd_offline_number_of_files, & ! [IN]
148  vars_2d(n), & ! [IN]
149  'XY', & ! [IN]
150  atmos_phy_rd_offline_enable_periodic_year, & ! [IN]
151  atmos_phy_rd_offline_enable_periodic_month, & ! [IN]
152  atmos_phy_rd_offline_enable_periodic_day, & ! [IN]
153  atmos_phy_rd_offline_step_fixed, & ! [IN]
154  atmos_phy_rd_offline_offset, & ! [IN]
155  atmos_phy_rd_offline_defval, & ! [IN]
156  check_coordinates = atmos_phy_rd_offline_check_coordinates, & ! [IN]
157  step_limit = atmos_phy_rd_offline_step_limit ) ! [IN]
158  end do
159 
160  do n = 1, num_vars_2d_op
161  call file_external_input_regist( atmos_phy_rd_offline_basename, & ! [IN]
162  atmos_phy_rd_offline_basename_add_num, & ! [IN]
163  atmos_phy_rd_offline_number_of_files, & ! [IN]
164  vars_2d_op(n), & ! [IN]
165  'XY', & ! [IN]
166  atmos_phy_rd_offline_enable_periodic_year, & ! [IN]
167  atmos_phy_rd_offline_enable_periodic_month, & ! [IN]
168  atmos_phy_rd_offline_enable_periodic_day, & ! [IN]
169  atmos_phy_rd_offline_step_fixed, & ! [IN]
170  atmos_phy_rd_offline_offset, & ! [IN]
171  atmos_phy_rd_offline_defval, & ! [IN]
172  check_coordinates = atmos_phy_rd_offline_check_coordinates, & ! [IN]
173  step_limit = atmos_phy_rd_offline_step_limit, & ! [IN]
174  exist = vars_2d_exist(n) ) ! [OUT]
175  if ( vars_2d_exist(n) ) then
176  log_info("ATMOS_PHY_RD_offline_setup",*) '', trim(vars_2d_op(n)), ' found.'
177  else
178  log_info("ATMOS_PHY_RD_offline_setup",*) '', trim(vars_2d_op(n)), ' not found.'
179  end if
180  end do
181 
182  return

References scale_const::const_undef, scale_file_external_input::file_external_input_regist(), scale_io::io_fid_conf, and scale_prc::prc_abort().

Referenced by mod_atmos_phy_rd_driver::atmos_phy_rd_driver_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_phy_rd_offline_flux()

subroutine, public scale_atmos_phy_rd_offline::atmos_phy_rd_offline_flux ( integer, intent(in)  KA,
integer, intent(in)  KS,
integer, intent(in)  KE,
integer, intent(in)  IA,
integer, intent(in)  IS,
integer, intent(in)  IE,
integer, intent(in)  JA,
integer, intent(in)  JS,
integer, intent(in)  JE,
real(dp), intent(in)  time_now,
real(rp), dimension (ka,ia,ja,2,2), intent(out)  flux_rad,
real(rp), dimension(ia,ja,n_rad_dir,n_rad_rgn), intent(out)  SFLX_rad_dn 
)

Radiation main.

Definition at line 192 of file scale_atmos_phy_rd_offline.F90.

192  use scale_prc, only: &
193  prc_abort
194  use scale_file_external_input, only: &
195  file_external_input_update
196  use scale_atmos_phy_rd_common, only: &
197  i_sw, &
198  i_lw, &
199  i_dn, &
200  i_up
201  implicit none
202 
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)
208  real(RP), intent(out) :: SFLX_rad_dn(IA,JA,N_RAD_DIR,N_RAD_RGN)
209 
210  real(RP) :: buffer(IA,JA)
211  logical :: error, error_sum, error_sflx
212 
213  integer :: i, j
214  !---------------------------------------------------------------------------
215 
216  log_progress(*) 'atmosphere / physics / radiation / offline'
217 
218  ! [note] external data input is now support only SCALE-RM
219 
220  error_sum = .false.
221 
222  ! 3D
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 )
225 
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 )
228 
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 )
231 
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 )
234 
235 
236  ! 2D
237  call file_external_input_update( 'SFLX_LW_up', time_now, buffer(:,:), error )
238  if ( error ) then
239  error_sum = .true.
240  else
241  !$omp parallel do default(none) OMP_SCHEDULE_ &
242  !$omp private(i,j) &
243  !$omp shared(KS,IS,IE,JS,JE) &
244  !$omp shared(flux_rad,buffer)
245  do j = js, je
246  do i = is, ie
247  flux_rad(ks-1,i,j,i_lw,i_up) = buffer(i,j)
248  end do
249  end do
250  end if
251 
252  call file_external_input_update( 'SFLX_LW_dn', time_now, buffer(:,:), error )
253  if ( error ) then
254  error_sum = .true.
255  else
256  !$omp parallel do default(none) OMP_SCHEDULE_ &
257  !$omp private(i,j) &
258  !$omp shared(KS,IS,IE,JS,JE) &
259  !$omp shared(flux_rad,buffer)
260  do j = js, je
261  do i = is, ie
262  flux_rad(ks-1,i,j,i_lw,i_dn) = buffer(i,j)
263  end do
264  end do
265  end if
266 
267  call file_external_input_update( 'SFLX_SW_up', time_now, buffer(:,:), error )
268  if ( error ) then
269  error_sum = .true.
270  else
271  !$omp parallel do default(none) OMP_SCHEDULE_ &
272  !$omp private(i,j) &
273  !$omp shared(KS,IS,IE,JS,JE) &
274  !$omp shared(flux_rad,buffer)
275  do j = js, je
276  do i = is, ie
277  flux_rad(ks-1,i,j,i_sw,i_up) = buffer(i,j)
278  end do
279  end do
280  end if
281 
282  call file_external_input_update( 'SFLX_SW_dn', time_now, buffer(:,:), error )
283  if ( error ) then
284  error_sum = .true.
285  else
286  !$omp parallel do default(none) OMP_SCHEDULE_ &
287  !$omp private(i,j) &
288  !$omp shared(KS,IS,IE,JS,JE) &
289  !$omp shared(flux_rad,buffer)
290  do j = js, je
291  do i = is, ie
292  flux_rad(ks-1,i,j,i_sw,i_dn) = buffer(i,j)
293  end do
294  end do
295  end if
296 
297  !$omp parallel do default(none) OMP_SCHEDULE_ &
298  !$omp private(i,j) &
299  !$omp shared(KS,IS,IE,JS,JE,ATMOS_PHY_RD_offline_diffuse_rate) &
300  !$omp shared(SFLX_rad_dn,flux_rad)
301  do j = js, je
302  do i = is, ie
303  sflx_rad_dn(i,j,i_r_direct ,i_r_ir) = 0.0_rp
304  sflx_rad_dn(i,j,i_r_diffuse,i_r_ir) = flux_rad(ks-1,i,j,i_lw,i_dn)
305  end do
306  end do
307 
308  ! 2D optional
309 
310  error_sflx = .false.
311 
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 )
315  else
316  error_sflx = .true.
317  endif
318 
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 )
322  else
323  error_sflx = .true.
324  endif
325 
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 )
329  else
330  error_sflx = .true.
331  endif
332 
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 )
336  else
337  error_sflx = .true.
338  endif
339 
340  if ( error_sflx ) then ! reconstruct from lowermost SW flux
341  !$omp parallel do default(none) OMP_SCHEDULE_ &
342  !$omp private(i,j) &
343  !$omp shared(KS,IS,IE,JS,JE,ATMOS_PHY_RD_offline_diffuse_rate,ATMOS_PHY_RD_offline_NIR_rate) &
344  !$omp shared(SFLX_rad_dn,flux_rad)
345  do j = js, je
346  do i = is, ie
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)
349  sflx_rad_dn(i,j,i_r_diffuse,i_r_nir) = ( atmos_phy_rd_offline_diffuse_rate ) &
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)
353  sflx_rad_dn(i,j,i_r_diffuse,i_r_vis) = ( atmos_phy_rd_offline_diffuse_rate ) &
354  * ( 1.0_rp-atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,i_sw,i_dn)
355  enddo
356  enddo
357  endif
358 
359  if ( error_sum ) then
360  log_error("ATMOS_PHY_RD_offline_flux",*) 'Requested data is not found!'
361  call prc_abort
362  endif
363 
364  return

References scale_atmos_phy_rd_common::i_dn, scale_atmos_phy_rd_common::i_lw, scale_cpl_sfc_index::i_r_diffuse, scale_cpl_sfc_index::i_r_direct, scale_cpl_sfc_index::i_r_ir, scale_cpl_sfc_index::i_r_nir, scale_cpl_sfc_index::i_r_vis, scale_atmos_phy_rd_common::i_sw, scale_atmos_phy_rd_common::i_up, and scale_prc::prc_abort().

Referenced by mod_atmos_phy_rd_driver::atmos_phy_rd_driver_calc_tendency().

Here is the call graph for this function:
Here is the caller graph for this function:
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:342
scale_file_external_input::file_external_input_regist
subroutine, public file_external_input_regist(basename, basename_add_num, number_of_files, varname, axistype, enable_periodic_year, enable_periodic_month, enable_periodic_day, step_fixed, offset, defval, check_coordinates, aggregate, allow_missing, step_limit, exist)
Regist data.
Definition: scale_file_external_input.F90:324
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_atmos_phy_rd_common
module atmosphere / physics / radiation / common
Definition: scale_atmos_phy_rd_common.F90:12
scale_file_external_input
module file / external_input
Definition: scale_file_external_input.F90:12
scale_const::const_undef
real(rp), public const_undef
Definition: scale_const.F90:41