Skip to content

Commit a5b3951

Browse files
authored
Merge pull request #1233 from CliMA/js/canopy-params
Add convenience constructors for canopy model components
2 parents 35d7d60 + e7f9ec3 commit a5b3951

File tree

5 files changed

+406
-4
lines changed

5 files changed

+406
-4
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ClimaLand.jl Release Notes
33

44
main
55
-------
6+
- Add constructors with default values for Canopy components PR[#1233](https://github.com/CliMA/ClimaLand.jl/pull/1233)
67

78
v0.17.2
89
-------

src/standalone/Vegetation/Canopy.jl

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,289 @@ include("./canopy_parameterizations.jl")
4747
using Dates
4848
include("./autotrophic_respiration.jl")
4949
include("./spatially_varying_parameters.jl")
50+
51+
########################################################
52+
# Convenience constructors for Canopy model components
53+
########################################################
54+
55+
## Autotrophic respiration models
56+
"""
57+
AutotrophicRespirationModel{FT}() where {FT <: AbstractFloat}
58+
59+
Creates a AutotrophicRespirationModel using default parameters of type FT.
60+
"""
61+
function AutotrophicRespirationModel{FT}() where {FT <: AbstractFloat}
62+
parameters = AutotrophicRespirationParameters(FT)
63+
return AutotrophicRespirationModel{FT, typeof(parameters)}(parameters)
64+
end
65+
66+
## Energy models
67+
"""
68+
BigLeafEnergyModel{FT}(; ac_canopy = FT(2e3)) where {FT <: AbstractFloat}
69+
70+
Creates a BigLeafEnergyModel using default parameters of type FT.
71+
72+
The following default parameter is used:
73+
- ac_canopy = FT(2e3) (J m^-2 K^-1) - canopy specific heat per area
74+
"""
75+
function BigLeafEnergyModel{FT}(;
76+
ac_canopy::FT = FT(2e3),
77+
) where {FT <: AbstractFloat}
78+
parameters = BigLeafEnergyParameters{FT}(ac_canopy)
79+
return BigLeafEnergyModel{FT, typeof(parameters)}(parameters)
80+
end
81+
82+
## Photosynthesis models
83+
"""
84+
FarquharModel{FT}(
85+
domain;
86+
photosynthesis_parameters = clm_photosynthesis_parameters(
87+
domain.space.surface,
88+
),
89+
pc::FT = -2e6,
90+
sc::FT = 5e-6,
91+
) where {
92+
FT <: AbstractFloat,
93+
MECH <: Union{FT, ClimaCore.Fields.Field},
94+
VC <: Union{FT, ClimaCore.Fields.Field},
95+
}
96+
97+
Creates a FarquharModel using default parameters of type FT.
98+
99+
The `photosynthesis_parameters` argument is a NamedTuple that contains
100+
- `is_c3`: a Float or Field indicating if plants are C3 (1) or C4 (0) (unitless)
101+
- `Vcmax25`: a Float or Field representing the maximum carboxylation rate at 25C (mol m^-2 s^-1)
102+
By default, these parameters are set by the `clm_photosynthesis_parameters` function,
103+
which reads in CLM data onto the surface space as ClimaUtilities SpaceVaryingInputs.
104+
105+
The following additional default parameters are used:
106+
- sc = 5e-6 (Pa^{-1}) - sensitivity to low water pressure in the moisture stress factor [Tuzet et al. (2003)]
107+
- pc = -2e6 (Pa) - reference water pressure for the moisture stress factor [Tuzet et al. (2003)]
108+
"""
109+
function FarquharModel{FT}(
110+
domain;
111+
photosynthesis_parameters = clm_photosynthesis_parameters(
112+
domain.space.surface,
113+
),
114+
sc::FT = FT(5e-6),
115+
pc::FT = FT(-2e6),
116+
) where {FT <: AbstractFloat}
117+
(; is_c3, Vcmax25) = photosynthesis_parameters
118+
parameters = FarquharParameters(FT, is_c3; Vcmax25, sc, pc)
119+
return FarquharModel{FT, typeof(parameters)}(parameters)
120+
end
121+
122+
## Plant hydraulics models
123+
"""
124+
PlantHydraulicsModel{FT}(
125+
domain,
126+
forcing::NamedTuple;
127+
n_stem::Int = 0,
128+
n_leaf::Int = 1,
129+
h_stem::FT = FT(0),
130+
h_leaf::FT = FT(1),
131+
SAI::FT = FT(0),
132+
RAI::FT = FT(1),
133+
ai_parameterization = PrescribedSiteAreaIndex{FT}(forcing.LAI, SAI, RAI),
134+
ν::FT = FT(1.44e-4),
135+
S_s::FT = FT(1e-2 * 0.0098), # m3/m3/MPa to m3/m3/m
136+
conductivity_model = Weibull{FT}(
137+
K_sat = FT(7e-8),
138+
ψ63 = FT(-4 / 0.0098),
139+
c = FT(4),
140+
),
141+
retention_model = LinearRetentionCurve{FT}(a = FT(0.05 * 0.0098)),
142+
rooting_depth = clm_rooting_depth(domain.space.surface),
143+
transpiration = PlantHydraulics.DiagnosticTranspiration{FT}(),
144+
) where {FT <: AbstractFloat}
145+
146+
Creates a PlantHydraulicsModel on the provided domain, using default parameters.
147+
148+
The required argument `forcing` should be a NamedTuple with the following field:
149+
- `LAI`: a function or ClimaUtilities TimeVaryingInput for leaf area index
150+
151+
The following default parameters are used:
152+
- n_stem = 0 (unitless) - number of stem compartments
153+
- n_leaf = 1 (unitless) - number of leaf compartments
154+
- h_stem = 0 (m) - height of the stem compartment
155+
- h_leaf = 1 (m) - height of the leaf compartment
156+
- SAI = 0 (m2/m2) - stem area index
157+
- RAI = 1 (m2/m2) - root area index
158+
- ν = 1.44e-4 (m3/m3) - porosity
159+
- S_s = 1e-2 * 0.0098 (m⁻¹) - storativity
160+
- K_sat = 7e-8 (m/s) - saturated hydraulic conductivity
161+
- ψ63 = -4 / 0.0098 (MPa to m) - xylem percentage loss of conductivity curve parameters; Holtzman's original value
162+
- c = 4 (unitless) - Weibull parameter; Holtzman's original value
163+
- a = 0.05 * 0.0098 (m) - bulk modulus of elasticity; Holtzman's original value
164+
165+
Citation:
166+
Holtzman, N., Wang, Y., Wood, J. D., Frankenberg, C., & Konings, A. G. (2023).
167+
Constraining plant hydraulics with microwave radiometry in a land surface model:
168+
Impacts of temporal resolution. Water Resources Research, 59, e2023WR035481.
169+
https://doi.org/10.1029/2023WR035481
170+
"""
171+
function PlantHydraulicsModel{FT}(
172+
domain,
173+
forcing::NamedTuple;
174+
n_stem::Int = 0,
175+
n_leaf::Int = 1,
176+
h_stem::FT = FT(0),
177+
h_leaf::FT = FT(1),
178+
SAI::FT = FT(0),
179+
RAI::FT = FT(1),
180+
ai_parameterization = PlantHydraulics.PrescribedSiteAreaIndex{FT}(
181+
forcing.LAI,
182+
SAI,
183+
RAI,
184+
),
185+
ν::FT = FT(1.44e-4),
186+
S_s::FT = FT(1e-2 * 0.0098), # m3/m3/MPa to m3/m3/m
187+
conductivity_model = PlantHydraulics.Weibull{FT}(
188+
FT(7e-8), # K_sat
189+
FT(-4 / 0.0098), # ψ63
190+
FT(4), # c
191+
),
192+
retention_model = PlantHydraulics.LinearRetentionCurve{FT}(
193+
FT(0.05 * 0.0098), # a
194+
),
195+
rooting_depth = clm_rooting_depth(domain.space.surface),
196+
transpiration = PlantHydraulics.DiagnosticTranspiration{FT}(),
197+
) where {FT <: AbstractFloat}
198+
@assert n_stem >= 0 "Stem number must be non-negative"
199+
@assert n_leaf >= 0 "Leaf number must be non-negative"
200+
@assert h_stem >= 0 "Stem height must be non-negative"
201+
@assert h_leaf >= 0 "Leaf height must be non-negative"
202+
203+
zmax = FT(0)
204+
compartment_midpoints =
205+
n_stem > 0 ? [h_stem / 2, h_stem + h_leaf / 2] : [h_leaf / 2]
206+
compartment_surfaces =
207+
n_stem > 0 ? [zmax, h_stem, h_stem + h_leaf] : [zmax, h_leaf]
208+
209+
parameters = PlantHydraulics.PlantHydraulicsParameters(;
210+
ai_parameterization,
211+
ν,
212+
S_s,
213+
conductivity_model,
214+
retention_model,
215+
rooting_depth,
216+
)
217+
return PlantHydraulics.PlantHydraulicsModel{FT}(;
218+
n_stem,
219+
n_leaf,
220+
compartment_midpoints,
221+
compartment_surfaces,
222+
parameters,
223+
transpiration,
224+
)
225+
end
226+
227+
## Radiative transfer models
228+
"""
229+
TwoStreamModel{FT}(
230+
domain;
231+
radiation_parameters = clm_canopy_radiation_parameters(domain.space.surface),
232+
ϵ_canopy = LP.get_default_parameter(FT, :canopy_emissivity),
233+
n_layers::Int = 20,
234+
)
235+
236+
Creates a Two Stream model for canopy radiative transfer on the provided domain.
237+
238+
Spatially-varying parameters are read in from data files in `clm_canopy_radiation_parameters`.`
239+
In particular, this function returns a field for
240+
- clumping index Ω
241+
- albedo and transmissitivy in PAR and NIR bands
242+
- leaf angle distribution G function parameter χl
243+
244+
Canopy emissivity and wavelength per PAR photon are currently treated
245+
as constants; these can be passed in as Floats by kwarg.
246+
Otherwise the default values from ClimaParams.jl are used.
247+
248+
The number of layers in the canopy is set by `n_layers`, which defaults to 20.
249+
"""
250+
function TwoStreamModel{FT}(
251+
domain;
252+
radiation_parameters = clm_canopy_radiation_parameters(
253+
domain.space.surface,
254+
),
255+
ϵ_canopy::FT = LP.get_default_parameter(FT, :canopy_emissivity),
256+
n_layers::Int = 20,
257+
) where {FT <: AbstractFloat}
258+
parameters =
259+
TwoStreamParameters(FT; radiation_parameters..., ϵ_canopy, n_layers)
260+
return TwoStreamModel{FT, typeof(parameters)}(parameters)
261+
end
262+
263+
"""
264+
BeerLambertModel{FT}(
265+
domain;
266+
radiation_parameters = clm_canopy_radiation_parameters(domain.space.surface),
267+
ϵ_canopy::FT = LP.get_default_parameter(FT, :canopy_emissivity),
268+
) where {FT <: AbstractFloat}
269+
270+
Creates a Beer-Lambert model for canopy radiative transfer on the provided domain.
271+
272+
Spatially-varying parameters are read in from data files in `clm_canopy_radiation_parameters`.`
273+
In particular, this function returns a field for
274+
- clumping index Ω
275+
- albedo and transmissitivy in PAR and NIR bands
276+
- leaf angle distribution G function parameter χl
277+
278+
Canopy emissivity and wavelength per PAR photon are currently treated
279+
as constants; these can be passed in as Floats by kwarg.
280+
Otherwise the default values from ClimaParams.jl are used.
281+
"""
282+
function BeerLambertModel{FT}(
283+
domain;
284+
radiation_parameters = clm_canopy_radiation_parameters(
285+
domain.space.surface,
286+
),
287+
ϵ_canopy::FT = LP.get_default_parameter(FT, :canopy_emissivity),
288+
) where {FT <: AbstractFloat}
289+
# Filter out radiation parameters that are not needed for Beer-Lambert model
290+
radiation_parameters = NamedTuple{
291+
filter(
292+
k -> k in (:α_PAR_leaf, :α_NIR_leaf),
293+
keys(radiation_parameters),
294+
),
295+
}(
296+
radiation_parameters,
297+
)
298+
parameters = BeerLambertParameters(FT; radiation_parameters..., ϵ_canopy)
299+
return BeerLambertModel{FT, typeof(parameters)}(parameters)
300+
end
301+
302+
## Stomatal conductance models
303+
"""
304+
MedlynConductanceModel{FT}(;
305+
g0::FT = FT(1e-4),
306+
g1 = clm_medlyn_g1(domain.space.surface),
307+
) where {FT <: AbstractFloat}
308+
309+
Creates a MedlynConductanceModel using default parameters of type FT.
310+
311+
The `conductance_parameters` argument is a NamedTuple that contains
312+
- `g1`: a Float or ClimaCore Field representing the slope parameter (PA^{1/2})
313+
By default, this parameter is set by the `clm_medlyn_g1` function,
314+
which reads in CLM data onto the surface space as a ClimaUtilities SpaceVaryingInput.
315+
316+
The following default parameter is used:
317+
- g0 = FT(1e-4) (mol m^-2 s^-1) - minimum stomatal conductance
318+
"""
319+
function MedlynConductanceModel{FT}(
320+
domain;
321+
g0::FT = FT(1e-4),
322+
g1 = clm_medlyn_g1(domain.space.surface),
323+
) where {FT <: AbstractFloat}
324+
parameters = MedlynConductanceParameters(FT; g0, g1)
325+
return MedlynConductanceModel{FT, typeof(parameters)}(parameters)
326+
end
327+
328+
329+
########################################################
330+
# End component model convenience constructors
331+
########################################################
332+
50333
"""
51334
SharedCanopyParameters{FT <: AbstractFloat, PSE}
52335

src/standalone/Vegetation/PlantHydraulics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function PlantHydraulicsParameters(;
173173
S_s::FT,
174174
conductivity_model,
175175
retention_model,
176-
rooting_depth::Union{Nothing, FT, ClimaCore.Fields.Field},
176+
rooting_depth::Union{FT, ClimaCore.Fields.Field},
177177
) where {FT}
178178
return PlantHydraulicsParameters{
179179
FT,

src/standalone/Vegetation/radiation.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ end
4040
Base.broadcastable(G::CLMGFunction) = tuple(G)
4141

4242
"""
43-
BeerLambertParameters{FT <: AbstractFloat}
43+
BeerLambertParameters{
44+
FT <: AbstractFloat,
45+
G <: Union{AbstractGFunction, ClimaCore.Fields.Field},
46+
F <: Union{FT, ClimaCore.Fields.Field},
47+
}
4448
4549
The required parameters for the Beer-Lambert radiative transfer model.
4650
$(DocStringExtensions.FIELDS)

0 commit comments

Comments
 (0)