forked from szy21/pycles_GCM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Microphysics.pxd
142 lines (108 loc) · 6.08 KB
/
Microphysics.pxd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
cimport Grid
cimport PrognosticVariables
cimport DiagnosticVariables
cimport ReferenceState
cimport ParallelMPI
cimport TimeStepping
from NetCDFIO cimport NetCDFIO_Stats
from Thermodynamics cimport LatentHeat, ClausiusClapeyron
from libc.math cimport pow, fmax, fmin, tanh
include 'parameters_micro.pxi'
cdef:
double lambda_constant(double T) nogil
double latent_heat_constant(double T, double Lambda) nogil
cdef class No_Microphysics_Dry:
# Make the thermodynamics_type member available from Python-Space
cdef public:
str thermodynamics_type
cpdef initialize(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa)
cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cdef class No_Microphysics_SA:
# Make the thermodynamics_type member available from Python-Space
cdef public:
str thermodynamics_type
cdef:
double (*L_fp)(double T, double Lambda) nogil
double (*Lambda_fp)(double T) nogil
double ccn
Py_ssize_t order
bint cloud_sedimentation
bint stokes_sedimentation
cpdef initialize(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa)
cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cdef class Microphysics_SB_Liquid:
# Make the thermodynamics_type member available from Python-Space
cdef public:
str thermodynamics_type
cdef:
double (*L_fp)(double T, double Lambda) nogil
double (*Lambda_fp)(double T) nogil
double (*compute_rain_shape_parameter)(double density, double qr, double Dm) nogil
double (*compute_droplet_nu)(double density, double ql) nogil
ClausiusClapeyron CC
double ccn
Py_ssize_t order
bint cloud_sedimentation
bint stokes_sedimentation
cpdef initialize(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV,NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa)
cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cdef class Microphysics_T_Liquid:
cdef public:
str thermodynamics_type
cdef:
double (*L_fp)(double T, double Lambda) nogil
double (*Lambda_fp)(double T) nogil
ClausiusClapeyron CC
cpdef initialize(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV,NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa)
cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cdef class Microphysics_CLIMA_Liquid_1M:
cdef public:
str thermodynamics_type
cdef:
double (*L_fp)(double T, double Lambda) nogil
double (*Lambda_fp)(double T) nogil
ClausiusClapeyron CC
Py_ssize_t order
cpdef initialize(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV,\
DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS,\
ParallelMPI.ParallelMPI Pa)
cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th,\
PrognosticVariables.PrognosticVariables PV,\
DiagnosticVariables.DiagnosticVariables DV,\
TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa)
cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th,\
PrognosticVariables.PrognosticVariables PV,\
DiagnosticVariables.DiagnosticVariables DV,\
NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cdef inline double lambda_constant(double T) nogil:
return 1.0
cdef inline double latent_heat_constant(double T, double Lambda) nogil:
return 2.501e6
cdef inline double latent_heat_variable(double T, double Lambda) nogil:
cdef:
double TC = T - 273.15
return (2500.8 - 2.36 * TC + 0.0016 * TC *
TC - 0.00006 * TC * TC * TC) * 1000.0
cdef inline double lambda_T(double T) nogil:
cdef:
double Twarm = 273.15
double Tcold = 263.15
double Lambda = 0.0
#POW_N can be modified in generate_parameters_a1m.py
#Lambda = 0.5 + 0.5 * tanh((T - 266.65000072654806)/2.6409572185027406)
if T > Tcold and T <= Twarm:
Lambda = pow((T - Tcold)/(Twarm - Tcold), POW_N)
elif T > Twarm:
Lambda = 1.0
else:
Lambda = 0.0
return Lambda
cdef inline double latent_heat_T(double T, double Lambda) nogil:
cdef:
double Lv = 2.501e6
double Ls = 2.8334e6
return (Lv * Lambda) + (Ls * (1.0 - Lambda))