#
# Getting Started with Abaqus: Interactive Edition
#
# Script for frame 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()
mdb.models.changeKey(fromName='Model-1', toName='standard')
##
## Sketch profile of frame
##
s = mdb.models['standard'].ConstrainedSketch(name='__profile__', sheetSize=4.0)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.setPrimaryObject(option=STANDALONE)
s.rectangle(point1=(-0.4, -0.2), point2=(0.4, 0.4))
s.delete(objectList=(c[18], c[21], c[19], c[20]))
s.ParallelConstraint(entity1=g.findAt((0.0, 0.4)), entity2=g.findAt((0.0,
-0.2)))
s.HorizontalDimension(vertex1=v.findAt((-0.4, 0.4)), vertex2=v.findAt((0.4,
0.4)), textPoint=(0.350665062665939, 0.510207295417786), value=1.0)
s.HorizontalDimension(vertex1=v.findAt((-0.4, -0.2)), vertex2=v.findAt((0.4,
-0.2)), textPoint=(0.299293786287308, -0.478947371244431), value=2.0)
s.ObliqueDimension(vertex1=v.findAt((0.4, 0.4)), vertex2=v.findAt((0.4,
-0.2)), textPoint=(0.589653432369232, 0.0547049306333065), value=1.0)
s.ObliqueDimension(vertex1=v.findAt((-1.6, -0.2)), vertex2=v.findAt((0.2,
0.4)), textPoint=(-0.524880945682526, 0.353907465934753), value=1.0)
session.viewports['Viewport: 1'].view.fitView()
s.Line(point1=(-0.45, 0.533012701892263), point2=(-0.15, -0.333012701892264))
s.CoincidentConstraint(entity1=v.findAt((-0.15, -0.333013)), entity2=g.findAt(
(0.05, -0.333013)), addUndoState=False)
s.Line(point1=(-0.15, -0.333012701892264), point2=(0.55, 0.533012701892263))
s.breakCurve(curve1=g.findAt((0.05, -0.333013)), point1=(-0.247599363327026,
-0.332068353891373), curve2=g.findAt((-0.3, 0.1)), point2=(
-0.158276319503784, -0.259217292070389))
s.EqualLengthConstraint(entity1=g.findAt((-0.3, 0.1)), entity2=g.findAt((0.2,
0.1)))
s.HorizontalConstraint(entity= g.findAt((-0.45, -0.284057), ))
s.HorizontalConstraint(entity=g.findAt((0.55, -0.333013)))
s.move(objectList=(g.findAt((-0.7, 0.1),), g.findAt((0.05, 0.533013), ),
g.findAt((0.8, 0.1),), g.findAt((-0.2, 0.1), ),
g.findAt(( 0.3, 0.1), ), g.findAt((0.55,-0.333013), ),
g.findAt((-0.45,-0.333013), )), vector=(-0.01, 0.0))
p = mdb.models['standard'].Part(name='Frame', dimensionality=TWO_D_PLANAR,
type=DEFORMABLE_BODY)
p = mdb.models['standard'].parts['Frame']
p.BaseWire(sketch=s)
s.unsetPrimaryObject()
p = mdb.models['standard'].parts['Frame']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['standard'].sketches['__profile__']
##
## Create material 'Steel'
##
mdb.models['standard'].Material('Steel')
mdb.models['standard'].materials['Steel'].Elastic(table=((200.E9, 0.3), ))
##
## Create truss section
##
mdb.models['standard'].TrussSection(name='FrameSection', material='Steel',
area=1.963E-05)
##
## Assign truss section
##
e = p.edges
edges = e
region = regionToolset.Region(edges=edges)
p.SectionAssignment(region=region, sectionName='FrameSection')
a = mdb.models['standard'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
##
## Set coordinate system (done by default)
##
a = mdb.models['standard'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
##
## Instance the frame
##
p = mdb.models['standard'].parts['Frame']
a.Instance(name='Frame-1', part=p, dependent=ON)
p1 = a.instances['Frame-1']
p1.translate(vector=(-0.035794, 0.331227, 0.0))
p1.translate(vector=(-0.004206, 0.001786, 0.0))
##
## Create a static linear perturbation step
##
mdb.models['standard'].StaticLinearPerturbationStep(name='Apply load',
previous='Initial', description='10kN central load',
matrixSolver=SOLVER_DEFAULT)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Apply load')
mdb.models['standard'].fieldOutputRequests['F-Output-1'].setValues(
variables=PRESELECT, region=MODEL)
##
## Apply concentrated force to bottom center
##
v = a.instances['Frame-1'].vertices
region=((v.findAt(((0.0, 0.0, 0.0), ), ), ), )
mdb.models['standard'].ConcentratedForce(name='Force',
createStepName='Apply load',
region=region, cf2=-10000.0)
##
## Apply encastre bc to bottom left corner
##
region=(v.findAt(((-1.0, 0.0, 0.0), ), ), None, None, None)
mdb.models['standard'].EncastreBC(name='Fixed', createStepName='Initial',
region=region)
##
## Apply roller bc to bottom right corner
##
region=(v.findAt(((1.0, 0.0, 0.0), ), ), None, None, None)
mdb.models['standard'].DisplacementBC(name='Roller',
createStepName='Initial', region=region, u2=0.0)
##
## Assign global seed
##
p.seedPart(size=1.0)
##
## Assign element type
##
elemType1 = mesh.ElemType(elemCode=T2D2)
e = p.edges
edges = e
pickedRegions =(edges, )
p.setElementType(regions=pickedRegions, elemTypes=(elemType1, ))
##
## Generate mesh
##
p.generateMesh()
##
## Create job
##
mdb.Job(name='Frame', model='standard',
description='Two-dimensional overhead hoist frame')
mdb.jobs['Frame'].setValues(echoPrint=ON, modelPrint=ON, contactPrint=ON,
historyPrint=ON)
session.viewports['Viewport: 1'].view.fitView()
##
## Save model database
##
mdb.saveAs('Frame')
##
## Create explicit dynamics model
##
mdb.Model(name='explicit', objectToCopy=mdb.models['standard'])
##
## add density
##
mdb.models['explicit'].materials['Steel'].Density(table=((7800.0, ), ))
a = mdb.models['explicit'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
##
## replace static step with explicit dynamics step
## add new history output requests
##
mdb.models['explicit'].ExplicitDynamicsStep(name='Apply load',
previous='Initial', maintainAttributes=True, timePeriod=0.01)
v = a.instances['Frame-1'].vertices
verts = v.findAt(((0.0, 0.0, 0.0), ))
a.Set(vertices=verts, name='Center')
regionDef=mdb.models['explicit'].rootAssembly.sets['Center']
mdb.models['explicit'].historyOutputRequests['H-Output-1'].setValues(
variables=('UT', ), region=regionDef, frequency=1)
##
# change element library to EXPLICIT
##
elemType1 = mesh.ElemType(elemCode=T2D2, elemLibrary=EXPLICIT)
p = mdb.models['explicit'].parts['Frame']
e = p.edges
edges = e
p.setElementType(regions=pickedRegions, elemTypes=(elemType1, ))
##
## create job
##
mdb.Job(name='expFrame', model='explicit', type=ANALYSIS,
description='Two-dimensional overhead hoist frame-explicit dynamics')
a = mdb.models['standard'].rootAssembly
a.regenerate()
a = mdb.models['explicit'].rootAssembly
a.regenerate()
mdb.save()