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

References scale_const::const_undef, 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 187 of file scale_atmos_phy_rd_offline.F90.

187  use scale_prc, only: &
188  prc_abort
189  use scale_file_external_input, only: &
190  file_external_input_update
191  use scale_atmos_phy_rd_common, only: &
192  i_sw, &
193  i_lw, &
194  i_dn, &
195  i_up
196  implicit none
197 
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)
203  real(RP), intent(out) :: SFLX_rad_dn(IA,JA,N_RAD_DIR,N_RAD_RGN)
204 
205  real(RP) :: buffer(IA,JA)
206  logical :: error, error_sum, error_sflx
207 
208  integer :: i, j
209  !---------------------------------------------------------------------------
210 
211  log_progress(*) 'atmosphere / physics / radiation / offline'
212 
213  ! [note] external data input is now support only SCALE-RM
214 
215  error_sum = .false.
216 
217  ! 3D
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 )
220 
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 )
223 
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 )
226 
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 )
229 
230 
231  ! 2D
232  call file_external_input_update( 'SFLX_LW_up', time_now, buffer(:,:), error )
233  if ( error ) then
234  error_sum = .true.
235  else
236  !$omp parallel do default(none) OMP_SCHEDULE_ &
237  !$omp private(i,j) &
238  !$omp shared(KS,IS,IE,JS,JE) &
239  !$omp shared(flux_rad,buffer)
240  !$acc kernels
241  do j = js, je
242  do i = is, ie
243  flux_rad(ks-1,i,j,i_lw,i_up) = buffer(i,j)
244  end do
245  end do
246  !$acc end kernels
247  end if
248 
249  call file_external_input_update( 'SFLX_LW_dn', time_now, buffer(:,:), error )
250  if ( error ) then
251  error_sum = .true.
252  else
253  !$omp parallel do default(none) OMP_SCHEDULE_ &
254  !$omp private(i,j) &
255  !$omp shared(KS,IS,IE,JS,JE) &
256  !$omp shared(flux_rad,buffer)
257  !$acc kernels
258  do j = js, je
259  do i = is, ie
260  flux_rad(ks-1,i,j,i_lw,i_dn) = buffer(i,j)
261  end do
262  end do
263  !$acc end kernels
264  end if
265 
266  call file_external_input_update( 'SFLX_SW_up', time_now, buffer(:,:), error )
267  if ( error ) then
268  error_sum = .true.
269  else
270  !$omp parallel do default(none) OMP_SCHEDULE_ &
271  !$omp private(i,j) &
272  !$omp shared(KS,IS,IE,JS,JE) &
273  !$omp shared(flux_rad,buffer)
274  !$acc kernels
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  !$acc end kernels
281  end if
282 
283  call file_external_input_update( 'SFLX_SW_dn', time_now, buffer(:,:), error )
284  if ( error ) then
285  error_sum = .true.
286  else
287  !$omp parallel do default(none) OMP_SCHEDULE_ &
288  !$omp private(i,j) &
289  !$omp shared(KS,IS,IE,JS,JE) &
290  !$omp shared(flux_rad,buffer)
291  !$acc kernels
292  do j = js, je
293  do i = is, ie
294  flux_rad(ks-1,i,j,i_sw,i_dn) = buffer(i,j)
295  end do
296  end do
297  !$acc end kernels
298  end if
299 
300  !$omp parallel do default(none) OMP_SCHEDULE_ &
301  !$omp private(i,j) &
302  !$omp shared(KS,IS,IE,JS,JE,ATMOS_PHY_RD_offline_diffuse_rate) &
303  !$omp shared(SFLX_rad_dn,flux_rad)
304  !$acc kernels
305  do j = js, je
306  do i = is, ie
307  sflx_rad_dn(i,j,i_r_direct ,i_r_ir) = 0.0_rp
308  sflx_rad_dn(i,j,i_r_diffuse,i_r_ir) = flux_rad(ks-1,i,j,i_lw,i_dn)
309  end do
310  end do
311  !$acc end kernels
312 
313  ! 2D optional
314 
315  error_sflx = .false.
316 
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 )
320  else
321  error_sflx = .true.
322  endif
323 
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 )
327  else
328  error_sflx = .true.
329  endif
330 
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 )
334  else
335  error_sflx = .true.
336  endif
337 
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 )
341  else
342  error_sflx = .true.
343  endif
344 
345  if ( error_sflx ) then ! reconstruct from lowermost SW flux
346  !$omp parallel do default(none) OMP_SCHEDULE_ &
347  !$omp private(i,j) &
348  !$omp shared(KS,IS,IE,JS,JE,ATMOS_PHY_RD_offline_diffuse_rate,ATMOS_PHY_RD_offline_NIR_rate) &
349  !$omp shared(SFLX_rad_dn,flux_rad)
350  !$acc kernels
351  do j = js, je
352  do i = is, ie
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)
355  sflx_rad_dn(i,j,i_r_diffuse,i_r_nir) = ( atmos_phy_rd_offline_diffuse_rate ) &
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)
359  sflx_rad_dn(i,j,i_r_diffuse,i_r_vis) = ( atmos_phy_rd_offline_diffuse_rate ) &
360  * ( 1.0_rp-atmos_phy_rd_offline_nir_rate ) * flux_rad(ks-1,i,j,i_sw,i_dn)
361  enddo
362  enddo
363  !$acc end kernels
364  endif
365 
366  if ( error_sum ) then
367  log_error("ATMOS_PHY_RD_offline_flux",*) 'Requested data is not found!'
368  call prc_abort
369  endif
370 
371  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:350
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:43