From 47439c2f62292772ae4fbf5743d92524619e4ef0 Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Mon, 30 Sep 2019 18:30:29 +0100 Subject: read target flow from boundary definition file. --- makeBoundary.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'makeBoundary.py') diff --git a/makeBoundary.py b/makeBoundary.py index e1ca2de..37a45d7 100755 --- a/makeBoundary.py +++ b/makeBoundary.py @@ -13,19 +13,21 @@ def read_definition(filename): ddict[items[0]] = eval(items[1]) return ddict +# read boundary definition file. definition_dict = read_definition('boundaryDefinition.txt') -for dd in definition_dict: - print(definition_dict[dd]) +#for dd in definition_dict: +# print(definition_dict[dd]) -with open('./1D_top.txt', "r") as data: - xch, ych, zch = np.loadtxt(data, delimiter=' ', unpack=True) +# with open('./1D_top.txt', "r") as data: +# xch, ych, zch = np.loadtxt(data, delimiter=' ', unpack=True) # Fit with polyfit -m, c = np.polyfit(ych, zch, 1) -print('gradient =', m, 'intercept =', c) +# m, c = np.polyfit(ych, zch, 1) +# print('gradient =', m, 'intercept =', c) -slope = abs(m) # slope at top boundary -target_flow = 2.0 # imposed discharge +slope = abs(definition_dict["slope"]) # slope at top boundary +target_flow = definition_dict["target_flow"] # imposed discharge +print(target_flow) with open('../topography/top_boundary.xyz', "r") as topo: xin, yin, zin = np.loadtxt(topo, delimiter=' ', unpack=True) -- cgit