Skip to content

Commit

Permalink
Fix GPU bug from sif model
Browse files Browse the repository at this point in the history
The implementation of the sif model in the Canopy module
broke GPU compatibility. This PR fixes this bug.

This commit also includes an update to the path of LAI artifacts.

Co-authored-by: AlexisRenchon <a.renchon@gmail.com>
Co-authored-by: Sbozzolo <gbozzola@caltech.edu>
  • Loading branch information
AlexisRenchon and Sbozzolo committed Aug 13, 2024
1 parent ac57809 commit 49cfa15
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion experiments/benchmarks/land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ function setup_prob(t0, tf, Δt; nelements = (101, 15))
# or PR #645 for details.
# For now, this clipping is similar to what CLM does.
LAIfunction = TimeVaryingInput(
joinpath(era5_artifact_path, "era5_2021_0.9x1.25_clima.nc"),
joinpath(era5_artifact_path, "era5_lai_2021_0.9x1.25_clima.nc"),
"lai",
surface_space;
reference_date = ref_time,
Expand Down
2 changes: 1 addition & 1 deletion experiments/integrated/global/global_soil_canopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ photosynthesis_args = (;
# Set up plant hydraulics
# Not ideal
LAIfunction = TimeVaryingInput(
joinpath(era5_artifact_path, "era5_2021_0.9x1.25_clima.nc"),
joinpath(era5_artifact_path, "era5_lai_2021_0.9x1.25_clima.nc"),
"lai",
surface_space;
reference_date = ref_time,
Expand Down
3 changes: 2 additions & 1 deletion experiments/long_runs/land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,15 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
)
)
# Set up plant hydraulics

# Note that we clip all values of LAI below 0.05 to zero.
# This is because we currently run into issues when LAI is
# of order eps(FT) in the SW radiation code.
# Please see Issue #644
# or PR #645 for details.
# For now, this clipping is similar to what CLM does.
LAIfunction = TimeVaryingInput(
joinpath(era5_artifact_path, "era5_2021_0.9x1.25_clima.nc"),
joinpath(era5_artifact_path, "era5_lai_2021_0.9x1.25_clima.nc"),
"lai",
surface_space;
reference_date = ref_time,
Expand Down
1 change: 1 addition & 0 deletions src/standalone/Vegetation/optimality_farquhar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,4 @@ function update_photosynthesis!(
@. Rd = dark_respiration(Vcmax25, β, f, ΔHRd, T, To, R)
@. An = net_photosynthesis(Ac, Aj, Rd, β)
end
Base.broadcastable(m::OptimalityFarquharParameters) = tuple(m)
14 changes: 10 additions & 4 deletions src/standalone/Vegetation/solar_induced_fluorescence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,18 @@ function update_SIF!(
T_freeze,
photosynthesis_parameters,
)
(; ΔHJmax, To, θj, ϕ) = photosynthesis_parameters
sif_parameters = sif_model.parameters
@. SIF = compute_SIF_at_a_point(
APAR,
Tc,
Vcmax25,
R,
T_freeze,
photosynthesis_parameters,
ΔHJmax,
To,
θj,
ϕ,
sif_parameters,
)
end
Expand All @@ -95,10 +99,12 @@ function compute_SIF_at_a_point(
Vcmax25::FT,
R::FT,
T_freeze::FT,
photosynthesis_parameters,
sif_parameters,
ΔHJmax::FT,
To::FT,
θj::FT,
ϕ::FT,
sif_parameters::SIFParameters{FT},
) where {FT}
(; ΔHJmax, To, θj, ϕ) = photosynthesis_parameters
Jmax = max_electron_transport(Vcmax25, ΔHJmax, Tc, To, R)
J = electron_transport(APAR, Jmax, θj, ϕ)
(; kf, kd_p1, kd_p2, min_kd, kn_p1, kn_p2, kp, kappa_p1, kappa_p2) =
Expand Down

0 comments on commit 49cfa15

Please sign in to comment.