SCALE-RM
mod_atmos_phy_ae_vars.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
12 !-------------------------------------------------------------------------------
13 #include "inc_openmp.h"
15  !-----------------------------------------------------------------------------
16  !
17  !++ used modules
18  !
19  use scale_precision
20  use scale_stdio
21  use scale_prof
23  use scale_tracer
24  !-----------------------------------------------------------------------------
25  implicit none
26  private
27  !-----------------------------------------------------------------------------
28  !
29  !++ Public procedure
30  !
31  public :: atmos_phy_ae_vars_setup
35 
36  !-----------------------------------------------------------------------------
37  !
38  !++ Public parameters & variables
39  !
40  logical, public :: atmos_phy_ae_restart_output = .false.
41 
42  character(len=H_LONG), public :: atmos_phy_ae_restart_in_basename = ''
43  character(len=H_LONG), public :: atmos_phy_ae_restart_out_basename = ''
44  character(len=H_MID), public :: atmos_phy_ae_restart_out_title = 'ATMOS_PHY_AE restart'
45  character(len=H_MID), public :: atmos_phy_ae_restart_out_dtype = 'DEFAULT'
46 
47  real(RP), public, allocatable :: atmos_phy_ae_rhoq_t(:,:,:,:) ! tendency rho*QTRC [kg/kg/s]
48 
49  real(RP), public, allocatable :: atmos_phy_ae_ccn(:,:,:) ! cloud condensation nuclei [/m3]
50  real(RP), public, allocatable :: atmos_phy_ae_ccn_t(:,:,:) ! tendency CCN [/m3/s]
51  real(RP), public, allocatable :: atmos_phy_ae_emit(:,:,:,:) ! emission of aerosol and gas
52  !-----------------------------------------------------------------------------
53  !
54  !++ Private procedure
55  !
56  !-----------------------------------------------------------------------------
57  !
58  !++ Private parameters & variables
59  !
60  integer, private, parameter :: vmax = 1
61  integer, private, parameter :: i_ccn = 1
62 
63  character(len=H_SHORT), private :: var_name(vmax)
64  character(len=H_MID), private :: var_desc(vmax)
65  character(len=H_SHORT), private :: var_unit(vmax)
66 
67  data var_name / 'CCN' /
68  data var_desc / 'cloud condensation nuclei' /
69  data var_unit / 'num/m3' /
70 
71  !-----------------------------------------------------------------------------
72 contains
73  !-----------------------------------------------------------------------------
75  subroutine atmos_phy_ae_vars_setup
76  use scale_process, only: &
78  use scale_const, only: &
79  undef => const_undef
80  implicit none
81 
82  namelist / param_atmos_phy_ae_vars / &
88 
89  integer :: ierr
90  integer :: iv
91  !---------------------------------------------------------------------------
92 
93  if( io_l ) write(io_fid_log,*)
94  if( io_l ) write(io_fid_log,*) '++++++ Module[VARS] / Categ[ATMOS PHY_AE] / Origin[SCALE-RM]'
95 
96  allocate( atmos_phy_ae_rhoq_t(ka,ia,ja,qa) )
97  atmos_phy_ae_rhoq_t(:,:,:, :) = undef
98 
99  allocate( atmos_phy_ae_ccn(ka,ia,ja) )
100  atmos_phy_ae_ccn(:,:,:) = undef
101 
102  allocate( atmos_phy_ae_ccn_t(ka,ia,ja) )
103  atmos_phy_ae_ccn_t(:,:,:) = undef
104 
105  allocate( atmos_phy_ae_emit(ka,ia,ja,qa_ae) )
106  atmos_phy_ae_emit(:,:,:,:) = 0.0_rp
107 
108  !--- read namelist
109  rewind(io_fid_conf)
110  read(io_fid_conf,nml=param_atmos_phy_ae_vars,iostat=ierr)
111  if( ierr < 0 ) then !--- missing
112  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
113  elseif( ierr > 0 ) then !--- fatal error
114  write(*,*) 'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_AE_VARS. Check!'
115  call prc_mpistop
116  endif
117  if( io_lnml ) write(io_fid_log,nml=param_atmos_phy_ae_vars)
118 
119  if( io_l ) write(io_fid_log,*)
120  if( io_l ) write(io_fid_log,*) '*** [ATMOS_PHY_AE] prognostic/diagnostic variables'
121  if( io_l ) write(io_fid_log,'(1x,A,A15,A,A32,3(A))') &
122  '*** |','VARNAME ','|', 'DESCRIPTION ','[', 'UNIT ',']'
123  do iv = 1, vmax
124  if( io_l ) write(io_fid_log,'(1x,A,i3,A,A15,A,A32,3(A))') &
125  '*** NO.',iv,'|',var_name(iv),'|',var_desc(iv),'[',var_unit(iv),']'
126  enddo
127 
128  if( io_l ) write(io_fid_log,*)
129  if ( atmos_phy_ae_restart_in_basename /= '' ) then
130  if( io_l ) write(io_fid_log,*) '*** Restart input? : ', trim(atmos_phy_ae_restart_in_basename)
131  else
132  if( io_l ) write(io_fid_log,*) '*** Restart input? : NO'
133  endif
135  .AND. atmos_phy_ae_restart_out_basename /= '' ) then
136  if( io_l ) write(io_fid_log,*) '*** Restart output? : ', trim(atmos_phy_ae_restart_out_basename)
137  else
138  if( io_l ) write(io_fid_log,*) '*** Restart output? : NO'
140  endif
141 
142  return
143  end subroutine atmos_phy_ae_vars_setup
144 
145  !-----------------------------------------------------------------------------
147  subroutine atmos_phy_ae_vars_fillhalo
148  use scale_comm, only: &
149  comm_vars8, &
150  comm_wait
151  implicit none
152 
153  integer :: i, j
154  !---------------------------------------------------------------------------
155 
156  do j = js, je
157  do i = is, ie
158  atmos_phy_ae_ccn( 1:ks-1,i,j) = atmos_phy_ae_ccn(ks,i,j)
159  atmos_phy_ae_ccn(ke+1:ka, i,j) = atmos_phy_ae_ccn(ke,i,j)
160  enddo
161  enddo
162 
163  call comm_vars8( atmos_phy_ae_ccn(:,:,:), 1 )
164  call comm_wait ( atmos_phy_ae_ccn(:,:,:), 1 )
165 
166  return
167  end subroutine atmos_phy_ae_vars_fillhalo
168 
169  !-----------------------------------------------------------------------------
172  use scale_fileio, only: &
173  fileio_read
174  use scale_rm_statistics, only: &
175  stat_total
176  implicit none
177 
178  real(RP) :: total
179  !---------------------------------------------------------------------------
180 
181  if( io_l ) write(io_fid_log,*)
182  if( io_l ) write(io_fid_log,*) '*** Input restart file (ATMOS_PHY_AE) ***'
183 
184  if ( atmos_phy_ae_restart_in_basename /= '' ) then
185  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(atmos_phy_ae_restart_in_basename)
186 
187  call fileio_read( atmos_phy_ae_ccn(:,:,:), & ! [OUT]
188  atmos_phy_ae_restart_in_basename, var_name(1), 'ZXY', step=1 ) ! [IN]
189 
191 
192  call stat_total( total, atmos_phy_ae_ccn(:,:,:), var_name(1) )
193  else
194  if( io_l ) write(io_fid_log,*) '*** restart file for ATMOS_PHY_AE is not specified.'
195  endif
196 
197  return
198  end subroutine atmos_phy_ae_vars_restart_read
199 
200  !-----------------------------------------------------------------------------
203  use scale_time, only: &
205  use scale_fileio, only: &
206  fileio_write
207  implicit none
208 
209  character(len=20) :: timelabel
210  character(len=H_LONG) :: basename
211  !---------------------------------------------------------------------------
212 
213  if ( atmos_phy_ae_restart_out_basename /= '' ) then
214 
215  call time_gettimelabel( timelabel )
216  write(basename,'(A,A,A)') trim(atmos_phy_ae_restart_out_basename), '_', trim(timelabel)
217 
218  if( io_l ) write(io_fid_log,*)
219  if( io_l ) write(io_fid_log,*) '*** Output restart file (ATMOS_PHY_AE) ***'
220  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(basename)
221 
222  call fileio_write( atmos_phy_ae_ccn(:,:,:), basename, atmos_phy_ae_restart_out_title, & ! [IN]
223  var_name(1), var_desc(1), var_unit(1), 'ZXY', atmos_phy_ae_restart_out_dtype ) ! [IN]
224 
225  endif
226 
227  return
228  end subroutine atmos_phy_ae_vars_restart_write
229 
230 end module mod_atmos_phy_ae_vars
character(len=h_long), public atmos_phy_ae_restart_in_basename
basename of the restart file
integer, public is
start point of inner domain: x, local
subroutine, public atmos_phy_ae_vars_fillhalo
HALO Communication.
integer, public je
end point of inner domain: y, local
integer, public qa_ae
subroutine, public prc_mpistop
Abort MPI.
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:59
logical, public atmos_phy_ae_restart_output
output restart file?
module STDIO
Definition: scale_stdio.F90:12
integer, public ke
end point of inner domain: z, local
integer, public qa
module FILE I/O (netcdf)
real(rp), public const_undef
Definition: scale_const.F90:43
module Statistics
module grid index
module TRACER
integer, public ia
of x whole cells (local, with HALO)
subroutine, public time_gettimelabel(timelabel)
generate time label
Definition: scale_time.F90:90
integer, public ka
of z whole cells (local, with HALO)
real(rp), dimension(:,:,:,:), allocatable, public atmos_phy_ae_emit
module COMMUNICATION
Definition: scale_comm.F90:23
integer, public js
start point of inner domain: y, local
module TIME
Definition: scale_time.F90:15
module PROCESS
real(rp), dimension(:,:,:,:), allocatable, public atmos_phy_ae_rhoq_t
real(rp), dimension(:,:,:), allocatable, public atmos_phy_ae_ccn
character(len=h_mid), public atmos_phy_ae_restart_out_title
title of the output file
character(len=h_mid), public atmos_phy_ae_restart_out_dtype
REAL4 or REAL8.
module CONSTANT
Definition: scale_const.F90:14
integer, public ks
start point of inner domain: z, local
subroutine, public atmos_phy_ae_vars_setup
Setup.
subroutine, public atmos_phy_ae_vars_restart_read
Read restart.
module profiler
Definition: scale_prof.F90:10
integer, public ie
end point of inner domain: x, local
logical, public io_lnml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:60
module PRECISION
subroutine, public atmos_phy_ae_vars_restart_write
Write restart.
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
character(len=h_long), public atmos_phy_ae_restart_out_basename
basename of the output file
module ATMOSPHERE / Physics Aerosol Microphysics
real(rp), dimension(:,:,:), allocatable, public atmos_phy_ae_ccn_t
integer, public ja
of y whole cells (local, with HALO)