Skip to content

Commit bcefb53

Browse files
authored
split up parameters and remove ModelSetup (#1211)
1 parent ccc3115 commit bcefb53

30 files changed

+1100
-1032
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+
- ![breaking change][badge-💥breaking] Remove ModelSetup.jl and split spatial parameter functions up PR[#1211](https://github.com/CliMA/ClimaLand.jl/pull/1211)
67
- ![breaking change][badge-💥breaking] Rename all `comms_ctx` to `context` PR[#1207](https://github.com/CliMA/ClimaLand.jl/pull/1207)
78
- Output NaNs in diagnostics where the ocean is PR[#1200](https://github.com/CliMA/ClimaLand.jl/pull/1200)
89
- ![breaking change][badge-💥breaking] Make soil albedo parameterization modular

experiments/benchmarks/bucket.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function setup_prob(t0, tf, Δt; nelements = (200, 7))
7070
dz_tuple = FT.((1.0, 0.05))
7171
depth = FT(3.5)
7272
bucket_domain =
73-
ClimaLand.ModelSetup.global_domain(FT; nelements, dz_tuple, depth)
73+
ClimaLand.Domains.global_domain(FT; nelements, dz_tuple, depth)
7474
start_date = DateTime(2005)
7575

7676
# Initialize parameters

experiments/benchmarks/richards.jl

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,19 @@ outdir = "richards_benchmark_$(device_suffix)"
7575

7676
function setup_prob(t0, tf, Δt; nelements = (101, 15))
7777
dz_tuple = (10.0, 0.1)
78-
domain = ClimaLand.ModelSetup.global_domain(FT; nelements, dz_tuple)
78+
domain = ClimaLand.Domains.global_domain(FT; nelements, dz_tuple)
7979
surface_space = domain.space.surface
8080
subsurface_space = domain.space.subsurface
8181

8282
start_date = DateTime(2008)
83-
spatially_varying_soil_params =
84-
ClimaLand.ModelSetup.default_spatially_varying_soil_parameters(
85-
subsurface_space,
86-
surface_space,
87-
FT,
88-
)
89-
(; ν, hydrology_cm, K_sat, S_s, θ_r, f_max) = spatially_varying_soil_params
83+
(; ν, hydrology_cm, K_sat, θ_r) =
84+
ClimaLand.Soil.soil_vangenuchten_parameters(subsurface_space, FT)
85+
S_s = ClimaCore.Fields.zeros(subsurface_space) .+ FT(1e-3)
9086
f_over = FT(3.28) # 1/m
9187
R_sb = FT(1.484e-4 / 1000) # m/s
9288
runoff_model = ClimaLand.Soil.Runoff.TOPMODELRunoff{FT}(;
9389
f_over = f_over,
94-
f_max = f_max,
90+
f_max = ClimaLand.Soil.topmodel_fmax(surface_space, FT),
9591
R_sb = R_sb,
9692
)
9793
soil_params = ClimaLand.Soil.RichardsParameters(;

experiments/benchmarks/snowy_land.jl

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ outdir = "snowy_land_benchmark_$(device_suffix)"
7676

7777
function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
7878
earth_param_set = LP.LandParameters(FT)
79-
domain = ClimaLand.ModelSetup.global_domain(FT; nelements = nelements)
79+
domain = ClimaLand.Domains.global_domain(FT; nelements = nelements)
8080
surface_space = domain.space.surface
8181
subsurface_space = domain.space.subsurface
8282

@@ -95,33 +95,14 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
9595
time_interpolation_method = time_interpolation_method,
9696
)
9797

98-
spatially_varying_soil_params =
99-
ClimaLand.ModelSetup.default_spatially_varying_soil_parameters(
100-
subsurface_space,
101-
surface_space,
102-
FT,
103-
)
104-
(;
105-
ν,
106-
ν_ss_om,
107-
ν_ss_quartz,
108-
ν_ss_gravel,
109-
hydrology_cm,
110-
K_sat,
111-
S_s,
112-
θ_r,
113-
PAR_albedo_dry,
114-
NIR_albedo_dry,
115-
PAR_albedo_wet,
116-
NIR_albedo_wet,
117-
f_max,
118-
) = spatially_varying_soil_params
119-
albedo = Soil.CLMTwoBandSoilAlbedo{FT}(;
120-
PAR_albedo_dry,
121-
NIR_albedo_dry,
122-
PAR_albedo_wet,
123-
NIR_albedo_wet,
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)...,
124104
)
105+
S_s = ClimaCore.Fields.zeros(subsurface_space) .+ FT(1e-3)
125106
soil_params = Soil.EnergyHydrologyParameters(
126107
FT;
127108
ν,
@@ -132,30 +113,23 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
132113
K_sat,
133114
S_s,
134115
θ_r,
135-
albedo,
116+
albedo = soil_albedo,
136117
)
137118
f_over = FT(3.28) # 1/m
138119
R_sb = FT(1.484e-4 / 1000) # m/s
139120
runoff_model = ClimaLand.Soil.Runoff.TOPMODELRunoff{FT}(;
140121
f_over = f_over,
141-
f_max = f_max,
122+
f_max = ClimaLand.Soil.topmodel_fmax(surface_space, FT),
142123
R_sb = R_sb,
143124
)
144125

145126
# Spatially varying canopy parameters from CLM
146-
clm_parameters = ClimaLand.ModelSetup.clm_canopy_parameters(surface_space)
147-
(;
148-
Ω,
149-
rooting_depth,
150-
is_c3,
151-
Vcmax25,
152-
g1,
153-
G_Function,
154-
α_PAR_leaf,
155-
τ_PAR_leaf,
156-
α_NIR_leaf,
157-
τ_NIR_leaf,
158-
) = clm_parameters
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)
159133

160134
# Energy Balance model
161135
ac_canopy = FT(2.5e3)

experiments/calibration/forward_model_land.jl

Lines changed: 16 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function setup_prob(
7474
z0_snow,
7575
) = params
7676

77-
domain = ClimaLand.ModelSetup.global_domain(FT; nelements = nelements)
77+
domain = ClimaLand.Domains.global_domain(FT; nelements = nelements)
7878
surface_space = domain.space.surface
7979
subsurface_space = domain.space.subsurface
8080

@@ -90,42 +90,14 @@ function setup_prob(
9090
time_interpolation_method = time_interpolation_method,
9191
)
9292

93-
94-
spatially_varying_soil_params =
95-
ClimaLand.ModelSetup.default_spatially_varying_soil_parameters(
96-
subsurface_space,
97-
surface_space,
98-
FT,
99-
)
100-
(;
101-
ν,
102-
ν_ss_om,
103-
ν_ss_quartz,
104-
ν_ss_gravel,
105-
hydrology_cm,
106-
K_sat,
107-
S_s,
108-
θ_r,
109-
PAR_albedo_dry,
110-
NIR_albedo_dry,
111-
PAR_albedo_wet,
112-
NIR_albedo_wet,
113-
f_max,
114-
) = spatially_varying_soil_params
115-
116-
# We need to ensure that the α < 1
117-
# PAR_albedo_dry .=
118-
# min.(PAR_albedo_dry .* α_soil_dry_scaler .* α_soil_scaler, FT(1))
119-
# NIR_albedo_dry .=
120-
# min.(NIR_albedo_dry .* α_soil_dry_scaler .* α_soil_scaler, FT(1))
121-
# PAR_albedo_wet .= min.(PAR_albedo_wet .* α_soil_scaler, FT(1))
122-
# NIR_albedo_wet .= min.(NIR_albedo_wet .* α_soil_scaler, FT(1))
123-
albedo = Soil.CLMTwoBandSoilAlbedo{FT}(;
124-
PAR_albedo_dry,
125-
NIR_albedo_dry,
126-
PAR_albedo_wet,
127-
NIR_albedo_wet,
93+
(; ν_ss_om, ν_ss_quartz, ν_ss_gravel) =
94+
ClimaLand.Soil.soil_composition_parameters(subsurface_space, FT)
95+
(; ν, hydrology_cm, K_sat, θ_r) =
96+
ClimaLand.Soil.soil_vangenuchten_parameters(subsurface_space, FT)
97+
soil_albedo = Soil.CLMTwoBandSoilAlbedo{FT}(;
98+
ClimaLand.Soil.clm_soil_albedo_parameters(surface_space)...,
12899
)
100+
S_s = ClimaCore.Fields.zeros(subsurface_space) .+ FT(1e-3)
129101
soil_params = Soil.EnergyHydrologyParameters(
130102
FT;
131103
ν,
@@ -136,30 +108,23 @@ function setup_prob(
136108
K_sat,
137109
S_s,
138110
θ_r,
139-
albedo,
111+
albedo = soil_albedo,
140112
)
141113
f_over = FT(3.28) # 1/m
142114
R_sb = FT(1.484e-4 / 1000) # m/s
143115
runoff_model = ClimaLand.Soil.Runoff.TOPMODELRunoff{FT}(;
144116
f_over = f_over,
145-
f_max = f_max,
117+
f_max = ClimaLand.Soil.topmodel_fmax(surface_space, FT),
146118
R_sb = R_sb,
147119
)
148120

149121
# Spatially varying canopy parameters from CLM
150-
clm_parameters = ClimaLand.ModelSetup.clm_canopy_parameters(surface_space)
151-
(;
152-
Ω,
153-
rooting_depth,
154-
is_c3,
155-
Vcmax25,
156-
g1,
157-
G_Function,
158-
α_PAR_leaf,
159-
τ_PAR_leaf,
160-
α_NIR_leaf,
161-
τ_NIR_leaf,
162-
) = clm_parameters
122+
g1 = ClimaLand.Canopy.clm_medlyn_g1(surface_space)
123+
rooting_depth = ClimaLand.Canopy.clm_rooting_depth(surface_space)
124+
(; is_c3, Vcmax25) =
125+
ClimaLand.Canopy.clm_photosynthesis_parameters(surface_space)
126+
(; Ω, G_Function, α_PAR_leaf, τ_PAR_leaf, α_NIR_leaf, τ_NIR_leaf) =
127+
ClimaLand.Canopy.clm_canopy_radiation_parameters(surface_space)
163128

164129
#α <= 1
165130
# α_PAR_leaf .= min.(α_leaf_scaler .* α_PAR_leaf, FT(1))

experiments/integrated/global/global_parameters.jl

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
1-
spatially_varying_soil_params =
2-
ClimaLand.ModelSetup.default_spatially_varying_soil_parameters(
3-
subsurface_space,
4-
surface_space,
5-
FT,
6-
)
7-
(;
8-
ν,
9-
ν_ss_om,
10-
ν_ss_quartz,
11-
ν_ss_gravel,
12-
hydrology_cm,
13-
K_sat,
14-
S_s,
15-
θ_r,
16-
PAR_albedo_dry,
17-
NIR_albedo_dry,
18-
PAR_albedo_wet,
19-
NIR_albedo_wet,
20-
f_max,
21-
) = spatially_varying_soil_params
1+
(; ν_ss_om, ν_ss_quartz, ν_ss_gravel) =
2+
ClimaLand.Soil.soil_composition_parameters(subsurface_space, FT)
3+
(; ν, hydrology_cm, K_sat, θ_r) =
4+
ClimaLand.Soil.soil_vangenuchten_parameters(subsurface_space, FT)
225
soil_albedo = Soil.CLMTwoBandSoilAlbedo{FT}(;
23-
PAR_albedo_dry,
24-
NIR_albedo_dry,
25-
PAR_albedo_wet,
26-
NIR_albedo_wet,
6+
ClimaLand.Soil.clm_soil_albedo_parameters(surface_space)...,
277
)
8+
S_s = ClimaCore.Fields.zeros(subsurface_space) .+ FT(1e-3)
289
soil_params = Soil.EnergyHydrologyParameters(
2910
FT;
3011
ν,
@@ -36,30 +17,23 @@ soil_params = Soil.EnergyHydrologyParameters(
3617
S_s,
3718
θ_r,
3819
albedo = soil_albedo,
39-
);
20+
)
4021
f_over = FT(3.28) # 1/m
4122
R_sb = FT(1.484e-4 / 1000) # m/s
4223
runoff_model = ClimaLand.Soil.Runoff.TOPMODELRunoff{FT}(;
4324
f_over = f_over,
44-
f_max = f_max,
25+
f_max = ClimaLand.Soil.topmodel_fmax(surface_space, FT),
4526
R_sb = R_sb,
4627
)
4728

4829

4930
# Spatially varying canopy parameters from CLM
50-
clm_parameters = ClimaLand.ModelSetup.clm_canopy_parameters(surface_space)
51-
(;
52-
Ω,
53-
rooting_depth,
54-
is_c3,
55-
Vcmax25,
56-
g1,
57-
G_Function,
58-
α_PAR_leaf,
59-
τ_PAR_leaf,
60-
α_NIR_leaf,
61-
τ_NIR_leaf,
62-
) = clm_parameters
31+
g1 = ClimaLand.Canopy.clm_medlyn_g1(surface_space)
32+
rooting_depth = ClimaLand.Canopy.clm_rooting_depth(surface_space)
33+
(; is_c3, Vcmax25) =
34+
ClimaLand.Canopy.clm_photosynthesis_parameters(surface_space)
35+
(; Ω, G_Function, α_PAR_leaf, τ_PAR_leaf, α_NIR_leaf, τ_NIR_leaf) =
36+
ClimaLand.Canopy.clm_canopy_radiation_parameters(surface_space)
6337
# Energy Balance model
6438
ac_canopy = FT(2.5e3)
6539
# Plant Hydraulics and general plant parameters

experiments/integrated/global/global_soil_canopy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ FT = Float64
3838
earth_param_set = LP.LandParameters(FT)
3939
nelements = (50, 10)
4040
dz_tuple = (10.0, 0.1)
41-
domain = ClimaLand.ModelSetup.global_domain(FT; nelements, dz_tuple)
41+
domain = ClimaLand.Domains.global_domain(FT; nelements, dz_tuple)
4242
surface_space = domain.space.surface
4343
subsurface_space = domain.space.subsurface
4444

experiments/long_runs/bucket.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,8 @@ function setup_simulation(; greet = false)
107107
# Domain
108108
depth = FT(3.5)
109109
dz_tuple = FT.((1.0, 0.05))
110-
domain = ClimaLand.ModelSetup.global_domain(
111-
FT;
112-
context,
113-
nelements,
114-
depth,
115-
dz_tuple,
116-
)
110+
domain =
111+
ClimaLand.Domains.global_domain(FT; context, nelements, depth, dz_tuple)
117112

118113
# Parameters
119114
params = LP.LandParameters(FT)

0 commit comments

Comments
 (0)