def containedDisplExtractors(odbName): keysToWrite = [ 'radialDisp_intFace', 'resForce_intFace', 'radialDisp_outFace', 'resForce_outFace', 'time' ] valuesToWrite = dict.fromkeys(keysToWrite, None) run = False for data in range(len(valuesToWrite)): file = valuesToWrite.keys()[data] + '.ascii' if (not os.path.isfile(file))\ or (os.path.getmtime(file) < os.path.getmtime('exeCalls.txt'))\ or (os.path.getmtime(file) < os.path.getmtime(__file__)): run = True break if run: print "running postPro on %s" % (odbName) myOdb = odbTools.openOdb(odbName) time = ext.getTime(myOdb) intRadialDispl = ext.getU_3(myOdb, 'innerFace') extRadialDispl = ext.getU_3(myOdb, 'outerFace') inResForce = ext.getResF(myOdb, 'innerFace') outResForce = ext.getResF(myOdb, 'outerFace') valuesToWrite = dict(radialDisp_intFace=intRadialDispl, radialDisp_outFace=extRadialDispl, resForce_intFace=inResForce, resForce_outFace=outResForce, time=time) odbTools.writeValues(valuesToWrite) myOdb.close()
def appliedDisplExtractors(odbName): keysToWrite = ['time', 'topResForce', 'bottomResForce'] keysToWrite.append('initCoord') keysToWrite.append('radialDisp') keysToWrite.append('axialDisp') keysToWrite.append('tgtDisp') valuesToWrite = dict.fromkeys(keysToWrite, None) run = False for data in valuesToWrite.keys(): file = data + '.ascii' if (not os.path.isfile(file))\ or (os.path.getmtime(file) < os.path.getmtime('exeCalls.txt'))\ or (os.path.getmtime(file) < os.path.getmtime(__file__)): run = True break if run: print "running postPro on %s" % (odbName) myOdb = odbTools.openOdb(odbName) myAssembly = myOdb.rootAssembly #create node set from surface mainPart = myAssembly.instances['PART-1-1'] extSetName = 'EXTERNALANNULUS' if extSetName not in myAssembly.nodeSets.keys(): mySurface = mainPart.surfaces[extSetName] nodeList = list() for e in mySurface.elements: nodeList.extend([ nodeLbl for nodeLbl in e.connectivity if nodeLbl not in nodeList ]) myNodes = tuple(nodeList) extSet = myAssembly.NodeSetFromNodeLabels(name=extSetName, nodeLabels=(('PART-1-1', myNodes), )) else: try: extSet = myAssembly.nodeSets[extSetName] except: raise Exception('FIND SURFACE') cylSystem = getCylDatum(myOdb) valuesToWrite['time'] = ext.getTime(myOdb) valuesToWrite['topResForce'] = ext.getResF( myOdb, 'NS_TOPPLATE_WITH_BACKGROUND', sysC=cylSystem) valuesToWrite['bottomResForce'] = ext.getResF( myOdb, 'NS_BOTTOMPLATE_WITH_BACKGROUND', sysC=cylSystem) valuesToWrite['initCoord'] = ext.getNCoord(myOdb, extSet, sysC=cylSystem) valuesToWrite['radialDisp'] = ext.getU_1(myOdb, extSet, sysC=cylSystem) valuesToWrite['tgtDisp'] = ext.getU_2(myOdb, extSet, sysC=cylSystem) valuesToWrite['axialDisp'] = ext.getU_3(myOdb, extSet, sysC=cylSystem) odbTools.writeValues(valuesToWrite) myOdb.close()
def appliedPressureExtractors(odbName): sets = [ 'edgeXMax', 'edgeXMaxInt', 'edgeXMin', 'edgeXMinInt', 'edgeYMax', 'edgeYMaxInt', 'edgeYMin', 'edgeYMinInt' ] keysToWrite = ['time', 'topAxialDispl'] for set in sets: keysToWrite.append('initCoord_%s' % set) keysToWrite.append('radialDisp_%s' % set) keysToWrite.append('axialDisp_%s' % set) keysToWrite.append('tgtDisp_%s' % set) valuesToWrite = dict.fromkeys(keysToWrite, None) run = False for data in valuesToWrite.keys(): file = data + '.ascii' if (not os.path.isfile(file))\ or (os.path.getmtime(file) < os.path.getmtime('exeCalls.txt'))\ or (os.path.getmtime(file) < os.path.getmtime(__file__)): run = True break if run: print "running postPro on %s" % (odbName) myOdb = odbTools.openOdb(odbName) sysCyl = geometricTools.cylXYCoordSystem(myOdb.rootAssembly) valuesToWrite['time'] = ext.getTime(myOdb) valuesToWrite['topAxialDispl'] = ext.getU_3(myOdb, 'zMax', sysC=sysCyl) for set in sets: valuesToWrite['initCoord_%s' % set] = ext.getNCoord(myOdb, set, sysC=sysCyl) valuesToWrite['radialDisp_%s' % set] = ext.getU_1(myOdb, set, sysC=sysCyl) valuesToWrite['tgtDisp_%s' % set] = ext.getU_2(myOdb, set, sysC=sysCyl) valuesToWrite['axialDisp_%s' % set] = ext.getU_3(myOdb, set, sysC=sysCyl) odbTools.writeValues(valuesToWrite) myOdb.close()
def postPro(odbName): odbToolbox = r"D:\myWork\procedures\postPro4Abq_VC" import sys sys.path.append(odbToolbox) import postProTools.odbTools as odbTools import postProTools.extractors as ext myOdb = odbTools.openOdb(odbName) refPoint = 'REFERENCE_POINT_PART-2-1 1' extDispl = ext.getU_3(myOdb, refPoint) extDiplsList = [displ[0] for displ in extDispl] outForce = ext.getRF_3(myOdb, refPoint) extForceList = [force[0] for force in outForce] stiffness = extForceList[-1] / extDiplsList[-1] * 1000. odbTools.writeValuesOpti(stiffness) myOdb.close()
def postPro(odbName): odbToolbox = r"D:\myWork\procedures\postPro4Abq_VC" import sys sys.path.append(odbToolbox) print 'running postPro on ', odbName import postProTools.odbTools as odbTools import postProTools.extractors as ext myOdb = odbTools.openOdb(odbName) forceExt = ext.getRF_3(myOdb, 'TOPRP') displExt = ext.getU_3(myOdb, 'TOPRP') extDiplsList = [abs(displ[0] - displExt[0][0]) for displ in displExt] extForceList = [abs(force[0] - forceExt[0][0]) for force in forceExt] idx = [n for n, i in enumerate(extDiplsList) if i > 0.2] try: idx = idx[0] #disregard first .2 mm ie about 0.5% except: idx = -1 # if no displacement is higher than 0.2, then output is 0 odbTools.writeValuesOpti(zip(extDiplsList[idx:], extForceList[idx:])) myOdb.close()
def postPro(odbName): print 'running postPro on ', odbName import postProTools.odbTools as odbTools import postProTools.extractors as ext import postProTools.contactExtractors as cExt valuesToWrite = dict() myOdb = odbTools.openOdb(odbName) fileName = odbName.split('.')[0] valuesToWrite['axialDispl_%s' % fileName] = ext.getU_3(myOdb, 'TOPPLATE') valuesToWrite['force_%s' % fileName] = ext.getRF_3(myOdb, 'TOPPLATE') try: masterName = 'CP-2-bot' slaveName = 'CP-2-PART-1-1' valuesToWrite['cForce1_%s' % fileName] = cExt.getCNormalForce_Magnitude( myOdb, masterName, slaveName) masterName = 'CP-3-bot' slaveName = 'CP-3-PART-1-1' valuesToWrite['cForce2_%s' % fileName] = cExt.getCNormalForce_Magnitude( myOdb, masterName, slaveName) except: masterName = 'topCartilage1' slaveName = 'botCartilage1' valuesToWrite['cForce1_%s' % fileName] = cExt.getCNormalForce_Magnitude( myOdb, masterName, slaveName) masterName = 'topCartilage2' slaveName = 'botCartilage2' valuesToWrite['cForce2_%s' % fileName] = cExt.getCNormalForce_Magnitude( myOdb, masterName, slaveName) odbTools.writeValues(valuesToWrite) print 'postPro on ', odbName, ': DONE' myOdb.close()