def createAnalysisPartionedCuboid(param): dH = param['h']/param['nbParts'] m = mdb.Model(param['modelName']) directions = list() matNames = list() a = m.rootAssembly s = m.ConstrainedSketch(name='__profile__', sheetSize=200.0) s.setPrimaryObject(option=STANDALONE) s.rectangle(point1=(param['l1'],0.), point2=(0.,param['l2'])) p = m.Part(name='Part-1', dimensionality=THREE_D, type=DEFORMABLE_BODY) p.BaseSolidExtrude(sketch=s, depth=param['h']) s.unsetPrimaryObject() for cube in range(param['nbParts']-1): z0 = cube*dH middlePt = (param['l1']/3.,param['l2']/3.,z0+dH/3.) pt1 = p.DatumPointByCoordinate(coords=(0.,0.,z0+dH)) pt2 = p.DatumPointByCoordinate(coords=(0.,param['l2']/3.,z0+dH)) pt3 = p.DatumPointByCoordinate(coords=(param['l1']/3.,0.,z0+dH)) pickedCells = p.cells.findAt((middlePt,)) p.PartitionCellByPlaneThreePoints(cells=pickedCells, point1=p.datums[pt1.id], point2=p.datums[pt2.id], point3=p.datums[pt3.id]) p.seedPart(size=param['seedSize']) p.generateMesh() elType = mesh.ElemType(C3D8R, hourglassControl=ENHANCED) p.setElementType((p.cells,), (elType,)) i = a.Instance(name=p.name+'-1', part=p, dependent=ON) upperFaces = list() lowerFaces = list() for cube in range(param['nbParts']): sectionName = 'section_%i'%cube matName = 'mat_%i'%cube z0 = cube*dH middlePt = (param['l1']/3.,param['l2']/3.,z0+dH/3.) pickedCells2 = p.cells.findAt((middlePt,)) # create material myMat = m.Material(name=matName) if isinstance(param['holzapfelParameters'],list) and len(param['holzapfelParameters']) == param['nbParts']: matParam = param['holzapfelParameters'][cube] elif len(param['holzapfelParameters']) == 5: matParam = param['holzapfelParameters'] else: raise("parameter 'holzapfelParameters' of unknown type or wrong length") E,nu = getEandNu(matParam) if not param['stupidMaterial']: if matParam[1]==0.: myMat.Hyperelastic(table=(matParam,),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=INCOMPRESSIBLE,localDirections=1) else: myMat.Hyperelastic(table=(matParam,),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=1) if isinstance(param['fiberDirection'],list) and len(param['fiberDirection']) == param['nbParts']: fibreAngle = param['fiberDirection'][cube] elif isinstance(param['fiberDirection'],float): fibreAngle = param['fiberDirection'] else: raise("parameter 'fiberDirection' of unknown type or wrong length") directions.append((math.cos(fibreAngle),math.sin(fibreAngle),0.)) matNames.append(matName) else: if matParam[1]==0.: myMat.Hyperelastic(testData=OFF,table=((E/(4*(1.+nu)),0.),),materialType=ISOTROPIC,type=NEO_HOOKE,behaviorType=INCOMPRESSIBLE) else: myMat.Hyperelastic(testData=OFF,table=((E/(4*(1.+nu)),6*(1-2.*nu)/E),),materialType=ISOTROPIC,type=NEO_HOOKE,behaviorType=COMPRESSIBLE) abaqusTools.assignMaterialToPartition(matName,p,sectionName,pickedCells2,m) upperFacePoint = (param['l1']/3.,param['l2'],z0+dH/3.) upperFaces.append(i.faces.findAt((upperFacePoint,) )) lowerFacePoint = (param['l1']/3.,0.,z0+dH/3.) lowerFaces.append(i.faces.findAt((lowerFacePoint,) )) innerPt = (param['l1']/3.,param['l2']/3.,0.) innerFace = i.faces.findAt((innerPt,)) innerSet = a.Set(faces=innerFace, name='innerFace') outerPt = (param['l1']/3.,param['l2']/3.,z0+dH) outerFace = i.faces.findAt((outerPt,)) outerSet = a.Set(faces=outerFace, name='outerFace') lowerSet = tuple(lowerFaces) a.Set(faces=lowerSet, name='lowerFace') upperSet = tuple(upperFaces) a.Set(faces=upperSet, name='upperFace') m.StaticStep(name='Step-1', previous='Initial', nlgeom=ON, timePeriod=1.,initialInc=.0001,maxNumInc=10000, minInc=.000001) if param['BCType'] == 'Tension': m.PinnedBC(name='BC-1', createStepName='Step-1', region=innerSet, localCsys=None) m.DisplacementBC(name='BC-2', createStepName='Step-1', region=outerSet, u1=0.0, u2=0.0, u3=param['displ']) elif param['BCType'] == 'Compression': m.PinnedBC(name='BC-1', createStepName='Step-1', region=innerSet, localCsys=None) m.DisplacementBC(name='BC-2', createStepName='Step-1', region=outerSet, u1=0.0, u2=0.0, u3=-1.*param['displ']) elif param['BCType'] == 'ParrTension': m.PinnedBC(name='BC-1', createStepName='Step-1', region=upperSet, localCsys=None) m.DisplacementBC(name='BC-2', createStepName='Step-1', region=lowerSet, u1=0.0, u2=-1.*param['displ'], u3=0.0) elif param['BCType'] == 'ParrCompression': m.PinnedBC(name='BC-1', createStepName='Step-1', region=upperSet, localCsys=None) m.DisplacementBC(name='BC-2', createStepName='Step-1', region=lowerSet, u1=0.0, u2=param['displ'], u3=0.0) ## JOB myJobDef = JobDefinition(param['modelName']) myJobDef.setScratchDir(param['scratchDir']) if not param['stupidMaterial']: myJobDef.setToFibrous() myJobDef.fibreDirections(directions) myJobDef.setFibreInputType('partition') myJobDef.setMatNames(matNames) myNewJob = myJobDef.create() if param['numCpus']>1: myNewJob.setValues(numCpus=param['numCpus'],numDomains=param['numCpus'],multiprocessingMode=THREADS) if param['saveCaeFile']:mdb.saveAs(myNewJob.name) return myNewJob,mdb
def createAnalysis(param): if param['matType'] != 'Hooke' and not param['nlgeom']: print 'non linear geometry enforced with hyperelastic materials' param['nlgeom'] = True ## IMPORT FILE mdb.ModelFromInputFile(inputFileName=param['inpFile'], name=param['modelName']) abaqusTools.deleteDefaultModel() ## SHORTCUTS myModel = mdb.models[param['modelName']] myAssembly = myModel.rootAssembly myASets = myAssembly.sets ## STEP CREATION nlGeom = OFF if param['nlgeom']: nlGeom = ON myModel.StaticStep(initialInc=1e-5 ,timePeriod=param['timePeriod'], maxInc=.1, minInc=1e-8, name='Load', nlgeom=nlGeom, previous='Initial',maxNumInc=10000) directions = list() matNames = list() for p,myPart in enumerate(myModel.parts.values()): myPSet = myPart.sets partNo = int(myPart.name.split('_')[1]) ## MATERIALS myMatA = myModel.materials['MATA_%i'%partNo] myMatP = myModel.materials['MATP_%i'%partNo] fullPartSet = myPart.sets['ALLPARTSET'] EA,nuA = getEandNu(param['holzapfelParametersA']) EP,nuP = getEandNu(param['holzapfelParametersP']) if param['matType'] == 'Hooke': myMatA.Elastic(table=((EA, nuA), )) myMatP.Elastic(table=((EP, nuP), )) elif param['matType'] == 'neoHooke': myMatA.Hyperelastic(testData=OFF,table=((EA/(4*(1.+nuA)),6*(1-2.*nuA)/EA),),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=COMPRESSIBLE) myMatP.Hyperelastic(testData=OFF,table=((EP/(4*(1.+nuP)),6*(1-2.*nuP)/EP),),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=COMPRESSIBLE) elif param['matType'] == 'Holzapfel': if param['twoDirections']: myMatA.Hyperelastic(table=(param['holzapfelParametersA'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=2) myMatP.Hyperelastic(table=(param['holzapfelParametersP'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=2) else: myMatA.Hyperelastic(table=(param['holzapfelParametersA'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=1) myMatP.Hyperelastic(table=(param['holzapfelParametersP'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=1) datum = myPart.DatumAxisByPrincipalAxis(principalAxis=ZAXIS) normalAxis = myPart.surfaces['EXTERNALSURFACE'] myPart.MaterialOrientation(region=fullPartSet, orientationType=DISCRETE, axis=AXIS_1, normalAxisDefinition=SURFACE, normalAxisRegion=normalAxis, normalAxisDirection=AXIS_1, primaryAxisDefinition=DATUM, primaryAxisDatum=myPart.datums[datum.id], primaryAxisDirection=AXIS_3) fibreAngle = param['fiberOrientation'][p] directions.append((0.,math.cos(fibreAngle),math.sin(fibreAngle))) directions.append((0.,math.cos(fibreAngle),math.sin(fibreAngle))) matNames.append('MATA_%i'%partNo) matNames.append('MATP_%i'%partNo) ## ELEMENT INTEGRATION (to ensure hourglass control - may not be needed!!) elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4, elemLibrary=STANDARD) myPart.setElementType(regions=(myPart.elements,), elemTypes=(elemType1, elemType2)) ## BC'S - any vertical / internal pressure only / any vertical + internal pressure #print myASets if param['load'] == 'displ': myModel.DisplacementBC(createStepName='Load', name='displacement', region=myASets['ZMAX'], u3=param['loadMagnitude']) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) #myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] == 'shearLongAxis': myModel.DisplacementBC(createStepName='Load', name='displacement', region=myASets['ZMAX'], u2=param['loadMagnitude']) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] == 'shearShortAxis': myModel.DisplacementBC(createStepName='Load', name='displacement', region=myASets['ZMAX'], u1=param['loadMagnitude']) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] =='Pressure': # magnitude provided = PRESSURE myModel.Pressure(name='Pressure',createStepName='Load',region=myASurface['ZMAX'],magnitude=p['loadMagnitude'], distributionType=UNIFORM) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] == 'PressurePlane': myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) import regionToolset # magnitude provided = concentrated FORCE on the rigid plane surf = myModel.ConstrainedSketch(name='surf', sheetSize=200.) surf.Line(point1=(0., 0.), point2=(0.0, 30.)) surfPart = myModel.Part(name='crushingPart', dimensionality=THREE_D, type=ANALYTIC_RIGID_SURFACE) surfPart.AnalyticRigidSurfExtrude(sketch=surf, depth=30.) surfPart.ReferencePoint(point=(7.5, 15., 0.)) crushPlane = myAssembly.Instance(name='crushingPlane', part=surfPart, dependent=ON) myAssembly.ParallelFace(movablePlane=crushPlane.faces[0], fixedPlane=myASurface['ZMAX'], flip=ON) myAssembly.translate(instanceList=('crushingPlane', ), vector=(0., 0., 6.)) side1Faces1 = crushPlane.faces.getSequenceFromMask(mask=('[#1 ]', ), ) myCrushingSurface = myAssembly.Surface(side1Faces=side1Faces1, name='crushingSurface') myModel.Tie(name='tieTop', master=myCrushingSurface, slave=myASurface['ZMAX']) region = regionToolset.Region(referencePoints=(crushPlane.referencePoints[2], )) myModel.ConcentratedForce(name='Load-1', createStepName='Load', region=region, cf2=-p['loadMagnitude'], distributionType=UNIFORM, follower=ON) myModel.DisplacementBC(name='pressurePlane', createStepName='Load', region=region, u1=0., u2=0., ur1=0., ur2=0., ur3=0., distributionType=UNIFORM) elif param['internalLoad']:#z fixations if internal pressure only myModel.ZsymmBC(name='FixedTop',createStepName='Load',region=myASurface['ZMAX']) myModel.ZsymmBC(name='Fixed',createStepName='Load',region=myASurface['ZMIN']) else: raise Exception("no BC's have been defined!!") if param['internalLoad']: mostInnerPart = myAssembly.instances['INSTANCE_1'] mostInnerSurface = mostInnerPart.surfaces['INTERNALSURFACE'] myModel.Pressure(name='intPressure',createStepName='Load',region=mostInnerSurface,magnitude=param['internalLoad'], distributionType=UNIFORM) ## OUTPUT REQUESTS #fieldVariable = ('S', 'LE', 'U', 'RT', 'P', 'CSTRESS', 'CDISP', 'CFORCE') #myModel.fieldOutputRequests['F-Output-1'].setValues(variables=fieldVariable) ## JOB from abaqusPythonTools.jobCreation import JobDefinition myJobDef = JobDefinition(param['modelName']) myJobDef.setScratchDir(param['scratchDir']) if param['matType'] == 'Holzapfel': myJobDef.setToFibrous() myJobDef.fibreDirections(directions) if param['twoDirections']: myJobDef.setFibreInputType('twoDirections') myJob = myJobDef.create() if param['numCpus']>1: myJob.setValues(numCpus=param['numCpus'],numDomains=param['numCpus'],multiprocessingMode=THREADS) mdb.saveAs(param['modelName']) return myJob,mdb
def createAnalysisFromSipExport(param): ## IMPORT FILE mdb.ModelFromInputFile(inputFileName=param['sipInpFile'], name=param['modelName']) abaqusTools.deleteDefaultModel() ## SHORTCUTS myModel = mdb.models[param['modelName']] myPart = myModel.parts['PART-1'] myAssembly = myModel.rootAssembly myInstance = myAssembly.instances['PART-1-1'] mySets = myAssembly.sets ## STEP CREATION nlGeom = OFF if param['nlgeom']: nlGeom = ON if param['matType'] == 'Hooke': initInc = .05 maxInc = .15 else: initInc = .01 maxInc = .1 if 'Contact' in param['sipInpFile']: initInc = 1e-4 maxInc = .1 minInc = min(initInc,maxInc)/1000. myModel.StaticStep(initialInc=initInc ,timePeriod=param['timePeriod'], maxInc=maxInc, minInc=minInc, name='displ', nlgeom=nlGeom, previous='Initial',maxNumInc=10000) ## ELEMENT INTEGRATION (to ensure hourglass control and hybrid integration - may not be needed!!) elemType1 = mesh.ElemType(elemCode=C3D8RH, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4, elemLibrary=STANDARD) myPart.setElementType(regions=(myPart.elements,), elemTypes=(elemType1, elemType2)) directions = list() matNames = list() for i,p in enumerate(param['parts']): ## MATERIALS mat = 'PM_'+p allMats = myModel.materials if allMats.has_key(mat): myMat = myModel.materials[mat] else:continue E,nu = getEandNu(param['holzapfelParameters']) if 'BRIDGES' in mat: if param['nlgeom']: myMat.Hyperelastic(testData=OFF,table=((6*(1-2.*0.45)/0.4,0.4/(4*(1.+0.45))),),materialType=ISOTROPIC,type=NEO_HOOKE,behaviorType=COMPRESSIBLE) else: myMat.Elastic(table=((0.4, 0.45), )) elif param['matType'] == 'Hooke': myMat.Elastic(table=((E, nu), )) elif param['matType'] == 'neoHooke': if param['holzapfelParameters'][1]==0.:# incompressible myMat.Hyperelastic(testData=OFF,table=((E/(4*(1.+nu)),6*(1-2.*nu)/E),),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=INCOMPRESSIBLE) else: myMat.Hyperelastic(testData=OFF,table=((E/(4*(1.+nu)),6*(1-2.*nu)/E),),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=COMPRESSIBLE) elif param['matType'] == 'Holzapfel': if param['holzapfelParameters'][1]==0.:# incompressible myMat.Hyperelastic(table=(param['holzapfelParameters'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=INCOMPRESSIBLE,localDirections=1) else: myMat.Hyperelastic(table=(param['holzapfelParameters'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=1) if 'SECTIONED' in mat: fibreAngle = 2.*param['fiberOrientation'] else: fibreAngle = 0. region = myPart.sets['PT_'+p] myPart.MaterialOrientation(region=region, orientationType=SYSTEM, localCsys=None) directions.append((0.,math.sin(fibreAngle),math.cos(fibreAngle))) matNames.append(mat) ##BC'S dMin = 'NS_%s_WITH_%sMIN'%(p,param['loadDirection']) if mySets.has_key(dMin): myModel.PinnedBC(createStepName='displ', localCsys=None, name='fix_%d'%(i), region=mySets[dMin]) dMax = 'NS_%s_WITH_%sMAX'%(p,param['loadDirection']) if mySets.has_key(dMax): if param['loadDirection'] == 'X': myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=mySets[dMax], u1=param['displ']) elif param['loadDirection'] == 'Y': myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=mySets[dMax], u2=param['displ']) elif param['loadDirection'] == 'Z': myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=mySets[dMax], u3=param['displ']) ##CONSTRAINTS - same for all interfaces - could be changed depending on the interface name!! if 'Contact' in param['sipInpFile']: for interactionName in myModel.interactionProperties.keys(): from abaqusPythonTools.interactions import Interactions inter = Interactions(myModel) inter.setName(interactionName) if param['interfaceType'] == 'Tie': masterRegion = myModel.interactions[interactionName+'-1'].master[0] slaveRegion = myModel.interactions[interactionName+'-1'].slave[0] del myModel.interactions[interactionName+'-1'] del myModel.interactionProperties[interactionName] inter.setMasterSlave(masterRegion,slaveRegion) inter.setInteractionToTie() elif param['interfaceType'] == 'Friction': inter.setFrictionBehaviour('Friction') elif param['interfaceType'] == 'Cohesive': inter.setCohesiveBehaviour() inter.changeInteraction() ## OUTPUT REQUESTS fieldVariable = ('S', 'LE', 'U', 'RT', 'P', 'CSTRESS', 'CDISP', 'CFORCE') myModel.fieldOutputRequests['F-Output-1'].setValues(variables=fieldVariable) ## RESTART DEF if param['allowRestart']: myModel.steps['displ'].Restart(numberIntervals=5,timeMarks=OFF,overlay=ON) ## JOB from abaqusPythonTools.jobCreation import JobDefinition myJobDef = JobDefinition(param['modelName']) myJobDef.setScratchDir(param['scratchDir']) if param['matType'] == 'Holzapfel': myJobDef.setToFibrous() myJobDef.fibreDirections(directions) myJobDef.setFibreInputType('fromSip') myJobDef.setMatNames(matNames) myNewJob = myJobDef.create() if param['numCpus']>1: myNewJob.setValues(numCpus=param['numCpus'],numDomains=param['numCpus'],multiprocessingMode=DEFAULT) mdb.saveAs(param['modelName']) ## return myNewJob,mdb
def createAnalysis(param): nbLamellae = len(param['parts'])-4 ## IMPORT FILE mdb.ModelFromInputFile(inputFileName=param['inpFile'], name=param['modelName']) abaqusTools.deleteDefaultModel() ## SHORTCUTS myModel = mdb.models[param['modelName']] myPart = myModel.parts['PART-1'] myAssembly = myModel.rootAssembly myInstance = myAssembly.instances['PART-1-1'] mySets = myAssembly.sets ## STEP CREATION nlGeom = OFF if param['nlgeom']: nlGeom = ON initInc = .01 maxInc = .1 if 'homogeneous' not in param['inpFile']: initInc = 1e-4 maxInc = .1 if ('Bonded' not in param['inpFile']) and ('bonded' not in param['inpFile']): initInc = 1e-6 minInc = initInc/10000. myModel.StaticStep(initialInc=initInc ,timePeriod=param['timePeriod'], maxInc=maxInc, minInc=minInc, name='displ', nlgeom=nlGeom, previous='Initial',maxNumInc=10000) if 'homogeneous' not in param['inpFile'] and 'Bonded' not in param['inpFile']: myModel.steps['displ'].control.setValues(allowPropagation=OFF, resetDefaultValues=OFF, discontinuous=ON) ## ELEMENT INTEGRATION (to ensure hourglass control - may not be needed!!) elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4, elemLibrary=STANDARD) myPart.setElementType(regions=(myPart.elements,), elemTypes=(elemType1, elemType2)) directions = list() matNames = list() for i,p in enumerate(param['parts']): ## MATERIALS mat = 'PM_'+p allMats = myModel.materials if allMats.has_key(mat): myMat = myModel.materials[mat] else:continue E,nu = getEandNu(param['holzapfelParameters']) if 'PLATE' in mat: if param['nlgeom']: myMat.Hyperelastic(testData=OFF,table=((300./1.3,2.4/1200.),),materialType=ISOTROPIC,type=NEO_HOOKE,behaviorType=COMPRESSIBLE) else: myMat.Elastic(table=((1200., 0.3), )) elif 'NUCLEUS' in mat: if param['nlgeom']: myMat.Hyperelastic(testData=OFF,table=((0.00025,0.0),),materialType=ISOTROPIC,type=NEO_HOOKE,behaviorType=INCOMPRESSIBLE) elemType1 = mesh.ElemType(elemCode=C3D8RH, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4H, elemLibrary=STANDARD) region = myPart.sets['PT_'+p] myPart.setElementType(regions=region, elemTypes=(elemType1, elemType2)) else: myMat.Elastic(table=((.0015, 0.499), )) elif not param['nlgeom']: myMat.Elastic(table=((E, nu), )) elif param['matType'] == 'neoHooke' or 'TRANSITIONZONE' in mat: matParam = (E/(4*(1.+nu)),6*(1-2.*nu)/E) if param['holzapfelParameters'][1]==0.:# incompressible myMat.Hyperelastic(testData=OFF,table=(matParam,),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=INCOMPRESSIBLE) elemType1 = mesh.ElemType(elemCode=C3D8RH, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4H, elemLibrary=STANDARD) region = myPart.sets['PT_'+p] myPart.setElementType(regions=region, elemTypes=(elemType1, elemType2)) else: myMat.Hyperelastic(testData=OFF,table=(matParam,),materialType=ISOTROPIC,type=NEO_HOOKE,behaviorType=COMPRESSIBLE) elif param['matType'] == 'Holzapfel': matParam = param['holzapfelParameters'] if 'homogeneous' not in param['inpFile']: nbDirection=1 else: nbDirection=2 if matParam[1]==0.:# incompressible myMat.Hyperelastic(table=(matParam,),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=INCOMPRESSIBLE,localDirections=nbDirection) elemType1 = mesh.ElemType(elemCode=C3D8RH, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4H, elemLibrary=STANDARD) region = myPart.sets['PT_'+p] myPart.setElementType(regions=region, elemTypes=(elemType1, elemType2)) else: myMat.Hyperelastic(table=(matParam,),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL,behaviorType=COMPRESSIBLE,localDirections=nbDirection) if isinstance(param['fiberOrientation'],tuple) and len(param['fiberOrientation']) == nbLamellae: lamellarNo = int(''.join(x for x in mat if x.isdigit())) fibreAngle = param['fiberOrientation'][lamellarNo-1] elif isinstance(param['fiberOrientation'],float): fibreAngle = param['fiberOrientation'] else: raise("parameter 'fiberOrientation' of wrong type or length") directions.append((math.sin(fibreAngle),math.cos(fibreAngle),0.)) matNames.append(mat) ##BC'S if 'Hemi' in param['inpFile']: #symmetry at yMin yMax = 'NS_%s_WITH_YMIN'%p if mySets.has_key(yMax): myModel.YsymmBC(createStepName='displ', name='ySymm_%s'%(p), region=mySets[yMax]) #fixation dMin = 'NS_%s_WITH_ZMIN'%p if mySets.has_key(dMin): myModel.PinnedBC(createStepName='displ', localCsys=None, name='fix_%d'%(i), region=mySets[dMin]) #displacement dMax = 'NS_%s_WITH_ZMAX'%p if mySets.has_key(dMax): myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=mySets[dMax], u3=param['displ'],u1=0.,u2=0.) else: #fixation dMin = 'NS_BOTTOMPLATE_WITH_BACKGROUND' if mySets.has_key(dMin): myModel.PinnedBC(createStepName='displ', localCsys=None, name='fix_%d'%(i), region=mySets[dMin]) #displacement dMax = 'NS_TOPPLATE_WITH_BACKGROUND' if mySets.has_key(dMax): myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=mySets[dMax], u1=param['displ'],u2=0.,u3=0.) ##CONSTRAINTS - same for all interfaces - could be changed depending on the interface name!! if 'homogeneous' not in param['inpFile'] and 'Bonded' not in param['inpFile'] and 'bonded' not in param['inpFile'] : for interactionName in myModel.interactionProperties.keys(): from abaqusPythonTools.interactions import Interactions inter = Interactions(myModel) inter.setName(interactionName) if param['interfaceType'] == 'Friction': inter.setFrictionBehaviour('Friction',param['frictionCoef']) inter.setSeparationAllowed() elif param['interfaceType'] == 'Rough': inter.setFrictionBehaviour('Rough') elif param['interfaceType'] == 'Cohesive': inter.setCohesiveBehaviour(useDefaultBehaviour=False,penalties=(100.0, 100.0, 100.0)) elif param['interfaceType'] == 'CohesiveRough': inter.setCohesiveBehaviour(useDefaultBehaviour=False) inter.setFrictionBehaviour('Rough') elif param['interfaceType'] == 'CohesiveFriction': inter.setCohesiveBehaviour(useDefaultBehaviour=False) inter.setFrictionBehaviour('Friction',param['frictionCoef']) inter.changeInteraction() ## OUTPUT REQUESTS # fieldVariable = ('S', 'LE', 'U', 'RT', 'P', 'CSTRESS', 'CDISP', 'CFORCE') # myModel.fieldOutputRequests['F-Output-1'].setValues(variables=fieldVariable) ## JOB from abaqusPythonTools.jobCreation import JobDefinition myJobDef = JobDefinition(param['modelName']) myJobDef.setScratchDir(param['scratchDir']) if param['matType'] == 'Holzapfel': myJobDef.setToFibrous() myJobDef.fibreDirections(directions) if 'homogeneous' in param['inpFile']: myJobDef.setFibreInputType('twoDirectionsZVert') myJobDef.setMatNames(matNames) myNewJob = myJobDef.create() if param['numCpus']>1: myNewJob.setValues(numCpus=param['numCpus'],numDomains=param['numCpus'],multiprocessingMode=DEFAULT) mdb.saveAs(param['modelName']) ## return myNewJob,mdb
def createAnalysis(param): if param['matType'] != 'Hooke' and not param['nlgeom']: print 'non linear geometry enforced with hyperelastic materials' param['nlgeom'] = True ## IMPORT FILE mdb.ModelFromInputFile(inputFileName=param['inpFile'], name=param['modelName']) abaqusTools.deleteDefaultModel() '''cant remember what those are for! bPoints = ((9.124844,0.,6.),(9.044464,0.647,6.),(8.964084,1.29591,6.),(8.883704,1.943865,6.),(8.803324,2.59182,6.),(8.722944,3.239775,6.),(8.642564,3.88773,6.),(8.562184,4.535685,6.),(8.608844,4.813532,6.)) tPoints = ((8.613523,21.058475,6.),(8.483499,21.382516,6.),(8.557826,22.030471,6.),(8.632154,22.678426,6.),(8.706481,23.326381,3.),(8.780808,23.974336,3.),(8.855136,24.622291,6.),(8.929463,25.270246,6.),(9.003791,25.918201,6.)) aPoints = ((0.,10.461036,6.),(0.375,10.58594,6.),(0.751,10.710843,6.),(1.127587,10.835746,6.),(1.503449,10.464365,3.),(1.503449,10.960649,6.),(2.255173,11.210456,6.),(2.631035,11.335359,6.),(3.415147,11.727949,6.)) ''' ## SHORTCUTS myModel = mdb.models[param['modelName']] myAssembly = myModel.rootAssembly myASets = myAssembly.sets ## STEP CREATION nlGeom = OFF if param['nlgeom']: nlGeom = ON if 'Cohesive' in param['interfaceType']: myModel.StaticStep(initialInc=1e-6 ,timePeriod=param['timePeriod'], maxInc=.1, minInc=1e-9, name='Load', nlgeom=nlGeom, previous='Initial',maxNumInc=10000) else: myModel.StaticStep(initialInc=1e-5 ,timePeriod=param['timePeriod'], maxInc=.1, minInc=1e-8, name='Load', nlgeom=nlGeom, previous='Initial',maxNumInc=10000) directions = list() matNames = list() for p,myPart in enumerate(myModel.parts.values()): myPSet = myPart.sets partNo = int(myPart.name.split('_')[1]) ## MATERIALS myMatA = myModel.materials['MATA_%i'%partNo] myMatP = myModel.materials['MATP_%i'%partNo] fullPartSet = myPart.sets['ALLPARTSET'] EA,nuA = getEandNu(param['holzapfelParametersA']) EP,nuP = getEandNu(param['holzapfelParametersP']) if param['matType'] == 'Hooke': myMatA.Elastic(table=((EA, nuA), )) myMatP.Elastic(table=((EP, nuP), )) elif param['matType'] == 'neoHooke': myMatA.Hyperelastic(testData=OFF,table=((EA/(4*(1.+nuA)),6*(1-2.*nuA)/EA),),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=COMPRESSIBLE) myMatP.Hyperelastic(testData=OFF,table=((EP/(4*(1.+nuP)),6*(1-2.*nuP)/EP),),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=COMPRESSIBLE) elif param['matType'] == 'Holzapfel': if param['twoDirections']: myMatA.Hyperelastic(table=(param['holzapfelParametersA'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=2) myMatP.Hyperelastic(table=(param['holzapfelParametersP'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=2) else: myMatA.Hyperelastic(table=(param['holzapfelParametersA'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=1) myMatP.Hyperelastic(table=(param['holzapfelParametersP'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=1) datum = myPart.DatumAxisByPrincipalAxis(principalAxis=ZAXIS) normalAxis = myPart.surfaces['EXTERNALSURFACE'] myPart.MaterialOrientation(region=fullPartSet, orientationType=DISCRETE, axis=AXIS_1, normalAxisDefinition=SURFACE, normalAxisRegion=normalAxis, normalAxisDirection=AXIS_1, primaryAxisDefinition=DATUM, primaryAxisDatum=myPart.datums[datum.id], primaryAxisDirection=AXIS_3) fibreAngle = param['fiberOrientation'][p] directions.append((0.,math.cos(fibreAngle),math.sin(fibreAngle))) directions.append((0.,math.cos(fibreAngle),math.sin(fibreAngle))) matNames.append('MATA_%i'%partNo) matNames.append('MATP_%i'%partNo) ## ELEMENT INTEGRATION (to ensure hourglass control - may not be needed!!) elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4, elemLibrary=STANDARD) myPart.setElementType(regions=(myPart.elements,), elemTypes=(elemType1, elemType2)) pt1 = myPart.DatumPointByCoordinate(coords=(3.176303, 3.536555, 6.)) pt2 = myPart.DatumPointByCoordinate(coords=(5.731896, 6.466231, 6.)) pt3 = myPart.DatumPointByCoordinate(coords=(5.731896, 6.466231, 0.)) plane1 = myPart.DatumPlaneByThreePoints(point1=myPart.datums[pt1.id], point2=myPart.datums[pt2.id], point3=myPart.datums[pt3.id]) myPart.PartitionCellByDatumPlane(datumPlane=myPart.datums[plane1.id], cells=myPart.cells) pt4 = myPart.DatumPointByCoordinate(coords=(2.610235,21.445631,6.)) pt5 = myPart.DatumPointByCoordinate(coords=(5.016845,18.749067,6.)) pt6 = myPart.DatumPointByCoordinate(coords=(5.016845,18.749067,0.)) plane2 = myPart.DatumPlaneByThreePoints(point1=myPart.datums[pt4.id], point2=myPart.datums[pt5.id], point3=myPart.datums[pt6.id]) myPart.PartitionCellByDatumPlane(datumPlane=myPart.datums[plane2.id], cells=myPart.cells.findAt(())) sectionA = 'SectionA-%i'%partNo sectionP = 'SectionP-%i'%partNo myRegion = myPart.Set(cells=myPart.cells.findAt((middlePt,)), name='Set_'+sectionP) myPart.SectionAssignment(region=myRegion, sectionName=sectionP, offset=0.0, offsetType=MIDDLE_SURFACE) myAssembly.regenerate() ## CONSTRAINTS - same for all interfaces!! for nbInteraction in range(1,len(myModel.parts.keys())): myMaInstance = myAssembly.instances['INSTANCE_%i'%nbInteraction] mySlInstance = myAssembly.instances['INSTANCE_%i'%(nbInteraction+1)] from abaqusPythonTools.interactions import Interactions inter = Interactions(myModel) inter.setMasterSlave(myMaInstance.surfaces['INTERNALSURFACE'],mySlInstance.surfaces['EXTERNALSURFACE']) inter.setName('interaction_%i'%(nbInteraction)) if param['interfaceType'] == 'Tie': inter.setInteractionToTie() elif param['interfaceType'] == 'Friction': inter.setFrictionBehaviour('Friction') elif param['interfaceType'] == 'Rough': inter.setFrictionBehaviour('Rough') elif param['interfaceType'] == 'Cohesive': inter.setCohesiveBehaviour() elif param['interfaceType'] == 'CohesiveRough': inter.setCohesiveBehaviour() inter.setFrictionBehaviour('Rough') elif param['interfaceType'] == 'CohesiveFriction': inter.setCohesiveBehaviour() inter.setFrictionBehaviour('Friction') inter.createInteraction() ## BC'S - any vertical / internal pressure only / any vertical + internal pressure #print myASets if param['load'] == 'displ': myModel.DisplacementBC(createStepName='Load', name='displacement', region=myASets['ZMAX'], u3=param['loadMagnitude']) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] == 'shearLongAxis': myModel.DisplacementBC(createStepName='Load', name='displacement', region=myASets['ZMAX'], u2=param['loadMagnitude']) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] == 'shearShortAxis': myModel.DisplacementBC(createStepName='Load', name='displacement', region=myASets['ZMAX'], u1=param['loadMagnitude']) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] =='Pressure': # magnitude provided = PRESSURE myModel.Pressure(name='Pressure',createStepName='Load',region=myASurface['ZMAX'],magnitude=p['loadMagnitude'], distributionType=UNIFORM) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] == 'PressurePlane': myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) import regionToolset # magnitude provided = concentrated FORCE on the rigid plane surf = myModel.ConstrainedSketch(name='surf', sheetSize=200.) surf.Line(point1=(0., 0.), point2=(0.0, 30.)) surfPart = myModel.Part(name='crushingPart', dimensionality=THREE_D, type=ANALYTIC_RIGID_SURFACE) surfPart.AnalyticRigidSurfExtrude(sketch=surf, depth=30.) surfPart.ReferencePoint(point=(7.5, 15., 0.)) crushPlane = myAssembly.Instance(name='crushingPlane', part=surfPart, dependent=ON) myAssembly.ParallelFace(movablePlane=crushPlane.faces[0], fixedPlane=myASurface['ZMAX'], flip=ON) myAssembly.translate(instanceList=('crushingPlane', ), vector=(0., 0., 6.)) side1Faces1 = crushPlane.faces.getSequenceFromMask(mask=('[#1 ]', ), ) myCrushingSurface = myAssembly.Surface(side1Faces=side1Faces1, name='crushingSurface') myModel.Tie(name='tieTop', master=myCrushingSurface, slave=myASurface['ZMAX']) region = regionToolset.Region(referencePoints=(crushPlane.referencePoints[2], )) myModel.ConcentratedForce(name='Load-1', createStepName='Load', region=region, cf2=-p['loadMagnitude'], distributionType=UNIFORM, follower=ON) myModel.DisplacementBC(name='pressurePlane', createStepName='Load', region=region, u1=0., u2=0., ur1=0., ur2=0., ur3=0., distributionType=UNIFORM) elif param['internalLoad']:#z fixations if internal pressure only myModel.ZsymmBC(name='FixedTop',createStepName='Load',region=myASurface['ZMAX']) myModel.ZsymmBC(name='Fixed',createStepName='Load',region=myASurface['ZMIN']) else: raise Exception("no BC's have been defined!!") if param['internalLoad']: mostInnerPart = myAssembly.instances['INSTANCE_8'] mostInnerSurface = mostInnerPart.surfaces['INTERNALSURFACE'] myModel.Pressure(name='intPressure',createStepName='Load',region=mostInnerSurface,magnitude=p['internalLoad'], distributionType=UNIFORM) ## OUTPUT REQUESTS fieldVariable = ('S', 'LE', 'U', 'RT', 'P', 'CSTRESS', 'CDISP', 'CFORCE') myModel.fieldOutputRequests['F-Output-1'].setValues(variables=fieldVariable) ## JOB from abaqusPythonTools.jobCreation import JobDefinition myJobDef = JobDefinition(param['modelName']) myJobDef.setScratchDir(param['scratchDir']) if param['matType'] == 'Holzapfel': myJobDef.setToFibrous() myJobDef.fibreDirections(directions) if param['twoDirections']: myJobDef.setFibreInputType('twoDirections') myJob = myJobDef.create() if param['numCpus']>1: myJob.setValues(numCpus=param['numCpus'],numDomains=param['numCpus'],multiprocessingMode=THREADS) mdb.saveAs(param['modelName']) return myJob,mdb
def createAnalysis(param): if param['matType'] != 'Hooke' and not param['nlgeom']: print 'non linear geometry enforced with hyperelastic materials' param['nlgeom'] = True ## IMPORT FILE mdb.ModelFromInputFile(inputFileName=param['inpFile'], name=param['modelName']) abaqusTools.deleteDefaultModel() ## SHORTCUTS myModel = mdb.models[param['modelName']] myAssembly = myModel.rootAssembly myASets = myAssembly.sets myASurface = myAssembly.surfaces ## STEP CREATION nlGeom = OFF if param['nlgeom']: nlGeom = ON if 'Cohesive' in param['interfaceType']: myModel.StaticStep(initialInc=1e-5 ,timePeriod=param['timePeriod'], maxInc=.1, minInc=1e-9, name='Load', nlgeom=nlGeom, previous='Initial',maxNumInc=10000) elif param['interfaceType'] == 'Friction': myModel.StaticStep(initialInc=1e-4 ,timePeriod=param['timePeriod'], maxInc=.1, minInc=1e-9, name='Load', nlgeom=nlGeom, previous='Initial',maxNumInc=10000) else: myModel.StaticStep(initialInc=1e-3 ,timePeriod=param['timePeriod'], maxInc=.1, minInc=1e-8, name='Load', nlgeom=nlGeom, previous='Initial',maxNumInc=10000) myModel.steps['Load'].control.setValues(allowPropagation=OFF, resetDefaultValues=OFF, timeIncrementation=(8, 10, 0, 0, 10, 0, 12, 10, 0, 0, 50)) #I0=4(nb equ ite),Ir=8 (),Ip=9,Ic=16,Il=10,Ig=4,Is=12,Ia=5 (nb of cut back in 1 inc),Ij=6,It=3,Isc=50 directions = list() matNames = list() E,nu = getEandNu(param['holzapfelParameters']) for p,myPart in enumerate(myModel.parts.values()): myPSet = myPart.sets partNo = int(myPart.name.split('_')[1]) ## MATERIALS myMat = myModel.materials['MAT_%i'%partNo] try: del myMat.hyperelastic#delete existing material def except (AttributeError): pass fullPartSet = myPart.sets['ALLPARTSET'] if param['matType'] == 'Hooke': myMat.Elastic(table=((E, nu), )) elif param['matType'] == 'neoHooke': if param['holzapfelParameters'][1]==0.: myMat.Hyperelastic(testData=OFF,table=((E/(4*(1.+nu)),0.),),materialType=ISOTROPIC,type=NEO_HOOKE,behaviorType=INCOMPRESSIBLE) else: myMat.Hyperelastic(testData=OFF,table=((E/(4*(1.+nu)),6*(1-2.*nu)/E),),materialType=ISOTROPIC,type=NEO_HOOKE,behaviorType=COMPRESSIBLE) elif param['matType'] == 'Holzapfel': if param['holzapfelParameters'][1]==0.:# incompressible if param['twoDirections']: myMat.Hyperelastic(table=(param['holzapfelParameters'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=INCOMPRESSIBLE,localDirections=2) else: myMat.Hyperelastic(table=(param['holzapfelParameters'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=INCOMPRESSIBLE,localDirections=1) else: if param['twoDirections']: myMat.Hyperelastic(table=(param['holzapfelParameters'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=2) else: myMat.Hyperelastic(table=(param['holzapfelParameters'],),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=1) datum = myPart.DatumAxisByPrincipalAxis(principalAxis=ZAXIS) normalAxis = myPart.surfaces['EXTERNALSURFACE'] myPart.MaterialOrientation(region=fullPartSet, orientationType=DISCRETE, axis=AXIS_1, normalAxisDefinition=SURFACE, normalAxisRegion=normalAxis, normalAxisDirection=AXIS_1, primaryAxisDefinition=DATUM, primaryAxisDatum=myPart.datums[datum.id], primaryAxisDirection=AXIS_3) fibreAngle = param['fiberOrientation'][p] directions.append((0.,math.cos(fibreAngle),math.sin(fibreAngle))) matNames.append('MAT_%i'%partNo) ## ELEMENT INTEGRATION (to ensure hourglass control - may not be needed!!) elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4, elemLibrary=STANDARD) myPart.setElementType(regions=(myPart.elements,), elemTypes=(elemType1, elemType2)) myModel.HomogeneousSolidSection('section_%s'%partNo, material='MAT_%i'%partNo) myPart.SectionAssignment(region=fullPartSet, sectionName='section_%s'%partNo) ## CONSTRAINTS - same for all interfaces!! for nbInteraction in range(1,len(myModel.parts.keys())): myMaInstance = myAssembly.instances['INSTANCE_%i'%nbInteraction] mySlInstance = myAssembly.instances['INSTANCE_%i'%(nbInteraction+1)] from abaqusPythonTools.interactions import Interactions inter = Interactions(myModel) inter.setMasterSlave(myMaInstance.surfaces['INTERNALSURFACE'],mySlInstance.surfaces['EXTERNALSURFACE']) inter.setName('interaction_%i'%(nbInteraction)) if param['interfaceType'] == 'Tie': inter.setInteractionToTie() elif param['interfaceType'] == 'Friction': inter.setFrictionBehaviour('Friction',param['frictionCoef']) inter.setSeparationAllowed() elif param['interfaceType'] == 'Rough': inter.setFrictionBehaviour('Rough') elif param['interfaceType'] == 'Cohesive': inter.setCohesiveBehaviour(useDefaultBehaviour=False,penalties=param['cohesivePenalties']) elif param['interfaceType'] == 'CohesiveRough': inter.setCohesiveBehaviour(useDefaultBehaviour=False) inter.setFrictionBehaviour('Rough') elif param['interfaceType'] == 'CohesiveFriction': inter.setCohesiveBehaviour(useDefaultBehaviour=False) inter.setFrictionBehaviour('Friction',param['frictionCoef']) inter.createInteraction() ## BC'S - any vertical / internal pressure only / any vertical + internal pressure if param['load'] == 'displ': myModel.DisplacementBC(createStepName='Load', name='displacement', region=myASets['ZMAX'], u3=param['loadMagnitude']) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) #if 'Cohesive' not in param['interfaceType'] and param['interfaceType'] != 'Friction': myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] =='Pressure': # magnitude provided = PRESSURE myModel.Pressure(name='Pressure',createStepName='Load',region=myASurface['ZMAX'],magnitude=param['loadMagnitude'], distributionType=UNIFORM) myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) myModel.DisplacementBC(createStepName='Load', name='noRadialDispl', region=myASets['ZMAX'], u1=0., u2=0.) elif param['load'] == 'PressurePlane': myModel.PinnedBC(createStepName='Load', name='fixation', region=myASets['ZMIN']) import regionToolset # magnitude provided = concentrated FORCE on the rigid plane surf = myModel.ConstrainedSketch(name='surf', sheetSize=200.) surf.Line(point1=(-1., 0.), point2=(17., 0.)) surfPart = myModel.Part(name='crushingPart', dimensionality=THREE_D, type=ANALYTIC_RIGID_SURFACE) surfPart.AnalyticRigidSurfExtrude(sketch=surf, depth=26.) crushPlane = myAssembly.Instance(name='crushingPlane', part=surfPart, dependent=ON) myAssembly.rotate(instanceList=('crushingPlane', ), axisPoint=(0., 0., 0.), axisDirection=(1., 0., 0.), angle=90.) myAssembly.translate(instanceList=('crushingPlane', ), vector=(0., 13., 6.)) surfPart.ReferencePoint(point=(8., 0., 0.)) myCrushingSurface = myAssembly.Surface(side1Faces=crushPlane.faces.getSequenceFromMask(mask=('[#1 ]', ), ), name='crushingSurface') myModel.Tie(name='tieTop', master=myCrushingSurface, slave=myASurface['ZMAX']) region = regionToolset.Region(referencePoints=(crushPlane.referencePoints[2], )) myModel.ConcentratedForce(name='Load-1', createStepName='Load', region=region, cf3=-param['loadMagnitude'], distributionType=UNIFORM, follower=ON) myModel.DisplacementBC(name='pressurePlane', createStepName='Load', region=region, u1=0., u2=0., ur1=0., ur2=0., ur3=0., distributionType=UNIFORM) elif param['internalLoad']:#z fixations if internal pressure only myModel.ZsymmBC(name='FixedTop',createStepName='Load',region=myASurface['ZMAX']) myModel.ZsymmBC(name='Fixed',createStepName='Load',region=myASurface['ZMIN']) else: raise Exception("no BC's have been defined!!") if param['internalLoad']: try: mostInnerSurface = myAssembly.instances['INSTANCE_8'].surfaces['INTERNALSURFACE'] except KeyError: if param['twoDirections']: mostInnerSurface = myAssembly.instances['INSTANCE_1'].surfaces['INTERNALSURFACE'] else: raise Exception("Undefined internal surface") myModel.Pressure(name='intPressure',createStepName='Load',region=mostInnerSurface,magnitude=param['internalLoad'], distributionType=UNIFORM) ## OUTPUT REQUESTS # fieldVariable = ('S', 'LE', 'U', 'RT', 'P', 'CSTRESS', 'CDISP', 'CFORCE') # myModel.fieldOutputRequests['F-Output-1'].setValues(variables=fieldVariable) ## JOB from abaqusPythonTools.jobCreation import JobDefinition myJobDef = JobDefinition(param['modelName']) myJobDef.setScratchDir(param['scratchDir']) if param['matType'] == 'Holzapfel': myJobDef.setToFibrous() myJobDef.fibreDirections(directions) if param['twoDirections']: myJobDef.setFibreInputType('twoDirections') myJob = myJobDef.create() if param['numCpus']>1: myJob.setValues(numCpus=param['numCpus'],numDomains=param['numCpus'],multiprocessingMode=THREADS) mdb.saveAs(param['modelName']) return myJob,mdb
def createAnalysis(param): if param['matType'] != 'Hooke' and not param['nlgeom']: print 'non linear geometry enforced with hyperelastic materials' param['nlgeom'] = True ## IMPORT FILE if param['sipInpFile']: myModel = mdb.ModelFromInputFile(inputFileName=param['sipInpFile'], name=param['modelName']) shellTo2DGeo(myModel) else: myModel = mdb.ModelFromInputFile(inputFileName=param['inpFile'], name=param['modelName']) abaqusTools.deleteDefaultModel() ## SHORTCUTS myAssembly = myModel.rootAssembly allMats = myModel.materials ## STEP CREATION nlGeom = OFF if param['nlgeom']: nlGeom = ON t0 = 0.01 if (param['interfaceType'] is not 'Tie') and (param['interfaceType'] is not 'Rough'):t0 = 1e-5 myModel.StaticStep(initialInc=t0 ,timePeriod=param['timePeriod'], maxInc=.1, minInc=1e-9, name='displ', nlgeom=nlGeom, previous='Initial') directions = list() matNames = list() slMaCouples = list() for i,myPart in enumerate(myModel.parts.values()): myPSet = myPart.sets part = myPart.name.split('_')[0] if part == 'INPLANE6' and param['load'] == 'custom': del myModel.parts['INPLANE6_Geo'] del myAssembly.features['INPLANE6_instance'] continue partType = [p for p in param['parts'] if p in part][0]#find if it is a sectionned or in plane lamellae ## MATERIALS cSys = myPart.DatumCsysByThreePoints(coordSysType=CARTESIAN,origin=(0.,0.,0.),point1=(1.,0.,0.),point2=(0.,1.,0.)) mat = 'SM_'+part if allMats.has_key(mat): myMat = myModel.materials[mat] else: print 'material %s unknown!!!'%mat continue E = 0.06#equivalent GM only as we are perp to fibers!! nu = 0.499 if partType == 'BRIDGES': myMat.Elastic(table=((0.4, 0.45), )) elif param['matType'] == 'Hooke': myMat.Elastic(table=((E, nu), )) elif param['matType'] == 'neoHooke': matParam = (E/(4*(1.+nu)),6*(1-2.*nu)/E) if matParam[1]==0.:# incompressible myMat.Hyperelastic(testData=OFF,table=(matParam,),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=INCOMPRESSIBLE) else: myMat.Hyperelastic(testData=OFF,table=(matParam,),materialType=ISOTROPIC,type=NEO_HOOKE ,behaviorType=COMPRESSIBLE) elif param['matType'] == 'Holzapfel': if partType == 'SECTIONED': #issue: shell/2D do not allow for mat properties out-of-plane --> fibres cannot be out-of-plane #--> the effect of the angle is incorporated into the mat properties, k1 only, that are reduced according to the cos of the angle fibreAngle = 2.*param['fiberOrientation'] matParam = (param['holzapfelParameters'][0],param['holzapfelParameters'][1],param['holzapfelParameters'][2]*math.cos(fibreAngle),param['holzapfelParameters'][3],param['holzapfelParameters'][4]) else: matParam = param['holzapfelParameters'] if matParam[1]==0.:# incompressible myMat.Hyperelastic(table=(matParam,),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=INCOMPRESSIBLE,localDirections=1) else: myMat.Hyperelastic(table=(matParam,),materialType=ANISOTROPIC,anisotropicType=HOLZAPFEL ,behaviorType=COMPRESSIBLE,localDirections=1) myPart.MaterialOrientation(region=(myPart.faces[0],), orientationType=SYSTEM, axis=AXIS_3, localCsys=myPart.datums[cSys.id])#AXIS_3 is the normal to the shell directions.append((0.,1.,0.)) matNames.append(mat) ## SECTION myModel.HomogeneousSolidSection(name='Section_%s'%part, material=mat, thickness=None) myPart.SectionAssignment(region=(myPart.faces[0],), sectionName='Section_%s'%part) ## BC'S myISet = myAssembly.instances['%s_instance'%part].sets dMin = 'NS_%s_WITH_XMIN'%part dMax = 'NS_%s_WITH_XMAX'%part if param['load'] == 'custom': if 'tt01_01_noBScSegDS' in param['sipInpFile']: if myISet.has_key(dMin): myModel.PinnedBC(createStepName='displ', localCsys=None, name='fix_%d'%(i), region=myISet[dMin]) if part == 'SECTIONED5': x1 = (1.10898,1.29364) x2 = (1.29274,0.74189) d1 = (0.134,-0.12) d2 = (0.18,-0.10) for node in myISet['SF_%s_WITH_INPLANE6'%part].nodes: i += 1 abaqusTools.applyInterpolatedDisplacement(myModel,node,x1,x2,d1,d2,'mov_%d'%(i)) elif 'tt02_02_CroppedNoBScSegDS' in param['sipInpFile']: if myISet.has_key(dMax): myModel.PinnedBC(createStepName='displ', localCsys=None, name='fix_%d'%(i), region=myISet[dMax]) if part == 'SECTIONED2': x1 = (0.261,1.943) x2 = (0.297,0) d1 = (-0.23617,0.09717) d2 = (-0.390945,-0.02034) for node in myISet['SF_%s_WITH_INPLANE1'%part].nodes: i += 1 abaqusTools.applyInterpolatedDisplacement2(myModel,node,x1,x2,d1,d2,'mov_%d'%(i)) else: if myISet.has_key(dMin): myModel.PinnedBC(createStepName='displ', localCsys=None, name='fix_%d'%(i), region=myISet[dMin]) if myISet.has_key(dMax): if param['load'] == 'tension': myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=myISet[dMax], u1=param['displ']) elif param['load'] == 'shear': myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=myISet[dMax], u2=param['displ']) else:raise Exception('unknonw load type') ## Get Master/Slave couples oParts = list(myModel.parts.keys()) oParts.remove(myPart.name) for setName in myPSet.keys(): if setName.startswith('SF_%s_WITH_'%part): for oPart in oParts: oPartName = oPart.split('_')[0] if oPartName=='INPLANE6': continue elif oPartName in setName: if [oPartName,part] not in slMaCouples: slMaCouples.append([part,oPartName]) ## CONSTRAINTS - same for all interfaces!! for nbInteraction,slMaCouple in enumerate(slMaCouples): masterName = 'SF_%s_WITH_%s'%(slMaCouple[1],slMaCouple[0]) slaveName = 'SF_%s_WITH_%s'%(slMaCouple[0],slMaCouple[1]) myMaInstance = myAssembly.instances['%s_instance'%slMaCouple[1]] mySlInstance = myAssembly.instances['%s_instance'%slMaCouple[0]] from abaqusPythonTools.interactions import Interactions inter = Interactions(myModel) inter.setName('interaction_%i'%nbInteraction) if param['interfaceType'] == 'Tie': inter.setMasterSlave(myMaInstance.sets[masterName],mySlInstance.sets[slaveName]) inter.setInteractionToTie() else: inter.setMasterSlave(myMaInstance.surfaces[masterName],mySlInstance.surfaces[slaveName]) inter.setNormalStiffness(param['normalStiffness']) if param['interfaceType'] == 'Friction': inter.setFrictionBehaviour('Friction') elif param['interfaceType'] == 'Rough': inter.setFrictionBehaviour('Rough') elif param['interfaceType'] == 'Cohesive': inter.setCohesiveBehaviour(useDefaultBehaviour=False,penalties=param['cohesivePenalties']) elif param['interfaceType'] == 'CohesiveRough': inter.setCohesiveBehaviour(useDefaultBehaviour=False,penalties=param['cohesivePenalties']) inter.setFrictionBehaviour('Rough') elif param['interfaceType'] == 'CohesiveFriction': inter.setCohesiveBehaviour() inter.setFrictionBehaviour('Friction') inter.createInteraction() ## OUTPUT REQUESTS #fieldVariable = ('S', 'LE', 'U', 'RF', 'P', 'CSTRESS', 'CDISP', 'CFORCE') #myModel.fieldOutputRequests['F-Output-1'].setValues(variables=fieldVariable) ## JOB from abaqusPythonTools.jobCreation import JobDefinition myJobDef = JobDefinition(param['modelName']) myJobDef.setScratchDir(param['scratchDir']) if param['matType'] == 'Holzapfel': myJobDef.setToFibrous() myJobDef.fibreDirections(directions) myJobDef.setFibreInputType('fromSip') myJobDef.setMatNames(matNames) myNewJob = myJobDef.create() if param['numCpus']>1: myNewJob.setValues(numCpus=param['numCpus'],numDomains=param['numCpus'],multiprocessingMode=DEFAULT) mdb.saveAs(param['modelName']) return myNewJob,mdb
def createAnalysisFromSipExport(param): ## IMPORT FILE mdb.ModelFromInputFile(inputFileName=param['sipInpFile'], name=param['modelName']) abaqusTools.deleteDefaultModel() ## SHORTCUTS myModel = mdb.models[param['modelName']] myPart = myModel.parts['PART-1'] myInstance = myModel.rootAssembly.instances['PART-1-1'] mySets = myModel.rootAssembly.sets ## STEP CREATION nlGeom = OFF if param['nlgeom']: nlGeom = ON if param['matType'] == 'Hooke': initInc = .05 maxInc = .15 else: initInc = .01 maxInc = .1 if 'Contact' in param['sipInpFile']: initInc = 1e-4 maxInc = .1 minInc = min(initInc,maxInc)/1000. myModel.StaticStep(initialInc=initInc ,timePeriod=param['timePeriod'], maxInc=maxInc, minInc=minInc, name='displ', nlgeom=nlGeom, previous='Initial') ## ELEMENT INTEGRATION (to ensure hourglass control - may not be needed!!) elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=STANDARD, hourglassControl=ENHANCED) elemType2 = mesh.ElemType(elemCode=C3D4, elemLibrary=STANDARD) myPart.setElementType(regions=(myPart.elements,), elemTypes=(elemType1, elemType2)) for i,p in enumerate(param['parts']): ## MATERIALS mat = 'PM_'+p myMat = myModel.materials[mat] if param['matType'] == 'Hooke': if param['matParameters'][1] == 0.5: matParam = (param['matParameters'][0],0.499) else: matParam = param['matParameters'] if 'BOX' in mat: myMat.Elastic(table=((matParam[0]/10., matParam[1]), )) else: myMat.Elastic(table=(matParam, )) elif param['matType'] == 'neoHooke': c10 = param['matParameters'][0]/(2*(1+param['matParameters'][1])) D = (6*(1-2*param['matParameters'][1]))/param['matParameters'][0] if 'BOX' in mat: matParam = (c10/10.,D*10) else: matParam = (c10,D) if D==0.:# incompressible myMat.Hyperelastic(table=(matParam,),materialType=ISOTROPIC,anisotropicType=NEO_HOOKE ,behaviorType=INCOMPRESSIBLE) else: myMat.Hyperelastic(table=(matParam,),materialType=ISOTROPIC,anisotropicType=NEO_HOOKE ,behaviorType=COMPRESSIBLE) ##BC'S dMin = 'NS_%s_WITH_%sMIN'%(p,param['loadDirection']) if mySets.has_key(dMin): myModel.PinnedBC(createStepName='displ', localCsys=None, name='fix_%d'%(i), region=mySets[dMin]) dMax = 'NS_%s_WITH_%sMAX'%(p,param['loadDirection']) if mySets.has_key(dMax): if param['loadDirection'] == 'X': myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=mySets[dMax], u1=param['displ']) elif param['loadDirection'] == 'Y': myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=mySets[dMax], u2=param['displ']) elif param['loadDirection'] == 'Z': myModel.DisplacementBC(createStepName='displ', localCsys=None, name='mov_%d'%(i), region=mySets[dMax], u3=param['displ']) ##CONSTRAINTS - same for all interfaces - could be changed depending on the interface name!! if 'Contact' in param['sipInpFile']: for interactionName in myModel.interactionProperties.keys(): from abaqusPythonTools.interactions import Interactions inter = Interactions(myModel) inter.setName(interactionName) if param['interfaceType'] == 'Friction': inter.setFrictionBehaviour('Friction') inter.changeInteraction() ## OUTPUT REQUESTS fieldVariable = ('S', 'LE', 'U', 'RT', 'P', 'CSTRESS', 'CDISP', 'CFORCE') myModel.fieldOutputRequests['F-Output-1'].setValues(variables=fieldVariable) ##JOB from abaqusPythonTools.jobCreation import JobDefinition myJobDef = JobDefinition(param['modelName']) myJobDef.setScratchDir(param['scratchDir']) myJob = myJobDef.create() if param['numCpus']>1: myJob.setValues(numCpus=param['numCpus'],numDomains=param['numCpus'],multiprocessingMode=DEFAULT) mdb.saveAs(myJob.name) #----------------------------------------------------------- return myJob,mdb