Skip to content

Commit 85f68e2

Browse files
simplify mesh generation code
1 parent 60c41f1 commit 85f68e2

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

perpendicular-flap/fluid-nutils/fluid.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,19 @@ def main(inflow: 'inflow velocity' = 10,
1414
timestepsize=0.01):
1515

1616
# mesh and geometry definition
17-
grid_x_1 = numpy.linspace(-3, -1, 7)
18-
grid_x_1 = grid_x_1[:-1]
19-
grid_x_2 = numpy.linspace(-1, -0.3, 8)
20-
grid_x_2 = grid_x_2[:-1]
21-
grid_x_3 = numpy.linspace(-0.3, 0.3, 13)
22-
grid_x_3 = grid_x_3[:-1]
23-
grid_x_4 = numpy.linspace(0.3, 1, 8)
24-
grid_x_4 = grid_x_4[:-1]
25-
grid_x_5 = numpy.linspace(1, 3, 7)
26-
grid_x = numpy.concatenate((grid_x_1, grid_x_2, grid_x_3, grid_x_4, grid_x_5), axis=None)
27-
grid_y_1 = numpy.linspace(0, 1.5, 16)
28-
grid_y_1 = grid_y_1[:-1]
29-
grid_y_2 = numpy.linspace(1.5, 2, 4)
30-
grid_y_2 = grid_y_2[:-1]
31-
grid_y_3 = numpy.linspace(2, 4, 7)
32-
grid_y = numpy.concatenate((grid_y_1, grid_y_2, grid_y_3), axis=None)
33-
grid = [grid_x, grid_y]
34-
35-
topo, geom = mesh.rectilinear(grid)
17+
topo, geom = mesh.rectilinear([
18+
numpy.concatenate((
19+
numpy.linspace(-3, -1, 6, endpoint=False),
20+
numpy.linspace(-1, -0.3, 7, endpoint=False),
21+
numpy.linspace(-0.3, 0.3, 12, endpoint=False),
22+
numpy.linspace(0.3, 1, 7, endpoint=False),
23+
numpy.linspace(1, 3, 7))),
24+
numpy.concatenate((
25+
numpy.linspace(0, 1.5, 15, endpoint=False),
26+
numpy.linspace(1.5, 2, 3, endpoint=False),
27+
numpy.linspace(2, 4, 7))),
28+
])
29+
3630
domain = topo.withboundary(inflow='left', wall='top,bottom', outflow='right') - \
3731
topo[18:20, :10].withboundary(flap='left,right,top')
3832

0 commit comments

Comments
 (0)