SCALE-RM
scale_const.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
15  !-----------------------------------------------------------------------------
16  !
17  !++ used modules
18  !
19  use scale_precision
20  use scale_stdio
21  !-----------------------------------------------------------------------------
22  implicit none
23  private
24  !-----------------------------------------------------------------------------
25  !
26  !++ Public procedure
27  !
28  public :: const_setup
29 
30  !-----------------------------------------------------------------------------
31  !
32  !++ Public parameters & variables
33  !
34  real(RP), public :: const_pi = 3.14159265358979_rp
35  real(RP), public :: const_d2r
36  real(RP), public :: const_eps = 1.e-16_rp
37  real(RP), public :: const_eps1 = 0.99999999999999_rp
38  real(RP), public :: const_huge = 1.e+30_rp
39 
40  integer, public, parameter :: const_undef2 = -32768
41  real(SP), public, parameter :: const_undef4 = -9.9999e30
42  real(DP), public, parameter :: const_undef8 = -9.9999d30
43  real(RP), public :: const_undef
44 
45  ! adopted constants
46  real(RP), public :: const_radius = 6.37122e+6_rp
47  real(RP), public :: const_ohm = 7.2920e-5_rp
48  real(RP), public :: const_grav = 9.80665_rp
49 
50  ! physical constants
51  real(RP), public, parameter :: const_stb = 5.670373e-8_rp
52  real(RP), public, parameter :: const_karman = 0.4_rp
53  real(RP), public, parameter :: const_r = 8.3144621_rp
54 
55  ! dry air constants
56  real(RP), public :: const_mdry = 28.97_rp
57  real(RP), public :: const_rdry = 287.04_rp
58  real(RP), public :: const_cpdry = 1004.64_rp
59  real(RP), public :: const_cvdry
60  real(RP), public :: const_laps = 6.5e-3_rp
61  real(RP), public :: const_lapsdry
62 
63  ! water constants
64  real(RP), public :: const_mvap = 18.02_rp
65  real(RP), public, parameter :: const_rvap = 461.46_rp
66  real(RP), public, parameter :: const_cpvap = 1845.60_rp
67  real(RP), public :: const_cvvap
68  real(RP), public, parameter :: const_cl = 4218.0_rp
69  real(RP), public, parameter :: const_ci = 2006.0_rp
70 
71  real(RP), public :: const_epsvap
72  real(RP), public :: const_epstvap
73 
74  real(RP), public, parameter :: const_emelt = 3.4e5_rp
75  real(RP), public, parameter :: const_tmelt = 273.15_rp
76 
77  real(RP), public :: const_lhv
78  real(RP), public :: const_lhs
79  real(RP), public :: const_lhf
80  real(RP), public, parameter :: const_lhv0 = 2.5008e6_rp
81  real(RP), public :: const_lhv00
82  real(RP), public, parameter :: const_lhs0 = 2.8342e6_rp
83  real(RP), public :: const_lhs00
84  real(RP), public :: const_lhf0
85  real(RP), public :: const_lhf00
86  real(RP), public, parameter :: const_psat0 = 610.7_rp
87  real(RP), public, parameter :: const_dwatr = 1000.0_rp
88  real(RP), public, parameter :: const_dice = 916.8_rp
89 
90  real(RP), public :: const_sound
91 
92  real(RP), public :: const_pstd = 101325.0_rp
93  real(RP), public :: const_pre00 = 100000.0_rp
94  real(RP), public :: const_tstd = 288.15_rp
95  real(RP), public, parameter :: const_tem00 = 273.15_rp
96  real(RP), public, parameter :: const_ppm = 1.e-6_rp
97 
98  integer, public :: const_i_lw = 1
99  integer, public :: const_i_sw = 2
100 
101  character(len=H_SHORT), public :: const_thermodyn_type = 'EXACT'
102 
103  !-----------------------------------------------------------------------------
104  !
105  !++ Private procedure
106  !
107  !-----------------------------------------------------------------------------
108  !
109  !++ Private parameters & variables
110  !
111  !-----------------------------------------------------------------------------
112 contains
113  !-----------------------------------------------------------------------------
115  subroutine const_setup
116  use scale_process, only: &
118  implicit none
119 
120  namelist / param_const / &
121  const_radius, &
122  const_ohm, &
123  const_grav, &
124  const_rdry, &
125  const_cpdry, &
126  const_laps, &
127  const_pstd, &
128  const_pre00, &
129  const_tstd, &
131 
132  integer :: ierr
133  !---------------------------------------------------------------------------
134 
135  if( io_l ) write(io_fid_log,*)
136  if( io_l ) write(io_fid_log,*) '++++++ Module[CONST] / Categ[COMMON] / Origin[SCALElib]'
137 
138  !--- read namelist
139  rewind(io_fid_conf)
140  read(io_fid_conf,nml=param_const,iostat=ierr)
141  if( ierr < 0 ) then !--- missing
142  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
143  elseif( ierr > 0 ) then !--- fatal error
144  write(*,*) 'xxx Not appropriate names in namelist PARAM_CONST. Check!'
145  call prc_mpistop
146  endif
147  if( io_lnml ) write(io_fid_log,nml=param_const)
148 
149  if ( rp == sp ) then
150  const_undef = real(const_undef4,kind=rp)
151  elseif( rp == dp ) then
152  const_undef = real(const_undef8,kind=rp)
153  else
154  write(*,*) 'xxx unsupported precision: ', rp
155  call prc_mpistop
156  endif
157 
158  const_pi = 4.e0_rp * atan( 1.0_rp )
159  const_d2r = const_pi / 180.0_rp
160  const_eps = epsilon(0.0_rp)
161  const_eps1 = 1.0_rp - epsilon(0.0_rp)
162  const_huge = huge(0.0_rp)
163 
166 
169  const_epstvap = 1.e0_rp / const_epsvap - 1.e0_rp
170 
172 
176 
177  if ( const_thermodyn_type == 'EXACT' ) then
181  elseif( const_thermodyn_type == 'SIMPLE' ) then
185  else
186  write(*,*) 'xxx Not appropriate ATMOS_THERMODYN_ENERGY_TYPE. Check!', trim(const_thermodyn_type)
187  call prc_mpistop
188  endif
189 
191 
192  if( io_l ) write(io_fid_log,*)
193  if( io_l ) write(io_fid_log,*) '*** List of constants ***'
194  if( io_l ) write(io_fid_log,*) '*** PI : PI = ', const_pi
195  if( io_l ) write(io_fid_log,*) '*** Small number : EPS = ', const_eps
196  if( io_l ) write(io_fid_log,*) '*** Small number (1-EPS) : EPS1 = ', const_eps1
197  if( io_l ) write(io_fid_log,*) '*** Huge number : HUGE = ', const_huge
198  if( io_l ) write(io_fid_log,*) '*** undefined number (INT2) : UNDEF2 = ', const_undef2
199  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL,general use) : UNDEF = ', const_undef
200  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL4) : UNDEF4 = ', const_undef4
201  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL8) : UNDEF8 = ', const_undef8
202 
203  if( io_l ) write(io_fid_log,*) '*** radius of the planet [m] : RADIUS = ', const_radius
204  if( io_l ) write(io_fid_log,*) '*** angular velocity of the planet [1/s] : OHM = ', const_ohm
205  if( io_l ) write(io_fid_log,*) '*** standard acceleration of gravity [m/s2] : GRAV = ', const_grav
206 
207  if( io_l ) write(io_fid_log,*) '*** Stefan-Boltzman constant [W/m2/K4] : STB = ', const_stb
208  if( io_l ) write(io_fid_log,*) '*** von Karman constant : KARMAN = ', const_karman
209  if( io_l ) write(io_fid_log,*) '*** universal gas constant [J/mol/K] : R = ', const_r
210 
211  if( io_l ) write(io_fid_log,*) '*** mass weight (dry air) [g/mol] : Mdry = ', const_mdry
212  if( io_l ) write(io_fid_log,*) '*** specific gas constant (dry air) [J/kg/K] : Rdry = ', const_rdry
213  if( io_l ) write(io_fid_log,*) '*** specific heat (dry air, const. pressure) [J/kg/K] : CPdry = ', const_cpdry
214  if( io_l ) write(io_fid_log,*) '*** specific heat (dry air, const. volume) [J/kg/K] : Cvdry = ', const_cvdry
215  if( io_l ) write(io_fid_log,*) '*** lapse rate of ISA [K/m] : LAPS = ', const_laps
216  if( io_l ) write(io_fid_log,*) '*** dry adiabatic lapse rate [K/m] : LAPSdry = ', const_lapsdry
217 
218  if( io_l ) write(io_fid_log,*) '*** mass weight (water vapor) [g/mol] : Rvap = ', const_rvap
219  if( io_l ) write(io_fid_log,*) '*** specific gas constant (water vapor) [J/kg/K] : Rvap = ', const_rvap
220  if( io_l ) write(io_fid_log,*) '*** specific heat (vapor, const. pressure) [J/kg/K] : CPvap = ', const_cpvap
221  if( io_l ) write(io_fid_log,*) '*** specific heat (vapor, const. volume) [J/kg/K] : CVvap = ', const_cvvap
222  if( io_l ) write(io_fid_log,*) '*** specific heat (liquid water) [J/kg/K] : CL = ', const_cl
223  if( io_l ) write(io_fid_log,*) '*** specific heat (ice) [J/kg/K] : CI = ', const_ci
224  if( io_l ) write(io_fid_log,*) '*** Rdry / Rvap : EPSvap = ', const_epsvap
225  if( io_l ) write(io_fid_log,*) '*** 1 / EPSvap - 1 : EPSTvap = ', const_epstvap
226 
227  if( io_l ) write(io_fid_log,*) '*** latent heat of vaporizaion at 0C [J/kg] : LHV0 = ', const_lhv0
228  if( io_l ) write(io_fid_log,*) '*** latent heat of sublimation at 0C [J/kg] : LHS0 = ', const_lhs0
229  if( io_l ) write(io_fid_log,*) '*** latent heat of fusion at 0C [J/kg] : LHF0 = ', const_lhf0
230  if( io_l ) write(io_fid_log,*) '*** latent heat of vaporizaion at 0K [J/kg] : LHV00 = ', const_lhv00
231  if( io_l ) write(io_fid_log,*) '*** latent heat of sublimation at 0K [J/kg] : LHS00 = ', const_lhs00
232  if( io_l ) write(io_fid_log,*) '*** latent heat of fusion at 0K [J/kg] : LHF00 = ', const_lhf00
233  if( io_l ) write(io_fid_log,*) '*** Thermodynamics calculation type : ', trim(const_thermodyn_type)
234  if( io_l ) write(io_fid_log,*) '*** latent heat of vaporizaion (used) [J/kg] : LHV = ', const_lhv
235  if( io_l ) write(io_fid_log,*) '*** latent heat of sublimation (used) [J/kg] : LHS = ', const_lhs
236  if( io_l ) write(io_fid_log,*) '*** latent heat of fusion (used) [J/kg] : LHF = ', const_lhf
237  if( io_l ) write(io_fid_log,*) '*** saturate pressure of water vapor at 0C [Pa] : PSAT0 = ', const_psat0
238  if( io_l ) write(io_fid_log,*) '*** density of water [kg/m3] : DWATR = ', const_dwatr
239  if( io_l ) write(io_fid_log,*) '*** density of ice [kg/m3] : DICE = ', const_dice
240 
241  if( io_l ) write(io_fid_log,*) '*** speed of sound (dry air at 0C) [m/s] : SOUND = ', const_sound
242  if( io_l ) write(io_fid_log,*) '*** standard pressure [Pa] : Pstd = ', const_pstd
243  if( io_l ) write(io_fid_log,*) '*** pressure reference [Pa] : PRE00 = ', const_pre00
244  if( io_l ) write(io_fid_log,*) '*** standard temperature (15C) [K] : Tstd = ', const_tstd
245  if( io_l ) write(io_fid_log,*) '*** temperature reference (0C) [K] : TEM00 = ', const_tem00
246 
247  return
248  end subroutine const_setup
249 
250 end module scale_const
251 !-------------------------------------------------------------------------------
real(rp), public const_lhs
latent heat of sublimation for use
Definition: scale_const.F90:78
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K]
Definition: scale_const.F90:59
real(rp), parameter, public const_psat0
saturate pressure of water vapor at 0C [Pa]
Definition: scale_const.F90:86
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
Definition: scale_const.F90:58
real(rp), parameter, public const_ppm
parts par million
Definition: scale_const.F90:96
real(rp), public const_huge
huge number
Definition: scale_const.F90:38
integer, public const_i_lw
long-wave radiation index
Definition: scale_const.F90:98
subroutine, public prc_mpistop
Abort MPI.
real(rp), parameter, public const_stb
Stefan-Boltzman constant [W/m2/K4].
Definition: scale_const.F90:51
real(rp), parameter, public const_ci
specific heat (ice) [J/kg/K]
Definition: scale_const.F90:69
real(rp), parameter, public const_dwatr
density of water [kg/m3]
Definition: scale_const.F90:87
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:59
real(rp), parameter, public const_cl
specific heat (liquid water) [J/kg/K]
Definition: scale_const.F90:68
real(rp), public const_radius
radius of the planet [m]
Definition: scale_const.F90:46
module STDIO
Definition: scale_stdio.F90:12
real(rp), parameter, public const_tem00
temperature reference (0C) [K]
Definition: scale_const.F90:95
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:35
real(rp), public const_cvvap
specific heat (water vapor, constant volume) [J/kg/K]
Definition: scale_const.F90:67
real(rp), public const_laps
lapse rate of ISA [K/m]
Definition: scale_const.F90:60
real(rp), parameter, public const_karman
von Karman constant
Definition: scale_const.F90:52
real(rp), parameter, public const_tmelt
Definition: scale_const.F90:75
real(rp), public const_lhf0
latent heat of fusion at 0C [J/kg]
Definition: scale_const.F90:84
real(rp), parameter, public const_dice
density of ice [kg/m3]
Definition: scale_const.F90:88
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
Definition: scale_const.F90:57
real(rp), public const_undef
Definition: scale_const.F90:43
real(sp), parameter, public const_undef4
undefined value (REAL4)
Definition: scale_const.F90:41
real(rp), parameter, public const_lhs0
latent heat of sublimation at 0C [J/kg]
Definition: scale_const.F90:82
real(rp), public const_ohm
angular velocity of the planet [1/s]
Definition: scale_const.F90:47
real(rp), public const_mvap
mass weight (water vapor) [g/mol]
Definition: scale_const.F90:64
integer, parameter, public dp
Definition: dc_types.f90:27
real(rp), public const_lapsdry
dry adiabatic lapse rate [K/m]
Definition: scale_const.F90:61
real(rp), parameter, public const_lhv0
latent heat of vaporizaion at 0C [J/kg]
Definition: scale_const.F90:80
real(rp), public const_pre00
pressure reference [Pa]
Definition: scale_const.F90:93
subroutine, public const_setup
Setup.
real(rp), parameter, public const_r
universal gas constant [J/mol/K]
Definition: scale_const.F90:53
real(rp), public const_lhf00
latent heat of fusion at 0K [J/kg]
Definition: scale_const.F90:85
real(rp), public const_grav
standard acceleration of gravity [m/s2]
Definition: scale_const.F90:48
integer, parameter, public const_undef2
undefined value (INT2)
Definition: scale_const.F90:40
module PROCESS
real(rp), public const_lhs00
latent heat of sublimation at 0K [J/kg]
Definition: scale_const.F90:83
real(rp), public const_lhv00
latent heat of vaporizaion at 0K [J/kg]
Definition: scale_const.F90:81
real(rp), public const_epsvap
Rdry / Rvap.
Definition: scale_const.F90:71
real(rp), public const_epstvap
1 / epsilon - 1
Definition: scale_const.F90:72
real(rp), public const_lhv
latent heat of vaporizaion for use
Definition: scale_const.F90:77
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
Definition: scale_const.F90:65
real(rp), public const_sound
speed of sound (dry air at 0C) [m/s]
Definition: scale_const.F90:90
module CONSTANT
Definition: scale_const.F90:14
real(rp), parameter, public const_emelt
Definition: scale_const.F90:74
real(dp), parameter, public const_undef8
undefined value (REAL8)
Definition: scale_const.F90:42
real(rp), public const_lhf
latent heat of fusion for use
Definition: scale_const.F90:79
integer, parameter, public sp
Definition: dc_types.f90:30
real(rp), public const_eps
small number
Definition: scale_const.F90:36
logical, public io_lnml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:60
integer, public const_i_sw
short-wave radiation index
Definition: scale_const.F90:99
module PRECISION
real(rp), public const_tstd
standard temperature (15C) [K]
Definition: scale_const.F90:94
real(rp), public const_pi
pi
Definition: scale_const.F90:34
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
real(rp), parameter, public const_cpvap
specific heat (water vapor, constant pressure) [J/kg/K]
Definition: scale_const.F90:66
character(len=h_short), public const_thermodyn_type
internal energy type
real(rp), public const_mdry
mass weight (dry air) [g/mol]
Definition: scale_const.F90:56
integer, parameter, public rp
real(rp), public const_pstd
standard pressure [Pa]
Definition: scale_const.F90:92
real(rp), public const_eps1
small number
Definition: scale_const.F90:37