Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend the MedlynConductance slope parameter to support SpaceVaryingInput #759

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions experiments/benchmarks/land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,21 @@ function setup_prob(t0, tf, Δt; nelements = (101, 15))
# Energy Balance model
ac_canopy = FT(2.5e3)

#clm_data is used for g1 and vcmax maps
clm_artifact_path = ClimaLand.Artifacts.clm_data_folder_path(; context)

# Conductance Model
g1 = FT(141) # Wang et al: 141 sqrt(Pa) for Medlyn model; Natan used 300.
# g1 is read in units of sqrt(kPa) and then converted to sqrt(Pa)
g1 = SpaceVaryingInput(
joinpath(clm_artifact_path, "vegetation_properties_map.nc"),
"medlynslope",
surface_space;
regridder_type,
regridder_kwargs = (; extrapolation_bc,),
file_reader_kwargs = (; preprocess_func = (data) -> data * 10^(3 / 2),),
)

#Photosynthesis model
clm_artifact_path = ClimaLand.Artifacts.clm_data_folder_path(; context)
# vcmax is read in units of umol CO2/m^2/s and then converted to mol CO2/m^2/s
Vcmax25 = SpaceVaryingInput(
joinpath(clm_artifact_path, "vegetation_properties_map.nc"),
Expand Down
14 changes: 12 additions & 2 deletions experiments/long_runs/land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,21 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
# Energy Balance model
ac_canopy = FT(2.5e4) # this will likely be 10x smaller!

#clm_data is used for g1 and vcmax maps
clm_artifact_path = ClimaLand.Artifacts.clm_data_folder_path(; context)

# Conductance Model
g1 = FT(141) # Wang et al: 141 sqrt(Pa) for Medlyn model; Natan used 300.
# g1 is read in units of sqrt(kPa) and then converted to sqrt(Pa)
g1 = SpaceVaryingInput(
joinpath(clm_artifact_path, "vegetation_properties_map.nc"),
"medlynslope",
surface_space;
regridder_type,
regridder_kwargs = (; extrapolation_bc,),
file_reader_kwargs = (; preprocess_func = (data) -> data * 10^(3 / 2),),
)

#Photosynthesis model
clm_artifact_path = ClimaLand.Artifacts.clm_data_folder_path(; context)
# vcmax is read in units of umol CO2/m^2/s and then converted to mol CO2/m^2/s
Vcmax25 = SpaceVaryingInput(
joinpath(clm_artifact_path, "vegetation_properties_map.nc"),
Expand Down
4 changes: 3 additions & 1 deletion ext/CreateParametersExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,9 @@ function MedlynConductanceParameters(

parameters = CP.get_parameter_values(toml_dict, name_map, "Land")
FT = CP.float_type(toml_dict)
return MedlynConductanceParameters{FT}(; g1, parameters..., kwargs...)
g1 = FT.(g1)
G1 = typeof(g1)
return MedlynConductanceParameters{FT, G1}(; g1, parameters..., kwargs...)
end

"""
Expand Down
7 changes: 5 additions & 2 deletions src/standalone/Vegetation/stomatalconductance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ abstract type AbstractStomatalConductanceModel{FT} <:
The required parameters for the Medlyn stomatal conductance model.
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct MedlynConductanceParameters{FT <: AbstractFloat}
Base.@kwdef struct MedlynConductanceParameters{
FT <: AbstractFloat,
G1 <: Union{FT, ClimaCore.Fields.Field},
}
"Relative diffusivity of water vapor (unitless)"
Drel::FT
"Minimum stomatal conductance mol/m^2/s"
g0::FT
"Slope parameter, inversely proportional to the square root of marginal water use efficiency (Pa^{1/2})"
g1::FT
g1::G1
end

Base.eltype(::MedlynConductanceParameters{FT}) where {FT} = FT
Expand Down
Loading
Loading