Skip to content

Commit

Permalink
clip whe condensing
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck committed Sep 4, 2024
1 parent f44d4f7 commit 55111a6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
4 changes: 4 additions & 0 deletions src/shared_utilities/drivers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ function turbulent_fluxes_at_a_point(
SVector{2, FT}(u, 0),
ts_in,
)
q_in::FT = Thermodynamics.total_specific_humidity(thermo_params, ts_in);

# State containers
sc = SurfaceFluxes.ValuesOnly(
Expand Down Expand Up @@ -366,6 +367,9 @@ function turbulent_fluxes_at_a_point(

E0::FT = SurfaceFluxes.evaporation(surface_flux_params, sc, conditions.Ch)
E = E0 * r_ae / (r_sfc + r_ae)
if q_sfc < q_in # condensation breaks things
E *= 0
end
= E / _ρ_liq
H = -ρ_air * cp_m * ΔT / r_ae
LH = _LH_v0 * E
Expand Down
29 changes: 14 additions & 15 deletions src/standalone/Soil/energy_hydrology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -715,14 +715,13 @@ end
"""
function ClimaLand.surface_evaporative_scaling(model::EnergyHydrology{FT}, Y, p) where {FT}
(; ν, θ_r, d_ds, earth_param_set, hydrology_cm) = model.parameters
θ_l_sfc = ClimaLand.top_center_to_surface(p.soil.θ_l)#p.soil.sfc_scratch
# ClimaLand.Domains.linear_interpolation_to_surface!(
# θ_l_sfc,
# p.soil.θ_l,
# model.domain.fields.z,
# model.domain.fields.Δz_top,
# )
# These are non-allocating
θ_l_sfc = p.soil.sfc_scratch
ClimaLand.Domains.linear_interpolation_to_surface!(
θ_l_sfc,
p.soil.θ_l,
model.domain.fields.z,
model.domain.fields.Δz_top,
)
θ_i_sfc = ClimaLand.Domains.top_center_to_surface(Y.soil.θ_i)
hydrology_cm_sfc = ClimaLand.Domains.top_center_to_surface(hydrology_cm)
ν_sfc = ClimaLand.Domains.top_center_to_surface(ν)
Expand All @@ -747,13 +746,13 @@ function ClimaLand.surface_resistance(
t,
) where {FT}
(; ν, θ_r, d_ds, earth_param_set, hydrology_cm) = model.parameters
θ_l_sfc = ClimaLand.Domains.top_center_to_surface(p.soil.θ_l)#p.soil.sfc_scratch
# ClimaLand.Domains.linear_interpolation_to_surface!(
# θ_l_sfc,
# p.soil.θ_l,
# model.domain.fields.z,
# model.domain.fields.Δz_top,
# )
θ_l_sfc = p.soil.sfc_scratch
ClimaLand.Domains.linear_interpolation_to_surface!(
θ_l_sfc,
p.soil.θ_l,
model.domain.fields.z,
model.domain.fields.Δz_top,
)
# These are non-allocating
θ_i_sfc = ClimaLand.Domains.top_center_to_surface(Y.soil.θ_i)
hydrology_cm_sfc = ClimaLand.Domains.top_center_to_surface(hydrology_cm)
Expand Down

0 comments on commit 55111a6

Please sign in to comment.