|
| 1 | +""" |
| 2 | +Current disabled. |
| 3 | +
|
| 4 | +Expuh node implementation needs to be updated to use pure julia methods. |
| 5 | +""" |
| 6 | + |
1 | 7 | using Parameters |
2 | 8 | using ModelParameters |
3 | 9 |
|
4 | 10 |
|
5 | | -Base.@kwdef mutable struct ExpuhNode{P, A<:AbstractFloat} <: IHACRESNode |
| 11 | +Base.@kwdef mutable struct ExpuhNode{P,A<:AbstractFloat} <: IHACRESNode |
6 | 12 | name::String |
7 | 13 | area::A |
8 | 14 |
|
|
95 | 101 |
|
96 | 102 |
|
97 | 103 | function ExpuhNode(name::String, area::Float64, d::Float64, d2::Float64, e::Float64, f::Float64, |
98 | | - tau_q::Float64, tau_s::Float64, v_s::Float64, s_coef::Float64, |
99 | | - store::Float64, quick::Float64, slow::Float64) |
100 | | - return ExpuhNode{Param, Float64}( |
| 104 | + tau_q::Float64, tau_s::Float64, v_s::Float64, s_coef::Float64, |
| 105 | + store::Float64, quick::Float64, slow::Float64) |
| 106 | + return ExpuhNode{Param,Float64}( |
101 | 107 | name=name, |
102 | 108 | area=area, |
103 | 109 | d=d, |
@@ -165,23 +171,21 @@ function run_node!( |
165 | 171 |
|
166 | 172 | flow_res = [0.0, 0.0, 0.0] |
167 | 173 | @ccall IHACRES.calc_flows(flow_res::Ptr{Cdouble}, prev_q::Cdouble, prev_s::Cdouble, s_node.v_s::Cdouble, e_rainfall::Cdouble, |
168 | | - s_node.area::Cdouble, s_node.tau_q::Cdouble, s_node.tau_s::Cdouble)::Cvoid |
| 174 | + s_node.area::Cdouble, s_node.tau_q::Cdouble, s_node.tau_s::Cdouble)::Cvoid |
169 | 175 | (quick_store, slow_store, outflow) = flow_res |
170 | 176 |
|
171 | 177 | gw_store = s_node.gw_store[end] |
172 | 178 | routing_res = [0.0, 0.0] |
173 | 179 | @ccall IHACRES.routing( |
174 | | - routing_res::Ptr{Cdouble}, |
175 | | - gw_store::Cdouble, |
176 | | - s_node.storage_coef::Cdouble, |
177 | | - inflow::Cdouble, |
178 | | - outflow::Cdouble, |
179 | | - ext::Cdouble, |
180 | | - gw_exchange::Cdouble)::Cvoid |
| 180 | + routing_res::Ptr{Cdouble}, |
| 181 | + gw_store::Cdouble, |
| 182 | + s_node.storage_coef::Cdouble, |
| 183 | + inflow::Cdouble, |
| 184 | + outflow::Cdouble, |
| 185 | + ext::Cdouble, |
| 186 | + gw_exchange::Cdouble)::Cvoid |
181 | 187 | (gw_store, outflow) = routing_res |
182 | 188 |
|
183 | | - # level::Float64 = @ccall IHACRES.calc_ft_level(outflow::Cdouble, s_node.level_params::Ptr{Cdouble})::Cdouble |
184 | | - |
185 | 189 | update_state!(s_node, cmd, e_rainfall, et, quick_store, slow_store, outflow, gw_store) |
186 | 190 |
|
187 | 191 | return outflow |
@@ -211,19 +215,19 @@ function run_node_with_temp!(s_node::ExpuhNode, rain::Float64, temp::Float64, in |
211 | 215 |
|
212 | 216 | flow_res = [0.0, 0.0, 0.0] |
213 | 217 | @ccall IHACRES.calc_flows(flow_res::Ptr{Cdouble}, prev_q::Cdouble, prev_s::Cdouble, s_node.v_s::Cdouble, e_rainfall::Cdouble, |
214 | | - s_node.area::Cdouble, s_node.tau_q::Cdouble, s_node.tau_s::Cdouble)::Cvoid |
| 218 | + s_node.area::Cdouble, s_node.tau_q::Cdouble, s_node.tau_s::Cdouble)::Cvoid |
215 | 219 | (quick_store, slow_store, outflow) = flow_res |
216 | 220 |
|
217 | 221 | gw_store = s_node.gw_store[end] |
218 | 222 | routing_res = [0.0, 0.0] |
219 | 223 | @ccall IHACRES.routing( |
220 | | - routing_res::Ptr{Cdouble}, |
221 | | - gw_store::Cdouble, |
222 | | - s_node.storage_coef::Cdouble, |
223 | | - inflow::Cdouble, |
224 | | - outflow::Cdouble, |
225 | | - ext::Cdouble, |
226 | | - gw_exchange::Cdouble)::Cvoid |
| 224 | + routing_res::Ptr{Cdouble}, |
| 225 | + gw_store::Cdouble, |
| 226 | + s_node.storage_coef::Cdouble, |
| 227 | + inflow::Cdouble, |
| 228 | + outflow::Cdouble, |
| 229 | + ext::Cdouble, |
| 230 | + gw_exchange::Cdouble)::Cvoid |
227 | 231 | (gw_store, outflow) = routing_res |
228 | 232 |
|
229 | 233 | # level::Float64 = @ccall IHACRES.calc_ft_level(outflow::Cdouble, s_node.level_params::Ptr{Cdouble})::Cdouble |
|
235 | 239 |
|
236 | 240 |
|
237 | 241 | function update_params!(node::ExpuhNode, d::Float64, d2::Float64, e::Float64, f::Float64, |
238 | | - tau_q::Float64, tau_s::Float64, v_s::Float64, s_coef::Float64)::Nothing |
| 242 | + tau_q::Float64, tau_s::Float64, v_s::Float64, s_coef::Float64)::Nothing |
239 | 243 | node.d = Param(d, bounds=node.d.bounds) |
240 | 244 | node.d2 = Param(d2, bounds=node.d2.bounds) |
241 | 245 | node.e = Param(e, bounds=node.e.bounds) |
|
0 commit comments