@@ -442,28 +442,30 @@ A `NamedTuple` of `(; ∂ₜq_c, ∂ₜq_r, ∂ₜN_c, ∂ₜN_r, ∂ₜL_rim,
442
442
7. `∂ₜB_rim`: rime volume tendency [m³/m³/s]
443
443
"""
444
444
function bulk_liquid_ice_collision_sources (
445
- params, logλ, L_ice, F_rim, ρ_rim,
445
+ params, logλ, L_ice, N_ice, F_rim, ρ_rim,
446
446
psd_c, psd_r, L_c, N_c, L_r, N_r,
447
447
aps, tps, vel, ρₐ, T; ∫kwargs... ,
448
448
)
449
449
FT = eltype (params)
450
- (; τ_wet) = params
450
+ (; τ_wet, ρ_i ) = params
451
451
D_shd = FT (1e-3 ) # 1mm # TODO : Externalize this parameter
452
452
453
453
ρw = psd_c. ρw
454
454
@assert ρw == psd_r. ρw " Cloud and rain should have the same liquid water density"
455
455
m_liq (Dₗ) = ρw * CO. volume_sphere_D (Dₗ)
456
456
457
- state = get_state (params; L_ice, F_rim, ρ_rim)
457
+ # state = get_state(params; L_ice, N_ice, F_rim, ρ_rim)
458
+ state = P3State (params, L_ice, N_ice, F_rim, ρ_rim)
458
459
459
- (QCFRZ, QCSHD, NCCOL, QRFRZ, QRSHD, NRCOL, ∫∂ₜM_col, BCCOL, BRCOL, ∫𝟙_wet_M_col) = ∫liquid_ice_collisions (
460
+ rates = ∫liquid_ice_collisions (
460
461
state, logλ,
461
462
psd_c, psd_r, L_c, N_c, L_r, N_r,
462
463
aps, tps, vel, ρₐ, T, m_liq; ∫kwargs... ,
463
464
)
465
+ (QCFRZ, QCSHD, NCCOL, QRFRZ, QRSHD, NRCOL, ∫∂ₜM_col, BCCOL, BRCOL, ∫𝟙_wet_M_col) = rates
464
466
465
467
# Bulk wet growth fraction
466
- f_wet = ∫𝟙_wet_M_col / ∫∂ₜM_col
468
+ f_wet = iszero (∫∂ₜM_col) ? zero (∫∂ₜM_col) : ∫𝟙_wet_M_col / ∫∂ₜM_col
467
469
468
470
# Shedding of rain
469
471
# QRSHD = ∫∂ₜM_col - (QCFRZ + QRFRZ)
@@ -472,9 +474,9 @@ function bulk_liquid_ice_collision_sources(
472
474
473
475
# Densification of rime
474
476
(; L_ice, F_rim, ρ_rim) = state
475
- B_rim = (L_ice * F_rim) / ρ_rim # from: ρ_rim = L_rim / B_rim
477
+ B_rim = iszero (ρ_rim) ? zero (ρ_rim) : (L_ice * F_rim) / ρ_rim # from: ρ_rim = L_rim / B_rim
476
478
QIWET = f_wet * L_ice * (1 - F_rim) / τ_wet # densification of rime mass
477
- BIWET = f_wet * (L_ice / ρ⭒ - B_rim) / τ_wet # densification of rime volume
479
+ BIWET = f_wet * (L_ice / ρ_i - B_rim) / τ_wet # densification of rime volume
478
480
479
481
# Bulk rates
480
482
# # Liquid phase
@@ -488,6 +490,7 @@ function bulk_liquid_ice_collision_sources(
488
490
# ∂ₜN_ice = 0
489
491
∂ₜB_rim = BCCOL + BRCOL + BIWET
490
492
491
- return (; ∂ₜq_c, ∂ₜq_r, ∂ₜN_c, ∂ₜN_r, ∂ₜL_rim, ∂ₜL_ice, ∂ₜB_rim)
492
-
493
+ return @NamedTuple {∂ₜq_c:: FT , ∂ₜq_r:: FT , ∂ₜN_c:: FT , ∂ₜN_r:: FT , ∂ₜL_rim:: FT , ∂ₜL_ice:: FT , ∂ₜB_rim:: FT }(
494
+ (∂ₜq_c, ∂ₜq_r, ∂ₜN_c, ∂ₜN_r, ∂ₜL_rim, ∂ₜL_ice, ∂ₜB_rim)
495
+ )
493
496
end
0 commit comments