SCALE-RM
scale_atmos_phy_ae_offline.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 !-------------------------------------------------------------------------------
11 #include "scalelib.h"
13  !-----------------------------------------------------------------------------
14  !
15  !++ used modules
16  !
17  use scale_precision
18  use scale_io
19  use scale_prof
20  use scale_atmos_aerosol, only: &
21  n_ae, &
22  i_a01, &
23  i_a02, &
24  i_a03, &
25  i_a04, &
26  i_a05, &
27  i_a06, &
28  i_a07
29  !-----------------------------------------------------------------------------
30  implicit none
31  private
32  !-----------------------------------------------------------------------------
33  !
34  !++ Public procedure
35  !
41 
42  !-----------------------------------------------------------------------------
43  !
44  !++ Public parameters & variables
45  !
46  !-----------------------------------------------------------------------------
47  !
48  !++ Private procedure
49  !
50  !-----------------------------------------------------------------------------
51  !
52  !++ Private parameters & variables
53  !
54  integer, private, parameter :: num_vars_3d = 8
55 
56  character(len=H_SHORT) :: vars_3d(num_vars_3d)
57 
58  data vars_3d / 'OUTQLD01', 'OUTQLD02', 'OUTQLD03', 'OUTQLD04', 'OUTQLD05', 'OUTQLD06', 'OUTQLD07', 'UNCCN' /
59 
60  real(RP), private :: const_value(num_vars_3d)
61 
62  !-----------------------------------------------------------------------------
63 contains
64  !-----------------------------------------------------------------------------
67  use scale_prc, only: &
68  prc_abort
69  use scale_file_external_input, only: &
71  use scale_const, only: &
72  undef => const_undef
73  implicit none
74 
75  character(len=H_LONG) :: atmos_phy_ae_offline_basename = ''
76  logical :: atmos_phy_ae_offline_basename_add_num = .false.
77  integer :: atmos_phy_ae_offline_number_of_files = 1
78  character(len=H_SHORT) :: atmos_phy_ae_offline_axistype = 'XYZ'
79  logical :: atmos_phy_ae_offline_enable_periodic_year = .false.
80  logical :: atmos_phy_ae_offline_enable_periodic_month = .false.
81  logical :: atmos_phy_ae_offline_enable_periodic_day = .false.
82  integer :: atmos_phy_ae_offline_step_fixed = 0
83  real(rp) :: atmos_phy_ae_offline_offset = 0.0_rp
84  real(rp) :: atmos_phy_ae_offline_defval ! = UNDEF
85  logical :: atmos_phy_ae_offline_check_coordinates = .true.
86  integer :: atmos_phy_ae_offline_step_limit = 0
87 
88  real(rp) :: atmos_phy_ae_offline_const_outqld01
89  real(rp) :: atmos_phy_ae_offline_const_outqld02
90  real(rp) :: atmos_phy_ae_offline_const_outqld03
91  real(rp) :: atmos_phy_ae_offline_const_outqld04
92  real(rp) :: atmos_phy_ae_offline_const_outqld05
93  real(rp) :: atmos_phy_ae_offline_const_outqld06
94  real(rp) :: atmos_phy_ae_offline_const_outqld07
95  real(rp) :: atmos_phy_ae_offline_const_unccn
96 
97  namelist / param_atmos_phy_ae_offline / &
98  atmos_phy_ae_offline_basename, &
99  atmos_phy_ae_offline_basename_add_num, &
100  atmos_phy_ae_offline_number_of_files, &
101  atmos_phy_ae_offline_axistype, &
102  atmos_phy_ae_offline_enable_periodic_year, &
103  atmos_phy_ae_offline_enable_periodic_month, &
104  atmos_phy_ae_offline_enable_periodic_day, &
105  atmos_phy_ae_offline_step_fixed, &
106  atmos_phy_ae_offline_offset, &
107  atmos_phy_ae_offline_defval, &
108  atmos_phy_ae_offline_check_coordinates, &
109  atmos_phy_ae_offline_step_limit, &
110  atmos_phy_ae_offline_const_outqld01, &
111  atmos_phy_ae_offline_const_outqld02, &
112  atmos_phy_ae_offline_const_outqld03, &
113  atmos_phy_ae_offline_const_outqld04, &
114  atmos_phy_ae_offline_const_outqld05, &
115  atmos_phy_ae_offline_const_outqld06, &
116  atmos_phy_ae_offline_const_outqld07, &
117  atmos_phy_ae_offline_const_unccn
118 
119  integer :: n, ierr
120  !---------------------------------------------------------------------------
121 
122  log_newline
123  log_info("ATMOS_PHY_AE_offline_setup",*) 'Setup'
124  log_info("ATMOS_PHY_AE_offline_setup",*) 'Kajino(2013) scheme'
125 
126  atmos_phy_ae_offline_defval = undef
127 
128  atmos_phy_ae_offline_const_outqld01 = undef
129  atmos_phy_ae_offline_const_outqld02 = undef
130  atmos_phy_ae_offline_const_outqld03 = undef
131  atmos_phy_ae_offline_const_outqld04 = undef
132  atmos_phy_ae_offline_const_outqld05 = undef
133  atmos_phy_ae_offline_const_outqld06 = undef
134  atmos_phy_ae_offline_const_outqld07 = undef
135  atmos_phy_ae_offline_const_unccn = undef
136 
137  !--- read namelist
138  rewind(io_fid_conf)
139  read(io_fid_conf,nml=param_atmos_phy_ae_offline,iostat=ierr)
140  if( ierr < 0 ) then !--- missing
141  log_info("ATMOS_PHY_AE_offline_setup",*) 'Not found namelist. Default used.'
142  elseif( ierr > 0 ) then !--- fatal error
143  log_error("ATMOS_PHY_AE_offline_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_AE_offline. Check!'
144  call prc_abort
145  endif
146  log_nml(param_atmos_phy_ae_offline)
147 
148  const_value(1) = atmos_phy_ae_offline_const_outqld01
149  const_value(2) = atmos_phy_ae_offline_const_outqld02
150  const_value(3) = atmos_phy_ae_offline_const_outqld03
151  const_value(4) = atmos_phy_ae_offline_const_outqld04
152  const_value(5) = atmos_phy_ae_offline_const_outqld05
153  const_value(6) = atmos_phy_ae_offline_const_outqld06
154  const_value(7) = atmos_phy_ae_offline_const_outqld07
155  const_value(8) = atmos_phy_ae_offline_const_unccn
156 
157  do n = 1, num_vars_3d
158 
159  if ( const_value(n) < undef*0.1 ) then ! read from external file
160 
161  if ( atmos_phy_ae_offline_basename /= '' ) then
162  call file_external_input_regist( atmos_phy_ae_offline_basename, & ! [IN]
163  atmos_phy_ae_offline_basename_add_num, & ! [IN]
164  atmos_phy_ae_offline_number_of_files, & ! [IN]
165  vars_3d(n), & ! [IN]
166  atmos_phy_ae_offline_axistype, & ! [IN]
167  atmos_phy_ae_offline_enable_periodic_year, & ! [IN]
168  atmos_phy_ae_offline_enable_periodic_month, & ! [IN]
169  atmos_phy_ae_offline_enable_periodic_day, & ! [IN]
170  atmos_phy_ae_offline_step_fixed, & ! [IN]
171  atmos_phy_ae_offline_offset, & ! [IN]
172  atmos_phy_ae_offline_defval, & ! [IN]
173  check_coordinates = atmos_phy_ae_offline_check_coordinates, & ! [IN]
174  step_limit = atmos_phy_ae_offline_step_limit ) ! [IN]
175  endif
176 
177  else ! set constant value
178 
179  log_info("ATMOS_PHY_AE_offline_setup",*) &
180  'Constant value is set for ', trim(vars_3d(n)), ', value = ', const_value(n)
181 
182  endif
183 
184  enddo
185 
186  return
187  end subroutine atmos_phy_ae_offline_setup
188 
189  !-----------------------------------------------------------------------------
191  subroutine atmos_phy_ae_offline_tendency( &
192  KA, KS, KE, &
193  IA, IS, IE, &
194  JA, JS, JE, &
195  time_now, &
196  CCN )
197  use scale_prc, only: &
198  prc_abort
199  use scale_file_external_input, only: &
200  file_external_input_update
201  use scale_const, only: &
202  undef => const_undef
203  implicit none
204 
205  integer, intent(in) :: ka, ks, ke
206  integer, intent(in) :: ia, is, ie
207  integer, intent(in) :: ja, js, je
208  real(dp), intent(in) :: time_now
209  real(rp), intent(out) :: ccn(ka,ia,ja)
210 
211  logical :: error
212  integer :: n
213  !---------------------------------------------------------------------------
214 
215  log_progress(*) 'atmosphere / physics / aerosol / offline'
216 
217  n = 8 ! UNCCN
218 
219  if ( const_value(n) < undef*0.1 ) then ! read from external file
220 
221  call file_external_input_update( vars_3d(n), time_now, ccn(:,:,:), error )
222  if ( error ) then
223  log_error("ATMOS_PHY_AE_offline_flux",*) 'Requested data is not found! ', trim(vars_3d(n))
224  call prc_abort
225  endif
226 
227  else ! set constant value
228 
229  ccn(:,:,:) = const_value(n)
230 
231  endif
232 
233  return
234  end subroutine atmos_phy_ae_offline_tendency
235 
236  !-----------------------------------------------------------------------------
239  KA, IA, JA, &
240  RH, &
241  Re )
242  implicit none
243 
244  integer, intent(in) :: ka, ia, ja
245  real(rp), intent(in) :: rh(ka,ia,ja) ! relative humidity [%]
246  real(rp), intent(out) :: re(ka,ia,ja,n_ae) ! effective radius
247 
248  real(rp), parameter :: ae_re(n_ae) = & ! aerosol radius [m]
249  (/ 1.6e-6_rp, & ! Soil dust
250  -1.0_rp, & ! Carbonacerous (BC/OC=0.3)
251  -1.0_rp, & ! Carbonacerous (BC/OC=0.15)
252  -1.0_rp, & ! Carbonacerous (BC/OC=0.)
253  4.e-8_rp, & ! Black carbon
254  -1.0_rp, & ! Sulfate
255  -1.0_rp /) ! Sea salt
256 
257  integer :: iaero
258  !---------------------------------------------------------------------------
259 
260  do iaero = 1, n_ae
261 
262  if ( ae_re(iaero) < 0.0_rp ) then ! hygroscopic particle : look-up table is based on the RH
263 
264  re(:,:,:,iaero) = rh(:,:,:) * 1.e-2_rp
265 
266  else ! non-hygroscopic particle : look-up table is the effective radius
267 
268  re(:,:,:,iaero) = ae_re(iaero) * 100.0_rp ! [m=>cm]
269 
270  endif
271 
272  enddo
273 
274  return
276 
277  !-----------------------------------------------------------------------------
279  subroutine atmos_phy_ae_offline_qtrc2qaero( &
280  KA, IA, JA, &
281  time_now, &
282  Qe )
283  use scale_prc, only: &
284  prc_abort
285  use scale_file_external_input, only: &
286  file_external_input_update
287  use scale_const, only: &
288  undef => const_undef
289  implicit none
290 
291  integer, intent(in) :: ka, ia, ja
292  real(dp), intent(in) :: time_now
293  real(rp), intent(out) :: qe(ka,ia,ja,n_ae) ! aerosol mixing ratio [kg/kg]
294 
295  logical :: error, error_sum
296  integer :: n, iaero
297  !---------------------------------------------------------------------------
298 
299  error_sum = .false.
300 
301  do n = 1, num_vars_3d-1
302  iaero = n
303 
304  if ( const_value(n) < undef*0.1 ) then ! read from external file
305 
306  call file_external_input_update( vars_3d(n), time_now, qe(:,:,:,iaero), error )
307  error_sum = ( error .OR. error_sum )
308 
309  else ! set constant value
310 
311  qe(:,:,:,iaero) = const_value(n)
312 
313  endif
314 
315  enddo
316 
317  if ( error_sum ) then
318  log_error("ATMOS_PHY_AE_offline_flux",*) 'Requested data is not found!'
319  call prc_abort
320  endif
321 
322  return
323  end subroutine atmos_phy_ae_offline_qtrc2qaero
324 
325  !-----------------------------------------------------------------------------
326  subroutine atmos_phy_ae_offline_mkinit( &
327  KA, KS, KE, &
328  IA, IS, IE, &
329  JA, JS, JE, &
330  ccn_init, &
331  CCN )
332  use scale_const, only: &
333  undef => const_undef
334  implicit none
335 
336  integer, intent(in) :: ka, ks, ke
337  integer, intent(in) :: ia, is, ie
338  integer, intent(in) :: ja, js, je
339  real(rp), intent(in) :: ccn_init
340  real(rp), intent(out) :: ccn(ka,ia,ja)
341 
342  integer :: n
343  !---------------------------------------------------------------------------
344 
346 
347  n = 8 ! UNCCN
348 
349  if ( const_value(n) < undef*0.1 ) then ! read from external file
350 
351  ccn(:,:,:) = ccn_init
352 
353  else ! set constant value
354 
355  ccn(:,:,:) = const_value(n)
356 
357  endif
358 
359  return
360  end subroutine atmos_phy_ae_offline_mkinit
361 
scale_atmos_grid_cartesc_index::ke
integer, public ke
end point of inner domain: z, local
Definition: scale_atmos_grid_cartesC_index.F90:52
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_precision
module PRECISION
Definition: scale_precision.F90:14
scale_atmos_grid_cartesc_index::ka
integer, public ka
Definition: scale_atmos_grid_cartesC_index.F90:47
scale_atmos_aerosol::n_ae
integer, parameter, public n_ae
Definition: scale_atmos_aerosol.F90:33
scale_atmos_aerosol::i_a02
integer, parameter, public i_a02
Definition: scale_atmos_aerosol.F90:35
scale_atmos_aerosol::i_a04
integer, parameter, public i_a04
Definition: scale_atmos_aerosol.F90:37
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_atmos_grid_cartesc_index::ie
integer, public ie
end point of inner domain: x, local
Definition: scale_atmos_grid_cartesC_index.F90:54
scale_io
module STDIO
Definition: scale_io.F90:10
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_atmos_grid_cartesc_index::ia
integer, public ia
Definition: scale_atmos_grid_cartesC_index.F90:48
scale_atmos_phy_ae_offline::atmos_phy_ae_offline_effective_radius
subroutine, public atmos_phy_ae_offline_effective_radius(KA, IA, JA, RH, Re)
Calculate Effective Radius.
Definition: scale_atmos_phy_ae_offline.F90:242
scale_atmos_aerosol::i_a03
integer, parameter, public i_a03
Definition: scale_atmos_aerosol.F90:36
scale_atmos_phy_ae_offline::atmos_phy_ae_offline_mkinit
subroutine, public atmos_phy_ae_offline_mkinit(KA, KS, KE, IA, IS, IE, JA, JS, JE, ccn_init, CCN)
Definition: scale_atmos_phy_ae_offline.F90:332
scale_prof
module profiler
Definition: scale_prof.F90:11
scale_atmos_phy_ae_offline::atmos_phy_ae_offline_setup
subroutine, public atmos_phy_ae_offline_setup
Setup.
Definition: scale_atmos_phy_ae_offline.F90:67
scale_atmos_phy_ae_offline::atmos_phy_ae_offline_tendency
subroutine, public atmos_phy_ae_offline_tendency(KA, KS, KE, IA, IS, IE, JA, JS, JE, time_now, CCN)
Aerosol Microphysics.
Definition: scale_atmos_phy_ae_offline.F90:197
scale_atmos_grid_cartesc_index::is
integer, public is
start point of inner domain: x, local
Definition: scale_atmos_grid_cartesC_index.F90:53
scale_atmos_aerosol::i_a06
integer, parameter, public i_a06
Definition: scale_atmos_aerosol.F90:39
scale_atmos_phy_ae_offline
module atmosphere / physics / aerosol / offline
Definition: scale_atmos_phy_ae_offline.F90:12
scale_precision::dp
integer, parameter, public dp
Definition: scale_precision.F90:32
scale_atmos_aerosol::i_a07
integer, parameter, public i_a07
Definition: scale_atmos_aerosol.F90:40
scale_atmos_grid_cartesc_index::ja
integer, public ja
Definition: scale_atmos_grid_cartesC_index.F90:49
scale_atmos_aerosol
module atmosphere / aerosol
Definition: scale_atmos_aerosol.F90:12
scale_atmos_aerosol::i_a05
integer, parameter, public i_a05
Definition: scale_atmos_aerosol.F90:38
scale_atmos_grid_cartesc_index::ks
integer, public ks
start point of inner domain: z, local
Definition: scale_atmos_grid_cartesC_index.F90:51
scale_atmos_phy_ae_offline::atmos_phy_ae_offline_qtrc2qaero
subroutine, public atmos_phy_ae_offline_qtrc2qaero(KA, IA, JA, time_now, Qe)
Calculate Effective Radius.
Definition: scale_atmos_phy_ae_offline.F90:283
scale_atmos_grid_cartesc_index::js
integer, public js
start point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:55
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
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:56
scale_atmos_grid_cartesc_index::je
integer, public je
end point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:56
scale_atmos_aerosol::i_a01
integer, parameter, public i_a01
Definition: scale_atmos_aerosol.F90:34