Skip to content

Commit

Permalink
lai clip
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck committed Sep 13, 2024
1 parent b47ef0f commit a0a4f58
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion experiments/long_runs/land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
depth = depth,
nelements = nelements,
npolynomial = 1,
dz_tuple = FT.((10.0, 0.05)),# top layer should ideally be only a few cm!
dz_tuple = FT.((10.0, 0.05)),
)
surface_space = domain.space.surface
subsurface_space = domain.space.subsurface
Expand Down
4 changes: 2 additions & 2 deletions experiments/long_runs/land_region.jl
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (10, 10, 15))
start_date;
output_writer = nc_writer,
output_vars = :short,
average_period = :monthly,
average_period = :daily,
)

diagnostic_handler =
Expand All @@ -638,7 +638,7 @@ end
function setup_and_solve_problem(; greet = false)

t0 = 0.0
tf = 60 * 60.0 * 24 * 365
tf = 60 * 60.0 * 24 * 30
Δt = 900.0
nelements = (10, 10, 15)
if greet
Expand Down
6 changes: 5 additions & 1 deletion src/standalone/Vegetation/PlantHydraulics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ ClimaLand.auxiliary_types(model::PlantHydraulicsModel{FT}) where {FT} = (
ClimaLand.auxiliary_domain_names(::PlantHydraulicsModel) =
(:surface, :surface, :surface, :surface, :surface)


function clip(x::FT, threshold::FT) where {FT}
x > threshold ? x : FT(0)
end
"""
set_canopy_prescribed_field!(component::PlantHydraulics{FT},
p,
Expand All @@ -322,6 +324,8 @@ function ClimaLand.Canopy.set_canopy_prescribed_field!(
) where {FT}
(; LAIfunction, SAI, RAI) = component.parameters.ai_parameterization
evaluate!(p.canopy.hydraulics.area_index.leaf, LAIfunction, floor(t))
p.canopy.hydraulics.area_index.leaf .=
clip.(p.canopy.hydraulics.area_index.leaf, FT(0.05))
@. p.canopy.hydraulics.area_index.stem = SAI
@. p.canopy.hydraulics.area_index.root = RAI
end
Expand Down
8 changes: 3 additions & 5 deletions test/shared_utilities/domains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FT = Float32
face_space = obtain_face_space(shell.space.subsurface)
z_face = ClimaCore.Fields.coordinate_field(face_space).z
@test shell.fields.z_sfc == top_face_to_surface(z_face, shell.space.surface)
Δz_top, Δz_bottom, Δz = get_Δz(shell.fields.z)
Δz_top, Δz_bottom = get_Δz(shell.fields.z)
@test shell.fields.Δz_top == Δz_top
@test shell.fields.Δz_bottom == Δz_bottom
@test shell.radius == radius
Expand Down Expand Up @@ -109,7 +109,7 @@ FT = Float32
face_space = obtain_face_space(box.space.subsurface)
z_face = ClimaCore.Fields.coordinate_field(face_space).z
@test box.fields.z_sfc == top_face_to_surface(z_face, box.space.surface)
Δz_top, Δz_bottom, Δz = get_Δz(box.fields.z)
Δz_top, Δz_bottom = get_Δz(box.fields.z)
@test box.fields.Δz_top == Δz_top
@test box.fields.Δz_bottom == Δz_bottom
box_coords = coordinates(box).subsurface
Expand Down Expand Up @@ -260,9 +260,7 @@ FT = Float32
z_face = ClimaCore.Fields.coordinate_field(face_space).z
@test z_column.fields.z_sfc ==
top_face_to_surface(z_face, z_column.space.surface)
Δz_top, Δz_bottom, Δz = get_Δz(z_column.fields.z)
z = ClimaCore.Fields.coordinate_field(z_column.space.subsurface).z
@test z_column.fields.z == z
Δz_top, Δz_bottom = get_Δz(z_column.fields.z)
@test z_column.fields.Δz_top == Δz_top
@test z_column.fields.Δz_bottom == Δz_bottom
column_coords = coordinates(z_column).subsurface
Expand Down

0 comments on commit a0a4f58

Please sign in to comment.