Skip to content

Commit

Permalink
block rectangular building block
Browse files Browse the repository at this point in the history
  • Loading branch information
malihass committed May 3, 2024
1 parent cba1560 commit a8ead2c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions bird/meshing/_mesh_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,35 @@ def make_walls_from_topo(topo):
return {"WallR": WallR, "WallL": WallL}


def make_fluid_blocks_from_corner(corners):
assert isinstance(corners, list)
fluid_blocks = []
for multi_block in corners:
n_end_block = len(multi_block)
for iend, end_block in enumerate(multi_block):

if iend == 0:
fluid_blocks.append(list(end_block))
else:
# Find direction to previous end point
prev_block=multi_block[iend-1]
line=np.array(end_block, dtype=int) - np.array(prev_block, dtype=int)
nnz = np.nonzero(line)
assert len(nnz) == 1
direction = np.array(line / np.linalg.norm(line), dtype=int)
blocks_line = []
found_next = False
count = 0
while not found_next:
count += int(1)
new_block = np.array(prev_block, dtype=int) + count*direction
if np.linalg.norm(new_block - np.array(end_block, dtype=int))<1:
found_next = True
blocks_line.append(list(np.array(prev_block, dtype=int) + count*direction))
fluid_blocks += blocks_line

return fluid_blocks

def make_bound_from_topo(topo):
BoundaryNames = []
BoundaryType = []
Expand Down

0 comments on commit a8ead2c

Please sign in to comment.