-
Notifications
You must be signed in to change notification settings - Fork 4
/
Microphysics_Arctic_1M.pxd_no_melt
85 lines (64 loc) · 2.78 KB
/
Microphysics_Arctic_1M.pxd_no_melt
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
cimport Grid
cimport ReferenceState
cimport PrognosticVariables
cimport DiagnosticVariables
cimport ParallelMPI
cimport TimeStepping
from libc.math cimport pow, fmax, fmin
include 'parameters_micro.pxi'
from Thermodynamics cimport ClausiusClapeyron
from NetCDFIO cimport NetCDFIO_Fields, NetCDFIO_Stats
cdef:
double lambda_constant_Arctic(double T) nogil
double latent_heat_constant_Arctic(double T, double Lambda) nogil
double lambda_Arctic(double T) nogil
double latent_heat_Arctic(double T, double Lambda) nogil
double latent_heat_variable_Arctic(double T, double Lambda) nogil
cdef inline double lambda_constant_Arctic(double T) nogil:
return 1.0
cdef inline double latent_heat_constant_Arctic(double T, double Lambda) nogil:
return 2.501e6
cdef inline double lambda_Arctic(double T) nogil:
cdef:
double Twarm = 273.0
double Tcold = 235.0
double Lambda = 0.0
#POW_N can be modified in generate_parameters_a1m.py
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_Arctic(double T, double Lambda) nogil:
cdef:
double Lv = 2.501e6
double Ls = 2.8334e6
return (Lv * Lambda) + (Ls * (1.0 - Lambda))
cdef inline double latent_heat_variable_Arctic(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 class Microphysics_Arctic_1M:
cdef public:
str thermodynamics_type
cdef:
double ccn
double n0_ice_input
Py_ssize_t order
double (*L_fp)(double T, double Lambda) nogil
double (*Lambda_fp)(double T) nogil
ClausiusClapeyron CC
double [:] evap_rate
double [:] precip_rate
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 RS, Th,
PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV,
TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa)
cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, Th, PrognosticVariables.PrognosticVariables PV,
DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cpdef ice_stats(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, PrognosticVariables.PrognosticVariables PV,
DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)