diff --git a/example.py b/example.py index c919b17..49729a8 100644 --- a/example.py +++ b/example.py @@ -13,6 +13,7 @@ # geometries radius_x = 0.19 +arc_x = 0.13 length_z = 1.1 # prepare ofblockmeshdicthelper.BlockMeshDict instance to @@ -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. @@ -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 @@ -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