User login

You are here

How to read Abaqus .res file

Hi,

 

I do optimization combinign Matlab and Abaqus.I need to have high precision nodal displacement so I generated .fil and .res files.

It is difficult to extract the result I need from .fil file, because it is a complex file to read/rearrange . So I decided to use the .res file. This file is a binary format. I really appreciat your idea about how to read this file.

 

Thank you so much.

 

Maryam 

Comments

It would probably be easier to read the ODB file directly using a python script. They have a very nice API for that. SIMULIA has tried several times to get rid of the *.fil file, while the ODB file is the preferred file to access and will be supported for the forseeable future.

Here's an example of how to get displacements:

<code>

from odbAccess import *

 

# Define some handy variables

odb = openOdb(path='Torque_Arm_Analysis.odb')

step1 = odb.steps['Step-1']

# Last frame in step

frame = step1.frames[-1]

# Initialize a variable

max_U2 = 0.

# Sets disps = all displacements in model (U)

disps = frame.fieldOutputs['U']

# Defines nodes = nodes in node set 'TORQUE_ARM'

nodes = odb.rootAssembly.instances['TORQUE_ARM-1'].nodeSets['DISPNODES']

# Sets disp_at_nodes = displacements in nodes in set 'DISPNODES'

disp_at_nodes = disps.getSubset(region=nodes)

# Loops over all nodes in set, sets max_U2 to maximum U2 displacement

for dispVal in disp_at_nodes.values:

# dispVal[0] is U1, [1] is U2, [3] is U3

if dispVal[1] > max_U2:

             max_U2 = dispVal[1]

# Creates a text file called 'outputs.dat' and writes responses of interest

outputFile = open('outputs.dat','w')

outputFile.write('Maximum 2-direction displacement in torque arm\n')

outputFile.write('%10.4E \n' % (max_U2))

outputFile.close()

</code>

If you put this code into a text file called "getOutputs.py" you could call it from the command line with the following command: "abaqus python getOutputs.py". You'd just need to make sure the python script and the ODB were in the working directory when you run.

If you want to use something more powerful for optimization than Matlab, check out HEEDS at my link below. 

My Company - Red Cedar Technology

Hidroxid's picture

Hello Marcus,

I am trying to use your code but it gives me the error in the following line:

"if dispVal[1] > max_U2:

             max_U2 = dispVal[1]"

The error message is: "IndentationError: expected an indented block"

 Do you know what is the problem?

ammar alsheghri's picture

Hello 

I am trying to use your code but I get the following problem:

  File "getOutput2.py", line 32, in <module> 

    if dispVal[1]>max_U2: 

TypeError: 'FieldValue' object is unsubscriptable 

Do you have an idea about it? 

 

That is a typing error in python code.

Python uses indentations for loops. Therefore, you should adjust the indent with to overcome this problem. 

Regards. 

 

Subscribe to Comments for "How to read Abaqus .res file"

Recent comments

More comments

Syndicate

Subscribe to Syndicate