Averaging Threshold Abaqus_Python
Averaging Threshold Abaqus_Python
(OP)
Hello Everybody
I am a student and as a part of my project i.e. Simulation of Shear Cutting on Abaqus™ CAE. I am running a Dynamic/Explicit analysis and then using a Python script to export data to rpt and excel. I am exporting VonMises, Stress Components and Reaction Forces.
My question is how can I change the "averaging threshold" value to 75% or 100% using the script. I know I can change it from result options.
I saw abaqus.rpy file and found this command:
However, when I tried to add this to script just in the start, nothing happened.
I still get "unaveraged" values.
It is also possible that I am not adding to the correct postion in my script.
Please suggest me a possible remedy. Thanks in advance
Ilyas
I am a student and as a part of my project i.e. Simulation of Shear Cutting on Abaqus™ CAE. I am running a Dynamic/Explicit analysis and then using a Python script to export data to rpt and excel. I am exporting VonMises, Stress Components and Reaction Forces.
My question is how can I change the "averaging threshold" value to 75% or 100% using the script. I know I can change it from result options.
I saw abaqus.rpy file and found this command:
CODE --> Python
session.viewports['Viewport: 1'].odbDisplay.basicOptions.setValues(averagingThreshold=30)
However, when I tried to add this to script just in the start, nothing happened.
CODE --> Python
myViewport = session.Viewport(name='3DShearCutting') session.viewports['3DShearCutting'].odbDisplay.basicOptions.setValues(averagingThreshold=75.0)
I still get "unaveraged" values.
It is also possible that I am not adding to the correct postion in my script.
Please suggest me a possible remedy. Thanks in advance
Ilyas





RE: Averaging Threshold Abaqus_Python
session.viewports['Viewport: 1'].odbDisplay.basicOptions.setValues(
averageElementOutput=True)
session.viewports['Viewport: 1'].odbDisplay.basicOptions.setValues(
averagingThreshold=25)
Also, you should take the stresses at integration points instead of averaging. This might depend on what you want to do with ofcourse :).
RE: Averaging Threshold Abaqus_Python
Thanks for your help, but it still doesn't work. I have tried alot.
CODE --> Abaqus
## -- I N P U T - F I L E -- ##--------------------------------INFO-------------------------------- ##This python script writes a text file containing maximum values of ##each requested variable for the odb mentioned in fileName variable. ##Following consideration must be taken to run this script. ## 1-This file should be placed in the abaqus temp folder i.e. the ## same folder where odb file resides. ## 2-Enter the odb name without extention (.odb) ## ##The Output of this script will be a text file (*.txt) in the ##same folder containing the maximum values and element_labels. ## ##-------------------------------------------------------------------- Name des zu analysierenden Odbs ohne Endung ###Systemdateien importieren from abaqus import * from abaqusConstants import * import visualization import odbAccess import fileinput import sys, os from viewerModules import * from odbAccess import * from odbMaterial import * from odbSection import * #Viewport anlegen myViewport = session.Viewport(name='3DShearCutting') #session.viewports['Viewport: 1'].odbDisplay.basicOptions.setValues(averageElementOutput=True) #session.viewports['Viewport: 1'].odbDisplay.basicOptions.setValues(averagingThreshold=75.0) session.viewports['3DShearCutting'].makeCurrent() session.viewports['3DShearCutting'].maximize() # set working directory workdir = os.getcwd()+'/' fileName = '3D10' #analyzed odb-file myPath = str(workdir)+str(fileName)+'.odb' #Output-Database oeffnen myOdb = openOdb(path=myPath) #zu analysierenden Step festlegen Step=myOdb.steps['Forming'] #spaeteres Ausgabefile anlegen und oeffnen file = open(str(workdir)+'Punch_'+fileName+'.txt', 'w') # Ueberschrift in File print >> file, 'Maximum Stresses (vonMises, sigma11, sigma22, sigma33) and Reaction Forces (in x,y and z direction) over all Frames \n===============================================================================================\n' print >> file, 'Datenbasis: %s\n\n' % (fileName) print >> file, 'Frame\tStep-Time\tVM-Stress\tEL-lab\tsigma11\t\tEL-lab\tsigma22\t\tEL-lab\tsigma33\t\tEL-lab\t sumRF-x\t sumRF-y\t sumRF-z\n' # number of Frames auslesen numFrames=len(Step.frames) #for m in range(0, numFrames-1): m = 5 # Frame-Auswahl Frame = myOdb.steps['Forming'].frames[m] #enthaelt alle Stress-Daten vom Letzen Frame stress = Frame.fieldOutputs['S'] #enthaelt die RF Daten vom letzten Frame rForce = Frame.fieldOutputs['RF'] Punch = str('ABHACKMESSER_5'+chr(176)+'-1,5MM-1') # Auswahl der Sets #element stempelEl = myOdb.rootAssembly.instances[str(Punch)].elementSets['ABHACKMESSER'] #node stempelNode = myOdb.rootAssembly.instances[str(Punch)].nodeSets['ABHACKMESSER'] Eleset = str('ABHACKMESSER_5'+chr(176)+'-1,5MM-1')+'.ABHACKMESSER' #Stress-Daten vom Element-Set auslesen #stempelStressEl = stress.getSubset(region=stempelEl, position=INTEGRATION_POINT) stempelStressEl = stress.getSubset(region=stempelEl, position=ELEMENT_NODAL) #ReactionForce-Daten vom Node-Set auslesen rForceStempel = rForce.getSubset(region=stempelNode, position=NODAL) #Variable, die alle Stress-Daten enthaelt kreieren valuesStempelStressEl = stempelStressEl.values session.viewports['3DShearCutting'].odbDisplay.basicOptions.setValues( regionBoundaries=ELEMENT_SET, userRegions=( str(Eleset), ), averagingThreshold=50) #Variable, die alle ReactionForce-Daten enthaelt kreieren valuesrForceStempel = rForceStempel.values # Stress Vorbelegung der MaxWerte ELVMmax = 0 VMmax = -1 sig11max = -1 sig22max = -1 sig33max = -1 ELsig11max = 0 ELsig22max = 0 ELsig33max = 0 #maxframe = 0 #maxtime = 0 # Stress Schleife zum MinMax finden (Zaehlvariable: i) for i in valuesStempelStressEl: #a = m #b = Frame.frameValue if i.mises > VMmax: VMmax = i.mises ELVMmax = i.elementLabel #maxframe = a #maxtime = b else: VMmax = VMmax ELVMmax = ELVMmax if i.data[0] > sig11max: sig11max = i.data[0] ELsig11max = i.elementLabel else: sig11max = sig11max ELsig11max = ELsig11max if i.data[1] > sig22max: sig22max = i.data[1] ELsig22max = i.elementLabel else: sig22max = sig22max ELsig22max = ELsig22max if i.data[2] > sig33max: sig33max = i.data[2] ELsig33max = i.elementLabel else: sig33max = sig33max ELsig33max = ELsig33max # Reaction Force Vorbelegung der Werte sumRFx = 0 sumRFy = 0 sumRFz = 0 # Reaction Force Schleife zum Aufsummieren (Zaehlvariable: k) for k in valuesrForceStempel: sumRFx = sumRFx + k.data[0] sumRFy = sumRFy + k.data[1] sumRFz = sumRFz + k.data[2] # print in file print >> file, '%2d\t%10.4e\t%10.4f\t%4d\t%10.4f\t%4d\t%10.4f\t%4d\t%10.4f\t%4d\t%10.4f\t%10.4f\t%10.4f' % (m , Frame.frameValue, VMmax, ELVMmax, sig11max, ELsig11max, sig22max, ELsig22max, sig33max, ELsig33max, sumRFx, sumRFy, sumRFz) #Ausgabefile schliessen file.close()Please tell me where shall I place the statement to turn on averaging.
Waiting for a positive reply.
RE: Averaging Threshold Abaqus_Python
http://www.eng-tips.com/faqs.cfm?fid=376
RE: Averaging Threshold Abaqus_Python
you will never get nodal averaging for RF, just because there is nothing to average (reaction forces are calculated at the nodes).
For stress, it is calculated at the integration points of elements, and extrapolated to nodes for each element.
Then, you can average the value at that node, for all the connecting elements (which is what you see by default in the viewport because it looks nice and smooth even if your mesh is shit).
What you are asking in your code is the "Element Nodal", "position=ELEMENT_NODAL" which is NOT averaged, because it gives the value for each node of each element.
If you change it to "NODAL", you will either get: 1 value if you average
or 1,2,3,4 ... values if you don't (depending on the number of elements bordering the node).
So IF you want the one averaged value, change the position to "nodal" and put
session.viewports['3DShearCutting'].odbDisplay.basicOptions.setValues(
averageElementOutput=True)
session.viewports['3DShearCutting'].odbDisplay.basicOptions.setValues(
regionBoundaries=ELEMENT_SET, userRegions=(
str(Eleset), ), averagingThreshold=50)
RE: Averaging Threshold Abaqus_Python
Actually I dont want to average Force (as you rightly said, that's not possible). After your helpful comment, I am now getting averaged(for a given averagingThreshold = value) VonMises stress values in viewport on GUI, but the values in the text file are still unaveraged, I want to write Max.SMises(averaged), Max.Stress Averaged(S11,S22,S33) for each frame in a text file and then plot them for different geometric parameters.
If you could tell me a formula (how in the background) to calculate averaged Stress, I will implement in myself.
Thanks alot for your prompt responses.
RE: Averaging Threshold Abaqus_Python
the easiest for you would be to:
1. open your odb in CAE
2. set an avering threshold in odb options
3. create XY data -> Stress (mises) -> unique nodal -> select a point -> plot
4. report -> xy -> apply
then check the .rpt file, it should have averaged values.
If that works, you can just c/p from the .rpy file into your script.
As far as I know, the averaging is a simple average with equal weights for each element (or maybe it's by element volume). The percentage you set is a cutoff, if the difference between values for the same nodes (comming from different elements) is higher than the %, abaqus will not average, so maybe that's the issue in your case.
If it doesn't average with the default 75%, I would be concerned about my mesh.
RE: Averaging Threshold Abaqus_Python
I am writing .rpt file for each frame using python script and then using a VBA script to import the Maximum Values into Excel Sheet and plotting them on a chart.
Hope this solution works for someone with a similar problem.
Goodluck and Bye