Skip to content

Commit 202130b

Browse files
committed
prep to calibrate model with new IC [skip ci]
1 parent d5b0828 commit 202130b

File tree

9 files changed

+79
-48
lines changed

9 files changed

+79
-48
lines changed

Artifacts.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
[saturated_land_ic]
2+
git-tree-sha1 = "cc2888b590f5158113b54c75eee3e2f797be8956"
3+
4+
[[saturated_land_ic.download]]
5+
sha256 = "d73ec9bf8a20f1c63a0133d483a08e801db9125fda43ab51d080bc0192343f84"
6+
url = "https://caltech.box.com/shared/static/99j3juuj3vnnzy16ye31dsfcx25s71z6.gz"
7+
18
[landsea_mask_30arcseconds]
29
git-tree-sha1 = "517c925535981f9d17ac9e7a65e2c35c3ce9597d"
310

experiments/calibration/models/snowy_land.jl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,24 @@ function setup_model(
6363
scf,
6464
)
6565

66+
ground = ClimaLand.PrognosticGroundConditions{FT}()
67+
canopy_forcing = (; atmos, radiation, ground)
68+
photosynthesis = PModel{FT}(domain, toml_dict)
69+
conductance = PModelConductance{FT}(toml_dict)
70+
soil_moisture_stress =
71+
ClimaLand.Canopy.PiecewiseMoistureStressModel{FT}(domain, toml_dict)
72+
canopy = ClimaLand.Canopy.CanopyModel{FT}(
73+
surface_domain,
74+
canopy_forcing,
75+
LAI,
76+
toml_dict;
77+
prognostic_land_components = (:canopy, :snow, :soil, :soilco2),
78+
photosynthesis,
79+
conductance,
80+
soil_moisture_stress,
81+
)
6682
# Construct the land model with all default components except for snow
67-
land = LandModel{FT}(forcing, LAI, toml_dict, domain, Δt; snow)
83+
land = LandModel{FT}(forcing, LAI, toml_dict, domain, Δt; snow, canopy)
6884
return land
6985
end
7086

experiments/calibration/run_calibration.jl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,30 @@ import JLD2
1111
include(joinpath(pkgdir(ClimaLand), "experiments/calibration/api.jl"))
1212

1313
const CALIBRATE_CONFIG = CalibrateConfig(;
14-
short_names = ["lwu"],
14+
short_names = ["lwu", "shf", "lhf"],
1515
minibatch_size = 1,
16-
n_iterations = 1,
17-
sample_date_ranges = [("2007-12-1", "2007-12-1")],
16+
n_iterations = 10,
17+
sample_date_ranges = [
18+
("$(2000 + 2*i)-12-1", "$(2002 + 2*i)-9-1") for i in 0:9
19+
], # 2000 to 2020
1820
extend = Dates.Month(3),
19-
spinup = Dates.Month(0),
21+
spinup = Dates.Month(3),
2022
nelements = (180, 360, 15),
2123
output_dir = "experiments/calibration/land_model",
2224
rng_seed = 42,
23-
obs_vec_filepath = "experiments/calibration/land_observation_vector.jld2",
25+
obs_vec_filepath = "/glade/derecho/scratch/kdeck/recalibrate_saturated",
2426
model_type = ClimaLand.LandModel,
2527
)
2628

2729

2830
if abspath(PROGRAM_FILE) == @__FILE__
29-
# true solution is at 0.96
30-
priors =
31-
[EKP.constrained_gaussian("emissivity_bare_soil", 0.82, 0.12, 0.0, 2.0)]
31+
priors = [
32+
EKP.constrained_gaussian("moisture_stress_c", 1.0, 0.5, 0, 2),
33+
EKP.constrained_gaussian("pmodel_cstar", 0.41, 0.11, 0, Inf),
34+
EKP.constrained_gaussian("pmodel_β", 146, 10, 0, Inf),
35+
EKP.constrained_gaussian("canopy_u0", 100, 90, 0, Inf),
36+
EKP.constrained_gaussian("ac_canopy", 3.5e4, 2e4, 2.5e3, 2.5e5),
37+
]
3238
prior = EKP.combine_distributions(priors)
3339

3440
observation_vector = JLD2.load_object(CALIBRATE_CONFIG.obs_vec_filepath)

experiments/long_runs/snowy_land_pmodel.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ function setup_model(
6969
surface_domain = ClimaLand.Domains.obtain_surface_domain(domain)
7070
surface_space = domain.space.surface
7171
# Forcing data - high resolution
72+
use_lowres_forcing = true
7273
atmos, radiation = ClimaLand.prescribed_forcing_era5(
7374
start_date,
7475
stop_date,
@@ -77,6 +78,7 @@ function setup_model(
7778
FT;
7879
max_wind_speed = 25.0,
7980
context,
81+
use_lowres_forcing,
8082
)
8183
forcing = (; atmos, radiation)
8284

src/Artifacts.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import ClimaUtilities.ClimaArtifacts: @clima_artifact
66

77
import LazyArtifacts
88

9+
function saturated_land_ic_path(; context = nothing)
10+
dir = @clima_artifact("saturated_land_ic", context)
11+
return joinpath(dir, "saturated_land_ic.nc")
12+
end
13+
914
"""
1015
soil_ic_2008_50m_path(; context)
1116

src/shared_utilities/Domains.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,8 +1247,8 @@ end
12471247
apply_mask = true,
12481248
mask_threshold = 0.5,
12491249
nelements = (101, 15),
1250-
dz_tuple = (10.0, 0.05),
1251-
depth = 50.0,
1250+
dz_tuple = (3.0, 0.05),
1251+
depth = 15.0,
12521252
npolynomial = 0,
12531253
context = ClimaComms.context(),
12541254
filepath = landseamask_file_path(;context),

src/simulations/Simulations.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ end
7070
model;
7171
outdir = ".",
7272
set_ic! = make_set_initial_state_from_file(
73-
ClimaLand.Artifacts.soil_ic_2008_50m_path(;
73+
ClimaLand.Artifacts.saturated_land_ic_path(;
7474
context = ClimaComms.context(model),
7575
),
7676
model,
@@ -116,7 +116,7 @@ function LandSimulation(
116116
model;
117117
outdir = ".",
118118
set_ic! = make_set_initial_state_from_file(
119-
ClimaLand.Artifacts.soil_ic_2008_50m_path(;
119+
ClimaLand.Artifacts.saturated_land_ic_path(;
120120
context = ClimaComms.context(model),
121121
),
122122
model,

src/simulations/initial_conditions.jl

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ function set_soil_initial_conditions!(
4949
regridder_kwargs = (; extrapolation_bc, interpolation_method),
5050
)
5151

52-
Y.soil.ϑ_l .= enforce_residual_constraint.(Y.soil.ϑ_l, θ_r)
53-
Y.soil.ϑ_l .= enforce_porosity_constraint.(Y.soil.ϑ_l, ν)
54-
Y.soil.θ_i .=
55-
enforce_residual_constraint.(Y.soil.θ_i, eltype(Y.soil.θ_i)(0))
56-
Y.soil.θ_i .= enforce_porosity_constraint.(Y.soil.ϑ_l, Y.soil.θ_i, ν)
52+
# Y.soil.ϑ_l .= enforce_residual_constraint.(Y.soil.ϑ_l, θ_r)
53+
# Y.soil.ϑ_l .= enforce_porosity_constraint.(Y.soil.ϑ_l, ν)
54+
# Y.soil.θ_i .=
55+
# enforce_residual_constraint.(Y.soil.θ_i, eltype(Y.soil.θ_i)(0))
56+
# Y.soil.θ_i .= enforce_porosity_constraint.(Y.soil.ϑ_l, Y.soil.θ_i, ν)
5757
ρc_s =
5858
ClimaLand.Soil.volumetric_heat_capacity.(
5959
Y.soil.ϑ_l,
@@ -68,21 +68,21 @@ function set_soil_initial_conditions!(
6868
regridder_type,
6969
regridder_kwargs = (; extrapolation_bc, interpolation_method),
7070
)
71-
T =
72-
ClimaLand.Soil.temperature_from_ρe_int.(
73-
Y.soil.ρe_int,
74-
Y.soil.θ_i,
75-
ρc_s,
76-
soil.parameters.earth_param_set,
77-
)
78-
T .= clip_to_bounds.(T, T_bounds[1], T_bounds[2])
79-
Y.soil.ρe_int .=
80-
ClimaLand.Soil.volumetric_internal_energy.(
81-
Y.soil.θ_i,
82-
ρc_s,
83-
T,
84-
soil.parameters.earth_param_set,
85-
)
71+
# T =
72+
# ClimaLand.Soil.temperature_from_ρe_int.(
73+
# Y.soil.ρe_int,
74+
# Y.soil.θ_i,
75+
# ρc_s,
76+
# soil.parameters.earth_param_set,
77+
# )
78+
# T .= clip_to_bounds.(T, T_bounds[1], T_bounds[2])
79+
# Y.soil.ρe_int .=
80+
# ClimaLand.Soil.volumetric_internal_energy.(
81+
# Y.soil.θ_i,
82+
# ρc_s,
83+
# T,
84+
# soil.parameters.earth_param_set,
85+
# )
8686
return nothing
8787
end
8888

@@ -247,20 +247,12 @@ function make_set_initial_state_from_file(
247247
# to soil potential (soil moisture), averaged over the soil layers,
248248
# which would correspond to approximate steady state
249249
if land.canopy.hydraulics isa ClimaLand.Canopy.PlantHydraulicsModel
250-
@. p.soil.ψ = ClimaLand.Soil.pressure_head(
251-
land.soil.parameters.hydrology_cm,
252-
land.soil.parameters.θ_r,
253-
Y.soil.ϑ_l,
254-
land.soil.parameters.ν - Y.soil.θ_i,
255-
land.soil.parameters.S_s,
256-
)
257-
ψ_roots = ClimaCore.Fields.zeros(axes(Y.canopy.hydraulics.ϑ_l.:1))
258-
z = land.soil.domain.fields.z
259-
tmp = @. ClimaLand.Canopy.root_distribution(
260-
z,
261-
land.canopy.biomass.rooting_depth,
262-
) * p.soil.ψ / land.soil.domain.fields.depth
263-
ClimaCore.Operators.column_integral_definite!(ψ_roots, tmp)
250+
ψ_roots = SpaceVaryingInput(
251+
ic_path,
252+
"lwp",
253+
land.snow.domain.space.surface;
254+
regridder_type,
255+
regridder_kwargs = (; extrapolation_bc, interpolation_method))
264256
Y.canopy.hydraulics.ϑ_l.:1 .=
265257
ClimaLand.Canopy.PlantHydraulics.inverse_water_retention_curve.(
266258
land.canopy.hydraulics.parameters.retention_model,

src/standalone/Soil/Soil.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ function EnergyHydrology{FT}(
278278
runoff;
279279
prognostic_land_components,
280280
)
281-
bottom_bc = EnergyWaterFreeDrainage()
281+
bottom_water_flux = WaterFluxBC((p, t) -> 0.0)
282+
bottom_heat_flux = HeatFluxBC((p, t) -> 0.0)
283+
bottom_bc =
284+
WaterHeatBC(; water = bottom_water_flux, heat = bottom_heat_flux)
282285
boundary_conditions = (; top = top_bc, bottom = bottom_bc)
283286
# sublimation and subsurface runoff are added automatically
284287
sources = (additional_sources..., PhaseChange{FT}())

0 commit comments

Comments
 (0)