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.31436_rp
54 
55  ! dry air constants
56  real(RP), public :: const_mdry = 28.966_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.016_rp
65  real(RP), public, parameter :: const_rvap = 461.50_rp
66  real(RP), public, parameter :: const_cpvap = 1846.00_rp
67  real(RP), public :: const_cvvap
68  real(RP), public, parameter :: const_cl = 4218.0_rp
69  real(RP), public, parameter :: const_ci = 2106.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, parameter :: const_lhv0 = 2.501e+6_rp
78  real(RP), public :: const_lhv00
79  real(RP), public, parameter :: const_lhs0 = 2.834e+6_rp
80  real(RP), public :: const_lhs00
81  real(RP), public :: const_lhf0
82  real(RP), public :: const_lhf00
83  real(RP), public, parameter :: const_psat0 = 610.78_rp
84  real(RP), public, parameter :: const_dwatr = 1000.0_rp
85  real(RP), public, parameter :: const_dice = 916.8_rp
86 
87  real(RP), public :: const_sound
88 
89  real(RP), public :: const_pstd = 101325.0_rp
90  real(RP), public :: const_pre00 = 100000.0_rp
91  real(RP), public :: const_tstd = 288.15_rp
92  real(RP), public, parameter :: const_tem00 = 273.15_rp
93  real(RP), public, parameter :: const_ppm = 1.e-6_rp
94 
95  integer, public :: const_i_lw = 1
96  integer, public :: const_i_sw = 2
97 
98  character(len=H_SHORT), public :: const_thermodyn_type = 'EXACT'
99 
100  !-----------------------------------------------------------------------------
101  !
102  !++ Private procedure
103  !
104  !-----------------------------------------------------------------------------
105  !
106  !++ Private parameters & variables
107  !
108  !-----------------------------------------------------------------------------
109 contains
110  !-----------------------------------------------------------------------------
112  subroutine const_setup
113  use scale_process, only: &
115  implicit none
116 
117  real(RP) :: const_smallplanetfactor = 1.0_rp
118 
119  namelist / param_const / &
120  const_radius, &
121  const_ohm, &
122  const_grav, &
123  const_rdry, &
124  const_cpdry, &
125  const_laps, &
126  const_pstd, &
127  const_pre00, &
128  const_tstd, &
130  const_smallplanetfactor
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_nml ) write(io_fid_nml,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.0_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 
164  const_radius = const_radius / const_smallplanetfactor
165  const_ohm = const_ohm * const_smallplanetfactor
166 
169 
172  const_epstvap = 1.0_rp / const_epsvap - 1.0_rp
173 
175 
179 
181 
182  if( io_l ) write(io_fid_log,*)
183  if( io_l ) write(io_fid_log,*) '*** List of constants ***'
184  if( io_l ) write(io_fid_log,*) '*** PI : PI = ', const_pi
185  if( io_l ) write(io_fid_log,*) '*** Small number : EPS = ', const_eps
186  if( io_l ) write(io_fid_log,*) '*** Small number (1-EPS) : EPS1 = ', const_eps1
187  if( io_l ) write(io_fid_log,*) '*** Huge number : HUGE = ', const_huge
188  if( io_l ) write(io_fid_log,*) '*** undefined number (INT2) : UNDEF2 = ', const_undef2
189  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL,general use) : UNDEF = ', const_undef
190  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL4) : UNDEF4 = ', const_undef4
191  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL8) : UNDEF8 = ', const_undef8
192 
193  if( io_l ) write(io_fid_log,*) '*** radius of the planet [m] : RADIUS = ', const_radius
194  if( io_l ) write(io_fid_log,*) '*** angular velocity of the planet [1/s] : OHM = ', const_ohm
195  if( io_l ) write(io_fid_log,*) '*** standard acceleration of gravity [m/s2] : GRAV = ', const_grav
196 
197  if( io_l ) write(io_fid_log,*) '*** Stefan-Boltzman constant [W/m2/K4] : STB = ', const_stb
198  if( io_l ) write(io_fid_log,*) '*** von Karman constant : KARMAN = ', const_karman
199  if( io_l ) write(io_fid_log,*) '*** universal gas constant [J/mol/K] : R = ', const_r
200 
201  if( io_l ) write(io_fid_log,*) '*** mass weight (dry air) [g/mol] : Mdry = ', const_mdry
202  if( io_l ) write(io_fid_log,*) '*** specific gas constant (dry air) [J/kg/K] : Rdry = ', const_rdry
203  if( io_l ) write(io_fid_log,*) '*** specific heat (dry air, const. pressure) [J/kg/K] : CPdry = ', const_cpdry
204  if( io_l ) write(io_fid_log,*) '*** specific heat (dry air, const. volume) [J/kg/K] : Cvdry = ', const_cvdry
205  if( io_l ) write(io_fid_log,*) '*** lapse rate of ISA [K/m] : LAPS = ', const_laps
206  if( io_l ) write(io_fid_log,*) '*** dry adiabatic lapse rate [K/m] : LAPSdry = ', const_lapsdry
207 
208  if( io_l ) write(io_fid_log,*) '*** mass weight (water vapor) [g/mol] : Rvap = ', const_rvap
209  if( io_l ) write(io_fid_log,*) '*** specific gas constant (water vapor) [J/kg/K] : Rvap = ', const_rvap
210  if( io_l ) write(io_fid_log,*) '*** specific heat (vapor, const. pressure) [J/kg/K] : CPvap = ', const_cpvap
211  if( io_l ) write(io_fid_log,*) '*** specific heat (vapor, const. volume) [J/kg/K] : CVvap = ', const_cvvap
212  if( io_l ) write(io_fid_log,*) '*** specific heat (liquid water) [J/kg/K] : CL = ', const_cl
213  if( io_l ) write(io_fid_log,*) '*** specific heat (ice) [J/kg/K] : CI = ', const_ci
214  if( io_l ) write(io_fid_log,*) '*** Rdry / Rvap : EPSvap = ', const_epsvap
215  if( io_l ) write(io_fid_log,*) '*** 1 / EPSvap - 1 : EPSTvap = ', const_epstvap
216 
217  if( io_l ) write(io_fid_log,*) '*** latent heat of vaporizaion at 0C [J/kg] : LHV0 = ', const_lhv0
218  if( io_l ) write(io_fid_log,*) '*** latent heat of sublimation at 0C [J/kg] : LHS0 = ', const_lhs0
219  if( io_l ) write(io_fid_log,*) '*** latent heat of fusion at 0C [J/kg] : LHF0 = ', const_lhf0
220  if( io_l ) write(io_fid_log,*) '*** latent heat of vaporizaion at 0K [J/kg] : LHV00 = ', const_lhv00
221  if( io_l ) write(io_fid_log,*) '*** latent heat of sublimation at 0K [J/kg] : LHS00 = ', const_lhs00
222  if( io_l ) write(io_fid_log,*) '*** latent heat of fusion at 0K [J/kg] : LHF00 = ', const_lhf00
223  if( io_l ) write(io_fid_log,*) '*** Thermodynamics calculation type : ', trim(const_thermodyn_type)
224  if( io_l ) write(io_fid_log,*) '*** saturate pressure of water vapor at 0C [Pa] : PSAT0 = ', const_psat0
225  if( io_l ) write(io_fid_log,*) '*** density of water [kg/m3] : DWATR = ', const_dwatr
226  if( io_l ) write(io_fid_log,*) '*** density of ice [kg/m3] : DICE = ', const_dice
227 
228  if( io_l ) write(io_fid_log,*) '*** speed of sound (dry air at 0C) [m/s] : SOUND = ', const_sound
229  if( io_l ) write(io_fid_log,*) '*** standard pressure [Pa] : Pstd = ', const_pstd
230  if( io_l ) write(io_fid_log,*) '*** pressure reference [Pa] : PRE00 = ', const_pre00
231  if( io_l ) write(io_fid_log,*) '*** standard temperature (15C) [K] : Tstd = ', const_tstd
232  if( io_l ) write(io_fid_log,*) '*** temperature reference (0C) [K] : TEM00 = ', const_tem00
233 
234  return
235  end subroutine const_setup
236 
237 end module scale_const
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:83
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:93
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:95
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:84
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:61
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:92
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:81
real(rp), parameter, public const_dice
density of ice [kg/m3]
Definition: scale_const.F90:85
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:79
real(rp), public const_ohm
angular velocity of the planet [1/s]
Definition: scale_const.F90:47
logical, public io_nml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:62
real(rp), public const_mvap
mass weight (water vapor) [g/mol]
Definition: scale_const.F90:64
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:77
real(rp), public const_pre00
pressure reference [Pa]
Definition: scale_const.F90:90
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:82
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:80
real(rp), public const_lhv00
latent heat of vaporizaion at 0K [J/kg]
Definition: scale_const.F90:78
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), 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:87
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_eps
small number
Definition: scale_const.F90:36
integer, public const_i_sw
short-wave radiation index
Definition: scale_const.F90:96
module PRECISION
real(rp), public const_tstd
standard temperature (15C) [K]
Definition: scale_const.F90:91
real(rp), public const_pi
pi
Definition: scale_const.F90:34
integer, parameter, public sp
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
Definition: scale_const.F90:98
real(rp), public const_mdry
mass weight (dry air) [g/mol]
Definition: scale_const.F90:56
integer, parameter, public rp
integer, parameter, public dp
integer, public io_fid_nml
Log file ID (only for output namelist)
Definition: scale_stdio.F90:57
real(rp), public const_pstd
standard pressure [Pa]
Definition: scale_const.F90:89
real(rp), public const_eps1
small number
Definition: scale_const.F90:37