aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boundaryDefinition.txt6
-rwxr-xr-xmakeBoundary.py44
2 files changed, 38 insertions, 12 deletions
diff --git a/boundaryDefinition.txt b/boundaryDefinition.txt
index a98786f..ab3b2af 100644
--- a/boundaryDefinition.txt
+++ b/boundaryDefinition.txt
@@ -14,6 +14,12 @@ slope: -0.003646
# Imposed discharge:
target_flow: 2.0
+# Panel marker co-ordinates (commma-separated list of cell-centre values):
+markers: [4.3]
+
+# Channel index (panel identifier):
+channel: 0
+
# Manning's n coefficients:
n_co_chan: 0.035
n_co_west: 0.040
diff --git a/makeBoundary.py b/makeBoundary.py
index 730f96d..89b3769 100755
--- a/makeBoundary.py
+++ b/makeBoundary.py
@@ -29,6 +29,10 @@ n_co_east = definition_dict["n_co_east"] # coefficient for general surface
# TODO: use weighted mean 'n' value. See http://help.floodmodeller.com/isis/ISIS/River_Section.htm (Eq. 4)
# 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
+
+# print(len(markers))
# with open('./1D_top.txt', "r") as data:
# xch, ych, zch = np.loadtxt(data, delimiter=' ', unpack=True)
@@ -76,22 +80,38 @@ elif location == 'right':
print(xin)
-# array index and co-ordinates are related by:
-# index = (co-ord - 0.25)*2
-xregion = xin[280:301]
-zregion = zin[280:301]
+num_panels = len(markers) + 1 # number of panels across boundary
+
+# convert panel co-ordinates to array indices:
+panel_ind = [0]
+for i in range(len(markers)):
+ panel_ind.append(int(markers[i]/dX - 1/2))
+if location == 'left' or location == 'right':
+ panel_ind.append(nrows-1)
+elif location == 'top' or location == 'bottom':
+ panel_ind.append(ncols-1)
+
+
+# print(panel_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_west = xin[100:281]
-zregion_west = zin[100:281]
+# xregion_west = xin[100:281]
+# zregion_west = zin[100:281]
-xregion_east = xin[300:408]
-zregion_east = zin[300:408]
+# xregion_east = xin[300:408]
+# zregion_east = zin[300:408]
-#print(zregion)
+# print(zregion)
+# print(xin[12:20])
-ztol = 0.01 # tolerance in overtopping height
-zmin = zregion.min() # minimum height
-zmax = zregion[-1]-ztol # overtopping height
+ztol = 0.01 # tolerance in overtopping height
+zmin = zregion[channel].min() # minimum height
+zmax = zregion[channel].max()-ztol # overtopping height
zmax_west = zmax
zmax_east = zmax