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

Rename n-factor params to 'nf' and 'nt'

parent d2218a1d
No related branches found
No related tags found
1 merge request!64Fix broken diagnostics functions
......@@ -15,12 +15,12 @@ BoundaryStyle(::Type{<:TemperatureGradient{<:Damping}}) = Neumann()
@inline boundaryvalue(bc::TemperatureGradient, l1, p2, l2, s1, s2) = bc.T(s1.t)
@with_kw struct NFactor{W,S} <: BoundaryEffect
winterfactor::W = Param(1.0, bounds=(0.0,1.0)) # applied when Tair <= 0
summerfactor::S = Param(1.0, bounds=(0.0,1.0)) # applied when Tair > 0
nf::W = Param(1.0, bounds=(0.0,1.0)) # applied when Tair <= 0
nt::S = Param(1.0, bounds=(0.0,1.0)) # applied when Tair > 0
end
@inline function boundaryvalue(bc::TemperatureGradient{<:NFactor}, l1, ::Heat, l2, s1, s2)
let nfw = bc.effect.winterfactor,
nfs = bc.effect.summerfactor,
let nfw = bc.effect.nf,
nfs = bc.effect.nt,
Tair = bc.T(s1.t),
nf = (Tair <= zero(Tair))*nfw + (Tair > zero(Tair))*nfs;
nf*Tair # apply damping factor to air temperature
......
......@@ -74,7 +74,7 @@ end
@testset "n-factors" begin
ts = DateTime(2010,1,1):Hour(1):DateTime(2010,1,1,4)
forcing = TimeSeriesForcing([1.0,0.5,-0.5,-1.0,0.1], ts, :Tair)
tgrad = TemperatureGradient(forcing, NFactor(winterfactor=0.5, summerfactor=1.0))
tgrad = TemperatureGradient(forcing, NFactor(nf=0.5, nt=1.0))
sub = TestGroundLayer()
heat = Heat()
f1(t) = boundaryvalue(tgrad,Top(),heat,sub,(t=t,),(t=t,))
......
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