aboutsummaryrefslogtreecommitdiff
path: root/makeBoundary
diff options
context:
space:
mode:
Diffstat (limited to 'makeBoundary')
-rwxr-xr-xmakeBoundary10
1 files changed, 8 insertions, 2 deletions
diff --git a/makeBoundary b/makeBoundary
index 0b675da..ca0478f 100755
--- a/makeBoundary
+++ b/makeBoundary
@@ -290,7 +290,12 @@ velocity_channel = Q_i[panel[0]][-1]/A_i[panel[0]][-1]
# print(target_flow_west)
# find part-filled panel:
-ind_p = bisect.bisect(total_flow, target_flow)
+if total_flow[-1] > target_flow:
+ ind_p = bisect.bisect(total_flow, target_flow)
+else:
+ print('Error: imposed discharge is higher than capacity')
+ quit()
+
print('index of part-filled panel:', ind_p)
# calculate target flow in part-filled panel:
@@ -300,7 +305,8 @@ else:
panel_target_flow = target_flow - total_flow[ind_p-1]
# find insertion point for target flow value:
-ind_q = bisect.bisect(Q_i[panel[ind_p]], panel_target_flow)
+ind_q = bisect.bisect(Q_i[panel[ind_p]], panel_target_flow)
+
print('insertion point =', ind_q)
# find height at target flow by linear interpolation