-
Notifications
You must be signed in to change notification settings - Fork 190
/
refineMesh abaqusMacros.py
44 lines (41 loc) · 1.28 KB
/
refineMesh abaqusMacros.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: mbcs -*-
# Do not delete the following import lines
from abaqus import *
from abaqusConstants import *
import __main__
def refineModel():
import section
import regionToolset
import displayGroupMdbToolset as dgm
import part
import material
import assembly
import step
import interaction
import load
import mesh
import optimization
import job
import sketch
import visualization
import xyPlot
import displayGroupOdbToolset as dgo
import connectorBehavior
# Change these variables according to your need
model = 'Model-1'
part = 'Part-1'
refinement_factor = 0.5
# No need to change anything below
p = mdb.models[model].parts[part]
elementsize = p.getPartSeeds(attribute=mesh.SIZE) * refinement_factor
f = p.faces
pickedRegions = f.getSequenceFromMask(mask=('[#1 ]', ), )
p.deleteMesh(regions=pickedRegions)
p = mdb.models[model].parts[part]
e = p.edges
pickedEdges = e.getSequenceFromMask(mask=('[#1 ]', ), )
p.seedEdgeBySize(edges=pickedEdges, size=elementsize/2.0, deviationFactor=0.1, constraint=FINER)
p = mdb.models[model].parts[part]
p.seedPart(size=elementsize, deviationFactor=0.1, minSizeFactor=0.1)
p = mdb.models[model].parts[part]
p.generateMesh()