-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #637 from slayoo/freezing
fix unit in ABIFM; TotalUnfrozenImmersedSurfaceArea product
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
24 changes: 24 additions & 0 deletions
24
PySDM/products/dynamics/freezing/total_unfrozen_immersed_surface_area.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |