diff options
author | Paul Garlick <pgarlick@tourbillion-technology.com> | 2019-10-09 12:01:04 +0100 |
---|---|---|
committer | Paul Garlick <pgarlick@tourbillion-technology.com> | 2019-10-09 12:01:04 +0100 |
commit | 480ee33810139b32d4c7373503ba96dd22227032 (patch) | |
tree | b8f235f3016ca68d4eaf80c7e60dd0f20cdcfce3 | |
parent | c6ed57637ccbd4c80e181b081cc605013cc9a6dd (diff) | |
download | fullSWOF-utils-480ee33810139b32d4c7373503ba96dd22227032.tar.gz |
calculate cell size.
-rwxr-xr-x | makeBoundary.py | 17 |
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 |