From f408c7aa814e53367f71218c31db88f79a94ca8d Mon Sep 17 00:00:00 2001 From: amylu00 Date: Fri, 19 Jan 2024 15:30:38 -0800 Subject: [PATCH] update Project files + fix R_a --- p3_sandbox/Project.toml | 2 +- p3_sandbox/p3_sandbox.jl | 20 +++++++++++++------- parcel/Project.toml | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/p3_sandbox/Project.toml b/p3_sandbox/Project.toml index 5fbddd66e4..f05e751c68 100644 --- a/p3_sandbox/Project.toml +++ b/p3_sandbox/Project.toml @@ -11,4 +11,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c" [compat] -CLIMAParameters = "0.7.12" +CLIMAParameters = "0.8" diff --git a/p3_sandbox/p3_sandbox.jl b/p3_sandbox/p3_sandbox.jl index be7c676f20..b95c637de0 100644 --- a/p3_sandbox/p3_sandbox.jl +++ b/p3_sandbox/p3_sandbox.jl @@ -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 @@ -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 @@ -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ₐ @@ -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) @@ -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 diff --git a/parcel/Project.toml b/parcel/Project.toml index 5fbddd66e4..f05e751c68 100644 --- a/parcel/Project.toml +++ b/parcel/Project.toml @@ -11,4 +11,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c" [compat] -CLIMAParameters = "0.7.12" +CLIMAParameters = "0.8"