Skip to content

Commit

Permalink
Fix terms of quadratic equation in Modified Puls Approach
Browse files Browse the repository at this point in the history
The inflow and outflow variables for the lake module are defined for dt, so the terms (Qin1 (t1) + Qin2 (t2))/2  and (Qout1 (t1) + Qout2 (t2))/2 as in the original mass balance equation of the Modified Puls Approach are not required. Because of this the terms of the quadratic equation were fixed (the solution of the quadratic equation based on the original mass balance equation was implemented.
  • Loading branch information
vers-w committed Jan 10, 2024
1 parent e855eb2 commit c503f20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/reservoir_lake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ function update(lake::Lake, i, inflow, doy, timestepsecs)

if si_factor_adj > 0.0
outflow = pow(
-lakefactor + pow((pow(lakefactor, 2.0) + 2.0 * si_factor_adj), 0.5),
0.5 *
(-lakefactor + pow((pow(lakefactor, 2.0) + 4.0 * si_factor_adj), 0.5)),
2.0,
)
else
Expand Down
8 changes: 4 additions & 4 deletions test/reservoir_lake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ end
)

Wflow.update(lake, 1, 2500.0, 181, 86400.0)
@test lake.outflow[1] 85.31903276150577
@test lake.totaloutflow[1] 7.371564430594098e6
@test lake.storage[1] 3.551103576940606e9
@test lake.waterlevel[1] 19.672569557695734
@test lake.outflow[1] 85.14292808113598
@test lake.totaloutflow[1] 7.356348986210149e6
@test lake.storage[1] 3.55111879238499e9
@test lake.waterlevel[1] 19.672653848925634
@test lake.precipitation[1] 20.0
@test lake.evaporation[1] 3.2
end
Expand Down

0 comments on commit c503f20

Please sign in to comment.