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: &
70  file_external_input_regist
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_defval ! = UNDEF
84  logical :: atmos_phy_ae_offline_check_coordinates = .true.
85  integer :: atmos_phy_ae_offline_step_limit = 0
86 
87  real(rp) :: atmos_phy_ae_offline_const_outqld01
88  real(rp) :: atmos_phy_ae_offline_const_outqld02
89  real(rp) :: atmos_phy_ae_offline_const_outqld03
90  real(rp) :: atmos_phy_ae_offline_const_outqld04
91  real(rp) :: atmos_phy_ae_offline_const_outqld05
92  real(rp) :: atmos_phy_ae_offline_const_outqld06
93  real(rp) :: atmos_phy_ae_offline_const_outqld07
94  real(rp) :: atmos_phy_ae_offline_const_unccn
95 
96  namelist / param_atmos_phy_ae_offline / &
97  atmos_phy_ae_offline_basename, &
98  atmos_phy_ae_offline_basename_add_num, &
99  atmos_phy_ae_offline_number_of_files, &
100  atmos_phy_ae_offline_axistype, &
101  atmos_phy_ae_offline_enable_periodic_year, &
102  atmos_phy_ae_offline_enable_periodic_month, &
103  atmos_phy_ae_offline_enable_periodic_day, &
104  atmos_phy_ae_offline_step_fixed, &
105  atmos_phy_ae_offline_defval, &
106  atmos_phy_ae_offline_check_coordinates, &
107  atmos_phy_ae_offline_step_limit, &
108  atmos_phy_ae_offline_const_outqld01, &
109  atmos_phy_ae_offline_const_outqld02, &
110  atmos_phy_ae_offline_const_outqld03, &
111  atmos_phy_ae_offline_const_outqld04, &
112  atmos_phy_ae_offline_const_outqld05, &
113  atmos_phy_ae_offline_const_outqld06, &
114  atmos_phy_ae_offline_const_outqld07, &
115  atmos_phy_ae_offline_const_unccn
116 
117  integer :: n, ierr
118  !---------------------------------------------------------------------------
119 
120  log_newline
121  log_info("ATMOS_PHY_AE_offline_setup",*) 'Setup'
122  log_info("ATMOS_PHY_AE_offline_setup",*) 'Kajino(2013) scheme'
123 
124  atmos_phy_ae_offline_defval = undef
125 
126  atmos_phy_ae_offline_const_outqld01 = undef
127  atmos_phy_ae_offline_const_outqld02 = undef
128  atmos_phy_ae_offline_const_outqld03 = undef
129  atmos_phy_ae_offline_const_outqld04 = undef
130  atmos_phy_ae_offline_const_outqld05 = undef
131  atmos_phy_ae_offline_const_outqld06 = undef
132  atmos_phy_ae_offline_const_outqld07 = undef
133  atmos_phy_ae_offline_const_unccn = undef
134 
135  !--- read namelist
136  rewind(io_fid_conf)
137  read(io_fid_conf,nml=param_atmos_phy_ae_offline,iostat=ierr)
138  if( ierr < 0 ) then !--- missing
139  log_info("ATMOS_PHY_AE_offline_setup",*) 'Not found namelist. Default used.'
140  elseif( ierr > 0 ) then !--- fatal error
141  log_error("ATMOS_PHY_AE_offline_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_AE_offline. Check!'
142  call prc_abort
143  endif
144  log_nml(param_atmos_phy_ae_offline)
145 
146  const_value(1) = atmos_phy_ae_offline_const_outqld01
147  const_value(2) = atmos_phy_ae_offline_const_outqld02
148  const_value(3) = atmos_phy_ae_offline_const_outqld03
149  const_value(4) = atmos_phy_ae_offline_const_outqld04
150  const_value(5) = atmos_phy_ae_offline_const_outqld05
151  const_value(6) = atmos_phy_ae_offline_const_outqld06
152  const_value(7) = atmos_phy_ae_offline_const_outqld07
153  const_value(8) = atmos_phy_ae_offline_const_unccn
154 
155  do n = 1, num_vars_3d
156 
157  if ( const_value(n) < undef*0.1 ) then ! read from external file
158 
159  if ( atmos_phy_ae_offline_basename /= '' ) then
160  call file_external_input_regist( atmos_phy_ae_offline_basename, & ! [IN]
161  atmos_phy_ae_offline_basename_add_num, & ! [IN]
162  atmos_phy_ae_offline_number_of_files, & ! [IN]
163  vars_3d(n), & ! [IN]
164  atmos_phy_ae_offline_axistype, & ! [IN]
165  atmos_phy_ae_offline_enable_periodic_year, & ! [IN]
166  atmos_phy_ae_offline_enable_periodic_month, & ! [IN]
167  atmos_phy_ae_offline_enable_periodic_day, & ! [IN]
168  atmos_phy_ae_offline_step_fixed, & ! [IN]
169  atmos_phy_ae_offline_defval, & ! [IN]
170  check_coordinates = atmos_phy_ae_offline_check_coordinates, & ! [IN]
171  step_limit = atmos_phy_ae_offline_step_limit ) ! [IN]
172  endif
173 
174  else ! set constant value
175 
176  log_info("ATMOS_PHY_AE_offline_setup",*) &
177  'Constant value is set for ', trim(vars_3d(n)), ', value = ', const_value(n)
178 
179  endif
180 
181  enddo
182 
183  return
184  end subroutine atmos_phy_ae_offline_setup
185 
186  !-----------------------------------------------------------------------------
188  subroutine atmos_phy_ae_offline_tendency( &
189  KA, KS, KE, &
190  IA, IS, IE, &
191  JA, JS, JE, &
192  time_now, &
193  CCN )
194  use scale_prc, only: &
195  prc_abort
196  use scale_file_external_input, only: &
197  file_external_input_update
198  use scale_const, only: &
199  undef => const_undef
200  implicit none
201 
202  integer, intent(in) :: ka, ks, ke
203  integer, intent(in) :: ia, is, ie
204  integer, intent(in) :: ja, js, je
205  real(dp), intent(in) :: time_now
206  real(rp), intent(out) :: ccn(ka,ia,ja)
207 
208  logical :: error
209  integer :: n
210  !---------------------------------------------------------------------------
211 
212  log_progress(*) 'atmosphere / physics / aerosol / offline'
213 
214  n = 8 ! UNCCN
215 
216  if ( const_value(n) < undef*0.1 ) then ! read from external file
217 
218  call file_external_input_update( vars_3d(n), time_now, ccn(:,:,:), error )
219  if ( error ) then
220  log_error("ATMOS_PHY_AE_offline_flux",*) 'Requested data is not found! ', trim(vars_3d(n))
221  call prc_abort
222  endif
223 
224  else ! set constant value
225 
226  ccn(:,:,:) = const_value(n)
227 
228  endif
229 
230  return
231  end subroutine atmos_phy_ae_offline_tendency
232 
233  !-----------------------------------------------------------------------------
236  KA, IA, JA, &
237  RH, &
238  Re )
239  implicit none
240 
241  integer, intent(in) :: ka, ia, ja
242  real(rp), intent(in) :: rh(ka,ia,ja) ! relative humidity [%]
243  real(rp), intent(out) :: re(ka,ia,ja,n_ae) ! effective radius
244 
245  real(rp), parameter :: ae_re(n_ae) = & ! aerosol radius [m]
246  (/ 1.6e-6_rp, & ! Soil dust
247  -1.0_rp, & ! Carbonacerous (BC/OC=0.3)
248  -1.0_rp, & ! Carbonacerous (BC/OC=0.15)
249  -1.0_rp, & ! Carbonacerous (BC/OC=0.)
250  4.e-8_rp, & ! Black carbon
251  -1.0_rp, & ! Sulfate
252  -1.0_rp /) ! Sea salt
253 
254  integer :: iaero
255  !---------------------------------------------------------------------------
256 
257  do iaero = 1, n_ae
258 
259  if ( ae_re(iaero) < 0.0_rp ) then ! hygroscopic particle : look-up table is based on the RH
260 
261  re(:,:,:,iaero) = rh(:,:,:) * 1.e-2_rp
262 
263  else ! non-hygroscopic particle : look-up table is the effective radius
264 
265  re(:,:,:,iaero) = ae_re(iaero) * 100.0_rp ! [m=>cm]
266 
267  endif
268 
269  enddo
270 
271  return
273 
274  !-----------------------------------------------------------------------------
276  subroutine atmos_phy_ae_offline_qtrc2qaero( &
277  KA, IA, JA, &
278  time_now, &
279  Qe )
280  use scale_prc, only: &
281  prc_abort
282  use scale_file_external_input, only: &
283  file_external_input_update
284  use scale_const, only: &
285  undef => const_undef
286  implicit none
287 
288  integer, intent(in) :: ka, ia, ja
289  real(dp), intent(in) :: time_now
290  real(rp), intent(out) :: qe(ka,ia,ja,n_ae) ! aerosol mixing ratio [kg/kg]
291 
292  logical :: error, error_sum
293  integer :: n, iaero
294  !---------------------------------------------------------------------------
295 
296  error_sum = .false.
297 
298  do n = 1, num_vars_3d-1
299  iaero = n
300 
301  if ( const_value(n) < undef*0.1 ) then ! read from external file
302 
303  call file_external_input_update( vars_3d(n), time_now, qe(:,:,:,iaero), error )
304  error_sum = ( error .OR. error_sum )
305 
306  else ! set constant value
307 
308  qe(:,:,:,iaero) = const_value(n)
309 
310  endif
311 
312  enddo
313 
314  if ( error_sum ) then
315  log_error("ATMOS_PHY_AE_offline_flux",*) 'Requested data is not found!'
316  call prc_abort
317  endif
318 
319  return
320  end subroutine atmos_phy_ae_offline_qtrc2qaero
321 
322  !-----------------------------------------------------------------------------
323  subroutine atmos_phy_ae_offline_mkinit( &
324  KA, KS, KE, &
325  IA, IS, IE, &
326  JA, JS, JE, &
327  ccn_init, &
328  CCN )
329  use scale_const, only: &
330  undef => const_undef
331  implicit none
332 
333  integer, intent(in) :: ka, ks, ke
334  integer, intent(in) :: ia, is, ie
335  integer, intent(in) :: ja, js, je
336  real(rp), intent(in) :: ccn_init
337  real(rp), intent(out) :: ccn(ka,ia,ja)
338 
339  integer :: n
340  !---------------------------------------------------------------------------
341 
343 
344  n = 8 ! UNCCN
345 
346  if ( const_value(n) < undef*0.1 ) then ! read from external file
347 
348  ccn(:,:,:) = ccn_init
349 
350  else ! set constant value
351 
352  ccn(:,:,:) = const_value(n)
353 
354  endif
355 
356  return
357  end subroutine atmos_phy_ae_offline_mkinit
358 
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:350
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:239
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:329
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:194
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:280
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:43
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:57
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