Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro for Retrieving Data in ABAQUS 1

Status
Not open for further replies.

Sri Harsha

Aerospace
Jun 16, 2017
37
0
0
DE
Hello,

After performing FEM Simulation in ABAQUS,I am trying to retrieve data like vonmisses stress,strain etc.

Below,I am describing the procedure,I used for retrieving the data using Graphical User Interface.

1)I have created a seperate set,which I named it as SET-4..This is my interested area.
2)For retrieving the data, I clicked on Tools->XY Data->Create
On this window,I just clicked on "ODB Field Output"
-->I just wanted to retrieve data for last timestep,so in my simulation,I used some 331 timesteps,so,I just selected on the 331st timestep.
-->Under Output Variables, I changed the position option from "Integratin Option" to "Element Nodal"
-->As of now,I just clicked on Vonmisses stress
-->Under Elements/Nodes tab, I clicked on Set-4(which consists of all elements/nodes of my interested area)
-->Then I clicked on "Save"..This created Vonmisses stress data for all my nodes


Can someone explain the macro to retrieve data like Nodaldata(X,Y,Z) ; Vonmisses stress data; plastic strain; ...etc. for all my nodes in set-4
Suppose I have some 80000 Nodes in my set-4..I want to retrieve matrices like Nodaldata,which has a size of 8000/3, i.e. each row correspnds to X,Y,Z data of each node.

I also want to retrieve data like Vonmisses and Plastic strain,which are matrices size of 8000/1


Waiting for reply!

Thanks in advance!
 
Replies continue below

Recommended for you

Add the field output variable COORD into your model and run the analysis again. In postprcessing you hide everything but your set. Then you use Report -> Field Output to create an ASCII file with your data. Select Position=Unique Nodal and activate COORD 1-3 and Mises. Or other variables as needed.
 
Hi Mustaine3,

Could you please explain me the macro for achieving the above!
I basically want to retrieve data like Vonmisses stress, plastic strain for all the nodes in Set-4.
and then I need to append the data into .csv format


Waiting for your reply
 
You don't need a macro.

Mustaine just described, step by step, how to achieve this using Report -> Field Output.

This is very basic. Read the Abaqus CAE Users Guide for a more detailed description.

If you do actually need to script this you can use python. This is described in the Abaqus Scripting reference manual.
 
Hi Dave442,

I basically need to write a macro,since I need to extract information for multiple job *.odb files.
Could you please send the macro for retrieving the Vonmisses data for all the nodes available in set-4.
If you can send that,I will try retrieving other data such as Elastic Strain etc.

Waiting for your reply
 
Hello Dave,

I tried recording the macro,just to get an idea.
I got something like this:

def NewMacro():
import section
import regionToolset
import displayGroupMdbToolset as dgm
import part
import material
import assembly
import step
import interaction
import load
import mesh
import optimization
import job
import sketch
import visualization
import xyPlot
import displayGroupOdbToolset as dgo
import connectorBehavior
session.mdbData.summary()
o1 = session.openOdb(name='H:/MiniThessis/MaterialModelling/Job-2.odb')
session.viewports['Viewport: 1'].setValues(displayedObject=o1)
odbName=session.viewports[session.currentViewportName].odbDisplay.name
session.odbData[odbName].setValues(activeFrames=(('Step-1', (14, )), ))
odb = session.odbs['H:/MiniThessis/MaterialModelling/Job-2.odb']
session.xyDataListFromField(odb=odb, outputPosition=ELEMENT_NODAL, variable=((
'S', INTEGRATION_POINT, ((INVARIANT, 'Mises'), )), ), elementSets=(
'SET-1', ))
x0 = session.xyDataObjects['S:Mises PI: PART-1-1 E: 29560 N: 5803']
x1 = session.xyDataObjects['S:Mises PI: PART-1-1 E: 29560 N: 5807']
x2 = session.xyDataObjects['S:Mises PI: PART-1-1 E: 29560 N: 5878']
x3 = session.xyDataObjects['S:Mises PI: PART-1-1 E: 29560 N: 5879']
x4 = session.xyDataObjects['S:Mises PI: PART-1-1 E: 29560 N: 35627']
..............................................

So,like the above, almost 10000 lines are getting generated for 10000 nodes,which are present in 'SET-1'
Could you please let me know,how can I loop through all nodes in Set-1,and find the vonmisses data for each node and append each value into a Matrix

Waiting for your reply
 
In the Scripting Users Manual is explained how you can access sets.
But you should consider using the mentioned Report and just automate that with a script. I guess that will be much faster than what you do currently.
 
Hi Mustaine3,

I could not understand it clearly.
Could you briefly explain me regarding this.
I would be really glad,if you can roughlt provide me the idea of the script
 
Hi Mustaine,

I have written the following:

odb = openOdb('H:\MiniThessis\MaterialModelling\Job-2.odb')
assembly = odb.rootAssembly
elsetName = 'SET-3'
elemset = assembly.elementSets[elsetName]
frame = odb.steps['Step-1'].frames[13]
allFields = frame.fieldOutputs
stressSet = allFields['S']
stressSet = stressSet.getSubset(region=elemset)
stressValue = stressSet.values
length = len(stressValue)


Is the length here returning the number of elements available in the set-3?? I want to retrieve the nodes available in the Set-3 and thereafter,I want to loop through each node,find the stress values on each node
 
A regular sets definition leada to an element and node set with that name.

You want to have stresses at nodes. By default stresses are not stored at nodes, but integration points. So you have to request before the analysis, that you want it differently. See *Element Output in the Keyword Reference Manual.

Then you can access the nodal results as shown in the Scripting Manual with displacements.
 
Hi Mustaine,

Finding stresses at nodes is another issue.
Please let me know,how can I retrieve the elements and node numbers available in a particular element set.
I have searched a lot in the python scripting reference,but I could not find the functions:

I am posting the script again,which I wrote:

odb = openOdb('H:\MiniThessis\MaterialModelling\Job-2.odb')
assembly = odb.rootAssembly
elsetName = 'SET-3'
elemset = assembly.elementSets[elsetName]


As you can see, in the above code,I am able to retrieve the elemset object..Please help me determine the node numbers and element numbers.
I already have the code to determine the stress and strain,if I can given element numbers and node numbers as inputs

Waiting for your reply
 
Use the Python Interpreter below the viewport to check the next options. So after you run that script, enter "print elemset" so see the suboptions. Then you'll see there is a suboption "elements, which contains a repository and a list with all the elements in there. So "print elemset.elements[0][0]" shows you the information you'll find when accessing the first element.
 
Hi Mustaine3,

Thanks a lot for your help regarding, retrieving of element labels and node labels.
Could you please let me know,if I can retrieve an element label based on a node label.

For e.g: A node,labelled as "5" can be common for element 1 as well as 2.
So,is there any way if I can retrieve the labels 1 and 2 based on the value 5(i.e. node number)

Waiting for your reply
 
You can find connected nodes by accessing elements, but I think there is data that provide the elements that are connected to a node.

You could write a script that scans the .odb or .inp and creates such a dictionary.
 
Status
Not open for further replies.
Back
Top