Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9b910d0
matsushima multiplicity parameterization
emmacware Jun 16, 2025
7ec0500
constants: redefine room temperature to be 25C instead of 25.01C (#1646)
slayoo Jun 13, 2025
90b2ed2
Merge branch 'main' into alpha_sampling
slayoo Jun 16, 2025
6813de9
correct alpha function
emmacware Jun 18, 2025
561d492
Homogeneous freezing (as a new option in `Freezing` dynamic, disabled…
tluettm Jun 18, 2025
32c5c52
CI: do not run tests for docs/README-only commits in PRs (#1652)
slayoo Jun 18, 2025
4c0f24b
integrate to pysdm!
emmacware Jun 20, 2025
6618c0a
Merge branch 'main' into alpha_sampling
slayoo Jul 2, 2025
962278a
alpha sampling tests
emmacware Jul 2, 2025
095ba0d
move plottnig logic from .py file to ipynb; drop dependence on seabor…
slayoo Jul 2, 2025
8d0fd8c
add bib items; remove commented-out code; precommit, pylint, etc
slayoo Jul 2, 2025
dbc5ebf
Merge branch 'main' into alpha_sampling
slayoo Jul 6, 2025
ad154f7
shipway match CLEO
emmacware Jul 18, 2025
3beeb0f
add random,pseudorandom, and endpoint dist options
emmacware Jul 21, 2025
59efe5e
example endpoint dists
emmacware Jul 21, 2025
98360c6
much smaller wiggle
emmacware Jul 21, 2025
258b676
Merge pull request #2 from open-atmos/main
emmacware Jul 22, 2025
3c7bdbc
create Hill et al 2023 figs , share backend
emmacware Jul 23, 2025
723ddf5
iters and errors
emmacware Jul 23, 2025
f50ee9c
adding Hill et al. 2023 to bib file
slayoo Sep 17, 2025
f33c5cc
fix DOI
slayoo Sep 17, 2025
617fc38
revert changes (part of other PR)
slayoo Sep 17, 2025
9f92bee
revert changes (part of other PR)
slayoo Sep 17, 2025
ec4a4a6
revert changes
slayoo Sep 17, 2025
0b304af
reverts
slayoo Sep 17, 2025
f085ef3
delete files
slayoo Sep 17, 2025
d378bf3
fix merge conflict
slayoo Sep 17, 2025
2d09e51
more reverts
slayoo Sep 17, 2025
eba32c9
cleanups, cleanups, cleanups
slayoo Sep 18, 2025
9f90733
fix merge conflict
slayoo Sep 18, 2025
03cb6cc
fox docs paths
slayoo Sep 18, 2025
cc9bf40
graph debugging
emmacware Oct 7, 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
8 changes: 8 additions & 0 deletions docs/bibliography.json
Original file line number Diff line number Diff line change
Expand Up @@ -946,5 +946,13 @@
],
"title": "A physically constrained classical description of the homogeneous nucleation of ice in water",
"label": "Koop and Murray 2016 (J. Chem. Phys. 145)"
},
"https://doi.org/10.1175/JAS-D-21-0275.1": {
"usages": [
"examples/PySDM_examples/Hill_et_al_2023/__init__.py",
"examples/PySDM_examples/Hill_et_al_2023/figs_1_2_4.ipynb"
],
"title": "Toward a Numerical Benchmark for Warm Rain Processes",
"label": "Hill et al. 2023 (JAS 80)"
}
}
8 changes: 8 additions & 0 deletions examples/PySDM_examples/Hill_et_al_2023/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# pylint: disable=invalid-name
"""
single-column prescribed-flow constant-temperature example from
[Hill et al., 2023](https://doi.org/10.1175/JAS-D-21-0275.1)

figs_1_2_4.ipynb
.. include:: ./figs_1_2_4.ipynb.badges.md
"""
70 changes: 70 additions & 0 deletions examples/PySDM_examples/Hill_et_al_2023/cross_sections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
from PySDM.physics import si
import numpy as np


def compute_dvol_andsigma_time_series(output, settings, cloud_base):
num_conc = (output["nc"] + output["nr"])[cloud_base]
rho_w = settings.formulae.constants.rho_w
D_vol = (6 * output["LWC"][cloud_base] / (np.pi * num_conc * rho_w)) ** (1 / 3)

r_bin_edges = settings.r_bins_edges
r_bin_centers = (r_bin_edges[:-1] + r_bin_edges[1:]) / 2
r_bin_volumes = settings.formulae.trivia.volume(r_bin_centers)

nc = output["wet spectrum"][cloud_base] + output["dry spectrum"][cloud_base]
mass_bins = (nc * r_bin_volumes[:, np.newaxis]) * rho_w
Dk = r_bin_centers * 2
Dvolmass = np.sum(mass_bins * Dk[:, np.newaxis], axis=0) / np.sum(mass_bins, axis=0)
Nd = np.sum(nc)
sigma = np.sqrt(
(1 / (Nd - 1)) * np.sum(nc * (Dk[:, np.newaxis] - Dvolmass) ** 2, axis=0)
)
return D_vol, sigma


def compute_dvol_andsigma_vertical(output, settings, zslice, time):
t_idx = np.where(output["t"] == time)[0][0]
num_conc = (output["nc"] + output["nr"])[zslice, t_idx]
rho_w = settings.formulae.constants.rho_w

D_vol = (6 * output["LWC"][zslice, t_idx] / (np.pi * num_conc * rho_w)) ** (1 / 3)

r_bin_edges = settings.r_bins_edges
r_bin_centers = (r_bin_edges[:-1] + r_bin_edges[1:]) / 2
r_bin_volumes = settings.formulae.trivia.volume(r_bin_centers)
nc = (
output["wet spectrum"][zslice, :, t_idx]
+ output["dry spectrum"][zslice, :, t_idx]
)
mass_bins = (nc * r_bin_volumes) * rho_w
Dk = r_bin_centers * 2
Dvolmass = np.sum(mass_bins * Dk, axis=1) / np.sum(mass_bins, axis=1)
Nd = np.sum(nc, axis=1)
sigma = np.sqrt(
(1 / (Nd - 1)) * np.sum(nc * (Dk - Dvolmass[:, np.newaxis]) ** 2, axis=1)
)
return D_vol, sigma


def compute_LWP_and_nc_time_series(output, settings, z_slice):
# LWP = np.mean(output["LWC"][z_slice], axis=0) * settings.z_max
LWP = np.sum(output["LWC"][z_slice], axis=0) * settings.dz
num_conc = (output["nc"] + output["nr"])[z_slice]
mask = output["LWC"][z_slice] > 1e-5
masked = num_conc * mask
masked[masked == 0] = np.nan
mean_num_conc = np.nanmean(masked, axis=0)
mean_num_conc[mean_num_conc == np.nan] = 0
return LWP, mean_num_conc


def compute_LWP_and_nc_vertical(output, z_slice, time):
t_idx = np.where(output["t"] == time)[0][0]
LWC = output["LWC"][z_slice, t_idx]
num_conc = (output["nc"] + output["nr"] + output["na"])[z_slice, t_idx]
mask = output["LWC"][z_slice, t_idx] > 1e-5
masked = num_conc * mask
masked[masked == 0] = np.nan
mean_num_conc = masked
mean_num_conc[mean_num_conc == np.nan] = 0
return LWC, num_conc
624 changes: 624 additions & 0 deletions examples/PySDM_examples/Hill_et_al_2023/figs_1_2_4.ipynb

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions examples/PySDM_examples/Shipway_and_Hill_2012/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def __init__(
save_spec_and_attr_times=(),
collision_kernel=None,
old_buggy_density_formula=False,
cloud_water_radius_range=(1 * si.um, 50 * si.um),
rain_water_radius_range=(50 * si.um, np.inf),
ignore_moisture_profile_in_density_calc=False,
):
self.formulae = formulae or Formulae()
self.n_sd_per_gridbox = n_sd_per_gridbox
Expand Down Expand Up @@ -112,9 +115,11 @@ def drhod_dz(z_above_reservoir, rhod):
water_vapour_mixing_ratio = self.water_vapour_mixing_ratio(
z_above_reservoir
)
d_water_vapour_mixing_ratio__dz = Derivative(
self.water_vapour_mixing_ratio
)(z_above_reservoir)
d_water_vapour_mixing_ratio__dz = (
0
if ignore_moisture_profile_in_density_calc
else Derivative(self.water_vapour_mixing_ratio)(z_above_reservoir)
)
T = self.formulae.state_variable_triplet.T(
rhod[0], self.thd(z_above_reservoir)
)
Expand Down Expand Up @@ -164,8 +169,8 @@ def drhod_dz(z_above_reservoir, rhod):
self.number_of_bins + 1,
endpoint=True,
)
self.cloud_water_radius_range = [1 * si.um, 50 * si.um]
self.rain_water_radius_range = [50 * si.um, np.inf * si.um]
self.cloud_water_radius_range = cloud_water_radius_range
self.rain_water_radius_range = rain_water_radius_range
self.save_spec_and_attr_times = save_spec_and_attr_times

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def zZ_to_z_above_reservoir(zZ):
PySDM_products.AmbientWaterVapourMixingRatio(
name="water_vapour_mixing_ratio"
),
PySDM_products.LiquidWaterContent(name="LWC"),
]
if settings.enable_condensation:
self.products.extend(
Expand Down