Skip to content

Commit 0a873e3

Browse files
authored
documentation for fluxnet sites and global runs (#1288)
1 parent 3a59dd6 commit 0a873e3

36 files changed

+1506
-1037
lines changed

docs/Manifest-v1.11.toml

Lines changed: 175 additions & 38 deletions
Large diffs are not rendered by default.

docs/Manifest.toml

Lines changed: 175 additions & 38 deletions
Large diffs are not rendered by default.

docs/Project.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
33
BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
44
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
55
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
6+
ClimaAnalysis = "29b5916a-a76c-4e73-9657-3c8fd22e65e6"
7+
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
68
ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
9+
ClimaDiagnostics = "1ecacbb8-0713-4841-9a07-eb5aa8a2d53f"
710
ClimaLand = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
811
ClimaLandSimulations = "348a0bd3-1299-4261-8002-d2cd97df6055"
912
ClimaParams = "5c42b081-d73a-476f-9059-fd94b934656c"
@@ -17,6 +20,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
1720
EnsembleKalmanProcesses = "aa8a2aa5-91d8-4396-bcef-d4f2ec43552d"
1821
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
1922
Format = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8"
23+
GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6"
2024
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
2125
Insolation = "e98cc03f-d57e-4e3c-b70c-8d51efe9e0d8"
2226
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
@@ -25,6 +29,7 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
2529
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
2630
MethodAnalysis = "85b6ec6f-f7df-4429-9514-a64bcd9ee824"
2731
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
32+
Poppler_jll = "9c32591e-4766-534b-9725-b71a8799265b"
2833
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
2934
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
3035
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"

docs/list_of_apis.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
apis = [
66
"ClimaLand" => [
7-
"ClimaLand" => "APIs/ClimaLand.md",
8-
"Shared Utilities" =>
9-
["APIs/Simulations.md", "APIs/shared_utilities.md"],
107
"Soil" => [
118
"Soil Energy and Hydrology" => "APIs/Soil.md",
129
"Soil Biogeochemistry" => "APIs/SoilBiogeochemistry.md",
@@ -25,4 +22,7 @@ apis = [
2522
"Bucket Model" => "APIs/Bucket.md",
2623
"Snow Model" => "APIs/Snow.md",
2724
],
25+
"Integrated Models" => "APIs/ClimaLand.md",
26+
"Shared Utilities" =>
27+
["APIs/Simulations.md", "APIs/shared_utilities.md"],
2828
]

docs/list_tutorials.jl

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
tutorials = [
2-
"Running land simulations" => [
3-
"Bucket LSM" => [
4-
"standalone/Bucket/bucket_tutorial.jl",
5-
"standalone/Bucket/coupled_bucket.jl",
6-
],
7-
"Integrated soil+canopy modeling" => [
8-
"Coupled Canopy and Soil" => "integrated/soil_canopy_tutorial.jl",
9-
],
10-
"Handling interactions between model components" => [
11-
"Adjusting boundary conditions for the soil" => "integrated/handling_soil_fluxes.jl",
12-
"Adjusting boundary conditions for the snow" => "integrated/handling_snow_fluxes.jl",
13-
],
14-
],
152
"Running standalone component simulations" => [
16-
"Soil modeling" => [
3+
"Bucket" => "standalone/Bucket/bucket_tutorial.jl",
4+
"Soil" => [
175
"Boundary conditions" => "standalone/Soil/boundary_conditions.jl",
186
"Richards Equation" => "standalone/Soil/richards_equation.jl",
197
"Energy and Hydrology" => "standalone/Soil/soil_energy_hydrology.jl",
@@ -25,22 +13,40 @@ tutorials = [
2513
"Coarse Sand Evaporation" => "standalone/Soil/evaporation.jl",
2614
"Gilat Loess Evaporation" => "standalone/Soil/evaporation_gilat_loess.jl",
2715
"Bare soil site" => "standalone/Soil/sublimation.jl",
16+
"Changing soil parameterizations" => "standalone/Soil/changing_soil_parameterizations.jl",
2817
],
29-
"Canopy modeling" => [
18+
"Canopy" => [
3019
"Standalone Canopy" => "standalone/Canopy/canopy_tutorial.jl",
20+
"Changing canopy parameterizations" => "standalone/Canopy/changing_canopy_parameterizations.jl",
3121
],
32-
"Snow Modeling" => [
33-
"standalone/Snow/base_tutorial.jl",
34-
"standalone/Snow/data_tutorial.jl",
22+
"Snow" => [
23+
"Base tutorial" => "standalone/Snow/base_tutorial.jl",
24+
"Data tutorial" => "standalone/Snow/data_tutorial.jl",
3525
],
3626
],
37-
"Calibrating your ClimaLand model" => [
27+
"Running Fluxnet simulations" => [
28+
"Canopy and soil" => "integrated/soil_canopy_fluxnet_tutorial.jl",
29+
"Canopy, soil, and snow" => "integrated/snowy_land_fluxnet_tutorial.jl",
30+
"Data processing" => "integrated/fluxnet_data.jl",
31+
"Visualization" => "integrated/fluxnet_vis.jl",
32+
],
33+
"Running global simulations" => [
34+
"Bucket" => "global/bucket.jl",
35+
"Snow, soil, canopy" => "global/snowy_land.jl",
36+
],
37+
"Calibrating a ClimaLand model" => [
3838
"Single site perfect model" => "calibration/minimal_working_example.jl",
3939
"Single site observations" => "calibration/minimal_working_example_obs.jl",
4040
],
41+
"Running coupled simulations" =>
42+
["Coupled bucket model" => "standalone/Bucket/coupled_bucket.jl"],
4143
"For model developers" => [
4244
"Intro to standalone models" => "standalone/Usage/model_tutorial.jl",
43-
"Intro to multi-component models" => "standalone/Usage/LSM_single_column_tutorial.jl",
45+
"Intro to multi-component models" => [
46+
"Single column tutorial" => "standalone/Usage/LSM_single_column_tutorial.jl",
47+
"Adjusting boundary conditions for the soil" => "integrated/handling_soil_fluxes.jl",
48+
"Adjusting boundary conditions for the snow" => "integrated/handling_snow_fluxes.jl",
49+
],
4450
"Intro to ClimaLand Domains" => "standalone/Usage/domain_tutorial.jl",
4551
"Intro to forced site-level runs" => "shared_utilities/driver_tutorial.jl",
4652
"Intro to implicit/explicit timestepping" => "shared_utilities/timestepping.jl",

docs/make.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@ include("list_diagnostics.jl")
5252
pages = Any[
5353
"Home" => "index.md",
5454
"Running your first simulation" => "getting_started.md",
55-
"ClimaLand structure" => [
55+
"Tutorials" => tutorials,
56+
"Additional resources" => [
5657
"Model structure" => "model_structure.md",
5758
"Repository structure" => "repo_structure.md",
59+
"Analyzing model output" => [
60+
"Diagnostics" => diagnostics,
61+
"Leaderboard" => "leaderboard/leaderboard.md",
62+
],
63+
"Running on GPU or with MPI" => "architectures.md",
64+
"Calibration" => "calibration.md",
65+
"Restarting a simulation" => "restarts.md",
66+
"Software utilities" => [
67+
"ITime type" => "itime.md",
68+
"Shared utilities" => "shared_utilities.md",
69+
],
70+
"Physical units" => "physical_units.md",
71+
"Model Equations" => standalone_models,
72+
"Julia background" => "julia.md",
5873
],
59-
"Tutorials" => tutorials,
60-
"Standalone models" => standalone_models,
61-
"Analyzing model output" => [
62-
"Diagnostics" => diagnostics,
63-
"Leaderboard" => "leaderboard/leaderboard.md",
64-
],
65-
"Running on GPU or with MPI" => "architectures.md",
66-
"Calibration" => "calibration.md",
67-
"Restarting a simulation" => "restarts.md",
68-
"Software utilities" => [
69-
"ITime type" => "itime.md",
70-
"Shared utilities" => "shared_utilities.md",
71-
],
72-
"Physical units" => "physical_units.md",
73-
"Julia background" => "julia.md",
7474
"APIs" => apis,
7575
"Contributor guide" => "contributing.md",
7676
]

docs/src/APIs/ClimaLand.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
```@meta
44
CurrentModule = ClimaLand
55
```
6-
## LSM Model Types and methods
6+
## Integrated Land Model Types and methods
77

88
```@docs
9-
ClimaLand.LandSoilBiogeochemistry
9+
ClimaLand.LandModel
10+
ClimaLand.SoilCanopyModel
1011
ClimaLand.LandHydrology
12+
ClimaLand.LandSoilBiogeochemistry
13+
ClimaLand.SoilSnowModel
1114
ClimaLand.land_components
1215
ClimaLand.lsm_aux_vars
1316
ClimaLand.lsm_aux_types

docs/src/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ julia> Pkg.add(ClimaLand)
1414
julia> using ClimaLand
1515
```
1616

17-
A typical land simulation employs several different parameterizations to model the various land-surface processes. Let's start our journet into ClimaLand by looking at one of those.
17+
A typical land simulation employs several different parameterizations to model the various land-surface processes. Let's start our journey into ClimaLand by looking at one of those.
1818

1919
### Parameterization
2020

docs/src/tutorials/global/bucket.jl

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# # Global bucket run
2+
3+
# The code sets up and runs the bucket model on a spherical domain,
4+
# using ERA5 data.
5+
6+
# First we import a lot of packages:
7+
import ClimaComms
8+
using ClimaCore
9+
using ClimaUtilities
10+
import Interpolations
11+
import ClimaUtilities.TimeVaryingInputs:
12+
TimeVaryingInput, LinearInterpolation, PeriodicCalendar
13+
ClimaComms.@import_required_backends
14+
import ClimaTimeSteppers as CTS
15+
import ClimaParams as CP
16+
using ClimaLand.Bucket:
17+
BucketModel, BucketModelParameters, PrescribedBaregroundAlbedo
18+
import ClimaLand
19+
import ClimaLand.Parameters as LP
20+
import ClimaLand.Simulations: LandSimulation, solve!
21+
using Dates
22+
using CairoMakie, ClimaAnalysis, GeoMakie, Poppler_jll, Printf, StatsBase
23+
import ClimaLand.LandSimVis as LandSimVis;
24+
25+
# Set the simulation float type, determine the
26+
# context (MPI or on a single node), and device type. Create
27+
# a default output directory for diagnostics.
28+
const FT = Float64;
29+
context = ClimaComms.context()
30+
ClimaComms.init(context)
31+
device = ClimaComms.device()
32+
device_suffix = device isa ClimaComms.CPUSingleThreaded ? "cpu" : "gpu"
33+
root_path = "bucket_longrun_$(device_suffix)"
34+
diagnostics_outdir = joinpath(root_path, "global_diagnostics")
35+
outdir =
36+
ClimaUtilities.OutputPathGenerator.generate_output_path(diagnostics_outdir);
37+
38+
# Set timestep, start_date, stop_date:
39+
Δt = 900.0
40+
start_date = DateTime(2008)
41+
stop_date = DateTime(2009);
42+
43+
# Create the domain - this is intentionally low resolution,
44+
# about 4.5 degrees x 4.5 degrees, to run quickly
45+
# when making the documentation on CPU.
46+
nelements = (20, 7)
47+
depth = FT(3.5)
48+
dz_tuple = FT.((1.0, 0.05))
49+
domain =
50+
ClimaLand.Domains.global_domain(FT; context, nelements, depth, dz_tuple);
51+
52+
# Parameters:
53+
earth_param_set = LP.LandParameters(FT)
54+
α_snow = FT(0.8)
55+
albedo = PrescribedBaregroundAlbedo{FT}(α_snow, domain.space.surface)
56+
bucket_parameters = BucketModelParameters(
57+
FT;
58+
albedo,
59+
σS_c = FT(0.2),
60+
W_f = FT(0.2),
61+
z_0m = FT(1e-3),
62+
z_0b = FT(1e-3),
63+
κ_soil = FT(1.5),
64+
ρc_soil = FT(2e6),
65+
τc = FT(float(Δt)),
66+
);
67+
68+
# Low-resolution forcing data from ERA5 is used here,
69+
# but high-resolution should be used for production runs.
70+
era5_ncdata_path = ClimaLand.Artifacts.era5_land_forcing_data2008_path(;
71+
context,
72+
lowres = true,
73+
)
74+
atmos, radiation = ClimaLand.prescribed_forcing_era5(
75+
era5_ncdata_path,
76+
domain.space.surface,
77+
start_date,
78+
earth_param_set,
79+
FT;
80+
max_wind_speed = 25.0,
81+
time_interpolation_method = LinearInterpolation(PeriodicCalendar()),
82+
regridder_type = :InterpolationsRegridder,
83+
);
84+
85+
# Make the model:
86+
bucket = BucketModel(
87+
parameters = bucket_parameters,
88+
domain = domain,
89+
atmosphere = atmos,
90+
radiation = radiation,
91+
);
92+
93+
# Create a function which sets the initial conditions.
94+
# This should have the argument structure (Y,p,t, model)
95+
# in order to be used by the `LandSimulation` struct, below:
96+
function set_ic!(Y, p, t, bucket)
97+
coords = ClimaCore.Fields.coordinate_field(Y.bucket.T)
98+
T_sfc_0 = 271.0
99+
@. Y.bucket.T = T_sfc_0 + 40 * cosd(coords.lat)^4
100+
Y.bucket.W .= 0.15
101+
Y.bucket.Ws .= 0.0
102+
Y.bucket.σS .= 0.0
103+
end
104+
105+
# Define timestepper and ODE algorithm
106+
timestepper = CTS.RK4()
107+
timestepper = CTS.ExplicitAlgorithm(timestepper);
108+
109+
# Create the simulation and solve it:
110+
simulation = LandSimulation(
111+
start_date,
112+
stop_date,
113+
Δt,
114+
bucket;
115+
set_ic!,
116+
timestepper,
117+
outdir,
118+
);
119+
120+
solve!(simulation);
121+
122+
# Make some plots:
123+
short_names = ["tsfc", "lhf", "shf", "wsoil"]
124+
125+
LandSimVis.make_annual_timeseries(
126+
simulation;
127+
savedir = ".",
128+
short_names,
129+
plot_name = "bucket_annual_timeseries.pdf",
130+
)
131+
# ![](bucket_annual_timeseries.pdf)
132+
133+
LandSimVis.make_heatmaps(
134+
simulation;
135+
savedir = ".",
136+
short_names,
137+
date = stop_date,
138+
plot_name = "bucket_figures.pdf",
139+
)
140+
# ![](bucket_figures.pdf)

0 commit comments

Comments
 (0)