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

Fix bug in freeW initialcondition!

parent e18c53f1
No related branches found
No related tags found
1 merge request!63Fixes recent regressions in heat initialization and refactors soil state variables
......@@ -14,18 +14,18 @@ end
(liq*kw^0.5 + ice*ki^0.5 + mineral*km^0.5 + organic*ko^0.5 + air*ka^0.5)^2
end
end
""" Heat capacity for soil layer """
@inline function heatcapacity!(soil::Soil, ::Heat, state)
@inbounds @. state.C = heatcapacity(soil, state.θw, state.θl, state.θm, state.θo)
end
""" Thermal conductivity for soil layer """
@inline function thermalconductivity!(soil::Soil, ::Heat, state)
@inbounds @. state.kc = thermalconductivity(soil, state.θw, state.θl, state.θm, state.θo)
end
include("sfcc.jl")
""" Initial condition for heat conduction (all state configurations) on soil layer. """
"""
Initial condition for heat conduction (all state configurations) on soil layer.
"""
function initialcondition!(soil::Soil, heat::Heat, state)
initialcondition!(soil, state)
L = heat.L
......@@ -34,15 +34,14 @@ function initialcondition!(soil::Soil, heat::Heat, state)
heatcapacity!(soil, heat, state)
@. state.H = enthalpy(state.T, state.C, L, state.θl)
end
""" Initial condition for heat conduction (all state configurations) with free water freeze curve on soil layer. """
"""
Initial condition for heat conduction (all state configurations) with free water freeze curve on soil layer.
"""
function initialcondition!(soil::Soil, heat::Heat{FreeWater}, state)
initialcondition!(soil, state)
L = heat.L
# initialize liquid water content based on temperature
@. state.θl = ifelse.(state.T > 0.0, 0.0, state.θp)
@. state.θl = ifelse.(state.T > 0.0, state.θw, 0.0)
heatcapacity!(soil, heat, state)
@. state.H = enthalpy(state.T, state.C, L, state.θl)
# evaluate freeze curve
fc! = freezecurve(heat)
fc!(soil, heat, state)
end
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