# # Getting Started with ABAQUS # # 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.0), point2=(0.5, 0.4)) s.delete(objectList=(c[18], c[19], c[20], c[21], c[22])) s.ParallelConstraint(entity1=g.findAt((0.05, 0.4)), entity2=g.findAt((0.05, 0.0))) s.HorizontalDimension(vertex1=v.findAt((-0.4, 0.4)), vertex2=v.findAt((0.5, 0.4)), textPoint=(0.450857281684875, 0.507287442684174), value=1.0) s.HorizontalDimension(vertex1=v.findAt((-0.4, 0.0)), vertex2=v.findAt((0.6, 0.0)), textPoint=(0.513240039348602, -0.235222667455673), value=2.0) s.ObliqueDimension(vertex1=v.findAt((0.6, 0.4)), vertex2=v.findAt((1.6, 0.0)), textPoint=(1.33608078956604, 0.304556548595428), value=1.0) s.ObliqueDimension(vertex1=v.findAt((-0.4, 0.0)), vertex2=v.findAt((-0.328477, 0.371391)), textPoint=(-0.389007270336151, 0.349928438663483), value=1.0) s.Line(point1=(-0.328476690885259, 0.371390676354104), point2=(0.13, -0.494634727430336)) s.CoincidentConstraint(entity1=v.findAt((0.13, -0.494635)), entity2=g.findAt(( 0.171523, -0.494635))) s.Line(point1=(0.13, -0.494634727430336), point2=(0.671523309114741, 0.371390676354104)) s.ObliqueDimension(vertex1=v.findAt((-0.328477, 0.371391)), vertex2=v.findAt(( 0.13, -0.494635)), textPoint=(-0.0369418859481812, -0.494634727430335), value=1.0) s.breakCurve(curve1=g.findAt((0.171523, -0.494635)), point1=( -0.132451087236404, -0.478043496608734), curve2=g.findAt((-0.078477, -0.061622)), point2=(0.157749980688095, -0.474372118711472)) 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() 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.findAt(((-0.078477, 0.371391, 0.0), ), ((0.796523, 0.154884, 0.0), ), ((0.921523, -0.494635, 0.0), ), ((0.296523, -0.278128, 0.0), ), ((-0.703477, -0.278128, 0.0), ), ((-0.203477, 0.154884, 0.0), ), ((-0.078477, -0.494635, 0.0), )) 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.171523309114741, 0.494634727430335, 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'].HistoryOutputRequest(name='H-Output-2', createStepName='Apply load', variables=('U1', 'U2', 'U3', 'UR1', 'UR2', 'UR3'), region=regionDef, sectionPoints=DEFAULT, rebar=EXCLUDE) ## # 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()