From fb50227eed06bd8c0e25104e909df07675f9fa12 Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Wed, 16 Oct 2019 16:35:38 +0100 Subject: read panel fill order from boundary definition file. --- boundaryDefinition.txt | 6 +++--- makeBoundary.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/boundaryDefinition.txt b/boundaryDefinition.txt index fb6be58..4053d54 100644 --- a/boundaryDefinition.txt +++ b/boundaryDefinition.txt @@ -17,10 +17,10 @@ target_flow: 2.0 # Panel marker co-ordinates (commma-separated list of cell-centre values): markers: [4.3] -# Channel index (panel identifier): -channel: 0 +# Fill order (comma-separated list of panel indices): +panel: [0, 1] -# Overtopping tolerance (/m): +# Channel overtopping tolerance (/m): ztol: 0.01 # Manning's n coefficients (comma-separated list, ordered by panel index): diff --git a/makeBoundary.py b/makeBoundary.py index ac86d16..c7ac94b 100755 --- a/makeBoundary.py +++ b/makeBoundary.py @@ -29,7 +29,7 @@ n_co = definition_dict["n_co"] # Manning's 'n' coefficients # Note: weighted mean calculation requires roughness map. height_data = definition_dict["height_data"] # topography markers = definition_dict["markers"] # distances from corner point -channel = definition_dict["channel"] # identifier of channel panel +panel = definition_dict["panel"] # panel fill order ztol = definition_dict["ztol"] # tolerance in overtopping height numH = definition_dict["numH"] # number of height intervals @@ -81,25 +81,25 @@ elif location == 'right': print(xin) -num_panels = len(markers) + 1 # number of panels across boundary +num_panels = len(panel) # number of panels across boundary -# convert panel co-ordinates to array indices: -panel_ind = [0] +# convert marker co-ordinates to array indices: +marker_ind = [0] for i in range(len(markers)): - panel_ind.append(int(markers[i]/dX - 1/2)) + marker_ind.append(int(markers[i]/dX - 1/2)) if location == 'left' or location == 'right': - panel_ind.append(nrows-1) + marker_ind.append(nrows-1) elif location == 'top' or location == 'bottom': - panel_ind.append(ncols-1) + marker_ind.append(ncols-1) -# print(panel_ind) +# print(marker_ind) xregion = [] zregion = [] for p in range(num_panels): - xregion.append(xin[panel_ind[p]:panel_ind[p+1]]) - zregion.append(zin[panel_ind[p]:panel_ind[p+1]]) + xregion.append(xin[marker_ind[p]:marker_ind[p+1]]) + zregion.append(zin[marker_ind[p]:marker_ind[p+1]]) # xregion_west = xin[100:281] # zregion_west = zin[100:281] @@ -117,8 +117,8 @@ for p in range(num_panels): print(zmin[1]) -# overtopping height (minimum of left bank and right bank heights): -zmax = min(zregion[channel][0], zregion[channel][-1]) - ztol +# channel overtopping height (minimum of left bank and right bank heights): +zmax = min(zregion[panel[0]][0], zregion[panel[0]][-1]) - ztol def conveyance(numH, n_co, xregion, zregion, zmin, zmax): p_i = [] # wetted perimeter -- cgit