diff options
-rwxr-xr-x | makeBoundary.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/makeBoundary.py b/makeBoundary.py index 0f98c91..15a1c0b 100755 --- a/makeBoundary.py +++ b/makeBoundary.py @@ -34,7 +34,10 @@ def conveyance(numH, n_co, xregion, zregion, zmin, zmax): z_sub[i] += list(zregion[booleanArray]) for interval in range(len(xregion)-1): if booleanArray[interval+1] != booleanArray[interval]: - x_extra = xregion[interval] + (h_i[i]-zregion[interval])*(xregion[interval+1]-xregion[interval])/(zregion[interval+1]-zregion[interval]) + x_extra = xregion[interval] \ + + (h_i[i]-zregion[interval])\ + *(xregion[interval+1]-xregion[interval])\ + /(zregion[interval+1]-zregion[interval]) bisect.insort(x_sub[i], x_extra) # add intercept value ind_x = x_sub[i].index(x_extra) z_sub[i].insert(ind_x, h_i[i]) # add height value @@ -273,10 +276,16 @@ 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 -h_extra = h_i[panel[ind_p]][ind_q-1] + (h_i[panel[ind_p]][ind_q]-h_i[panel[ind_p]][ind_q-1])*(panel_target_flow-Q_i[panel[ind_p]][ind_q-1])/(Q_i[panel[ind_p]][ind_q]-Q_i[panel[ind_p]][ind_q-1]) +h_extra = h_i[panel[ind_p]][ind_q-1] \ + + (h_i[panel[ind_p]][ind_q]-h_i[panel[ind_p]][ind_q-1])\ + *(panel_target_flow-Q_i[panel[ind_p]][ind_q-1])\ + /(Q_i[panel[ind_p]][ind_q]-Q_i[panel[ind_p]][ind_q-1]) print('heights:', h_i[panel[ind_p]][ind_q-1], h_extra, h_i[panel[ind_p]][ind_q]) # find area at target flow by linear interpolation -A_extra = A_i[panel[ind_p]][ind_q-1] + (h_extra-h_i[panel[ind_p]][ind_q-1])*(A_i[panel[ind_p]][ind_q]-A_i[panel[ind_p]][ind_q-1])/(h_i[panel[ind_p]][ind_q]-h_i[panel[ind_p]][ind_q-1]) +A_extra = A_i[panel[ind_p]][ind_q-1] \ + + (h_extra-h_i[panel[ind_p]][ind_q-1])\ + *(A_i[panel[ind_p]][ind_q]-A_i[panel[ind_p]][ind_q-1])\ + /(h_i[panel[ind_p]][ind_q]-h_i[panel[ind_p]][ind_q-1]) print('hydraulic radii:', r_h[panel[ind_p]][ind_q-1], r_h[panel[ind_p]][ind_q]) velocity_panel = panel_target_flow/A_extra |