Skip to content

Commit b53c8f0

Browse files
bhiogadeSanket Bhiogadeslayoo
authored
Jensen & Nugent 2017 GCCN example (incl. Grabowski et al. diffusion thermics) (#1267)
Co-authored-by: Sanket Bhiogade <[email protected]> Co-authored-by: Sylwester Arabas <[email protected]>
1 parent fe88baf commit b53c8f0

File tree

29 files changed

+13797
-2
lines changed

29 files changed

+13797
-2
lines changed

PySDM/initialisation/sampling/spectral_sampling.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def _sample(self, grid, spectrum):
5555
diff = abs(1 - np.sum(y_float) / spectrum.norm_factor)
5656
if diff > self.error_threshold:
5757
raise ValueError(
58-
f"{100*diff}% error in total real-droplet number due to sampling"
58+
f"{diff * 100:.3g}% error in total real-droplet number due to sampling "
59+
f"({len(x)} samples)"
5960
)
6061

6162
return x, y_float

PySDM/physics/constants_defaults.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,16 @@
321321
""" [Bohren 1987](https://doi.org/10.1119/1.15109) """
322322
asymmetry_g = 0.85 # forward scattering from cloud droplets
323323

324+
""" TODO #1266 """
325+
diffussion_thermics_D_G11_A = 1e-5 * si.m**2 / si.s
326+
diffussion_thermics_D_G11_B = 0.15 / si.K
327+
diffussion_thermics_D_G11_C = -1.9
328+
329+
diffussion_thermics_K_G11_A = 1.5e-11 * si.W / si.m / si.K**4
330+
diffussion_thermics_K_G11_B = -4.8e-8 * si.W / si.m / si.K**3
331+
diffussion_thermics_K_G11_C = 1e-4 * si.W / si.m / si.K**2
332+
diffussion_thermics_K_G11_D = -3.9e-4 * si.W / si.m / si.K
333+
324334

325335
def compute_derived_values(c: dict):
326336
c["eps"] = c["Mv"] / c["Md"]

PySDM/physics/diffusion_kinetics/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
from .fuchs_sutugin import FuchsSutugin
66
from .lowe_et_al_2019 import LoweEtAl2019
77
from .neglect import Neglect
8+
from .grabowski_et_al_2011 import GrabowskiEtAl2011
9+
from .jensen_and_nugent_2017 import JensenAndNugent2017
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
as in [Grabowski et al. (2011)](https://doi.org/10.1016/j.atmosres.2010.10.020)
3+
"""
4+
5+
from .pruppacher_and_klett_2005 import PruppacherKlett
6+
7+
8+
class GrabowskiEtAl2011(PruppacherKlett):
9+
pass
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
as in [Jensen and Nugent 2017](https://doi.org/10.1175/JAS-D-15-0370.1)
3+
(which refers to [Grabowski et al. (2011)](https://doi.org/10.1016/j.atmosres.2010.10.020)
4+
but uses different gas constant, typo?)
5+
"""
6+
7+
import numpy as np
8+
from .grabowski_et_al_2011 import GrabowskiEtAl2011
9+
10+
11+
class JensenAndNugent2017(GrabowskiEtAl2011):
12+
@staticmethod
13+
def lambdaD(const, D, T):
14+
return D / np.sqrt(2 * const.Rd * T)

PySDM/physics/diffusion_kinetics/pruppacher_and_klett_2005.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ def D(const, D, r, lmbd):
1919
return D / (
2020
(r / (r + const.dv_pk05)) + 2 * np.sqrt(const.PI) * lmbd / r / const.MAC
2121
)
22+
23+
@staticmethod
24+
def lambdaK(_, T, p): # pylint: disable=unused-argument
25+
return -1
26+
27+
@staticmethod
28+
def K(const, K, r, lmbd): # pylint: disable=unused-argument
29+
return K # TODO #1266

PySDM/physics/diffusion_thermics/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
from .lowe_et_al_2019 import LoweEtAl2019
66
from .neglect import Neglect
77
from .tracy_welch_porter import TracyWelchPorter
8+
from .grabowski_et_al_2011 import GrabowskiEtAl2011
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
as in [Grabowski et al. (2011)](https://doi.org/10.1016/j.atmosres.2010.10.020)
3+
"""
4+
5+
6+
class GrabowskiEtAl2011:
7+
def __init__(self, _):
8+
pass
9+
10+
@staticmethod
11+
def D(const, T, p): # pylint: disable=unused-argument
12+
return const.diffussion_thermics_D_G11_A * (
13+
const.diffussion_thermics_D_G11_B * T + const.diffussion_thermics_D_G11_C
14+
)
15+
16+
@staticmethod
17+
def K(const, T, p): # pylint: disable=unused-argument
18+
return (
19+
const.diffussion_thermics_K_G11_A * T**3
20+
+ const.diffussion_thermics_K_G11_B * T**2
21+
+ const.diffussion_thermics_K_G11_C * T
22+
+ const.diffussion_thermics_K_G11_D
23+
)

PySDM/physics/impl/fake_unit_registry.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(self, si):
2626
"litre",
2727
"hour",
2828
"newton",
29+
"watt",
2930
):
3031
self.__setattr__(prefix + unit, _fake(si.__getattr__(prefix + unit)))
3132
self.__setattr__(
@@ -48,5 +49,6 @@ def __init__(self, si):
4849
"h",
4950
"bar",
5051
"N",
52+
"W",
5153
):
5254
self.__setattr__(prefix + unit, _fake(si.__getattr__(prefix + unit)))

PySDM/physics/trivia.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,7 @@ def isotopic_enrichment_to_delta_SMOW(E, delta_0_SMOW):
125125
@staticmethod
126126
def mixing_ratio_to_specific_content(mixing_ratio):
127127
return mixing_ratio / (1 + mixing_ratio)
128+
129+
@staticmethod
130+
def dn_dlogr(r, dn_dr):
131+
return np.log(10) * r * dn_dr

0 commit comments

Comments
 (0)