From 8ff9cf3be3f1bc4db687d6ec94824affed5e3821 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Thu, 31 Jul 2025 21:18:47 +0200 Subject: [PATCH 1/3] physics: switch the default for saturation vapour pressures from Flatau et al. '92 to Murphy Koop '05 --- PySDM/formulae.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySDM/formulae.py b/PySDM/formulae.py index 4b796f5784..9667c243de 100644 --- a/PySDM/formulae.py +++ b/PySDM/formulae.py @@ -31,7 +31,7 @@ def __init__( # pylint: disable=too-many-locals seed: int = None, fastmath: bool = True, diffusion_coordinate: str = "WaterMassLogarithm", - saturation_vapour_pressure: str = "FlatauWalkoCotton", + saturation_vapour_pressure: str = "MurphyKoop2005", latent_heat_vapourisation: str = "Kirchhoff", latent_heat_sublimation: str = "MurphyKoop2005", hygroscopicity: str = "KappaKoehlerLeadingTerms", From cfd86747ffc6f186c9dfde8680468e7789c73d7e Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Fri, 1 Aug 2025 14:02:56 +0200 Subject: [PATCH 2/3] import tanh in cpp2python --- PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py b/PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py index 8d3e7623bc..00b37421fa 100644 --- a/PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py +++ b/PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py @@ -197,7 +197,7 @@ def make(self): power, sqrt, arctanh as atanh, arcsinh as asinh, - sinh, + sinh, tanh, maximum, minimum, where, # TODO #1295 ) From 1c6cb746265a3fab671b05dc36090b6ca93f05ee Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Tue, 5 Aug 2025 10:30:44 +0200 Subject: [PATCH 3/3] test renorms --- tests/unit_tests/dynamics/condensation/test_diagnostics.py | 5 +++-- tests/unit_tests/dynamics/test_vapour_deposition_on_ice.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/unit_tests/dynamics/condensation/test_diagnostics.py b/tests/unit_tests/dynamics/condensation/test_diagnostics.py index 4c8f01cb9b..c034e4e954 100644 --- a/tests/unit_tests/dynamics/condensation/test_diagnostics.py +++ b/tests/unit_tests/dynamics/condensation/test_diagnostics.py @@ -5,7 +5,7 @@ import numpy as np -from PySDM import Builder +from PySDM import Builder, Formulae from PySDM.backends import CPU from PySDM.dynamics.condensation import Condensation from PySDM.impl.mesh import Mesh @@ -79,7 +79,8 @@ def __init__( # pylint: disable=too-many-locals rho=rho, eta=eta, ) - builder = Builder(n_sd=n_sd, backend=backend(), environment=env) + formulae = Formulae(saturation_vapour_pressure="FlatauWalkoCotton") + builder = Builder(n_sd=n_sd, backend=backend(formulae), environment=env) builder.add_dynamic(Condensation(max_iters=max_iters)) self.particulator = builder.build( diff --git a/tests/unit_tests/dynamics/test_vapour_deposition_on_ice.py b/tests/unit_tests/dynamics/test_vapour_deposition_on_ice.py index 842541691c..6aef885dd5 100644 --- a/tests/unit_tests/dynamics/test_vapour_deposition_on_ice.py +++ b/tests/unit_tests/dynamics/test_vapour_deposition_on_ice.py @@ -245,9 +245,9 @@ def test_growth_rates_against_spichtinger_and_gierens_2009_fig_5( assert (np.diff(mass_rate) > 0).all() assert 1.8e-15 * si.kg / si.s < dm_dt[230 * si.K][0] < 4.0e-15 * si.kg / si.s - assert 7.0e-17 * si.kg / si.s < dm_dt[200 * si.K][0] < 1.0e-16 * si.kg / si.s + assert 6.0e-17 * si.kg / si.s < dm_dt[200 * si.K][0] < 1.0e-16 * si.kg / si.s assert 1.3e-12 * si.kg / si.s < dm_dt[230 * si.K][-1] < 1.5e-12 * si.kg / si.s - assert 6.0e-14 * si.kg / si.s < dm_dt[200 * si.K][-1] < 1.2e-13 * si.kg / si.s + assert 5.0e-14 * si.kg / si.s < dm_dt[200 * si.K][-1] < 1.2e-13 * si.kg / si.s @staticmethod @pytest.mark.parametrize("diffusion_coordinate", DIFFUSION_COORDINATES)