Skip to content

Commit

Permalink
Merge pull request #759 from CliMA/tr/spatially-varying-medlynslope
Browse files Browse the repository at this point in the history
Extend the MedlynConductance slope parameter to support SpaceVaryingInput
  • Loading branch information
imreddyTeja authored Sep 10, 2024
2 parents 1e8834c + c018155 commit 1db54a8
Show file tree
Hide file tree
Showing 5 changed files with 830 additions and 770 deletions.
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

0 comments on commit 1db54a8

Please sign in to comment.