Skip to content

Commit

Permalink
reverts runoff change from PR 993, adds to diagnostics (#1021)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck authored Feb 10, 2025
1 parent ee06c18 commit 3be9828
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ ClimaLand.jl Release Notes

main
-------

- Use MODIS LAI by default in experiments and longruns
PR[#973](https://github.com/CliMA/ClimaLand.jl/pull/973)
- Revert PR993 changes to runoff
PR[#1021](https://github.com/CliMA/ClimaLand.jl/pull/1021)

v0.15.9
-------
Expand Down
3 changes: 3 additions & 0 deletions src/diagnostics/default_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,14 @@ function default_diagnostics(
"swu",
"swd",
"lwu",
"lwd",
"et",
"er",
"sr",
"swe",
"snd",
"shf",
"lhf",
]
end

Expand Down
19 changes: 4 additions & 15 deletions src/standalone/Soil/Runoff/Runoff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,10 @@ end
Computes the soil infiltration capacity on the surface space
for Richards model.
Currently approximates i_c = -K_sat ∂h/∂z at the surface.
Currently approximates i_c = -K_sat at the surface.
"""
function soil_infiltration_capacity(model::RichardsModel, Y, p)
# This computes -K∂h/∂z ≈ -K (0+Δz - ψ)/Δz for the entire column,
# but uses Δz_top. In the end, we then just take the surface value,
# so this is OK.

@. p.soil.subsfc_scratch =
-1 *
model.parameters.K_sat *
(1 - p.soil.ψ / model.domain.fields.Δz_top)
@. p.soil.subsfc_scratch = -1 * model.parameters.K_sat
return ClimaLand.Domains.top_center_to_surface(p.soil.subsfc_scratch)
end

Expand All @@ -335,25 +328,21 @@ end
Computes the soil infiltration capacity on the surface space
for the full soil model.
Currently approximates i_c = -K_sat*F(θ_i)*G(T)∂h/∂z at the surface, where F and G
Currently approximates i_c = -K_sat*F(θ_i)*G(T) at the surface, where F and G
are the functions which adjust the conductivity for the presence ice and taking into
account the temperature dependence of the viscosity of water.
"""
function soil_infiltration_capacity(model::EnergyHydrology, Y, p)
(; K_sat, θ_r, Ω, γ, γT_ref) = model.parameters
surface_space = model.domain.space.surface

# This computes -K∂h/∂z ≈ -K (0+Δz - ψ)/Δz for the entire column,
# but uses Δz_top. In the end, we then just take the surface value,
# so this is OK.
@. p.soil.subsfc_scratch =
-K_sat *
ClimaLand.Soil.impedance_factor(
Y.soil.θ_i / (p.soil.θ_l + Y.soil.θ_i - θ_r),
Ω,
) *
ClimaLand.Soil.viscosity_factor(p.soil.T, γ, γT_ref) *
(1 - p.soil.ψ / model.domain.fields.Δz_top)
ClimaLand.Soil.viscosity_factor(p.soil.T, γ, γT_ref)
return ClimaLand.Domains.top_center_to_surface(p.soil.subsfc_scratch)
end

Expand Down
8 changes: 2 additions & 6 deletions test/standalone/Soil/runoff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ end
model.domain.depth .- p.soil.h∇,
)
ic = ClimaLand.Soil.Runoff.soil_infiltration_capacity(model, Y, p)
ψ_sfc = ClimaLand.Domains.top_center_to_surface(p.soil.ψ)
Δz_top = domain.fields.Δz_top
@test all(parent(ic) .≈ parent(@. -FT(1e-6) * (1 - ψ_sfc / Δz_top)))
@test ic == ClimaCore.Fields.zeros(surface_space) .- FT(1e-6) #Ksat
@test p.soil.infiltration ==
@. ClimaLand.Soil.Runoff.topmodel_surface_infiltration(
p.soil.h∇,
Expand Down Expand Up @@ -258,9 +256,7 @@ end
set_initial_cache! = make_set_initial_cache(model)
set_initial_cache!(p, Y, FT(0))
ic = ClimaLand.Soil.Runoff.soil_infiltration_capacity(model, Y, p)
ψ_sfc = ClimaLand.Domains.top_center_to_surface(p.soil.ψ)
Δz_top = domain.fields.Δz_top
@test all(parent(ic) .≈ parent(@. -FT(1e-6) * (1 - ψ_sfc / Δz_top)))
@test ic == ClimaCore.Fields.zeros(surface_space) .- FT(1e-6) #Ksat
@test p.soil.infiltration ==
ClimaLand.Soil.Runoff.surface_infiltration.(
ic,
Expand Down

0 comments on commit 3be9828

Please sign in to comment.