11"""
2- SoilProfile(; bulk_density, mineral_density)
2+ SoilProfile(; bulk_density, mineral_density, hydraulics )
33
4- Per-depth soil column profile read by both the soil properties model
5- (thermal) and the soil hydraulic model. Sized to match `MicroModel.depths`.
4+ Per-depth soil column profile read by the soil properties model (thermal)
5+ and the soil hydraulic model. Sized to match `MicroModel.depths`.
66
77- `bulk_density` — dry soil bulk density (kg/m³) at each depth node
88- `mineral_density` — soil mineral density (kg/m³) at each depth node
9+ - `hydraulics` — per-depth hydraulic parameters (e.g. `CampbellHydraulicProfile`)
10+ matched to the chosen `soil_hydraulic_model`
911"""
10- @kwdef struct SoilProfile{BD,MD}
12+ @kwdef struct SoilProfile{BD,MD,H }
1113 bulk_density:: BD
1214 mineral_density:: MD
15+ hydraulics:: H
1316end
1417
1518function example_soil_profile (depths= DEFAULT_DEPTHS;
1619 bulk_density = 2.56 u " Mg/m^3" ,
1720 mineral_density = 2.560 u " Mg/m^3" ,
21+ hydraulics = example_campbell_hydraulic_profile (depths),
1822)
1923 SoilProfile (;
2024 bulk_density = bulk_density isa AbstractVector ? bulk_density : fill (bulk_density, length (depths)),
2125 mineral_density = mineral_density isa AbstractVector ? mineral_density : fill (mineral_density, length (depths)),
26+ hydraulics,
2227 )
2328end
2429
6469
6570"""
6671 MicroModel(; hours, depths, heights,
67- soil_profile, soil_properties_model, soil_hydraulic_model,
72+ soil_properties_model, soil_hydraulic_model,
6873 radiation=RadiationModel(),
6974 snow_model=NoSnow(),
7075 vapour_pressure_equation=GoffGratch(),
@@ -77,8 +82,6 @@ Constant-across-runs scientific description of the simulation:
7782
7883- solver geometry (`hours`, `depths`, `heights`) # TODO generalise to sub-hourly
7984- physical-process models:
80- - `soil_profile::SoilProfile` — per-depth `bulk_density` and `mineral_density`
81- profiles read by both the soil properties and soil hydraulic models
8285 - `soil_properties_model::AbstractSoilProperties` (e.g. `CampbelldeVriesSoilProperties(...)`)
8386 - `soil_hydraulic_model::AbstractSoilHydraulicsModel` (e.g. `CampbellSoilHydraulics(...)`)
8487 - `radiation::RadiationModel` — bundle of `solar_radiation_model`,
@@ -91,17 +94,12 @@ Constant-across-runs scientific description of the simulation:
9194 (carries the phase-transition `freezing_model` and ODE solver settings)
9295- iteration/data-delivery strategy in `config::MicroConfig`
9396
94- The days of year to simulate live on `MicroProblem`, not here — they're a
95- per-run choice (e.g. monthly mid-month days vs daily 1:365) that can vary
96- without changing the model.
97-
9897Combine with a `MicroInputs` via `MicroProblem(model, inputs; days)` to run.
9998"""
100- @kwdef struct MicroModel{H,Dep,Ht,SPR, SPM,SHM,RAD,SNM,VPE,BLM,EVM,SEM,C}
99+ @kwdef struct MicroModel{H,Dep,Ht,SPM,SHM,RAD,SNM,VPE,BLM,EVM,SEM,C}
101100 hours:: H = DEFAULT_HOURS # hour of day for solar_radiation
102101 depths:: Dep = DEFAULT_DEPTHS # soil nodes - keep spacing close near the surface
103102 heights:: Ht = [0.01 , 2 ]u " m" # air nodes for temperature, wind speed and humidity profile, last height is reference height for weather data
104- soil_profile:: SPR
105103 soil_properties_model:: SPM
106104 soil_hydraulic_model:: SHM
107105 radiation:: RAD = RadiationModel ()
@@ -114,14 +112,20 @@ Combine with a `MicroInputs` via `MicroProblem(model, inputs; days)` to run.
114112end
115113
116114"""
117- MicroInputs(; site, environment_minmax, environment_daily, environment_hourly=nothing,
115+ MicroInputs(; site, soil_profile, environment_minmax, environment_daily,
116+ environment_hourly=nothing,
118117 initial_soil_temperature=nothing, initial_soil_moisture,
119118 initial_snow_depth=0.0u"cm", initial_snow_temperature=u"K"(0.0u"°C"),
120119 initial_snow_density=nothing)
121120
122- Per-run input data: site, environment forcings, and initial conditions.
121+ Per-run input data: site, soil column profile, environment forcings, and
122+ initial conditions.
123123
124124- `site::Site` — properties of the place
125+ - `soil_profile::SoilProfile` — per-depth `bulk_density` and `mineral_density`
126+ read by both the soil properties and soil hydraulic models. Per-location
127+ structural soil-column data; lives here (not on `MicroModel`) because it
128+ varies between sites without changing the physics.
125129- `environment_minmax`, `environment_daily`, `environment_hourly` — input forcings
126130- `initial_*` — initial conditions (`initial_soil_temperature=nothing` falls back to
127131 the day-mean reference air temperature)
@@ -130,8 +134,9 @@ Per-run input data: site, environment forcings, and initial conditions.
130134Pass a fresh `MicroInputs` to `reinit!(cache, inputs)` to re-solve the same
131135model on different data without rebuilding the cache.
132136"""
133- @kwdef struct MicroInputs{S,EMM,EH,ED,IST,ISM,ISD,ISNT,ISND}
137+ @kwdef struct MicroInputs{S,SP <: SoilProfile , EMM,EH,ED,IST,ISM,ISD,ISNT,ISND}
134138 site:: S
139+ soil_profile:: SP
135140 environment_minmax:: EMM
136141 environment_hourly:: EH = nothing
137142 environment_daily:: ED
@@ -176,7 +181,7 @@ function example_microclimate_problem(;
176181 site = example_site (),
177182 soil_profile = example_soil_profile (depths),
178183 soil_properties_model = example_soil_properties_model (),
179- soil_hydraulic_model = example_soil_hydraulic_model (depths ),
184+ soil_hydraulic_model = example_soil_hydraulic_model (),
180185 snow_model = NoSnow (),
181186 environment_minmax = example_monthly_weather (),
182187 environment_daily = example_daily_environment (days),
@@ -185,10 +190,11 @@ function example_microclimate_problem(;
185190 initial_soil_temperature = fill (u " K" (7.741667 u " °C" ), length (depths)),
186191 initial_soil_moisture = fill (0.42 * 0.25 , length (depths)),
187192)
188- model = MicroModel (; hours, depths, heights,
189- soil_profile, soil_properties_model, soil_hydraulic_model, snow_model, config)
193+ model = MicroModel (;
194+ hours, depths, heights, soil_properties_model, soil_hydraulic_model, snow_model, config
195+ )
190196 inputs = MicroInputs (;
191- site, environment_minmax, environment_daily, environment_hourly,
197+ site, soil_profile, environment_minmax, environment_daily, environment_hourly,
192198 initial_soil_temperature, initial_soil_moisture,
193199 )
194200 MicroProblem (model, inputs; days)
0 commit comments