Skip to content

Commit

Permalink
final docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
trontrytel committed Mar 14, 2024
1 parent 00fedda commit a7bde12
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
11 changes: 5 additions & 6 deletions docs/src/IceNucleationParcel0D.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,14 @@ We can calculate the variance ``\bf{V}`` as,
\end{equation}
```

We use this process to model the logarithm of INPC (``x=\log(\text{INPC})``),
which tends toward the mean ``\mu(T)``.
We use this process to model ``x=\log(\text{INPC})``,
which tends toward the mean ``\mu(T)``.
If we denote ``\tau = 1 / \gamma`` as the process timescale and
``\sigma = g / \sqrt(2 \gamma)`` as the process uncertainty,
then the tendency

``\sigma = g / \sqrt{2 / \gamma}`` as the process uncertainty,
then
```math
\begin{equation}
d\log(\text{INPC}) = - \frac{\log(\text{INPC}) - μ}{\tau} + \sigma \sqrt(\frac{2}{\tau dt}) \; {\bf{N}}(0, 1))
d\log(\text{INPC}) = - \frac{\log(\text{INPC}) - μ}{\tau} + \sigma \sqrt{\frac{2}{\tau \; dt}} \; {\bf{N}}(0, 1))
\end{equation}
```

Expand Down
24 changes: 8 additions & 16 deletions parcel/Example_Frostenberg_Immersion_Freezing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ for (const_dt, n_dt_range) in zip(const_dt_range, n_dt_range_12)
end
end

results_stochastic = []
labels_stochastic = []
time_stochastic = []
results_stoch = []
labels_stoch = []
time_stoch = []
for const_dt in const_dt_range
# Frostenberg_stochastic with different timescales γ
for τ in τ_range
Expand All @@ -130,17 +130,14 @@ for const_dt in const_dt_range
push!(solutions_st, sol_st)
end
mean_sol = sum(solutions_st) / length(solutions_st)
push!(time_stochastic, solutions_st[1].t)
push!(results_stochastic, mean_sol)
push!(
labels_stochastic,
"dt = " * string(const_dt) * " τ = " * string(τ),
)
push!(time_stoch, solutions_st[1].t)
push!(results_stoch, mean_sol)
push!(labels_stoch, "dt = " * string(const_dt) * " τ = " * string(τ))
end
end

# Plotting
fig = MK.Figure(size = (900, 700))
fig = MK.Figure(size = (1200, 900))
ax1 = MK.Axis(fig[1, 1], ylabel = "Ice Supersaturation [-]")
ax2 = MK.Axis(fig[1, 2], ylabel = "T [K]")
ax3 = MK.Axis(fig[2, 1], ylabel = "q_ice [g/kg]")
Expand Down Expand Up @@ -178,12 +175,7 @@ function plot_results(sol, t, ll, cl, ls)
label = ll,
)
end
for (sol, t, ll, cl) in zip(
results_stochastic,
time_stochastic,
labels_stochastic,
colors_stochastic,
)
for (sol, t, ll, cl) in zip(results_stoch, time_stoch, labels_stoch, colors)
ls = :solid
plot_results(sol, t, ll, cl, ls)
MK.lines!(ax7, sol[3, :], exp.(sol[11, :]), linestyle = ls, color = cl)
Expand Down
3 changes: 2 additions & 1 deletion parcel/Example_Liquid_only.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ r₀ = FT(8e-6)
p₀ = FT(800 * 1e2)
T₀ = FT(273.15 + 7.0)
x_sulph = FT(0)
ln_INPC = FT(0)
e = TD.saturation_vapor_pressure(tps, T₀, TD.Liquid())
Sₗ = FT(1)
md_v = (p₀ - e) / R_d / T₀
Expand All @@ -34,7 +35,7 @@ ml_v = Nₗ * 4 / 3 * FT(π) * ρₗ * r₀^3
qᵥ = mv_v / (md_v + mv_v + ml_v)
qₗ = ml_v / (md_v + mv_v + ml_v)
qᵢ = FT(0)
IC = [Sₗ, p₀, T₀, qᵥ, qₗ, qᵢ, Nₐ, Nₗ, Nᵢ, x_sulph]
IC = [Sₗ, p₀, T₀, qᵥ, qₗ, qᵢ, Nₐ, Nₗ, Nᵢ, x_sulph, ln_INPC]

# Simulation parameters passed into ODE solver
w = FT(10) # updraft speed
Expand Down
3 changes: 1 addition & 2 deletions parcel/Example_Tully_et_al_2023.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ function get_initial_condition(
R_v = TD.Parameters.R_v(tps)
e_sl = TD.saturation_vapor_pressure(tps, T, TD.Liquid())
e = eᵥ(qᵥ, p_air, R_a, R_v)
S_liq = e / e_sl
ln_INPC = FT(0)
Sₗ = e / e_sl

return [Sₗ, p_air, T, qᵥ, qₗ, qᵢ, Nₐ, Nₗ, Nᵢ, x_sulph, ln_INPC]
end
Expand Down

0 comments on commit a7bde12

Please sign in to comment.