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  real(rp), public, parameter :: const_epsvac = 8.854187817e-12_rp
94  real(rp), public :: const_epsair = 1.00059_rp
95 
96  integer, public :: const_i_lw = 1
97  integer, public :: const_i_sw = 2
98 
99  character(len=H_SHORT), public :: const_thermodyn_type = 'EXACT'
100 
101  !-----------------------------------------------------------------------------
102  !
103  !++ Private procedure
104  !
105  !-----------------------------------------------------------------------------
106  !
107  !++ Private parameters & variables
108  !
109  logical, private :: initialized = .false.
110  !-----------------------------------------------------------------------------
111 contains
112  !-----------------------------------------------------------------------------
114  subroutine const_setup
115  use scale_prc, only: &
116  prc_abort
117  implicit none
118 
119  real(rp) :: const_smallplanetfactor = 1.0_rp
120 
121  namelist / param_const / &
122  const_radius, &
123  const_ohm, &
124  const_grav, &
125  const_rdry, &
126  const_cpdry, &
127  const_laps, &
128  const_pstd, &
129  const_pre00, &
130  const_tstd, &
132  const_smallplanetfactor
133 
134  integer :: ierr
135  !---------------------------------------------------------------------------
136 
137  if ( initialized ) return
138  initialized = .true.
139 
140  log_newline
141  log_info("CONST_setup",*) 'Setup'
142 
143  !--- read namelist
144  rewind(io_fid_conf)
145  read(io_fid_conf,nml=param_const,iostat=ierr)
146  if( ierr < 0 ) then !--- missing
147  log_info("CONST_setup",*) 'Not found namelist. Default used.'
148  elseif( ierr > 0 ) then !--- fatal error
149  log_error("CONST_setup",*) 'Not appropriate names in namelist PARAM_CONST. Check!'
150  call prc_abort
151  endif
152  log_nml(param_const)
153 
154  if ( rp == sp ) then
155  const_undef = real(const_undef4,kind=rp)
156  elseif( rp == dp ) then
157  const_undef = real(const_undef8,kind=rp)
158  else
159  log_error("CONST_setup",*) 'unsupported precision: ', rp
160  call prc_abort
161  endif
162 
163  const_pi = 4.0_rp * atan( 1.0_rp )
164  const_d2r = const_pi / 180.0_rp
165  const_eps = epsilon(0.0_rp)
166  const_eps1 = 1.0_rp - epsilon(0.0_rp)
167  const_huge = huge(0.0_rp)
168 
169  const_radius = const_radius / const_smallplanetfactor
170  const_ohm = const_ohm * const_smallplanetfactor
171 
174 
177  const_epstvap = 1.0_rp / const_epsvap - 1.0_rp
178 
180 
184 
186 
187  log_newline
188  log_info("CONST_setup",*) 'List of constants '
189  log_info_cont(*) 'PI : PI = ', const_pi
190  log_info_cont(*) 'Small number : EPS = ', const_eps
191  log_info_cont(*) 'Small number (1-EPS) : EPS1 = ', const_eps1
192  log_info_cont(*) 'Huge number : HUGE = ', const_huge
193  log_info_cont(*) 'undefined number (INT2) : UNDEF2 = ', const_undef2
194  log_info_cont(*) 'undefined number (REAL,general use) : UNDEF = ', const_undef
195  log_info_cont(*) 'undefined number (REAL4) : UNDEF4 = ', const_undef4
196  log_info_cont(*) 'undefined number (REAL8) : UNDEF8 = ', const_undef8
197 
198  log_info_cont(*) 'radius of the planet [m] : RADIUS = ', const_radius
199  log_info_cont(*) 'angular velocity of the planet [1/s] : OHM = ', const_ohm
200  log_info_cont(*) 'standard acceleration of gravity [m/s2] : GRAV = ', const_grav
201 
202  log_info_cont(*) 'Stefan-Boltzman constant [W/m2/K4] : STB = ', const_stb
203  log_info_cont(*) 'von Karman constant : KARMAN = ', const_karman
204  log_info_cont(*) 'universal gas constant [J/mol/K] : R = ', const_r
205 
206  log_info_cont(*) 'mass weight (dry air) [g/mol] : Mdry = ', const_mdry
207  log_info_cont(*) 'specific gas constant (dry air) [J/kg/K] : Rdry = ', const_rdry
208  log_info_cont(*) 'specific heat (dry air, const. pressure) [J/kg/K] : CPdry = ', const_cpdry
209  log_info_cont(*) 'specific heat (dry air, const. volume) [J/kg/K] : Cvdry = ', const_cvdry
210  log_info_cont(*) 'lapse rate of ISA [K/m] : LAPS = ', const_laps
211  log_info_cont(*) 'dry adiabatic lapse rate [K/m] : LAPSdry = ', const_lapsdry
212 
213  log_info_cont(*) 'mass weight (water vapor) [g/mol] : Mvap = ', const_mvap
214  log_info_cont(*) 'specific gas constant (water vapor) [J/kg/K] : Rvap = ', const_rvap
215  log_info_cont(*) 'specific heat (vapor, const. pressure) [J/kg/K] : CPvap = ', const_cpvap
216  log_info_cont(*) 'specific heat (vapor, const. volume) [J/kg/K] : CVvap = ', const_cvvap
217  log_info_cont(*) 'specific heat (liquid water) [J/kg/K] : CL = ', const_cl
218  log_info_cont(*) 'specific heat (ice) [J/kg/K] : CI = ', const_ci
219  log_info_cont(*) 'Rdry / Rvap : EPSvap = ', const_epsvap
220  log_info_cont(*) '1 / EPSvap - 1 : EPSTvap = ', const_epstvap
221 
222  log_info_cont(*) 'latent heat of vaporizaion at 0C [J/kg] : LHV0 = ', const_lhv0
223  log_info_cont(*) 'latent heat of sublimation at 0C [J/kg] : LHS0 = ', const_lhs0
224  log_info_cont(*) 'latent heat of fusion at 0C [J/kg] : LHF0 = ', const_lhf0
225  log_info_cont(*) 'latent heat of vaporizaion at 0K [J/kg] : LHV00 = ', const_lhv00
226  log_info_cont(*) 'latent heat of sublimation at 0K [J/kg] : LHS00 = ', const_lhs00
227  log_info_cont(*) 'latent heat of fusion at 0K [J/kg] : LHF00 = ', const_lhf00
228  log_info_cont(*) 'Thermodynamics calculation type : ', trim(const_thermodyn_type)
229  log_info_cont(*) 'saturate pressure of water vapor at 0C [Pa] : PSAT0 = ', const_psat0
230  log_info_cont(*) 'density of water [kg/m3] : DWATR = ', const_dwatr
231  log_info_cont(*) 'density of ice [kg/m3] : DICE = ', const_dice
232 
233  log_info_cont(*) 'speed of sound (dry air at 0C) [m/s] : SOUND = ', const_sound
234  log_info_cont(*) 'standard pressure [Pa] : Pstd = ', const_pstd
235  log_info_cont(*) 'pressure reference [Pa] : PRE00 = ', const_pre00
236  log_info_cont(*) 'standard temperature (15C) [K] : Tstd = ', const_tstd
237  log_info_cont(*) 'temperature reference (0C) [K] : TEM00 = ', const_tem00
238 
239  return
240  end subroutine const_setup
241 
242 end module scale_const
scale_const::const_grav
real(rp), public const_grav
standard acceleration of gravity [m/s2]
Definition: scale_const.F90:46
scale_const::const_lapsdry
real(rp), public const_lapsdry
dry adiabatic lapse rate [K/m]
Definition: scale_const.F90:59
scale_precision::sp
integer, parameter, public sp
Definition: scale_precision.F90:31
scale_const::const_lhv0
real(rp), parameter, public const_lhv0
latent heat of vaporizaion at 0C [J/kg]
Definition: scale_const.F90:75
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:342
scale_const::const_epstvap
real(rp), public const_epstvap
1 / epsilon - 1
Definition: scale_const.F90:70
scale_const::const_sound
real(rp), public const_sound
speed of sound (dry air at 0C) [m/s]
Definition: scale_const.F90:85
scale_const::const_r
real(rp), parameter, public const_r
universal gas constant [J/mol/K]
Definition: scale_const.F90:51
scale_const::const_undef2
integer, parameter, public const_undef2
undefined value (INT2)
Definition: scale_const.F90:38
scale_const::const_lhs00
real(rp), public const_lhs00
latent heat of sublimation at 0K [J/kg]
Definition: scale_const.F90:78
scale_const::const_epsvap
real(rp), public const_epsvap
Rdry / Rvap.
Definition: scale_const.F90:69
scale_const::const_lhv00
real(rp), public const_lhv00
latent heat of vaporizaion at 0K [J/kg]
Definition: scale_const.F90:76
scale_const::const_epsvac
real(rp), parameter, public const_epsvac
parts par million
Definition: scale_const.F90:93
scale_const::const_undef8
real(dp), parameter, public const_undef8
undefined value (REAL8)
Definition: scale_const.F90:40
scale_precision
module PRECISION
Definition: scale_precision.F90:14
scale_const::const_rvap
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
Definition: scale_const.F90:63
scale_const::const_emelt
real(rp), parameter, public const_emelt
Definition: scale_const.F90:72
scale_const::const_eps
real(rp), public const_eps
small number
Definition: scale_const.F90:33
scale_const::const_tstd
real(rp), public const_tstd
standard temperature (15C) [K]
Definition: scale_const.F90:89
scale_const::const_thermodyn_type
character(len=h_short), public const_thermodyn_type
internal energy type
Definition: scale_const.F90:99
scale_const::const_i_sw
integer, public const_i_sw
short-wave radiation index
Definition: scale_const.F90:97
scale_const::const_cpvap
real(rp), parameter, public const_cpvap
specific heat (water vapor, constant pressure) [J/kg/K]
Definition: scale_const.F90:64
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_const::const_pi
real(rp), public const_pi
pi
Definition: scale_const.F90:31
scale_precision::rp
integer, parameter, public rp
Definition: scale_precision.F90:41
scale_io
module STDIO
Definition: scale_io.F90:10
scale_const::const_pstd
real(rp), public const_pstd
standard pressure [Pa]
Definition: scale_const.F90:87
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_const::const_mdry
real(rp), public const_mdry
mass weight (dry air) [g/mol]
Definition: scale_const.F90:54
scale_const::const_cvdry
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K]
Definition: scale_const.F90:57
scale_const::const_eps1
real(rp), public const_eps1
small number
Definition: scale_const.F90:34
scale_const::const_ppm
real(rp), parameter, public const_ppm
parts par million
Definition: scale_const.F90:91
scale_const::const_cpdry
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
Definition: scale_const.F90:56
scale_const::const_huge
real(rp), public const_huge
huge number
Definition: scale_const.F90:35
scale_precision::dp
integer, parameter, public dp
Definition: scale_precision.F90:32
scale_const::const_psat0
real(rp), parameter, public const_psat0
saturate pressure of water vapor at 0C [Pa]
Definition: scale_const.F90:81
scale_const::const_i_lw
integer, public const_i_lw
long-wave radiation index
Definition: scale_const.F90:96
scale_const::const_stb
real(rp), parameter, public const_stb
Stefan-Boltzman constant [W/m2/K4].
Definition: scale_const.F90:49
scale_const::const_ci
real(rp), parameter, public const_ci
specific heat (ice) [J/kg/K]
Definition: scale_const.F90:67
scale_const::const_dwatr
real(rp), parameter, public const_dwatr
density of water [kg/m3]
Definition: scale_const.F90:82
scale_const::const_tem00
real(rp), parameter, public const_tem00
temperature reference (0C) [K]
Definition: scale_const.F90:90
scale_const::const_cl
real(rp), parameter, public const_cl
specific heat (liquid water) [J/kg/K]
Definition: scale_const.F90:66
scale_const::const_cvvap
real(rp), public const_cvvap
specific heat (water vapor, constant volume) [J/kg/K]
Definition: scale_const.F90:65
scale_const::const_radius
real(rp), public const_radius
radius of the planet [m]
Definition: scale_const.F90:44
scale_const::const_tmelt
real(rp), parameter, public const_tmelt
Definition: scale_const.F90:73
scale_const::const_karman
real(rp), parameter, public const_karman
von Karman constant
Definition: scale_const.F90:50
scale_const::const_epsair
real(rp), public const_epsair
parts par million
Definition: scale_const.F90:94
scale_const::const_lhf0
real(rp), public const_lhf0
latent heat of fusion at 0C [J/kg]
Definition: scale_const.F90:79
scale_const::const_rdry
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
Definition: scale_const.F90:55
scale_const::const_undef4
real(sp), parameter, public const_undef4
undefined value (REAL4)
Definition: scale_const.F90:39
scale_const::const_lhs0
real(rp), parameter, public const_lhs0
latent heat of sublimation at 0C [J/kg]
Definition: scale_const.F90:77
scale_const::const_d2r
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:32
scale_const::const_laps
real(rp), public const_laps
lapse rate of ISA [K/m]
Definition: scale_const.F90:58
scale_const::const_mvap
real(rp), public const_mvap
mass weight (water vapor) [g/mol]
Definition: scale_const.F90:62
scale_const::const_dice
real(rp), parameter, public const_dice
density of ice [kg/m3]
Definition: scale_const.F90:83
scale_const::const_undef
real(rp), public const_undef
Definition: scale_const.F90:41
scale_const::const_ohm
real(rp), public const_ohm
angular velocity of the planet [1/s]
Definition: scale_const.F90:45
scale_const::const_pre00
real(rp), public const_pre00
pressure reference [Pa]
Definition: scale_const.F90:88
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:56
scale_const::const_setup
subroutine, public const_setup
Setup.
Definition: scale_const.F90:115
scale_const::const_lhf00
real(rp), public const_lhf00
latent heat of fusion at 0K [J/kg]
Definition: scale_const.F90:80