Skip to content

Commit

Permalink
Jensen & Nugent 2017 example updates (incl. new smoke tests, Fig 7, 8…
Browse files Browse the repository at this point in the history
… and Tab 4 notebooks); GrabowskiEtAl2011 diffusion thermics coefficient fix; Bolton1980 & Wexler1976 svp formulae; (#1283)

Co-authored-by: Sanket Bhiogade <[email protected]>
Co-authored-by: Sylwester Arabas <[email protected]>
Co-authored-by: Kaitlyn Loftus <[email protected]>
  • Loading branch information
4 people authored Apr 20, 2024
1 parent ddf07df commit 181284e
Show file tree
Hide file tree
Showing 24 changed files with 8,450 additions and 8,608 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests+artifacts+pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ jobs:
test-suite: [ "chemistry_freezing_isotopes", "condensation_a", "condensation_b", "coagulation", "breakup", "multi-process_a", "multi-process_b"]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 45
timeout-minutes: 50
steps:
- uses: actions/[email protected]
with:
Expand Down
19 changes: 18 additions & 1 deletion PySDM/physics/constants_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@

""" TODO #1266 """
diffussion_thermics_D_G11_A = 1e-5 * si.m**2 / si.s
diffussion_thermics_D_G11_B = 0.15 / si.K
diffussion_thermics_D_G11_B = 0.015 / si.K
diffussion_thermics_D_G11_C = -1.9

diffussion_thermics_K_G11_A = 1.5e-11 * si.W / si.m / si.K**4
Expand Down Expand Up @@ -386,3 +386,20 @@ def compute_derived_values(c: dict):
c["water_molar_volume"] = c["Mv"] / c["rho_w"]
c["rho_STP"] = c["p_STP"] / c["Rd"] / c["T_STP"]
c["H_u"] = c["M"] / c["p_STP"]


W76W_G0 = -2.9912729e3 * si.K**2
W76W_G1 = -6.0170128e3 * si.K
W76W_G2 = 1.887643854e1
W76W_G3 = -2.8354721e-2 * si.K**-1
W76W_G4 = 1.7838301e-5 * si.K**-2
W76W_G5 = -8.4150417e-10 * si.K**-3
W76W_G6 = 4.4412543e-13 * si.K**-4
W76W_G7 = 2.858487
W76W_G8 = 1 * si.Pa

B80W_G0 = 6.112 * si.hPa
B80W_G1 = 17.67 * si.dimensionless
B80W_G2 = 243.5 * si.K

one_kelvin = 1 * si.K
1 change: 0 additions & 1 deletion PySDM/physics/diffusion_kinetics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
from .lowe_et_al_2019 import LoweEtAl2019
from .neglect import Neglect
from .grabowski_et_al_2011 import GrabowskiEtAl2011
from .jensen_and_nugent_2017 import JensenAndNugent2017
14 changes: 0 additions & 14 deletions PySDM/physics/diffusion_kinetics/jensen_and_nugent_2017.py

This file was deleted.

2 changes: 2 additions & 0 deletions PySDM/physics/diffusion_thermics/grabowski_et_al_2011.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ def __init__(self, _):

@staticmethod
def D(const, T, p): # pylint: disable=unused-argument
"""eq (10)"""
return const.diffussion_thermics_D_G11_A * (
const.diffussion_thermics_D_G11_B * T + const.diffussion_thermics_D_G11_C
)

@staticmethod
def K(const, T, p): # pylint: disable=unused-argument
"""eq (12)"""
return (
const.diffussion_thermics_K_G11_A * T**3
+ const.diffussion_thermics_K_G11_B * T**2
Expand Down
4 changes: 3 additions & 1 deletion PySDM/physics/impl/fake_unit_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, si):
self.dimensionless = 1.0
for prefix in ("nano", "micro", "milli", "centi", "", "hecto", "kilo"):
for unit in (
"bar",
"metre",
"gram",
"hertz",
Expand All @@ -35,6 +36,7 @@ def __init__(self, si):

for prefix in ("n", "u", "m", "c", "", "h", "k"):
for unit in (
"b",
"m",
"g",
"Hz",
Expand All @@ -47,7 +49,7 @@ def __init__(self, si):
"Pa",
"l",
"h",
"bar",
"bar", # note: "b" is barn !!!
"N",
"W",
):
Expand Down
2 changes: 2 additions & 0 deletions PySDM/physics/saturation_vapour_pressure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
from .flatau_walko_cotton import FlatauWalkoCotton
from .lowe1977 import Lowe1977
from .murphy_koop_2005 import MurphyKoop2005
from .wexler_1976 import Wexler1976
from .bolton_1980 import Bolton1980
20 changes: 20 additions & 0 deletions PySDM/physics/saturation_vapour_pressure/bolton_1980.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
[Bolton 1980](https://doi.org/10.1175/1520-0493(1980)108<1046:TCOEPT>2.0.CO;2)
"""

import numpy as np


class Bolton1980:
def __init__(self, _):
pass

@staticmethod
def pvs_Celsius(const, T):
"""valid for -30 <= T <= 35 C, eq (10)"""
return const.B80W_G0 * np.exp((const.B80W_G1 * T) / (T + const.B80W_G2))

@staticmethod
def ice_Celsius(const, T):
"""NaN with unit of pressure and correct dimension"""
return np.nan * T / const.B80W_G2 * const.B80W_G0
31 changes: 31 additions & 0 deletions PySDM/physics/saturation_vapour_pressure/wexler_1976.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
[Wexler 1976](https://nvlpubs.nist.gov/nistpubs/jres/80A/jresv80An5-6p775_A1b.pdf)
"""

import numpy as np


class Wexler1976:
def __init__(self, _):
pass

@staticmethod
def pvs_Celsius(const, T):
return (
np.exp(
const.W76W_G0 / (T + const.T0) ** 2
+ const.W76W_G1 / (T + const.T0)
+ const.W76W_G2
+ const.W76W_G3 * (T + const.T0)
+ const.W76W_G4 * (T + const.T0) ** 2
+ const.W76W_G5 * (T + const.T0) ** 3
+ const.W76W_G6 * (T + const.T0) ** 4
+ const.W76W_G7 * np.log((T + const.T0) / const.one_kelvin)
)
* const.W76W_G8
)

@staticmethod
def ice_Celsius(const, T):
"""NaN with unit of pressure and correct dimension"""
return np.nan * T / const.B80W_G2 * const.B80W_G0
Loading

0 comments on commit 181284e

Please sign in to comment.