SCALE-RM
mod_atmos_phy_lt_driver.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
21  use scale_tracer
22  !-----------------------------------------------------------------------------
23  implicit none
24  private
25  !-----------------------------------------------------------------------------
26  !
27  !++ Public procedure
28  !
33 
34  !-----------------------------------------------------------------------------
35  !
36  !++ Public parameters & variables
37  !
38  !-----------------------------------------------------------------------------
39  !
40  !++ Private procedure
41  !
42  !-----------------------------------------------------------------------------
43  !
44  !++ Private parameters & variables
45  !
46 
47  !--- For history output
48  integer, private, parameter :: w_nmax = 3
49  integer, private, parameter :: I_CRGD_LIQ = 1
50  integer, private, parameter :: I_CRGD_ICE = 2
51  integer, private, parameter :: I_CRGD_TOT = 3
52  integer, private :: HIST_id(w_nmax)
53  character(len=H_SHORT), private :: w_name(w_nmax)
54  character(len=H_MID), private :: w_longname(w_nmax)
55  character(len=H_SHORT), private :: w_unit(w_nmax)
56  data w_name / 'CRGD_LIQ', &
57  'CRGD_ICE', &
58  'CRGD_TOT' /
59  data w_longname / 'Charge density of liquid water', &
60  'Charge density of ice water', &
61  'Charge density of QHYD' /
62  data w_unit / 'nC/m3', &
63  'nC/m3', &
64  'nC/m3' /
65 
66 
67  !-----------------------------------------------------------------------------
68 contains
69  !-----------------------------------------------------------------------------
72  use mod_atmos_admin, only: &
76  use scale_tracer, only: &
78  use scale_atmos_phy_mp_suzuki10, only: &
82  use mod_atmos_phy_lt_vars, only: &
83  qa_lt, &
84  qs_lt, &
85  qe_lt
86  use scale_atmos_hydrometeor, only: &
87  qha, &
88  qhs
89  use scale_prc, only: &
90  prc_abort
91  implicit none
92 
93  character(len=H_SHORT), allocatable :: name(:)
94  character(len=H_MID ), allocatable :: desc(:)
95  character(len=H_SHORT), allocatable :: unit(:)
96  integer :: iq
97  !---------------------------------------------------------------------------
98 
99  log_newline
100  log_info("ATMOS_PHY_LT_driver_tracer_setup",*) 'Setup'
101 
102  if ( atmos_sw_phy_lt ) then
103 
104  select case ( atmos_phy_lt_type )
105  case ( 'OFF', 'NONE' )
106  log_info("ATMOS_PHY_LT_driver_tracer_setup",*) 'this component is never called.'
107  case ( 'SATO2019' )
108  select case ( atmos_phy_mp_type )
109  case ( 'TOMITA08', 'SN14' )
110  ! do nothing
111  case ( 'SUZUKI10' )
112 
113  if( atmos_phy_mp_suzuki10_nccn /= 0 ) then
114  log_error("ATMOS_PHY_LT_driver_tracer_setup",*) 'nccn in SUZUKI10 should be 0 for lithgning component(', atmos_phy_mp_suzuki10_nccn, '). CHECK!'
115  call prc_abort
116  endif
117  if ( atmos_phy_mp_suzuki10_nices == 0 ) then
118  log_error("ATMOS_PHY_LT_driver_tracer_setup",*) 'ICEFLG in SUZUKI10 should be 1 for lithgning component. CHECK!'
119  call prc_abort
120  endif
121  case ( 'KESSLER' )
122  log_error("ATMOS_PHY_LT_driver_tracer_setup",*) 'ATMOS_PHY_MP_TYPE should be TOMITA08, or SN14, or SUZUKI10 (', atmos_phy_mp_type, '). CHECK!'
123  call prc_abort
124  end select
125  case default
126  log_error("ATMOS_PHY_LT_driver_tracer_setup",*) 'invalid lithgning type(', atmos_phy_lt_type, '). CHECK!'
127  call prc_abort
128  end select
129 
130  qa_lt = qha
131 
132  allocate( name(qa_lt), desc(qa_lt), unit(qa_lt) )
133  do iq = 1, qa_lt
134  name(iq) = 'QCRG_'//trim(tracer_name(qhs+iq-1)(2:))
135  desc(iq) = 'Ratio of charge density of '//trim(tracer_name(qhs+iq-1))
136  unit(iq) = 'fC/kg'
137  end do
138  call tracer_regist( qs_lt, & ! [OUT]
139  qa_lt, & ! [IN]
140  name(:), & ! [IN]
141  desc(:), & ! [IN]
142  unit(:) ) ! [IN]
143  deallocate( name, desc, unit )
144 
145  qe_lt = qs_lt - 1 + qa_lt
146 
147  else
148  qa_lt = 0
149  qs_lt = -1
150  qe_lt = -2
151  endif
152 
153  return
154  end subroutine atmos_phy_lt_driver_tracer_setup
155 
156  !-----------------------------------------------------------------------------
158  subroutine atmos_phy_lt_driver_setup
160  real_lon => atmos_grid_cartesc_real_lon, &
161  real_lat => atmos_grid_cartesc_real_lat
162  use scale_atmos_grid_cartesc, only: &
163  cdx => atmos_grid_cartesc_cdx, &
165  use scale_atmos_phy_lt_sato2019, only: &
167  use mod_atmos_phy_lt_vars, only: &
168  flg_lt, &
170  use mod_atmos_admin, only: &
173  use scale_prc, only: &
174  prc_abort
175  use scale_atmos_hydrometeor, only: &
176  qha
177  use scale_file_history, only: &
179  implicit none
180 
181  logical :: lt_force_with_suzuki10 = .false. ! experimental use only
182 
183  namelist / param_atmos_phy_lt / &
184  lt_force_with_suzuki10
185 
186  integer :: ip
187  integer :: ierr
188  !---------------------------------------------------------------------------
189 
190  log_newline
191  log_info("ATMOS_PHY_LT_driver_setup",*) 'Setup'
192 
193  !--- read namelist
194  rewind(io_fid_conf)
195  read(io_fid_conf,nml=param_atmos_phy_lt,iostat=ierr)
196  if ( ierr < 0 ) then !--- missing
197  log_info("ATMOS_PHY_LT_driver_setup",*) 'Not found namelist. Default used.'
198  elseif ( ierr > 0 ) then !--- fatal error
199  log_error("ATMOS_PHY_LT_dirver_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_LT. Check!'
200  call prc_abort
201  end if
202  log_nml(param_atmos_phy_lt)
203 
204  select case( atmos_phy_lt_type )
205  case ( 'SATO2019' )
206 
207  if ( atmos_phy_mp_type == "SUZUKI10" ) then
208  log_warn("ATMOS_PHY_LT_driver_setup",*) 'At this moment, ATMOS_PHY_MP_TYPE of SUZUKI10 with SATO2019 scheme is for experimental use only.'
209  if ( .not. lt_force_with_suzuki10 ) then
210  log_error("ATMOS_PHY_LT_driver_setup",*) 'At this moment, ATMOS_PHY_MP_TYPE of SUZUKI10 with SATO2019 scheme is for experimental use only.'
211  call prc_abort
212  end if
213  end if
214 
215 
216  call atmos_phy_lt_sato2019_setup( ka, ks, ke, & ! [IN]
217  ia, is, ie, & ! [IN]
218  ja, js, je, & ! [IN]
219  imaxg, & ! [IN]
220  jmaxg, & ! [IN]
221  kmax, & ! [IN]
222  atmos_phy_mp_type, & ! [IN]
223  cdx, cdy ) ! [IN]
224  flg_lt = .true.
225  case default
226  flg_lt = .false.
227  end select
228 
229 
230  if ( flg_lt ) then
231 
232  allocate( atmos_phy_lt_sarea(ka,ia,ja,qha) )
233 
234  do ip = 1, w_nmax
235  call file_history_reg( w_name(ip), w_longname(ip), w_unit(ip), & ! [IN]
236  hist_id(ip) ) ! [OUT]
237  end do
238 
239  call history
240 
241  else
242  log_info("ATMOS_PHY_LT_driver_setup",*) 'This component is never called.'
243  endif
244 
245 
246  return
247  end subroutine atmos_phy_lt_driver_setup
248 
249  !-----------------------------------------------------------------------------
253  use mod_atmos_admin, only: &
256  use mod_atmos_phy_lt_vars, only: &
257  flg_lt, &
259  implicit none
260  !---------------------------------------------------------------------------
261 
262  log_newline
263  log_info("ATMOS_PHY_LT_driver_finalize",*) 'Finalize'
264 
265  if ( atmos_sw_phy_lt ) then
266  select case ( atmos_phy_lt_type )
267  case ( 'OFF', 'NONE' )
268  case ( 'SATO2019' )
270  end select
271  end if
272 
273  if ( flg_lt ) then
274  deallocate( atmos_phy_lt_sarea )
275  end if
276 
277  return
278  end subroutine atmos_phy_lt_driver_finalize
279  !-----------------------------------------------------------------------------
282  use scale_time, only: &
283  dt_lt => time_dtsec_atmos_phy_lt
284  use mod_atmos_vars, only: &
285  dens => dens_av, &
286  rhot => rhot_av, &
287  qtrc => qtrc_av, &
288  atmos_vars_get_diagnostic
289  use mod_atmos_phy_lt_vars, only: &
290  qa_lt, &
291  qs_lt, &
292  qe_lt, &
293  sarea => atmos_phy_lt_sarea, &
294  epot => atmos_phy_lt_epot
295  use scale_atmos_phy_lt_sato2019, only: &
297  implicit none
298 
299  real(rp) :: qhyd(ka,ia,ja)
300  !---------------------------------------------------------------------------
301 
302  !$acc data create(QHYD) &
303  !$acc copyin(DENS,RHOT,QHYD,Sarea) &
304  !$acc copy(QTRC,Epot)
305 
306  call atmos_vars_get_diagnostic( "QHYD", qhyd(:,:,:) )
307 
309  ka, ks, ke, ia, is, ie, ja, js, je, kijmax, imax, jmax, qa_lt, & ! [IN]
310  dens(:,:,:), rhot(:,:,:), qhyd(:,:,:), sarea(:,:,:,:), & ! [IN]
311  dt_lt, & ! [IN]
312  qtrc(:,:,:,qs_lt:qe_lt), epot(:,:,:) ) ! [INOUT]
313 
314  call history
315 
316  !$acc end data
317 
318  return
319  end subroutine atmos_phy_lt_driver_adjustment
320 
321  ! private
322  subroutine history
324  qla
325  use mod_atmos_phy_lt_vars, only: &
326  qs_lt, &
327  qe_lt
328  use mod_atmos_vars, only: &
329  dens => dens_av, &
330  qtrc => qtrc_av
331  use scale_file_history, only: &
332  file_history_query, &
333  file_history_put
334  implicit none
335  real(RP) :: work(KA,IA,JA)
336  logical :: HIST_sw(w_nmax)
337  integer :: k, i, j, n, ip
338 
339  !$acc data copyin(QTRC,DENS) create(work)
340 
341  do ip = 1, w_nmax
342  call file_history_query( hist_id(ip), hist_sw(ip) )
343  end do
344 
345  if ( hist_sw(i_crgd_liq) ) then
346  !$omp parallel do
347  !$acc kernels
348  do j = js, je
349  do i = is, ie
350  do k = ks, ke
351  work(k,i,j) = 0.0_rp
352  do n = qs_lt, qs_lt + qla - 1
353  work(k,i,j) = work(k,i,j) + qtrc(k,i,j,n)
354  enddo
355  work(k,i,j) = work(k,i,j) * dens(k,i,j) * 1.e-6_rp ! [fC/kg] -> [nc/m3]
356  end do
357  end do
358  end do
359  !$acc end kernels
360  call file_history_put( hist_id(i_crgd_liq), work(:,:,:) )
361  end if
362  if ( hist_sw(i_crgd_ice) ) then
363  !$omp parallel do
364  !$acc kernels
365  do j = js, je
366  do i = is, ie
367  do k = ks, ke
368  work(k,i,j) = 0.0_rp
369  do n = qs_lt + qla, qe_lt
370  work(k,i,j) = work(k,i,j) + qtrc(k,i,j,n)
371  enddo
372  work(k,i,j) = work(k,i,j) * dens(k,i,j) * 1.e-6_rp ! [fC/kg] -> [nc/m3]
373  end do
374  end do
375  end do
376  !$acc end kernels
377  call file_history_put( hist_id(i_crgd_ice), work(:,:,:) )
378  end if
379  if ( hist_sw(i_crgd_tot) ) then
380  !$omp parallel do
381  !$acc kernels
382  do j = js, je
383  do i = is, ie
384  do k = ks, ke
385  work(k,i,j) = 0.0_rp
386  do n = qs_lt, qe_lt
387  work(k,i,j) = work(k,i,j) + qtrc(k,i,j,n)
388  enddo
389  work(k,i,j) = work(k,i,j) * dens(k,i,j) * 1.e-6_rp ! [fC/kg] -> [nc/m3]
390  end do
391  end do
392  end do
393  !$acc end kernels
394  call file_history_put( hist_id(i_crgd_tot), work(:,:,:) )
395  end if
396 
397  !$acc end data
398 
399  return
400  end subroutine history
401 
402 end module mod_atmos_phy_lt_driver
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_atmos_phy_lt_sato2019::atmos_phy_lt_sato2019_setup
subroutine, public atmos_phy_lt_sato2019_setup(KA, KS, KE, IA, IS, IE, JA, JS, JE, IMAXG, JMAXG, KMAX, MP_TYPE, CDX, CDY)
Setup.
Definition: scale_atmos_phy_lt_sato2019.F90:181
mod_atmos_vars::qtrc_av
real(rp), dimension(:,:,:,:), pointer, public qtrc_av
Definition: mod_atmos_vars.F90:95
scale_atmos_hydrometeor::qhs
integer, public qhs
Definition: scale_atmos_hydrometeor.F90:132
scale_atmos_phy_lt_sato2019::atmos_phy_lt_sato2019_adjustment
subroutine, public atmos_phy_lt_sato2019_adjustment(KA, KS, KE, IA, IS, IE, JA, JS, JE, KIJMAX, IMAX, JMAX, QA_LT, DENS, RHOT, QHYD, Sarea, dt_LT, QTRC, Epot)
Update of charge density.
Definition: scale_atmos_phy_lt_sato2019.F90:520
scale_atmos_phy_lt_sato2019::atmos_phy_lt_sato2019_finalize
subroutine, public atmos_phy_lt_sato2019_finalize
finalize
Definition: scale_atmos_phy_lt_sato2019.F90:490
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
mod_atmos_admin
module ATMOS admin
Definition: mod_atmos_admin.F90:11
mod_atmos_phy_lt_vars
module Atmosphere / Physics Chemistry
Definition: mod_atmos_phy_lt_vars.F90:12
mod_atmos_vars::rhot_av
real(rp), dimension(:,:,:), pointer, public rhot_av
Definition: mod_atmos_vars.F90:94
scale_atmos_hydrometeor
module atmosphere / hydrometeor
Definition: scale_atmos_hydrometeor.F90:12
scale_atmos_grid_cartesc::atmos_grid_cartesc_cdy
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdy
y-length of control volume [m]
Definition: scale_atmos_grid_cartesC.F90:62
mod_atmos_phy_lt_driver::history
subroutine history
Definition: mod_atmos_phy_lt_driver.F90:323
scale_atmos_grid_cartesc_index::imaxg
integer, public imaxg
Definition: scale_atmos_grid_cartesC_index.F90:72
mod_atmos_phy_lt_vars::qe_lt
integer, public qe_lt
Definition: mod_atmos_phy_lt_vars.F90:61
mod_atmos_phy_lt_vars::atmos_phy_lt_sarea
real(rp), dimension(:,:,:,:), allocatable, public atmos_phy_lt_sarea
Definition: mod_atmos_phy_lt_vars.F90:57
mod_atmos_vars::rhot
real(rp), dimension(:,:,:), allocatable, target, public rhot
Definition: mod_atmos_vars.F90:80
scale_atmos_grid_cartesc_real
module Atmosphere GRID CartesC Real(real space)
Definition: scale_atmos_grid_cartesC_real.F90:11
mod_atmos_vars::qtrc
real(rp), dimension(:,:,:,:), allocatable, target, public qtrc
Definition: mod_atmos_vars.F90:81
scale_file_history
module file_history
Definition: scale_file_history.F90:15
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lon
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lon
longitude [rad,0-2pi]
Definition: scale_atmos_grid_cartesC_real.F90:49
scale_atmos_grid_cartesc_index::imax
integer, public imax
Definition: scale_atmos_grid_cartesC_index.F90:37
scale_atmos_grid_cartesc_index::jmaxg
integer, public jmaxg
Definition: scale_atmos_grid_cartesC_index.F90:73
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_precision::rp
integer, parameter, public rp
Definition: scale_precision.F90:41
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
mod_atmos_phy_lt_driver::atmos_phy_lt_driver_finalize
subroutine, public atmos_phy_lt_driver_finalize
Definition: mod_atmos_phy_lt_driver.F90:251
mod_atmos_vars::dens
real(rp), dimension(:,:,:), allocatable, target, public dens
Definition: mod_atmos_vars.F90:76
mod_atmos_phy_lt_driver
module ATMOSPHERE / Physics Chemistry
Definition: mod_atmos_phy_lt_driver.F90:12
scale_atmos_grid_cartesc_index
module atmosphere / grid / cartesC index
Definition: scale_atmos_grid_cartesC_index.F90:12
scale_atmos_grid_cartesc_index::ia
integer, public ia
Definition: scale_atmos_grid_cartesC_index.F90:48
mod_atmos_admin::atmos_phy_lt_type
character(len=h_short), public atmos_phy_lt_type
Definition: mod_atmos_admin.F90:44
scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_nwaters
integer, public atmos_phy_mp_suzuki10_nwaters
Definition: scale_atmos_phy_mp_suzuki10.F90:57
mod_atmos_phy_lt_driver::atmos_phy_lt_driver_adjustment
subroutine, public atmos_phy_lt_driver_adjustment
Driver.
Definition: mod_atmos_phy_lt_driver.F90:282
scale_atmos_grid_cartesc_index::kmax
integer, public kmax
Definition: scale_atmos_grid_cartesC_index.F90:36
mod_atmos_admin::atmos_sw_phy_lt
logical, public atmos_sw_phy_lt
Definition: mod_atmos_admin.F90:60
scale_prof
module profiler
Definition: scale_prof.F90:11
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_phy_mp_suzuki10
module Spectran Bin Microphysics
Definition: scale_atmos_phy_mp_suzuki10.F90:23
scale_atmos_hydrometeor::qha
integer, public qha
Definition: scale_atmos_hydrometeor.F90:131
scale_atmos_grid_cartesc_index::ja
integer, public ja
Definition: scale_atmos_grid_cartesC_index.F90:49
scale_time
module TIME
Definition: scale_time.F90:11
scale_tracer::tracer_regist
subroutine, public tracer_regist(QS, NQ, NAME, DESC, UNIT, CV, CP, R, ENGI0, ADVC, MASS)
Regist tracer.
Definition: scale_tracer.F90:68
scale_tracer
module TRACER
Definition: scale_tracer.F90:12
mod_atmos_phy_lt_vars::qa_lt
integer, public qa_lt
Definition: mod_atmos_phy_lt_vars.F90:59
mod_atmos_vars::dens_av
real(rp), dimension(:,:,:), pointer, public dens_av
Definition: mod_atmos_vars.F90:90
scale_atmos_grid_cartesc_index::ks
integer, public ks
start point of inner domain: z, local
Definition: scale_atmos_grid_cartesC_index.F90:51
mod_atmos_vars
module ATMOSPHERIC Variables
Definition: mod_atmos_vars.F90:12
scale_atmos_grid_cartesc_index::jmax
integer, public jmax
Definition: scale_atmos_grid_cartesC_index.F90:38
scale_atmos_grid_cartesc_index::js
integer, public js
start point of inner domain: y, local
Definition: scale_atmos_grid_cartesC_index.F90:55
mod_atmos_phy_lt_vars::flg_lt
logical, public flg_lt
Definition: mod_atmos_phy_lt_vars.F90:65
scale_atmos_phy_lt_sato2019
module atmosphere / physics / lightninh / SATO2019
Definition: scale_atmos_phy_lt_sato2019.F90:27
mod_atmos_admin::atmos_phy_mp_type
character(len=h_short), public atmos_phy_mp_type
Definition: mod_atmos_admin.F90:36
scale_file_history::file_history_reg
subroutine, public file_history_reg(name, desc, unit, itemid, standard_name, ndims, dim_type, cell_measures, fill_halo)
Register/Append variable to history file.
Definition: scale_file_history.F90:685
mod_atmos_phy_lt_driver::atmos_phy_lt_driver_tracer_setup
subroutine, public atmos_phy_lt_driver_tracer_setup
Config.
Definition: mod_atmos_phy_lt_driver.F90:72
scale_time::time_dtsec_atmos_phy_lt
real(dp), public time_dtsec_atmos_phy_lt
time interval of physics(lightning ) [sec]
Definition: scale_time.F90:45
scale_atmos_grid_cartesc::atmos_grid_cartesc_cdx
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdx
x-length of control volume [m]
Definition: scale_atmos_grid_cartesC.F90:61
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lat
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lat
latitude [rad,-pi,pi]
Definition: scale_atmos_grid_cartesC_real.F90:53
scale_atmos_grid_cartesc
module atmosphere / grid / cartesC
Definition: scale_atmos_grid_cartesC.F90:12
scale_atmos_hydrometeor::qla
integer, public qla
Definition: scale_atmos_hydrometeor.F90:135
scale_atmos_phy_mp_suzuki10::atmos_phy_mp_suzuki10_nices
integer, public atmos_phy_mp_suzuki10_nices
Definition: scale_atmos_phy_mp_suzuki10.F90:58
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:57
scale_atmos_grid_cartesc_index::kijmax
integer, public kijmax
Definition: scale_atmos_grid_cartesC_index.F90:59
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_phy_mp_suzuki10::atmos_phy_mp_suzuki10_nccn
integer, public atmos_phy_mp_suzuki10_nccn
Definition: scale_atmos_phy_mp_suzuki10.F90:59
mod_atmos_phy_lt_vars::atmos_phy_lt_epot
real(rp), dimension(:,:,:), allocatable, public atmos_phy_lt_epot
Definition: mod_atmos_phy_lt_vars.F90:56
mod_atmos_phy_lt_vars::qs_lt
integer, public qs_lt
Definition: mod_atmos_phy_lt_vars.F90:60
mod_atmos_phy_lt_driver::atmos_phy_lt_driver_setup
subroutine, public atmos_phy_lt_driver_setup
Setup.
Definition: mod_atmos_phy_lt_driver.F90:159