A partial implementation of the CryoGrid permafrost model in Julia, with a focus on parameter estimation and uncertainty quantification.
Part of the broader research project: Quantifying and explaining uncertainty in permafrost modeling under a warming climate
Author: Brian Groenke (brian.groenke@awi.de)
- Fast and modular interface for defining multi-physics permafrost models including:
- Two-phase heat and water transport in porous media (i.e. soil and snow)
- Soil freeze-thaw dynamics from FreezeCurves.jl
- Surface energy balance
- Snow cover
- Salt diffusion
- Flexible interface for model parameter handling via ModelParameters.jl
- Support for automatic differentiation via ForwardDiff.jl
- Compatibility with ODE solvers OrdinaryDiffEq.jl as well as other SciML tools for analyzing dynamical systems
CryoGrid.jl
can be installed via the Julia package manager:
add CryoGrid
or equivalently in code/REPL:
import Pkg
Pkg.add("CryoGrid")
Here we define a multi-layer heat conduction model on the pre-defined soil profile for Samoylov Island.
Make sure that you have the Plots
package installed in addition to CryoGrid
in order to run this example code.
using CryoGrid
using Plots: plot
# load provided forcing data from Samoylov;
# The forcing file will be automatically downloaded to the input/ folder if not already present.
forcings = loadforcings(CryoGrid.Presets.Forcings.Samoylov_ERA_obs_fitted_1979_2014_spinup_extended_2044);
# get preset soil and initial temperature profile for Samoylov
soilprofile, tempprofile = CryoGrid.Presets.SamoylovDefault
initT = initializer(:T, tempprofile)
# choose grid with 5cm spacing
grid = CryoGrid.Presets.DefaultGrid_5cm
# build a default Tile with heat conduction on the given soil profile
tile = CryoGrid.Presets.SoilHeatTile(
TemperatureBC(forcings.Tair),
GeothermalHeatFlux(0.053u"W/m^2"),
soilprofile,
initT,
grid=grid
)
# define time span (1 year)
tspan = (DateTime(2010,11,30),DateTime(2011,11,30))
u0, du0 = initialcondition!(tile, tspan)
# CryoGrid front-end for ODEProblem
prob = CryoGridProblem(tile, u0, tspan, savevars=(:T,))
# solve discretized system, saving every 3 hours
sol = @time solve(prob);
out = CryoGridOutput(sol)
zs = [2,7,12,22,32,42,50,100,500]u"cm"
cg = Plots.cgrad(:copper,rev=true)
plot(out.T[Z(Near(zs))], color=cg[LinRange(0.0,1.0,length(zs))]', ylabel="Temperature", leg=false)
The examples/
folder contains a number of other examples that should help users get started with the model.
In order to run these examples, it is recommended to clone the repository or add it as a development package via the package manager (i.e. dev CryoGrid
instead of add CryoGrid
). In the latter case, you can find the repository in $JULIA_HOME/.dev/CryoGrid
.
Then cd
into the CryoGrid
repository and start julia with the examples
folder set as the project environment; e.g. julia --project=examples
or julia
followed by activate examples
in the package manager.
The package manager will install all additional dependencies needed for the examples (e.g. plotting and analysis packages). After this is finished, you should be able to run all of the examples without issue. If you encounter any errors while running the examples, please create an issue on GitHub so that we can fix it.
CryoGrid Community (MATLAB) | CryoGrid3 (MATLAB) | CryoGridLite | CryoGrid.jl | |
---|---|---|---|---|
Heat conduction (enthalpy based) | โ | โ | โ | โ |
Heat conduction (temperature based) | โ | โ | โ | โ |
Soil freezing characteristics | โ | โ | โ | โ |
Water balance, bucket advection | โ | โ * | โ | โ |
Water balance, Richard's equation | โ | โ | โ | โ |
Snow, bulk (single-layer) | โ | โ | โ | โ |
Snow, multi-layer, constant density | โ | โ | โ | ๐ง |
Snow, multi-layer, w/ microphysics (CROCUS) | โ | โ | โ | โ |
Surface energy balance, iterative | โ | โ | โ | โ |
Surface energy balance, fully coupled | โ | โ | โ | โ |
Evapotranspiration | โ | โ | โ | โ |
Sublimation | โ | โ | โ | โ |
Lake dynamics | โ | โ | โ | ๐ง |
Salt diffusion | โ | โ | โ | โ |
Lateral coupling, heat | โ | โ | โ | โ |
Lateral coupling, water | โ | โ | โ | โ |
Excess ice melt and subsidence | โ | โ | โ | โ |
Excess ice aggradation | โ | โ | โ | โ |
Vegetation dynamics | โ | โ | โ | โ |
Overland flow | โ | โ | โ | โ |
Surface infrastructure | โ | โ | โ | โ |
Arbitrary time-varying boundary conditions | โ | โ | โ | โ |
CryoGrid Community (MATLAB) | CryoGrid3 (MATLAB) | CryoGridLite | CryoGrid.jl | |
---|---|---|---|---|
Modular code structure | โ | โ | โ | โ |
Ensemble simulations | โ | โ | โ | โ |
Data assimilation and/or parameter estimation | โ | โ | โ | โ |
Global sensitivity analysis | โ | โ | โ | โ |
Higher-order numerical solvers | โ | โ | โ | โ |
Automatic differentiation | โ | โ | โ | โ |
Probabilistic programming and uncertainty quantification | โ | โ | โ | โ |
ML emulator integration | โ | โ | โ | ๐ง |
Automated testing framework | โ | โ | โ | โ |
Non-proprietary runtime environment | โ | โ | โ | โ |