-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstreamCLOEModel.cs
110 lines (88 loc) · 2.82 KB
/
InstreamCLOEModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RiverSystem;
using TIME.Core;
using TIME.Core.Metadata;
namespace Source.CLOE
{
public class InstreamCLOEModel : LinkSourceSinkModel
{
public InstreamCLOEModel()
{
}
[Parameter, CalculationUnits(CommonUnits.kilograms), Minimum(0.0)]
public double InitialLinkStore{ get; set; }
[State]
public double LinkStore { get; set; }
[Parameter]
public double Dlink { get; set; }
[Parameter]
public double Olink { get; set; }
[Parameter]
public double B51 { get; set; }
[Parameter]
public double B52 { get; set; }
#region Streambank Erosion terms
[Input,CalculationUnits(CommonUnits.KgPerDay)]
public double BankErosionRate { get; set; }
[Input]
public double TimingFactor { get; set; }
[Parameter]
public double Alpha { get; set; }
[Parameter, DefaultValue(1.4), Description("Operation Factor")]
public double O { get; set; }
[Parameter, Description("Management Factor")]
public double M { get; set; }
[Parameter,Description("Streambank Vegetation Factor")]
public double E { get; set; }
#endregion
public override void runTimeStep(DateTime now, double theTimeStepInSeconds)
{
LinkStore += AdditionalInflowMass + CatchmentInflowMass + UpstreamFlowMass;
LinkStore += BankErosion;
ProcessedLoad = LinkStore*ConstituentOutFraction;
LinkStore = Math.Max(0.0, LinkStore - ProcessedLoad);
}
public double ConstituentOutFraction
{
get
{
var exp = -B51*CloeUtils.safeInv(DownstreamFlowVolume) + B52 * Link.TravelTime;
return CloeUtils.weight(Dlink,Olink,Math.Exp(exp));
}
}
public double BankErosion
{
get
{
return O*Alpha*BankErosionRate*M*E*TimingFactor;
//Math.Pow(DownstreamFlowVolume, B) * Link.Length;
}
}
public override LinkSourceSinkModel CloneForMultipleDivisions()
{
return new InstreamCLOEModel()
{
Dlink = Dlink,
Olink = Olink,
B51 = B51,
B52 = B52,
Alpha = Alpha,
O = O,
M = M,
E= E,
TimingFactor = TimingFactor,
BankErosionRate = BankErosionRate
};
}
public override void reset()
{
base.reset();
LinkStore = InitialLinkStore;
}
}
}