Skip to content

Commit

Permalink
cleaning 🧹
Browse files Browse the repository at this point in the history
  • Loading branch information
amylu00 committed Feb 6, 2024
1 parent 2e886bb commit f13e53c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion box/Alpert_Knopf_2016_forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Aj_sorted = sort(Aj_unsorted, rev = true)
# initial condition for the problem
IC = [T_initial, r_l, FT(Nâ‚€), FT(N_ice)]
# additional model parameters
p_def = (; tps, r_l, aerosol, cooling_rate, Nâ‚€)
p_def = (; tps, aerosol, cooling_rate, Nâ‚€)

# run the box model without and with distribution sampling
sol_cst = run_box(IC, t_0, t_end, (p_def..., const_dt = dt, flag = false))
Expand Down
16 changes: 8 additions & 8 deletions box/box.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ ODE problem definitions
function box_model(dY, Y, p, t)

# Get simulation parameters
(; tps, r_l, aerosol, cooling_rate) = p
(; tps, aerosol, cooling_rate) = p
# Numerical precision used in the simulation
FT = eltype(Y)

# Our state vector
T = Y[1] # temperature
r_l = Y[2] # droplet radius
N_liq = Y[3] # number concentration of existing water droplets
N_ice = Y[4] # number concentration of activated ice crystals

Expand Down Expand Up @@ -45,13 +46,13 @@ ODE problem definitions
function box_model_with_probability(dY, Y, p, t)

# Get simulation parameters
(; tps, const_dt, r_l, aerosol, cooling_rate, Aj_sorted, Nâ‚€) = p
(; tps, const_dt, aerosol, cooling_rate, Aj_sorted, Nâ‚€) = p
# Numerical precision used in the simulation
FT = eltype(Y)

# Our state vector
T = Y[1] # temperature
r = Y[2] # total surface area converted to radius
r_l = Y[2] # total surface area converted to radius
N_liq = max(FT(0), Y[3]) # number concentration of existing water droplets
N_ice = max(FT(0), Y[4]) # number concentration of activated ice crystals

Expand All @@ -61,7 +62,7 @@ function box_model_with_probability(dY, Y, p, t)

# Update the tendecies
dT_dt = -cooling_rate
drj_dt = FT(0)
dr_l_dt = FT(0)
dN_ice_dt = FT(0)
dN_liq_dt = FT(0)
if N_liq > 0
Expand All @@ -79,18 +80,17 @@ function box_model_with_probability(dY, Y, p, t)
Aj_sorted[j] = FT(0)
end
end
A = N_liq * 4 * FT(Ï€) * r^2
Aj_sum = sum(Aj_sorted)
rj_sum = sqrt(Aj_sum / 4 / FT(Ï€))
drj_dt = (rj_sum - r * N_liq) / const_dt / N_liq
#drj_dt = - sqrt(abs(Aj_sum - A) / 4 / FT(Ï€)) / const_dt / N_liq
dr_l_dt = (rj_sum - r_l * N_liq) / const_dt / N_liq
#dr_l_dt = - sqrt(abs(Aj_sum - A) / 4 / FT(Ï€)) / const_dt / N_liq
dN_ice_dt = max(FT(0), n_frz / const_dt)
dN_liq_dt = -dN_ice_dt
end

# Set tendencies
dY[1] = dT_dt # temperature
dY[2] = drj_dt # radius
dY[2] = dr_l_dt # droplet radius
dY[3] = dN_liq_dt # number concentration of droplets
dY[4] = dN_ice_dt # number concentration of ice activated particles

Expand Down

0 comments on commit f13e53c

Please sign in to comment.