# # Getting Started with ABAQUS # # Script for elastic 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() mdb.models.changeKey(fromName='Model-1', toName='standard') session.viewports['Viewport: 1'].setValues(displayedObject=None) ## Sketch profile of the lug s = mdb.models['standard'].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['standard'].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['standard'].Part(name='Lug', dimensionality=THREE_D, type=DEFORMABLE_BODY) p = mdb.models['standard'].parts['Lug'] p.BaseSolidExtrude(sketch=s, depth=0.02) 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.0E9, 0.3), )) ## ## Create solid section ## mdb.models['standard'].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['standard'].rootAssembly a.DatumCsysByDefault(CARTESIAN) ## ## Instance the lug ## a.Instance(name='Lug-1', part=p, dependent=ON) ## ## Create a static general step ## mdb.models['standard'].StaticStep(name='LugLoad', previous='Initial', description='Apply uniform pressure to the hole') 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'] ## ## 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['standard'].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['standard'].Pressure(name='Pressure load', createStepName='LugLoad', region=region, magnitude=5.0E7) ## ## 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) ## ## 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) ## ## Create job ## 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 pickedRegions =(cells, ) p.setElementType(regions=pickedRegions, 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()