Skip to content

Commit 90eb46c

Browse files
add new example for ventilation factors (Pruppacher and Rasmussen 1979) --- from #1494 (#1573)
Co-authored-by: Sylwester Arabas <[email protected]>
1 parent 64587b0 commit 90eb46c

File tree

8 files changed

+401
-6
lines changed

8 files changed

+401
-6
lines changed

PySDM/physics/constants_defaults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@
518518

519519
PRUPPACHER_RASMUSSEN_1979_XTHRES = 1.4 * si.dimensionless
520520
"""
521-
[Pruppacher & Rasmussen 1979](https://doi.org/10.1175/1520-0469(1979)036%3C1255:AWTIOT%3E2.0.CO;2)
522-
"""
521+
[Pruppacher & Rasmussen 1979](https://doi.org/10.1175/1520-0469%281979%29036%3C1255:AWTIOT%3E2.0.CO;2)
522+
""" # pylint: disable=line-too-long
523523
PRUPPACHER_RASMUSSEN_1979_CONSTSMALL = 1.0 * si.dimensionless
524524
""" 〃 """
525525
PRUPPACHER_RASMUSSEN_1979_COEFFSMALL = 0.108 * si.dimensionless

PySDM/physics/ventilation/pruppacher_rasmussen_1979.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""
22
ventilation coefficient as a function of dimensionless Reynolds (Re) and Schmidt (Sc)
33
numbers for liquid drops following
4-
[Pruppacher & Rasmussen (1979)](https://doi.org/10.1175/1520-0469(1979)036%3C1255:AWTIOT%3E2.0.CO;2)
4+
[Pruppacher & Rasmussen 1979](https://doi.org/10.1175/1520-0469%281979%29036%3C1255:AWTIOT%3E2.0.CO;2)
55
NB: this parameterization is only experimentally validated for Re < 2600
66
but is hypothesized to be valid for spheres with Re < 8 × 10⁴
77
based on theory (Pruppacher & Rasmussen, 1979).
88
the parameterization also does not account for effects of air turbulence.
9-
"""
9+
""" # pylint: disable=line-too-long
1010

1111
import numpy as np
1212

docs/bibliography.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,13 @@
626626
"label": "Bartman et al. 2022 (J. Open Source Soft. 7)",
627627
"title": "PySDM v1: particle-based cloud modeling package for warm-rain microphysics and aqueous chemistry"
628628
},
629-
"https://doi.org/10.1175/1520-0469(1979)036%3C1255:AWTIOT%3E2.0.CO;2": {
629+
"https://doi.org/10.1175/1520-0469%281979%29036%3C1255:AWTIOT%3E2.0.CO;2": {
630630
"usages": [
631631
"PySDM/physics/constants_defaults.py",
632-
"PySDM/physics/ventilation/pruppacher_rasmussen_1979.py"
632+
"PySDM/physics/ventilation/pruppacher_rasmussen_1979.py",
633+
"examples/PySDM_examples/Pruppacher_and_Rasmussen_1979/fig_1.ipynb",
634+
"examples/PySDM_examples/Pruppacher_and_Rasmussen_1979/__init__.py",
635+
"tests/smoke_tests/no_env/pruppacher_and_rasmussen_1979/test_fig_1.py"
633636
],
634637
"label": "Pruppacher & Rasmussen 1979 (J. Atmos. Sci. 36)",
635638
"title": "A Wind Tunnel Investigation of the Rate of Evaporation of Large Water Drops Falling at Terminal Velocity in Air"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
based on Pruppacher and Rasmussen 1979 (J. Atmos. Sci.)
3+
https://doi.org/10.1175/1520-0469%281979%29036%3C1255:AWTIOT%3E2.0.CO;2
4+
5+
fig_1.ipynb:
6+
.. include:: ./fig_1.ipynb.badges.md
7+
8+
"""
9+
10+
# pylint: disable=invalid-name

examples/PySDM_examples/Pruppacher_and_Rasmussen_1979/fig_1.ipynb

Lines changed: 330 additions & 0 deletions
Large diffs are not rendered by default.

tests/examples_tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def findfiles(path, regex):
3939
"Bolin_1958",
4040
"Stewart_1975",
4141
"Kinzer_And_Gunn_1951",
42+
"Pruppacher_and_Rasmussen_1979",
4243
],
4344
"condensation_a": [
4445
"Lowe_et_al_2019",

tests/smoke_tests/no_env/pruppacher_and_rasmussen_1979/__init__.py

Whitespace-only changes.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
regression tests checking values against paper Fig 1 from [Pruppacher and Rasmussen
3+
1979](https://doi.org/10.1175/1520-0469%281979%29036%3C1255:AWTIOT%3E2.0.CO;2)
4+
"""
5+
6+
from pathlib import Path
7+
8+
import numpy as np
9+
import pytest
10+
11+
from open_atmos_jupyter_utils import notebook_vars
12+
from PySDM_examples import Pruppacher_and_Rasmussen_1979
13+
14+
PLOT = False
15+
16+
17+
@pytest.fixture(scope="session", name="notebook_local_variables")
18+
def notebook_local_variables_fixture():
19+
return notebook_vars(
20+
Path(Pruppacher_and_Rasmussen_1979.__file__).parent / "fig_1.ipynb", plot=PLOT
21+
)
22+
23+
24+
class TestFig1:
25+
@staticmethod
26+
@pytest.mark.parametrize(
27+
"sqrt_re_times_cbrt_sc, vent_coeff",
28+
(
29+
(3, 1.7),
30+
(20, 7),
31+
(44, 14),
32+
),
33+
)
34+
def test_values_match(notebook_local_variables, sqrt_re_times_cbrt_sc, vent_coeff):
35+
plot_x = notebook_local_variables["sqrt_re_times_cbrt_sc"]
36+
plot_y = notebook_local_variables["vent_coef"]
37+
eps = 0.1
38+
((index,),) = np.where(abs(plot_x - sqrt_re_times_cbrt_sc) < eps)
39+
np.testing.assert_approx_equal(
40+
actual=plot_y[index], desired=vent_coeff, significant=2
41+
)
42+
43+
@staticmethod
44+
def test_monotonic_x(notebook_local_variables):
45+
plot_x = notebook_local_variables["sqrt_re_times_cbrt_sc"]
46+
assert (np.diff(plot_x) > 0).all()
47+
48+
@staticmethod
49+
def test_monotonic_y(notebook_local_variables):
50+
plot_y = notebook_local_variables["vent_coef"]
51+
assert (np.diff(plot_y) > 0).all()

0 commit comments

Comments
 (0)