Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# geometries
radius_x = 0.19
arc_x = 0.13
length_z = 1.1

# prepare ofblockmeshdicthelper.BlockMeshDict instance to
Expand All @@ -26,8 +27,10 @@
basevs = [
Vertex(0, 0, 0, 'v0'),
Vertex(radius_x, 0, 0, 'v1'),
Vertex(radius_x, 0, length_z, 'v2'),
Vertex(radius_x, 1, length_z, 'v2'),
Vertex(0, 0, length_z, 'v3')]
# vertices for the arc
arcvs = [Vertex(arc_x, 0, length_z/2.0, 'varc')]

# rotate wedgedegree/2 around z axis
# rotated vertices are named with '-y' or '+y' suffix.
Expand All @@ -38,10 +41,13 @@
for v in basevs:
bmd.add_vertex(v.x*cosd, -v.x*sind, v.z, v.name+'-y')
bmd.add_vertex(v.x*cosd, v.x*sind, v.z, v.name+'+y')
for v in arcvs:
bmd.add_vertex(v.x*cosd, -v.x*sind, v.z, v.name+'-y')
bmd.add_vertex(v.x*cosd, v.x*sind, v.z, v.name+'+y')

# v0+y and v3+y have same coordinate as v0-y and v3-y, respectively.
bmd.reduce_vertex('v0-y', 'v0+y')
bmd.reduce_vertex('v3-y', 'v3+y')
#bmd.reduce_vertex('v0-y', 'v0+y')
#bmd.reduce_vertex('v3-y', 'v3+y')


# utility to to generate vertex names
Expand All @@ -66,7 +72,14 @@ def vnamegen(x0z0, x1z0, x1z1, x0z1):
bmd.add_boundary('patch', 'outlet', [b0.face('zp')])
bmd.add_boundary('empty', 'axis', [b0.face('xm')])

bmd.add_arcedge(('v2-y', 'v3-y'), 'arc', 'varc-y')
bmd.add_arcedge(('v2+y', 'v3+y'), 'arc', 'varc+y')

# prepare for output
bmd.assign_vertexid()
# output
print(bmd.format())
#print(bmd.format())string = bmd.format()
string = bmd.format()
f = open("blockMeshDict", "w")
f.write(string)
f.close