diff --git a/tests/unit_tests/backends/test_freezing_methods.py b/tests/unit_tests/backends/test_freezing_methods.py index 72f7c9cf9..84c71bd5a 100644 --- a/tests/unit_tests/backends/test_freezing_methods.py +++ b/tests/unit_tests/backends/test_freezing_methods.py @@ -6,7 +6,6 @@ from PySDM import Builder, Formulae from PySDM.dynamics import Freezing from PySDM.environments import Box -from PySDM.physics import constants_defaults as const from PySDM.physics import si from PySDM.products import IceWaterContent @@ -68,7 +67,7 @@ def test_freeze_singular(backend_class): dt = 1 * si.s dv = 1 * si.m**3 T_fz = 250 * si.K - vol = 1 * si.um**3 + water_mass = 1 * si.mg multiplicity = 1e10 steps = 1 @@ -81,7 +80,7 @@ def test_freeze_singular(backend_class): attributes = { "multiplicity": np.full(n_sd, multiplicity), "freezing temperature": np.full(n_sd, T_fz), - "volume": np.full(n_sd, vol), + "water mass": np.full(n_sd, water_mass), } products = (IceWaterContent(name="qi"),) particulator = builder.build(attributes=attributes, products=products) @@ -92,9 +91,10 @@ def test_freeze_singular(backend_class): particulator.run(steps=steps) # assert - np.testing.assert_almost_equal( - np.asarray(particulator.products["qi"].get()), - [n_sd * multiplicity * vol * const.rho_w / dv], + np.testing.assert_approx_equal( + actual=np.asarray(particulator.products["qi"].get()), + desired=n_sd * multiplicity * water_mass / dv, + significant=7, ) @staticmethod @@ -123,7 +123,7 @@ def test_freeze_time_dependent(backend_class, double_precision, plot=False): ) # dummy (but must-be-set) values - vol = ( + initial_water_mass = ( 44 # for sign flip (ice water has negative volumes), value does not matter ) d_v = 666 # products use conc., dividing there, multiplying here, value does not matter @@ -165,7 +165,7 @@ def low(t): attributes = { "multiplicity": np.full(n_sd, int(case["N"])), "immersed surface area": np.full(n_sd, immersed_surface_area), - "volume": np.full(n_sd, vol), + "water mass": np.full(n_sd, initial_water_mass), } particulator = builder.build(attributes=attributes, products=products) env["RH"] = 1.0001 @@ -178,7 +178,7 @@ def low(t): ice_mass_per_volume = particulator.products["qi"].get()[cell_id] ice_mass = ice_mass_per_volume * d_v - ice_number = ice_mass / (const.rho_w * vol) + ice_number = ice_mass / initial_water_mass unfrozen_fraction = 1 - ice_number / number_of_real_droplets output[key]["unfrozen_fraction"].append(unfrozen_fraction)