def getThermalProperties2D(): odb = session.openOdb('Job-1'+'.odb') #odb = session.openOdb(name='Job-'+str(modelCount)+'.odb') #odb = session.openOdb(name='Job-1.odb') #odb = session.openOdb(name=fileName) lastFrame = odb.steps['applyHeat'].frames[-1] hfl = lastFrame.fieldOutputs['HFL'] bottoms = odb.rootAssembly.instances['PART1'].elementSets['BOTTOM'] tops = odb.rootAssembly.instances['PART1'].elementSets['TOP'] bottomHFL = hfl.getSubset(region=bottoms) topHFL = hfl.getSubset(region=tops) botVals = bottomHFL.values topVals = topHFL.values sumsVals = 0.0 count = 0.0 for val1 in botVals: sumsVals = sumsVals + val1.magnitude count = count + 1.0 for val2 in topVals: sumsVals = sumsVals + val2.magnitude count = count + 1.0 side1 = side * 10 ** -6 avgHeatFlux = sumsVals / count thermalCond = avgHeatFlux * side1 / (temp1-temp2) del odb return int(round(avgHeatFlux, -1)), round(thermalCond, 4)
def getThermalProperties3D(particleRadius, matrixSide, temp1, temp2, fileName="Job-1"): import odbAccess odb = session.openOdb(name=fileName + '.odb') lastFrame = odb.steps['Step-1'].frames[-1] hfl = lastFrame.fieldOutputs['HFL'] bottoms = odb.rootAssembly.instances['MATRIXFULL-1'].elementSets['BOT'] tops = odb.rootAssembly.instances['MATRIXFULL-1'].elementSets['TOP'] bottomHFL = hfl.getSubset(region=bottoms) topHFL = hfl.getSubset(region=tops) botVals = bottomHFL.values topVals = topHFL.values sumsVals = 0.0 count = 0.0 for val1 in botVals: # Sum bottom values sumsVals = sumsVals + val1.magnitude count = count + 1.0 for val2 in topVals: # Sum top values sumsVals = sumsVals + val2.magnitude count = count + 1.0 radius = particleRadius side = matrixSide radius = radius * 10**-6 side = side * 10**-6 avgHeatFlux = sumsVals / count thermalCond = avgHeatFlux * side / (temp1 - temp2) return int(round(avgHeatFlux, -1)), round(thermalCond, 4)
def getThermalProperties3D(particleRadius, matrixSide, temp1, temp2, fileName="Job-1"): import odbAccess odb = session.openOdb(name=fileName+'.odb') lastFrame = odb.steps['Step-1'].frames[-1] hfl = lastFrame.fieldOutputs['HFL'] bottoms = odb.rootAssembly.instances['MATRIXFULL-1'].elementSets['BOT'] tops = odb.rootAssembly.instances['MATRIXFULL-1'].elementSets['TOP'] bottomHFL = hfl.getSubset(region=bottoms) topHFL = hfl.getSubset(region=tops) botVals = bottomHFL.values topVals = topHFL.values sumsVals = 0.0 count = 0.0 for val1 in botVals: # Sum bottom values sumsVals = sumsVals + val1.magnitude count = count + 1.0 for val2 in topVals: # Sum top values sumsVals = sumsVals + val2.magnitude count = count + 1.0 radius = particleRadius side = matrixSide radius = radius * 10 ** -6 side = side * 10 ** -6 avgHeatFlux = sumsVals / count thermalCond = avgHeatFlux * side / (temp1-temp2) return int(round(avgHeatFlux, -1)), round(thermalCond, 4)
def getThermalProperties2D(): odb = session.openOdb('Job-1' + '.odb') #odb = session.openOdb(name='Job-'+str(modelCount)+'.odb') #odb = session.openOdb(name='Job-1.odb') #odb = session.openOdb(name=fileName) lastFrame = odb.steps['applyHeat'].frames[-1] hfl = lastFrame.fieldOutputs['HFL'] bottoms = odb.rootAssembly.instances['PART1'].elementSets['BOTTOM'] tops = odb.rootAssembly.instances['PART1'].elementSets['TOP'] bottomHFL = hfl.getSubset(region=bottoms) topHFL = hfl.getSubset(region=tops) botVals = bottomHFL.values topVals = topHFL.values sumsVals = 0.0 count = 0.0 for val1 in botVals: sumsVals = sumsVals + val1.magnitude count = count + 1.0 for val2 in topVals: sumsVals = sumsVals + val2.magnitude count = count + 1.0 side1 = side * 10**-6 avgHeatFlux = sumsVals / count thermalCond = avgHeatFlux * side1 / (temp1 - temp2) del odb return int(round(avgHeatFlux, -1)), round(thermalCond, 4)