From b1c4c9d14f05fe35d9dc7363846bcf84c21f1873 Mon Sep 17 00:00:00 2001 From: Brian Groenke <brian.groenke@awi.de> Date: Sun, 12 Dec 2021 13:58:04 +0100 Subject: [PATCH] Remove defunct paritioned enthalpy scheme --- src/Physics/HeatConduction/HeatConduction.jl | 8 ++---- src/Physics/HeatConduction/heat.jl | 29 -------------------- src/Physics/HeatConduction/soil/soilheat.jl | 9 ------ 3 files changed, 3 insertions(+), 43 deletions(-) diff --git a/src/Physics/HeatConduction/HeatConduction.jl b/src/Physics/HeatConduction/HeatConduction.jl index d58688a3..e10bb42f 100644 --- a/src/Physics/HeatConduction/HeatConduction.jl +++ b/src/Physics/HeatConduction/HeatConduction.jl @@ -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! diff --git a/src/Physics/HeatConduction/heat.jl b/src/Physics/HeatConduction/heat.jl index 9b9830fa..442c7d7a 100644 --- a/src/Physics/HeatConduction/heat.jl +++ b/src/Physics/HeatConduction/heat.jl @@ -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 diff --git a/src/Physics/HeatConduction/soil/soilheat.jl b/src/Physics/HeatConduction/soil/soilheat.jl index ca725923..1ebafe56 100644 --- a/src/Physics/HeatConduction/soil/soilheat.jl +++ b/src/Physics/HeatConduction/soil/soilheat.jl @@ -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 -- GitLab