From 3eac581334efedd96b1a280594913282fb41c250 Mon Sep 17 00:00:00 2001 From: Alexis Renchon Date: Fri, 26 Jul 2024 16:27:57 -0700 Subject: [PATCH] WIP --- experiments/integrated/fluxnet/ozark_pft.jl | 3 +-- ext/CreateParametersExt.jl | 17 ++++++++++------- src/standalone/Vegetation/photosynthesis.jl | 18 +++++++++--------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/experiments/integrated/fluxnet/ozark_pft.jl b/experiments/integrated/fluxnet/ozark_pft.jl index 51fef199d4..92f5ba968b 100644 --- a/experiments/integrated/fluxnet/ozark_pft.jl +++ b/experiments/integrated/fluxnet/ozark_pft.jl @@ -184,9 +184,8 @@ radiative_transfer_args = (; conductance_args = (; parameters = MedlynConductanceParameters(FT; g1)) # Set up photosynthesis # Set up photosynthesis -SP = SIFParameters() photosynthesis_args = - (; parameters = FarquharParameters(FT, Canopy.C3(), SP; Vcmax25 = Vcmax25)) + (; parameters = FarquharParameters(FT, Canopy.C3(); Vcmax25 = Vcmax25)) # Set up plant hydraulics ai_parameterization = PrescribedSiteAreaIndex{FT}(LAIfunction, SAI, RAI) diff --git a/ext/CreateParametersExt.jl b/ext/CreateParametersExt.jl index 70933e5396..7a14b24e25 100644 --- a/ext/CreateParametersExt.jl +++ b/ext/CreateParametersExt.jl @@ -133,17 +133,19 @@ toml_dict = CP.create_toml_dict(Float32); ClimaLand.Canopy.FarquharParameters(toml_dict, ClimaLand.Canopy.C3(); Vcmax25 = 99999999, pc = 444444444) ``` """ -FarquharParameters( +function FarquharParameters( ::Type{FT}, - mechanism, - SIFParameters(); + mechanism; kwargs..., -) where {FT <: AbstractFloat} = - FarquharParameters(CP.create_toml_dict(FT), mechanism, SIFParameters(); kwargs...) +) where {FT <: AbstractFloat} + sif_parameters = SIFParameters{FT}() + FarquharParameters(CP.create_toml_dict(FT), mechanism, sif_parameters; kwargs...) +end function FarquharParameters( toml_dict::CP.AbstractTOMLDict, - mechanism; + mechanism, + sif_parameters; Vcmax25 = 5e-5, kwargs..., ) @@ -168,10 +170,11 @@ function FarquharParameters( parameters = CP.get_parameter_values(toml_dict, name_map, "Land") FT = CP.float_type(toml_dict) MECH = typeof(mechanism) - SP = SIFParameters() + SP = typeof(sif_parameters) return FarquharParameters{FT, MECH, SP}(; mechanism, Vcmax25, + sif_parameters, parameters..., kwargs..., ) diff --git a/src/standalone/Vegetation/photosynthesis.jl b/src/standalone/Vegetation/photosynthesis.jl index 4bf59ba35c..e9ba696630 100644 --- a/src/standalone/Vegetation/photosynthesis.jl +++ b/src/standalone/Vegetation/photosynthesis.jl @@ -10,23 +10,23 @@ $(DocStringExtensions.FIELDS) """ @kwdef struct SIFParameters{FT <: AbstractFloat} "" - kf::FT = 0.05 + kf::FT = FT(0.05) "" - kd_p1::FT = 0.03 + kd_p1::FT = FT(0.03) "" - kd_p2::FT = 0.0273 + kd_p2::FT = FT(0.0273) "" - min_kd::FT = 0.087 + min_kd::FT = FT(0.087) "" - kn_p1::FT = 6.2473 + kn_p1::FT = FT(6.2473) "" - kn_p2::FT = 0.5944 + kn_p2::FT = FT(0.5944) "" - kp::FT = 4.0 + kp::FT = FT(4.0) "" - kappa_p1::FT = 0.045 + kappa_p1::FT = FT(0.045) "" - kappa_p2::FT = 7.85 + kappa_p2::FT = FT(7.85) end abstract type AbstractPhotosynthesisMechanism end