-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmicro_blk_1m.py
More file actions
69 lines (59 loc) · 1.56 KB
/
micro_blk_1m.py
File metadata and controls
69 lines (59 loc) · 1.56 KB
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
#!/usr/bin/env python
import numpy as np
from libcloudphxx import blk_1m
from micro_blk_1m_common import _opts_init_blk_1m_common
from parcel_common import _stats
def _opts_init_blk_1m():
"""Initialize options for bulk microphysics scheme"""
opts_init = blk_1m.opts_t()
opts_init = _opts_init_blk_1m_common(opts_init)
# no ice proceesses:
opts_init.homA1 = False
opts_init.homA2 = False
opts_init.hetA = False
opts_init.hetB = False
opts_init.depA = False
opts_init.depB = False
opts_init.rimA = False
opts_init.rimB = False
opts_init.melA = False
opts_init.melB = False
return opts_init
def _micro_step_blk_1m(micro_opts, state, info, opts):
"""Microphysics step for bulk scheme without ice processes"""
# get state variables as numpy arrays
p = np.asarray(state["p"])
dot_th_d = np.zeros_like(state["th_d"])
dot_rv = np.zeros_like(state["r_v"])
dot_rc = np.zeros_like(state["rc"])
dot_rr = np.zeros_like(state["rr"])
blk_1m.adj_cellwise(
micro_opts,
state["rhod"],
p,
state["th_d"],
state["r_v"],
state["rc"],
state["rr"],
opts["dt"]
)
blk_1m.rhs_cellwise_revap(
micro_opts,
dot_th_d,
dot_rv,
dot_rc,
dot_rr,
state["rhod"],
p,
state["th_d"],
state["r_v"],
state["rc"],
state["rr"],
opts["dt"]
)
state["th_d"] += dot_th_d * opts["dt"]
state["r_v"] += dot_rv * opts["dt"]
state["rc"] += dot_rc * opts["dt"]
state["rr"] += dot_rr * opts["dt"]
# Update thermodynamic state
_stats(state, info)