@@ -442,28 +442,30 @@ A `NamedTuple` of `(; ∂ₜq_c, ∂ₜq_r, ∂ₜN_c, ∂ₜN_r, ∂ₜL_rim,
4424427. `∂ₜB_rim`: rime volume tendency [m³/m³/s]
443443"""
444444function bulk_liquid_ice_collision_sources (
445- params, logλ, L_ice, F_rim, ρ_rim,
445+ params, logλ, L_ice, N_ice, F_rim, ρ_rim,
446446 psd_c, psd_r, L_c, N_c, L_r, N_r,
447447 aps, tps, vel, ρₐ, T; ∫kwargs... ,
448448)
449449 FT = eltype (params)
450- (; τ_wet) = params
450+ (; τ_wet, ρ_i ) = params
451451 D_shd = FT (1e-3 ) # 1mm # TODO : Externalize this parameter
452452
453453 ρw = psd_c. ρw
454454 @assert ρw == psd_r. ρw " Cloud and rain should have the same liquid water density"
455455 m_liq (Dₗ) = ρw * CO. volume_sphere_D (Dₗ)
456456
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)
458459
459- (QCFRZ, QCSHD, NCCOL, QRFRZ, QRSHD, NRCOL, ∫∂ₜM_col, BCCOL, BRCOL, ∫𝟙_wet_M_col) = ∫liquid_ice_collisions (
460+ rates = ∫liquid_ice_collisions (
460461 state, logλ,
461462 psd_c, psd_r, L_c, N_c, L_r, N_r,
462463 aps, tps, vel, ρₐ, T, m_liq; ∫kwargs... ,
463464 )
465+ (QCFRZ, QCSHD, NCCOL, QRFRZ, QRSHD, NRCOL, ∫∂ₜM_col, BCCOL, BRCOL, ∫𝟙_wet_M_col) = rates
464466
465467 # 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
467469
468470 # Shedding of rain
469471 # QRSHD = ∫∂ₜM_col - (QCFRZ + QRFRZ)
@@ -472,9 +474,9 @@ function bulk_liquid_ice_collision_sources(
472474
473475 # Densification of rime
474476 (; 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
476478 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
478480
479481 # Bulk rates
480482 # # Liquid phase
@@ -488,6 +490,7 @@ function bulk_liquid_ice_collision_sources(
488490 # ∂ₜN_ice = 0
489491 ∂ₜB_rim = BCCOL + BRCOL + BIWET
490492
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+ )
493496end
0 commit comments