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

Remove defunct paritioned enthalpy scheme

parent 4212485e
No related branches found
No related tags found
1 merge request!58Rename Land -> Strat and promote soil comps to state variables
......@@ -30,10 +30,9 @@ struct FreeWater <: FreezeCurve end
TemperatureProfile(pairs::Pair{<:DistQuantity,<:TempQuantity}...) =
Profile(map(p -> uconvert(u"m", p[1]) => uconvert(u"°C", p[2]),pairs)...)
abstract type HeatVariable end
struct Enthalpy <: HeatVariable end
struct PartitionedEnthalpy <: HeatVariable end
struct Temperature <: HeatVariable end
abstract type HeatImpl end
struct Enthalpy <: HeatImpl end
struct Temperature <: HeatImpl end
@with_kw struct Heat{F<:FreezeCurve,S} <: SubSurfaceProcess
ρ::Float"kg/m^3" = 1000.0xu"kg/m^3" #[kg/m^3]
......@@ -45,7 +44,6 @@ end
# convenience constructors for specifying prognostic variable as symbol
Heat(var::Union{Symbol,Tuple{Vararg{Symbol}}}; kwargs...) = Heat(Val{var}(); kwargs...)
Heat(::Val{:H}; kwargs...) = Heat(;sp=Enthalpy(), kwargs...)
Heat(::Val{(:Hₛ,:Hₗ)}; kwargs...) = Heat(;sp=PartitionedEnthalpy(), kwargs...)
Heat(::Val{:T}; kwargs...) = Heat(;sp=Temperature(), kwargs...)
export enthalpy, heatcapacity, heatcapacity!, thermalconductivity, thermalconductivity!
......
......@@ -54,22 +54,6 @@ variables(layer::SubSurface, heat::Heat{<:FreezeCurve,Enthalpy}) = (
# add freeze curve variables (if any are present)
variables(layer, heat, freezecurve(heat))...,
)
""" Variable definitions for heat conduction (partitioned enthalpy) on any subsurface layer. """
variables(layer::SubSurface, heat::Heat{<:FreezeCurve,PartitionedEnthalpy}) = (
Prognostic(:Hₛ, Float"J/m^3", OnGrid(Cells)),
Prognostic(:Hₗ, Float"J/m^3", OnGrid(Cells)),
Diagnostic(:dH, Float"J/s/m^3", OnGrid(Cells)),
Diagnostic(:H, Float"J", OnGrid(Cells)),
Diagnostic(:T, Float"°C", OnGrid(Cells)),
Diagnostic(:C, Float"J/K/m^3", OnGrid(Cells)),
Diagnostic(:Ceff, Float"J/K/m^3", OnGrid(Cells)),
Diagnostic(:dθdT, Float"m/m", OnGrid(Cells)),
Diagnostic(:k, Float"W/m/K", OnGrid(Edges)),
Diagnostic(:kc, Float"W/m/K", OnGrid(Cells)),
Diagnostic(:θl, Float"1", OnGrid(Cells)),
# add freeze curve variables (if any are present)
variables(layer, heat, freezecurve(heat))...,
)
""" Variable definitions for heat conduction (temperature) on any subsurface layer. """
variables(layer::SubSurface, heat::Heat{<:FreezeCurve,Temperature}) = (
Prognostic(:T, Float"°C", OnGrid(Cells)),
......@@ -113,19 +97,6 @@ function prognosticstep!(::SubSurface, ::Heat{<:FreezeCurve,Enthalpy}, state)
# Diffusion on non-boundary cells
heatconduction!(state.dH,state.T,ΔT,state.k,Δk)
end
""" Prognostic step for heat conduction (partitioned enthalpy) on subsurface layer."""
function prognosticstep!(::SubSurface, heat::Heat{<:FreezeCurve,PartitionedEnthalpy}, state)
Δk = Δ(state.grids.k) # cell sizes
ΔT = Δ(state.grids.T)
# Diffusion on non-boundary cells
heatconduction!(state.dH,state.T,ΔT,state.k,Δk)
let L = heat.L;
@. state.dHₛ = state.dH / (L/state.C*state.dθdT + 1)
# This could also be expressed via a mass matrix with 1
# in the upper right block diagonal. But this is easier.
@. state.dHₗ = state.dH - state.dHₛ
end
end
""" Prognostic step for heat conduction (temperature) on subsurface layer. """
function prognosticstep!(::SubSurface, ::Heat{<:FreezeCurve,Temperature}, state)
Δk = Δ(state.grids.k) # cell sizes
......
......@@ -42,12 +42,3 @@ function initialcondition!(soil::Soil, heat::Heat{<:SFCC}, state)
heatcapacity!(soil, heat, state)
@. state.H = enthalpy(state.T, state.C, L, state.θl)
end
""" Diagonstic step for partitioned heat conduction on soil layer. """
function initialcondition!(soil::Soil, heat::Heat{<:SFCC,PartitionedEnthalpy}, state)
L = heat.L
sfcc = freezecurve(heat)
state.θl .= sfcc.f.(state.T, sfccparams(sfcc.f, soil, heat, state)...)
heatcapacity!(soil, heat, state)
@. state.Hₛ = state.T*state.C
@. state.Hₗ = state.θl*L
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment