Close this search box.
Clear all

Python script to extract fieldOutput for 2 specific nodes

3 Posts
2 Users
0 Reactions
Posts: 4
Topic starter
New Member
Joined: 10 years ago

Hello everyone!

I badly want your help!

I am required to extract the fieldOutput(Acoustic Pressure) for only 2 nodes(Eg, NodeLabel=32078 and NodeLabel=33789), which I am struggling to achieve. I have the Python script which extracts the Acoustic Pressure for all the nodes and it is working fine, but I need only 2 nodes with the Acoustic Pressure value and not all nodes!

The script for extracting Acoustic pressure for all nodes is :

from odbAccess import *

from abaqusConstants import *

import part

jobname = working-copy

stepname = Acoustic Pressure

resultfile_name = Pressure # file to be written in

odb_file = jobname + .odb

inp_file = jobname + .inp

odb = openOdb(odb_file,readOnly=True)

number_freq = len(odb.steps[stepname].frames)

assembly = odb.rootAssembly

for i in xrange(number_freq): # for all frequencies calculated in step


if f>0:

result_file = resultfile_name + _ + str(f) + .txt

file_results = open(result_file,w+)



for ii in xrange(number_nodes): [b]# for all nodes in model (nodes of different parts together in one list)[/b]





file_results.write(%10i %13E %13E\n % (nodeID,u,ui))

# close file where it was written in


# ***************************************************************************************************************************

Can you please help me to modify this script such that it extracts Acoustic Pressure for 2 specific nodes!

Thanks In Advance!!

2 Replies
Posts: 3998
Joined: 5 years ago

I recommend that you add an IF statement right after the for ii in xrange... statement.
The statement can be something like:
if ii==1234:
which simply checks if the node number is of interest.


2 Replies
Posts: 4
Topic starter
New Member
Joined: 10 years ago

Thank you for the reply!

I was thinking too complex, thanks for ur suggestion to use a if statement! I got the script to work with this line of code : [B]if data_i.values[ii].nodeLabel==32736 or data_i.values[ii].nodeLabel==44393:[/B]

The script is working!

Thanks again!! 🙂