Skip to content

Commit faad475

Browse files
committed
improve model setup
1 parent dd84c3c commit faad475

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/simulations/model_setup.jl

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
"""
22
EnergyHydrology(FT, domain, earth_param_set, forcing, prognostic_land_components;
3-
runoff_model = ClimaLand.Soil.Runoff.TOPMODELRunoff{FT}(f_over = FT(3.28), # extract from EPS
4-
R_sb = FT(1.484e-4 / 1000),# extract from EPS
3+
runoff_model = ClimaLand.Soil.Runoff.TOPMODELRunoff{FT}(f_over = FT(3.28),
4+
R_sb = FT(1.484e-4 / 1000),
55
f_max = topmodel_fmax(domain.space.surface,FT),
66
),
7-
retention_parameters = soil_vangenuchten_parameters(domain.space.subsurface, FT), # Should this be vanGenuchten type?
7+
retention_parameters = soil_vangenuchten_parameters(domain.space.subsurface, FT),
88
composition_parameters = soil_composition_parameters(domain.space.subsurface, FT),
9-
albedo_parameters = clm_soil_albedo_parameters(domain.space.surface, FT), # eventually, can be CLMSoilAlbedo type
10-
S_s = ClimaCore.Fields.zeros(domain.space.subsurface) .+ 1e-3,# extract from EPS or get from file
9+
albedo_parameters = clm_soil_albedo_parameters(domain.space.surface, FT),
10+
S_s = ClimaCore.Fields.zeros(domain.space.subsurface) .+ 1e-3,
11+
top_bc = ClimaLand.Soil.AtmosDrivenFluxBC(forcing.atmos,
12+
forcing.radiation,
13+
runoff_model,
14+
prognostic_land_components,
15+
),
16+
bottom_bc = ClimaLand.Soil.EnergyWaterFreeDrainage()
17+
sources = (ClimaLand.Soil.PhaseChange{FT}(),)
1118
)
1219
1320
Creates a ClimaLand.Soil.EnergyHydrology model with the given float type FT, domain, earth_param_set, forcing, and prognostic land components.
@@ -16,6 +23,8 @@ Default spatially varying parameters (for retention curve parameters, compositio
1623
changed with keyword arguments.
1724
1825
The runoff model is also provided and can be changed with a keyword argument.
26+
27+
Boundary conditions and sources suitable for global runs are also provided as defaults, but can be modified using a keyword argument if you know what you are doing.
1928
"""
2029
function EnergyHydrology(
2130
FT,
@@ -39,23 +48,19 @@ function EnergyHydrology(
3948
FT,
4049
),
4150
albedo_parameters = clm_soil_albedo_parameters(domain.space.surface, FT), # eventually, can be CLMSoilAlbedo type
42-
S_s = ClimaCore.Fields.zeros(domain.space.subsurface) .+ 1e-3,# extract from EPS or get from file
43-
)
51+
S_s = ClimaCore.Fields.zeros(domain.space.subsurface) .+ 1e-3,# extract from EPS or get from file,
4452
top_bc = ClimaLand.Soil.AtmosDrivenFluxBC(
4553
forcing.atmos,
4654
forcing.radiation,
4755
runoff_model,
4856
prognostic_land_components,
49-
)
50-
bottom_bc = ClimaLand.Soil.EnergyWaterFreeDrainage()
57+
),
58+
bottom_bc = ClimaLand.Soil.EnergyWaterFreeDrainage()sources =
59+
(ClimaLand.Soil.PhaseChange{FT}(),),
60+
)
5161
boundary_conditions = (; top = top_bc, bottom = bottom_bc)
52-
# sublimation and subsurface runoff are added automatically
53-
if :canopy prognostic_land_components
54-
sources =
55-
(ClimaLand.RootExtraction{FT}(), ClimaLand.Soil.PhaseChange{FT}())
56-
else
57-
sources = (ClimaLand.Soil.PhaseChange{FT}(),)
58-
end
62+
:canopy prognostic_land_components &&
63+
@assert ClimaLand.RootExtraction{FT}() sources
5964
parameters = ClimaLand.Soil.EnergyHydrologyParameters(
6065
FT;
6166
retention_parameters...,

0 commit comments

Comments
 (0)