A.8 Connecting lug with plasticity

gsi_plasticlug_caemodel.py

#
# Getting Started with ABAQUS
#
# Script for plastic lug example
#
from abaqus import *
from abaqusConstants import *
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
session.journalOptions.setValues(replayGeometry=COORDINATE, 
    recoverGeometry=COORDINATE)
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
Mdb()

session.viewports['Viewport: 1'].setValues(displayedObject=None)

##  Sketch profile of the lug

s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=0.25)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.sketchOptions.setValues(decimalPlaces=3)
s.setPrimaryObject(option=STANDALONE)

mdb.models['Model-1'].sketches['__profile__'].sketchOptions.setValues(
    gridFrequency=2)

##  Sketch rectangle; delete right edge

s.rectangle(point1=(-0.02, 0.02), point2=(0.02, -0.01))

s.delete(objectList=(g.findAt((0.02, 0.005)), ))

##  Constraint and dimensions

s.EqualLengthConstraint(entity1=g.findAt((0.0, -0.01)),
    entity2=g.findAt((0.0, 0.02)))

s.ObliqueDimension(vertex1=v.findAt((-0.02, 0.02)),
    vertex2=v.findAt((-0.02, -0.01)),
    textPoint=(-0.0295071750879288, -0.000801935500930995), 
    value=0.05)

s.ObliqueDimension(vertex1=v.findAt((0.02, 0.04)),
    vertex2=v.findAt((-0.02, 0.04)),
    textPoint=(-0.000981846125796437, 0.0510564744472504), value=0.1)

##  Close profile with semicircular arc

s.ArcByCenterEnds(center=(0.0689500589329149, 0.015), point1=(0.08, 0.04), 
    point2=(0.08, -0.01), direction=CLOCKWISE)

##  Constraints and dimension

s.TangentConstraint(entity1=g.findAt((0.096283, 0.015)),
    entity2=g.findAt((0.03, 0.04)))

s.TangentConstraint(entity1=g.findAt((0.105, 0.015)),
    entity2=g.findAt((0.03, -0.01)))

s.RadialDimension(curve=g.findAt((0.105, 0.015)),
    textPoint=(0.104353070259094, -0.0138576403260231), radius=0.025)

d[2].setValues(reference=ON)

##  Sketch circular hole

s.CircleByCenterPerimeter(center=(0.08, 0.015),
    point1=(0.09446020424366, 0.0123283043503761))

##  Dimension

s.RadialDimension(curve=g.findAt((0.06554, 0.017672)),
    textPoint=(0.0518245659768581, 0.027848444879055), radius=0.015)

s.VerticalDimension(vertex1=v.findAt((0.08, 0.015)),
    vertex2=v.findAt((0.09475, 0.012275)),
    textPoint=(0.115778021514416, 0.0141020342707634), value=0.0)

p = mdb.models['Model-1'].Part(name='Lug', dimensionality=THREE_D, 
    type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['Lug']
p.BaseSolidExtrude(sketch=s, depth=0.02)
s.unsetPrimaryObject()
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']
##
##  Create material 'Steel'
##
mdb.models['Model-1'].Material('Steel')
mdb.models['Model-1'].materials['Steel'].Elastic(table=((200.0E9, 0.3), ))
mdb.models['Model-1'].materials['Steel'].Plastic(table=((380.0E6, 0.0), (
    580.0E6, 0.35)))
##
##  Create solid section 
##
mdb.models['Model-1'].HomogeneousSolidSection(name='LugSection', 
    material='Steel', thickness=1.0)
##
##  Assign solid section 
##
c = p.cells
cells = c
region = regionToolset.Region(cells=cells)
p.SectionAssignment(region=region, sectionName='LugSection', offset=0.0)
##
##  Set coordinate system (done by default)
##
a = mdb.models['Model-1'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
##
##  Instance the lug
##
a.Instance(name='Lug-1', part=p, dependent=ON)
##
##  Create a static general step
##
mdb.models['Model-1'].StaticStep(name='LugLoad', 
    previous='Initial', description='Apply uniform pressure to the hole',
    initialInc=0.2)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='LugLoad')
##
##  Apply encastre bc to left end
##
f = a.instances['Lug-1'].faces
faces = f.findAt(((-0.02, 0.006667, 0.013333), ))
region = regionToolset.Region(faces=faces)
mdb.models['Model-1'].EncastreBC(name='Fix left end',
    createStepName='LugLoad', region=region)

session.viewports['Viewport: 1'].setValues(displayedObject=a)
session.viewports['Viewport: 1'].view.fitView()
session.viewports['Viewport: 1'].view.setValues(session.views['Iso'])
##
##  Partition the lug
##
c = p.cells
e = p.edges
v = p.vertices
d = p.datums
pickedCells = c.findAt(((-0.02, 0.006667, 0.013333), ))
p.PartitionCellByPlaneThreePoints(point1=v.findAt(coordinates=(0.095, 0.015, 
    0.02)), cells=pickedCells, point2=p.InterestingPoint(edge=e.findAt(
    coordinates=(0.08, 0.03, 0.02)), rule=MIDDLE), point3=p.InterestingPoint(
    edge=e.findAt(coordinates=(0.08, 0.03, 0.0)), rule=MIDDLE))
##
##  Apply pressure load to bottom of hole
##
a.regenerate()
s = a.instances['Lug-1'].faces
side1Faces = s.findAt(((0.094968, 0.01402, 0.013333), ))
region = regionToolset.Region(side1Faces=side1Faces)
mdb.models['Model-1'].Pressure(name='Pressure load',
    createStepName='LugLoad', region=region, magnitude=1.0E8)


##
##  Create partitions
##
pickedCells = c.findAt(((-0.02, 0.006667, 0.006667), ), ((-0.02, 0.023333, 
    0.013333), ))
p.PartitionCellByPlaneThreePoints(cells=pickedCells, point1=p.InterestingPoint(
    edge=e.findAt(coordinates=(0.069393, 0.004393, 0.0)), rule=MIDDLE), 
    point2=p.InterestingPoint(edge=e.findAt(coordinates=(0.069393, 0.004393, 
    0.02)), rule=MIDDLE), point3=p.InterestingPoint(edge=e.findAt(
    coordinates=(0.090607, 0.025607, 0.02)), rule=MIDDLE))

p.DatumPointByEdgeParam(edge=e.findAt(coordinates=(0.055, -0.01, 0.02)), 
    parameter=0.25)
pickedCells = c.findAt(((-0.02, 0.006667, 0.006667), ), ((-0.02, 0.023333, 
    0.013333), ))
p.PartitionCellByPlanePointNormal(point=d[5], normal=e.findAt(coordinates=(
    0.055, -0.01, 0.02)), cells=pickedCells)

f = a.instances['Lug-1'].faces
faces = f.findAt(((-0.02, 0.006667, 0.006667), ), ((-0.02, 0.023333, 
    0.013333), ))
a.Set(faces=faces, name='BuiltIn')

e = a.instances['Lug-1'].edges
edges = e.findAt(((0.08, 0.0, 0.015), ))
a.Set(edges=edges, name='HoleBot')

##
##  Assign global seed
##
p.seedPart(size=0.007)
##
##  Assign element type
##
elemType1 = mesh.ElemType(elemCode=C3D20R)
elemType2 = mesh.ElemType(elemCode=C3D15)
elemType3 = mesh.ElemType(elemCode=C3D10M)
cells = c
pickedRegions =(cells, )
p.setElementType(regions=pickedRegions, elemTypes=(elemType1, elemType2, 
    elemType3))
##
##  Generate the mesh
##
p.generateMesh()
session.viewports['Viewport: 1'].view.setValues(session.views['Iso'])
session.viewports['Viewport: 1'].assemblyDisplay.geometryOptions.setValues(
    datumPoints=OFF)

mdb.models['Model-1'].fieldOutputRequests['F-Output-1'].setValues(
    variables=PRESELECT)
del mdb.models['Model-1'].historyOutputRequests['H-Output-1']

a.regenerate()
mdb.Job(name='PlasticLugHard', model='Model-1', 
    description='Elastic-Plastic Steel Connecting Lug')

a.regenerate()

session.viewports['Viewport: 1'].view.fitView()
session.viewports['Viewport: 1'].view.setValues(session.views['Iso'])
#
#  Save model database
#
mdb.saveAs('PlasticLug.cae')