2
2
immersion freezing using either singular or time-dependent formulation
3
3
"""
4
4
5
- from PySDM .backends .impl_common .freezing_attributes import (
6
- SingularAttributes ,
7
- TimeDependentAttributes ,
8
- )
9
5
from PySDM .physics .heterogeneous_ice_nucleation_rate import Null
10
6
from PySDM .dynamics .impl import register_dynamic
11
7
@@ -25,22 +21,24 @@ def __init__(self, *, singular=True, record_freezing_temperature=False, thaw=Fal
25
21
def register (self , builder ):
26
22
self .particulator = builder .particulator
27
23
28
- assert builder .formulae .particle_shape_and_density .supports_mixed_phase ()
24
+ assert (
25
+ self .particulator .formulae .particle_shape_and_density .supports_mixed_phase ()
26
+ )
29
27
30
28
builder .request_attribute ("signed water mass" )
31
29
if self .singular or self .record_freezing_temperature :
32
30
builder .request_attribute ("freezing temperature" )
33
31
34
32
if not self .singular :
35
33
assert not isinstance (
36
- builder .formulae .heterogeneous_ice_nucleation_rate , Null
34
+ self . particulator .formulae .heterogeneous_ice_nucleation_rate , Null
37
35
)
38
36
builder .request_attribute ("immersed surface area" )
39
37
self .rand = self .particulator .Storage .empty (
40
38
self .particulator .n_sd , dtype = float
41
39
)
42
40
self .rng = self .particulator .Random (
43
- self .particulator .n_sd , self .particulator .backend . formulae .seed
41
+ self .particulator .n_sd , self .particulator .formulae .seed
44
42
)
45
43
46
44
def __call__ (self ):
@@ -54,39 +52,12 @@ def __call__(self):
54
52
return
55
53
56
54
if self .singular :
57
- self .particulator .backend .freeze_singular (
58
- attributes = SingularAttributes (
59
- freezing_temperature = self .particulator .attributes [
60
- "freezing temperature"
61
- ],
62
- signed_water_mass = self .particulator .attributes ["signed water mass" ],
63
- ),
64
- temperature = self .particulator .environment ["T" ],
65
- relative_humidity = self .particulator .environment ["RH" ],
66
- cell = self .particulator .attributes ["cell id" ],
67
- thaw = self .thaw ,
68
- )
55
+ self .particulator .immersion_freezing_singular (thaw = self .thaw )
69
56
else :
70
57
self .rand .urand (self .rng )
71
- self .particulator .backend . freeze_time_dependent (
58
+ self .particulator .immersion_freezing_time_dependent (
72
59
rand = self .rand ,
73
- attributes = TimeDependentAttributes (
74
- immersed_surface_area = self .particulator .attributes [
75
- "immersed surface area"
76
- ],
77
- signed_water_mass = self .particulator .attributes ["signed water mass" ],
78
- ),
79
- timestep = self .particulator .dt ,
80
- cell = self .particulator .attributes ["cell id" ],
81
- a_w_ice = self .particulator .environment ["a_w_ice" ],
82
- temperature = self .particulator .environment ["T" ],
83
- relative_humidity = self .particulator .environment ["RH" ],
84
60
record_freezing_temperature = self .record_freezing_temperature ,
85
- freezing_temperature = (
86
- self .particulator .attributes ["freezing temperature" ]
87
- if self .record_freezing_temperature
88
- else None
89
- ),
90
61
thaw = self .thaw ,
91
62
)
92
63
0 commit comments