Skip to content

Commit

Permalink
Added latent heating for ice vapour deposition and included it in uni…
Browse files Browse the repository at this point in the history
…t test
  • Loading branch information
tluettm committed Oct 9, 2024
1 parent 3a8cabc commit 95cf76e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions PySDM/backends/impl_numba/methods/deposition_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def body(
assert False
ambient_vapour_mixing_ratio[cid] += delta_rv_i

delta_T = -delta_rv_i * latent_heat_sub / formulae.constants.c_pd
ambient_temperature[cid] += delta_T

x_old = formulae.diffusion_coordinate__x(ice_mass)
dx_dt_old = formulae.diffusion_coordinate__dx_dt(x_old, dm_dt)
x_new = formulae.trivia__explicit_euler(x_old, time_step, dx_dt_old)
Expand Down
7 changes: 6 additions & 1 deletion tests/unit_tests/dynamics/test_vapour_deposition_on_ice.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,24 @@ def test_iwc_lower_after_timestep(


# act
T0 = temperature
iwc_old = particulator.products["ice water content"].get().copy()
particulator.run(steps=1)
T_new = particulator.environment["T"][0]
iwc_new = particulator.products["ice water content"].get().copy()

rv_new = particulator.environment["water_vapour_mixing_ratio"][0]
# assert
if water_mass < 0 and RHi != 1:
if RHi > 1:
assert (iwc_new > iwc_old).all()
assert rv_new < rv0
assert T_new > T0
elif RHi < 1:
assert (iwc_new < iwc_old).all()
assert rv_new > rv0
assert T_new < T0
else:
assert (iwc_new == iwc_old).all()
assert rv_new == rv0
assert T_new == T0

0 comments on commit 95cf76e

Please sign in to comment.