Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
121ed92
added new homogeneous freezing example
tluettm Jul 8, 2025
b23b733
expanded freezing temperature unit test, and notebook
tluettm Jul 8, 2025
7f269b1
fix mark_updated calls for freezing
slayoo Jul 8, 2025
fc604f9
Merge pull request #3 from slayoo/tim/new_hom_freezing_example
tluettm Jul 8, 2025
22aa786
finished example setup for threshold homogeneous freezing
tluettm Jul 8, 2025
4b56496
expanded hom freezing example
tluettm Jul 9, 2025
0345a1a
Changed plot function
tluettm Jul 10, 2025
2e65c9f
added back freezing temperature histogram plots
tluettm Jul 10, 2025
87cd676
added ensemble of realisations
tluettm Jul 11, 2025
03529b1
draft of a smoke test + avoiding relative imports in the notebook to …
slayoo Jul 11, 2025
a53d448
note in the noteboo
slayoo Jul 11, 2025
5215b77
added ensemble for numer of super droplets
tluettm Jul 11, 2025
823cbaf
added vertical updraft ensemble
tluettm Jul 14, 2025
3d53216
Merge remote-tracking branch 'upstream' into new_hom_freezing_example
tluettm Jul 14, 2025
e11348e
added updraft ensemble and notebook cleanup
tluettm Jul 16, 2025
c8b7d28
added ensemble for ccn concentration / droplet size
tluettm Jul 17, 2025
2403fa3
new unit test for homogeneous nucleation rate and changed saturation …
tluettm Jul 19, 2025
b4c49ad
addressing pylint
tluettm Jul 21, 2025
21e4d88
added vapour deposition on ice to notebook example
tluettm Jul 23, 2025
3096742
further tinkering with simulation setups
tluettm Jul 27, 2025
83c6659
work done on the example notebook
tluettm Aug 5, 2025
aca1e86
Merge branch 'main' into new_hom_freezing_example
tluettm Aug 6, 2025
90da071
'signed water mass' changes applied to scipy solver. scipy solver too…
tluettm Sep 1, 2025
e12ed99
addressing pylint
tluettm Sep 2, 2025
7d8f046
additions to __init__.py
tluettm Sep 2, 2025
2964499
improvements to hom_freezing_example
tluettm Sep 9, 2025
8b46b6a
splitted hom_freezing.ipynb intwo two parts, improvements to simulati…
tluettm Sep 11, 2025
7a56320
precommit check for newly added files
tluettm Sep 11, 2025
ac5fc4c
added hom. freezing example with coalescence
tluettm Sep 12, 2025
0a053cb
extended hom. freezing example with coalescence
tluettm Sep 12, 2025
6306564
Added plot names to show_plot()
tluettm Sep 17, 2025
223147b
Refresh notebook
tluettm Sep 20, 2025
40c782e
Update to the plots and (temporary) change to module imports
tluettm Sep 22, 2025
65aad6a
added_new_plot_type
tluettm Sep 23, 2025
0e2acaa
added_new_plot variable
tluettm Sep 23, 2025
9cffb9a
added plots for updraft ensemble
tluettm Sep 24, 2025
6ea8681
updated notebooks
tluettm Sep 29, 2025
f66516f
Merge branch 'main' into new_hom_freezing_example
tluettm Sep 29, 2025
843620c
changed dry to wet radius initialisation and added lucky droplet meth…
tluettm Sep 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _condensation(
RH_max=RH_max.data,
success=success.data,
)
particulator.attributes.mark_updated("water mass")
particulator.attributes.mark_updated("signed water mass")


@lru_cache()
Expand Down
3 changes: 3 additions & 0 deletions PySDM/particulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ def homogeneous_freezing_time_dependent(self, *, rand: Storage):
temperature=self.environment["T"],
relative_humidity_ice=self.environment["RH_ice"],
)
self.attributes.mark_updated("signed water mass")

def homogeneous_freezing_threshold(self):
self.backend.homogeneous_freezing_threshold(
Expand All @@ -556,6 +557,7 @@ def homogeneous_freezing_threshold(self):
temperature=self.environment["T"],
relative_humidity_ice=self.environment["RH_ice"],
)
self.attributes.mark_updated("signed water mass")

def thaw_instantaneous(self):
self.backend.thaw_instantaneous(
Expand All @@ -565,3 +567,4 @@ def thaw_instantaneous(self):
cell=self.attributes["cell id"],
temperature=self.environment["T"],
)
self.attributes.mark_updated("signed water mass")
15 changes: 15 additions & 0 deletions examples/PySDM_examples/Luettmer_homogeneous_freezing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Homogeneous freezing example

hom_freezing.ipynb:
.. include:: ./hom_freezing.ipynb
"""

from .settings import Settings
from .simulation import Simulation
from .plot import (
plot_thermodynamics_and_bulk,
plot_freezing_temperatures_histogram,
plot_freezing_temperatures_2d_histogram,
plot_freezing_temperatures_2d_histogram_seaborn,
)
85 changes: 85 additions & 0 deletions examples/PySDM_examples/Luettmer_homogeneous_freezing/commons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# import numpy as np
from PySDM import Formulae
from PySDM.physics.constants import si
from PySDM.backends import CPU
import time

from PySDM_examples.Luettmer_homogeneous_freezing.settings import Settings
from PySDM_examples.Luettmer_homogeneous_freezing.simulation import Simulation


formulae = Formulae(
particle_shape_and_density="MixedPhaseSpheres",
)


def run_simulations(setting):

simulation = {
"settings": setting,
"ensemble_member_outputs": [],
}
for n in range(setting["number_of_ensemble_runs"]):
model_setup = Settings(**simulation["settings"])
model_setup.formulae.seed += 1
model = Simulation(model_setup)
simulation["ensemble_member_outputs"].append(model.run())

return simulation


def hom_pure_droplet_freezing_backend():
backends = {
"threshold": CPU(
formulae=Formulae(
particle_shape_and_density="MixedPhaseSpheres",
homogeneous_ice_nucleation_rate="Null",
saturation_vapour_pressure="MurphyKoop2005",
seed=time.time_ns(),
)
),
"KoopMurray2016": CPU(
formulae=Formulae(
particle_shape_and_density="MixedPhaseSpheres",
homogeneous_ice_nucleation_rate="KoopMurray2016",
saturation_vapour_pressure="MurphyKoop2005",
seed=time.time_ns(),
)
),
"Spichtinger2023": CPU(
formulae=Formulae(
particle_shape_and_density="MixedPhaseSpheres",
homogeneous_ice_nucleation_rate="Koop_Correction",
saturation_vapour_pressure="MurphyKoop2005",
seed=time.time_ns(),
)
),
"Koop2000": CPU(
formulae=Formulae(
particle_shape_and_density="MixedPhaseSpheres",
homogeneous_ice_nucleation_rate="Koop2000",
saturation_vapour_pressure="MurphyKoop2005",
seed=time.time_ns(),
)
),
}
return backends


def hom_pure_droplet_freezing_standard_setup():
standard = {
"n_sd": int(1e3),
"w_updraft": 1.0 * si.meter / si.second,
"T0": formulae.trivia.C2K(-25),
"dz": 0.1 * si.meter,
"N_dv_droplet_distribution": 750 / si.cm**3,
"r_mean_droplet_distribution": 15 * si.nanometer,
"type_droplet_distribution": "monodisperse",
"RH_0": 0.995,
"p0": 500 * si.hectopascals,
"condensation_enable": True,
"deposition_enable": True,
"deposition_adaptive": True,
"number_of_ensemble_runs": 1,
}
return standard

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading