4
4
# [`previous tutorial`](@ref https://clima.github.io/ClimaLand.jl/dev/generated/soil_plant_hydrology_tutorial/),
5
5
# we demonstrated how to run the canopy model in
6
6
# standalone mode using prescribed values for the inputs of soil moisture
7
+ # and ground temperature
7
8
# into the canopy hydraulics model. However, ClimaLand can also
8
9
# integrate the canopy model with a soil model and timestep the two
9
10
# components together to simulate an interacting canopy-soil system. This tutorial
13
14
# oak-hickory forest in Ozark, Missouri, USA.
14
15
# The focus of this tutorial is to learn the steps towards setting up and
15
16
# running an integrated simulation, and less on the parameterization choices.
16
- # As such, a number of default parameters are implicitly set.
17
+ # As such, the default parameters are implicitly set. To experiment with
18
+ # modularity in the parameters and parameterizations, please see tutorial X.
17
19
18
20
# # Preliminary Setup
19
- import SciMLBase
20
- using Plots
21
- using Statistics
22
21
using Dates
23
- using Insolation
24
- using ClimaCore
25
22
import ClimaParams as CP
26
- import ClimaTimeSteppers as CTS
27
23
using ClimaDiagnostics
28
24
using ClimaLand
29
- using ClimaLand. Domains: Column, obtain_surface_domain
30
- using ClimaLand. Soil
31
- using ClimaLand. Soil. Biogeochemistry
32
- using ClimaLand. Canopy
25
+ using ClimaLand. Domains: Column
33
26
using ClimaLand. Simulations
34
- using ClimaLand. Canopy. PlantHydraulics
35
- import ClimaLand
36
27
import ClimaLand. Parameters as LP
37
28
using DelimitedFiles
38
29
FluxnetSimulationsExt =
@@ -44,13 +35,11 @@ LandSimulationVisualizationExt =
44
35
:LandSimulationVisualizationExt ,
45
36
). LandSimulationVisualizationExt;
46
37
47
- # Define the floating point precision desired (64 or 32 bit), get the
48
- # parameter set holding constants used across CliMA Models, and define
49
- # the components of the integrated model.
38
+ # Define the floating point precision desired (64 or 32 bit), and get the
39
+ # parameter set holding constants used across CliMA Models.
50
40
51
41
const FT = Float32;
52
42
earth_param_set = LP. LandParameters (FT);
53
- prognostic_land_components = (:canopy , :soil , :soilco2 );
54
43
55
44
# We will use prescribed atmospheric and radiative drivers from the
56
45
# US-MOz tower, which we read in here. We also
@@ -61,12 +50,11 @@ lat = FT(38.7441) # degree
61
50
long = FT (- 92.2000 ) # degree
62
51
atmos_h = FT (32 ); # Height of the sensor at the site (m)
63
52
64
- start_date = DateTime (2010 ) + Hour (time_offset) + Day (150 ) # start mid year - in UTC
65
- stop_date = DateTime (2010 ) + Hour (time_offset) + Day (250 ) # end 100 days later - in UTC
66
- Δt = Float64 (450 ); # seconds
67
-
53
+ start_date = DateTime (" 2010-05-01" , " yyyy-mm-dd" ) # in UTC
54
+ stop_date = DateTime (" 2010-09-01" , " yyyy-mm-dd" ) # in UTC
55
+ Δt = 450.0 ; # seconds
68
56
# Forcing data for the site - this uses our interface for working with Fluxnet data
69
- (; atmos, radiation) = FluxnetSimulationsExt. prescribed_forcing_fluxnet (
57
+ forcing = FluxnetSimulationsExt. prescribed_forcing_fluxnet (
70
58
site_ID,
71
59
lat,
72
60
long,
@@ -80,72 +68,25 @@ stop_date = DateTime(2010) + Hour(time_offset) + Day(250) # end 100 days later -
80
68
(LAI, maxLAI) =
81
69
FluxnetSimulationsExt. prescribed_LAI_fluxnet (site_ID, start_date);# eventually just get LAI
82
70
83
- # Setup the domain(s) for the model:
71
+ # Setup the domain for the model:
84
72
zmin = FT (- 2 ) # in m
85
73
zmax = FT (0 ) # in m
86
74
domain = Column (; zlim = (zmin, zmax), nelements = 10 , longlat = (long, lat))
87
- soil_domain = domain # vertically resolved
88
- canopy_domain = ClimaLand. Domains. obtain_surface_domain (domain); # only the surface
89
75
90
- # # Setup the Coupled Canopy and Soil Physics Model
76
+ # # Setup the integrated model
91
77
92
78
# We want to simulate the canopy-soil system together, so the model type
93
79
# [`SoilCanopyModel`](https://clima.github.io/ClimaLand.jl/dev/APIs/ClimaLand/#LSM-Model-Types-and-methods)
94
- # is chosen.
95
-
96
- # For our soil model, we use the
97
- # [`EnergyHydrology`](https://clima.github.io/ClimaLand.jl/dev/APIs/Soil/#Soil-Models-2)
98
- # model. Here we use default parameter choices corresponding to the values taken from global
99
- # maps at the latitude
100
- # and longitude of the site we are modeling. See the
101
- # [tutorial](https://clima.github.io/ClimaLand.jl/dev/generated/Soil/soil_energy_hydrology/)
102
- # on the model for a more detailed explanation of the soil model and how to vary parameter values
103
- # and parameterizations.
104
- soil_forcing = (; atmos, radiation)
105
- soil = Soil. EnergyHydrology {FT} (
106
- soil_domain,
107
- soil_forcing,
108
- earth_param_set;
109
- prognostic_land_components,
110
- additional_sources = (ClimaLand. RootExtraction {FT} (),), # in addition to phase changes
111
- runoff = ClimaLand. Soil. Runoff. SurfaceRunoff (),
112
- );
113
- # We next make the heterotrophic respiration model; again we use
114
- # default parameter values, see the
115
- # [documentation](https://clima.github.io/ClimaLand.jl/previews/PR214/dynamicdocs/pages/soil_biogeochemistry/microbial_respiration/)
116
- # for additional information.
117
- soil_organic_carbon =
118
- ClimaLand. PrescribedSoilOrganicCarbon {FT} (TimeVaryingInput ((t) -> 5 ))# kg C/m^3; eventually this will be read from a file.
119
- co2_prognostic_soil = Soil. Biogeochemistry. PrognosticMet (soil. parameters)
120
- soil_co2_forcing = Soil. Biogeochemistry. SoilDrivers (
121
- co2_prognostic_soil,
122
- soil_organic_carbon,
123
- atmos,
124
- )
125
- soilco2 = Soil. Biogeochemistry. SoilCO2Model {FT} (soil_domain, soil_co2_forcing);
126
-
127
- # Next we set up the [`CanopyModel`](https://clima.github.io/ClimaLand.jl/dev/APIs/canopy/Canopy/#Canopy-Model-Structs).
128
- # For more details on the specifics of this model and it's parameter options,
129
- # see the previous tutorial.
130
- canopy_forcing =
131
- (; atmos, radiation, ground = ClimaLand. PrognosticSoilConditions {FT} ())
132
- canopy = Canopy. CanopyModel {FT} (
133
- canopy_domain,
134
- canopy_forcing,
135
- LAI,
136
- earth_param_set;
137
- prognostic_land_components,
138
- );
139
-
140
- # # Setup and solve the simulation, including a function to set initial conditions, output diagnostics
141
-
142
- land_model = SoilCanopyModel {FT} (soilco2, soil, canopy);
80
+ # is chosen. Here we use the highest level model constructor, which uses default parameters,
81
+ # and parameterizations, for the soil and canopy models.
82
+ # A different tutorial will show you how to change these parameters and parameterizations.
83
+ land_model = SoilCanopyModel {FT} (forcing, LAI, earth_param_set, domain);
143
84
set_ic! = FluxnetSimulationsExt. make_set_fluxnet_initial_conditions (
144
85
site_ID,
145
86
start_date,
146
87
time_offset,
147
88
land_model,
148
- )
89
+ );
149
90
output_vars = [" gpp" , " swu" , " lwu" , " shf" , " lhf" ]
150
91
diagnostics = ClimaLand. default_diagnostics (
151
92
land_model,
@@ -159,18 +100,18 @@ simulation = Simulations.LandSimulation(
159
100
FT,
160
101
start_date,
161
102
stop_date,
162
- Δt,
103
+ Δt, # seconds
163
104
land_model;
164
105
set_ic!,
165
106
user_callbacks = (),
166
107
diagnostics,
167
- )
108
+ );
168
109
solve! (simulation);
169
110
170
111
# # Plotting results
171
112
LandSimulationVisualizationExt. make_diurnal_timeseries (
172
113
simulation;
173
114
short_names = [" gpp" , " shf" , " lhf" , " swu" , " lwu" ],
174
115
spinup_date = start_date + Day (20 ),
175
- )
116
+ );
176
117
# 
0 commit comments