Skip to content

Commit

Permalink
fix delta a_w problem
Browse files Browse the repository at this point in the history
  • Loading branch information
amylu00 committed Jan 23, 2024
1 parent 0732833 commit 2b170c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 5 additions & 1 deletion docs/src/IceNucleationParcel0D.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,11 @@ include("../../parcel/Immersion_Freezing.jl")

The following plots show the parcel model running with homogeneous freezing and
depositional growth assuming a lognormal distribution of aerosols.
It is compared against [Jensen2022](@cite).
It is compared against [Jensen2022](@cite). Note that running with the initial
conditions described in [Jensen2022](@cite) results in a ``\Delta a_w`` smaller
than the minimum valid value for the ``J_{hom}`` parameterization. We have forced
the ``\Delta a_w`` to be equal to the minimum valid value in this example only
for demonstrative purposes.

```@example
include("../../parcel/Jensen_et_al_2022.jl")
Expand Down
14 changes: 10 additions & 4 deletions parcel/parcel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function parcel_model(dY, Y, p, t)
Δa_w = T > FT(185) && T < FT(235) ?
CMO.a_w_xT(H2SO4_prs, tps, x_sulph, T) - CMO.a_w_ice(tps, T) :
CMO.a_w_eT(tps, e, T) - CMO.a_w_ice(tps, T)
J_immersion = CMI_het.ABIFM_J(aerosol, ip, Δa_w)
J_immersion = CMI_het.ABIFM_J(aerosol, Δa_w)
if "Monodisperse" in droplet_size_distribution
r_l = cbrt(q_liq / N_liq / (4 / 3 * π) / ρ_liq * ρ_air)
elseif "Gamma" in droplet_size_distribution
Expand All @@ -109,28 +109,34 @@ function parcel_model(dY, Y, p, t)
dN_act_dt_hom = FT(0)
dqi_dt_new_hom = FT(0)
if "HomogeneousFreezing" in ice_nucleation_modes
#a_w_ice_μ = exp((210368 + 131.438*T - (3.32373e6 /T) - 41729.1*log(T))/(8.31441*T))
#Δa_w = CMO.a_w_eT(tps, e, T) - a_w_ice_μ
a_w_ice = CMO.a_w_ice(tps, T)
Δa_w = CMO.a_w_eT(tps, e, T) - a_w_ice
J_hom = CMI_hom.homogeneous_J(ip.homogeneous, Δa_w)
if "Monodisperse" in droplet_size_distribution
J_hom = CMI_hom.homogeneous_J(ip.homogeneous, Δa_w)
r_l = cbrt(q_liq / N_liq / (4 / 3 * π) / ρ_liq * ρ_air)
V_l = 4 /3 * π * r_l^3
dN_act_dt_hom = max(FT(0), J_hom * N_liq * V_l)
dqi_dt_new_hom = dN_act_dt_hom * 4 / 3 * π * r_l^3 * ρ_ice / ρ_air
elseif "Gamma" in droplet_size_distribution
J_hom = CMI_hom.homogeneous_J(ip.homogeneous, Δa_w)
λ = cbrt(32 * π * N_liq / q_liq * ρ_liq / ρ_air)
#A = N_liq* λ^2
r_l = 2 / λ
V_l = 4 / 3 * π * r_l^3
dN_act_dt_hom = max(FT(0), J_hom * N_aer * V_l)
dqi_dt_new_hom = dN_act_dt_hom * 4 / 3 * π * r_l^3 * ρ_ice / ρ_air
elseif "Lognormal" in droplet_size_distribution
J_hom = CMI_hom.homogeneous_J(ip.homogeneous, Δa_w)
dN_act_dt_hom = max(FT(0), J_hom * N_liq * 4 / 3 * π * exp((6*log(R_mode_liq) + 9 * σ^2)/(2)))
r_l = R_mode_liq * exp(σ)
dqi_dt_new_hom = dN_act_dt_hom * 4 / 3 * π * r_l^3 * ρ_ice / ρ_air
elseif "Jensen_Example" in droplet_size_distribution
if Δa_w < ip.homogeneous.Δa_w_min
Δa_w = ip.homogeneous.Δa_w_min
elseif Δa_w > ip.homogeneous.Δa_w_max
Δa_w = ip.homogeneous.Δa_w_max
end
J_hom = CMI_hom.homogeneous_J(ip.homogeneous, Δa_w)
dN_act_dt_hom = max(FT(0), J_hom * N_aer * 4 / 3 * π * exp((6*log(r_nuc) + 9 * σ^2)/(2)))
r_aero = r_nuc * exp(σ)
dqi_dt_new_hom = dN_act_dt_hom * 4 / 3 * π * r_aero^3 * ρ_ice / ρ_air
Expand Down

0 comments on commit 2b170c5

Please sign in to comment.