-
Notifications
You must be signed in to change notification settings - Fork 42
new particle_shape_and_density #1539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
""" | ||
particle shape and density relationships for ice particles | ||
""" | ||
|
||
from .ice_spheres import IceSpheres |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
""" | ||
columnar particles with constant density of ice | ||
""" | ||
|
||
class Columnar: | ||
def __init__(self, const, _): | ||
self.mass_density = const.rho_i | ||
|
||
@staticmethod | ||
def supports_mixed_phase(_=None): | ||
return True | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
""" | ||
spherical particles with constant density of ice | ||
""" | ||
from PySDM.physics.trivia import Trivia | ||
|
||
class IceSpheres: | ||
def __init__(self, const, _): | ||
pass | ||
|
||
@staticmethod | ||
def supports_mixed_phase(_=None): | ||
return True | ||
|
||
@staticmethod | ||
def mass_to_volume(const, mass): | ||
return ( | ||
Trivia.volume_of_density_mass(const, const.rho_i, mass) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, this will not work with the current implementation of |
||
) | ||
|
||
@staticmethod | ||
def volume_to_mass(const, volume): | ||
return ( | ||
Trivia.mass_of_density_volume(const.rho_i, volume) | ||
) | ||
|
||
@staticmethod | ||
def volume_to_radius(const, volume): | ||
return ( | ||
Trivia.radius(const, volume) | ||
) | ||
|
||
@staticmethod | ||
def radius_to_volume(const, radius): | ||
return ( | ||
Trivia.sphere_radius_to_volume(const, radius) | ||
) | ||
|
||
@staticmethod | ||
def radius_to_mass(const, radius, mass_density): | ||
return ( | ||
Trivia.sphere_radius_to_volume(const, radius) * const.rho_i | ||
) | ||
|
||
@staticmethod | ||
def radius_to_area(const, radius): | ||
return( | ||
Trivia.area(const, radius) | ||
) | ||
|
||
@staticmethod | ||
def mass_to_capacity(const, mass): | ||
return( | ||
Trivia.sphere_mass_to_radius(const, mass, const.rho_i,) | ||
) | ||
|
||
@staticmethod | ||
def maximum_diameter(const, mass): | ||
return( | ||
Trivia.sphere_mass_to_radius(const, mass, const.rho_i) * 2 | ||
) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
particle shape and density relationships for liquid particles | ||
""" | ||
|
||
from .liquid_spheres import LiquidSpheres | ||
from .porous_spheroids import PorousSpheroid |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
""" | ||
spherical particles with constant density of ice | ||
""" | ||
from PySDM.physics.trivia import Trivia | ||
|
||
class LiquidSpheres: | ||
def __init__(self, const, _): | ||
pass | ||
|
||
@staticmethod | ||
def mass_to_volume(const, mass): | ||
return ( | ||
Trivia.volume_of_density_mass(const, const.rho_w, mass) | ||
) | ||
|
||
@staticmethod | ||
def volume_to_mass(const, volume): | ||
return ( | ||
Trivia.mass_of_density_volume(const.rho_w, volume) | ||
) | ||
|
||
@staticmethod | ||
def volume_to_radius(const, volume): | ||
return ( | ||
Trivia.radius(const, volume) | ||
) | ||
|
||
@staticmethod | ||
def radius_to_volume(const, radius): | ||
return ( | ||
Trivia.sphere_radius_to_volume(const, radius) | ||
) | ||
|
||
@staticmethod | ||
def radius_to_mass(const, radius, mass_density): | ||
return ( | ||
Trivia.sphere_radius_to_volume(const, radius) * const.rho_w | ||
) | ||
|
||
@staticmethod | ||
def radius_to_area(const, radius): | ||
return ( | ||
Trivia.area(const, radius) | ||
) | ||
|
||
@staticmethod | ||
def mass_to_capacity(const, mass): | ||
return ( | ||
Trivia.sphere_mass_to_radius(const, mass, const.rho_w, ) | ||
) | ||
|
||
@staticmethod | ||
def maximum_diameter(const, mass): | ||
return ( | ||
Trivia.sphere_mass_to_radius(const, mass, const.rho_w) * 2 | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
""" | ||
for mixed-phase microphysics as in | ||
[Shima et al. 2020](https://doi.org/10.5194/gmd-13-4107-2020) | ||
""" | ||
|
||
|
||
class PorousSpheroid: # pylint: disable=too-few-public-methods | ||
@staticmethod | ||
def supports_mixed_phase(_=None): | ||
return True |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,21 +12,36 @@ def __init__(self, _): | |
pass | ||
|
||
@staticmethod | ||
def volume_of_density_mass(rho, m): | ||
return m / rho | ||
def volume_of_density_mass(rho, mass): | ||
return mass / rho | ||
|
||
@staticmethod | ||
def mass_of_density_volume(rho, volume): | ||
return volume * rho | ||
|
||
# TODO: change name to sphere_volume_to_radius | ||
@staticmethod | ||
def radius(const, volume): | ||
return np.power(volume / const.PI_4_3, const.ONE_THIRD) | ||
|
||
# TODO: change name to sphere_radius_to_area | ||
@staticmethod | ||
def area(const, radius): | ||
return const.PI * const.FOUR * np.power(radius, const.TWO) | ||
|
||
@staticmethod | ||
def volume(const, radius): | ||
def sphere_radius_to_volume(const, radius): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. very good point! |
||
return const.PI_4_3 * np.power(radius, const.THREE) | ||
|
||
@staticmethod | ||
def sphere_radius_to_mass(const, radius, density): | ||
return const.PI_4_3 * np.power(radius, const.THREE) * density | ||
|
||
@staticmethod | ||
def sphere_mass_to_radius(const, mass, density): | ||
return const.PI_4_3 * np.power(radius, const.THREE) * density | ||
|
||
# TODO: remove this. There is already sphere_radius_to_area | ||
@staticmethod | ||
def sphere_surface(const, diameter): | ||
return const.PI * diameter**2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that
supports_mixed_phase
withinIceSpheres
does not really convey much - should always beTrue