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  public :: const_finalize
27 
28  !-----------------------------------------------------------------------------
29  !
30  !++ Public parameters & variables
31  !
32  real(rp), public, parameter :: const_pi = 4.0_rp * atan( 1.0_rp )
33  real(rp), public :: const_d2r
34  real(rp), public :: const_r2d
35  real(rp), public :: const_eps = 1.e-16_rp
36  real(rp), public :: const_eps1 = 0.99999999999999_rp
37  real(rp), public :: const_huge = 1.e+30_rp
38  !$acc declare create(CONST_D2R, CONST_EPS, CONST_EPS1, CONST_HUGE)
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  !$acc declare create(CONST_UNDEF)
45 
46  ! adopted constants
47  real(rp), public :: const_radius
48  real(rp), public :: const_ohm
49  real(rp), public :: const_grav
50  !$acc declare create(CONST_RADIUS, CONST_OHM, CONST_GRAV)
51 
52  ! physical constants
53  real(rp), public, parameter :: const_stb = 5.670373e-8_rp
54  real(rp), public, parameter :: const_karman = 0.4_rp
55  real(rp), public, parameter :: const_r = 8.31436_rp
56 
57  ! dry air constants
58  real(rp), public :: const_mdry = 28.966_rp
59  real(rp), public :: const_rdry
60  real(rp), public :: const_cpdry
61  real(rp), public :: const_cvdry
62  real(rp), public :: const_laps
63  real(rp), public :: const_lapsdry
64  !$acc declare create(CONST_Mdry, CONST_Rdry, CONST_CPdry, CONST_CVdry, CONST_LAPS, CONST_LAPSdry)
65 
66  ! water constants
67  real(rp), public :: const_mvap = 18.016_rp
68  real(rp), public, parameter :: const_rvap = 461.50_rp
69  real(rp), public, parameter :: const_cpvap = 1846.00_rp
70  real(rp), public :: const_cvvap
71  real(rp), public, parameter :: const_cl = 4218.0_rp
72  real(rp), public, parameter :: const_ci = 2106.0_rp
73  !$acc declare create(CONST_Mvap)
74 
75  real(rp), public :: const_epsvap
76  real(rp), public :: const_epstvap
77  !$acc declare create(CONST_EPSvap, CONST_EPSTvap)
78 
79  real(rp), public, parameter :: const_emelt = 3.4e5_rp
80  real(rp), public, parameter :: const_tmelt = 273.15_rp
81 
82  real(rp), public, parameter :: const_lhv0 = 2.501e+6_rp
83  real(rp), public :: const_lhv00
84  real(rp), public, parameter :: const_lhs0 = 2.834e+6_rp
85  real(rp), public :: const_lhs00
86  real(rp), public :: const_lhf0
87  real(rp), public :: const_lhf00
88  real(rp), public, parameter :: const_psat0 = 610.78_rp
89  real(rp), public, parameter :: const_dwatr = 1000.0_rp
90  real(rp), public, parameter :: const_dice = 916.8_rp
91  !$acc declare create(CONST_LHV00, CONST_LHS00, CONST_LHF0, CONST_LHF00)
92 
93  real(rp), public :: const_sound
94  !$acc declare create(CONST_SOUND)
95 
96  real(rp), public :: const_pstd
97  real(rp), public :: const_pre00
98  real(rp), public :: const_tstd
99  real(rp), public, parameter :: const_tem00 = 273.15_rp
100  real(rp), public, parameter :: const_ppm = 1.e-6_rp
101  !$acc declare create(CONST_Pstd, CONST_PRE00, CONST_Tstd)
102 
103  real(rp), public, parameter :: const_epsvac = 8.854187817e-12_rp
104  real(rp), public :: const_epsair = 1.00059_rp
105  !$acc declare create(CONST_EPSair)
106 
107  integer, public :: const_i_lw = 1
108  integer, public :: const_i_sw = 2
109  !$acc declare create(CONST_I_LW, CONST_I_SW)
110 
111  character(len=H_SHORT), public :: const_thermodyn_type = 'EXACT'
112  !$acc declare create(CONST_THERMODYN_TYPE)
113 
114  !-----------------------------------------------------------------------------
115  !
116  !++ Private procedure
117  !
118  !-----------------------------------------------------------------------------
119  !
120  !++ Private parameters & variables
121  !
122  logical, private :: initialized = .false.
123  !-----------------------------------------------------------------------------
124 contains
125  !-----------------------------------------------------------------------------
127  subroutine const_setup
128  use scale_prc, only: &
129  prc_abort
130  implicit none
131 
132  real(rp) :: const_smallplanetfactor
133 
134  namelist / param_const / &
135  const_radius, &
136  const_ohm, &
137  const_grav, &
138  const_rdry, &
139  const_cpdry, &
140  const_laps, &
141  const_pstd, &
142  const_pre00, &
143  const_tstd, &
145  const_smallplanetfactor
146 
147  integer :: ierr
148  !---------------------------------------------------------------------------
149 
150  if ( initialized ) return
151  initialized = .true.
152 
153  log_newline
154  log_info("CONST_setup",*) 'Setup'
155 
156  const_radius = 6.37122e+6_rp
157  const_ohm = 7.2920e-5_rp
158  const_grav = 9.80665_rp
159  const_rdry = 287.04_rp
160  const_cpdry = 1004.64_rp
161  const_laps = 6.5e-3_rp
162  const_pstd = 101325.0_rp
163  const_pre00 = 100000.0_rp
164  const_tstd = 288.15_rp
165 
166  const_thermodyn_type = 'EXACT'
167 
168  const_smallplanetfactor = 1.0_rp
169 
170  !--- read namelist
171  rewind(io_fid_conf)
172  read(io_fid_conf,nml=param_const,iostat=ierr)
173  if( ierr < 0 ) then !--- missing
174  log_info("CONST_setup",*) 'Not found namelist. Default used.'
175  elseif( ierr > 0 ) then !--- fatal error
176  log_error("CONST_setup",*) 'Not appropriate names in namelist PARAM_CONST. Check!'
177  call prc_abort
178  endif
179  log_nml(param_const)
180 
181  if ( rp == sp ) then
182  const_undef = real(const_undef4,kind=rp)
183  elseif( rp == dp ) then
184  const_undef = real(const_undef8,kind=rp)
185  else
186  log_error("CONST_setup",*) 'unsupported precision: ', rp
187  call prc_abort
188  endif
189 
190  const_d2r = const_pi / 180.0_rp
191  const_r2d = 180.0_rp / const_pi
192  const_eps = epsilon(0.0_rp)
193  const_eps1 = 1.0_rp - epsilon(0.0_rp)
194  const_huge = huge(0.0_rp)
195 
196  const_radius = const_radius / const_smallplanetfactor
197  const_ohm = const_ohm * const_smallplanetfactor
198 
201 
204  const_epstvap = 1.0_rp / const_epsvap - 1.0_rp
205 
207 
211 
213 
214  log_newline
215  log_info("CONST_setup",*) 'List of constants '
216  log_info_cont(*) 'PI : PI = ', const_pi
217  log_info_cont(*) 'Small number : EPS = ', const_eps
218  log_info_cont(*) 'Small number (1-EPS) : EPS1 = ', const_eps1
219  log_info_cont(*) 'Huge number : HUGE = ', const_huge
220  log_info_cont(*) 'undefined number (INT2) : UNDEF2 = ', const_undef2
221  log_info_cont(*) 'undefined number (REAL,general use) : UNDEF = ', const_undef
222  log_info_cont(*) 'undefined number (REAL4) : UNDEF4 = ', const_undef4
223  log_info_cont(*) 'undefined number (REAL8) : UNDEF8 = ', const_undef8
224 
225  log_info_cont(*) 'radius of the planet [m] : RADIUS = ', const_radius
226  log_info_cont(*) 'angular velocity of the planet [1/s] : OHM = ', const_ohm
227  log_info_cont(*) 'standard acceleration of gravity [m/s2] : GRAV = ', const_grav
228 
229  log_info_cont(*) 'Stefan-Boltzman constant [W/m2/K4] : STB = ', const_stb
230  log_info_cont(*) 'von Karman constant : KARMAN = ', const_karman
231  log_info_cont(*) 'universal gas constant [J/mol/K] : R = ', const_r
232 
233  log_info_cont(*) 'mass weight (dry air) [g/mol] : Mdry = ', const_mdry
234  log_info_cont(*) 'specific gas constant (dry air) [J/kg/K] : Rdry = ', const_rdry
235  log_info_cont(*) 'specific heat (dry air, const. pressure) [J/kg/K] : CPdry = ', const_cpdry
236  log_info_cont(*) 'specific heat (dry air, const. volume) [J/kg/K] : Cvdry = ', const_cvdry
237  log_info_cont(*) 'lapse rate of ISA [K/m] : LAPS = ', const_laps
238  log_info_cont(*) 'dry adiabatic lapse rate [K/m] : LAPSdry = ', const_lapsdry
239 
240  log_info_cont(*) 'mass weight (water vapor) [g/mol] : Mvap = ', const_mvap
241  log_info_cont(*) 'specific gas constant (water vapor) [J/kg/K] : Rvap = ', const_rvap
242  log_info_cont(*) 'specific heat (vapor, const. pressure) [J/kg/K] : CPvap = ', const_cpvap
243  log_info_cont(*) 'specific heat (vapor, const. volume) [J/kg/K] : CVvap = ', const_cvvap
244  log_info_cont(*) 'specific heat (liquid water) [J/kg/K] : CL = ', const_cl
245  log_info_cont(*) 'specific heat (ice) [J/kg/K] : CI = ', const_ci
246  log_info_cont(*) 'Rdry / Rvap : EPSvap = ', const_epsvap
247  log_info_cont(*) '1 / EPSvap - 1 : EPSTvap = ', const_epstvap
248 
249  log_info_cont(*) 'latent heat of vaporizaion at 0C [J/kg] : LHV0 = ', const_lhv0
250  log_info_cont(*) 'latent heat of sublimation at 0C [J/kg] : LHS0 = ', const_lhs0
251  log_info_cont(*) 'latent heat of fusion at 0C [J/kg] : LHF0 = ', const_lhf0
252  log_info_cont(*) 'latent heat of vaporizaion at 0K [J/kg] : LHV00 = ', const_lhv00
253  log_info_cont(*) 'latent heat of sublimation at 0K [J/kg] : LHS00 = ', const_lhs00
254  log_info_cont(*) 'latent heat of fusion at 0K [J/kg] : LHF00 = ', const_lhf00
255  log_info_cont(*) 'Thermodynamics calculation type : ', trim(const_thermodyn_type)
256  log_info_cont(*) 'saturate pressure of water vapor at 0C [Pa] : PSAT0 = ', const_psat0
257  log_info_cont(*) 'density of water [kg/m3] : DWATR = ', const_dwatr
258  log_info_cont(*) 'density of ice [kg/m3] : DICE = ', const_dice
259 
260  log_info_cont(*) 'speed of sound (dry air at 0C) [m/s] : SOUND = ', const_sound
261  log_info_cont(*) 'standard pressure [Pa] : Pstd = ', const_pstd
262  log_info_cont(*) 'pressure reference [Pa] : PRE00 = ', const_pre00
263  log_info_cont(*) 'standard temperature (15C) [K] : Tstd = ', const_tstd
264  log_info_cont(*) 'temperature reference (0C) [K] : TEM00 = ', const_tem00
265 
266  !$acc update device(CONST_D2R, CONST_EPS, CONST_EPS1, CONST_HUGE)
267  !$acc update device(CONST_UNDEF)
268  !$acc update device(CONST_RADIUS, CONST_OHM, CONST_GRAV)
269  !$acc update device(CONST_Mdry, CONST_Rdry, CONST_CPdry, CONST_CVdry, CONST_LAPS, CONST_LAPSdry)
270  !$acc update device(CONST_Mvap)
271  !$acc update device(CONST_EPSvap, CONST_EPSTvap)
272  !$acc update device(CONST_LHV00, CONST_LHS00, CONST_LHF0, CONST_LHF00)
273  !$acc update device(CONST_SOUND)
274  !$acc update device(CONST_Pstd, CONST_PRE00, CONST_Tstd)
275  !$acc update device(CONST_EPSair)
276  !$acc update device(CONST_I_LW, CONST_I_SW)
277  !$acc update device(CONST_THERMODYN_TYPE)
278 
279  return
280  end subroutine const_setup
281 
282  !-----------------------------------------------------------------------------
284  subroutine const_finalize
285 
286  initialized = .false.
287 
288  return
289  end subroutine const_finalize
290 
291 end module scale_const
scale_const::const_grav
real(rp), public const_grav
standard acceleration of gravity [m/s2]
Definition: scale_const.F90:49
scale_const::const_lapsdry
real(rp), public const_lapsdry
dry adiabatic lapse rate [K/m]
Definition: scale_const.F90:63
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:82
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
scale_const::const_epstvap
real(rp), public const_epstvap
1 / epsilon - 1
Definition: scale_const.F90:76
scale_const::const_sound
real(rp), public const_sound
speed of sound (dry air at 0C) [m/s]
Definition: scale_const.F90:93
scale_const::const_r
real(rp), parameter, public const_r
universal gas constant [J/mol/K]
Definition: scale_const.F90:55
scale_const::const_undef2
integer, parameter, public const_undef2
undefined value (INT2)
Definition: scale_const.F90:40
scale_const::const_lhs00
real(rp), public const_lhs00
latent heat of sublimation at 0K [J/kg]
Definition: scale_const.F90:85
scale_const::const_epsvap
real(rp), public const_epsvap
Rdry / Rvap.
Definition: scale_const.F90:75
scale_const::const_lhv00
real(rp), public const_lhv00
latent heat of vaporizaion at 0K [J/kg]
Definition: scale_const.F90:83
scale_const::const_epsvac
real(rp), parameter, public const_epsvac
parts par million
Definition: scale_const.F90:103
scale_const::const_undef8
real(dp), parameter, public const_undef8
undefined value (REAL8)
Definition: scale_const.F90:42
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:68
scale_const::const_emelt
real(rp), parameter, public const_emelt
Definition: scale_const.F90:79
scale_const::const_eps
real(rp), public const_eps
small number
Definition: scale_const.F90:35
scale_const::const_tstd
real(rp), public const_tstd
standard temperature (15C) [K]
Definition: scale_const.F90:98
scale_const::const_thermodyn_type
character(len=h_short), public const_thermodyn_type
internal energy type
Definition: scale_const.F90:111
scale_const::const_i_sw
integer, public const_i_sw
short-wave radiation index
Definition: scale_const.F90:108
scale_const::const_cpvap
real(rp), parameter, public const_cpvap
specific heat (water vapor, constant pressure) [J/kg/K]
Definition: scale_const.F90:69
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_const::const_finalize
subroutine, public const_finalize
Finalize.
Definition: scale_const.F90:285
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:96
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:58
scale_const::const_cvdry
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K]
Definition: scale_const.F90:61
scale_const::const_eps1
real(rp), public const_eps1
small number
Definition: scale_const.F90:36
scale_const::const_ppm
real(rp), parameter, public const_ppm
parts par million
Definition: scale_const.F90:100
scale_const::const_cpdry
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
Definition: scale_const.F90:60
scale_const::const_huge
real(rp), public const_huge
huge number
Definition: scale_const.F90:37
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:88
scale_const::const_pi
real(rp), parameter, public const_pi
pi
Definition: scale_const.F90:32
scale_const::const_i_lw
integer, public const_i_lw
long-wave radiation index
Definition: scale_const.F90:107
scale_const::const_stb
real(rp), parameter, public const_stb
Stefan-Boltzman constant [W/m2/K4].
Definition: scale_const.F90:53
scale_const::const_ci
real(rp), parameter, public const_ci
specific heat (ice) [J/kg/K]
Definition: scale_const.F90:72
scale_const::const_dwatr
real(rp), parameter, public const_dwatr
density of water [kg/m3]
Definition: scale_const.F90:89
scale_const::const_tem00
real(rp), parameter, public const_tem00
temperature reference (0C) [K]
Definition: scale_const.F90:99
scale_const::const_cl
real(rp), parameter, public const_cl
specific heat (liquid water) [J/kg/K]
Definition: scale_const.F90:71
scale_const::const_cvvap
real(rp), public const_cvvap
specific heat (water vapor, constant volume) [J/kg/K]
Definition: scale_const.F90:70
scale_const::const_radius
real(rp), public const_radius
radius of the planet [m]
Definition: scale_const.F90:47
scale_const::const_tmelt
real(rp), parameter, public const_tmelt
Definition: scale_const.F90:80
scale_const::const_karman
real(rp), parameter, public const_karman
von Karman constant
Definition: scale_const.F90:54
scale_const::const_epsair
real(rp), public const_epsair
parts par million
Definition: scale_const.F90:104
scale_const::const_lhf0
real(rp), public const_lhf0
latent heat of fusion at 0C [J/kg]
Definition: scale_const.F90:86
scale_const::const_rdry
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
Definition: scale_const.F90:59
scale_const::const_undef4
real(sp), parameter, public const_undef4
undefined value (REAL4)
Definition: scale_const.F90:41
scale_const::const_lhs0
real(rp), parameter, public const_lhs0
latent heat of sublimation at 0C [J/kg]
Definition: scale_const.F90:84
scale_const::const_d2r
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:33
scale_const::const_laps
real(rp), public const_laps
lapse rate of ISA [K/m]
Definition: scale_const.F90:62
scale_const::const_mvap
real(rp), public const_mvap
mass weight (water vapor) [g/mol]
Definition: scale_const.F90:67
scale_const::const_r2d
real(rp), public const_r2d
radian to degree
Definition: scale_const.F90:34
scale_const::const_dice
real(rp), parameter, public const_dice
density of ice [kg/m3]
Definition: scale_const.F90:90
scale_const::const_undef
real(rp), public const_undef
Definition: scale_const.F90:43
scale_const::const_ohm
real(rp), public const_ohm
angular velocity of the planet [1/s]
Definition: scale_const.F90:48
scale_const::const_pre00
real(rp), public const_pre00
pressure reference [Pa]
Definition: scale_const.F90:97
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:57
scale_const::const_setup
subroutine, public const_setup
Setup.
Definition: scale_const.F90:128
scale_const::const_lhf00
real(rp), public const_lhf00
latent heat of fusion at 0K [J/kg]
Definition: scale_const.F90:87