Skip to content

Commit

Permalink
Merge pull request #191 from CliMA/ck/fix_density_arg
Browse files Browse the repository at this point in the history
Remove unused argument in virtual_temperature
  • Loading branch information
charleskawczynski authored Feb 6, 2024
2 parents edb0afc + 3561fcb commit 1508238
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/relations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2345,7 +2345,7 @@ The dry potential temperature, given a thermodynamic state `ts`.
) where {FT <: AbstractFloat, phase_type <: ThermodynamicState}
q_tot = RH * q_vap_saturation(param_set, T, ρ, phase_type)
q_pt = PhasePartition_equil(param_set, T, ρ, q_tot, phase_type)
return virtual_temperature(param_set, T, ρ, q_pt)
return virtual_temperature(param_set, T, q_pt)
end
"""
temperature_and_humidity_given_TᵥρRH(param_set, T_virt, ρ, RH)
Expand Down Expand Up @@ -2568,20 +2568,18 @@ given a thermodynamic state `ts`.
)

"""
virtual_temperature(param_set, T, ρ[, q::PhasePartition])
virtual_temperature(param_set, T[, q::PhasePartition])
The virtual temperature where
- `param_set` an `AbstractParameterSet`, see the [`Thermodynamics`](@ref) for more details
- `T` temperature
- `ρ` (moist-)air density
and, optionally,
- `q` [`PhasePartition`](@ref). Without this argument, the results are for dry air.
"""
@inline function virtual_temperature(
param_set::APS,
T::FT,
ρ::FT,
q::PhasePartition{FT} = q_pt_0(FT),
) where {FT <: Real}
R_d::FT = TP.R_d(param_set)
Expand All @@ -2598,7 +2596,6 @@ given a thermodynamic state `ts`.
virtual_temperature(
param_set,
air_temperature(param_set, ts),
air_density(param_set, ts),
PhasePartition(param_set, ts),
)

Expand Down
4 changes: 2 additions & 2 deletions test/relations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ end

# Test virtual temperature and inverse functions:
_R_d = FT(TP.R_d(param_set))
T_virt = virtual_temperature.(param_set, T, ρ, q_pt)
T_virt = virtual_temperature.(param_set, T, q_pt)
@test all(T_virt gas_constant_air.(param_set, q_pt) ./ _R_d .* T)

T_rec_qpt_rec =
Expand All @@ -1318,7 +1318,7 @@ end
@test all(
isapprox.(
T_virt,
virtual_temperature.(param_set, T_rec, ρ, q_pt_rec),
virtual_temperature.(param_set, T_rec, q_pt_rec),
atol = sqrt(eps(FT)),
),
)
Expand Down

0 comments on commit 1508238

Please sign in to comment.