Skip to content

Commit

Permalink
Use ClimaParameters for EnergyHydrologyParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Mar 1, 2024
1 parent 9336127 commit 3164617
Show file tree
Hide file tree
Showing 20 changed files with 423 additions and 372 deletions.
3 changes: 2 additions & 1 deletion docs/tutorials/integrated/soil_canopy_tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ soil_α_PAR = FT(0.2)
soil_α_NIR = FT(0.4)

soil_domain = land_domain
soil_ps = Soil.EnergyHydrologyParameters{FT}(;
soil_ps = Soil.EnergyHydrologyParameters(
FT;
ν = soil_ν,
ν_ss_om = ν_ss_om,
ν_ss_quartz = ν_ss_quartz,
Expand Down
25 changes: 12 additions & 13 deletions docs/tutorials/standalone/Soil/freezing_front.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,18 @@ using ClimaLand.Soil
import ClimaLand
import ClimaLand.Parameters as LP

# # Preliminary set-up
# Preliminary set-up

# Choose a floating point precision, and get the parameter set, which holds constants used across CliMA models:
FT = Float32
earth_param_set = LP.LandParameters(FT);

# Set the values of other parameters required by the model:
ν = FT(0.535)
K_sat = FT(3.2e-6) # m/s
S_s = FT(1e-3) #inverse meters
vg_n = FT(1.48)
vg_α = FT(1.11) # inverse meters
hcm = vanGenuchten{FT}(; α = vg_α, n = vg_n);
hydrology_cm = vanGenuchten{FT}(; α = vg_α, n = vg_n);
# You could also try the Brooks and Corey model:
#ψb = FT(-0.6)
#c = FT(0.43)
Expand All @@ -109,16 +108,16 @@ hcm = vanGenuchten{FT}(; α = vg_α, n = vg_n);
ν_ss_om = FT(0.3)
ν_ss_quartz = FT(0.7)
ν_ss_gravel = FT(0.0)
params = Soil.EnergyHydrologyParameters{FT}(;
ν = ν,
ν_ss_om = ν_ss_om,
ν_ss_quartz = ν_ss_quartz,
ν_ss_gravel = ν_ss_gravel,
hydrology_cm = hcm,
K_sat = K_sat,
S_s = S_s,
θ_r = θ_r,
earth_param_set = earth_param_set,
params = Soil.EnergyHydrologyParameters(
FT;
ν,
ν_ss_om,
ν_ss_quartz,
ν_ss_gravel,
hydrology_cm,
K_sat,
S_s,
θ_r,
);
# Choose the domain and discretization:
zmax = FT(0)
Expand Down
34 changes: 17 additions & 17 deletions docs/tutorials/standalone/Soil/soil_energy_hydrology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,34 +100,34 @@ earth_param_set = LP.LandParameters(FT);

# # Create the model
# Set the values of other parameters required by the model:
ν = FT(0.395);
ν = 0.395
# Soil solids
# are the components of soil besides water, ice, gases, and air.
# We specify the soil component fractions, relative to all soil solids.
# These do not sum to unity; the remainder is ν_ss_minerals (=0.08, in this case).
ν_ss_quartz = FT(0.92)
ν_ss_om = FT(0.0)
ν_ss_gravel = FT(0.0);
ν_ss_quartz = 0.92
ν_ss_om = 0.0
ν_ss_gravel = 0.0
# Other parameters include the hydraulic conductivity at saturation, the specific
# storage, and the van Genuchten parameters for sand.
# We recommend Chapter 8 of Bonan (2019) for finding parameters
# for other soil types.
Ksat = FT(4.42 / 3600 / 100) # m/s
S_s = FT(1e-3) #inverse meters
Ksat = 4.42 / 3600 / 100 # m/s
S_s = 1e-3 #inverse meters
vg_n = FT(1.89)
vg_α = FT(7.5) # inverse meters
hcm = vanGenuchten{FT}(; α = vg_α, n = vg_n);
θ_r = FT(0.0);
params = Soil.EnergyHydrologyParameters{FT}(;
ν = ν,
ν_ss_om = ν_ss_om,
ν_ss_quartz = ν_ss_quartz,
ν_ss_gravel = ν_ss_gravel,
hydrology_cm = hcm,
hydrology_cm = vanGenuchten{FT}(; α = vg_α, n = vg_n)
θ_r = 0.0
params = Soil.EnergyHydrologyParameters(
FT;
ν,
ν_ss_om,
ν_ss_quartz,
ν_ss_gravel,
hydrology_cm,
K_sat = Ksat,
S_s = S_s,
θ_r = θ_r,
earth_param_set = earth_param_set,
S_s,
θ_r,
);

# We also need to pick a domain on which to solve the equations:
Expand Down
12 changes: 6 additions & 6 deletions experiments/integrated/fluxnet/run_fluxnet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ include(
# Now we set up the model. For the soil model, we pick
# a model type and model args:
soil_domain = land_domain
soil_ps = Soil.EnergyHydrologyParameters{FT}(;
soil_ps = Soil.EnergyHydrologyParameters(
FT;
ν = soil_ν,
ν_ss_om = ν_ss_om,
ν_ss_quartz = ν_ss_quartz,
ν_ss_gravel = ν_ss_gravel,
ν_ss_om,
ν_ss_quartz,
ν_ss_gravel,
hydrology_cm = vanGenuchten{FT}(; α = soil_vg_α, n = soil_vg_n),
K_sat = soil_K_sat,
S_s = soil_S_s,
θ_r = θ_r,
earth_param_set = earth_param_set,
θ_r,
z_0m = z_0m_soil,
z_0b = z_0b_soil,
emissivity = soil_ϵ,
Expand Down
12 changes: 6 additions & 6 deletions experiments/integrated/ozark/conservation/ozark_conservation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ for float_type in (Float32, Float64)
# Now we set up the model. For the soil model, we pick
# a model type and model args:
soil_domain = land_domain
soil_ps = Soil.EnergyHydrologyParameters{FT}(;
soil_ps = Soil.EnergyHydrologyParameters(
FT;
ν = soil_ν,
ν_ss_om = ν_ss_om,
ν_ss_quartz = ν_ss_quartz,
ν_ss_gravel = ν_ss_gravel,
ν_ss_om,
ν_ss_quartz,
ν_ss_gravel,
hydrology_cm = vanGenuchten{FT}(; α = soil_vg_α, n = soil_vg_n),
K_sat = soil_K_sat,
S_s = soil_S_s,
θ_r = θ_r,
earth_param_set = earth_param_set,
θ_r,
z_0m = z_0m_soil,
z_0b = z_0b_soil,
emissivity = soil_ϵ,
Expand Down
21 changes: 10 additions & 11 deletions experiments/standalone/Biogeochemistry/experiment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,20 @@ for (FT, tf) in ((Float32, 2 * dt), (Float64, tf))
S_s = FT(1e-3) #inverse meters
vg_n = FT(2.0)
vg_α = FT(2.6) # inverse meters
hcm = vanGenuchten{FT}(; α = vg_α, n = vg_n)
θ_r = FT(0.1)
ν_ss_om = FT(0.0)
ν_ss_quartz = FT(1.0)
ν_ss_gravel = FT(0.0)
soil_ps = Soil.EnergyHydrologyParameters{FT}(;
ν = ν,
ν_ss_om = ν_ss_om,
ν_ss_quartz = ν_ss_quartz,
ν_ss_gravel = ν_ss_gravel,
hydrology_cm = hcm,
K_sat = K_sat,
S_s = S_s,
θ_r = θ_r,
earth_param_set = earth_param_set,
soil_ps = Soil.EnergyHydrologyParameters(
FT;
ν,
ν_ss_om,
ν_ss_quartz,
ν_ss_gravel,
hydrology_cm = vanGenuchten{FT}(; α = vg_α, n = vg_n),
K_sat,
S_s,
θ_r,
)

zmax = FT(0)
Expand Down
34 changes: 17 additions & 17 deletions experiments/standalone/Soil/evaporation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ for (FT, tf) in ((Float32, 2 * dt), (Float64, tf))
# n and alpha estimated by matching vG curve.
vg_n = FT(10.0)
vg_α = FT(6.0)
hcm = vanGenuchten{FT}(; α = vg_α, n = vg_n)
hydrology_cm = vanGenuchten{FT}(; α = vg_α, n = vg_n)
# Alternative parameters for Brooks Corey water retention model
#ψb = FT(-0.14)
#c = FT(5.5)
Expand Down Expand Up @@ -92,22 +92,22 @@ for (FT, tf) in ((Float32, 2 * dt), (Float64, tf))
zero_flux = FluxBC((p, t) -> 0)
boundary_fluxes =
(; top = top_bc, bottom = (water = zero_flux, heat = zero_flux))
params = ClimaLand.Soil.EnergyHydrologyParameters{FT}(;
ν = ν,
ν_ss_om = ν_ss_om,
ν_ss_quartz = ν_ss_quartz,
ν_ss_gravel = ν_ss_gravel,
hydrology_cm = hcm,
K_sat = K_sat,
S_s = S_s,
θ_r = θ_r,
PAR_albedo = PAR_albedo,
NIR_albedo = NIR_albedo,
emissivity = emissivity,
z_0m = z_0m,
z_0b = z_0b,
earth_param_set = earth_param_set,
d_ds = d_ds,
params = ClimaLand.Soil.EnergyHydrologyParameters(
FT;
ν,
ν_ss_om,
ν_ss_quartz,
ν_ss_gravel,
hydrology_cm,
K_sat,
S_s,
θ_r,
PAR_albedo,
NIR_albedo,
emissivity,
z_0m,
z_0b,
d_ds,
)

#TODO: Run with higher resolution once we have the implicit stepper
Expand Down
Loading

0 comments on commit 3164617

Please sign in to comment.