Faster way to partition a Face with Sketch in ABAQUS with scripting
<p>My aim is to obtain a transition mapped quad meshing on a long rectangular region which is a parametrised model. The final mesh can be seen as follows: </p>

<p><a href="https://i.stack.imgur.com/P9esm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P9esm.png" alt="Transition Mapped Quad Meshing"></a></p>

<p>The only way I could realise this final output mesh was to partition the face with sketch and then, using adequate mesh controls and seeding on the respective edges. For this reason, I started with generating a block on the left hand side of the geometry like this:</p>

<p><a href="https://i.stack.imgur.com/w3jpB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w3jpB.png" alt="Single block created by partioning the face with sketch"></a> </p>

<p>Thereafter, a "for" loop was used in the Python script running from the left hand side of the rectangular face to the right-most end and the final partitioned face looks like this:</p>

<p><a href="https://i.stack.imgur.com/WQfT2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WQfT2.png" alt="Final geometry ready to be meshed"></a></p>

<p>So, I tried doing this in three ways.</p>

<p>Option 1: Place the sketcher window using findAt at the left hand side and then  generate the block and with a "for" loop push the origin of the coordinate system of the sketcher window to the right incrementally all the way to the right-most side. In other words, the position of the block with respect to the origin stayed the same always and hence, when the origin moved from left to right, the block moved with it. So I had to open and clos "Partition Face with Sketch" as many times as the number of blocks required. </p>

<p>Option 2: The origin of the Sketcher window stayed at the same place (i.e. at 0.0, 0.0, 0.0) and the blocks were pushed to the right incrementally. In comparison with Option 1, here the relative position of the block with respect to the origin changed over each increment. Here also, "Partition Face with Sketch" was opened and closed as many times as the number of blocks required. </p>

<p>Option 3: I opened the "Partition Face with Sketch" only once and the origin stayed at the same place. Then I drew all these horizontal and vertical lines also with a "for" loop resulting in the final partitioned face.</p>

<p>All these methodologies work perfectly but are extremely time-consuming. Each of these methods takes almost from 8-12 minutes to finish generating all the blocks and hence, is not suitable for a convergence study.</p>

<p>Can anyone suggest a better solution to make this entire process faster, like in 3-4 minutes or so? Would really appreciate it. Thanks in advance.</p>

<p>EDIT: Here is the code guys:</p>

<pre><code># The arguments of the function "block" are the x and y coordinates of the  
# 4 corners of the rectangle where the blocks have to be generated in.
def block(x_left, x_right, y_top, y_bottom):

    # Opens the sketcher window
    p = mdb.models['TDCB'].parts['Part_TDCB']
    f, e, d = p.faces, p.edges, p.datums
    t = p.MakeSketchTransform(sketchPlane=f.findAt(coordinates=(x_left + ((x_right - x_left) / 3), y_bottom + ((y_top - y_bottom) / 3), 0.0), 
    normal=(0.0, 0.0, 1.0)), sketchPlaneSide=SIDE1, origin=(x_left, y_bottom, 0.0))             
    s = mdb.models['TDCB'].ConstrainedSketch(name='__profile__', sheetSize=500.00, 
    gridSpacing=12.00, transform=t)
    g, v, d1, c = s.geometry, s.vertices, s.dimensions, s.constraints
    s.setPrimaryObject(option=SUPERIMPOSE)
    p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)


    # The following block generates the first couple of horizontal lines 
    s.Line(point1=(block_width, 0.0), point2=(block_width, y_top))  # Line No.1

    s.Line(point1=(0.0, y_coord[-2]), point2=(block_width, y_coord[-2]))  # Line No.2

    s.Line(point1=(0.0, y_coord[-3]), point2=(block_width, y_coord[-3]))  # Line No.3

    s.Line(point1=(0.0, y_coord[-4]), point2=(block_width, y_coord[-4]))  # Line No.4

    s.Line(point1=(0.0, y_coord[-5]), point2=(block_width, y_coord[-5]))  # Line No.5

    s.Line(point1=(0.0, y_coord[-6]), point2=(block_width, y_coord[-6]))  # Line No.6

    # Closes the sketcher window
    p = mdb.models['TDCB'].parts['Part_TDCB']
    f = p.faces
    pickedFaces = f.findAt((x_left + ((x_right - x_left) / 3), y_bottom + ((y_top - y_bottom) / 3), 0.0))                     
    e1, d2 = p.edges, p.datums
    p.PartitionFaceBySketch(faces=pickedFaces, sketch=s)
    s.unsetPrimaryObject()
    del mdb.models['TDCB'].sketches['__profile__']    

    return

# Finally the blocks are generated using a "for" loop
for i in range(total_blocks):
    block(x_left, x_right, y_top, y_bottom)
</code></pre>