''' ----------------------------------------------------------------------------- Symmetric two dimensional model of a single edged notch specimen modeled using reduced integration plane strain elements (CPE8R). Fracture analysis is done on this model subjected to thermal stresses obtained by running a Heat transfer analysis on this model. ----------------------------------------------------------------------------- ''' from abaqus import * from abaqusConstants import * import part, material, section, assembly, step, interaction import regionToolset, displayGroupMdbToolset as dgm, mesh, load, job #---------------------------------------------------------------------------- # Create a model Mdb() modelName = 'SingleEdThermMesh1CPE8R' myModel = mdb.Model(name=modelName) # Create a new viewport in which to display the model # and the results of the analysis. myViewport = session.Viewport(name=modelName) myViewport.makeCurrent() myViewport.maximize() #--------------------------------------------------------------------------- # Create a part # Create a sketch for the base feature mySketch = myModel.Sketch(name='plateProfile',sheetSize=200.0) mySketch.sketchOptions.setValues(viewStyle=AXISYM) mySketch.setPrimaryObject(option=STANDALONE) mySketch.rectangle(point1=(-10.0, 0.0), point2=(10.0, 40.0)) myPlate = myModel.Part(name='Plate', dimensionality=TWO_D_PLANAR, type=DEFORMABLE_BODY) myPlate.BaseShell(sketch=mySketch) mySketch.unsetPrimaryObject() del myModel.sketches['plateProfile'] myViewport.setValues(displayedObject=myPlate) # Partition the edge for the crack pickedEdge = myPlate.edges.findAt((1,0,0)) myPlate.PartitionEdgeByParam(edges=pickedEdge, parameter=0.5) # Partition the plate face1 = myPlate.faces.findAt((0,20,0)) t = myPlate.MakeSketchTransform(sketchPlane=face1, sketchPlaneSide=SIDE1, origin=(0.0,20.0,0.0)) mySketch = myModel.Sketch(name='partitionProfile', sheetSize=89.44, gridSpacing=2.23, transform=t) mySketch.setPrimaryObject(option=SUPERIMPOSE) myPlate.projectReferencesOntoSketch(sketch=mySketch, filter=COPLANAR_EDGES) mySketch.sketchOptions.setValues(gridOrigin=(0.0, -20.0)) mySketch.ArcByCenterEnds(center=(0.0,-20.0), point1=(0.147,-20.0), point2=(-0.147,-20.0), direction=COUNTERCLOCKWISE) mySketch.CircleByCenterPerimeter(center=(0.0,-33.38), point1=(0.0,-10.5)) mySketch.Line(point1=(0.0,-20.0), point2=(10.0,-12.8010204334617)) mySketch.Line(point1=(0.0,-20.0), point2=(-10.0,-12.8010204334617)) pickedFaces = myPlate.faces.findAt((0,20,0)) myPlate.PartitionFaceBySketch(faces=pickedFaces, sketch=mySketch) mySketch.unsetPrimaryObject() del myModel.sketches['partitionProfile'] # Create a set for the entire part faces1 = myPlate.faces myPlate.Set(faces=faces1, name='faces') #--------------------------------------------------------------------------- # Assign material properties # Create linear elastic material myModel.Material(name='LinearElastic') myModel.materials['LinearElastic'].Elastic(table=((30000000.0,0.3),)) myModel.materials['LinearElastic'].Expansion(table=((7.5e-6,),)) myModel.HomogeneousSolidSection(name='SolidHomogeneous', material='LinearElastic', thickness=1.0) region = myPlate.sets['faces'] # Assign the above section to the part myPlate.SectionAssignment(region=region, sectionName='SolidHomogeneous') #--------------------------------------------------------------------------- # Create an assembly myAssembly = myModel.rootAssembly myViewport.setValues(displayedObject=myAssembly) myAssembly.DatumCsysByDefault(CARTESIAN) myAssembly.Instance(name='myPlate-1', part=myPlate, dependent=OFF) myPlateInstance = myAssembly.instances['myPlate-1'] # Create a set for the entire instance faces1 = myPlateInstance.faces myAssembly.Set(faces=faces1, name='All') # Create a set for the X edge e1 = myPlateInstance.edges.findAt(((-5.0735,0.,0.),), ((-0.0735,0.,0.),),) myAssembly.Set(edges=e1, name='xEdge') # Create a set for the top edge e1 = myPlateInstance.edges.findAt(((0.,40.,0.),),) myAssembly.Set(edges=e1, name='topEdge') # Create a set for the vertex to be fixed in X v1 = myPlateInstance.vertices.findAt(((-10.,40.,0.),),) myAssembly.Set(vertices=v1, name='topVertex') # Create a set for the crack tip v1 = myPlateInstance.vertices.findAt(((0.,0.,0.),),) myAssembly.Set(vertices=v1, name='crackTip') #--------------------------------------------------------------------------- # Create a step for applying the thermal stresses # obtained in the heat transfer analysis myModel.StaticStep(name='ApplyThermalLoad', previous='Initial', description='Apply the thermal stresses') #--------------------------------------------------------------------------- # Create interaction properties verts1 = myPlateInstance.vertices v1 = myPlateInstance.vertices.findAt((0,0,0),) v2 = myPlateInstance.vertices.findAt((-10,0,0),) crackFront = crackTip = myAssembly.sets['crackTip'] myAssembly.engineeringFeatures.ContourIntegral(name='Crack', symmetric=ON, crackFront=crackFront, crackTip=crackTip, extensionDirectionMethod=Q_VECTORS, qVectors=((v1, v2),), midNodePosition=0.25, collapsedElementAtTip=SINGLE_NODE) #--------------------------------------------------------------------------- # Create loads and boundary conditions # Assign boundary conditions # Fix the bottom edge in the Y direction region = myAssembly.sets['xEdge'] myModel.DisplacementBC(name='bottomEdgeFixedInY', createStepName='Initial', region=region, u2=0.0, fixed=OFF, distribution=UNIFORM, localCsys=None) # Fix the top edge in the Y direction region = myAssembly.sets['topEdge'] myModel.DisplacementBC(name='topEdgeFixedInY', createStepName='Initial', region=region, u2=0.0, fixed=OFF, distribution=UNIFORM, localCsys=None) # Fix the top vertex in the X direction region = myAssembly.sets['topVertex'] myModel.DisplacementBC(name='XFixed', createStepName='Initial', region=region, u1=0.0, fixed=OFF, distribution=UNIFORM, localCsys=None) # Create a temperature field. # The *.odb file from the heat transfer analysis will be used # to drive the analysis. myModel.Temperature(name='TempField', createStepName='ApplyThermalLoad', distribution=FROM_FILE, fileName='SingleEdgedThermMesh1.odb', beginStep=None, beginIncrement=None, endStep=None, endIncrement=None, interpolate=ON, absoluteExteriorTolerance=0.0, exteriorTolerance=0.05) #--------------------------------------------------------------------------- # Create a mesh # Assign meshing controls to different regions pickedRegions = myPlateInstance.faces.findAt(((-0.048303,0.014643,0.),), ((0.050153,0.016175,0.),), ((0.,0.031845,0.),),) myAssembly.setMeshControls(regions=pickedRegions, elemShape=QUAD_DOMINATED, technique=SWEEP) pickedRegions = myPlateInstance.faces.findAt(((-5.062731,1.838048,0.),), ((0.,4.8235,0.),), ((5.062731,1.838048,0.),), ((0.042229,25.4511,0.),),) myAssembly.setMeshControls(regions=pickedRegions, technique=STRUCTURED) # Seed all the edges pickedEdges = myPlateInstance.edges.findAt(((-0.0735,0.,0.),), ((-0.059651,0.042942,0.),), ((0.059651,0.042942,0.),), ((0.0735,0.,0.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=1, constraint=FIXED) pickedEdges = myPlateInstance.edges.findAt(((0.139904,0.04512,0.),), ((-0.140678,0.042647,0.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=4, constraint=FIXED) pickedEdges = myPlateInstance.edges.findAt(((0.067022,0.130832,0.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=8, constraint=FIXED) pickedEdges1 = myPlateInstance.edges.findAt(((1.895979,0.,0.),),) pickedEdges2 = myPlateInstance.edges.findAt(((-1.895979,0.,0.),),) myAssembly.seedEdgeByBias(end1Edges=pickedEdges1, end2Edges=pickedEdges2, ratio=5.0, number=8, constraint=FIXED) pickedEdges1 = myPlateInstance.edges.findAt(((-1.902571,1.369657,0.),),) pickedEdges2 = myPlateInstance.edges.findAt(((1.902571,1.369657,0.),),) myAssembly.seedEdgeByBias(end1Edges=pickedEdges1, end2Edges=pickedEdges2, ratio=5.0, number=8, constraint=FIXED) pickedEdges = myPlateInstance.edges.findAt(((-10.,3.59949,0.),), ((10.,3.59949,0.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=4, constraint=FIXED) pickedEdges = myPlateInstance.edges.findAt(((-5.13066,8.917326,0.),), ((5.13066,8.917326,0.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=4, constraint=FIXED) pickedEdges1 = myPlateInstance.edges.findAt(((10.,10,0.),),) pickedEdges2 = myPlateInstance.edges.findAt(((-10.,10,0.),),) myAssembly.seedEdgeByBias(end1Edges=pickedEdges1, end2Edges=pickedEdges2, ratio=3, number=4, constraint=FIXED) pickedEdges = myPlateInstance.edges.findAt(((0.,40.,0.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=8, constraint=FIXED) elemType1 = mesh.ElemType(elemCode=CPE8R, elemLibrary=STANDARD) elemType2 = mesh.ElemType(elemCode=CPE6M, elemLibrary=STANDARD) faces1 = myPlateInstance.faces pickedRegions =(faces1, ) myAssembly.setElementType(regions=pickedRegions, elemTypes=(elemType1,elemType2)) partInstances =(myPlateInstance, ) myAssembly.generateMesh(regions=partInstances) #--------------------------------------------------------------------------- # Request history output for the crack myModel.historyOutputRequests.changeKey(fromName='H-Output-1', toName='JInt') myModel.historyOutputRequests['JInt'].setValues(contourIntegral='Crack', numberOfContours=7) #--------------------------------------------------------------------------- # Create the job and submit it for analysis myJob = mdb.Job(name=modelName, model=modelName, description='Heat transfer analysis') mdb.saveAs(pathName=modelName) #---------------------------------------------------------------------------