def get_stress_tensors_from_path(path, session, output_position=ELEMENT_NODAL): session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable( variableLabel='S', outputPosition=output_position, refinement=[COMPONENT, 'S11']) xy = xyPlot.XYDataFromPath(name='Stress profile', path=path, labelType=TRUE_DISTANCE, shape=UNDEFORMED, pathStyle=PATH_POINTS, includeIntersections=False) stress_data = np.zeros((max(len(xy), 100), 7)) print(len(xy)) comps = ['S11', 'S22', 'S33', 'S12', 'S13', 'S23'] for i, comp in enumerate(comps): session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable( variableLabel='S', outputPosition=output_position, refinement=[COMPONENT, comp]) xy = xyPlot.XYDataFromPath(name='Stress profile', path=path, labelType=TRUE_DISTANCE, shape=UNDEFORMED, pathStyle=PATH_POINTS, includeIntersections=False) print(len(xy)) for idx, (pos, stress_comp) in enumerate(xy): stress_data[idx, 0] = pos stress_data[idx, i + 1] = stress_comp return stress_data
def get_data_from_path(path, session, variable, component=None, output_position=ELEMENT_NODAL): if component is None: session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable(variableLabel=variable, outputPosition=output_position) else: session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable(variableLabel=variable, outputPosition=output_position, refinement=[COMPONENT, component]) xy = xyPlot.XYDataFromPath(name=path.name + '_' + variable, path=path, labelType=TRUE_DISTANCE, shape=UNDEFORMED, pathStyle=PATH_POINTS, includeIntersections=False) return np.array(xy)
def get_scalar_field_from_path(path, session, variable, output_position=ELEMENT_NODAL): data = np.zeros((100, 2)) session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable( variableLabel=variable, outputPosition=output_position) xy = xyPlot.XYDataFromPath(name='Stress profile', path=path, labelType=TRUE_DISTANCE, shape=UNDEFORMED, pathStyle=PATH_POINTS, includeIntersections=False) for idx, (pos, value) in enumerate(xy): data[idx, :] = pos, value return data
def extractPathsfromODBoutputSet01(wd,project,deltapsi,nl,nSegsOnPath,tol,logfile): writeLineToLogFile(logfile,'a','Starting path extraction on project ' + project + '\n',True) # define database name odbname = project + '.odb' odbfullpath = join(wd,project,'solver',odbname) # define input file name inpname = project + '.inp' inpfullpath = join(wd,project,'input',inpname) # define csv output folder csvfolder = join(wd,project,'csv') # open odb writeLineToLogFile(logfile,'a','Open odb ' + odbname + ' in folder ' + join(wd,project,'solver') + ' ...\n',True) odb = openOdb(path=odbfullpath) writeLineToLogFile(logfile,'a','... done.',True) #======================================================================= # get first and last frame #======================================================================= skipLineToLogFile(logfile,'a',True) writeLineToLogFile(logfile,'a','Get first and last frame...\n',True) firstFrame = odb.steps[odb.steps.keys()[-1]].frames[0] lastFrame = odb.steps[odb.steps.keys()[-1]].frames[-1] writeLineToLogFile(logfile,'a','... done.',True) #======================================================================= # get deformed nodes #======================================================================= skipLineToLogFile(logfile,'a',True) writeLineToLogFile(logfile,'a','Get deformed nodes...\n',True) nodes = {} intpoints = {} nodesCoords = lastFrame.fieldOutputs['COORD'].getSubset(position=NODAL) intpointCoords = lastFrame.fieldOutputs['COORD'].getSubset(position=INTEGRATION_POINT) for value in nodesCoords.values: components = [] for component in value.data: components.append(component) nodes[str(value.nodeLabel)] = components for value in intpointCoords.values: components = [] for component in value.data: components.append(component) intpoints[str(value.nodeLabel)] = components with open(join(csvfolder,'defnodesCoords.csv'),'w') as csv: csv.write('DATA\n') csv.write('NODE TYPE, NODE LABEL, X, Y\n') for value in nodesCoords.values: csv.write('NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') with open(join(csvfolder,'defintpointCoords.csv'),'w') as csv: csv.write('DATA\n') csv.write('NODE TYPE, NODE LABEL, X, Y\n') for value in intpointCoords.values: csv.write('INTEGRATION-POINTS' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') defSW = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['SW-CORNERNODE']) defSE = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['SE-CORNERNODE']) defNE = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['NE-CORNERNODE']) defNW = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['NW-CORNERNODE']) defLowerSideNoCorn = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['LOWERSIDE-NODES-WITHOUT-CORNERS']) defRightSideNoCorn = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['RIGHTSIDE-NODES-WITHOUT-CORNERS']) defUpperSideNoCorn = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['UPPERSIDE-NODES-WITHOUT-CORNERS']) defLeftSideNoCorn = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['LEFTSIDE-NODES-WITHOUT-CORNERS']) with open(join(csvfolder,'defboundaryNodesCoords.csv'),'w') as csv: csv.write('DATA\n') csv.write('NODE SET' + ', ' + 'NODE TYPE, NODE LABEL, X, Y\n') for value in defSW.values: csv.write('SW-CORNER' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') for value in defLowerSideNoCorn.values: csv.write('LOWERSIDE-NODES-WITHOUT-CORNERS' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') for value in defSE.values: csv.write('SE-CORNER' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') for value in defRightSideNoCorn.values: csv.write('RIGHTSIDE-NODES-WITHOUT-CORNERS' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') for value in defNE.values: csv.write('NE-CORNER' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') for value in defUpperSideNoCorn.values: csv.write('UPPERSIDE-NODES-WITHOUT-CORNERS' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') for value in defNW.values: csv.write('NW-CORNER' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') for value in defLeftSideNoCorn.values: csv.write('LEFTSIDE-NODES-WITHOUT-CORNERS' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') defFiberSurf = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['FIBERSURFACE-NODES']) defMatrixSurfAtFiberInter = nodesCoords.getSubset(region=odb.rootAssembly.instances['PART-1-1'].nodeSets['MATRIXSURFACEATFIBERINTERFACE-NODES']) with open(join(csvfolder,'deffiberInterfaceNodesCoords.csv'),'w') as csv: csv.write('DATA\n') csv.write('NODE SET, NODE TYPE, NODE LABEL, X, Y\n') for value in defFiberSurf.values: csv.write('FIBERSURFACE-NODES' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') for value in defMatrixSurfAtFiberInter.values: csv.write('MATRIXSURFACEATFIBERINTERFACE-NODES' + ', ' + 'NODAL' + ', ' + str(value.nodeLabel) + ', ' + str(value.data[0]) + ', ' + str(value.data[1]) + '\n') writeLineToLogFile(logfile,'a','... done.',True) #======================================================================= # get Rf and l in the deformed configuration #======================================================================= skipLineToLogFile(logfile,'a',True) writeLineToLogFile(logfile,'a','Get Rf and l in the deformed configuration...\n',True) meanDefRf = 0 countRf = 0 for value in defFiberSurf.values: countRf += 1 meanDefRf += numpy.sqrt(numpy.power(value.data[0],2)+numpy.power(value.data[1],2)) meanDefRf /= countRf minL = numpy.minimum(numpy.abs(defSW.values[0].data[0]),numpy.abs(defSW.values[0].data[1])) for value in defSW.values: if numpy.minimum(numpy.abs(value.data[0]),numpy.abs(value.data[1]))<minL: minL = numpy.minimum(numpy.abs(value.data[0]),numpy.abs(value.data[1])) for value in defLowerSideNoCorn.values: if numpy.abs(value.data[1])<minL: minL = numpy.abs(value.data[1]) for value in defSE.values: if numpy.minimum(numpy.abs(value.data[0]),numpy.abs(value.data[1]))<minL: minL = numpy.minimum(numpy.abs(value.data[0]),numpy.abs(value.data[1])) for value in defRightSideNoCorn.values: if numpy.abs(value.data[0])<minL: minL = numpy.abs(value.data[0]) for value in defNE.values: if numpy.minimum(numpy.abs(value.data[0]),numpy.abs(value.data[1]))<minL: minL = numpy.minimum(numpy.abs(value.data[0]),numpy.abs(value.data[1])) for value in defUpperSideNoCorn.values: if numpy.abs(value.data[1])<minL: minL = numpy.abs(value.data[1]) for value in defNW.values: if numpy.minimum(numpy.abs(value.data[0]),numpy.abs(value.data[1]))<minL: minL = numpy.minimum(numpy.abs(value.data[0]),numpy.abs(value.data[1])) for value in defLeftSideNoCorn.values: if numpy.abs(value.data[0])<minL: minL = numpy.abs(value.data[0]) writeLineToLogFile(logfile,'a','... done.',True) #======================================================================= # get stresses and strains along radial paths #======================================================================= skipLineToLogFile(logfile,'a',True) writeLineToLogFile(logfile,'a','Get stresses and strains along radial paths...\n',True) sessionOdb = session.openOdb(name=odbfullpath) session.viewports['Viewport: 1'].setValues(displayedObject=sessionOdb) psis = numpy.arange(0,360,deltapsi) with open(join(csvfolder,'radialpaths.csv'),'w') as csv: csv.write('VARIABLE, angle [°], Ri, Rf, FOLDER, FILENAME\n') for j,psi in enumerate(psis): session.Path(name='Radius-' + str(j+1), type=RADIAL, expression=((0, 0, 0), (0, 0, 1), (minL,0, 0)), circleDefinition=ORIGIN_AXIS, numSegments=nSegsOnPath, radialAngle=psi, startRadius=0, endRadius=CIRCLE_RADIUS) radpath = session.paths['Radius-' + str(j+1)] # sigmaxx sigmaxx = xyPlot.XYDataFromPath(path=radpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('S',INTEGRATION_POINT, ( (COMPONENT, 'S11' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','sigmaxx-Radius-' + str(j+1) + '.dat'),xyData=sigmaxx,appendMode=OFF) with open(join(csvfolder,'radialpaths.csv'),'a') as csv: csv.write('S11' + ', ' + str(psi) + ', ' + '0' + ', ' + str(minL) + ', ' + str(join(wd,project,'dat')) + ', ' + 'sigmaxx-Radius-' + str(j+1) + '.dat' + '\n') # sigmayy sigmayy = xyPlot.XYDataFromPath(path=radpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('S',INTEGRATION_POINT, ( (COMPONENT, 'S22' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','sigmayy-Radius-' + str(j+1) + '.dat'),xyData=sigmayy,appendMode=OFF) with open(join(csvfolder,'radialpaths.csv'),'a') as csv: csv.write('S22' + ', ' + str(psi) + ', ' + '0' + ', ' + str(minL) + ', ' + str(join(wd,project,'dat')) + ', ' + 'sigmayy-Radius-' + str(j+1) + '.dat' + '\n') # sigmaxy sigmaxy = xyPlot.XYDataFromPath(path=radpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('S',INTEGRATION_POINT, ( (COMPONENT, 'S12' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','sigmaxy-Radius-' + str(j+1) + '.dat'),xyData=sigmaxy,appendMode=OFF) with open(join(csvfolder,'radialpaths.csv'),'a') as csv: csv.write('S12' + ', ' + str(psi) + ', ' + '0' + ', ' + str(minL) + ', ' + str(join(wd,project,'dat')) + ', ' + 'sigmaxy-Radius-' + str(j+1) + '.dat' + '\n') # epsxx epsxx = xyPlot.XYDataFromPath(path=radpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('EE',INTEGRATION_POINT, ( (COMPONENT, 'EE11' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','epsxx-Radius-' + str(j+1) + '.dat'),xyData=epsxx,appendMode=OFF) with open(join(csvfolder,'radialpaths.csv'),'a') as csv: csv.write('EE11' + ', ' + str(psi) + ', ' + '0' + ', ' + str(minL) + ', ' + str(join(wd,project,'dat')) + ', ' + 'epsxx-Radius-' + str(j+1) + '.dat' + '\n') # epsyy epsyy = xyPlot.XYDataFromPath(path=radpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('EE',INTEGRATION_POINT, ( (COMPONENT, 'EE22' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','epsyy-Radius-' + str(j+1) + '.dat'),xyData=epsyy,appendMode=OFF) with open(join(csvfolder,'radialpaths.csv'),'a') as csv: csv.write('EE22' + ', ' + str(psi) + ', ' + '0' + ', ' + str(minL) + ', ' + str(join(wd,project,'dat')) + ', ' + 'epsyy-Radius-' + str(j+1) + '.dat' + '\n') # epsxy epsxy = xyPlot.XYDataFromPath(path=radpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('EE',INTEGRATION_POINT, ( (COMPONENT, 'EE12' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','epsxy-Radius-' + str(j+1) + '.dat'),xyData=epsxy,appendMode=OFF) with open(join(csvfolder,'radialpaths.csv'),'a') as csv: csv.write('EE12' + ', ' + str(psi) + ', ' + '0' + ', ' + str(minL) + ', ' + str(join(wd,project,'dat')) + ', ' + 'epsxy-Radius-' + str(j+1) + '.dat' + '\n') writeLineToLogFile(logfile,'a','... done.',True) #======================================================================= # get stresses and strains along circumferential paths #======================================================================= skipLineToLogFile(logfile,'a',True) writeLineToLogFile(logfile,'a','Get stresses and strains along circumferential paths...\n',True) rs = numpy.concatenate((numpy.linspace(0,meanDefRf,nl+1,endpoint=False)[1:],numpy.linspace(meanDefRf,minL,nl+1)[1:]),axis=0) with open(join(csvfolder,'circumpaths.csv'),'w') as csv: csv.write('VARIABLE, R, phi_i [°], phi_f [°], FOLDER, FILENAME\n') for j,r in enumerate(rs): session.Path(name='Circle-' + str(j+1), type=CIRCUMFERENTIAL, expression=((0, 0, 0), (0, 0, 1), (r, 0, 0)), circleDefinition=ORIGIN_AXIS, numSegments=nSegsOnPath, startAngle=0, endAngle=360, radius=CIRCLE_RADIUS) circpath = session.paths['Circle-' + str(j+1)] # sigmaxx sigmaxx = xyPlot.XYDataFromPath(path=circpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('S',INTEGRATION_POINT, ( (COMPONENT, 'S11' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','sigmaxx-Circle-' + str(j+1) + '.dat'),xyData=sigmaxx,appendMode=OFF) with open(join(csvfolder,'circumpaths.csv'),'a') as csv: csv.write('S11' + ', ' + str(r) + ', ' + '0' + ', ' + '360' + ', ' + str(join(wd,project,'dat')) + ', ' + 'sigmaxx-Circle-' + str(j+1) + '.dat' + '\n') # sigmayy sigmayy = xyPlot.XYDataFromPath(path=circpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('S',INTEGRATION_POINT, ( (COMPONENT, 'S22' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','sigmayy-Circle-' + str(j+1) + '.dat'),xyData=sigmayy,appendMode=OFF) with open(join(csvfolder,'circumpaths.csv'),'a') as csv: csv.write('S22' + ', ' + str(r) + ', ' + '0' + ', ' + '360' + ', ' + str(join(wd,project,'dat')) + ', ' + 'sigmayy-Circle-' + str(j+1) + '.dat' + '\n') # sigmaxy sigmaxy = xyPlot.XYDataFromPath(path=circpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('S',INTEGRATION_POINT, ( (COMPONENT, 'S12' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','sigmaxy-Circle-' + str(j+1) + '.dat'),xyData=sigmaxy,appendMode=OFF) with open(join(csvfolder,'circumpaths.csv'),'a') as csv: csv.write('S12' + ', ' + str(r) + ', ' + '0' + ', ' + '360' + ', ' + str(join(wd,project,'dat')) + ', ' + 'sigmaxy-Circle-' + str(j+1) + '.dat' + '\n') # epsxx epsxx = xyPlot.XYDataFromPath(path=circpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('EE',INTEGRATION_POINT, ( (COMPONENT, 'EE11' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','epsxx-Circle-' + str(j+1) + '.dat'),xyData=epsxx,appendMode=OFF) with open(join(csvfolder,'circumpaths.csv'),'a') as csv: csv.write('EE11' + ', ' + str(r) + ', ' + '0' + ', ' + '360' + ', ' + str(join(wd,project,'dat')) + ', ' + 'epsxx-Circle-' + str(j+1) + '.dat' + '\n') # epsyy epsyy = xyPlot.XYDataFromPath(path=circpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('EE',INTEGRATION_POINT, ( (COMPONENT, 'EE22' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','epsyy-Circle-' + str(j+1) + '.dat'),xyData=epsyy,appendMode=OFF) with open(join(csvfolder,'circumpaths.csv'),'a') as csv: csv.write('EE22' + ', ' + str(r) + ', ' + '0' + ', ' + '360' + ', ' + str(join(wd,project,'dat')) + ', ' + 'epsyy-Circle-' + str(j+1) + '.dat' + '\n') # epsxy epsxy = xyPlot.XYDataFromPath(path=circpath,includeIntersections=True,pathStyle=PATH_POINTS,numIntervals=nSegsOnPath,shape=DEFORMED,labelType=TRUE_DISTANCE,variable= ('EE',INTEGRATION_POINT, ( (COMPONENT, 'EE12' ), ), )) session.writeXYReport(fileName=join(wd,project,'dat','epsxy-Circle-' + str(j+1) + '.dat'),xyData=epsxy,appendMode=OFF) with open(join(csvfolder,'circumpaths.csv'),'a') as csv: csv.write('EE12' + ', ' + str(r) + ', ' + '0' + ', ' + '360' + ', ' + str(join(wd,project,'dat')) + ', ' + 'epsxy-Circle-' + str(j+1) + '.dat' + '\n') writeLineToLogFile(logfile,'a','... done.',True) #======================================================================= # close database #======================================================================= skipLineToLogFile(logfile,'a',True) writeLineToLogFile(logfile,'a','Close database...\n',True) odb.close() writeLineToLogFile(logfile,'a','... done.',True)
session.viewports['Viewport: 1'].setValues(displayedObject=o7) step_index = odb.steps.keys().index('danteResults_DC' + str(case_depth).replace('.', '_')) last_frame = len(odb.steps[odb.steps.keys()[-1]].frames) session.viewports['Viewport: 1'].odbDisplay.setFrame(step=step_index, frame=last_frame) root_path = create_path(path_data, 'longitudinal_path', session) stress_tensors = get_stress_tensors_from_path(root_path, session) session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable( variableLabel='HV', outputPosition=ELEMENT_NODAL) xy = xyPlot.XYDataFromPath(name='hardness profile', path=root_path, labelType=TRUE_DISTANCE, shape=UNDEFORMED, pathStyle=PATH_POINTS, includeIntersections=False) for pos_idx, val in enumerate(xy): hardness[pos_idx, case_idx + 1] = val[1] odb.close() normal_stress = np.dot(np.dot(normal_root, stress_tensors), normal_root) residual_stresses[:, case_idx + 1] = normal_stress # Dump stresses to pickle residual_stress_pickle = open( '../planetary_gear/pickles/tooth_root_stresses/residual_stresses.pkl', 'w')
session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable( variableLabel='LE', outputPosition=INTEGRATION_POINT, refinement=(COMPONENT, 'LE22')) session.viewports['Viewport: 1'].odbDisplay.basicOptions.setValues( sectionResults=USE_TOP) xyp = session.XYPlot(XYPlotName) chartName = xyp.charts.keys()[0] chart = xyp.charts[chartName] pth = session.paths['Path_Circumferential'] xy1 = xyPlot.XYDataFromPath(path=pth, includeIntersections=True, projectOntoMesh=True, pathStyle=PATH_POINTS, numIntervals=100, projectionTolerance=0, shape=UNDEFORMED, labelType=TRUE_DISTANCE) c1 = session.Curve(xyData=xy1) chart.setValues(curvesToPlot=(c1, ), ) session.viewports['Viewport: 1'].setValues(displayedObject=xyp) session.XYDataFromPath(name=NameOfFile, path=pth, includeIntersections=True, projectOntoMesh=True, pathStyle=PATH_POINTS, numIntervals=100, projectionTolerance=0, shape=UNDEFORMED, labelType=TRUE_DISTANCE)
height=230.809509277344) session.viewports['Viewport: 1'].makeCurrent() session.viewports['Viewport: 1'].maximize() o7 = session.odbs[session.odbs.keys()[0]] session.viewports['Viewport: 1'].setValues(displayedObject=o7) step_index = odb.steps.keys().index(odb.steps.keys()[-1]) print "step:", odb.steps.keys()[-1] last_frame = len(odb.steps[odb.steps.keys()[-1]].frames) session.viewports['Viewport: 1'].odbDisplay.setFrame(step=step_index, frame=last_frame) session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable(variableLabel='CONC', outputPosition=ELEMENT_NODAL) for path_data, name, data_dict in zip([flank_data, root_data], ['flank', 'root'], [carbon_root, carbon_flank]): data_path = create_path(path_data, name + '_path') xy = xyPlot.XYDataFromPath(name='Carbon profile', path=data_path, labelType=TRUE_DISTANCE, shape=UNDEFORMED, pathStyle=PATH_POINTS, includeIntersections=False) data_array = np.zeros((len(xy), 2)) for i, xy_point in enumerate(xy): data_array[i, 0] = xy_point[0] data_array[i, 1] = xy_point[1] data_dict[case_depth] = data_array if cd_idx == len(case_depths) - 1: pickle_handle = open('../planetary_gear/pickles/carbon_' + name + '_sim.pkl', 'wb') pickle.dump(data_dict, pickle_handle) pickle_handle.close() print data_dict odb.close()