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

Merge branch 'refactor/soil-module' into 'master'

Move Soil to Physics module and rename Water -> WaterBalance

See merge request sparcs/cryogrid/cryogridjulia!65
parents 5bf5d9f0 a1df02d4
No related branches found
No related tags found
1 merge request!65Move Soil to Physics module and rename Water -> WaterBalance
name = "CryoGrid"
uuid = "a535b82e-5f3d-4d97-8b0b-d6483f5bebd5"
authors = ["Brian Groenke <brian.groenke@awi.de>", "Moritz Langer <moritz.langer@awi.de>"]
version = "0.5.8"
version = "0.6.0"
[deps]
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
......
......@@ -7,10 +7,11 @@ const modules = [
CryoGrid,
CryoGrid.Utils,
CryoGrid.Numerics,
CryoGrid.Layers,
CryoGrid.Physics,
CryoGrid.Boundaries,
CryoGrid.HeatConduction,
CryoGrid.WaterBalance,
CryoGrid.Soils,
CryoGrid.SEB,
CryoGrid.Strat,
CryoGrid.Presets,
......@@ -34,6 +35,8 @@ makedocs(modules=modules,
"Utilities" => "api/utils.md",
"Physics" => [
"Heat Conduction" => "api/heat_conduction.md",
"Water Balance" => "api/water_balance.md",
"Soils" => "api/soils.md",
"Surface Energy Balance" => "api/seb.md",
],
"Stratigraphy" => "api/strat.md",
......
# Soils
```@autodocs
Modules = [Soils]
Private = false
Order = [:type, :function, :macro]
```
\ No newline at end of file
# Water balance
```@autodocs
Modules = [WaterBalance]
Private = false
Order = [:type, :function, :macro]
```
\ No newline at end of file
......@@ -22,7 +22,6 @@ include("methods.jl")
# Submodules
include("Utils/Utils.jl")
include("Numerics/Numerics.jl")
include("Layers/Layers.jl")
include("Physics/Physics.jl")
include("Strat/Strat.jl")
include("IO/InputOutput.jl")
......@@ -33,7 +32,6 @@ using .Utils
# Re-exported submodules
@reexport using .Numerics
@reexport using .Utils: convert_tspan
@reexport using .Layers
@reexport using .Physics
@reexport using .Strat
@reexport using .Drivers
......
module Layers
import CryoGrid: SubSurface
import CryoGrid: initialcondition!, variables
using CryoGrid.Numerics
using CryoGrid.Utils
using DimensionalData
using IntervalSets
using ModelParameters
using Parameters
using Unitful
export Soil, SoilParameterization, SoilCharacteristicFractions, SoilProfile, SoilType, Sand, Silt, Clay
export soilparameters, soilcomp, porosity
include("soil.jl")
end
\ No newline at end of file
......@@ -2,27 +2,20 @@ module HeatConduction
import CryoGrid: SubSurfaceProcess, BoundaryStyle, Dirichlet, Neumann, BoundaryProcess, Layer, Top, Bottom, SubSurface, Callback
import CryoGrid: diagnosticstep!, prognosticstep!, interact!, initialcondition!, boundaryflux, boundaryvalue, variables, callbacks, criterion, affect!
import CryoGrid.Layers: Soil, totalwater, porosity, mineral, organic
using CryoGrid.Physics
using CryoGrid.Physics.Boundaries
using CryoGrid.Physics.Water: VanGenuchten
using CryoGrid.Numerics
using CryoGrid.Numerics: nonlineardiffusion!, harmonicmean!, harmonicmean, heaviside
using CryoGrid.Utils
using Base: @propagate_inbounds
using DimensionalData
using IfElse
using Interpolations: Linear, Flat
using IntervalSets
using ModelParameters
using Parameters
using SimulationLogs
using Unitful
import Flatten: @flattenable, flattenable
export Heat, TemperatureProfile
export FreeWater, FreezeCurve, freezecurve
......@@ -53,11 +46,9 @@ variables(::SubSurface, ::Heat, ::FreezeCurve) = ()
# Fallback (error) implementation for freeze curve
(fc::FreezeCurve)(sub::SubSurface, heat::Heat, state) = error("freeze curve $(typeof(fc)) not implemented for $(typeof(heat)) on layer $(typeof(sub))")
export heatconduction!, enthalpy, heatcapacity, heatcapacity!, thermalconductivity, thermalconductivity!
export heatconduction!, enthalpy, totalwater, liquidwater, heatcapacity, heatcapacity!, thermalconductivity, thermalconductivity!
include("heat.jl")
export ConstantTemp, GeothermalHeatFlux, TemperatureGradient, NFactor, Damping
include("heat_bc.jl")
export SFCC, DallAmico, Westermann, McKenzie, SFCCNewtonSolver
include("soil/soilheat.jl")
end
......@@ -3,7 +3,6 @@ module Physics
import CryoGrid: Process, CoupledProcesses, Coupled, Layer, Top, Bottom, SubSurface
import CryoGrid: diagnosticstep!, initialcondition!, interact!, prognosticstep!, variables, callbacks, observe
using CryoGrid.Layers
using CryoGrid.Numerics
using CryoGrid.Utils
......@@ -13,13 +12,15 @@ using Unitful
include("coupled.jl")
include("Boundaries/Boundaries.jl")
include("Water/Water.jl")
include("WaterBalance/WaterBalance.jl")
include("HeatConduction/HeatConduction.jl")
include("Soils/Soils.jl")
include("SEB/SEB.jl")
include("Sources/Sources.jl")
@reexport using .Boundaries
@reexport using .HeatConduction
@reexport using .Soils
@reexport using .SEB
@reexport using .Sources
......
......@@ -3,7 +3,7 @@ module SEB
using ..HeatConduction: Heat
using ..Physics
using ..Boundaries
using CryoGrid.Layers: Soil
using CryoGrid.Physics.Soils
using CryoGrid.Numerics
using CryoGrid.Utils
......
module Soils
import CryoGrid: SubSurface
import CryoGrid: initialcondition!, variables
import CryoGrid.Physics.HeatConduction: Enthalpy, Temperature, totalwater, liquidwater, thermalconductivity, heatcapacity
using CryoGrid.Numerics
using CryoGrid.Numerics: heaviside
using CryoGrid.Physics.HeatConduction
using CryoGrid.Physics.WaterBalance
using CryoGrid.Utils
using Base: @propagate_inbounds
using IfElse
using ModelParameters
using Parameters
using Unitful
import Flatten: @flattenable, flattenable
export Soil, SoilParameterization, SoilCharacteristicFractions, SoilProfile, SoilType, Sand, Silt, Clay
export soilparameters, soilcomp, porosity, mineral, organic
"""
Represents the texture classification of the soil. Sand, Silt, and Clay are provided by default.
"""
......@@ -69,3 +92,8 @@ totalwater(soil::Soil{T,<:SoilCharacteristicFractions}) where T = soilcomp(Val{:
porosity(soil::Soil{T,<:SoilCharacteristicFractions}) where T = soilcomp(Val{:θp}(), soil.para)
mineral(soil::Soil{T,<:SoilCharacteristicFractions}) where T = soilcomp(Val{:θm}(), soil.para)
organic(soil::Soil{T,<:SoilCharacteristicFractions}) where T = soilcomp(Val{:θo}(), soil.para)
export SFCC, DallAmico, Westermann, McKenzie, SFCCNewtonSolver
include("soilheat.jl")
end
\ No newline at end of file
File moved
module Water
module WaterBalance
import CryoGrid: BoundaryStyle, diagnosticstep!, prognosticstep!, interact!, initialcondition!, variables
......
File moved
......@@ -3,7 +3,6 @@ module Strat
import CryoGrid: Layer, Top, Bottom, SubSurface, Process, SubSurfaceProcess, BoundaryProcess, CoupledProcesses
import CryoGrid: variables, initialcondition!, prognosticstep!, diagnosticstep!, interact!, observe
using CryoGrid.Layers
using CryoGrid.Numerics
using CryoGrid.Physics
using CryoGrid.Utils
......
......@@ -7,10 +7,10 @@ using ComponentArrays
Tₘ = 0.0
θres = 0.0
soil = Soil(para=soilparameters())
θw = Layers.soilcomp(Val{:θw}(), soil.para)
θp = Layers.soilcomp(Val{:θp}(), soil.para)
θm = Layers.soilcomp(Val{:θm}(), soil.para)
θo = Layers.soilcomp(Val{:θo}(), soil.para)
θw = Soils.soilcomp(Val{:θw}(), soil.para)
θp = Soils.soilcomp(Val{:θp}(), soil.para)
θm = Soils.soilcomp(Val{:θm}(), soil.para)
θo = Soils.soilcomp(Val{:θo}(), soil.para)
@testset "McKenzie freeze curve" begin
@testset "Sanity checks" begin
f = McKenzie()
......@@ -244,10 +244,10 @@ function benchmarksfcc()
L = heat.L
# set up multi-grid-cell state vars
T = [-15.0 for i in 1:10]
θw = Layers.soilcomp(Val{:θw}(), soil.para)
θp = Layers.soilcomp(Val{:θp}(), soil.para)
θm = Layers.soilcomp(Val{:θm}(), soil.para)
θo = Layers.soilcomp(Val{:θo}(), soil.para)
θw = Soils.soilcomp(Val{:θw}(), soil.para)
θp = Soils.soilcomp(Val{:θp}(), soil.para)
θm = Soils.soilcomp(Val{:θm}(), soil.para)
θo = Soils.soilcomp(Val{:θo}(), soil.para)
θl = f.(T,Tₘ,θres,θp,θw,L,α,n) # set liquid water content according to freeze curve
C = heatcapacity.(soil,θw,θl,θm,θo)
H = let T = T.+14.999,
......
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