From 480ee33810139b32d4c7373503ba96dd22227032 Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Wed, 9 Oct 2019 12:01:04 +0100 Subject: calculate cell size. --- makeBoundary.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'makeBoundary.py') 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 -- cgit