PySDM 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.
Files changed (51) hide show
  1. PySDM/__init__.py +3 -0
  2. PySDM/attributes/__init__.py +6 -0
  3. PySDM/attributes/chemistry/acidity.py +2 -1
  4. PySDM/attributes/chemistry/concentration.py +9 -1
  5. PySDM/attributes/chemistry/hydrogen_ion_concentration.py +2 -1
  6. PySDM/attributes/ice/cooling_rate.py +2 -2
  7. PySDM/attributes/ice/freezing_temperature.py +2 -1
  8. PySDM/attributes/ice/immersed_surface_area.py +2 -1
  9. PySDM/attributes/impl/__init__.py +2 -0
  10. PySDM/attributes/impl/attribute_registry.py +62 -0
  11. PySDM/attributes/impl/dummy_attribute.py +0 -14
  12. PySDM/attributes/isotopes/__init__.py +2 -1
  13. PySDM/attributes/isotopes/delta.py +6 -1
  14. PySDM/attributes/isotopes/{moles_light_isotopes.py → moles.py} +10 -1
  15. PySDM/attributes/numerics/__init__.py +1 -1
  16. PySDM/attributes/numerics/cell_id.py +3 -2
  17. PySDM/attributes/numerics/cell_origin.py +2 -1
  18. PySDM/attributes/numerics/position_in_cell.py +2 -1
  19. PySDM/attributes/physics/__init__.py +3 -2
  20. PySDM/attributes/physics/area.py +2 -1
  21. PySDM/attributes/physics/critical_supersaturation.py +2 -1
  22. PySDM/attributes/physics/critical_volume.py +3 -1
  23. PySDM/attributes/physics/dry_radius.py +2 -1
  24. PySDM/attributes/physics/dry_volume.py +21 -2
  25. PySDM/attributes/physics/equilibrium_supersaturation.py +2 -1
  26. PySDM/attributes/physics/heat.py +2 -1
  27. PySDM/attributes/physics/hygroscopicity.py +3 -2
  28. PySDM/attributes/physics/{multiplicities.py → multiplicity.py} +4 -4
  29. PySDM/attributes/physics/radius.py +3 -1
  30. PySDM/attributes/physics/relative_fall_velocity.py +17 -2
  31. PySDM/attributes/physics/reynolds_number.py +6 -1
  32. PySDM/attributes/physics/temperature.py +2 -1
  33. PySDM/attributes/physics/terminal_velocity.py +6 -1
  34. PySDM/attributes/physics/volume.py +2 -1
  35. PySDM/attributes/physics/{mass.py → water_mass.py} +2 -1
  36. PySDM/builder.py +5 -8
  37. PySDM/dynamics/collisions/collision.py +2 -2
  38. PySDM/formulae.py +12 -0
  39. PySDM/impl/camel_case.py +13 -0
  40. PySDM/impl/particle_attributes_factory.py +7 -2
  41. PySDM/physics/__init__.py +1 -0
  42. PySDM/physics/bulk_phase_partitioning/__init__.py +4 -0
  43. PySDM/physics/bulk_phase_partitioning/kaul_et_al_2015.py +27 -0
  44. PySDM/physics/constants_defaults.py +4 -0
  45. PySDM/products/impl/product.py +2 -9
  46. {PySDM-2.65.dist-info → PySDM-2.67.dist-info}/METADATA +5 -1
  47. {PySDM-2.65.dist-info → PySDM-2.67.dist-info}/RECORD +50 -47
  48. PySDM/attributes/impl/mapper.py +0 -134
  49. {PySDM-2.65.dist-info → PySDM-2.67.dist-info}/LICENSE +0 -0
  50. {PySDM-2.65.dist-info → PySDM-2.67.dist-info}/WHEEL +0 -0
  51. {PySDM-2.65.dist-info → PySDM-2.67.dist-info}/top_level.txt +0 -0
PySDM/__init__.py CHANGED
@@ -24,6 +24,9 @@ PySDM test-suite built using [pytest](https://docs.pytest.org/) is located in th
24
24
 
25
25
  from importlib.metadata import PackageNotFoundError, version
26
26
 
27
+ from PySDM.attributes.impl.attribute_registry import register_attribute
28
+
29
+ from . import attributes
27
30
  from . import environments, exporters, products
28
31
  from .builder import Builder
29
32
  from .formulae import Formulae
@@ -1,3 +1,9 @@
1
1
  """
2
2
  Classes representing super-particle attributes
3
3
  """
4
+
5
+ from .physics import *
6
+ from .numerics import *
7
+ from .ice import *
8
+ from .chemistry import *
9
+ from .isotopes import *
@@ -2,11 +2,12 @@
2
2
  pH calculated by finding equilibrium hydrogen ion concentration
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.intensive_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
  from PySDM.backends.impl_numba.methods.chemistry_methods import _conc
7
7
  from PySDM.dynamics.impl.chemistry_utils import AQUEOUS_COMPOUNDS
8
8
 
9
9
 
10
+ @register_attribute(name="pH")
10
11
  class Acidity(DerivedAttribute):
11
12
  def __init__(self, builder):
12
13
  self.conc = {}
@@ -2,7 +2,9 @@
2
2
  concentrations (intensive, derived attributes)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.intensive_attribute import IntensiveAttribute
5
+ from PySDM.attributes.impl import IntensiveAttribute, register_attribute
6
+ from PySDM.attributes.impl.mole_amount import make_mole_amount_factory
7
+ from PySDM.dynamics.impl.chemistry_utils import AQUEOUS_COMPOUNDS
6
8
 
7
9
 
8
10
  class ConcentrationImpl(IntensiveAttribute):
@@ -15,3 +17,9 @@ def make_concentration_factory(what):
15
17
  return ConcentrationImpl(builder, what=what)
16
18
 
17
19
  return _factory
20
+
21
+
22
+ for compound in AQUEOUS_COMPOUNDS:
23
+ register_attribute(name=f"conc_{compound}")(make_concentration_factory(compound))
24
+
25
+ register_attribute(name=f"moles_{compound}")(make_mole_amount_factory(compound))
@@ -2,9 +2,10 @@
2
2
  hydrogen ion concentration derived from pH
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute(name="conc_H")
8
9
  class HydrogenIonConcentration(DerivedAttribute):
9
10
  def __init__(self, builder):
10
11
  self.acidity = builder.get_attribute("pH")
@@ -5,10 +5,10 @@ cooling rate estimated as the difference in current and previous grid-cell
5
5
  """
6
6
 
7
7
  import numpy as np
8
-
9
- from PySDM.attributes.impl import DerivedAttribute
8
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
10
9
 
11
10
 
11
+ @register_attribute()
12
12
  class CoolingRate(DerivedAttribute):
13
13
  def __init__(self, builder):
14
14
  self.cell_id = builder.get_attribute("cell id")
@@ -3,9 +3,10 @@ particle freezing temperature (assigned at initialisation, modified through coll
3
3
  used in singular regime)
4
4
  """
5
5
 
6
- from PySDM.attributes.impl import MaximumAttribute
6
+ from PySDM.attributes.impl import MaximumAttribute, register_attribute
7
7
 
8
8
 
9
+ @register_attribute()
9
10
  class FreezingTemperature(MaximumAttribute):
10
11
  def __init__(self, builder):
11
12
  super().__init__(builder, name="freezing temperature")
@@ -3,9 +3,10 @@ immersed INP surface area (assigned at initialisation, modified through collisio
3
3
  used in time-dependent regime)
4
4
  """
5
5
 
6
- from ..impl import ExtensiveAttribute
6
+ from ..impl import ExtensiveAttribute, register_attribute
7
7
 
8
8
 
9
+ @register_attribute()
9
10
  class ImmersedSurfaceArea(ExtensiveAttribute):
10
11
  def __init__(self, particles_builder):
11
12
  super().__init__(particles_builder, name="immersed surface area")
@@ -9,3 +9,5 @@ from .derived_attribute import DerivedAttribute
9
9
  from .dummy_attribute import DummyAttribute
10
10
  from .extensive_attribute import ExtensiveAttribute
11
11
  from .maximum_attribute import MaximumAttribute
12
+ from .attribute_registry import register_attribute, get_attribute_class
13
+ from .intensive_attribute import IntensiveAttribute
@@ -0,0 +1,62 @@
1
+ """ definition of decorator used to register PySDM attribute classes """
2
+
3
+ import warnings
4
+
5
+ from PySDM.impl.camel_case import camel_case_to_words
6
+
7
+ _ATTRIBUTES_REGISTRY = {}
8
+
9
+
10
+ def _make_dummy_attribute_factory(name):
11
+ # pylint: disable=import-outside-toplevel
12
+ from PySDM.attributes.impl.dummy_attribute import DummyAttribute
13
+
14
+ def _factory(builder):
15
+ return DummyAttribute(builder, name=name)
16
+
17
+ return _factory
18
+
19
+
20
+ def register_attribute(*, name=None, variant=None, dummy_default=False, warn=False):
21
+ if variant is not None:
22
+ assert name is not None
23
+ if dummy_default:
24
+ assert variant is not None
25
+ if warn:
26
+ assert dummy_default
27
+
28
+ def decorator(cls):
29
+ key = name or camel_case_to_words(cls.__name__)
30
+
31
+ if key not in _ATTRIBUTES_REGISTRY:
32
+ _ATTRIBUTES_REGISTRY[key] = {}
33
+ elif cls in _ATTRIBUTES_REGISTRY[key]:
34
+ raise ValueError(f"attribute {key} already exists!")
35
+ _ATTRIBUTES_REGISTRY[key][cls] = variant or (lambda _, __: cls)
36
+ if dummy_default:
37
+ _ATTRIBUTES_REGISTRY[key][_make_dummy_attribute_factory(key)] = (
38
+ lambda _, __: (
39
+ warnings.warn(
40
+ f"dummy implementation used for requested attribute named '{name}'"
41
+ )
42
+ if warn
43
+ else None
44
+ )
45
+ is None
46
+ and not variant(_, __)
47
+ )
48
+ return cls
49
+
50
+ return decorator
51
+
52
+
53
+ def get_attribute_class(name, dynamics=None, formulae=None):
54
+ if name not in _ATTRIBUTES_REGISTRY:
55
+ raise ValueError(
56
+ f"Unknown attribute name: {name};"
57
+ " valid names: {', '.join(sorted(_ATTRIBUTES_REGISTRY))}"
58
+ )
59
+ for cls, func in _ATTRIBUTES_REGISTRY[name].items():
60
+ if func(dynamics, formulae):
61
+ return cls
62
+ assert False
@@ -1,8 +1,6 @@
1
1
  """ logic around `PySDM.attributes.impl.dummy_attribute.DummyAttribute` - parent class
2
2
  for do-nothing attributes """
3
3
 
4
- import warnings
5
-
6
4
  import numpy as np
7
5
 
8
6
  from .attribute import Attribute
@@ -18,15 +16,3 @@ class DummyAttribute(Attribute):
18
16
 
19
17
  def get(self):
20
18
  return self.data
21
-
22
-
23
- def make_dummy_attribute_factory(name, warn=False):
24
- def _factory(builder):
25
- return DummyAttribute(builder, name=name)
26
-
27
- if warn:
28
- warnings.warn(
29
- f"dummy implementation used for requested attribute named '{name}'"
30
- )
31
-
32
- return _factory
@@ -2,4 +2,5 @@
2
2
  isotopic fractionation related attributes
3
3
  """
4
4
 
5
- from .moles_light_isotopes import Moles1H, Moles16O, MolesLightWater
5
+ from .moles import Moles1H, Moles16O, MolesLightWater
6
+ from ..isotopes import delta
@@ -3,7 +3,8 @@ per-droplet isotopic ratio of heavy-to-light isotope number concentrations
3
3
  expressed vs the VSMOW reference in SI units (i.e., not per mille)
4
4
  """
5
5
 
6
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
6
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
7
+ from PySDM.dynamics.isotopic_fractionation import HEAVY_ISOTOPES
7
8
 
8
9
 
9
10
  class DeltaImpl(DerivedAttribute):
@@ -43,3 +44,7 @@ def make_delta_factory(what):
43
44
  return DeltaImpl(builder, heavy_isotope=what)
44
45
 
45
46
  return _factory
47
+
48
+
49
+ for isotope in HEAVY_ISOTOPES:
50
+ register_attribute(name=f"delta_{isotope}")(make_delta_factory(isotope))
@@ -21,7 +21,9 @@ derived attributes providing amounts of light isotopes in water (1H and 16O)
21
21
  moles_16O = .5 * (moles_2H + moles_3H) + moles_H2O
22
22
  """
23
23
 
24
- from PySDM.attributes.impl import DerivedAttribute
24
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
25
+ from PySDM.attributes.impl.mole_amount import make_mole_amount_factory
26
+ from PySDM.dynamics.isotopic_fractionation import HEAVY_ISOTOPES
25
27
 
26
28
 
27
29
  class Helper(DerivedAttribute):
@@ -39,6 +41,7 @@ class Helper(DerivedAttribute):
39
41
  self.data += (mult, "*", attr.data)
40
42
 
41
43
 
44
+ @register_attribute()
42
45
  class MolesLightWater(Helper):
43
46
  def __init__(self, builder):
44
47
  const = builder.formulae.constants
@@ -64,6 +67,7 @@ class MolesLightWater(Helper):
64
67
  )
65
68
 
66
69
 
70
+ @register_attribute(name="moles_1H")
67
71
  class Moles1H(Helper):
68
72
  def __init__(self, builder):
69
73
  super().__init__(
@@ -79,6 +83,7 @@ class Moles1H(Helper):
79
83
  )
80
84
 
81
85
 
86
+ @register_attribute(name="moles_16O")
82
87
  class Moles16O(Helper):
83
88
  def __init__(self, builder):
84
89
  super().__init__(
@@ -90,3 +95,7 @@ class Moles16O(Helper):
90
95
  builder.get_attribute("moles light water"): 1.0,
91
96
  },
92
97
  )
98
+
99
+
100
+ for isotope in HEAVY_ISOTOPES:
101
+ register_attribute(name=f"moles_{isotope}")(make_mole_amount_factory(isotope))
@@ -2,6 +2,6 @@
2
2
  attributes used for tracking cell-particle mapping in multi-dimensional simulations
3
3
  """
4
4
 
5
- from .cell_id import CellID
5
+ from .cell_id import CellId
6
6
  from .cell_origin import CellOrigin
7
7
  from .position_in_cell import PositionInCell
@@ -2,10 +2,11 @@
2
2
  grid cell id attribute
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.cell_attribute import CellAttribute
5
+ from PySDM.attributes.impl import CellAttribute, register_attribute
6
6
 
7
7
 
8
- class CellID(CellAttribute):
8
+ @register_attribute()
9
+ class CellId(CellAttribute):
9
10
  def __init__(self, builder):
10
11
  super().__init__(builder, name="cell id", dtype=int)
11
12
 
@@ -2,9 +2,10 @@
2
2
  grid-cell origin (multi-dimensional)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.cell_attribute import CellAttribute
5
+ from PySDM.attributes.impl import CellAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class CellOrigin(CellAttribute):
9
10
  def __init__(self, builder):
10
11
  super().__init__(
@@ -2,9 +2,10 @@
2
2
  position-within-cell attribute (multi-dimensional, values normalised to one)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.cell_attribute import CellAttribute
5
+ from PySDM.attributes.impl import CellAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class PositionInCell(CellAttribute):
9
10
  def __init__(self, builder):
10
11
  super().__init__(
@@ -9,8 +9,9 @@ from .dry_radius import DryRadius
9
9
  from .dry_volume import DryVolume
10
10
  from .equilibrium_supersaturation import EquilibriumSupersaturation
11
11
  from .heat import Heat
12
- from .mass import WaterMass
13
- from .multiplicities import Multiplicities
12
+ from .hygroscopicity import Kappa, KappaTimesDryVolume
13
+ from .water_mass import WaterMass
14
+ from .multiplicity import Multiplicity
14
15
  from .radius import Radius, SquareRootOfRadius
15
16
  from .relative_fall_velocity import RelativeFallMomentum, RelativeFallVelocity
16
17
  from .temperature import Temperature
@@ -2,9 +2,10 @@
2
2
  particle wet radius (calculated from the volume)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class Area(DerivedAttribute):
9
10
  def __init__(self, builder):
10
11
  self.volume = builder.get_attribute("volume")
@@ -2,9 +2,10 @@
2
2
  kappa-Koehler critical supersaturation calculated for actual environment temperature
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class CriticalSupersaturation(DerivedAttribute):
9
10
  def __init__(self, builder):
10
11
  self.v_crit = builder.get_attribute("critical volume")
@@ -2,9 +2,10 @@
2
2
  critical wet volume (kappa-Koehler, computed using actual temperature)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class CriticalVolume(DerivedAttribute):
9
10
  def __init__(self, builder):
10
11
  self.cell_id = builder.get_attribute("cell id")
@@ -29,6 +30,7 @@ class CriticalVolume(DerivedAttribute):
29
30
  )
30
31
 
31
32
 
33
+ @register_attribute()
32
34
  class WetToCriticalVolumeRatio(DerivedAttribute):
33
35
  def __init__(self, builder):
34
36
  self.critical_volume = builder.get_attribute("critical volume")
@@ -2,9 +2,10 @@
2
2
  particle dry radius computed from dry volume
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class DryRadius(DerivedAttribute):
9
10
  def __init__(self, builder):
10
11
  self.volume_dry = builder.get_attribute("dry volume")
@@ -2,10 +2,16 @@
2
2
  particle dry volume (subject to evolution due to collisions or aqueous chemistry)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
6
- from PySDM.attributes.impl.extensive_attribute import ExtensiveAttribute
5
+ from PySDM.attributes.impl import (
6
+ DerivedAttribute,
7
+ ExtensiveAttribute,
8
+ register_attribute,
9
+ )
7
10
 
8
11
 
12
+ @register_attribute(
13
+ name="dry volume", variant=lambda dynamics, _: "AqueousChemistry" in dynamics
14
+ )
9
15
  class DryVolumeDynamic(DerivedAttribute):
10
16
  def __init__(self, builder):
11
17
  self.particulator = builder.particulator
@@ -20,16 +26,29 @@ class DryVolumeDynamic(DerivedAttribute):
20
26
  self.data *= dynamic.dry_molar_mass / dynamic.dry_rho
21
27
 
22
28
 
29
+ @register_attribute(
30
+ name="dry volume", variant=lambda dynamics, _: "AqueousChemistry" not in dynamics
31
+ )
23
32
  class DryVolume(ExtensiveAttribute):
24
33
  def __init__(self, builder):
25
34
  super().__init__(builder, name="dry volume")
26
35
 
27
36
 
37
+ @register_attribute(
38
+ name="dry volume organic",
39
+ variant=lambda _, formulae: formulae.surface_tension.__name__ != "Constant",
40
+ dummy_default=True,
41
+ )
28
42
  class DryVolumeOrganic(ExtensiveAttribute):
29
43
  def __init__(self, builder):
30
44
  super().__init__(builder, name="dry volume organic")
31
45
 
32
46
 
47
+ @register_attribute(
48
+ name="dry volume organic fraction",
49
+ variant=lambda _, formulae: formulae.surface_tension.__name__ != "Constant",
50
+ dummy_default=True,
51
+ )
33
52
  class OrganicFraction(DerivedAttribute):
34
53
  def __init__(self, builder):
35
54
  self.volume_dry_org = builder.get_attribute("dry volume organic")
@@ -2,9 +2,10 @@
2
2
  kappa-Koehler equilibrium supersaturation calculated for actual environment temperature
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class EquilibriumSupersaturation(DerivedAttribute):
9
10
  def __init__(self, builder):
10
11
  self.r_wet = builder.get_attribute("radius")
@@ -2,9 +2,10 @@
2
2
  particle heat content (test-use only for now, exemplifying intensive/extensive attribute logic)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.extensive_attribute import ExtensiveAttribute
5
+ from PySDM.attributes.impl import ExtensiveAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class Heat(ExtensiveAttribute):
9
10
  def __init__(self, builder):
10
11
  super().__init__(builder, name="heat")
@@ -4,15 +4,16 @@ kappa-Koehler hygroscopicity representation:
4
4
  and the derived `PySDM.attributes.physics.hygroscopicity.Kappa` attribute
5
5
  """
6
6
 
7
- from ..impl.derived_attribute import DerivedAttribute
8
- from ..impl.extensive_attribute import ExtensiveAttribute
7
+ from ..impl import DerivedAttribute, ExtensiveAttribute, register_attribute
9
8
 
10
9
 
10
+ @register_attribute()
11
11
  class KappaTimesDryVolume(ExtensiveAttribute):
12
12
  def __init__(self, builder):
13
13
  super().__init__(builder, name="kappa times dry volume")
14
14
 
15
15
 
16
+ @register_attribute()
16
17
  class Kappa(DerivedAttribute):
17
18
  def __init__(self, builder):
18
19
  self.kappa_times_dry_volume = builder.get_attribute("kappa times dry volume")
@@ -4,13 +4,13 @@ super-particle multiplicity (aka weighting factor) - the number of real-world pa
4
4
  """
5
5
 
6
6
  import numpy as np
7
+ from PySDM.attributes.impl import BaseAttribute, register_attribute
7
8
 
8
- from PySDM.attributes.impl.base_attribute import BaseAttribute
9
9
 
10
-
11
- class Multiplicities(BaseAttribute):
10
+ @register_attribute()
11
+ class Multiplicity(BaseAttribute):
12
12
  TYPE = np.int64
13
13
  MAX_VALUE = np.iinfo(TYPE).max
14
14
 
15
15
  def __init__(self, builder):
16
- super().__init__(builder, name="multiplicity", dtype=Multiplicities.TYPE)
16
+ super().__init__(builder, name="multiplicity", dtype=Multiplicity.TYPE)
@@ -2,9 +2,10 @@
2
2
  particle wet radius (calculated from the volume)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class Radius(DerivedAttribute):
9
10
  def __init__(self, builder):
10
11
  self.volume = builder.get_attribute("volume")
@@ -16,6 +17,7 @@ class Radius(DerivedAttribute):
16
17
  self.data **= 1 / 3
17
18
 
18
19
 
20
+ @register_attribute()
19
21
  class SquareRootOfRadius(DerivedAttribute):
20
22
  def __init__(self, builder):
21
23
  self.radius = builder.get_attribute("radius")
@@ -2,15 +2,30 @@
2
2
  Attributes for tracking droplet velocity
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
6
- from PySDM.attributes.impl.extensive_attribute import ExtensiveAttribute
5
+ from PySDM.attributes.impl import (
6
+ DerivedAttribute,
7
+ ExtensiveAttribute,
8
+ register_attribute,
9
+ )
7
10
 
8
11
 
12
+ @register_attribute(
13
+ name="relative fall momentum",
14
+ variant=lambda dynamics, _: "RelaxedVelocity" in dynamics,
15
+ dummy_default=True,
16
+ warn=True,
17
+ # note: could eventually make an attribute that calculates momentum
18
+ # from terminal velocity instead when no RelaxedVelocity dynamic is present
19
+ )
9
20
  class RelativeFallMomentum(ExtensiveAttribute):
10
21
  def __init__(self, builder):
11
22
  super().__init__(builder, name="relative fall momentum", dtype=float)
12
23
 
13
24
 
25
+ @register_attribute(
26
+ name="relative fall velocity",
27
+ variant=lambda dynamics, _: "RelaxedVelocity" in dynamics,
28
+ )
14
29
  class RelativeFallVelocity(DerivedAttribute):
15
30
  def __init__(self, builder):
16
31
  self.momentum = builder.get_attribute("relative fall momentum")
@@ -2,9 +2,14 @@
2
2
  particle Reynolds number
3
3
  """
4
4
 
5
- from ..impl.derived_attribute import DerivedAttribute
5
+ from ..impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute(
9
+ name="Reynolds number",
10
+ variant=lambda _, formulae: formulae.ventilation.__name__ != "Neglect",
11
+ dummy_default=True,
12
+ )
8
13
  class ReynoldsNumber(DerivedAttribute):
9
14
  def __init__(self, builder):
10
15
  self.radius = builder.get_attribute("radius")
@@ -2,9 +2,10 @@
2
2
  particle temperature (test-use only for now, exemplifying intensive/extensive attribute logic)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.intensive_attribute import IntensiveAttribute
5
+ from PySDM.attributes.impl import IntensiveAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute()
8
9
  class Temperature(IntensiveAttribute):
9
10
  def __init__(self, builder):
10
11
  super().__init__(builder, base="heat", name="temperature")
@@ -2,9 +2,14 @@
2
2
  particle terminal velocity (used for collision probability and particle displacement)
3
3
  """
4
4
 
5
- from PySDM.attributes.impl.derived_attribute import DerivedAttribute
5
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
6
6
 
7
7
 
8
+ @register_attribute(
9
+ name="relative fall velocity",
10
+ variant=lambda dynamics, _: "RelaxedVelocity" not in dynamics,
11
+ )
12
+ @register_attribute()
8
13
  class TerminalVelocity(DerivedAttribute):
9
14
  def __init__(self, builder):
10
15
  self.radius = builder.get_attribute("radius")
@@ -4,9 +4,10 @@ in simulation involving mixed-phase clouds, positive values correspond to
4
4
  liquid water and negative values to ice
5
5
  """
6
6
 
7
- from PySDM.attributes.impl import DerivedAttribute
7
+ from PySDM.attributes.impl import DerivedAttribute, register_attribute
8
8
 
9
9
 
10
+ @register_attribute()
10
11
  class Volume(DerivedAttribute):
11
12
  def __init__(self, builder):
12
13
  self.water_mass = builder.get_attribute("water mass")
@@ -4,9 +4,10 @@ in simulation involving mixed-phase clouds, positive values correspond to
4
4
  liquid water and negative values to ice
5
5
  """
6
6
 
7
- from PySDM.attributes.impl import ExtensiveAttribute
7
+ from PySDM.attributes.impl import ExtensiveAttribute, register_attribute
8
8
 
9
9
 
10
+ @register_attribute()
10
11
  class WaterMass(ExtensiveAttribute):
11
12
  def __init__(self, builder):
12
13
  super().__init__(builder, name="water mass")
PySDM/builder.py CHANGED
@@ -7,10 +7,7 @@ import warnings
7
7
 
8
8
  import numpy as np
9
9
 
10
- from PySDM.attributes.impl.mapper import get_class as attr_class
11
- from PySDM.attributes.numerics.cell_id import CellID
12
- from PySDM.attributes.physics import WaterMass
13
- from PySDM.attributes.physics.multiplicities import Multiplicities
10
+ from PySDM.attributes.impl.attribute_registry import get_attribute_class
14
11
  from PySDM.impl.particle_attributes_factory import ParticleAttributesFactory
15
12
  from PySDM.impl.wall_timer import WallTimer
16
13
  from PySDM.initialisation.discretise_multiplicities import ( # TODO #324
@@ -33,9 +30,9 @@ class Builder:
33
30
  self.formulae = backend.formulae
34
31
  self.particulator = Particulator(n_sd, backend)
35
32
  self.req_attr = {
36
- "multiplicity": Multiplicities(self),
37
- "water mass": WaterMass(self),
38
- "cell id": CellID(self),
33
+ "multiplicity": get_attribute_class("multiplicity")(self),
34
+ "water mass": get_attribute_class("water mass")(self),
35
+ "cell id": get_attribute_class("cell id")(self),
39
36
  }
40
37
  self.aerosol_radius_threshold = 0
41
38
  self.condensation_params = None
@@ -83,7 +80,7 @@ class Builder:
83
80
 
84
81
  def request_attribute(self, attribute, variant=None):
85
82
  if attribute not in self.req_attr:
86
- self.req_attr[attribute] = attr_class(
83
+ self.req_attr[attribute] = get_attribute_class(
87
84
  attribute, self.particulator.dynamics, self.formulae
88
85
  )(self)
89
86
  if variant is not None:
@@ -14,7 +14,7 @@ from collections import namedtuple
14
14
 
15
15
  import numpy as np
16
16
 
17
- from PySDM.attributes.physics.multiplicities import Multiplicities
17
+ from PySDM.attributes.impl import get_attribute_class
18
18
  from PySDM.dynamics.collisions.breakup_efficiencies import ConstEb
19
19
  from PySDM.dynamics.collisions.breakup_fragmentations import AlwaysN
20
20
  from PySDM.dynamics.collisions.coalescence_efficiencies import ConstEc
@@ -32,7 +32,7 @@ DEFAULTS = namedtuple(
32
32
  dt_coal_range=(0.1 * si.second, 100.0 * si.second),
33
33
  adaptive=True,
34
34
  substeps=1,
35
- max_multiplicity=Multiplicities.MAX_VALUE // int(2e5),
35
+ max_multiplicity=get_attribute_class("multiplicity").MAX_VALUE // int(2e5),
36
36
  )
37
37
 
38
38
 
PySDM/formulae.py CHANGED
@@ -55,6 +55,7 @@ class Formulae: # pylint: disable=too-few-public-methods,too-many-instance-attr
55
55
  particle_shape_and_density: str = "LiquidSpheres",
56
56
  terminal_velocity: str = "GunnKinzer1949",
57
57
  air_dynamic_viscosity: str = "ZografosEtAl1987",
58
+ bulk_phase_partitioning: str = "Null",
58
59
  handle_all_breakups: bool = False,
59
60
  ):
60
61
  # initialisation of the fields below is just to silence pylint and to enable code hints
@@ -86,6 +87,7 @@ class Formulae: # pylint: disable=too-few-public-methods,too-many-instance-attr
86
87
  self.particle_shape_and_density = particle_shape_and_density
87
88
  self.air_dynamic_viscosity = air_dynamic_viscosity
88
89
  self.terminal_velocity = terminal_velocity
90
+ self.bulk_phase_partitioning = bulk_phase_partitioning
89
91
 
90
92
  self._components = tuple(
91
93
  i
@@ -101,8 +103,18 @@ class Formulae: # pylint: disable=too-few-public-methods,too-many-instance-attr
101
103
  getattr(defaults, k), (numbers.Number, pint.Quantity, pint.Unit)
102
104
  )
103
105
  }
106
+
107
+ physics.constants_defaults.compute_derived_values(constants_defaults)
108
+ if constants is not None:
109
+ for key in constants:
110
+ if key not in constants_defaults:
111
+ raise ValueError(
112
+ f"constant override provided for unknown key: {key}"
113
+ )
114
+
104
115
  constants_defaults = {**constants_defaults, **(constants or {})}
105
116
  physics.constants_defaults.compute_derived_values(constants_defaults)
117
+
106
118
  constants = namedtuple("Constants", tuple(constants_defaults.keys()))(
107
119
  **constants_defaults
108
120
  )
@@ -0,0 +1,13 @@
1
+ """
2
+ utility routine converting "CamelCase" strings into space-separated ones (i.e., "camel case")
3
+ """
4
+
5
+ import re
6
+
7
+ CAMEL_CASE_PATTERN = re.compile(r"[A-Z]?[a-z]+|[A-Z]+(?![^A-Z])")
8
+
9
+
10
+ def camel_case_to_words(string: str):
11
+ words = CAMEL_CASE_PATTERN.findall(string)
12
+ words = (word if word.isupper() else word.lower() for word in words)
13
+ return " ".join(words)
@@ -11,8 +11,8 @@ from PySDM.attributes.impl import (
11
11
  ExtensiveAttribute,
12
12
  MaximumAttribute,
13
13
  )
14
- from PySDM.attributes.physics.multiplicities import Multiplicities
15
14
  from PySDM.impl.particle_attributes import ParticleAttributes
15
+ from PySDM.attributes.impl import get_attribute_class
16
16
 
17
17
 
18
18
  class ParticleAttributesFactory:
@@ -30,7 +30,12 @@ class ParticleAttributesFactory:
30
30
  maximum_attr.append(attr_name)
31
31
  elif not isinstance(
32
32
  req_attr[attr_name],
33
- (DerivedAttribute, Multiplicities, CellAttribute, DummyAttribute),
33
+ (
34
+ DerivedAttribute,
35
+ get_attribute_class("multiplicity"),
36
+ CellAttribute,
37
+ DummyAttribute,
38
+ ),
34
39
  ):
35
40
  raise AssertionError()
36
41
 
PySDM/physics/__init__.py CHANGED
@@ -45,5 +45,6 @@ from . import (
45
45
  ventilation,
46
46
  air_dynamic_viscosity,
47
47
  terminal_velocity,
48
+ bulk_phase_partitioning,
48
49
  )
49
50
  from .constants import convert_to, in_unit, si
@@ -0,0 +1,4 @@
1
+ """ phase partitioning formulae for bulk description of cloud water """
2
+
3
+ from PySDM.impl.null_physics_class import Null
4
+ from .kaul_et_al_2015 import KaulEtAl2015
@@ -0,0 +1,27 @@
1
+ """
2
+ Eq. 1 in [Kaul et al. 2015](https://doi.org/10.1175/MWR-D-14-00319.1)
3
+ """
4
+
5
+ import numpy as np
6
+
7
+
8
+ class KaulEtAl2015: # pylint: disable=too-few-public-methods
9
+ def __init__(self, const):
10
+ assert np.isfinite(const.bulk_phase_partitioning_exponent)
11
+
12
+ @staticmethod
13
+ def liquid_fraction(const, T):
14
+ return np.minimum(
15
+ 1,
16
+ np.power(
17
+ np.maximum(
18
+ 0,
19
+ (T - const.bulk_phase_partitioning_T_cold)
20
+ / (
21
+ const.bulk_phase_partitioning_T_warm
22
+ - const.bulk_phase_partitioning_T_cold
23
+ ),
24
+ ),
25
+ const.bulk_phase_partitioning_exponent,
26
+ ),
27
+ )
@@ -424,3 +424,7 @@ B80W_G1 = 17.67 * si.dimensionless
424
424
  B80W_G2 = 243.5 * si.K
425
425
 
426
426
  one_kelvin = 1 * si.K
427
+
428
+ bulk_phase_partitioning_T_cold = 235 * si.K
429
+ bulk_phase_partitioning_T_warm = 273 * si.K
430
+ bulk_phase_partitioning_exponent = np.nan
@@ -3,21 +3,20 @@ logic around the `PySDM.products.impl.product.Product` - parent class for all pr
3
3
  """
4
4
 
5
5
  import inspect
6
- import re
7
6
  from abc import abstractmethod
8
7
  from typing import Optional
9
8
 
10
9
  import pint
11
10
 
12
11
  from PySDM.physics.constants import PPB, PPM, PPT
12
+ from PySDM.impl.camel_case import camel_case_to_words
13
13
 
14
14
  _UNIT_REGISTRY = pint.UnitRegistry()
15
- _CAMEL_CASE_PATTERN = re.compile(r"[A-Z]?[a-z]+|[A-Z]+(?![^A-Z])")
16
15
 
17
16
 
18
17
  class Product:
19
18
  def __init__(self, *, unit: str, name: Optional[str] = None):
20
- self.name = name or self._camel_case_to_words(self.__class__.__name__)
19
+ self.name = name or camel_case_to_words(self.__class__.__name__)
21
20
 
22
21
  self._unit = self._parse_unit(unit)
23
22
  self.unit_magnitude_in_base_units = self._unit.to_base_units().magnitude
@@ -51,12 +50,6 @@ class Product:
51
50
  return PPT * _UNIT_REGISTRY.dimensionless
52
51
  return _UNIT_REGISTRY.parse_expression(unit)
53
52
 
54
- @staticmethod
55
- def _camel_case_to_words(string: str):
56
- words = _CAMEL_CASE_PATTERN.findall(string)
57
- words = (word if word.isupper() else word.lower() for word in words)
58
- return " ".join(words)
59
-
60
53
  def __check_unit(self):
61
54
  init = inspect.signature(self.__init__)
62
55
  if "unit" not in init.parameters:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySDM
3
- Version: 2.65
3
+ Version: 2.67
4
4
  Summary: Pythonic particle-based (super-droplet) warm-rain/aqueous-chemistry cloud microphysics package with box, parcel & 1D/2D prescribed-flow examples in Python, Julia and Matlab
5
5
  Home-page: https://github.com/open-atmos/PySDM
6
6
  Author: https://github.com/open-atmos/PySDM/graphs/contributors
@@ -878,6 +878,8 @@ licence: [GPL v3](https://www.gnu.org/licenses/gpl-3.0.html)
878
878
  https://github.com/emmacware/droplets.jl
879
879
  - LacmoPy (Python/Numba)
880
880
  https://github.com/JanKBohrer/LacmoPy/blob/master/collision/all_or_nothing.py
881
+ - McSnow (FORTRAN):
882
+ https://gitlab.dkrz.de/mcsnow/mcsnow/-/blob/master/src/mo_coll.f90
881
883
 
882
884
  ### non-SDM probabilistic particle-based coagulation solvers
883
885
 
@@ -893,5 +895,7 @@ licence: [GPL v3](https://www.gnu.org/licenses/gpl-3.0.html)
893
895
  ### non-Python cloud microphysics open-source software
894
896
 
895
897
  - CloudMicrophysics.jl: https://github.com/CliMA/CloudMicrophysics.jl
898
+ - McSnow: https://gitlab.dkrz.de/mcsnow/mcsnow
899
+
896
900
 
897
901
 
@@ -1,51 +1,51 @@
1
- PySDM/__init__.py,sha256=-jFr7iN9cgzKvlcRdCA3NLAxMc_1NHyQR4uk0ZfF_A0,1640
2
- PySDM/builder.py,sha256=3xwlnz2HijK4FHYm1YlkxPE02udj-WbZULZcq-iXaSk,5682
3
- PySDM/formulae.py,sha256=nL3boyk04lkpwEG7ots91snh0OMrvFzr5MupdUhfiyI,13293
1
+ PySDM/__init__.py,sha256=nrBhoz8kmvowBpYj_ijAM85wIqlcCxZg5Y-I1LLpeNo,1738
2
+ PySDM/builder.py,sha256=ODgUYLavdZokZwzimgd93YrBk6xbRv8TPpjlqn-kiW4,5601
3
+ PySDM/formulae.py,sha256=aYMFG1R4JJ9rqmtrFtUfAXKHWQX_oZC-GPeYsJMi5js,13739
4
4
  PySDM/particulator.py,sha256=pF43WTzuen3UmWZKSbU2BPnPF3WWwjYpeu-zDxQnD0Q,16789
5
- PySDM/attributes/__init__.py,sha256=wR9DAJL3beWY_9IyDsbSjLV9BqJrOXdNScVCYy-Qtw8,55
5
+ PySDM/attributes/__init__.py,sha256=cJVc2aGo7ZID8fTo_AcxSi0XhnxML-r9yc4L4RYJaE4,171
6
6
  PySDM/attributes/chemistry/__init__.py,sha256=sv9kFUXgcZjbjmrQKK8sgdgqM05MPxAw73Euj0O3n40,223
7
- PySDM/attributes/chemistry/acidity.py,sha256=kMF23ykBWBPv9d1p4EZLv8PYqTCM-NmIwbtv2P4yvRY,1611
8
- PySDM/attributes/chemistry/concentration.py,sha256=8uMygl5iGTTYIe46gEyoFKX0ezwJOjBIq8VeMUKSqfw,436
9
- PySDM/attributes/chemistry/hydrogen_ion_concentration.py,sha256=kCgX8Q7nMEs9mzjwUBYpYd5eSOyAoQLuaveJbw6Z-io,438
7
+ PySDM/attributes/chemistry/acidity.py,sha256=XGRhQEi7XH9WtBmwzsaMphzuq3ZYGhqClo4PY1d79bA,1642
8
+ PySDM/attributes/chemistry/concentration.py,sha256=SePyTjF_Xz7g8BuoxNauUGyrqSm28AJtY-ZnekiwJQc,782
9
+ PySDM/attributes/chemistry/hydrogen_ion_concentration.py,sha256=VUyZANuDIQ8YiF7r-fGh_3pLgtHULE3GpToa5lhE78E,475
10
10
  PySDM/attributes/ice/__init__.py,sha256=H4geuX7GEkaLfMp5UqBUq7kYOQzziR4AIZ8e77NIhrI,222
11
- PySDM/attributes/ice/cooling_rate.py,sha256=Eu08jZIiH1Vs-6t5n947zcRvDsn6S5wsFNwDJKotxWQ,1129
12
- PySDM/attributes/ice/freezing_temperature.py,sha256=Ua1Ty1UzNQi2GQGlrIkC0iISnpYny8_J0YXGjOMnHk0,322
13
- PySDM/attributes/ice/immersed_surface_area.py,sha256=UGY4j8Ovv0cj1okQ37Hw_UHDo_6Oo4irZgZngcCZ-Lc,334
14
- PySDM/attributes/impl/__init__.py,sha256=M9rGcCuktDeL74UCnOkzoqOVIAXcnuNSV1ERfzPJJZI,396
11
+ PySDM/attributes/ice/cooling_rate.py,sha256=-m1N_H9b1RRNL2DHDEkapoxLE3XMvc4GjYZyVnBySD4,1170
12
+ PySDM/attributes/ice/freezing_temperature.py,sha256=20fvlNLNLMWRMJGuawflan-WU5fVBfTCJNHVJKQaCSc,364
13
+ PySDM/attributes/ice/immersed_surface_area.py,sha256=YGkvzX0vAMglTt2lowueDvmtCLtueTo1DcL7ukOwKWI,376
14
+ PySDM/attributes/impl/__init__.py,sha256=hcyb5nTVgRkQX91EIj6_6P2sUop1NtB8_PnFCTCoW20,520
15
15
  PySDM/attributes/impl/attribute.py,sha256=msvilCTfqsBarBwCjTf2p40RJpei7TXwVhy-yjMyiwE,1156
16
+ PySDM/attributes/impl/attribute_registry.py,sha256=8WH6edvEKsDOzUXPuKxqqX_-1EeY2Jz9CWNHQLXzy_0,1898
16
17
  PySDM/attributes/impl/base_attribute.py,sha256=dS_XaDgNVBGVByVRdZeclN7rzoV8EKXGjuV6re6qFf4,470
17
18
  PySDM/attributes/impl/cell_attribute.py,sha256=F_j_OKo7stf-xHLJXh24Vk9HsKGyflKJgXF97rrRAog,220
18
19
  PySDM/attributes/impl/derived_attribute.py,sha256=q1HKQwxbyireBG-IgglsTAO7jOVuN821SfkcnsrKaQU,844
19
- PySDM/attributes/impl/dummy_attribute.py,sha256=wBMIqGwyph4AaxOyRfVRmcSkduDeeWOmHMaQ1QvyiIk,716
20
+ PySDM/attributes/impl/dummy_attribute.py,sha256=026hfEoX8vvpM_C_hi2Zj3t1CA3L23FkPU8gBFV3T_4,420
20
21
  PySDM/attributes/impl/extensive_attribute.py,sha256=3wg-VeTriKP1Kn0LJwyUjZkWvdDCYZaYp1VwYpANWi8,224
21
22
  PySDM/attributes/impl/intensive_attribute.py,sha256=erkLMcsu7fFW3bmus15jtrcxO9ubaMpMo4zAQqWHnYY,548
22
- PySDM/attributes/impl/mapper.py,sha256=ZQv1_NbeKs9xo24bfDWMLIolCeW4BYQv6VSRyPdGbc4,5199
23
23
  PySDM/attributes/impl/maximum_attribute.py,sha256=wPk5AE0L9DXVYiiQmDUT7ZxzIyH9qv_e2xjyBLuH8kc,391
24
24
  PySDM/attributes/impl/mole_amount.py,sha256=65akHKk-XUuXBD-vNxO6sXP2edv_B0RKvIkGnipyf0g,410
25
- PySDM/attributes/isotopes/__init__.py,sha256=6nroi2IFaLkkYCqQ9hBmhKM4Imz3IdPkIFQWO7grB5U,120
26
- PySDM/attributes/isotopes/delta.py,sha256=mhhXLWxJ8XvP42tKeisIra8uWo2yg6_PTVITpXcSID4,1388
27
- PySDM/attributes/isotopes/moles_light_isotopes.py,sha256=7ypPyMGdjT_InQCmyWm2BbSippFEa4ZyQzKfiD3KQFs,3245
28
- PySDM/attributes/numerics/__init__.py,sha256=v8phYk_r4_8QSq5cJOKrgbqbXg-Omz0hbOnhtV7i308,202
29
- PySDM/attributes/numerics/cell_id.py,sha256=iRdnxu7kPzouYpXPbkqyYHdkCgNyCvGmtDHULFgOxhU,261
30
- PySDM/attributes/numerics/cell_origin.py,sha256=XLxY-0EVthfBsPqowHspw9mb9I_c0Qee2iGSOtrx9Pc,352
31
- PySDM/attributes/numerics/position_in_cell.py,sha256=Pcqb4fNidFeA6vZks1Rer0drvhfI88DHeUjUoYMkoYM,378
32
- PySDM/attributes/physics/__init__.py,sha256=j0dCO8FmjVfiI_6skaznu1za6RY7DHHWOLPTMDZLAWE,740
33
- PySDM/attributes/physics/area.py,sha256=cIn7XS0nfAtEX4sEz8Y-G9xEZcYl7YWsJzPzwOgaaFw,550
34
- PySDM/attributes/physics/critical_supersaturation.py,sha256=5_vkKrezzmlA9z40GEEyb_QgrVmflDvSXgOXXrU4TMo,1338
35
- PySDM/attributes/physics/critical_volume.py,sha256=vj-Glo-qo1fYYJAKQJz3Ay75BTXyfI5uIvD3dyoGgGA,1582
36
- PySDM/attributes/physics/dry_radius.py,sha256=lj1bB05R6GqsUZNI_jq_Nvp1-NcwMXMGMYn4HrhCn_I,517
37
- PySDM/attributes/physics/dry_volume.py,sha256=4_zZC-42-_jNga5DSaGtMI8Ul6dB4OKIsnoQuf2Ygwo,1496
38
- PySDM/attributes/physics/equilibrium_supersaturation.py,sha256=i3_0s9ypsfOPF6XBu8V4R72V8-JeaWDKcHBjZr8XNVc,1387
39
- PySDM/attributes/physics/heat.py,sha256=TEkRWrTFZ401HMeoGGvQZ8YFnPRKRdxRSk8SKdVjmnY,292
40
- PySDM/attributes/physics/hygroscopicity.py,sha256=-Clpc4T6K_ebDO9FzQOXzvAS_pJXeq8Rhk_jJkfRlwc,923
41
- PySDM/attributes/physics/mass.py,sha256=AhnlQeL19aMHrD1ExpyqFUcdl2uCi02NV1kRWsSaNDc,350
42
- PySDM/attributes/physics/multiplicities.py,sha256=Udrvp4HML_JVLq_tyS0tERi2vCrjlG1u8X4wIHqva1Q,449
43
- PySDM/attributes/physics/radius.py,sha256=qrE_DNxlyrcxae3yOjVYqZmRIjRtS5X8HSVMx296lv0,867
44
- PySDM/attributes/physics/relative_fall_velocity.py,sha256=fMkeYD9-B76jiHgcHvRW2vRABlV9vtm-dXBEfWblSmU,824
45
- PySDM/attributes/physics/reynolds_number.py,sha256=GokTVa079zdHWw-r4_CDY1xLdMIOlLF_kxjiZfqn8Ks,928
46
- PySDM/attributes/physics/temperature.py,sha256=sK9PaFRQHYvVs38E33ZWodx03gxKnS1YcMpBfcyzoCA,318
47
- PySDM/attributes/physics/terminal_velocity.py,sha256=1z5m7l-lsFcwNUqmh3TDpJBxHUr8LdzeO2DGc53Rd1g,619
48
- PySDM/attributes/physics/volume.py,sha256=Mj6VM1rzBkxRrLdxWD_AeYrbrhZ7o7rXDwv4CuqWLOI,545
25
+ PySDM/attributes/isotopes/__init__.py,sha256=ESHKhFf05g3KAEP7SoIJEzRWRJ8ANmMv3eDHXCPP87o,134
26
+ PySDM/attributes/isotopes/delta.py,sha256=kxaVk_uG1udsxqihTyC8Y4QbXyITGQH1q1arZ-fN0jQ,1565
27
+ PySDM/attributes/isotopes/moles.py,sha256=gOb8CURFyB7IaiDaXjE1uQWj95-deRbsMoSPJkvAOtY,3614
28
+ PySDM/attributes/numerics/__init__.py,sha256=xXldqBfs0Et2-Wd8Y6K_tPUouhzVhA8CxiIB8B4Cp4c,202
29
+ PySDM/attributes/numerics/cell_id.py,sha256=VYXV_kOtr3e6rD1hAqFdp6Us7EL0R3ZyALie1lb5YHc,288
30
+ PySDM/attributes/numerics/cell_origin.py,sha256=GvFiO23nq5yka1PLIgIUWSVLNjrIT_5jEIeilvnFfdg,379
31
+ PySDM/attributes/numerics/position_in_cell.py,sha256=Iw9pwNU--FIfXXk24T1SBNpRYTTh2uuay54p1Gtn1dI,405
32
+ PySDM/attributes/physics/__init__.py,sha256=jjZGtEd0u8KwdOcDU-noi55t4lTt18bdH63x9lNB27U,797
33
+ PySDM/attributes/physics/area.py,sha256=vB-TkdPmRNk6QPYJqnD7VHhejzCcOGOJlCv-KZa095M,574
34
+ PySDM/attributes/physics/critical_supersaturation.py,sha256=A70SJ7ceIW9yJFsQQGm7uYiOj6jMjP5Q43BTI84vgXo,1362
35
+ PySDM/attributes/physics/critical_volume.py,sha256=SqYcZVDUUmuX3Uvaojkqud1yh1rwGpdmqZdDxhQPSM0,1628
36
+ PySDM/attributes/physics/dry_radius.py,sha256=V9WwthSRDR427bnBacjV6YQNyl87ba7JE9Fn0Rfwkn4,541
37
+ PySDM/attributes/physics/dry_volume.py,sha256=8eYDTgAI1M01DYkaKguHGyq4sQh5wTNLWkqZy-Xk_dU,2003
38
+ PySDM/attributes/physics/equilibrium_supersaturation.py,sha256=cuRY78P4OdMfdyvIn3ZyfLWeFG869ceRGTU5afjbbyk,1411
39
+ PySDM/attributes/physics/heat.py,sha256=IXLCFpyBe7teeeaJewvpJ8A_tZXfUNYVKqKayZBQSHo,314
40
+ PySDM/attributes/physics/hygroscopicity.py,sha256=H-dS8ZMNkfOuDVDK8KsiXYF24OvCEbxCeowBBqAH0RE,931
41
+ PySDM/attributes/physics/multiplicity.py,sha256=jrbym-mT06D8vQBF_-UtrIMnF5v_biUacZxL5ZoGcCs,471
42
+ PySDM/attributes/physics/radius.py,sha256=9M_hkWNKeuIodY3XnkOjwmLBpMiGrKnnM8rJAzz8HPY,913
43
+ PySDM/attributes/physics/relative_fall_velocity.py,sha256=XVyMPQsPwQxuo-l13cYszq9kx4DIKy9BWfGHy1yXIjg,1229
44
+ PySDM/attributes/physics/reynolds_number.py,sha256=0kMcLE2yrhNKTDwoBfKSs55usMHMlQpYbSEKClkZvE8,1081
45
+ PySDM/attributes/physics/temperature.py,sha256=DrHDxMYCQPYRefp_zqJ3971Er8yY0zkA5kkzJPNnzZU,340
46
+ PySDM/attributes/physics/terminal_velocity.py,sha256=zu0U0g-qGcx5HJqhTFJHuLyp7lmnsPkHT1Qp3rFJXtE,768
47
+ PySDM/attributes/physics/volume.py,sha256=25eG5HEXeRMJV4iKywtZ0JTU5PiF2Ibp3X-WHC6BB6c,587
48
+ PySDM/attributes/physics/water_mass.py,sha256=fzmCjIWLWgghWy_Pa4KZoCd2XgdUv3tb-qB9FFmCUF8,392
49
49
  PySDM/backends/__init__.py,sha256=6dPU5Y30rDovvkaTehryG9gA-tJk5sEOrmlxpQAP4Ek,2235
50
50
  PySDM/backends/numba.py,sha256=bBtZPmlfoyV1vT2_yfgW_h39IJMC_tOqKlr5nFMKBkw,2708
51
51
  PySDM/backends/thrust_rtc.py,sha256=5T2joHmLA5y-HPbLfw4m3wf9-BFuk-1YsmWJj62LPNU,2643
@@ -113,7 +113,7 @@ PySDM/dynamics/freezing.py,sha256=ZWVwC_wmaTGmlVSkiehCImG2LAlDG4N_EDMh5w63jKU,36
113
113
  PySDM/dynamics/isotopic_fractionation.py,sha256=zssQWKMEMkK9yFlOcp0ui19BRW6xG8i_4tgkSCS7ZDY,1201
114
114
  PySDM/dynamics/relaxed_velocity.py,sha256=Zd5Cjy5qvGPcC_8U9bOc5UDdzGr306i7FwcdtkkICoc,3145
115
115
  PySDM/dynamics/collisions/__init__.py,sha256=gutS6RlEXSp9S7z6zgUKq-K4hXLrHXTJFQkYCi2KibY,554
116
- PySDM/dynamics/collisions/collision.py,sha256=Lo2CVWD_L9ZhkQcH40W526xLG5TbLdR00s3HirHLo00,13242
116
+ PySDM/dynamics/collisions/collision.py,sha256=3lJS1dtEIHc_TDrVVqHlm7Ih36epNO-2ku3QIyuwZms,13250
117
117
  PySDM/dynamics/collisions/breakup_efficiencies/__init__.py,sha256=PWWgvr3wLjlOKjiK_S9-Bd9bcGFIIwMlbwJtMriDc1Q,59
118
118
  PySDM/dynamics/collisions/breakup_efficiencies/constEb.py,sha256=vkLQ8DB-q-4aruHalaaWC11y-0e6W4RZXVRRt57wMfo,313
119
119
  PySDM/dynamics/collisions/breakup_fragmentations/__init__.py,sha256=tgXZhQ-UQiCd0i6A1rSxm7NSMumB9YoCCu55d7SqoaU,329
@@ -169,10 +169,11 @@ PySDM/exporters/vtk_exporter.py,sha256=aG57X93RBHRxXA9wxTboXyuh--LL9lJAQIAtj1xNM
169
169
  PySDM/exporters/vtk_exporter_1d.py,sha256=UlLYO-QmQVV8XZ8-ucgt-FB89YsQ9j-YaaTEdHGYmWA,2180
170
170
  PySDM/impl/__init__.py,sha256=bDVvuLEQ93BFfusiXsh_dC8PKYw6nPDi4HP3NFp1QPU,53
171
171
  PySDM/impl/arakawa_c.py,sha256=ACzN8k4lVapTP5ra2r3foUO-olBJf5ZcFTpH5I4SCEE,331
172
+ PySDM/impl/camel_case.py,sha256=2ivX9gjsLDPwYvGWL0omPqSBp9LXyg-rPLC_pJ62pTU,367
172
173
  PySDM/impl/mesh.py,sha256=h64y8vKLR2sqKcs7BMSrtlz2S6JIq15KJMW4KQfKynI,2528
173
174
  PySDM/impl/null_physics_class.py,sha256=-AEqs_yrPyDkgOlkXtG4nMtIeyp6tShiyVNvQqQexkI,128
174
175
  PySDM/impl/particle_attributes.py,sha256=XgBWf8JgpEmBiqhzLsoaRDklUVjFheIMx8pvfePA1eA,3445
175
- PySDM/impl/particle_attributes_factory.py,sha256=XArDbeP0Q92kBNZdIta29bSMcBFCBYH6Nfk1wOVnva0,4580
176
+ PySDM/impl/particle_attributes_factory.py,sha256=ZKkkbkFIoEcw7Yj7axlmrsqhy-_Hb9TusMnu1XtuH3w,4687
176
177
  PySDM/impl/wall_timer.py,sha256=cDApBqoTS_kUfnBzzQtP-XTJxBMBmyqv4m9mODaA2CE,465
177
178
  PySDM/initialisation/__init__.py,sha256=Li4IboyzZBIwoLbNKceZq9nDUgJpShQr8QyibDZM_5Q,351
178
179
  PySDM/initialisation/discretise_multiplicities.py,sha256=D_8EsoXwSLsgIGUyOuLDDVuaQpZAQbtEDtJfcXK90Bw,779
@@ -193,13 +194,15 @@ PySDM/initialisation/spectra/gaussian.py,sha256=SmTZYyrBJaTAKhZzjuKfiXXwL3jiPlDW
193
194
  PySDM/initialisation/spectra/lognormal.py,sha256=pa1z5zWsAHlQFZ9CRse0wvMoc91S8fSRosXtKQTuVkY,1169
194
195
  PySDM/initialisation/spectra/sum.py,sha256=SaxepweOdCozWlUkxCfr6Udo-KjGKWXgrdS0ahyUNfA,1315
195
196
  PySDM/initialisation/spectra/top_hat.py,sha256=xmBr_IrctsnguPNgX-jR7JnQnQl1qzIaEyz75fvAJho,563
196
- PySDM/physics/__init__.py,sha256=rFZDMxa1uX04sEmaCBwUL176SASR0lt48I2DfoxySuA,1861
197
+ PySDM/physics/__init__.py,sha256=cHgdLJl631R3bkiqq-t_FNZXAq6jdLor34uLr5LESAY,1890
197
198
  PySDM/physics/constants.py,sha256=ETbcdk-nhrVtjHidTREjHiUkAemNBNrSBWED3XjCXb8,1333
198
- PySDM/physics/constants_defaults.py,sha256=hn5InJEt3YuDKMFuQRdwYf4LcxB5iFKBwrmfGpg7W-U,14109
199
+ PySDM/physics/constants_defaults.py,sha256=o3dcweOvCcI84tpvIWcy3cSWsqFfYH83tM6SKe_y_JM,14240
199
200
  PySDM/physics/dimensional_analysis.py,sha256=6_myMgc_eKhcbuNr7RqiQGj0OKNQ1TNqEMRb6Kzsqj0,688
200
201
  PySDM/physics/trivia.py,sha256=gAF0fUKTGFZbt95D2G_MwnDfAgVymGDWMawncKAMOG0,4048
201
202
  PySDM/physics/air_dynamic_viscosity/__init__.py,sha256=cLemG7DDSvwWv0mDwotzIUMHdiVhlLP_OrFENOnD8RM,90
202
203
  PySDM/physics/air_dynamic_viscosity/zografos_et_al_1987.py,sha256=51X3jHzkhx8w9KtYwbG_TEUbYJ9QpiLfXEiBqlrXFqw,620
204
+ PySDM/physics/bulk_phase_partitioning/__init__.py,sha256=FvtnA6VqGdHNEDvm42hUe0FoLp4SC_fFAdhWX2CNaOo,162
205
+ PySDM/physics/bulk_phase_partitioning/kaul_et_al_2015.py,sha256=g2df4prIAItEoCbbqdMZs2sGJqEXBpWC72B0YeotpLA,763
203
206
  PySDM/physics/condensation_coordinate/__init__.py,sha256=LlSg1TLiLRQ46tfsKA1Khg7SaVPd2wg-MF0Syk5O7ng,151
204
207
  PySDM/physics/condensation_coordinate/volume.py,sha256=DvkuOTHEq_vLFnJMjfEr0K0OUxTvcBBgFPlBb606sk8,410
205
208
  PySDM/physics/condensation_coordinate/volume_logarithm.py,sha256=92xFq-qSIN8llu9HM59DQvbwawzbeRBIZ5hi7KEs7gc,512
@@ -348,7 +351,7 @@ PySDM/products/impl/activation_filtered_product.py,sha256=JUr-Wmna7SYItM_qq3XTNN
348
351
  PySDM/products/impl/concentration_product.py,sha256=eOsKFu24Fb0R0pe4Y8wSF1IqtUAL-2xS1g_Qua9nEO4,1505
349
352
  PySDM/products/impl/moist_environment_product.py,sha256=czIPLjGV2hiX-sHHiXwuflcFZGbhvRyQ_QpIv3S-Hdo,889
350
353
  PySDM/products/impl/moment_product.py,sha256=rlYlTCNxdk0-oyCzVOq-4E6SZqNrGZGggDZerNmZLxg,1483
351
- PySDM/products/impl/product.py,sha256=z9kQWfQ8CKP0gRJ3LDVKL8JLfXhHjb3b9hjTox5ql_o,3412
354
+ PySDM/products/impl/product.py,sha256=LJJ8KSUhfal3R3x9tppxwJ9OUyS9p8aVBU5ZZffZEgg,3161
352
355
  PySDM/products/impl/rate_product.py,sha256=d_l_my6KNGcpzC1mPM_U-M69NT__VIbQOqziyQrCkag,1099
353
356
  PySDM/products/impl/spectrum_moment_product.py,sha256=0QUUBJyzbNmnGTgv1Ol9dtf2aviNLue3CobPbencSNg,1670
354
357
  PySDM/products/optical/__init__.py,sha256=jBNQ2aUR6hUfZZtZPt9UR5866EeOdgtMU-FjlXZ6x_U,123
@@ -375,8 +378,8 @@ PySDM/products/size_spectral/size_standard_deviation.py,sha256=ikW_BefV27gwUlDPo
375
378
  PySDM/products/size_spectral/total_particle_concentration.py,sha256=stDEn67KGhxEkrOC4CCfCFVgjtQPMphZTfJ1Vy_H5aw,454
376
379
  PySDM/products/size_spectral/total_particle_specific_concentration.py,sha256=z6SfknIoXgT2XbVeuswrwBew9yTlmbW7qWFRmD4rqUg,460
377
380
  PySDM/products/size_spectral/water_mixing_ratio.py,sha256=i2g2s8Hj_ZTmggZvXuGRWnqyxutSknncY8Imzw_Vfhk,1301
378
- PySDM-2.65.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
379
- PySDM-2.65.dist-info/METADATA,sha256=2hjCWA1nYn4fr__zSllUrdgc7ese3FonreX3gRIKa9A,45787
380
- PySDM-2.65.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
381
- PySDM-2.65.dist-info/top_level.txt,sha256=6NYaDAhUnaYMD7ebD_dQ7HlhiJS7NMuKEXb0ck7Wcsg,6
382
- PySDM-2.65.dist-info/RECORD,,
381
+ PySDM-2.67.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
382
+ PySDM-2.67.dist-info/METADATA,sha256=cy10pWLrK7oGEcJJbNo7IOiDFY0BJbjvQdNWVAUzeAs,45929
383
+ PySDM-2.67.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
384
+ PySDM-2.67.dist-info/top_level.txt,sha256=6NYaDAhUnaYMD7ebD_dQ7HlhiJS7NMuKEXb0ck7Wcsg,6
385
+ PySDM-2.67.dist-info/RECORD,,
@@ -1,134 +0,0 @@
1
- """
2
- attribute name-class mapping logic (each new attribute must be added here)
3
- """
4
-
5
- from functools import partial
6
-
7
- from PySDM.attributes.chemistry import (
8
- Acidity,
9
- HydrogenIonConcentration,
10
- make_concentration_factory,
11
- )
12
- from PySDM.attributes.ice import CoolingRate, FreezingTemperature, ImmersedSurfaceArea
13
- from PySDM.attributes.impl.dummy_attribute import make_dummy_attribute_factory
14
- from PySDM.attributes.impl.mole_amount import make_mole_amount_factory
15
- from PySDM.attributes.isotopes import Moles1H, Moles16O, MolesLightWater
16
- from PySDM.attributes.isotopes.delta import make_delta_factory
17
- from PySDM.attributes.numerics import CellID, CellOrigin, PositionInCell
18
- from PySDM.attributes.physics import (
19
- Area,
20
- CriticalVolume,
21
- DryRadius,
22
- Heat,
23
- Multiplicities,
24
- Radius,
25
- RelativeFallVelocity,
26
- SquareRootOfRadius,
27
- Temperature,
28
- TerminalVelocity,
29
- Volume,
30
- WaterMass,
31
- WetToCriticalVolumeRatio,
32
- ReynoldsNumber,
33
- )
34
- from PySDM.attributes.physics.critical_supersaturation import CriticalSupersaturation
35
- from PySDM.attributes.physics.dry_volume import (
36
- DryVolume,
37
- DryVolumeDynamic,
38
- DryVolumeOrganic,
39
- OrganicFraction,
40
- )
41
- from PySDM.attributes.physics.equilibrium_supersaturation import (
42
- EquilibriumSupersaturation,
43
- )
44
- from PySDM.attributes.physics.hygroscopicity import Kappa, KappaTimesDryVolume
45
- from PySDM.attributes.physics.relative_fall_velocity import RelativeFallMomentum
46
- from PySDM.dynamics.impl.chemistry_utils import AQUEOUS_COMPOUNDS
47
- from PySDM.dynamics.isotopic_fractionation import HEAVY_ISOTOPES
48
- from PySDM.physics.surface_tension import Constant
49
- from PySDM.physics.ventilation import Neglect
50
-
51
- attributes = {
52
- "multiplicity": lambda _, __: Multiplicities,
53
- "volume": lambda _, __: Volume,
54
- "dry volume organic": lambda dynamics, formulae: (
55
- make_dummy_attribute_factory("dry volume organic")
56
- if formulae.surface_tension.__name__ == Constant.__name__
57
- else DryVolumeOrganic
58
- ),
59
- "dry volume": lambda dynamics, formulae: (
60
- DryVolumeDynamic if "AqueousChemistry" in dynamics else DryVolume
61
- ),
62
- "dry volume organic fraction": lambda dynamics, formulae: (
63
- make_dummy_attribute_factory("dry volume organic fraction")
64
- if formulae.surface_tension.__name__ == Constant.__name__
65
- else OrganicFraction
66
- ),
67
- "kappa times dry volume": lambda _, __: KappaTimesDryVolume,
68
- "kappa": lambda _, __: Kappa,
69
- "radius": lambda _, __: Radius,
70
- "square root of radius": lambda _, __: SquareRootOfRadius,
71
- "area": lambda _, __: Area,
72
- "dry radius": lambda _, __: DryRadius,
73
- "terminal velocity": lambda _, __: TerminalVelocity,
74
- "relative fall momentum": lambda dynamics, __: (
75
- RelativeFallMomentum
76
- if "RelaxedVelocity" in dynamics
77
- else make_dummy_attribute_factory("relative fall momentum", warn=True)
78
- # note: could eventually make an attribute that calculates momentum
79
- # from terminal velocity instead when no RelaxedVelocity dynamic is present
80
- ),
81
- "relative fall velocity": lambda dynamics, __: (
82
- RelativeFallVelocity if "RelaxedVelocity" in dynamics else TerminalVelocity
83
- ),
84
- "cell id": lambda _, __: CellID,
85
- "cell origin": lambda _, __: CellOrigin,
86
- "cooling rate": lambda _, __: CoolingRate,
87
- "position in cell": lambda _, __: PositionInCell,
88
- "temperature": lambda _, __: Temperature,
89
- "heat": lambda _, __: Heat,
90
- "critical volume": lambda _, __: CriticalVolume,
91
- **{
92
- "moles_"
93
- + compound: partial(lambda _, __, c: make_mole_amount_factory(c), c=compound)
94
- for compound in AQUEOUS_COMPOUNDS
95
- },
96
- **{
97
- "conc_"
98
- + compound: partial(lambda _, __, c: make_concentration_factory(c), c=compound)
99
- for compound in AQUEOUS_COMPOUNDS
100
- },
101
- "pH": lambda _, __: Acidity,
102
- "conc_H": lambda _, __: HydrogenIonConcentration,
103
- "freezing temperature": lambda _, __: FreezingTemperature,
104
- "immersed surface area": lambda _, __: ImmersedSurfaceArea,
105
- "critical supersaturation": lambda _, __: CriticalSupersaturation,
106
- "equilibrium supersaturation": lambda _, __: EquilibriumSupersaturation,
107
- "wet to critical volume ratio": lambda _, __: WetToCriticalVolumeRatio,
108
- "water mass": lambda _, __: WaterMass,
109
- **{
110
- "moles_"
111
- + isotope: partial(lambda _, __, c: make_mole_amount_factory(c), c=isotope)
112
- for isotope in HEAVY_ISOTOPES
113
- },
114
- **{
115
- "delta_" + isotope: partial(lambda _, __, c: make_delta_factory(c), c=isotope)
116
- for isotope in HEAVY_ISOTOPES
117
- },
118
- "moles_1H": lambda _, __: Moles1H,
119
- "moles_16O": lambda _, __: Moles16O,
120
- "moles light water": lambda _, __: MolesLightWater,
121
- "Reynolds number": lambda _, formulae: (
122
- make_dummy_attribute_factory("Reynolds number")
123
- if formulae.ventilation.__name__ == Neglect.__name__
124
- else ReynoldsNumber
125
- ),
126
- }
127
-
128
-
129
- def get_class(name, dynamics, formulae):
130
- if name not in attributes:
131
- raise ValueError(
132
- f"Unknown attribute name: {name}; valid names: {', '.join(sorted(attributes))}"
133
- )
134
- return attributes[name](dynamics, formulae)
File without changes
File without changes