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