From da070f46c09beb91ff85ada0e9aaad558a26dd58 Mon Sep 17 00:00:00 2001
From: Paul Garlick <pgarlick@tourbillion-technology.com>
Date: Fri, 8 Nov 2019 15:08:07 +0000
Subject: check that discharge capacity is not exceeded.

---
 makeBoundary | 10 ++++++++--
 1 file 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
-- 
cgit