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  real(RP) :: CONST_SmallPlanetFactor = 1.0_rp
121 
122  namelist / param_const / &
123  const_radius, &
124  const_ohm, &
125  const_grav, &
126  const_rdry, &
127  const_cpdry, &
128  const_laps, &
129  const_pstd, &
130  const_pre00, &
131  const_tstd, &
133  const_smallplanetfactor
134 
135  integer :: ierr
136  !---------------------------------------------------------------------------
137 
138  if( io_l ) write(io_fid_log,*)
139  if( io_l ) write(io_fid_log,*) '++++++ Module[CONST] / Categ[COMMON] / Origin[SCALElib]'
140 
141  !--- read namelist
142  rewind(io_fid_conf)
143  read(io_fid_conf,nml=param_const,iostat=ierr)
144  if( ierr < 0 ) then !--- missing
145  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
146  elseif( ierr > 0 ) then !--- fatal error
147  write(*,*) 'xxx Not appropriate names in namelist PARAM_CONST. Check!'
148  call prc_mpistop
149  endif
150  if( io_lnml ) write(io_fid_log,nml=param_const)
151 
152  if ( rp == sp ) then
153  const_undef = real(const_undef4,kind=rp)
154  elseif( rp == dp ) then
155  const_undef = real(const_undef8,kind=rp)
156  else
157  write(*,*) 'xxx unsupported precision: ', rp
158  call prc_mpistop
159  endif
160 
161  const_pi = 4.e0_rp * atan( 1.0_rp )
162  const_d2r = const_pi / 180.0_rp
163  const_eps = epsilon(0.0_rp)
164  const_eps1 = 1.0_rp - epsilon(0.0_rp)
165  const_huge = huge(0.0_rp)
166 
167  const_radius = const_radius / const_smallplanetfactor
168  const_ohm = const_ohm * const_smallplanetfactor
169 
172 
175  const_epstvap = 1.e0_rp / const_epsvap - 1.e0_rp
176 
178 
182 
183  if ( const_thermodyn_type == 'EXACT' ) then
187  elseif( const_thermodyn_type == 'SIMPLE' ) then
191  else
192  write(*,*) 'xxx Not appropriate ATMOS_THERMODYN_ENERGY_TYPE. Check!', trim(const_thermodyn_type)
193  call prc_mpistop
194  endif
195 
197 
198  if( io_l ) write(io_fid_log,*)
199  if( io_l ) write(io_fid_log,*) '*** List of constants ***'
200  if( io_l ) write(io_fid_log,*) '*** PI : PI = ', const_pi
201  if( io_l ) write(io_fid_log,*) '*** Small number : EPS = ', const_eps
202  if( io_l ) write(io_fid_log,*) '*** Small number (1-EPS) : EPS1 = ', const_eps1
203  if( io_l ) write(io_fid_log,*) '*** Huge number : HUGE = ', const_huge
204  if( io_l ) write(io_fid_log,*) '*** undefined number (INT2) : UNDEF2 = ', const_undef2
205  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL,general use) : UNDEF = ', const_undef
206  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL4) : UNDEF4 = ', const_undef4
207  if( io_l ) write(io_fid_log,*) '*** undefined number (REAL8) : UNDEF8 = ', const_undef8
208 
209  if( io_l ) write(io_fid_log,*) '*** radius of the planet [m] : RADIUS = ', const_radius
210  if( io_l ) write(io_fid_log,*) '*** angular velocity of the planet [1/s] : OHM = ', const_ohm
211  if( io_l ) write(io_fid_log,*) '*** standard acceleration of gravity [m/s2] : GRAV = ', const_grav
212 
213  if( io_l ) write(io_fid_log,*) '*** Stefan-Boltzman constant [W/m2/K4] : STB = ', const_stb
214  if( io_l ) write(io_fid_log,*) '*** von Karman constant : KARMAN = ', const_karman
215  if( io_l ) write(io_fid_log,*) '*** universal gas constant [J/mol/K] : R = ', const_r
216 
217  if( io_l ) write(io_fid_log,*) '*** mass weight (dry air) [g/mol] : Mdry = ', const_mdry
218  if( io_l ) write(io_fid_log,*) '*** specific gas constant (dry air) [J/kg/K] : Rdry = ', const_rdry
219  if( io_l ) write(io_fid_log,*) '*** specific heat (dry air, const. pressure) [J/kg/K] : CPdry = ', const_cpdry
220  if( io_l ) write(io_fid_log,*) '*** specific heat (dry air, const. volume) [J/kg/K] : Cvdry = ', const_cvdry
221  if( io_l ) write(io_fid_log,*) '*** lapse rate of ISA [K/m] : LAPS = ', const_laps
222  if( io_l ) write(io_fid_log,*) '*** dry adiabatic lapse rate [K/m] : LAPSdry = ', const_lapsdry
223 
224  if( io_l ) write(io_fid_log,*) '*** mass weight (water vapor) [g/mol] : Rvap = ', const_rvap
225  if( io_l ) write(io_fid_log,*) '*** specific gas constant (water vapor) [J/kg/K] : Rvap = ', const_rvap
226  if( io_l ) write(io_fid_log,*) '*** specific heat (vapor, const. pressure) [J/kg/K] : CPvap = ', const_cpvap
227  if( io_l ) write(io_fid_log,*) '*** specific heat (vapor, const. volume) [J/kg/K] : CVvap = ', const_cvvap
228  if( io_l ) write(io_fid_log,*) '*** specific heat (liquid water) [J/kg/K] : CL = ', const_cl
229  if( io_l ) write(io_fid_log,*) '*** specific heat (ice) [J/kg/K] : CI = ', const_ci
230  if( io_l ) write(io_fid_log,*) '*** Rdry / Rvap : EPSvap = ', const_epsvap
231  if( io_l ) write(io_fid_log,*) '*** 1 / EPSvap - 1 : EPSTvap = ', const_epstvap
232 
233  if( io_l ) write(io_fid_log,*) '*** latent heat of vaporizaion at 0C [J/kg] : LHV0 = ', const_lhv0
234  if( io_l ) write(io_fid_log,*) '*** latent heat of sublimation at 0C [J/kg] : LHS0 = ', const_lhs0
235  if( io_l ) write(io_fid_log,*) '*** latent heat of fusion at 0C [J/kg] : LHF0 = ', const_lhf0
236  if( io_l ) write(io_fid_log,*) '*** latent heat of vaporizaion at 0K [J/kg] : LHV00 = ', const_lhv00
237  if( io_l ) write(io_fid_log,*) '*** latent heat of sublimation at 0K [J/kg] : LHS00 = ', const_lhs00
238  if( io_l ) write(io_fid_log,*) '*** latent heat of fusion at 0K [J/kg] : LHF00 = ', const_lhf00
239  if( io_l ) write(io_fid_log,*) '*** Thermodynamics calculation type : ', trim(const_thermodyn_type)
240  if( io_l ) write(io_fid_log,*) '*** latent heat of vaporizaion (used) [J/kg] : LHV = ', const_lhv
241  if( io_l ) write(io_fid_log,*) '*** latent heat of sublimation (used) [J/kg] : LHS = ', const_lhs
242  if( io_l ) write(io_fid_log,*) '*** latent heat of fusion (used) [J/kg] : LHF = ', const_lhf
243  if( io_l ) write(io_fid_log,*) '*** saturate pressure of water vapor at 0C [Pa] : PSAT0 = ', const_psat0
244  if( io_l ) write(io_fid_log,*) '*** density of water [kg/m3] : DWATR = ', const_dwatr
245  if( io_l ) write(io_fid_log,*) '*** density of ice [kg/m3] : DICE = ', const_dice
246 
247  if( io_l ) write(io_fid_log,*) '*** speed of sound (dry air at 0C) [m/s] : SOUND = ', const_sound
248  if( io_l ) write(io_fid_log,*) '*** standard pressure [Pa] : Pstd = ', const_pstd
249  if( io_l ) write(io_fid_log,*) '*** pressure reference [Pa] : PRE00 = ', const_pre00
250  if( io_l ) write(io_fid_log,*) '*** standard temperature (15C) [K] : Tstd = ', const_tstd
251  if( io_l ) write(io_fid_log,*) '*** temperature reference (0C) [K] : TEM00 = ', const_tem00
252 
253  return
254  end subroutine const_setup
255 
256 end module scale_const
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