Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Add quadratic term to air temp expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Jan 9, 2020
1 parent c87d8f9 commit 8e09c6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Common/MoistThermodynamics/MoistThermodynamics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -927,9 +927,14 @@ and, optionally,
function air_temperature_from_liquid_ice_pottemp(θ_liq_ice::FT, ρ::FT,
q::PhasePartition{FT}=q_pt_0(FT)) where {FT<:Real}

cv = cv_m(q)
cvm = cv_m(q)
cpm = cp_m(q)
R_m = gas_constant_air(q)
return θ_liq_ice **R_m*θ_liq_ice/FT(MSLP))^(R_m/cv) + latent_heat_liq_ice(q)/cv
κ = 1 - cvm/cpm
T_u =*R_m*θ_liq_ice/FT(MSLP))^(R_m/cvm)*θ_liq_ice
T_1 = latent_heat_liq_ice(q)/cvm
T_2 = -κ/(2*T_u)*(latent_heat_liq_ice(q)/cvm)^2
return T_u + T_1 + T_2
end

"""
Expand Down
2 changes: 2 additions & 0 deletions test/Common/MoistThermodynamics/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ end

# Accurate but expensive `LiquidIcePotTempSHumNonEquil` constructor (Non-linear temperature from θ_liq_ice)
T_non_linear = air_temperature_from_liquid_ice_pottemp_non_linear.(θ_liq_ice, ρ, FT(1e-3), 10, q_pt)
T_expansion = air_temperature_from_liquid_ice_pottemp.(θ_liq_ice, ρ, q_pt)
@test all(isapprox.(T_non_linear, T_expansion, rtol=rtol))
e_int_ = internal_energy.(T_non_linear, q_pt)
ts = PhaseNonEquil.(e_int_, ρ, q_pt)
@test all(T_non_linear .≈ air_temperature.(ts))
Expand Down

0 comments on commit 8e09c6d

Please sign in to comment.