Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisRenchon committed Jul 26, 2024
1 parent c5cb03b commit 04d299b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/standalone/Vegetation/photosynthesis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ export FarquharParameters, FarquharModel, C3, C4
abstract type AbstractPhotosynthesisModel{FT} <: AbstractCanopyComponent{FT} end

"""
SIFModel{FT<:AbstractFloat}
SIFParameters{FT<:AbstractFloat}
The required parameters for the SIF model [give citation].
The required parameters for the SIF parameterisation [give citation].
$(DocStringExtensions.FIELDS)
"""
@kwdef struct SIFModel{
@kwdef struct SIFParameters{
FT <: AbstractFloat,
}
""
Expand Down Expand Up @@ -48,15 +48,15 @@ struct C4 <: AbstractPhotosynthesisMechanism end

abstract type AbstractPhotosynthesisModel{FT} <: AbstractCanopyComponent{FT} end
"""
FarquharParameters{FT<:AbstractFloat, MECH <: AbstractPhotosynthesisMechanism}
FarquharParameters{FT<:AbstractFloat, MECH <: AbstractPhotosynthesisMechanism, SP <: SIFParameters}
The required parameters for the Farquhar photosynthesis model.
$(DocStringExtensions.FIELDS)
"""
Base.@kwdef struct FarquharParameters{
FT <: AbstractFloat,
MECH <: AbstractPhotosynthesisMechanism,
SM <: AbstractSIFModel,
SP <: SIFParameters,
}
"Vcmax at 25 °C (mol CO2/m^2/s)"
Vcmax25::FT
Expand Down Expand Up @@ -95,7 +95,7 @@ Base.@kwdef struct FarquharParameters{
"Photosynthesis mechanism: C3 or C4"
mechanism::MECH
""
sif_model::SM
sif_parameters::SP
end

Base.eltype(::FarquharParameters{FT}) where {FT} = FT
Expand All @@ -106,9 +106,9 @@ struct FarquharModel{FT, FP <: FarquharParameters{FT}} <:
end

function FarquharModel{FT}(
parameters::FarquharParameters{FT}; sif_model = SIFModel{FT}()
parameters::FarquharParameters{FT}; sif_parameters = SIFParameters{FT}()
) where {FT <: AbstractFloat}
return FarquharModel{eltype(parameters), typeof(parameters), typeof(sif_model)}(parameters, sif_model)
return FarquharModel{eltype(parameters), typeof(parameters), typeof(sif_parameters)}(parameters, sif_parameters)
end

ClimaLand.name(model::AbstractPhotosynthesisModel) = :photosynthesis
Expand Down Expand Up @@ -203,11 +203,11 @@ function update_photosynthesis!(
model.parameters,
)
Vcmax25field .= Vcmax25
@. SIF = compute_SIF_at_a_point(APAR, T, Vcmax25, R, model.parameters, model.sifmodel)
@. SIF = compute_SIF_at_a_point(APAR, T, Vcmax25, R, model.parameters, model.sif_parameters)

end
Base.broadcastable(m::AbstractPhotosynthesisMechanism) = tuple(m)
Base.broadcastable(m::FarquharParameters) = tuple(m)
Base.broadcastable(m::SIFModel) = tuple(m)
Base.broadcastable(m::SIFParameters) = tuple(m)

include("./optimality_farquhar.jl")

0 comments on commit 04d299b

Please sign in to comment.