Skip to content

Commit

Permalink
Merge pull request #637 from slayoo/freezing
Browse files Browse the repository at this point in the history
fix unit in ABIFM; TotalUnfrozenImmersedSurfaceArea product
  • Loading branch information
slayoo authored Sep 23, 2021
2 parents ad0067e + 0d1f753 commit 4c5676f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion PySDM/physics/heterogeneous_ice_nucleation_rate/abifm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import numpy as np
from PySDM.physics import si

m = np.inf
c = np.inf
unit = 1 / si.cm**2 / si.s

class ABIFM:
@staticmethod
Expand All @@ -11,4 +13,4 @@ def _check():

@staticmethod
def J_het(a_w_ice):
return 10**(m * (1 - a_w_ice) + c)
return 10**(m * (1 - a_w_ice) + c) * unit
1 change: 1 addition & 0 deletions PySDM/products/dynamics/freezing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .ice_water_content import IceWaterContent
from .freezable_specific_concentration import FreezableSpecificConcentration
from .total_unfrozen_immersed_surface_area import TotalUnfrozenImmersedSurfaceArea
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from ...product import MomentProduct
import numpy as np
from PySDM.physics.constants import convert_to, si


class TotalUnfrozenImmersedSurfaceArea(MomentProduct):
def __init__(self):
super().__init__(
name='A_tot',
description='total unfrozen immersed surface area',
unit='m2'
)

def get(self):
params = {
'attr': 'immersed surface area',
'filter_attr': 'volume',
'filter_range': (0, np.inf)
}
self.download_moment_to_buffer(**params, rank=1)
result = np.copy(self.buffer)
self.download_moment_to_buffer(**params, rank=0)
result[:] *= self.buffer
return result

0 comments on commit 4c5676f

Please sign in to comment.