@@ -139,11 +139,6 @@ function implicit_tendency_bc!(Yₜ, Y, p, t)
139139 return nothing
140140end
141141
142- function thermo_state (thermo_params, ᶜρ, ᶜρe_tot, ᶜK, grav, ᶜz)
143- return @. lazy (
144- TD. PhaseDry_ρe (thermo_params, ᶜρ, ᶜρe_tot / ᶜρ - ᶜK - Φ (grav, ᶜz)),
145- )
146- end
147142
148143function ᶜimplicit_tendency_bc (ᶜY, ᶠY, p, t)
149144 (; rayleigh_sponge, dt, zmax, thermo_params) = p
@@ -158,10 +153,11 @@ function ᶜimplicit_tendency_bc(ᶜY, ᶠY, p, t)
158153 ᶠu₃ = ᶠY. u₃
159154
160155 ᶜK = compute_kinetic (ᶜuₕ, ᶠu₃)
161- ᶜts = thermo_state (thermo_params, ᶜρ, ᶜρe_tot, ᶜK, grav, ᶜz)
162- ᶜp = @. lazy (TD. air_pressure (thermo_params, ᶜts))
156+ ᶜe_int = @. lazy (ᶜρe_tot / ᶜρ - ᶜK - Φ (grav, ᶜz))
157+ ᶜT = @. lazy (TD. air_temperature (thermo_params, ᶜe_int))
158+ ᶜp = @. lazy (TD. air_pressure (thermo_params, ᶜT, ᶜρ))
163159 ᶜh_tot =
164- @. lazy (TD. total_specific_enthalpy (thermo_params, ᶜts, ᶜρe_tot / ᶜρ))
160+ @. lazy (TD. total_enthalpy (thermo_params, ᶜρe_tot / ᶜρ, ᶜT ))
165161 # Central advection of active tracers (e_tot and q_tot)
166162 ᶠuₕ³ = @. lazy (ᶠwinterp (ᶜρ * ᶜJ, CT3 (ᶜuₕ)))
167163 ᶠu³ = @. lazy (ᶠuₕ³ + CT3 (ᶠu₃))
@@ -183,8 +179,9 @@ function ᶠimplicit_tendency_bc(ᶜY, ᶠY, p, t)
183179 ᶜuₕ = ᶜY. uₕ
184180 ᶠu₃ = ᶠY. u₃
185181 ᶜK = compute_kinetic (ᶜuₕ, ᶠu₃)
186- ᶜts = thermo_state (thermo_params, ᶜρ, ᶜρe_tot, ᶜK, grav, ᶜz)
187- ᶜp = @. lazy (TD. air_pressure (thermo_params, ᶜts))
182+ ᶜe_int = @. lazy (ᶜρe_tot / ᶜρ - ᶜK - Φ (grav, ᶜz))
183+ ᶜT = @. lazy (TD. air_temperature (thermo_params, ᶜe_int))
184+ ᶜp = @. lazy (TD. air_pressure (thermo_params, ᶜT, ᶜρ))
188185 bc1 = @. lazy (- (ᶠgradᵥ (ᶜp) / ᶠinterp (ᶜρ) + ᶠgradᵥ (Φ (grav, ᶜz))))
189186 bc2 = @. lazy (- β_rayleigh_w (rayleigh_sponge, ᶠz, zmax) * ᶠu₃)
190187 return @. lazy (ᶠtendencies (bc1 + bc2))
199196
200197function set_precomputed_quantities! (Y, p, t)
201198 (; thermo_params) = p
202- (; ᶜu, ᶠu³, ᶠu, ᶜK, ᶜts , ᶜp) = p. precomputed
199+ (; ᶜu, ᶠu³, ᶠu, ᶜK, ᶜT , ᶜp) = p. precomputed
203200
204201 ᶜρ = Y. c. ρ
205202 ᶜuₕ = Y. c. uₕ
@@ -211,16 +208,13 @@ function set_precomputed_quantities!(Y, p, t)
211208 ᶠu³ .= compute_ᶠuₕ³ (ᶜuₕ, ᶜρ) .+ CT3 .(ᶠu₃)
212209 ᶜK .= compute_kinetic (ᶜuₕ, ᶠu₃)
213210
214- @. ᶜts = TD. PhaseDry_ρe (
215- thermo_params,
216- Y. c. ρ,
217- Y. c. ρe_tot / Y. c. ρ - ᶜK - Φ (grav, ᶜz),
218- )
219- @. ᶜp = TD. air_pressure (thermo_params, ᶜts)
211+ ᶜe_int = @. Y. c. ρe_tot / Y. c. ρ - ᶜK - Φ (grav, ᶜz)
212+ @. ᶜT = TD. air_temperature (thermo_params, ᶜe_int)
213+ @. ᶜp = TD. air_pressure (thermo_params, ᶜT, Y. c. ρ)
220214
221215 (; ᶜh_tot) = p. precomputed
222216 @. ᶜh_tot =
223- TD. total_specific_enthalpy (thermo_params, ᶜts, Y. c. ρe_tot / Y. c. ρ)
217+ TD. total_enthalpy (thermo_params, Y. c. ρe_tot / Y. c. ρ, ᶜT )
224218 return nothing
225219end
226220
@@ -300,7 +294,7 @@ precomputed = (;
300294 ᶠu³ = Fields. Field (CT3{FT}, ᶠspace),
301295 ᶜp = Fields. Field (FT, ᶜspace),
302296 ᶜK = Fields. Field (FT, ᶜspace),
303- ᶜts = Fields. Field (TD . PhaseDry{FT} , ᶜspace),
297+ ᶜT = Fields. Field (FT , ᶜspace),
304298 ᶠu = Fields. Field (C123{FT}, ᶠspace),
305299 ᶜu = Fields. Field (C123{FT}, ᶜspace),
306300)
0 commit comments