Skip to content

Commit 1ff837e

Browse files
committed
Add a AbstractSoilMoistureStressModel, 3 methods
This commits adds a portion of Yuchen Li PR #1330, a new Canopy component: AbstractSoilMoistureStressModel, with 3 methods: the existing one (Tuzet) which was previously in PlantHydraulics, a Piecewise method using dry to wet soil moisture, and no moisture stress. Co-authored-by: AlexisRenchon <[email protected]> Co-authored-by: ychnli <[email protected]> [skip ci]
1 parent 6648726 commit 1ff837e

File tree

13 files changed

+702
-153
lines changed

13 files changed

+702
-153
lines changed

experiments/integrated/fluxnet/ozark_pmodel.jl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ dt = Float64(450) # 7.5 minutes
112112
atmos_h,
113113
start_date,
114114
earth_param_set,
115-
FT,
115+
FT;
116+
construct_prescribed_soil = false,
116117
)
117118

118119

@@ -179,6 +180,17 @@ conductance = PModelConductance{FT}()
179180
# Set up photosynthesis
180181
photosynthesis = PModel{FT}()
181182

183+
# Set up soil moisture stress
184+
soil_moisture_stress_params = PiecewiseMoistureStressParameters(
185+
FT;
186+
θ_c = FT(0.60),
187+
θ_w = FT(0.10),
188+
c = FT(1.0),
189+
β0 = FT(1.0),
190+
)
191+
soil_moisture_stress =
192+
PiecewiseMoistureStressModel{FT}(soil_moisture_stress_params)
193+
182194
# Set up plant hydraulics
183195
# Read in LAI from MODIS data
184196
surface_space = land_domain.space.surface;
@@ -222,6 +234,7 @@ canopy = Canopy.CanopyModel{FT}(
222234
radiative_transfer,
223235
photosynthesis,
224236
conductance,
237+
soil_moisture_stress,
225238
hydraulics,
226239
energy,
227240
)
@@ -265,8 +278,9 @@ simulation = LandSimulation(
265278
set_ic!,
266279
updateat,
267280
diagnostics = diags,
268-
);
269-
@time solve!(simulation)
281+
)
282+
283+
@time sol = solve!(simulation)
270284

271285
comparison_data = FluxnetSimulations.get_comparison_data(site_ID, time_offset)
272286
savedir = joinpath(

src/diagnostics/land_compute_methods.jl

Lines changed: 17 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,14 @@ function compute_stomatal_conductance!(
115115
end
116116

117117
function compute_stomatal_conductance!(out, Y, p, t, land_model::CanopyModel)
118-
compute_stomatal_conductance!(out, Y, p, t, land_model, canopy.conductance)
118+
compute_stomatal_conductance!(
119+
out,
120+
Y,
121+
p,
122+
t,
123+
land_model,
124+
land_model.conductance,
125+
)
119126
end
120127

121128
function compute_stomatal_conductance!(
@@ -273,61 +280,6 @@ function compute_leaf_water_potential!(out, Y, p, t, land_model::CanopyModel)
273280
end
274281
end
275282

276-
function compute_moisture_stress_factor!(
277-
out,
278-
Y,
279-
p,
280-
t,
281-
land_model::Union{SoilCanopyModel, LandModel},
282-
)
283-
canopy = land_model.canopy
284-
hydraulics = canopy.hydraulics
285-
n_stem = hydraulics.n_stem
286-
n_leaf = hydraulics.n_leaf
287-
n = n_stem + n_leaf
288-
289-
earth_param_set = canopy.parameters.earth_param_set
290-
grav = LP.grav(earth_param_set)
291-
ρ_l = LP.ρ_cloud_liq(earth_param_set)
292-
(; sc, pc) = canopy.photosynthesis.parameters
293-
ψ = p.canopy.hydraulics.ψ
294-
if isnothing(out)
295-
out = zeros(land_model.canopy.domain.space.surface) # Allocates
296-
fill!(field_values(out), NaN)
297-
@. out = moisture_stress(ψ.:($$n) * ρ_l * grav, sc, pc)
298-
return out
299-
else
300-
@. out = moisture_stress(ψ.:($$n) * ρ_l * grav, sc, pc)
301-
end
302-
end
303-
function compute_moisture_stress_factor!(
304-
out,
305-
Y,
306-
p,
307-
t,
308-
land_model::Union{CanopyModel},
309-
)
310-
canopy = land_model
311-
hydraulics = canopy.hydraulics
312-
n_stem = hydraulics.n_stem
313-
n_leaf = hydraulics.n_leaf
314-
n = n_stem + n_leaf
315-
316-
earth_param_set = canopy.parameters.earth_param_set
317-
grav = LP.grav(earth_param_set)
318-
ρ_l = LP.ρ_cloud_liq(earth_param_set)
319-
(; sc, pc) = canopy.photosynthesis.parameters
320-
ψ = p.canopy.hydraulics.ψ
321-
if isnothing(out)
322-
out = zeros(land_model.canopy.domain.space.surface) # Allocates
323-
fill!(field_values(out), NaN)
324-
@. out = moisture_stress(ψ.:($$n) * ρ_l * grav, sc, pc)
325-
return out
326-
else
327-
@. out = moisture_stress(ψ.:($$n) * ρ_l * grav, sc, pc)
328-
end
329-
end
330-
331283
# @diagnostic_compute "flux_per_ground_area" Union{SoilCanopyModel, LandModel} p.canopy.hydraulics.fa # return a Tuple
332284
@diagnostic_compute "root_flux_per_ground_area" Union{
333285
SoilCanopyModel,
@@ -340,6 +292,13 @@ end
340292
CanopyModel,
341293
} p.canopy.hydraulics.area_index.leaf
342294

295+
# Canopy - Soil moisture stress
296+
@diagnostic_compute "moisture_stress_factor" Union{
297+
SoilCanopyModel,
298+
LandModel,
299+
CanopyModel,
300+
} p.canopy.soil_moisture_stress.βm
301+
343302
# Canopy - Hydraulics
344303
@diagnostic_compute "root_area_index" Union{
345304
SoilCanopyModel,
@@ -574,8 +533,8 @@ end # Convert from kg C to mol CO2.
574533

575534
## Other ##
576535
@diagnostic_compute "sw_albedo" Union{SoilCanopyModel, LandModel} p.α_sfc
577-
@diagnostic_compute "lw_up" Union{SoilCanopyModel, LandModel} p.LW_u
578-
@diagnostic_compute "sw_up" Union{SoilCanopyModel, LandModel} p.SW_u
536+
@diagnostic_compute "lw_up" Union{SoilCanopyModel, LandModel, CanopyModel} p.LW_u
537+
@diagnostic_compute "sw_up" Union{SoilCanopyModel, LandModel, CanopyModel} p.SW_u
579538
@diagnostic_compute "surface_runoff" Union{SoilCanopyModel, LandModel} p.soil.R_s
580539
@diagnostic_compute "subsurface_runoff" Union{SoilCanopyModel, LandModel} p.soil.R_ss
581540

src/integrated/land.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ function LandModel{FT}(;
184184
energy_model = PrescribedCanopyTempModel{FT}()
185185
end
186186

187+
if :soil_moisture_stress in propertynames(canopy_component_types)
188+
soil_moisture_stress_model =
189+
canopy_component_types.soil_moisture_stress(
190+
canopy_component_args.soil_moisture_stress...,
191+
)
192+
else
193+
@info "No soil moisture stress model provided, using NoMoistureStressModel (βm = 1.0)"
194+
soil_moisture_stress_model =
195+
ClimaLand.Canopy.NoMoistureStressModel{FT}()
196+
end
197+
187198
canopy = Canopy.CanopyModel{FT}(;
188199
autotrophic_respiration = canopy_component_types.autotrophic_respiration(
189200
canopy_component_args.autotrophic_respiration...,
@@ -197,6 +208,7 @@ function LandModel{FT}(;
197208
conductance = canopy_component_types.conductance(
198209
canopy_component_args.conductance...,
199210
),
211+
soil_moisture_stress = soil_moisture_stress_model,
200212
hydraulics = canopy_component_types.hydraulics(;
201213
transpiration = transpiration,
202214
canopy_component_args.hydraulics...,

0 commit comments

Comments
 (0)