aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Garlick <pgarlick@tourbillion-technology.com>2019-10-08 14:25:41 +0100
committerPaul Garlick <pgarlick@tourbillion-technology.com>2019-10-08 14:25:41 +0100
commit888736862a1f170e52d3c89360c01394576f82d5 (patch)
treeb93b3c31e54c4cd2497076a727ae6fee2bd9b0b4
parentbea857dc8251e298dafb56350aefe6db4d5c6b2e (diff)
downloadfullSWOF-utils-888736862a1f170e52d3c89360c01394576f82d5.tar.gz
read name of topography file from boundary definition file.
-rw-r--r--boundaryDefinition.txt3
-rwxr-xr-xmakeBoundary.py20
2 files changed, 13 insertions, 10 deletions
diff --git a/boundaryDefinition.txt b/boundaryDefinition.txt
index cb9f76d..a98786f 100644
--- a/boundaryDefinition.txt
+++ b/boundaryDefinition.txt
@@ -2,6 +2,9 @@
# Boundary Definition File
#
+# topography:
+height_data: "../FullSWOF_2D-1.08.00/Examples/Simple/Inputs/topography.txt"
+
# Boundary location ("top", "bottom", "left", "right"):
location: "top"
diff --git a/makeBoundary.py b/makeBoundary.py
index 1808bf9..9b9e5e2 100755
--- a/makeBoundary.py
+++ b/makeBoundary.py
@@ -19,6 +19,15 @@ def read_definition(filename):
definition_dict = read_definition('boundaryDefinition.txt')
#for dd in definition_dict:
# print(definition_dict[dd])
+slope = abs(definition_dict["slope"]) # slope at top boundary
+target_flow = definition_dict["target_flow"] # imposed discharge
+location = definition_dict["location"] # boundary location
+n_co_chan = definition_dict["n_co_chan"] # coefficient for inland water
+n_co_west = definition_dict["n_co_west"] # coefficient for general surface
+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
# with open('./1D_top.txt', "r") as data:
# xch, ych, zch = np.loadtxt(data, delimiter=' ', unpack=True)
@@ -27,7 +36,7 @@ definition_dict = read_definition('boundaryDefinition.txt')
# m, c = np.polyfit(ych, zch, 1)
# print('gradient =', m, 'intercept =', c)
-with open('../topography/top_boundary.xyz', "r") as topo:
+with open(height_data, "r") as topo:
xin, yin, zin = np.loadtxt(topo, delimiter=' ', unpack=True)
# array index and co-ordinates are related by:
@@ -54,15 +63,6 @@ zmin_east = zregion_east.min()
print(zmin_east)
-slope = abs(definition_dict["slope"]) # slope at top boundary
-target_flow = definition_dict["target_flow"] # imposed discharge
-location = definition_dict["location"] # boundary location
-n_co_chan = definition_dict["n_co_chan"] # coefficient for inland water
-n_co_west = definition_dict["n_co_west"] # coefficient for general surface
-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.
-
numH = 50 # number of height intervals
def conveyance(numH, n_co, xregion, zregion, zmin, zmax):