Skip to content

Commit

Permalink
update Project files + fix R_a
Browse files Browse the repository at this point in the history
  • Loading branch information
amylu00 committed Jan 19, 2024
1 parent a197d9f commit f408c7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion p3_sandbox/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"

[compat]
CLIMAParameters = "0.7.12"
CLIMAParameters = "0.8"
20 changes: 13 additions & 7 deletions p3_sandbox/p3_sandbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CloudMicrophysics.Parameters as CMP
import CloudMicrophysics.P3Scheme as P3
import CloudMicrophysics.HetIceNucleation as CMI_het
import CloudMicrophysics.Common as CMO
import Thermodynamics.Parameters as TDP
import Thermodynamics as TD

"""
ODE problem definitions
Expand All @@ -13,7 +13,7 @@ function p3_sandbox(dY, Y, p, t)

# Numerical precision used in the simulation
FT = eltype(Y)
(; const_dt, tps, T, pₐ, qᵥ, Nₗ, rₗ, aero_type) = p
(; const_dt, tps, T, pₐ, qᵥ, qₗ, Nₗ, rₗ, aero_type) = p
p3 = CMP.ParametersP3(FT)

# Our state vector
Expand All @@ -24,8 +24,9 @@ function p3_sandbox(dY, Y, p, t)

F_r = qᵣ / qᵢ
ρ_r = ifelse(Bᵣ == 0, FT(0), qᵣ / Bᵣ)
q = TD.PhasePartition(qᵥ + qₗ + qᵢ, qₗ, qᵢ)

Rₐ = TD.gas_constant_air(tps, qᵥ)
Rₐ = TD.gas_constant_air(tps, q)
R_v = TD.Parameters.R_v(tps)
e = qᵥ * pₐ * R_v / Rₐ

Expand All @@ -34,6 +35,7 @@ function p3_sandbox(dY, Y, p, t)
Δa_w = a_w - a_w_ice
J_immersion = CMI_het.ABIFM_J(aero_type, Δa_w)
dNᵢ_dt = J_immersion * Nₗ * 4 * π * rₗ^2
println("J = ", J_immersion)


sol = P3.thresholds(p3, ρ_r, F_r)
Expand Down Expand Up @@ -61,15 +63,19 @@ const_dt = 1.0
t_0 = 0
t_end = 2

tps = TDP.ThermodynamicsParameters(FT) # thermodynamics free parameters
tps = TD.Parameters.ThermodynamicsParameters(FT) # thermodynamics free parameters
wps = CMP.WaterProperties(FT)

T = FT(251)
pₐ = FT(400 * 1e2) # air pressure
qᵥ = FT(8.1e-4) # mixing ratio of water vapor
pₐ = FT(800 * 1e2) # air pressure
ρₗ = wps.ρw
Nₗ = FT(500 * 1e3) # number of cloud droplets
rₗ = FT(1e-6) # radius of dropletes
qᵥ = FT(8.1e-4) # mixing ratio of water vapor
qₗ = Nₗ * 4 / 3 * π * rₗ^3 * ρₗ / 1.2 # 1.2 should be ρₐ
aero_type = CMP.Illite(FT)

p = (; const_dt, tps, T, pₐ, qᵥ, Nₗ, rₗ, aero_type)
p = (; const_dt, tps, T, pₐ, qᵥ, qₗ, Nₗ, rₗ, aero_type)

Nᵢ_0 = 100 * 1e6
qᵢ_0 = 1e-3
Expand Down
2 changes: 1 addition & 1 deletion parcel/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"

[compat]
CLIMAParameters = "0.7.12"
CLIMAParameters = "0.8"

0 comments on commit f408c7a

Please sign in to comment.