PySDM 2.69__py3-none-any.whl → 2.71__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/builder.py +5 -5
- PySDM/dynamics/ambient_thermodynamics.py +3 -0
- PySDM/dynamics/aqueous_chemistry.py +2 -0
- PySDM/dynamics/collisions/collision.py +4 -0
- PySDM/dynamics/condensation.py +3 -1
- PySDM/dynamics/displacement.py +3 -0
- PySDM/dynamics/eulerian_advection.py +8 -9
- PySDM/dynamics/freezing.py +2 -0
- PySDM/dynamics/impl/__init__.py +2 -0
- PySDM/dynamics/impl/register_dynamic.py +21 -0
- PySDM/dynamics/isotopic_fractionation.py +2 -0
- PySDM/dynamics/relaxed_velocity.py +2 -0
- PySDM/environments/impl/moist.py +7 -7
- PySDM/environments/kinematic_1d.py +1 -3
- PySDM/environments/kinematic_2d.py +4 -8
- PySDM/products/ambient_thermodynamics/ambient_dry_air_density.py +2 -1
- PySDM/products/ambient_thermodynamics/ambient_dry_air_potential_temperature.py +2 -1
- PySDM/products/ambient_thermodynamics/ambient_pressure.py +2 -1
- PySDM/products/ambient_thermodynamics/ambient_relative_humidity.py +2 -1
- PySDM/products/ambient_thermodynamics/ambient_temperature.py +2 -1
- PySDM/products/ambient_thermodynamics/ambient_water_vapour_mixing_ratio.py +2 -1
- PySDM/products/aqueous_chemistry/acidity.py +2 -1
- PySDM/products/aqueous_chemistry/aqueous_mass_spectrum.py +3 -1
- PySDM/products/aqueous_chemistry/aqueous_mole_fraction.py +2 -1
- PySDM/products/aqueous_chemistry/gaseous_mole_fraction.py +2 -1
- PySDM/products/aqueous_chemistry/total_dry_mass_mixing_ratio.py +2 -1
- PySDM/products/collision/collision_rates.py +6 -1
- PySDM/products/collision/collision_timestep_mean.py +2 -1
- PySDM/products/collision/collision_timestep_min.py +2 -1
- PySDM/products/condensation/activable_fraction.py +2 -1
- PySDM/products/condensation/condensation_timestep.py +4 -1
- PySDM/products/condensation/event_rates.py +5 -1
- PySDM/products/condensation/peak_supersaturation.py +2 -1
- PySDM/products/displacement/averaged_terminal_velocity.py +2 -1
- PySDM/products/displacement/flow_velocity_component.py +2 -1
- PySDM/products/displacement/max_courant_number.py +2 -1
- PySDM/products/displacement/surface_precipitation.py +2 -1
- PySDM/products/freezing/cooling_rate.py +2 -1
- PySDM/products/freezing/freezable_specific_concentration.py +2 -1
- PySDM/products/freezing/frozen_particle_concentration.py +3 -1
- PySDM/products/freezing/ice_nuclei_concentration.py +3 -1
- PySDM/products/freezing/total_unfrozen_immersed_surface_area.py +2 -1
- PySDM/products/housekeeping/dynamic_wall_time.py +2 -1
- PySDM/products/housekeeping/super_droplet_count_per_gridbox.py +2 -1
- PySDM/products/housekeeping/time.py +2 -1
- PySDM/products/housekeeping/timers.py +3 -1
- PySDM/products/impl/__init__.py +3 -0
- PySDM/products/impl/activation_filtered_product.py +1 -1
- PySDM/products/impl/product.py +5 -1
- PySDM/products/impl/register_product.py +22 -0
- PySDM/products/optical/cloud_albedo.py +2 -1
- PySDM/products/optical/cloud_optical_depth.py +2 -1
- PySDM/products/parcel/cloud_water_path.py +11 -7
- PySDM/products/parcel/parcel_displacement.py +2 -1
- PySDM/products/size_spectral/arbitrary_moment.py +2 -2
- PySDM/products/size_spectral/cloud_water_content.py +7 -1
- PySDM/products/size_spectral/effective_radius.py +2 -1
- PySDM/products/size_spectral/effective_radius_activated.py +11 -7
- PySDM/products/size_spectral/mean_radius.py +2 -1
- PySDM/products/size_spectral/mean_radius_activated.py +10 -6
- PySDM/products/size_spectral/mean_volume_radius.py +10 -6
- PySDM/products/size_spectral/number_size_spectrum.py +2 -1
- PySDM/products/size_spectral/particle_concentration.py +3 -1
- PySDM/products/size_spectral/particle_concentration_activated.py +11 -6
- PySDM/products/size_spectral/particle_size_spectrum.py +7 -2
- PySDM/products/size_spectral/particle_volume_versus_radius_logarithm_spectrum.py +2 -1
- PySDM/products/size_spectral/radius_binned_number_averaged_terminal_velocity.py +2 -1
- PySDM/products/size_spectral/size_standard_deviation.py +13 -8
- PySDM/products/size_spectral/total_particle_concentration.py +2 -1
- PySDM/products/size_spectral/total_particle_specific_concentration.py +2 -1
- PySDM/products/size_spectral/water_mixing_ratio.py +2 -1
- {PySDM-2.69.dist-info → PySDM-2.71.dist-info}/METADATA +12 -12
- {PySDM-2.69.dist-info → PySDM-2.71.dist-info}/RECORD +76 -74
- {PySDM-2.69.dist-info → PySDM-2.71.dist-info}/WHEEL +1 -1
- {PySDM-2.69.dist-info → PySDM-2.71.dist-info}/LICENSE +0 -0
- {PySDM-2.69.dist-info → PySDM-2.71.dist-info}/top_level.txt +0 -0
PySDM/builder.py
CHANGED
|
@@ -61,9 +61,9 @@ class Builder:
|
|
|
61
61
|
def _register_product(self, product, buffer):
|
|
62
62
|
if product.name in self.particulator.products:
|
|
63
63
|
raise ValueError(f'product name "{product.name}" already registered')
|
|
64
|
-
product.
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
self.particulator.products[product.name] = product.instantiate(
|
|
65
|
+
builder=self, buffer=buffer
|
|
66
|
+
)
|
|
67
67
|
|
|
68
68
|
def _resolve_attribute(self, attr_name):
|
|
69
69
|
if attr_name not in self.req_attr:
|
|
@@ -121,8 +121,8 @@ class Builder:
|
|
|
121
121
|
self._resolve_attribute(attr_name)
|
|
122
122
|
self.req_attr_names = None
|
|
123
123
|
|
|
124
|
-
for dynamic in self.particulator.dynamics.
|
|
125
|
-
dynamic.
|
|
124
|
+
for key, dynamic in self.particulator.dynamics.items():
|
|
125
|
+
self.particulator.dynamics[key] = dynamic.instantiate(builder=self)
|
|
126
126
|
|
|
127
127
|
single_buffer_for_all_products = np.empty(self.particulator.mesh.grid)
|
|
128
128
|
for product in products:
|
|
@@ -13,12 +13,14 @@ from PySDM.dynamics.impl.chemistry_utils import (
|
|
|
13
13
|
M,
|
|
14
14
|
SpecificGravities,
|
|
15
15
|
)
|
|
16
|
+
from PySDM.dynamics.impl import register_dynamic
|
|
16
17
|
|
|
17
18
|
DEFAULTS = namedtuple("_", ("pH_min", "pH_max", "pH_rtol", "ionic_strength_threshold"))(
|
|
18
19
|
pH_min=-1.0, pH_max=14.0, pH_rtol=1e-6, ionic_strength_threshold=0.02 * M
|
|
19
20
|
)
|
|
20
21
|
|
|
21
22
|
|
|
23
|
+
@register_dynamic()
|
|
22
24
|
class AqueousChemistry: # pylint: disable=too-many-instance-attributes
|
|
23
25
|
def __init__(
|
|
24
26
|
self,
|
|
@@ -23,6 +23,7 @@ from PySDM.dynamics.impl.random_generator_optimizer_nopair import (
|
|
|
23
23
|
RandomGeneratorOptimizerNoPair,
|
|
24
24
|
)
|
|
25
25
|
from PySDM.physics import si
|
|
26
|
+
from PySDM.dynamics.impl import register_dynamic
|
|
26
27
|
|
|
27
28
|
# pylint: disable=too-many-lines
|
|
28
29
|
|
|
@@ -36,6 +37,7 @@ DEFAULTS = namedtuple(
|
|
|
36
37
|
)
|
|
37
38
|
|
|
38
39
|
|
|
40
|
+
@register_dynamic()
|
|
39
41
|
class Collision: # pylint: disable=too-many-instance-attributes
|
|
40
42
|
def __init__(
|
|
41
43
|
self,
|
|
@@ -288,6 +290,7 @@ class Collision: # pylint: disable=too-many-instance-attributes
|
|
|
288
290
|
)
|
|
289
291
|
|
|
290
292
|
|
|
293
|
+
@register_dynamic()
|
|
291
294
|
class Coalescence(Collision):
|
|
292
295
|
def __init__(
|
|
293
296
|
self,
|
|
@@ -316,6 +319,7 @@ class Coalescence(Collision):
|
|
|
316
319
|
)
|
|
317
320
|
|
|
318
321
|
|
|
322
|
+
@register_dynamic()
|
|
319
323
|
class Breakup(Collision):
|
|
320
324
|
def __init__(
|
|
321
325
|
self,
|
PySDM/dynamics/condensation.py
CHANGED
|
@@ -7,7 +7,8 @@ from collections import namedtuple
|
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
|
|
10
|
-
from
|
|
10
|
+
from PySDM.physics import si
|
|
11
|
+
from PySDM.dynamics.impl import register_dynamic
|
|
11
12
|
|
|
12
13
|
DEFAULTS = namedtuple("_", ("rtol_x", "rtol_thd", "cond_range", "schedule"))(
|
|
13
14
|
rtol_x=1e-6,
|
|
@@ -17,6 +18,7 @@ DEFAULTS = namedtuple("_", ("rtol_x", "rtol_thd", "cond_range", "schedule"))(
|
|
|
17
18
|
)
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
@register_dynamic()
|
|
20
22
|
class Condensation: # pylint: disable=too-many-instance-attributes
|
|
21
23
|
def __init__(
|
|
22
24
|
self,
|
PySDM/dynamics/displacement.py
CHANGED
|
@@ -11,9 +11,12 @@ from collections import namedtuple
|
|
|
11
11
|
|
|
12
12
|
import numpy as np
|
|
13
13
|
|
|
14
|
+
from PySDM.dynamics.impl import register_dynamic
|
|
15
|
+
|
|
14
16
|
DEFAULTS = namedtuple("_", ("rtol", "adaptive"))(rtol=1e-2, adaptive=True)
|
|
15
17
|
|
|
16
18
|
|
|
19
|
+
@register_dynamic()
|
|
17
20
|
class Displacement: # pylint: disable=too-many-instance-attributes
|
|
18
21
|
def __init__(
|
|
19
22
|
self,
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
wrapper class for triggering integration in the Eulerian advection solver
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
from PySDM.dynamics.impl import register_dynamic
|
|
5
6
|
|
|
7
|
+
|
|
8
|
+
@register_dynamic()
|
|
6
9
|
class EulerianAdvection:
|
|
7
10
|
def __init__(self, solvers):
|
|
8
11
|
self.solvers = solvers
|
|
@@ -12,12 +15,8 @@ class EulerianAdvection:
|
|
|
12
15
|
self.particulator = builder.particulator
|
|
13
16
|
|
|
14
17
|
def __call__(self):
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
self.particulator.environment.get_predicted("thd").download(
|
|
21
|
-
self.particulator.environment.get_thd(), reshape=True
|
|
22
|
-
)
|
|
23
|
-
self.solvers()
|
|
18
|
+
for field in ("water_vapour_mixing_ratio", "thd"):
|
|
19
|
+
self.particulator.environment.get_predicted(field).download(
|
|
20
|
+
getattr(self.particulator.environment, f"get_{field}")(), reshape=True
|
|
21
|
+
)
|
|
22
|
+
self.solvers(self.particulator.dynamics["Displacement"])
|
PySDM/dynamics/freezing.py
CHANGED
|
@@ -7,8 +7,10 @@ from PySDM.backends.impl_common.freezing_attributes import (
|
|
|
7
7
|
TimeDependentAttributes,
|
|
8
8
|
)
|
|
9
9
|
from PySDM.physics.heterogeneous_ice_nucleation_rate import Null
|
|
10
|
+
from PySDM.dynamics.impl import register_dynamic
|
|
10
11
|
|
|
11
12
|
|
|
13
|
+
@register_dynamic()
|
|
12
14
|
class Freezing:
|
|
13
15
|
def __init__(self, *, singular=True, record_freezing_temperature=False, thaw=False):
|
|
14
16
|
assert not (record_freezing_temperature and singular)
|
PySDM/dynamics/impl/__init__.py
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
""" decorator for dynamics classes
|
|
2
|
+
ensuring that their instances can be re-used with multiple builders """
|
|
3
|
+
|
|
4
|
+
from copy import deepcopy
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _instantiate(self, *, builder):
|
|
8
|
+
copy = deepcopy(self)
|
|
9
|
+
copy.register(builder=builder)
|
|
10
|
+
return copy
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def register_dynamic():
|
|
14
|
+
def decorator(cls):
|
|
15
|
+
if hasattr(cls, "instantiate"):
|
|
16
|
+
assert cls.instantiate is _instantiate
|
|
17
|
+
else:
|
|
18
|
+
setattr(cls, "instantiate", _instantiate)
|
|
19
|
+
return cls
|
|
20
|
+
|
|
21
|
+
return decorator
|
|
@@ -4,11 +4,13 @@ requires condensation dynamic to be registered (and run beforehand)
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
from PySDM.dynamics.condensation import Condensation
|
|
7
|
+
from PySDM.dynamics.impl import register_dynamic
|
|
7
8
|
|
|
8
9
|
LIGHT_ISOTOPES = ("1H", "16O")
|
|
9
10
|
HEAVY_ISOTOPES = ("2H", "3H", "17O", "18O")
|
|
10
11
|
|
|
11
12
|
|
|
13
|
+
@register_dynamic()
|
|
12
14
|
class IsotopicFractionation:
|
|
13
15
|
def __init__(self, isotopes: tuple = HEAVY_ISOTOPES):
|
|
14
16
|
self.isotopes = isotopes
|
|
@@ -6,8 +6,10 @@ towards the terminal velocity
|
|
|
6
6
|
|
|
7
7
|
from PySDM.attributes.impl.attribute import Attribute
|
|
8
8
|
from PySDM.particulator import Particulator
|
|
9
|
+
from PySDM.dynamics.impl import register_dynamic
|
|
9
10
|
|
|
10
11
|
|
|
12
|
+
@register_dynamic()
|
|
11
13
|
class RelaxedVelocity: # pylint: disable=too-many-instance-attributes
|
|
12
14
|
"""
|
|
13
15
|
A dynamic which updates the fall momentum according to a relaxation timescale
|
PySDM/environments/impl/moist.py
CHANGED
|
@@ -44,21 +44,21 @@ class Moist:
|
|
|
44
44
|
result[var] = self.particulator.Storage.empty((self.mesh.n_cell,), float)
|
|
45
45
|
return result
|
|
46
46
|
|
|
47
|
-
def __getitem__(self,
|
|
48
|
-
"""returns a Storage representing the variable (field) at a given
|
|
49
|
-
otherwise a NaN-filled Storage if the
|
|
47
|
+
def __getitem__(self, key: str):
|
|
48
|
+
"""returns a Storage representing the variable (field) at a given key or
|
|
49
|
+
otherwise a NaN-filled Storage if the key is not found (in order to simplify
|
|
50
50
|
generic code which uses optional variables, e.g. air viscosity, etc.)"""
|
|
51
|
-
if
|
|
52
|
-
return self._values["current"][
|
|
51
|
+
if key in self._values["current"]:
|
|
52
|
+
return self._values["current"][key]
|
|
53
53
|
return self._nan_field
|
|
54
54
|
|
|
55
|
-
def get_predicted(self,
|
|
55
|
+
def get_predicted(self, key: str):
|
|
56
56
|
if self._values["predicted"] is None:
|
|
57
57
|
raise AssertionError(
|
|
58
58
|
"It seems the AmbientThermodynamics dynamic was not added"
|
|
59
59
|
" when building particulator"
|
|
60
60
|
)
|
|
61
|
-
return self._values["predicted"][
|
|
61
|
+
return self._values["predicted"][key]
|
|
62
62
|
|
|
63
63
|
def _recalculate_temperature_pressure_relative_humidity(self, target):
|
|
64
64
|
self.particulator.backend.temperature_pressure_rh(
|
|
@@ -26,7 +26,7 @@ class Kinematic1D(Moist):
|
|
|
26
26
|
self._tmp["rhod"] = rhod
|
|
27
27
|
|
|
28
28
|
def get_water_vapour_mixing_ratio(self) -> np.ndarray:
|
|
29
|
-
return self.particulator.dynamics["EulerianAdvection"].solvers.advectee
|
|
29
|
+
return self.particulator.dynamics["EulerianAdvection"].solvers.advectee
|
|
30
30
|
|
|
31
31
|
def get_thd(self) -> np.ndarray:
|
|
32
32
|
return self.thd0
|
|
@@ -61,9 +61,7 @@ class Kinematic1D(Moist):
|
|
|
61
61
|
v_wet, n_per_kg = spectral_discretisation.sample(
|
|
62
62
|
backend=self.particulator.backend, n_sd=self.particulator.n_sd
|
|
63
63
|
)
|
|
64
|
-
# attributes["dry volume"] = v_wet
|
|
65
64
|
attributes["volume"] = v_wet
|
|
66
|
-
# attributes["kappa times dry volume"] = attributes["dry volume"] * kappa
|
|
67
65
|
else:
|
|
68
66
|
r_dry, n_per_kg = spectral_discretisation.sample(
|
|
69
67
|
backend=self.particulator.backend, n_sd=self.particulator.n_sd
|
|
@@ -85,16 +85,12 @@ class Kinematic2D(Moist):
|
|
|
85
85
|
return attributes
|
|
86
86
|
|
|
87
87
|
def get_thd(self):
|
|
88
|
-
return
|
|
89
|
-
self.particulator.dynamics["EulerianAdvection"].solvers["th"].advectee.get()
|
|
90
|
-
)
|
|
88
|
+
return self.particulator.dynamics["EulerianAdvection"].solvers["th"]
|
|
91
89
|
|
|
92
90
|
def get_water_vapour_mixing_ratio(self):
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
.advectee.get()
|
|
97
|
-
)
|
|
91
|
+
return self.particulator.dynamics["EulerianAdvection"].solvers[
|
|
92
|
+
"water_vapour_mixing_ratio"
|
|
93
|
+
]
|
|
98
94
|
|
|
99
95
|
def sync(self):
|
|
100
96
|
self.particulator.dynamics["EulerianAdvection"].solvers.wait()
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
ambient dry-air density
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl
|
|
5
|
+
from PySDM.products.impl import MoistEnvironmentProduct, register_product
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@register_product()
|
|
8
9
|
class AmbientDryAirDensity(MoistEnvironmentProduct):
|
|
9
10
|
def __init__(self, name="rhod", unit="kg/m^3", var=None):
|
|
10
11
|
super().__init__(name=name, unit=unit, var=var)
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
ambient dry-air potential temperature (computed using dry air partial pressure)
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl
|
|
5
|
+
from PySDM.products.impl import MoistEnvironmentProduct, register_product
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@register_product()
|
|
8
9
|
class AmbientDryAirPotentialTemperature(MoistEnvironmentProduct):
|
|
9
10
|
def __init__(self, unit="K", name=None, var=None):
|
|
10
11
|
super().__init__(unit=unit, name=name, var=var)
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
ambient pressure
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl
|
|
5
|
+
from PySDM.products.impl import MoistEnvironmentProduct, register_product
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@register_product()
|
|
8
9
|
class AmbientPressure(MoistEnvironmentProduct):
|
|
9
10
|
def __init__(self, name=None, unit="Pa", var=None):
|
|
10
11
|
super().__init__(name=name, unit=unit, var=var)
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
ambient relative humidity (wrt water or ice)
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl
|
|
5
|
+
from PySDM.products.impl import MoistEnvironmentProduct, register_product
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@register_product()
|
|
8
9
|
class AmbientRelativeHumidity(MoistEnvironmentProduct):
|
|
9
10
|
def __init__(self, name=None, unit="dimensionless", var=None, ice=False):
|
|
10
11
|
super().__init__(name=name, unit=unit, var=var)
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
ambient temperature
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl
|
|
5
|
+
from PySDM.products.impl import MoistEnvironmentProduct, register_product
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@register_product()
|
|
8
9
|
class AmbientTemperature(MoistEnvironmentProduct):
|
|
9
10
|
def __init__(self, name=None, unit="K", var=None):
|
|
10
11
|
super().__init__(name=name, unit=unit, var=var)
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
ambient water vapour mixing ratio (mass of water vapour per mass of dry air)
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl
|
|
5
|
+
from PySDM.products.impl import MoistEnvironmentProduct, register_product
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@register_product()
|
|
8
9
|
class AmbientWaterVapourMixingRatio(MoistEnvironmentProduct):
|
|
9
10
|
def __init__(self, name=None, unit="dimensionless", var=None):
|
|
10
11
|
super().__init__(unit=unit, name=name, var=var)
|
|
@@ -5,9 +5,10 @@ with weighting either by number or volume
|
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
8
|
-
from PySDM.products.impl
|
|
8
|
+
from PySDM.products.impl import MomentProduct, register_product
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
@register_product()
|
|
11
12
|
class Acidity(MomentProduct):
|
|
12
13
|
def __init__(
|
|
13
14
|
self,
|
|
@@ -8,9 +8,10 @@ from chempy import Substance
|
|
|
8
8
|
|
|
9
9
|
from PySDM.dynamics.impl.chemistry_utils import AQUEOUS_COMPOUNDS
|
|
10
10
|
from PySDM.physics.constants import si
|
|
11
|
-
from PySDM.products.impl
|
|
11
|
+
from PySDM.products.impl import SpectrumMomentProduct, register_product
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
@register_product()
|
|
14
15
|
class AqueousMassSpectrum(SpectrumMomentProduct):
|
|
15
16
|
def __init__(
|
|
16
17
|
self, *, key, dry_radius_bins_edges, specific=False, name=None, unit="kg/m^3"
|
|
@@ -58,6 +59,7 @@ class AqueousMassSpectrum(SpectrumMomentProduct):
|
|
|
58
59
|
return vals
|
|
59
60
|
|
|
60
61
|
|
|
62
|
+
@register_product()
|
|
61
63
|
class SpecificAqueousMassSpectrum(AqueousMassSpectrum):
|
|
62
64
|
def __init__(self, key, dry_radius_bins_edges, name=None, unit="dimensionless"):
|
|
63
65
|
super().__init__(
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
mole fractions of aqueous-chemistry relevant compounds
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl
|
|
5
|
+
from PySDM.products.impl import MomentProduct, register_product
|
|
6
6
|
|
|
7
7
|
DUMMY_SPECIFIC_GRAVITY = 44
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
@register_product()
|
|
10
11
|
class AqueousMoleFraction(MomentProduct):
|
|
11
12
|
def __init__(self, key, unit="dimensionless", name=None):
|
|
12
13
|
super().__init__(unit=unit, name=name)
|
|
@@ -3,9 +3,10 @@ mole fractions of gaseous compounds relevant for aqueous chemistry
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from PySDM.dynamics.impl.chemistry_utils import GASEOUS_COMPOUNDS
|
|
6
|
-
from PySDM.products.impl
|
|
6
|
+
from PySDM.products.impl import Product, register_product
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
@register_product()
|
|
9
10
|
class GaseousMoleFraction(Product):
|
|
10
11
|
def __init__(self, key, unit="dimensionless", name=None):
|
|
11
12
|
super().__init__(name=name, unit=unit)
|
|
@@ -4,9 +4,10 @@ dry aerosol mass summed over all particles in a grid box per mass of dry air
|
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
|
|
7
|
-
from PySDM.products.impl
|
|
7
|
+
from PySDM.products.impl import MomentProduct, register_product
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
@register_product()
|
|
10
11
|
class TotalDryMassMixingRatio(MomentProduct):
|
|
11
12
|
def __init__(self, density, name=None, unit="kg/kg"):
|
|
12
13
|
super().__init__(unit=unit, name=name)
|
|
@@ -4,9 +4,10 @@ Rates of collision events and their deficit wrt expected values in case mutiplic
|
|
|
4
4
|
or due to unrepresentable breakups from integer overflow
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
from PySDM.products.impl
|
|
7
|
+
from PySDM.products.impl import RateProduct, register_product
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
@register_product()
|
|
10
11
|
class CollisionRateDeficitPerGridbox(RateProduct):
|
|
11
12
|
def __init__(self, name=None, unit="s^-1 kg^-1"):
|
|
12
13
|
super().__init__(
|
|
@@ -14,6 +15,7 @@ class CollisionRateDeficitPerGridbox(RateProduct):
|
|
|
14
15
|
)
|
|
15
16
|
|
|
16
17
|
|
|
18
|
+
@register_product()
|
|
17
19
|
class CollisionRatePerGridbox(RateProduct):
|
|
18
20
|
def __init__(self, name=None, unit="s^-1 kg^-1"):
|
|
19
21
|
super().__init__(
|
|
@@ -21,6 +23,7 @@ class CollisionRatePerGridbox(RateProduct):
|
|
|
21
23
|
)
|
|
22
24
|
|
|
23
25
|
|
|
26
|
+
@register_product()
|
|
24
27
|
class CoalescenceRatePerGridbox(RateProduct):
|
|
25
28
|
def __init__(self, name=None, unit="s^-1 kg^-1"):
|
|
26
29
|
super().__init__(
|
|
@@ -28,6 +31,7 @@ class CoalescenceRatePerGridbox(RateProduct):
|
|
|
28
31
|
)
|
|
29
32
|
|
|
30
33
|
|
|
34
|
+
@register_product()
|
|
31
35
|
class BreakupRatePerGridbox(RateProduct):
|
|
32
36
|
def __init__(self, name=None, unit="s^-1 kg^-1"):
|
|
33
37
|
super().__init__(
|
|
@@ -35,6 +39,7 @@ class BreakupRatePerGridbox(RateProduct):
|
|
|
35
39
|
)
|
|
36
40
|
|
|
37
41
|
|
|
42
|
+
@register_product()
|
|
38
43
|
class BreakupRateDeficitPerGridbox(RateProduct):
|
|
39
44
|
def __init__(self, name=None, unit="s^-1 kg^-1"):
|
|
40
45
|
super().__init__(
|
|
@@ -7,9 +7,10 @@ import numba
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
|
|
9
9
|
from PySDM.backends.impl_numba.conf import JIT_FLAGS
|
|
10
|
-
from PySDM.products.impl
|
|
10
|
+
from PySDM.products.impl import Product, register_product
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
@register_product()
|
|
13
14
|
class CollisionTimestepMean(Product):
|
|
14
15
|
def __init__(self, unit="s", name=None):
|
|
15
16
|
super().__init__(unit=unit, name=name)
|
|
@@ -3,9 +3,10 @@ Minimal collision timestep used when adaptive timestepping is enabled in the
|
|
|
3
3
|
`PySDM.dynamics.collisions.collision.Collision` dynamic (fetching a value resets the counter)
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from PySDM.products.impl
|
|
6
|
+
from PySDM.products.impl import Product, register_product
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
@register_product()
|
|
9
10
|
class CollisionTimestepMin(Product):
|
|
10
11
|
def __init__(self, unit="s", name=None):
|
|
11
12
|
super().__init__(unit=unit, name=name)
|
|
@@ -3,9 +3,10 @@ fraction of particles with critical supersaturation lower than a given supersatu
|
|
|
3
3
|
(passed as keyword argument while calling `get()`)
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from PySDM.products.impl
|
|
6
|
+
from PySDM.products.impl import MomentProduct, register_product
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
@register_product()
|
|
9
10
|
class ActivableFraction(MomentProduct):
|
|
10
11
|
def __init__(self, unit="dimensionless", name=None):
|
|
11
12
|
super().__init__(name=name, unit=unit)
|
|
@@ -4,9 +4,10 @@ minimum and maximum condensation timestep (fetching a value resets the counter)
|
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
|
|
7
|
-
from PySDM.products.impl
|
|
7
|
+
from PySDM.products.impl import Product, register_product
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
@register_product()
|
|
10
11
|
class _CondensationTimestep(Product):
|
|
11
12
|
def __init__(self, name, unit, extremum, reset_value):
|
|
12
13
|
super().__init__(
|
|
@@ -37,11 +38,13 @@ class _CondensationTimestep(Product):
|
|
|
37
38
|
return self.buffer
|
|
38
39
|
|
|
39
40
|
|
|
41
|
+
@register_product()
|
|
40
42
|
class CondensationTimestepMin(_CondensationTimestep):
|
|
41
43
|
def __init__(self, name=None, unit="s"):
|
|
42
44
|
super().__init__(name=name, unit=unit, extremum=np.minimum, reset_value=np.inf)
|
|
43
45
|
|
|
44
46
|
|
|
47
|
+
@register_product()
|
|
45
48
|
class CondensationTimestepMax(_CondensationTimestep):
|
|
46
49
|
def __init__(self, name=None, unit="s"):
|
|
47
50
|
super().__init__(name=name, unit=unit, extremum=np.maximum, reset_value=-np.inf)
|
|
@@ -5,9 +5,10 @@ rates of activation, deactivation and ripening events (take into account substep
|
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
8
|
-
from PySDM.products.impl
|
|
8
|
+
from PySDM.products.impl import Product, register_product
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
@register_product()
|
|
11
12
|
class EventRate(Product):
|
|
12
13
|
def __init__(self, what, name=None, unit=None):
|
|
13
14
|
super().__init__(name=name, unit=unit)
|
|
@@ -42,16 +43,19 @@ class EventRate(Product):
|
|
|
42
43
|
return self.buffer
|
|
43
44
|
|
|
44
45
|
|
|
46
|
+
@register_product()
|
|
45
47
|
class RipeningRate(EventRate):
|
|
46
48
|
def __init__(self, name=None, unit="s^-1 kg^-1"):
|
|
47
49
|
super().__init__("ripening", name=name, unit=unit)
|
|
48
50
|
|
|
49
51
|
|
|
52
|
+
@register_product()
|
|
50
53
|
class ActivatingRate(EventRate):
|
|
51
54
|
def __init__(self, name=None, unit="s^-1 kg^-1"):
|
|
52
55
|
super().__init__("activating", name=name, unit=unit)
|
|
53
56
|
|
|
54
57
|
|
|
58
|
+
@register_product()
|
|
55
59
|
class DeactivatingRate(EventRate):
|
|
56
60
|
def __init__(self, name=None, unit="s^-1 kg^-1"):
|
|
57
61
|
super().__init__("deactivating", name=name, unit=unit)
|
|
@@ -7,9 +7,10 @@ highest supersaturation encountered while solving for condensation/evaporation (
|
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
|
|
10
|
-
from PySDM.products.impl
|
|
10
|
+
from PySDM.products.impl import Product, register_product
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
@register_product()
|
|
13
14
|
class PeakSupersaturation(Product):
|
|
14
15
|
def __init__(self, unit="dimensionless", name=None):
|
|
15
16
|
super().__init__(unit=unit, name=name)
|
|
@@ -4,9 +4,10 @@ average terminal with weighting either by number or volume
|
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
|
|
7
|
-
from PySDM.products.impl
|
|
7
|
+
from PySDM.products.impl import MomentProduct, register_product
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
@register_product()
|
|
10
11
|
class AveragedTerminalVelocity(MomentProduct):
|
|
11
12
|
def __init__(
|
|
12
13
|
self, *, radius_range=(0, np.inf), weighting="volume", unit="m/s", name=None
|
|
@@ -5,9 +5,10 @@ absolute values of Courant number on all edges of a cell)
|
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
8
|
-
from PySDM.products.impl
|
|
8
|
+
from PySDM.products.impl import Product, register_product
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
@register_product()
|
|
11
12
|
class FlowVelocityComponent(Product):
|
|
12
13
|
def __init__(self, component: int, name=None, unit="m/s"):
|
|
13
14
|
super().__init__(unit=unit, name=name)
|
|
@@ -5,9 +5,10 @@ absolute values of Courant number on all edges of a cell)
|
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
8
|
-
from PySDM.products.impl
|
|
8
|
+
from PySDM.products.impl import Product, register_product
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
@register_product()
|
|
11
12
|
class MaxCourantNumber(Product):
|
|
12
13
|
def __init__(self, name=None, unit="dimensionless"):
|
|
13
14
|
super().__init__(unit=unit, name=name)
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
water volume flux derived from sizes of particles crossing bottom domain boundary
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl
|
|
5
|
+
from PySDM.products.impl import Product, register_product
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@register_product()
|
|
8
9
|
class SurfacePrecipitation(Product):
|
|
9
10
|
def __init__(self, name=None, unit="m/s"):
|
|
10
11
|
super().__init__(unit=unit, name=name)
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
number-averaged cooling rate
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from PySDM.products.impl import MomentProduct
|
|
5
|
+
from PySDM.products.impl import MomentProduct, register_product
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@register_product()
|
|
8
9
|
class CoolingRate(MomentProduct):
|
|
9
10
|
def __init__(self, unit="K/s", name=None):
|
|
10
11
|
super().__init__(unit=unit, name=name)
|