Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AgnieszkaMakulska committed Feb 24, 2024
1 parent f04f5ff commit 0559d32
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
9 changes: 7 additions & 2 deletions parcel/Example_Frostenberg_Immersion_Freezing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ params = parcel_params{FT}(
sol = run_parcel(IC, FT(0), t_max, params)

# Plot results
MK.lines!(ax1, sol.t / 60, sol[1, :] .-1, label = "S_liq")
MK.lines!(ax1, sol.t / 60, S_i.(tps, sol[3, :], sol[1, :]) .- 1, label = "S_ice")
MK.lines!(ax1, sol.t / 60, sol[1, :] .- 1, label = "S_liq")
MK.lines!(
ax1,
sol.t / 60,
S_i.(tps, sol[3, :], sol[1, :]) .- 1,
label = "S_ice",
)
MK.lines!(ax2, sol.t / 60, sol[3, :])
MK.lines!(ax3, sol.t / 60, sol[6, :] * 1e3)
MK.lines!(ax4, sol.t / 60, sol[5, :] * 1e3)
Expand Down
2 changes: 1 addition & 1 deletion parcel/ParcelParameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct Frostenberg_stochastic{FT} <: CMP.ParametersType{FT}
γ::FT
end

struct Frostenberg_mean{FT} <: CMP.ParametersType{FT}
struct Frostenberg_mean{FT} <: CMP.ParametersType{FT}
ip::CMP.ParametersType{FT}
end

Expand Down
8 changes: 5 additions & 3 deletions parcel/ParcelTendencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ function immersion_freezing(params::Frostenberg_random, PSD, state)
if mod(t, drawing_interval) == 0
μ = CMI_het.INP_concentration_mean(T)
INPC = exp(rand(Normal(μ, ip.σ)))
else
INPC = 0
end
return min(Nₗ, max(FT(0), INPC - Nᵢ))
end
Expand All @@ -131,9 +133,9 @@ function immersion_freezing(params::Frostenberg_stochastic, PSD, state)
(; ip, γ) = params
(; T, Nₗ, Nᵢ, t) = state
μ = CMI_het.INP_concentration_mean(T)
g = ip.σ * sqrt(2*γ)
mean = (1 - exp(-γ*t)) * μ
st_dev = sqrt( g^2 /(2*γ) * (1 - exp(-2*γ*t)) )
g = ip.σ * sqrt(2 * γ)
mean = (1 - exp(-γ * t)) * μ
st_dev = sqrt(g^2 / (2 * γ) * (1 - exp(-2 * γ * t)))
INPC = exp(rand(Normal(mean, st_dev)))
return min(Nₗ, max(FT(0), INPC - Nᵢ))
end
Expand Down
9 changes: 4 additions & 5 deletions src/IceNucleation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ function INP_concentration_frequency(

μ = INP_concentration_mean(T)

return 1 / (sqrt(2 * FT(π)) * params.σ) * exp(-(log(INPC) - μ)^2 / (2 * params.σ^2))
return 1 / (sqrt(2 * FT(π)) * params.σ) *
exp(-(log(INPC) - μ)^2 / (2 * params.σ^2))
end


Expand All @@ -196,12 +197,10 @@ end
Returns the logarithm of mean INP concentration (in m^-3), depending on the temperature.
Based on the function μ(T) in Frostenberg et al., 2023. See DOI: 10.5194/acp-23-10883-2023
"""
function INP_concentration_mean(
T::FT,
) where {FT}
function INP_concentration_mean(T::FT) where {FT}

T_celsius = T - FT(273.15)

return log(-(T_celsius)^9 * 10^(-9))
end

Expand Down

0 comments on commit 0559d32

Please sign in to comment.