PySDM-examples 2.65__py3-none-any.whl → 2.67__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PySDM_examples/Abade_and_Albuquerque_2024/__init__.py +8 -0
- PySDM_examples/Abade_and_Albuquerque_2024/settings.py +48 -0
- PySDM_examples/Abade_and_Albuquerque_2024/simulation.py +49 -0
- {PySDM_examples-2.65.dist-info → PySDM_examples-2.67.dist-info}/METADATA +8 -1
- {PySDM_examples-2.65.dist-info → PySDM_examples-2.67.dist-info}/RECORD +7 -4
- {PySDM_examples-2.65.dist-info → PySDM_examples-2.67.dist-info}/WHEEL +0 -0
- {PySDM_examples-2.65.dist-info → PySDM_examples-2.67.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from pystrict import strict
|
|
2
|
+
|
|
3
|
+
from PySDM import Formulae
|
|
4
|
+
from PySDM.physics import si
|
|
5
|
+
from PySDM.initialisation.spectra import Lognormal
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@strict
|
|
9
|
+
class Settings:
|
|
10
|
+
def __init__(self, *, n_sd: int, timestep: float):
|
|
11
|
+
self.n_sd = n_sd
|
|
12
|
+
self.timestep = timestep
|
|
13
|
+
|
|
14
|
+
self.initial_total_pressure = 1000 * si.hPa # note: not given in the paper
|
|
15
|
+
|
|
16
|
+
# parameters from the paper
|
|
17
|
+
self.formulae = Formulae(
|
|
18
|
+
constants={"bulk_phase_partitioning_exponent": 0.1},
|
|
19
|
+
bulk_phase_partitioning="KaulEtAl2015",
|
|
20
|
+
)
|
|
21
|
+
self.initial_water_vapour_mixing_ratio = 1.5 * si.g / si.kg
|
|
22
|
+
self.parcel_linear_extent = 100 * si.m
|
|
23
|
+
self.updraft = 0.5 * si.m / si.s
|
|
24
|
+
|
|
25
|
+
thd_0 = self.formulae.state_variable_triplet.th_dry(
|
|
26
|
+
th_std=269 * si.K,
|
|
27
|
+
water_vapour_mixing_ratio=self.initial_water_vapour_mixing_ratio,
|
|
28
|
+
)
|
|
29
|
+
rhod_0 = self.formulae.state_variable_triplet.rho_d(
|
|
30
|
+
p=self.initial_total_pressure,
|
|
31
|
+
water_vapour_mixing_ratio=self.initial_water_vapour_mixing_ratio,
|
|
32
|
+
theta_std=thd_0,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
self.mass_of_dry_air = rhod_0 * self.formulae.trivia.volume(
|
|
36
|
+
radius=self.parcel_linear_extent
|
|
37
|
+
)
|
|
38
|
+
self.soluble_aerosol = Lognormal(
|
|
39
|
+
norm_factor=200
|
|
40
|
+
/ si.mg
|
|
41
|
+
* self.mass_of_dry_air, # note: assuming per mg of dry air
|
|
42
|
+
m_mode=75 * si.nm,
|
|
43
|
+
s_geom=1.6,
|
|
44
|
+
)
|
|
45
|
+
self.kappa = 0.6
|
|
46
|
+
self.initial_temperature = self.formulae.state_variable_triplet.T(
|
|
47
|
+
rhod=rhod_0, thd=thd_0
|
|
48
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
from PySDM_examples.utils import BasicSimulation
|
|
4
|
+
|
|
5
|
+
from PySDM import Builder
|
|
6
|
+
from PySDM.backends import CPU
|
|
7
|
+
from PySDM.dynamics import Condensation, AmbientThermodynamics
|
|
8
|
+
from PySDM.initialisation.sampling.spectral_sampling import ConstantMultiplicity
|
|
9
|
+
from PySDM.products import AmbientTemperature, ParcelDisplacement, WaterMixingRatio
|
|
10
|
+
from PySDM.environments import Parcel
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Simulation(BasicSimulation):
|
|
14
|
+
def __init__(self, settings):
|
|
15
|
+
parcel = Parcel(
|
|
16
|
+
dt=settings.timestep,
|
|
17
|
+
mass_of_dry_air=settings.mass_of_dry_air,
|
|
18
|
+
p0=settings.initial_total_pressure,
|
|
19
|
+
initial_water_vapour_mixing_ratio=settings.initial_water_vapour_mixing_ratio,
|
|
20
|
+
T0=settings.initial_temperature,
|
|
21
|
+
w=settings.updraft,
|
|
22
|
+
)
|
|
23
|
+
builder = Builder(
|
|
24
|
+
backend=CPU(settings.formulae, override_jit_flags={"parallel": False}),
|
|
25
|
+
n_sd=settings.n_sd,
|
|
26
|
+
environment=parcel,
|
|
27
|
+
)
|
|
28
|
+
builder.add_dynamic(AmbientThermodynamics())
|
|
29
|
+
builder.add_dynamic(Condensation())
|
|
30
|
+
|
|
31
|
+
r_dry, n_in_dv = ConstantMultiplicity(settings.soluble_aerosol).sample(
|
|
32
|
+
n_sd=settings.n_sd
|
|
33
|
+
)
|
|
34
|
+
attributes = parcel.init_attributes(
|
|
35
|
+
n_in_dv=n_in_dv, kappa=settings.kappa, r_dry=r_dry
|
|
36
|
+
)
|
|
37
|
+
self.products = (
|
|
38
|
+
WaterMixingRatio(name="water", radius_range=(0, np.inf)),
|
|
39
|
+
WaterMixingRatio(name="ice", radius_range=(-np.inf, 0)),
|
|
40
|
+
WaterMixingRatio(name="total", radius_range=(-np.inf, np.inf)),
|
|
41
|
+
ParcelDisplacement(name="height"),
|
|
42
|
+
AmbientTemperature(name="T"),
|
|
43
|
+
)
|
|
44
|
+
super().__init__(
|
|
45
|
+
particulator=builder.build(attributes=attributes, products=self.products)
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def run(self, *, nt, steps_per_output_interval):
|
|
49
|
+
return self._run(nt=nt, steps_per_output_interval=steps_per_output_interval)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PySDM-examples
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.67
|
|
4
4
|
Summary: PySDM usage examples reproducing results from literature and depicting how to use PySDM from Python Jupyter notebooks
|
|
5
5
|
Home-page: https://github.com/open-atmos/PySDM
|
|
6
6
|
Author: https://github.com/open-atmos/PySDM/graphs/contributors
|
|
@@ -238,6 +238,13 @@ Requires-Dist: nbconvert ; extra == 'tests'
|
|
|
238
238
|
[](https://mybinder.org/v2/gh/open-atmos/PySDM.git/main?urlpath=lab/tree/examples/PySDM_examples/Jaruga_and_Pawlowska_2018/fig_3.ipynb)
|
|
239
239
|
[](https://colab.research.google.com/github/open-atmos/PySDM/blob/main/examples/PySDM_examples/Jaruga_and_Pawlowska_2018/fig_3.ipynb)
|
|
240
240
|
|
|
241
|
+
### 0D parcel-environment condensation/freezing example:
|
|
242
|
+
- [Abade & Albuquerque 2024](https://doi.org/10.1002/qj.4775) (Adiabatic parcel, liquid/solid phase partitioning):
|
|
243
|
+
- Fig 2:
|
|
244
|
+
[](https://github.com/open-atmos/PySDM/blob/main/examples/PySDM_examples/Abade_and_Albuquerque_2024/fig_2.ipynb)
|
|
245
|
+
[](https://mybinder.org/v2/gh/open-atmos/PySDM.git/main?urlpath=lab/tree/examples/PySDM_examples/Abade_and_Albuquerque_2024/fig_2.ipynb)
|
|
246
|
+
[](https://colab.research.google.com/github/open-atmos/PySDM/blob/main/examples/PySDM_examples/Abade_and_Albuquerque_2024/fig_2.ipynb)
|
|
247
|
+
|
|
241
248
|
### OD parcel-environment iterative framework mimicking removal of precipitation
|
|
242
249
|
- [Rozanski & Sonntag 1982](https://doi.org/10.1111/j.2153-3490.1982.tb01800.x):
|
|
243
250
|
- Figs 4-6:
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
PySDM_examples/__init__.py,sha256=Ht8EcJquTq4qeSaDJ4qFG8SNWA4qMfhfTyGcO415i3A,340
|
|
2
|
+
PySDM_examples/Abade_and_Albuquerque_2024/__init__.py,sha256=agkn4Z6rWIh64M4UweHkacNu-dNOE2dkSfPqvy2zD2k,228
|
|
3
|
+
PySDM_examples/Abade_and_Albuquerque_2024/settings.py,sha256=bKByjymGguWI47OvgVZrTdFoClYb7FmAmOAa6vIhwqg,1613
|
|
4
|
+
PySDM_examples/Abade_and_Albuquerque_2024/simulation.py,sha256=rGIbkOa9XcwLmdjUbyKgFM6n6TLZyZVBD-4l-hWEGUs,1925
|
|
2
5
|
PySDM_examples/Abdul_Razzak_Ghan_2000/__init__.py,sha256=t568yvoJqJgyyhR69eBjs2y8gj4SIgofowulmiWbz9U,165
|
|
3
6
|
PySDM_examples/Abdul_Razzak_Ghan_2000/aerosol.py,sha256=BHZL7DILM2WGK5v251N0pHd_bdk8V1PnhSpItkPh1HI,3405
|
|
4
7
|
PySDM_examples/Abdul_Razzak_Ghan_2000/data_from_ARG2000_paper.py,sha256=MRyurAnXq5ESE8gA5rzMsVx1ZhwcOz76o2xPRAcTPMQ,11585
|
|
@@ -142,7 +145,7 @@ PySDM_examples/utils/read_vtk_1d.py,sha256=7_3sagEbX_FxqFuGkFWdwQapd1-9echFghU8T
|
|
|
142
145
|
PySDM_examples/utils/widgets/__init__.py,sha256=U67WZ2YDcXSocMraI7pzcMxCfcxzXNqehDzoG6ogsh4,519
|
|
143
146
|
PySDM_examples/utils/widgets/freezer.py,sha256=tFlZWShXUzA2X0cxgeE44N1g9kD33q3KQWZBqkgBP0A,407
|
|
144
147
|
PySDM_examples/utils/widgets/progbar_updater.py,sha256=3uhG32QkAiSM3dTV7DoROJl7fAUNA6ZsJEIKSg3tdmk,267
|
|
145
|
-
PySDM_examples-2.
|
|
146
|
-
PySDM_examples-2.
|
|
147
|
-
PySDM_examples-2.
|
|
148
|
-
PySDM_examples-2.
|
|
148
|
+
PySDM_examples-2.67.dist-info/METADATA,sha256=h5s_z6_pGZ14Y3TSgihv2Yjg-YG6T8hi6C0nVI71Eqo,40752
|
|
149
|
+
PySDM_examples-2.67.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
150
|
+
PySDM_examples-2.67.dist-info/top_level.txt,sha256=axw2inuuYKPWkQhzBYtkZJTPDlo5LrpGLOA0iSAf9v0,15
|
|
151
|
+
PySDM_examples-2.67.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|