1
1
const ρw = 1000.0 # Density of water, kg/m³
2
2
const golovin_b = (1500.0 )* 1e-3 # Golovin collision coefficient, input cm³/g/s to -> m³/kg/s
3
3
4
+ """
5
+ mass_from_r(r; ρ=ρw)
6
+
7
+ Compute mass (kg) of a droplet with given radius (m) and density (kg/m³)
8
+ """
4
9
mass_from_r (r; ρ= ρw) = (4 * π/ 3 )* ρ* (r^ 3 )
10
+
11
+ """
12
+ r_from_mass(x; ρ=ρw)
13
+
14
+ Compute radius (m) of a droplet with given mass (kg) and density (kg/m³)
15
+ """
5
16
r_from_mass (x; ρ= ρw) = (3 * x/ 4 / π/ ρ)^ (1 / 3 )
6
17
7
18
# Initial cloud droplet distribution
8
- # nc(x; L=L, x̅=x̅) = (L / x̅^2) * exp(-x / x̅)
9
- # NOTE: this probably needs to be some sort of struct with an abstract type?
10
- # Exponential(x, L, x̅) = nc(x, L, x̅)
11
19
12
20
# # Collision Kernels
13
21
14
- # inputs in kg
22
+ """
23
+ golovin_kernel(xᵢ, xⱼ)
24
+
25
+ Compute the Golovin collision kernel for droplets of two given masses (in kg)
26
+ """
15
27
golovin_kernel (xᵢ, xⱼ) = golovin_b * (xᵢ + xⱼ)
16
28
29
+
17
30
function _interior_hydro_kernel (E_coal, E_coll, r_sum, tv_diff)
18
31
E_coal * E_coll * π * r_sum* r_sum * abs (tv_diff)
19
32
end
20
33
34
+
35
+ """
36
+ hydrodynamic_kernel(xᵢ, xⱼ)
37
+
38
+ Compute the hydrodynamic collision kernel for droplets of the two given masses
39
+ (in kg) assuming unity collision and coalescence efficiency.
40
+ """
21
41
function hydrodynamic_kernel (xᵢ, xⱼ)
22
42
tvᵢ = terminal_v (xᵢ)
23
43
tvⱼ = terminal_v (xⱼ)
@@ -26,6 +46,12 @@ function hydrodynamic_kernel(xᵢ, xⱼ)
26
46
_interior_hydro_kernel (1.0 , 1.0 , r_sum, tv_diff)
27
47
end
28
48
49
+ """
50
+ long_kernel(xᵢ, xⱼ)
51
+
52
+ Compute the hydrodynamic collision kernel with parameterization of collision
53
+ efficiency from Long (1974) for two droplets of given masses (in kg)
54
+ """
29
55
function long_kernel (xᵢ, xⱼ)
30
56
rᵢ = r_from_mass (xᵢ)
31
57
rⱼ = r_from_mass (xⱼ)
@@ -52,9 +78,13 @@ function long_kernel(xᵢ, xⱼ)
52
78
_interior_hydro_kernel (1.0 , E_coll, r_sum, tv_diff)
53
79
end
54
80
55
- # Other Functions
81
+ """
82
+ terminal_v(x)
83
+
84
+ Compute terminal velocity of a droplet of given mass (in kg) following the
85
+ parameterization of Beard (1976)
86
+ """
56
87
function terminal_v (x)
57
- # Beard (1976)
58
88
r = r_from_mass (x)
59
89
d = 2 * r * 1e6 # diameter, m -> μm
60
90
x = x * 1e3 # mass, kg -> g
@@ -76,12 +106,17 @@ function terminal_v(x)
76
106
tv = 1e-2 * α * x_to_beta # cm/s -> m/s
77
107
end
78
108
79
- # Pre-compute collison kernels
80
- function kernels (x, kernel)
109
+ """
110
+ kernels(x::AbstractArray{FT, 1}, kernel::Symbol) where {FT <: AbstractFloat}
111
+
112
+ Pre-compute and cache pair-wise collision kernels for a 1D binned discretization
113
+ of mass space.
114
+ """
115
+ function kernels (x:: AbstractArray{FT, 1} , kernel:: Symbol ) where {FT <: AbstractFloat }
81
116
82
117
m = length (x)
83
- ck = zeros (Float64 , m, m)
84
- cck = zeros (Float64 , m, m)
118
+ ck = zeros (FT , m, m)
119
+ cck = zeros (FT , m, m)
85
120
86
121
# Compute collision kernel for all potential bin interactions
87
122
for j ∈ 1 : m
0 commit comments