You finished a long run, and now you need one number out of it: the peak von Mises stress in a weld toe, the reaction force history at a boundary, the displacement of one node across 200 frames. Clicking through the Visualization module works once. It stops working when you have forty jobs, or when a reviewer asks you to repeat the extraction next month with a slightly different mesh.
An Abaqus ODB Python script solves that properly. The ODB is just a database with a documented object tree, and Abaqus ships a Python interpreter that can read it directly. This guide shows the object tree, two ways to run the script, working code for field and history output, and the mistakes that cause most of the errors people hit on their first attempt.
What an Abaqus ODB Python script actually does
An .odb file is a binary results database. It holds the model (parts, instances, node and element sets), and the results, organised as steps, then frames, then field and history output.
The odbAccess module gives you read access to that structure. You open the file, walk down to the output you want, and write it wherever you need it: CSV, a text report, a NumPy array, a database. No viewport, no XY data manager, no clicking.
Two important limits before you start. First, odbAccess is read-mostly; you can add field output to an ODB, but you cannot change the analysis results that are already in it. Second, you can only read what the job actually wrote. If *OUTPUT, FIELD did not include PEEQ, no script will recover it, and you will have to re-run the job. Getting those requests right before you submit is covered in our guide to Abaqus field output vs history output.
Two ways to run the script, and the licence difference
abaqus python: the lightweight route
abaqus python extract.pyThis starts the Abaqus Python interpreter directly. You get odbAccess, abaqusConstants, and the standard library. You do not get mdb, session, or anything to do with viewports and images.
The practical advantage is licensing: this route does not check out an Abaqus/CAE token. On a shared licence pool that matters. If all you do is read numbers out of an ODB, use this.
abaqus cae -noGUI: the full kernel
abaqus cae -noGUI=extract.pyThis starts the full CAE kernel without a window, so session and mdb are available. You need it for anything that touches the viewport: printing PNGs of contour plots, using session.XYDataFromHistory, writing report files with session.writeFieldReport, or building a model and submitting it in the same script. It consumes a CAE token for as long as it runs.
One more thing worth checking before you debug anything else, because it changes your syntax: the Python version. Abaqus 2023 and earlier ship Python 2.7. Abaqus 2024 and later ship Python 3. Confirm it on your install rather than guessing:
abaqus python -c "import sys; print(sys.version)"The ODB object tree you need to know
Almost every script is a walk down the same path:
odbrootAssemblyinstances['PART-1-1']→ nodes, elements, nodeSets, elementSetsnodeSets['TOP_FACE']elementSets['WELD']
steps['Step-1']frames[-1]→fieldOutputs['S']→.values,.bulkDataBlockshistoryRegions['Node PART-1-1.5']→historyOutputs['U2']→.data
Field output is spatial: one value per node or integration point, per frame. History output is temporal: a list of (time, value) pairs at a point or for the whole model. Picking the wrong one is the most common reason a script returns an empty list.
When you are not sure what is inside a file, print the keys first. This is the fastest debugging habit in ODB scripting:
from odbAccess import openOdb
odb = openOdb('Job-1.odb', readOnly=True)
print(odb.rootAssembly.instances.keys())
print(odb.rootAssembly.nodeSets.keys())
print(odb.steps.keys())
step = odb.steps[odb.steps.keys()[-1]]
print(len(step.frames), 'frames')
print(step.frames[-1].fieldOutputs.keys())
print(step.historyRegions.keys())
odb.close()A working script: von Mises stress to CSV
This pulls integration point stress from the last frame, limited to one element set, and writes it to CSV.
from odbAccess import openOdb
from abaqusConstants import *
import csv
odb = openOdb('Job-1.odb', readOnly=True)
step = odb.steps['Step-1']
frame = step.frames[-1]
region = odb.rootAssembly.instances['PART-1-1'].elementSets['WELD']
stress = frame.fieldOutputs['S'].getSubset(region=region,
position=INTEGRATION_POINT)
f = open('mises.csv', 'w') # Python 2: open('mises.csv', 'wb')
w = csv.writer(f)
w.writerow(['element', 'ip', 'mises', 'pressure', 's11'])
for v in stress.values:
w.writerow([v.elementLabel, v.integrationPoint,
v.mises, v.press, v.data[0]])
f.close()
odb.close()A few notes on this. readOnly=True stops Abaqus from writing a lock file and from silently upgrading the database. getSubset is what keeps the loop small; without it you iterate every element in the model. And v.data is the raw component array, ordered S11, S22, S33, S12, S13, S23 for a 3D element, while v.mises and v.press are invariants Abaqus computes for you.
If you want nodal values instead, be careful which position you ask for. Stress lives at integration points, so position=NODAL returns nothing. Use position=ELEMENT_NODAL to get values extrapolated to the element corners, and accept that neighbouring elements will disagree at shared nodes. NODAL is correct for genuinely nodal fields such as U, RF, and NT11.
Pulling history output: reaction force and displacement versus time
History output is cheaper to write and much cheaper to read, so request it for anything you plan to plot against time.
odb = openOdb('Job-1.odb', readOnly=True)
step = odb.steps['Step-1']
for rname, region in step.historyRegions.items():
for oname, out in region.historyOutputs.items():
if oname.startswith('RF'):
print(rname, oname)
for t, val in out.data:
print('%10.5f %14.6e' % (t, val))
odb.close()Region names are generated by Abaqus and look like Node PART-1-1.5, Element PART-1-1.12 Int Point 1, or Assembly ASSEMBLY. Do not hardcode them from memory. Print historyRegions.keys() once and copy the real string, or match it with startswith as above.
Finding peak stress and where it happened
A frequent request is the maximum over the whole history, plus its location. The direct version is a nested loop:
peak, where = -1.0e30, None
for frame in step.frames:
for v in frame.fieldOutputs['S'].values:
if v.mises > peak:
peak = v.mises
where = (frame.frameValue, v.elementLabel, v.integrationPoint)
print('peak mises %.3f at time %.4f, element %d, ip %d'
% (peak, where[0], where[1], where[2]))This is correct and perfectly fine for a few hundred thousand values. It becomes slow on large models, because every FieldValue object is created in Python one at a time.
Making it fast on large models
For big ODBs, use bulkDataBlocks instead of .values. It returns the data as arrays rather than per-value Python objects, which is normally one to two orders of magnitude faster:
import numpy as np
field = step.frames[-1].fieldOutputs['S']
for block in field.bulkDataBlocks:
mises = np.array(block.mises)
labels = np.array(block.elementLabels)
i = mises.argmax()
print(labels[i], mises[i])Three more habits that cut runtime a lot: request output only on the sets you care about in the job itself, use a smaller output frequency instead of every increment, and open the ODB once and extract everything you need in that single pass. Opening and closing a large file repeatedly is often the real bottleneck, not the loop.
If extraction is slow because the jobs are slow, the fix is upstream of scripting. Our HPC service runs Abaqus and ANSYS jobs on dedicated hardware, which also means your post-processing scripts run next to the ODB instead of across a network share.
Common mistakes that break ODB scripts
- Running the script with system Python.
import odbAccessfails withImportErrorin any Python that is not Abaqus’s own. Useabaqus pythonorabaqus cae -noGUI. - Lowercase set names. Abaqus stores assembly and instance set names in uppercase.
nodeSets['top_face']raises aKeyError;nodeSets['TOP_FACE']works. - Looking for an instance set at assembly level. A set defined on a part lives under
instances['PART-1-1'].nodeSets. A set defined in the Assembly module lives underrootAssembly.nodeSets. They are different dictionaries. - Asking for NODAL stress. Returns an empty subset. Use
ELEMENT_NODALorINTEGRATION_POINT. - Forgetting
odb.close(). On Windows the file stays locked, and the next job that tries to write it fails. - Reading an ODB from an older release. You get a version error. Convert it first with
abaqus upgrade -job new_name -odb old_name. - Opening an ODB while the job is still running. Results can be incomplete or the file can be locked. Wait for the job to finish, or read the
.stafile for progress instead. - Mixing Python 2 and 3 syntax.
print x,dict.keys()indexing, andopen(..., 'wb')for thecsvmodule all behave differently between the two. Check your version first.
Ready-to-use models and scripts
If you would rather start from working code than build it from scratch, these packages include the scripts and the models they run on:
- 3 Methods to Use Python in Abaqus for Absolute Beginners — covers the GUI macro, the kernel command line, and external scripts, which is the right starting point if you are still unsure which of the two run modes above you need.
- Free Python Script to Automate Sequential Abaqus Jobs — a job queue in Python; pair it with the extraction script in this guide and a batch of runs becomes one command plus one CSV.
- Parametric Study with Python in Abaqus — builds the model, submits it, and reads the ODB for each parameter set, which is the full loop this article only covers the last part of.
- AI for Abaqus: Python Scripting, Fortran Subroutines and FEA Validation — how to use LLMs to draft and debug Abaqus scripts without trusting output you have not validated.
For the broader scripting context, see our guide on Python scripting in Abaqus. The official reference for the objects used here is the Abaqus Scripting User’s Guide chapter on reading from an output database, and there is a minimal field data example in the same manual.
FAQ
Can I read an ODB file with normal Python outside Abaqus?
Not with odbAccess, which only exists inside the Abaqus Python installation. The usual workaround is a two-step pipeline: run a small script under abaqus python that writes CSV, NPZ, or JSON, then do the analysis and plotting in your own Python with pandas and matplotlib. That also keeps your analysis code free of Python 2 constraints on older Abaqus releases.
Does an Abaqus ODB Python script use a licence token?
abaqus python does not check out an Abaqus/CAE token, so it is the better choice on a shared pool. abaqus cae -noGUI does, for the whole duration of the script. Solver tokens are unrelated; reading results does not need them.
Why does my field output subset come back empty?
Three usual causes, in order of likelihood: the position is wrong for that variable, such as NODAL for S; the set name does not match exactly, including uppercase; or the output variable was never requested in the job. Print fieldOutputs.keys() for that frame to confirm the variable exists before debugging the region.
How do I get stress at a specific node rather than an element?
Request position=ELEMENT_NODAL and subset by a node set. You will get one value per element attached to that node, so average them yourself if you need a single number, and remember that a large spread between them is a mesh refinement signal, not a scripting problem.
Can a script write new results back into the ODB?
Yes, within limits. You can add your own field output to an existing frame with frame.FieldOutput(...) and addData(...), which is how people store derived quantities such as a fatigue damage parameter and then contour them in Viewer. Open the ODB without readOnly=True for this, and keep a backup copy, because a failed write can leave the file unusable.
Where to go from here
Start small. Write a ten-line script that opens one of your own ODBs and prints the keys at each level. Once you can see the tree, the rest is bookkeeping: pick the step, pick the frame, subset the region, read the values.
The payoff shows up on the second project, not the first. Extraction that is scripted is repeatable, reviewable, and survives a mesh change without an afternoon of clicking.
The same logic applies on the input side: if you are generating or modifying runs programmatically, it helps to be comfortable with the input file itself. See our guide on how to edit the Abaqus INP file with the Keywords Editor and with Python.
If you want tested scripts and the models that go with them, browse the Abaqus and Python packages in our shop. If you would rather hand over a specific extraction or automation job, we take it on through our simulation and consulting services.



