60
60
- `logλ`: the log of the slope parameter [log(1/m)]
61
61
62
62
# Keyword arguments
63
- - `∫kwargs`: Named tuple of keyword arguments passed to [`∫fdD`](@ref)
63
+ - `∫kwargs... `: Additional keyword arguments passed to the quadrature rule
64
64
65
65
Returns the melting rate of ice (QIMLT in Morrison and Mildbrandt (2015)).
66
66
"""
67
67
function ice_melt (
68
68
velocity_params:: CMP.Chen2022VelType , aps:: CMP.AirProperties , tps:: TDI.PS , Tₐ, ρₐ, dt, state:: P3State , logλ;
69
- ∫kwargs = (;) ,
69
+ ∫kwargs... ,
70
70
)
71
71
# Note: process not dependent on `F_liq`
72
72
# (we want ice core shape params)
@@ -83,7 +83,8 @@ function ice_melt(
83
83
84
84
# Integrate
85
85
fac = 4 * K_therm / L_f * (Tₐ - T_freeze)
86
- dLdt = fac * ∫fdD (state, logλ; ∫kwargs... ) do D
86
+ bnds = integral_bounds (state, logλ; p = 1e-6 )
87
+ dLdt = fac * integrate (bnds... ; ∫kwargs... ) do D
87
88
∂ice_mass_∂D (state, D) * F_v (D) * N′ (D) / D
88
89
end
89
90
@@ -257,7 +258,7 @@ Returns a function `liquid_integrals(Dᵢ)` that computes the liquid particle in
257
258
- `liq_bounds`: integration bounds for liquid particles
258
259
259
260
# Keyword arguments
260
- - `∫kwargs...`: Additional keyword arguments passed to `QuadGK.quadgk`
261
+ - `∫kwargs...`: Additional keyword arguments passed to the quadrature rule
261
262
262
263
# Notes
263
264
The function `liquid_integrals(Dᵢ)` returns a tuple `(∂ₜN_col, ∂ₜM_col, ∂ₜB_col)`
@@ -268,17 +269,16 @@ The function `liquid_integrals(Dᵢ)` returns a tuple `(∂ₜN_col, ∂ₜM_col
268
269
"""
269
270
function get_liquid_integrals (n, ∂ₜV, m_liq, ρ′_rim, liq_bounds; ∫kwargs... )
270
271
function liquid_integrals (Dᵢ)
271
- ((∂ₜN_col, ∂ₜM_col, ∂ₜB_col), _) =
272
- QGK. quadgk (liq_bounds... ; ∫kwargs... ) do D
273
- return SA. SVector (
274
- # ∂ₜN_col = ∫ ∂ₜV ⋅ n ⋅ dD
275
- ∂ₜV (Dᵢ, D) * n (D),
276
- # ∂ₜM_col = ∫ ∂ₜV ⋅ n ⋅ m_liq ⋅ dD
277
- ∂ₜV (Dᵢ, D) * n (D) * m_liq (D),
278
- # ∂ₜB_col = ∫ ∂ₜV ⋅ n ⋅ m_liq / ρ′_rim ⋅ dD
279
- ∂ₜV (Dᵢ, D) * n (D) * m_liq (D) / ρ′_rim (Dᵢ, D),
280
- )
281
- end
272
+ (∂ₜN_col, ∂ₜM_col, ∂ₜB_col) = integrate (liq_bounds... ; ∫kwargs... ) do D
273
+ return SA. SVector (
274
+ # ∂ₜN_col = ∫ ∂ₜV ⋅ n ⋅ dD
275
+ ∂ₜV (Dᵢ, D) * n (D),
276
+ # ∂ₜM_col = ∫ ∂ₜV ⋅ n ⋅ m_liq ⋅ dD
277
+ ∂ₜV (Dᵢ, D) * n (D) * m_liq (D),
278
+ # ∂ₜB_col = ∫ ∂ₜV ⋅ n ⋅ m_liq / ρ′_rim ⋅ dD
279
+ ∂ₜV (Dᵢ, D) * n (D) * m_liq (D) / ρ′_rim (Dᵢ, D),
280
+ )
281
+ end
282
282
return ∂ₜN_col, ∂ₜM_col, ∂ₜB_col
283
283
end
284
284
return liquid_integrals
@@ -299,7 +299,7 @@ Computes the bulk collision rate integrands between ice and liquid particles.
299
299
- `ice_bounds`: integration bounds for ice particles, from [`integral_bounds`](@ref)
300
300
301
301
# Keyword arguments
302
- - `∫kwargs...`: Additional keyword arguments passed to `QuadGK.quadgk`
302
+ - `∫kwargs...`: Additional keyword arguments passed to the quadrature rule
303
303
304
304
# Returns
305
305
A tuple of 8 integrands, see [`∫liquid_ice_collisions`](@ref) for details.
@@ -333,9 +333,7 @@ function ∫liquid_ice_collisions(n_i, ∂ₜM_max, cloud_integrals, rain_integr
333
333
n * 𝟙_wet * ∂ₜM_col, # ∫𝟙_wet_M_col, wet growth indicator
334
334
)
335
335
end
336
-
337
- (rates, _) = QGK. quadgk (liquid_ice_collisions_integrands, ice_bounds... ; ∫kwargs... )
338
- return rates
336
+ return integrate (liquid_ice_collisions_integrands, ice_bounds... ; ∫kwargs... )
339
337
end
340
338
341
339
"""
@@ -378,7 +376,7 @@ A tuple `(QCFRZ, QCSHD, NCCOL, QRFRZ, QRSHD, NRCOL, ∫M_col, BCCOL, BRCOL, ∫
378
376
function ∫liquid_ice_collisions (
379
377
state, logλ,
380
378
psd_c, psd_r, L_c, N_c, L_r, N_r,
381
- aps, tps, vel, ρₐ, T, m_liq,
379
+ aps, tps, vel, ρₐ, T, m_liq; ∫kwargs ... ,
382
380
)
383
381
FT = eltype (state)
384
382
@@ -388,13 +386,10 @@ function ∫liquid_ice_collisions(
388
386
n_i = DT. size_distribution (state, logλ) # n_i(Dᵢ)
389
387
390
388
# Initialize integration buffers by evaluating a representative integral
391
- ice_bounds = integral_bounds (state, logλ; p = 0.00001 )
392
- mm = FT (1e-3 )
393
- bounds_c = FT[0 ; 0.01 mm; 0.1 mm; 1 mm; 10 mm; 100 mm; 1 ] # TODO : Replace by quantiles method
394
- bounds_r = FT[0 ; 0.01 mm; 0.1 mm; 1 mm; 10 mm; 100 mm; 1 ] # TODO : Replace by quantiles method
395
- segbuf_c = QGK. quadgk_segbuf (n_c, bounds_c... )[3 ]
396
- segbuf_r = QGK. quadgk_segbuf (n_r, bounds_r... )[3 ]
397
- segbuf_ice = QGK. quadgk_segbuf (n_i, ice_bounds... )[3 ]
389
+ p = FT (0.00001 )
390
+ ice_bounds = integral_bounds (state, logλ; p)
391
+ bounds_c = CM2. get_size_distribution_bounds (psd_c, L_c, ρₐ, N_c, p)
392
+ bounds_r = CM2. get_size_distribution_bounds (psd_r, L_r, ρₐ, N_r, p)
398
393
399
394
# Integrand components
400
395
# NOTE: We assume collision efficiency, shape (spherical), and terminal velocity is the
@@ -403,12 +398,10 @@ function ∫liquid_ice_collisions(
403
398
ρ′_rim = compute_local_rime_density (vel, ρₐ, T, state) # ρ′_rim(Dᵢ, Dₗ)
404
399
∂ₜM_max = compute_max_freeze_rate (aps, tps, vel, ρₐ, T, state) # ∂ₜM_max(Dᵢ)
405
400
406
- cloud_integrals = get_liquid_integrals (n_c, ∂ₜV, m_liq, ρ′_rim, bounds_c; eval_segbuf = segbuf_c ) # (∂ₜN_c_col, ∂ₜM_c_col, ∂ₜB_c_col)
407
- rain_integrals = get_liquid_integrals (n_r, ∂ₜV, m_liq, ρ′_rim, bounds_r; eval_segbuf = segbuf_r ) # (∂ₜN_r_col, ∂ₜM_r_col, ∂ₜB_r_col)
401
+ cloud_integrals = get_liquid_integrals (n_c, ∂ₜV, m_liq, ρ′_rim, bounds_c; ∫kwargs ... ) # (∂ₜN_c_col, ∂ₜM_c_col, ∂ₜB_c_col)
402
+ rain_integrals = get_liquid_integrals (n_r, ∂ₜV, m_liq, ρ′_rim, bounds_r; ∫kwargs ... ) # (∂ₜN_r_col, ∂ₜM_r_col, ∂ₜB_r_col)
408
403
409
- return ∫liquid_ice_collisions (
410
- n_i, ∂ₜM_max, cloud_integrals, rain_integrals, ice_bounds; eval_segbuf = segbuf_ice,
411
- )
404
+ return ∫liquid_ice_collisions (n_i, ∂ₜM_max, cloud_integrals, rain_integrals, ice_bounds; ∫kwargs... )
412
405
end
413
406
414
407
"""
@@ -451,7 +444,7 @@ A `NamedTuple` of `(; ∂ₜq_c, ∂ₜq_r, ∂ₜN_c, ∂ₜN_r, ∂ₜL_rim,
451
444
function bulk_liquid_ice_collision_sources (
452
445
params, logλ, L_ice, F_rim, ρ_rim,
453
446
psd_c, psd_r, L_c, N_c, L_r, N_r,
454
- aps, tps, vel, ρₐ, T,
447
+ aps, tps, vel, ρₐ, T; ∫kwargs ... ,
455
448
)
456
449
FT = eltype (params)
457
450
(; τ_wet) = params
@@ -466,7 +459,7 @@ function bulk_liquid_ice_collision_sources(
466
459
(QCFRZ, QCSHD, NCCOL, QRFRZ, QRSHD, NRCOL, ∫∂ₜM_col, BCCOL, BRCOL, ∫𝟙_wet_M_col) = ∫liquid_ice_collisions (
467
460
state, logλ,
468
461
psd_c, psd_r, L_c, N_c, L_r, N_r,
469
- aps, tps, vel, ρₐ, T, m_liq,
462
+ aps, tps, vel, ρₐ, T, m_liq; ∫kwargs ... ,
470
463
)
471
464
472
465
# Bulk wet growth fraction
0 commit comments