Skip to content

Commit 3ecb670

Browse files
committed
use new LandModel constructors in experiments
1 parent c65bc30 commit 3ecb670

File tree

9 files changed

+446
-931
lines changed

9 files changed

+446
-931
lines changed

experiments/benchmarks/snowy_land.jl

Lines changed: 36 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ outdir = "snowy_land_benchmark_$(device_suffix)"
7777
function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
7878
earth_param_set = LP.LandParameters(FT)
7979
domain = ClimaLand.Domains.global_domain(FT; nelements = nelements)
80+
surface_domain = ClimaLand.Domains.obtain_surface_domain(domain)
8081
surface_space = domain.space.surface
81-
subsurface_space = domain.space.subsurface
82-
8382
start_date = DateTime(2008)
83+
8484
# Forcing data
8585
era5_ncdata_path = ClimaLand.Artifacts.era5_land_forcing_data2008_path(;
8686
context,
@@ -94,216 +94,69 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
9494
FT;
9595
time_interpolation_method = time_interpolation_method,
9696
)
97+
forcing = (; atmos, radiation)
9798

98-
(; ν_ss_om, ν_ss_quartz, ν_ss_gravel) =
99-
ClimaLand.Soil.soil_composition_parameters(subsurface_space, FT)
100-
(; ν, hydrology_cm, K_sat, θ_r) =
101-
ClimaLand.Soil.soil_vangenuchten_parameters(subsurface_space, FT)
102-
soil_albedo = Soil.CLMTwoBandSoilAlbedo{FT}(;
103-
ClimaLand.Soil.clm_soil_albedo_parameters(surface_space)...,
104-
)
105-
S_s = ClimaCore.Fields.zeros(subsurface_space) .+ FT(1e-3)
106-
soil_params = Soil.EnergyHydrologyParameters(
107-
FT;
108-
ν,
109-
ν_ss_om,
110-
ν_ss_quartz,
111-
ν_ss_gravel,
112-
hydrology_cm,
113-
K_sat,
114-
S_s,
115-
θ_r,
116-
albedo = soil_albedo,
117-
)
118-
f_over = FT(3.28) # 1/m
119-
R_sb = FT(1.484e-4 / 1000) # m/s
120-
runoff_model = ClimaLand.Soil.Runoff.TOPMODELRunoff{FT}(;
121-
f_over = f_over,
122-
f_max = ClimaLand.Soil.topmodel_fmax(surface_space, FT),
123-
R_sb = R_sb,
124-
)
125-
126-
# Spatially varying canopy parameters from CLM
127-
g1 = ClimaLand.Canopy.clm_medlyn_g1(surface_space)
128-
rooting_depth = ClimaLand.Canopy.clm_rooting_depth(surface_space)
129-
(; is_c3, Vcmax25) =
130-
ClimaLand.Canopy.clm_photosynthesis_parameters(surface_space)
131-
(; Ω, G_Function, α_PAR_leaf, τ_PAR_leaf, α_NIR_leaf, τ_NIR_leaf) =
132-
ClimaLand.Canopy.clm_canopy_radiation_parameters(surface_space)
133-
134-
# Energy Balance model
135-
ac_canopy = FT(2.5e3)
136-
# Plant Hydraulics and general plant parameters
137-
SAI = FT(0.0) # m2/m2
138-
f_root_to_shoot = FT(3.5)
139-
RAI = FT(1.0)
140-
K_sat_plant = FT(5e-9) # m/s # seems much too small?
141-
ψ63 = FT(-4 / 0.0098) # / MPa to m, Holtzman's original parameter value is -4 MPa
142-
Weibull_param = FT(4) # unitless, Holtzman's original c param value
143-
a = FT(0.05 * 0.0098) # Holtzman's original parameter for the bulk modulus of elasticity
144-
conductivity_model =
145-
Canopy.PlantHydraulics.Weibull{FT}(K_sat_plant, ψ63, Weibull_param)
146-
retention_model = Canopy.PlantHydraulics.LinearRetentionCurve{FT}(a)
147-
plant_ν = FT(1.44e-4)
148-
plant_S_s = FT(1e-2 * 0.0098) # m3/m3/MPa to m3/m3/m
149-
n_stem = 0
150-
n_leaf = 1
151-
h_stem = FT(0.0)
152-
h_leaf = FT(1.0)
153-
zmax = FT(0.0)
154-
h_canopy = h_stem + h_leaf
155-
compartment_midpoints =
156-
n_stem > 0 ? [h_stem / 2, h_stem + h_leaf / 2] : [h_leaf / 2]
157-
compartment_surfaces =
158-
n_stem > 0 ? [zmax, h_stem, h_canopy] : [zmax, h_leaf]
159-
160-
z0_m = FT(0.13) * h_canopy
161-
z0_b = FT(0.1) * z0_m
162-
163-
soil_args = (domain = domain, parameters = soil_params)
164-
soil_model_type = Soil.EnergyHydrology{FT}
165-
166-
# Soil microbes model
167-
soilco2_type = Soil.Biogeochemistry.SoilCO2Model{FT}
168-
soilco2_ps = Soil.Biogeochemistry.SoilCO2ModelParameters(FT)
169-
Csom = ClimaLand.PrescribedSoilOrganicCarbon{FT}(TimeVaryingInput((t) -> 5))
170-
171-
soilco2_args = (; domain = domain, parameters = soilco2_ps)
172-
173-
# Now we set up the canopy model, which we set up by component:
174-
# Component Types
175-
canopy_component_types = (;
176-
autotrophic_respiration = Canopy.AutotrophicRespirationModel{FT},
177-
radiative_transfer = Canopy.TwoStreamModel{FT},
178-
photosynthesis = Canopy.FarquharModel{FT},
179-
conductance = Canopy.MedlynConductanceModel{FT},
180-
hydraulics = Canopy.PlantHydraulicsModel{FT},
181-
energy = Canopy.BigLeafEnergyModel{FT},
182-
)
183-
# Individual Component arguments
184-
# Set up autotrophic respiration
185-
autotrophic_respiration_args =
186-
(; parameters = Canopy.AutotrophicRespirationParameters(FT))
187-
# Set up radiative transfer
188-
radiative_transfer_args = (;
189-
parameters = Canopy.TwoStreamParameters(
190-
FT;
191-
Ω,
192-
α_PAR_leaf,
193-
τ_PAR_leaf,
194-
α_NIR_leaf,
195-
τ_NIR_leaf,
196-
G_Function,
197-
)
198-
)
199-
# Set up conductance
200-
conductance_args =
201-
(; parameters = Canopy.MedlynConductanceParameters(FT; g1))
202-
# Set up photosynthesis
203-
photosynthesis_args =
204-
(; parameters = Canopy.FarquharParameters(FT, is_c3; Vcmax25 = Vcmax25))
205-
# Set up plant hydraulics
99+
# Read in LAI from MODIS data
206100
modis_lai_ncdata_path = ClimaLand.Artifacts.modis_lai_multiyear_paths(;
207101
context = nothing,
208102
start_date = start_date + Second(t0),
209103
end_date = start_date + Second(t0) + Second(tf),
210104
)
211-
LAIfunction = ClimaLand.prescribed_lai_modis(
105+
LAI = ClimaLand.prescribed_lai_modis(
212106
modis_lai_ncdata_path,
213107
surface_space,
214108
start_date;
215109
time_interpolation_method = time_interpolation_method,
216110
)
217-
ai_parameterization =
218-
Canopy.PrescribedSiteAreaIndex{FT}(LAIfunction, SAI, RAI)
219-
220-
plant_hydraulics_ps = Canopy.PlantHydraulics.PlantHydraulicsParameters(;
221-
ai_parameterization = ai_parameterization,
222-
ν = plant_ν,
223-
S_s = plant_S_s,
224-
rooting_depth = rooting_depth,
225-
conductivity_model = conductivity_model,
226-
retention_model = retention_model,
227-
)
228-
plant_hydraulics_args = (
229-
parameters = plant_hydraulics_ps,
230-
n_stem = n_stem,
231-
n_leaf = n_leaf,
232-
compartment_midpoints = compartment_midpoints,
233-
compartment_surfaces = compartment_surfaces,
234-
)
235-
236-
energy_args = (parameters = Canopy.BigLeafEnergyParameters{FT}(ac_canopy),)
237-
238-
# Canopy component args
239-
canopy_component_args = (;
240-
autotrophic_respiration = autotrophic_respiration_args,
241-
radiative_transfer = radiative_transfer_args,
242-
photosynthesis = photosynthesis_args,
243-
conductance = conductance_args,
244-
hydraulics = plant_hydraulics_args,
245-
energy = energy_args,
246-
)
247111

248-
# Other info needed
249-
shared_params = Canopy.SharedCanopyParameters{FT, typeof(earth_param_set)}(
250-
z0_m,
251-
z0_b,
252-
earth_param_set,
253-
)
112+
# Overwrite some defaults for the canopy model
113+
# Energy model
114+
ac_canopy = FT(2.5e3)
115+
energy = Canopy.BigLeafEnergyModel{FT}(; ac_canopy)
254116

255-
canopy_model_args = (;
256-
parameters = shared_params,
257-
domain = ClimaLand.obtain_surface_domain(domain),
258-
)
117+
# Roughness lengths
118+
hydraulics = Canopy.PlantHydraulicsModel{FT}(surface_domain, LAI)
119+
h_canopy = hydraulics.compartment_surfaces[end]
120+
z0_m = FT(0.13) * h_canopy
121+
z0_b = FT(0.1) * z0_m
259122

260-
# Snow model
261-
snow_parameters = SnowParameters{FT}(Δt; earth_param_set = earth_param_set)
262-
snow_args = (;
263-
parameters = snow_parameters,
264-
domain = ClimaLand.obtain_surface_domain(domain),
123+
ground = ClimaLand.PrognosticGroundConditions{FT}()
124+
canopy_forcing = (; atmos, radiation, ground)
125+
126+
canopy = ClimaLand.Canopy.CanopyModel{FT}(
127+
surface_domain,
128+
canopy_forcing,
129+
LAI,
130+
earth_param_set;
131+
prognostic_land_components = (:canopy, :snow, :soil, :soilco2),
132+
energy,
133+
hydraulics,
134+
z_0m = z0_m,
135+
z_0b = z0_b,
265136
)
266-
snow_model_type = Snow.SnowModel
267137

268-
land_input = (
269-
atmos = atmos,
270-
radiation = radiation,
271-
runoff = runoff_model,
272-
soil_organic_carbon = Csom,
273-
)
274-
land = LandModel{FT}(;
275-
soilco2_type = soilco2_type,
276-
soilco2_args = soilco2_args,
277-
land_args = land_input,
278-
soil_model_type = soil_model_type,
279-
soil_args = soil_args,
280-
canopy_component_types = canopy_component_types,
281-
canopy_component_args = canopy_component_args,
282-
canopy_model_args = canopy_model_args,
283-
snow_args = snow_args,
284-
snow_model_type = snow_model_type,
285-
)
138+
# Construct land model with all default components
139+
land = LandModel{FT}(forcing, LAI, earth_param_set, domain, Δt; canopy)
286140

287141
Y, p, cds = initialize(land)
288142

143+
# Set initial conditions
144+
(; θ_r, ν, ρc_ds) = land.soil.parameters
289145
@. Y.soil.ϑ_l = θ_r +- θ_r) / 2
290146
Y.soil.θ_i .= 0
291147
T = FT(276.85)
292148
ρc_s =
293149
Soil.volumetric_heat_capacity.(
294150
Y.soil.ϑ_l,
295151
Y.soil.θ_i,
296-
soil_params.ρc_ds,
297-
soil_params.earth_param_set,
152+
ρc_ds,
153+
earth_param_set,
298154
)
299155
Y.soil.ρe_int .=
300-
Soil.volumetric_internal_energy.(
301-
Y.soil.θ_i,
302-
ρc_s,
303-
T,
304-
soil_params.earth_param_set,
305-
)
156+
Soil.volumetric_internal_energy.(Y.soil.θ_i, ρc_s, T, earth_param_set)
306157
Y.soilco2.C .= FT(0.000412) # set to atmospheric co2, mol co2 per mol air
158+
159+
plant_ν = land.canopy.hydraulics.parameters.ν
307160
Y.canopy.hydraulics.ϑ_l.:1 .= plant_ν
308161
evaluate!(Y.canopy.energy.T, atmos.T, t0)
309162

0 commit comments

Comments
 (0)