''' ----------------------------------------------------------------------------- Symmetric model of a conical crack in a block modeled using continuum elements (C3D20R). ----------------------------------------------------------------------------- ''' from abaqus import * import testUtils testUtils.setBackwardCompatibility() from abaqusConstants import * import part, material, section, assembly, step, interaction import regionToolset, displayGroupMdbToolset as dgm, mesh, load, job import inpReader #---------------------------------------------------------------------------- # Create a model Mdb() modelName = 'SymmConeCrack' orphanModelName = 'SymmConeCrackOrphan' 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 block myBlockSketch = myModel.Sketch(name='blockProfile',sheetSize=500.0) myBlockSketch.sketchOptions.setValues(viewStyle=REGULAR) myBlockSketch.setPrimaryObject(option=STANDALONE) myBlockSketch.rectangle(point1=(0.0, 0.0), point2=(300.0, -300.0)) myBlock = myModel.Part(name='Block', dimensionality=THREE_D, type=DEFORMABLE_BODY) myBlock.BaseSolidExtrude(sketch=myBlockSketch, depth=300.0) myBlockSketch.unsetPrimaryObject() myViewport.setValues(displayedObject=myBlock) del myModel.sketches['blockProfile'] # Create a symmetric cone myConeSketch = myModel.Sketch(name='coneProfile', sheetSize=200.0) myConeSketch.setPrimaryObject(option=STANDALONE) myConeSketch.ObliqueConstructionLine(point1=(0.0,-100.0), point2=(0.0,100.0)) myConeSketch.Line(point1=(0.0,0.0), point2=(10.0,0.0)) myConeSketch.Line(point1=(10.0,0.0), point2=(20.6066017177982,-10.6066017177982)) myConeSketch.Line(point1=(20.6066017177982,-10.6066017177982), point2=(0.0,-10.6066017177982)) myConeSketch.Line(point1=(0.0,-10.6066017177982), point2=(0.0,0.0)) myCone = myModel.Part(name='symmCone', dimensionality=THREE_D, type=DEFORMABLE_BODY) myCone.BaseSolidRevolve(sketch=myConeSketch, angle=90.0, flipRevolveDirection=ON) myConeSketch.unsetPrimaryObject() myViewport.setValues(displayedObject=myCone) del myModel.sketches['coneProfile'] # Create a tube to be used as an inner partition myInnerTubeSketch = myModel.Sketch(name='innerTubeProfile', sheetSize=200.0) myInnerTubeSketch.setPrimaryObject(option=STANDALONE) myInnerTubeSketch.ObliqueConstructionLine(point1=(0.0,-100.0), point2=(0.0,100.0)) myInnerTubeSketch.CircleByCenterPerimeter(center=(20.606602,-10.606602), point1=(20.306602, -10.606602)) myInnerTube = myModel.Part(name='innerTube', dimensionality=THREE_D, type=DEFORMABLE_BODY) myInnerTube.BaseSolidRevolve(sketch=myInnerTubeSketch, angle=90.0, flipRevolveDirection=ON) myInnerTubeSketch.unsetPrimaryObject() myViewport.setValues(displayedObject=myInnerTube) del myModel.sketches['innerTubeProfile'] # Create a tube to be used as an outer partition myOuterTubeSketch = myModel.Sketch(name='outerTubeProfile', sheetSize=200.0) myOuterTubeSketch.setPrimaryObject(option=STANDALONE) myOuterTubeSketch.ObliqueConstructionLine(point1=(0.0,-100.0), point2=(0.0, 100.0)) myOuterTubeSketch.CircleByCenterPerimeter(center=(20.606602,-10.606602), point1=(15.606602,-10.606602)) myOuterTube = myModel.Part(name='outerTube', dimensionality=THREE_D, type=DEFORMABLE_BODY) myOuterTube.BaseSolidRevolve(sketch=myOuterTubeSketch, angle=90.0, flipRevolveDirection=ON) myOuterTubeSketch.unsetPrimaryObject() myViewport.setValues(displayedObject=myOuterTube) del myModel.sketches['outerTubeProfile'] #--------------------------------------------------------------------------- # Create an assembly # Create an instance of the block myAssembly = myModel.rootAssembly myViewport.setValues(displayedObject=myAssembly) myAssembly.DatumCsysByDefault(CARTESIAN) myAssembly.Instance(name='Block-1', part=myBlock, dependent=OFF) myBlockInstance = myAssembly.instances['Block-1'] # Create an instance of the cone myAssembly.Instance(name='symmCone-1', part=myCone, dependent=OFF) myConeInstance = myAssembly.instances['symmCone-1'] # Create an instance of the inner tube myAssembly.Instance(name='innerTube-1', part=myInnerTube, dependent=OFF) myInnerTubeInstance = myAssembly.instances['innerTube-1'] # Create an instance of the outer tube myAssembly.Instance(name='outerTube-1', part=myOuterTube, dependent=OFF) myOuterTubeInstance = myAssembly.instances['outerTube-1'] # Translate the cone, inner tube, and outer tube instances myConeInstance.translate(vector=(0.0,0.0,300.0)) myInnerTubeInstance.translate(vector=(0.0,0.0,300.0)) myOuterTubeInstance.translate(vector=(0.0,0.0,300.0)) # Merge the block, cone, inner, and outer tubes myAssembly.PartFromBooleanMerge(name='BlockwithCone', instances=(myBlockInstance, myConeInstance, myInnerTubeInstance, myOuterTubeInstance, ), keepIntersections=ON, domain=GEOMETRY) myTempBlock = myModel.parts['BlockwithCone'] # Create an instance of the cracked block myAssembly.Instance(name='BlockwithCone-1', part=myTempBlock, dependent=OFF) myTempBlockInstance = myAssembly.instances['BlockwithCone-1'] # Create a new assembly of the parts to be suppressed myAssembly1 = myModel.rootAssembly myAssembly1.suppressFeatures(('Block-1', 'innerTube-1', 'outerTube-1', 'symmCone-1', )) myViewport.setValues(displayedObject=myTempBlock) #--------------------------------------------------------------------------- # Create additional partitions such that the entire part can be meshed # Create a partition for the cracks pickedCells = myTempBlock.cells myTempBlock.PartitionCellByPlaneThreePoints(point1=(20.606602,-10.606602,300.), point2=(0.,-10.606602,300.), point3=(0.,-10.606602,279.393398), cells=pickedCells) # Create a datum plane using offset from plane face1 = myTempBlock.faces.findAt((62.803301,-10.606602,50.)) myTempBlock.DatumPlaneByOffset(plane=face1, flip=SIDE2, offset=-8.0) # Partition the block using the datum plane d1 = myTempBlock.datums pickedCells = myTempBlock.cells myTempBlock.PartitionCellByDatumPlane(datumPlane=d1[3], cells=pickedCells) # Create shell parts for lower partitions mySketch = myModel.Sketch(name='lowerInnerProfile', sheetSize=200.0) mySketch.setPrimaryObject(option=STANDALONE) mySketch.ObliqueConstructionLine(point1=(0.0, -100.0), point2=(0.0, 100.0)) mySketch.Line(point1=(15.606602, -10.606602), point2=(10.9878, -18.606602)) myLowerInnerShell = myModel.Part(name='lowerInnerShell', dimensionality=THREE_D, type=DEFORMABLE_BODY) myLowerInnerShell.BaseShellRevolve(sketch=mySketch, angle=90.0, flipRevolveDirection=ON) mySketch.unsetPrimaryObject() myViewport.setValues(displayedObject=myLowerInnerShell) mySketch = myModel.Sketch(name='lowerOuterProfile', sheetSize=200.0) mySketch.setPrimaryObject(option=STANDALONE) mySketch.ObliqueConstructionLine(point1=(0.0, -100.0), point2=(0.0, 100.0)) mySketch.Line(point1=(25.606602, -10.606602), point2=(33.606602, -18.606602)) myLowerOuterShell = myModel.Part(name='lowerOuterShell', dimensionality=THREE_D, type=DEFORMABLE_BODY) myLowerOuterShell.BaseShellRevolve(sketch=mySketch, angle=90.0, flipRevolveDirection=ON) mySketch.unsetPrimaryObject() myViewport.setValues(displayedObject=myLowerOuterShell) del myModel.sketches['lowerOuterProfile'] mySketch = myModel.Sketch(name='upperOuterProfile', sheetSize=200.0) mySketch.setPrimaryObject(option=STANDALONE) mySketch.ObliqueConstructionLine(point1=(0.0, -100.0), point2=(0.0, 100.0)) mySketch.Line(point1=(25.606602, -10.606602), point2=(36.213204, 0.0)) myUpperOuterShell = myModel.Part(name='upperOuterShell', dimensionality=THREE_D, type=DEFORMABLE_BODY) myUpperOuterShell.BaseShellRevolve(sketch=mySketch, angle=90.0, flipRevolveDirection=ON) mySketch.unsetPrimaryObject() myViewport.setValues(displayedObject=myUpperOuterShell) del myModel.sketches['upperOuterProfile'] myAssembly.regenerate() myViewport.setValues(displayedObject=myAssembly) # Create instances of the shells myLowerInnerShellIns = myAssembly.Instance(name='lowerInnerShell-1', part=myLowerInnerShell, dependent=OFF) myLowerOuterShellIns = myAssembly.Instance(name='lowerOuterShell-1', part=myLowerOuterShell, dependent=OFF) myUpperOuterShellIns = myAssembly.Instance(name='upperOuterShell-1', part=myUpperOuterShell, dependent=OFF) # Translate the three shells myLowerInnerShellIns.translate(vector=(0.0, 0.0, 300.0)) myLowerOuterShellIns.translate(vector=(0.0, 0.0, 300.0)) myUpperOuterShellIns.translate(vector=(0.0, 0.0, 300.0)) # Merge the block with the shells myCrackedBlock = myAssembly.PartFromBooleanMerge(name='partitionedBlock', instances=(myTempBlockInstance, myLowerInnerShellIns, myLowerOuterShellIns, myUpperOuterShellIns, ), keepIntersections=ON, domain=GEOMETRY) # Create an instance of this part myCrackedBlockInstance = myAssembly.Instance(name='partitionedBlock-1', part=myCrackedBlock, dependent=OFF) # Suppress all the old parts myAssembly2 = myModel.rootAssembly myAssembly2.suppressFeatures(('BlockwithCone-1', 'lowerInnerShell-1', 'lowerOuterShell-1', 'upperOuterShell-1',)) myViewport.setValues(displayedObject=myAssembly) #--------------------------------------------------------------------------- # Assign material properties # Create a set for the cracked block c = myCrackedBlock.cells myCrackedBlock.Set(cells=c, name='allCells') # Create linear elastic material myModel.Material(name='LinearElastic') myModel.materials['LinearElastic'].Elastic(table=((30000000.0, 0.3), )) myModel.HomogeneousSolidSection(name='SolidHomogeneous', material='LinearElastic', thickness=1.0) region = myCrackedBlock.sets['allCells'] # Assign the above section to the part myCrackedBlock.SectionAssignment(region=region, sectionName='SolidHomogeneous') myAssembly.regenerate() myAssembly = myModel.rootAssembly myViewport.setValues(displayedObject=myAssembly) #--------------------------------------------------------------------------- # Create different sets # Create a set for the cone cells1 = myCrackedBlockInstance.cells.findAt(( (5.5,-8.308505,294.284448),), ((12.188586,-8.308505,287.811414),), ((14.421068,-10.4,285.578932),),) myAssembly.Set(cells=cells1, name='Cone') # Create a set for the crack line edges1 = myCrackedBlockInstance.edges.findAt(( (14.571068,-10.606602,285.428932),),) myAssembly.Set(edges=edges1, name='crackLine') # Create a set for the seam crack faces faces1 = myCrackedBlockInstance.faces.findAt(((9.571068,-3.535534,290.428932),), ((12.946068,-8.308505,287.053932),), ((14.496068,-10.500536,285.503932),),) myAssembly.Set(faces=faces1, name='seamCrackFaces') #--------------------------------------------------------------------------- # Create a step for applying a load myModel.StaticStep(name='ApplyLoad', previous='Initial', description='Apply the load') #------------------------------------------------------------------------- # Create interaction properties # Assign seam crack properties pickedRegions = myAssembly.sets['seamCrackFaces'] myAssembly.engineeringFeatures.assignSeam(regions=pickedRegions) # Create the contour integral definition for the crack crackFront = crackTip = myAssembly.sets['crackLine'] v1 = myCrackedBlockInstance.vertices.findAt((0.,0.,290.)) v2 = myCrackedBlockInstance.vertices.findAt((0.,-10.606602,279.393398)) myAssembly.engineeringFeatures.ContourIntegral(name='Crack', symmetric=OFF, crackFront=crackFront, crackTip=crackTip, extensionDirectionMethod=Q_VECTORS, qVectors=((v1, v2),), midNodePosition=0.27, collapsedElementAtTip=SINGLE_NODE) #------------------------------------------------------------------------- # Create loads and boundary conditions # Create a set for the top face of the cone faces1 = myCrackedBlockInstance.faces.findAt(((5,0.,295),),) myAssembly.Surface(side1Faces=faces1, name='topConeFace') # Apply a pressure load on the top face of the cone region = myAssembly.surfaces['topConeFace'] myModel.Pressure(name='PressureLoad', createStepName='ApplyLoad', region=region, distributionType=UNIFORM, magnitude=10.0, amplitude=UNSET) # Create a set for the bottom plane of the block faces1 = myCrackedBlockInstance.faces.findAt(((100,-300,100),),) myAssembly.Set(faces=faces1, name='bottomFace') # Fix the bottom plane in Y region = myAssembly.sets['bottomFace'] myModel.DisplacementBC(name='baseFixed', createStepName='Initial', region=region, u2=SET, fixed=OFF, distributionType=UNIFORM, localCsys=None) # Create a set for the Z face of the block faces1 = myCrackedBlockInstance.faces.findAt(((50.,-59.303301,300.),), ((62,-15,300),), ((68,-5,300),), ((5,-5,300),), ((5,-15,300.),), ((23,-2.5,300),), ((20.6,-17.5,300),), ((20.6,-14,300),), ((22,-7,300),), ((20.606602,-11.5,300),), ((17.3,-9,300),), ((19.5,-10,300),), ((21.18,-10,300),),) myAssembly.Set(faces=faces1, name='ZFace') # Fix the plane in the Z direction region = myAssembly.sets['ZFace'] myModel.DisplacementBC(name='ZFixed', createStepName='Initial', region=region, u3=SET, fixed=OFF, distributionType=UNIFORM, localCsys=None) # Create a set for the X face of the block faces1 = myCrackedBlockInstance.faces.findAt(((0,-50,250),), ((0,-15,233),), ((0.,-5,230),), ((0.,-5,295.),), ((0.,-15,293),), ((0.,-2.5,277),), ((0,-17,277),), ((0,-7.5,278),), ((0,-14,279.39),), ((0,-9,282),), ((0,-10,278.8),), ((0,-11,279.39),), ((0,-10,280.45),),) myAssembly.Set(faces=faces1, name='XFace') # Fix the plane in X directions region = myAssembly.sets['XFace'] myModel.DisplacementBC(name='XFixed', createStepName='Initial', region=region, u1=SET, fixed=OFF, distributionType=UNIFORM, localCsys=None) #--------------------------------------------------------------------------- # Create a mesh # Assign meshing controls to the respective regions pickedRegions = myCrackedBlockInstance.cells.findAt( ((20.62,-10.55,300),), ((20.535891,-10.55,300),), ((20.606602,-10.65,300),),) myAssembly.setMeshControls(regions=pickedRegions, elemShape=WEDGE, technique=SWEEP) # All the remaining cells will be meshed with hex elements using # structured meshing. This is also the default. # Seed all the edges pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-10.606602,278.643398),), ((21.356602,-10.606602,300.),), ((19.856602,-10.606602,300.),), ((0.,-10.076272,279.923728),), ((0.,-10.606602,280.143398),), ((20.076272,-10.076272,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=1, constraint=FIXED) ### pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-10.606602,279.243398),), ((20.756602,-10.606602,300.),), ((20.456602,-10.606602,300.),), ((0.,-10.500536,279.499464),), ((0.,-10.606602,279.543398),), ((20.500536,-10.500536,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=1, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((20.329438,-10.491797,300.),), ((0.,-10.491797,279.670562),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=2, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-5.987204,277.479981),), ((20.721407,-10.329438,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=6, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((20.606602,-10.906602,300.),), ((0.,-10.906602,279.393398),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=8, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((14.7832,-10.606602,285.2168),), ((14.571068,-10.606602,285.428932),), ((14.421068,-10.39447,285.578932),), ((14.358936,-10.606602,285.641064),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=18, constraint=FIXED) ### pickedEdges = myCrackedBlockInstance.edges.findAt(((0.,-10.606602,276.743398),), ((23.256602,-10.606602,300.),), ((17.956602,-10.606602,300.),), ((0.,-8.732769,281.267231),), ((18.732769,-8.732769,300.),), ((0,-10.606602,282.043398),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=12, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-8.693185,284.012796),), ((15.987204,-8.693185,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=2, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-5.987204,277.479981),), ((22.520019,-5.987204,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=6, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((20.606602,-15.606602,300.),), ((0.,-15.606602,279.393398),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=8, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((18.106602,-10.606602,281.893398),), ((11.035534,-10.606602,288.964466),), ((12.071068,-7.071068,287.928932),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=18, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-5.303301,269.090097),), ((30.909903,-5.303301,300.),), ((300.,-5.303301,300.),), ((0.,-5.303301,0.),), ((300.,-5.303301,0.),), ((0.,-5.303301,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=3, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-14.606602,270.393398),), ((29.606602,-14.606602,300.),), ((0.,-14.606602,0.),), ((13.297201,-14.606602,300.),), ((0.,-14.606602,286.702799),), ((300.,-14.606602,300.),), ((0.,-14.606602,300.),), (( 300.,-14.606602,0.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=2, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((25.606602,0.,274.393398),), ((7.071068,0.,292.928932),), ((23.763456,-18.606602,276.236544),), ((7.769548,-18.606602,292.230452),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=18, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,0.,276.893398),), ((23.106602,0.,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=6, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((22.297201,-18.606602,300.),), ((0.,-18.606602,277.702799),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=8, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-10.606602,292.196699),), ((7.803301,-10.606602,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=8, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-18.606602,294.5061),), ((0.,-10.606602,292.196699),), ((0.,0.,295.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=13, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((5.4939,-18.606602,300.),), ((7.803301,-10.606602,300.),), ((5.,0.,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=7, constraint=FIXED) pickedEdges1 = myCrackedBlockInstance.edges.findAt( ((300.,-25,300.),), ((0.,-25,0.),),) pickedEdges2 = myCrackedBlockInstance.edges.findAt( ((300,-25,0),), ((0.,-25,300),),) myAssembly.seedEdgeByBias(end1Edges=pickedEdges1, end2Edges=pickedEdges2, ratio=5.0, number=8, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((50.,-300.,0.),), ((300.,-300.,250.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=8, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((50.,-300.,0.),), ((300.,-300.,250.),), ((50.,-18.606602,0.),), ((300.,-18.606602,250.),), ((300.,-10.606602,250.),), ((50.,-10.606602,0.),), ((300.,0.,250.),), ((50.,0.,0.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=8, constraint=FIXED) pickedEdges1 = myCrackedBlockInstance.edges.findAt(((40,0.,300.),),) pickedEdges2 = myCrackedBlockInstance.edges.findAt(((0.,0.,255),),) myAssembly.seedEdgeByBias(end1Edges=pickedEdges1, end2Edges=pickedEdges2, ratio=1.5, number=12, constraint=FIXED) pickedEdges1 = myCrackedBlockInstance.edges.findAt(((0.,-10.606602,265),),) pickedEdges2 = myCrackedBlockInstance.edges.findAt(((62.803301,-10.606602,300.),),) myAssembly.seedEdgeByBias(end1Edges=pickedEdges1, end2Edges=pickedEdges2, ratio=1.3, number=12, constraint=FIXED) pickedEdges1 = myCrackedBlockInstance.edges.findAt( ((50,-18.606602,300.),),) pickedEdges2 = myCrackedBlockInstance.edges.findAt( ((0.,-18.606602,250),),) myAssembly.seedEdgeByBias(end1Edges=pickedEdges1, end2Edges=pickedEdges2, ratio=1.5, number=12, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((0.,-300.,150.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=33, constraint=FIXED) pickedEdges = myCrackedBlockInstance.edges.findAt( ((50.,-300.,300.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=27, constraint=FIXED) ### pickedEdges = myCrackedBlockInstance.edges.findAt( ((300.,-18.606602,150.),), ((300.,-300.,150.),), ((300.,-10.606602,150.),), ((300.,0.,150.),),) myAssembly.seedEdgeByNumber(edges=pickedEdges, number=12, constraint=FIXED) elemType1 = mesh.ElemType(elemCode=C3D20R, elemLibrary=STANDARD, kinematicSplit=AVERAGE_STRAIN, secondOrderAccuracy=OFF, hourglassControl=STIFFNESS, distortionControl=OFF) elemType2 = mesh.ElemType(elemCode=C3D15, elemLibrary=STANDARD) elemType3 = mesh.ElemType(elemCode=C3D10M, elemLibrary=STANDARD) cells1 = myCrackedBlockInstance.cells pickedRegions =(cells1, ) myAssembly.setElementType(regions=pickedRegions, elemTypes=(elemType1, elemType2, elemType3)) partInstances = (myCrackedBlockInstance, ) 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=5) myModel.HistoryOutputRequest(name='StressInt', createStepName='ApplyLoad', contourIntegral='Crack', numberOfContours=5, contourType=K_FACTORS) myModel.HistoryOutputRequest(name='TStr', createStepName='ApplyLoad', contourIntegral='Crack', numberOfContours=5, contourType=T_STRESS) #--------------------------------------------------------------------------- # Create a job and write an input file to get the orphan mesh mdb.Job(name=modelName, model=modelName, type=ANALYSIS, description='Create the job to get an orphan mesh') mdb.jobs[modelName].writeInput() #--------------------------------------------------------------------------- # Import the input file so that there is an orphan mesh # This orphan mesh will be used to edit the q vectors mdb.ModelFromInputFile(name=orphanModelName, inputFileName='SymmConeCrack.inp') modelName = orphanModelName myModel = mdb.models[modelName] myAssembly = mdb.models[modelName].rootAssembly myViewport = session.viewports['SymmConeCrack'] myViewport.setValues(displayedObject=myAssembly) myViewport.makeCurrent() #--------------------------------------------------------------------------- # Delete the history output del myModel.historyOutputRequests['Crack-1'] del myModel.historyOutputRequests['Crack-2'] del myModel.historyOutputRequests['Crack-3'] #--------------------------------------------------------------------------- # Recreate interaction properties del myAssembly.engineeringFeatures.cracks['JINT_CRACK'] del myAssembly.engineeringFeatures.cracks['STRESSINT_CRACK'] myAssembly.engineeringFeatures.cracks.changeKey(fromName='TSTR_CRACK', toName='Crack') # Edit the q vector definition n1 = ((10.,0.,300.), (9.990482,0.,299.563812), (9.961947,0.,299.128448), (9.914449,0.,298.694733), (9.848078,0.,298.263519), (9.762959,0.,297.835602), (9.659258,0.,297.411804), (9.537169,0.,296.99295), (9.396926,0.,296.579803), (9.238793,0.,296.173157), (9.063078,0.,295.773804), (8.870106,0.,295.382507), (8.660254,0.,295.), (8.433911,0.,294.627014), (8.191521,0.,294.264221), (7.933527,0.,293.912384), (7.660444,0.,293.572113), (7.372769,0.,293.24408), (7.071068,0.,292.928925), (6.755903,0.,292.627228), (6.427876,0.,292.339569), (6.087616,0.,292.066467), (5.735765,0.,291.808472), (5.372995,0.,291.566071), (5.,0.,291.339752), (4.617487,0.,291.129883), (4.226182,0.,290.93692), (3.826836,0.,290.7612), (3.420202,0.,290.603088), (3.007059,0.,290.46283), (2.588191,0.,290.340729), (2.164394,0.,290.23703), (1.736482,0.,290.151917), (1.305261,0.,290.085541), (871.557E-03,0.,290.038055), (436.194E-03,0.,290.009521), (0.,0.,290.)) n2 = ((20.606602,-10.606602,300.), (20.586988,-10.606602,299.101135), (20.528187,-10.606602,298.20401), (20.430309,-10.606602,297.310303), (20.293541,-10.606602,296.421692), (20.118143,-10.606602,295.539917), (19.904449,-10.606602,294.666626), (19.652864,-10.606602,293.803467), (19.363871,-10.606602,292.952118), (19.038013,-10.606602,292.114197), (18.675924,-10.606602,291.29126), (18.278273,-10.606602,290.484924), (17.84584,-10.606602,289.696686), (17.379429,-10.606602,288.92807), (16.87994,-10.606602,288.180542), (16.348318,-10.606602,287.455505), (15.785573,-10.606602,286.754333), (15.19278,-10.606602,286.078369), (14.571068,-10.606602,285.428925), (13.921614,-10.606602,284.80722), (13.245668,-10.606602,284.214417), (12.5445,-10.606602,283.651672), (11.819461,-10.606602,283.120056), (11.071915,-10.606602,282.620575), (10.303301,-10.606602,282.154144), (9.515064,-10.606602,281.72171), (8.708726,-10.606602,281.324066), (7.885805,-10.606602,280.961975), (7.047873,-10.606602,280.636139), (6.196527,-10.606602,280.347137), (5.333381,-10.606602,280.095551), (4.460084,-10.606602,279.881866), (3.578299,-10.606602,279.706451), (2.6897,-10.606602,279.569702), (1.795984,-10.606602,279.471802), (898.847E-03,-10.606602,279.413025), (0.,-10.606602,279.393402)) myAssembly.engineeringFeatures.cracks['Crack'].setValues(symmetric=OFF, extensionDirectionMethod=Q_VECTORS, qVectors=((n1[0],n2[0]), (n1[1],n2[1]), (n1[2],n2[2]), (n1[3],n2[3]), (n1[4],n2[4]), (n1[5],n2[5]), (n1[6],n2[6]), (n1[7],n2[7]), (n1[8],n2[8]), (n1[9],n2[9]), (n1[10],n2[10]), (n1[11],n2[11]), (n1[12],n2[12]), (n1[13],n2[13]), (n1[14],n2[14]), (n1[15],n2[15]), (n1[16],n2[16]), (n1[17],n2[17]), (n1[18],n2[18]), (n1[19],n2[19]), (n1[20],n2[20]), (n1[21],n2[21]), (n1[22],n2[22]), (n1[23],n2[23]), (n1[24],n2[24]), (n1[25],n2[25]), (n1[26],n2[26]), (n1[27],n2[27]), (n1[28],n2[28]), (n1[29],n2[29]), (n1[30],n2[30]), (n1[31],n2[31]), (n1[32],n2[32]), (n1[33],n2[33]), (n1[34],n2[34]), (n1[35],n2[35]), (n1[36],n2[36]))) #--------------------------------------------------------------------------- # Create history output myModel.HistoryOutputRequest(name='JInt', createStepName='ApplyLoad', contourIntegral='Crack', numberOfContours=5) myModel.HistoryOutputRequest(name='StressInt', createStepName='ApplyLoad', contourIntegral='Crack', numberOfContours=5, contourType=K_FACTORS) myModel.HistoryOutputRequest(name='TStr', createStepName='ApplyLoad', contourIntegral='Crack', numberOfContours=5, contourType=T_STRESS) #--------------------------------------------------------------------------- # Create a job and submit it for analysis mdb.Job(name=modelName, model=modelName, type=ANALYSIS, description='Submit the modified job') mdb.jobs[modelName].writeInput() mdb.saveAs(pathName=modelName) #---------------------------------------------------------------------------