Pobieranie największej wartości naprężenia i odkształcenia w Abaqusie
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
from abaqusConstants import * from math import * import odbAccess import os import multiprocessing as mp ################# CONFIGS ##################### odbFiles = ['MICRO_COMPR_XX', 'MICRO_COMPR_YY', 'MICRO_SHEAR_XY'] # seperate new odb files with comma maxPercent = 0.0001 # Percent of elements with maximum values which is taken to determinate average maximum value cpus = 4 # How many CPUs do you want to use - how many odbs will be accessed in the same time. ############################################### def avgMaxFromPercentList(l, percent, revSort): l.sort(reverse=revSort) maxElements = int(ceil(len(l) * maxPercent)) lmax = l[:maxElements] avg = sum(lmax) / float(len(lmax)) return avg def Analise(resultFile): print resultFile + "\t[START]" try: os.remove(resultFile + '_MAX.txt') except OSError: pass odb = odbAccess.openOdb(resultFile+'.odb', readOnly=True) step=odb.steps['Step-1'] frames = step.frames maxStrain = 0 maxStress = 0 # Stress/Strain Curve for frame in frames: # Max stress / strain stress=frame.fieldOutputs['S'].getSubset(position=INTEGRATION_POINT).values strain=frame.fieldOutputs['PEEQ'].getSubset(position=INTEGRATION_POINT).values count = len(stress) stressList = [None] * count strainList = [None] * count for i in range(0, count): stressList[i] = stress[i].mises strainList[i] = strain[i].data newStress = avgMaxFromPercentList(stressList, maxPercent, True) if newStress > maxStress: maxStress = newStress newStrain = avgMaxFromPercentList(strainList, maxPercent, True) if newStrain > maxStrain: maxStrain = newStrain file = open(resultFile+'_MAX.txt', 'w') file.write('{0}\t{1}\n'.format(maxStrain, maxStress)) file.close() odb.close() print resultFile + "\t[DONE]" if __name__ == '__main__': pool = mp.Pool(processes=cpus) pool.map(Analise, odbFiles) pool.close() # no more tasks pool.join() # wrap up current tasks print "Finished!" |
Skrypt pobiera wartość maksymalną naprężeń Misesa i ekwiwalentnych odkształceń z n% elementów z największymi wartościami, wśród wszystkich kroków czasowych symulacji.
