gsi_lug_caemodel.py
#
# Getting Started with ABAQUS
#
# Script for elastic lug example
#
from abaqus import *
from abaqusConstants import *
session.journalOptions.setValues(replayGeometry=COORDINATE,
recoverGeometry=COORDINATE)
session.Viewport(name='Viewport: 1', origin=(1.3671875, 1.3671875),
width=201.25, height=135.625)
session.viewports['Viewport: 1'].makeCurrent()
Mdb()
mdb.models.changeKey(fromName='Model-1', toName='standard')
##
## Switch to the part module
##
import part
import regionToolset
import displayGroupMdbToolset as dgm
##
## Sketch profile of the lug
##
s0 = mdb.models['standard'].Sketch(name='__profile__', sheetSize=0.25)
g, v, d = s0.geometry, s0.vertices, s0.dimensions
s0.sketchOptions.setValues(sheetSize=0.25, gridSpacing=0.005, grid=ON,
gridFrequency=2, constructionGeometry=ON, dimensionTextHeight=0.005,
decimalPlaces=4)
##
## Sketch three edges of rectangle
##
s0.Line(point1=(0.04, 0.025), point2=(-0.06, 0.025))
s0.Line(point1=(-0.06, 0.025), point2=(-0.06, -0.025))
s0.Line(point1=(-0.06, -0.025), point2=(0.04, -0.025))
##
## Dimensional annotations
##
s0.HorizontalDimension(vertex1=v[2], vertex2=v[1], textPoint=(
0.0226459056138992, 0.0408435016870499))
s0.VerticalDimension(vertex1=v[2], vertex2=v[4], textPoint=(
-0.0773734971880913, -0.0217023231089115))
session.viewports['Viewport: 1'].partDisplay.setValues(renderStyle=WIREFRAME)
##
## Close profile with semicircular arc
##
s0.ArcByCenterEnds(center=(0.04, 0.0), point1=(0.04, 0.025), point2=(0.04,
-0.025))
##
## Dimensional annotations
##
s0.RadialDimension(curve=g[10], textPoint=(0.0668593347072601,
-0.0341036543250084))
##
## Sketch circular hole
##
s0.CircleByCenterPerimeter(center=(0.04, -3.46944695195361e-18), point1=(
0.055, 0.0))
##
## Dimensional annotations
##
s0.RadialDimension(curve=g[14], textPoint=(-0.00647026160731912,
0.00822261720895767))
p = mdb.models['standard'].Part(name='Lug', dimensionality=THREE_D,
type=DEFORMABLE_BODY)
p = mdb.models['standard'].parts['Lug']
p.BaseSolidExtrude(sketch=s0, depth=0.02)
p = mdb.models['standard'].parts['Lug']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['standard'].sketches['__profile__']
##
## Switch to the property module
##
import material
import section
##
## Create material 'Steel'
##
mdb.models['standard'].Material('Steel')
mdb.models['standard'].materials['Steel'].Elastic(table=((200.0E9, 0.3), ))
##
## Create solid section
##
mdb.models['standard'].HomogeneousSolidSection(name='LugSection',
material='Steel', thickness=1.0)
##
## Assign solid section
##
p0 = mdb.models['standard'].parts['Lug']
c = p0.cells
region=(None, None, None,
c.findAt(((0.0421788935686915,
-0.0249048674522936, 0.0133333333333333), ), ))
p0.SectionAssignment(region=region, sectionName='LugSection')
##
## Switch to the assembly module
##
import assembly
import part
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
meshTechnique=OFF)
##
## Set coordinate system (done by default)
##
a = mdb.models['standard'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
##
## Instance the lug
##
p = mdb.models['standard'].parts['Lug']
a.Instance(name='Lug-1', part=p, dependent=ON)
##
## Switch to the step module
##
import step
##
## Create a static general step
##
mdb.models['standard'].StaticStep(name='LugLoad',
previous='Initial', description='Apply uniform pressure to the hole',
timePeriod=1, adiabatic=OFF, maxNumInc=100,
stabilization=None, timeIncrementationMethod=AUTOMATIC, initialInc=1,
minInc=1e-05, maxInc=1, matrixSolver=SOLVER_DEFAULT, amplitude=RAMP,
extrapolation=LINEAR, fullyPlastic="")
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='LugLoad')
##
## Modify output requests
##
mdb.models['standard'].fieldOutputRequests['F-Output-1'].setValues(
variables=('S', 'U', 'RF'), region=MODEL)
del mdb.models['standard'].historyOutputRequests['H-Output-1']
##
## Switch to load module
##
import load
session.viewports['Viewport: 1'].assemblyDisplay.setValues(loads=ON, bcs=ON,
fields=ON)
##
## Reset view and suppress display of datum geometry
##
session.viewports['Viewport: 1'].view.setValues(cameraPosition=(-0.17919,
0.032919, 0.23678), cameraUpVector=(0.25082, 0.89439, -0.37034))
session.viewports['Viewport: 1'].assemblyDisplay.setValues(renderStyle=HIDDEN)
session.viewports['Viewport: 1'].assemblyDisplay.geometryOptions.setValues(
datumPoints=OFF, datumAxes=OFF, datumPlanes=OFF, datumCoordSystems=OFF)
##
## Apply encastre bc to left end
##
a = mdb.models['standard'].rootAssembly
f1 = a.instances['Lug-1'].faces
region=(None, None,
f1.findAt(((-0.06,
-0.00833333333333333, 0.00666666666666667), (-1.0, 0.0, 0.0)), ), None)
mdb.models['standard'].EncastreBC(name='Fix left end', createStepName='LugLoad',
region=region)
session.viewports['Viewport: 1'].view.setValues(cameraPosition=(0.11568,
0.041851, 0.28173), cameraUpVector=(-0.17654, 0.88133, -0.43829))
##
## Partition the lug
##
p = mdb.models['standard'].parts['Lug']
c = p.cells
cells=(c.findAt((
0.0421788935686915, -0.0249048674522936, 0.0133333333333333), ), )
e = p.edges
v = p.vertices
p.PartitionCellByPlaneThreePoints(cells=cells,
point1=p.InterestingPoint(e.findAt((0.04,
-0.015, 0.02), ), MIDDLE),
point2=v.findAt((0.055, 0.0, 0.02), ),
point3=p.InterestingPoint(e.findAt((0.04,
-0.015, 0.0), ), MIDDLE))
##
## Apply pressure load to bottom of hole
##
a0 = mdb.models['standard'].rootAssembly
a0.regenerate()
f1 = a0.instances['Lug-1'].faces
region=((f1.findAt((
(0.0549429204713762, -0.00130733614121487, 0.0133333333333333),
(-0.996194698091746, 0.087155742747658, 0.0)), ), SIDE1), )
mdb.models['standard'].Pressure(name='Pressure load', createStepName='LugLoad',
region=region, magnitude=5.0E7)
##
## Switch to mesh module
##
import mesh
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=ON, loads=OFF,
bcs=OFF, fields=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
meshTechnique=ON)
##
## Create partitions
##
c1 = p.cells
cells=(
c1.findAt((
0.0649048674522936, 0.00217889356869145, 0.0133333333333333), ),
c1.findAt((
0.0649048674522936, -0.00217889356869145, 0.00666666666666667), ))
e1 = p.edges
p.PartitionCellByPlaneThreePoints(cells=cells,
point1=p.InterestingPoint(e1.findAt((
0.0293933982822018, 0.0106066017177982, 0.02), ), MIDDLE),
point2=p.InterestingPoint(e1.findAt((
0.0506066017177982, -0.0106066017177982, 0.02), ), MIDDLE),
point3=p.InterestingPoint(e1.findAt((
0.0506066017177982, -0.0106066017177982, 0.0), ), MIDDLE))
e1 = p.edges
p.DatumPointByEdgeParam(edge=e1.findAt(coordinates=(0.015, -0.025, 0.02)),
parameter=0.25)
c1 = p.cells
cells=(
c1.findAt((
0.0386926638587851, 0.0149429204713762, 0.00666666666666667), ),
c1.findAt((
0.0386926638587851, -0.0149429204713762, 0.00666666666666666), ))
d1 = p.datums
e1 = p.edges
p.PartitionCellByPlanePointNormal(point=d1[5], normal=e1.findAt((
-0.03875, -1.0842021724855e-17, 0.02), ), cells=cells)
##
## 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)
c1 = p.cells
regions=(None, None, None,
c1.findAt(((
-0.00999999999999999, 0.00833333333333333, 0.0), ), ((
-0.00999999999999999, -0.00833333333333334, 0.02), ), ((
0.0413073361412149, 0.0149429204713762, 0.00666666666666666), ), ((
0.0413073361412149, -0.0149429204713762, 0.00666666666666667), ), ((
0.0233333333333333, -0.025, 0.0133333333333333), ), ((0.0233333333333333,
0.025, 0.00666666666666667), ), ))
p.setElementType(regions=regions, 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)
##
## Switch to job module
##
import job
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
meshTechnique=OFF)
##
## Create job
##
a = mdb.models['standard'].rootAssembly
a.regenerate()
mdb.Job(name='Lug', model='standard',
description='Linear Elastic Steel Connecting Lug')
##
## Save model database
##
mdb.saveAs('Lug.cae')
##
## Explicit dynamics model
##
mdb.Model(name='explicit', objectToCopy=mdb.models['standard'])
##
## add density
##
mdb.models['explicit'].materials['Steel'].Density(table=((7800.0, ), ))
##
## replace static step with explicit dynamics step
##
a = mdb.models['explicit'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
mdb.models['explicit'].ExplicitDynamicsStep(name='LugLoad',
previous='Initial', maintainAttributes=TRUE, timePeriod=0.005)
##
## change number of field output intervals to 40
##
mdb.models['explicit'].fieldOutputRequests['F-Output-1'].setValues(
numIntervals=40)
##
## change element type to linear and library to EXPLICIT
##
elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=EXPLICIT,
hourglassControl=ENHANCED)
elemType2 = mesh.ElemType(elemCode=C3D6, elemLibrary=EXPLICIT)
elemType3 = mesh.ElemType(elemCode=C3D4, elemLibrary=EXPLICIT)
p = mdb.models['explicit'].parts['Lug']
c = p.cells
cells = c.findAt(((0.019003, 0.010833, 0.0), ), ((-0.01, -0.025, 0.006667),
), ((0.023333, -0.025, 0.013333), ), ((0.064905, 0.002173, 0.013333), ), ((
-0.01, 0.016667, 0.02), ), ((0.041304, -0.014943, 0.006667), ))
regions =(cells, )
p.setElementType(regions=regions, elemTypes=(elemType1, elemType2, elemType3))
##
## create job
##
mdb.Job(name='expLug', model='explicit', type=ANALYSIS,
description='dynamic analysis of lug')
a = mdb.models['standard'].rootAssembly
a.regenerate()
a = mdb.models['explicit'].rootAssembly
a.regenerate()
mdb.save()