aboutsummaryrefslogtreecommitdiff
path: root/makeBoundary.py
diff options
context:
space:
mode:
Diffstat (limited to 'makeBoundary.py')
-rwxr-xr-xmakeBoundary.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/makeBoundary.py b/makeBoundary.py
index f71ef8c..3876e1e 100755
--- a/makeBoundary.py
+++ b/makeBoundary.py
@@ -40,12 +40,19 @@ height_data = definition_dict["height_data"] # topography
with open(height_data, "r") as topo:
xtp, ytp, ztp = np.loadtxt(topo, delimiter=' ', unpack=True)
-# number of cells in x direction
-ncols = int(math.sqrt(len(xtp)*(xtp[0]+xtp[-1])/(ytp[0]+ytp[-1])))
-# number of cells in y direction
+# domain extent in x-direction:
+xmax = (xtp[0]+xtp[-1])
+# domain extent in y-direction:
+ymax = (ytp[0]+ytp[-1])
+# number of cells in x-direction:
+ncols = int(math.sqrt(len(xtp)*xmax/ymax))
+# number of cells in y-direction:
nrows = int(len(xtp)/ncols)
+# cell size
+dX = xmax/ncols
+print('dX =', dX)
-print(ncols, nrows)
+#print(ncols, nrows)
# array index and co-ordinates are related by:
# index = (co-ord - 0.25)*2
@@ -188,8 +195,6 @@ print(r_h_west[ind_q-1], r_h_west[ind_q])
velocity_west = target_flow_west/A_extra
print(velocity_channel, velocity_east, velocity_west)
-dX = (xin[0]+xin[-1])/len(xin) # cell size
-print('dX =', dX)
csa = np.zeros(len(xin)) # cross-sectional area
csa_west = 0
csa_chan = 0