@@ -356,6 +356,38 @@ function add_sgs_ᶜK!(ᶜK, Y, ᶜρa⁰, ᶠu₃⁰, turbconv_model)
356
356
return nothing
357
357
end
358
358
359
+ # TODO : Remove this.
360
+ @inline function PhaseEquil_ρeq_temporary_overwrite (
361
+ param_set:: TD.APS ,
362
+ ρ:: FT ,
363
+ e_int:: FT ,
364
+ q_tot:: FT ,
365
+ maxiter:: IT = nothing ,
366
+ relative_temperature_tol:: TT = nothing ,
367
+ :: Type{sat_adjust_method} = TD. RS. NewtonsMethod,
368
+ T_guess:: Union{FT, Nothing} = nothing ,
369
+ ) where {FT <: Real , sat_adjust_method, IT <: TD.ITERTYPE , TT <: TD.TOLTYPE }
370
+ maxiter === nothing && (maxiter = 8 )
371
+ relative_temperature_tol === nothing &&
372
+ (relative_temperature_tol = FT (1e-4 ))
373
+ phase_type = TD. PhaseEquil{FT}
374
+ q_tot_safe = clamp (q_tot, 0 , 1 ) # clamp(q_tot, FT(0), FT(1))
375
+ T = TD. saturation_adjustment (
376
+ sat_adjust_method,
377
+ param_set,
378
+ e_int,
379
+ ρ,
380
+ q_tot_safe,
381
+ phase_type,
382
+ maxiter,
383
+ relative_temperature_tol,
384
+ T_guess,
385
+ )
386
+ q_pt = TD. PhasePartition_equil (param_set, T, ρ, q_tot_safe, phase_type)
387
+ p = TD. air_pressure (param_set, T, ρ, q_pt)
388
+ return TD. PhaseEquil {FT} (ρ, p, e_int, q_tot_safe, T)
389
+ end
390
+
359
391
function thermo_state (
360
392
thermo_params;
361
393
ρ = nothing ,
@@ -374,7 +406,7 @@ function thermo_state(
374
406
get_ts (ρ:: Real , :: Nothing , :: Nothing , e_int:: Real , :: Nothing , :: Nothing ) =
375
407
TD. PhaseDry_ρe (thermo_params, ρ, e_int)
376
408
get_ts (ρ:: Real , :: Nothing , :: Nothing , e_int:: Real , q_tot:: Real , :: Nothing ) =
377
- TD. PhaseEquil_ρeq (
409
+ PhaseEquil_ρeq_temporary_overwrite ( # TD.PhaseEquil_ρeq(
378
410
thermo_params,
379
411
ρ,
380
412
e_int,
@@ -490,6 +522,7 @@ NVTX.@annotate function set_implicit_precomputed_quantities!(Y, p, t)
490
522
# @. ᶜK += Y.c.sgs⁰.ρatke / Y.c.ρ
491
523
# TODO : We should think more about these increments before we use them.
492
524
end
525
+ iszero (t) && @show (eltype (Y. c. ρ)) # TODO : Remove this.
493
526
@. ᶜts = ts_gs (thermo_args... , Y. c, ᶜK, ᶜΦ, Y. c. ρ)
494
527
@. ᶜp = TD. air_pressure (thermo_params, ᶜts)
495
528
@. ᶜh_tot = TD. total_specific_enthalpy (
0 commit comments