PHYEX
0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
src
pyphyex
phyex1d
__init__.py
Go to the documentation of this file.
1
"""
2
1D model using PHYEX
3
"""
4
5
import
os
6
7
import
numpy
8
9
from
pyphyex
import
__version__
# PHYEX version
10
11
12
# Command line tools (added at the end of their help messages)
13
COMMANDS = {
14
'phyex1d-cases_install'
:
'install the DEPHY-SCM cases (download or link)'
,
15
'phyex1d-cases_list'
:
'list the installed DEPHY-SCM cases'
,
16
'phyex1d-exp_run'
:
'run experiments on a case'
,
17
'phyex1d-exp_list'
:
'list the experiments having results'
,
18
'phyex1d-exp_plot'
:
'plot the results of experiments'
,
19
'phyex1d-exp_2nc'
:
'convert the results of an experiment into a dephycf netCDF file'
,
20
'phyex1d-grid_list'
:
'list the available vertical grids'
,
21
'phyex1d-grid_show'
:
'print the description of a vertical grid'
,
22
'phyex1d-namel_list'
:
'list the available namelists'
,
23
'phyex1d-namel_show'
:
'print the content of a namelist'
,
24
}
25
26
27
def
commands_help
():
28
"""Section, common to the help messages of the command line tools, listing them"""
29
width = max(len(command)
for
command
in
COMMANDS)
30
return
'\n'
.join([
'phyex1d command line tools (use -h for details):'
] +
31
[f
' {command:{width}s} {description}'
32
for
command, description
in
COMMANDS.items()])
33
34
35
def
user_dir
(subdir):
36
"""
37
User directory in which grids and namelists are searched before the package
38
directory: $PHYEXCONF/phyex1d/<subdir>, PHYEXCONF being ~/.phyex by default
39
:param subdir: 'grids' or 'namelists'
40
"""
41
return
os.path.join(os.environ.get(
'PHYEXCONF'
, os.path.expanduser(
'~/.phyex'
)),
42
'phyex1d'
, subdir)
43
44
45
class
Phyex1DError
(Exception):
46
"""
47
phyex1d error
48
"""
49
50
class
Cst():
# pylint: disable=too-few-public-methods,too-many-instance-attributes
51
"""Empty class to store constants"""
52
def
__init__
(self):
53
# pylint: disable=invalid-name
54
self.
pi
= 2. * numpy.arcsin(1.)
55
self.
Karman
= 0.4
56
self.
Planck
= 6.6260755E-34
57
self.
boltz
= 1.380658E-23
58
self.
avogadro
= 6.0221367e+23
59
60
self.
P0
= 100000.
61
self.
g
= 9.80665
62
self.
day
= 86400.
63
self.
siyear
= 365.25 * self.
day
* 2. * self.
pi
/ 6.283076
64
self.
siday
= self.
day
/ (1. + self.
day
/ self.
siyear
)
65
self.
omega
= 2. * self.
pi
/ self.
siday
66
67
self.
md
= 28.9644e-3
68
self.
mv
= 18.0153E-3
69
self.
Rd
= self.
avogadro
* self.
boltz
/ self.
md
70
self.
Rv
= self.
avogadro
* self.
boltz
/ self.
mv
71
self.
Cpd
= 7.* self.
Rd
/ 2.
72
self.
Cpv
= 4.* self.
Rv
73
self.
Cl
= 4.218E+3
74
self.
Ci
= 2.106E+3
75
self.
Tt
= 273.16
76
self.
LvTt
= 2.5008E+6
77
self.
LsTt
= 2.8345E+6
78
self.
Lv_0
= self.
LvTt
- (self.
Cpv
- self.
Cl
) * self.
Tt
79
self.
Ls_0
= self.
LsTt
- (self.
Cpv
- self.
Ci
) * self.
Tt
80
self.
EsTt
= 611.14
81
self.
gamw
= (self.
Cl
- self.
Cpv
) / self.
Rv
82
self.
betaw
= (self.
LvTt
/ self.
Rv
) + (self.
gamw
* self.
Tt
)
83
self.
alpw
= numpy.log(self.
EsTt
) + (self.
betaw
/ self.
Tt
) + (self.
gamw
* numpy.log(self.
Tt
))
84
self.
gami
= (self.
Ci
- self.
Cpv
) / self.
Rv
85
self.
betai
= (self.
LsTt
/ self.
Rv
) + (self.
gami
* self.
Tt
)
86
self.
alpi
= numpy.log(self.
EsTt
) + (self.
betai
/ self.
Tt
) + (self.
gami
* numpy.log(self.
Tt
))
87
88
89
from
.case
import
Case, CaseCommonFormat, CaseXarray
90
from
.grid
import
Grid
91
from
.experiment_runner
import
ExperimentRunner
92
from
.physics_base
import
PhysicsBase
93
from
.phyex
import
(PHYEX, PhysicsArome, PhysicsAromeTQ, PhysicsAromeThetaR,
94
PhysicsForcingTQ, PhysicsForcingThetaR)
95
from
.simple_physics
import
SimplePhysics, SimplePhysicsTQ, SimplePhysicsThetaR
pyphyex.phyex1d.Cst.LsTt
float LsTt
Definition
__init__.py:77
pyphyex.phyex1d.Cst.md
float md
Definition
__init__.py:67
pyphyex.phyex1d.Cst.avogadro
float avogadro
Definition
__init__.py:58
pyphyex.phyex1d.Cst.betaw
tuple betaw
Definition
__init__.py:82
pyphyex.phyex1d.Cst.omega
int omega
Definition
__init__.py:65
pyphyex.phyex1d.Cst.gami
tuple gami
Definition
__init__.py:84
pyphyex.phyex1d.Cst.Planck
float Planck
Definition
__init__.py:56
pyphyex.phyex1d.Cst.mv
float mv
Definition
__init__.py:68
pyphyex.phyex1d.Cst.Ci
float Ci
Definition
__init__.py:74
pyphyex.phyex1d.Cst.Tt
float Tt
Definition
__init__.py:75
pyphyex.phyex1d.Cst.Karman
float Karman
Definition
__init__.py:55
pyphyex.phyex1d.Cst.Lv_0
float Lv_0
Definition
__init__.py:78
pyphyex.phyex1d.Cst.siday
int siday
Definition
__init__.py:64
pyphyex.phyex1d.Cst.pi
int pi
Definition
__init__.py:54
pyphyex.phyex1d.Cst.Ls_0
float Ls_0
Definition
__init__.py:79
pyphyex.phyex1d.Cst.P0
int P0
Definition
__init__.py:60
pyphyex.phyex1d.Cst.g
float g
Definition
__init__.py:61
pyphyex.phyex1d.Cst.Cl
float Cl
Definition
__init__.py:73
pyphyex.phyex1d.Cst.siyear
float siyear
Definition
__init__.py:63
pyphyex.phyex1d.Cst.Cpd
int Cpd
Definition
__init__.py:71
pyphyex.phyex1d.Cst.Rv
float Rv
Definition
__init__.py:70
pyphyex.phyex1d.Cst.betai
tuple betai
Definition
__init__.py:85
pyphyex.phyex1d.Cst.alpi
alpi
Definition
__init__.py:86
pyphyex.phyex1d.Cst.EsTt
float EsTt
Definition
__init__.py:80
pyphyex.phyex1d.Cst.day
int day
Definition
__init__.py:62
pyphyex.phyex1d.Cst.boltz
float boltz
Definition
__init__.py:57
pyphyex.phyex1d.Cst.Cpv
int Cpv
Definition
__init__.py:72
pyphyex.phyex1d.Cst.alpw
alpw
Definition
__init__.py:83
pyphyex.phyex1d.Cst.__init__
__init__(self)
Definition
__init__.py:52
pyphyex.phyex1d.Cst.Rd
float Rd
Definition
__init__.py:69
pyphyex.phyex1d.Cst.LvTt
float LvTt
Definition
__init__.py:76
pyphyex.phyex1d.Cst.gamw
tuple gamw
Definition
__init__.py:81
pyphyex.phyex1d.Phyex1DError
Definition
__init__.py:45
pyphyex.phyex1d.commands_help
commands_help()
Definition
__init__.py:27
pyphyex.phyex1d.user_dir
user_dir(subdir)
Definition
__init__.py:35
Generated by
1.15.0