Skip to content
Snippets Groups Projects
Commit 6c704afb authored by Brian Groenke's avatar Brian Groenke
Browse files

Update docs and examples

parent 5fa60d99
No related branches found
No related tags found
1 merge request!57Add support for per-layer callbacks
...@@ -75,7 +75,7 @@ out = @time solve(prob, Euler(), dt=120.0, saveat=6*3600.0, progress=true) |> Cr ...@@ -75,7 +75,7 @@ out = @time solve(prob, Euler(), dt=120.0, saveat=6*3600.0, progress=true) |> Cr
plot(out.T[Z(Near(zs))], color=cg[LinRange(0.0,1.0,length(zs))]', ylabel="Temperature", leg=false) plot(out.T[Z(Near(zs))], color=cg[LinRange(0.0,1.0,length(zs))]', ylabel="Temperature", leg=false)
``` ```
Note that `SoilHeat` uses energy as the state variable by default. To use temperature as the state variable instead: Note that `SoilHeatColumn` uses energy as the state variable by default. To use temperature as the state variable instead:
```julia ```julia
# :T is the variable name for temperature, :H represents enthalpy/energy. # :T is the variable name for temperature, :H represents enthalpy/energy.
......
...@@ -15,7 +15,6 @@ const modules = [ ...@@ -15,7 +15,6 @@ const modules = [
CryoGrid.Land, CryoGrid.Land,
CryoGrid.Presets, CryoGrid.Presets,
CryoGrid.Diagnostics, CryoGrid.Diagnostics,
CryoGrid.Callbacks,
] ]
makedocs(modules=modules, makedocs(modules=modules,
...@@ -39,7 +38,6 @@ makedocs(modules=modules, ...@@ -39,7 +38,6 @@ makedocs(modules=modules,
], ],
"Land" => "api/land.md", "Land" => "api/land.md",
"Diagnostics" => "api/diagnostics.md", "Diagnostics" => "api/diagnostics.md",
"Callbacks" => "api/callbacks.md",
"Presets" => "api/presets.md", "Presets" => "api/presets.md",
], ],
"Contributing" => "contributing.md", "Contributing" => "contributing.md",
......
# Callbacks
```@autodocs
Modules = [CryoGrid.Callbacks]
Private = false
Order = [:type, :function, :macro]
```
\ No newline at end of file
...@@ -4,9 +4,11 @@ using Plots ...@@ -4,9 +4,11 @@ using Plots
forcings = loadforcings(CryoGrid.Presets.Forcings.Samoylov_ERA_obs_fitted_1979_2014_spinup_extended_2044, :Tair => u"°C"); forcings = loadforcings(CryoGrid.Presets.Forcings.Samoylov_ERA_obs_fitted_1979_2014_spinup_extended_2044, :Tair => u"°C");
# use air temperature as upper boundary forcing; # use air temperature as upper boundary forcing;
tair = TimeSeriesForcing(ustrip.(forcings.data.Tair), forcings.timestamps, :Tair); tair = TimeSeriesForcing(ustrip.(forcings.data.Tair), forcings.timestamps, :Tair);
# use default profiles for samoylov
soilprofile, tempprofile = CryoGrid.Presets.SamoylovDefault
# "simple" heat conduction model w/ 5 cm grid spacing (defaults to free water freezing scheme) # "simple" heat conduction model w/ 5 cm grid spacing (defaults to free water freezing scheme)
grid = CryoGrid.Presets.DefaultGrid_5cm grid = CryoGrid.Presets.DefaultGrid_5cm
model = CryoGrid.Presets.SoilHeatColumn(:H, TemperatureGradient(tair), CryoGrid.Presets.SamoylovDefault; grid=grid) model = CryoGrid.Presets.SoilHeatColumn(:H, TemperatureGradient(tair), soilprofile; grid=grid)
# define time span # define time span
tspan = (DateTime(2010,10,30),DateTime(2011,10,30)) tspan = (DateTime(2010,10,30),DateTime(2011,10,30))
p = parameters(model) p = parameters(model)
......
...@@ -33,14 +33,14 @@ Lin = TimeSeriesForcing(forcings.data.Lin, forcings.timestamps, :Lin); ...@@ -33,14 +33,14 @@ Lin = TimeSeriesForcing(forcings.data.Lin, forcings.timestamps, :Lin);
Sin = TimeSeriesForcing(forcings.data.Sin, forcings.timestamps, :Sin); Sin = TimeSeriesForcing(forcings.data.Sin, forcings.timestamps, :Sin);
z = 2.; # height [m] for which the forcing variables (Temp, humidity, wind, pressure) are provided z = 2.; # height [m] for which the forcing variables (Temp, humidity, wind, pressure) are provided
tspan = (DateTime(2010,1,1), DateTime(2011,1,1)) tspan = (DateTime(2010,1,1), DateTime(2011,1,1))
soilprofile, tempprofile = CryoGrid.Presets.SamoylovDefault
strat = Stratigraphy( strat = Stratigraphy(
-2.0u"m" => top(SurfaceEnergyBalance(Tair,pr,q,wind,Lin,Sin,z)), -2.0u"m" => top(SurfaceEnergyBalance(Tair,pr,q,wind,Lin,Sin,z)),
# Note: You can change Heat{:H} to Heat{:T} to use temperature as the prognostic state variable. Tuple(z => subsurface(:soil1, Soil(para=para), Heat(:H, freezecurve=SFCC(DallAmico()))) for (z,para) in soilprofile),
0.0u"m" => subsurface(:soil, Soil(soilprofile), Heat{:H}(freezecurve=SFCC(DallAmico()))), 1000.0u"m" => bottom(GeothermalHeatFlux(0.053u"J/s/m^2")),
1000.0u"m" => bottom(GeothermalHeatFlux(0.053u"J/s/m^2"))
); );
grid = Grid(gridvals); grid = Grid(gridvals);
model = Tile(strat,grid); model = Tile(strat, grid);
# define time span # define time span
tspan = (DateTime(2010,10,30),DateTime(2011,10,30)) tspan = (DateTime(2010,10,30),DateTime(2011,10,30))
p = parameters(model) p = parameters(model)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment