GLucas9829
Mechanical
- Mar 10, 2016
- 4
Hi All,
I am using a Matlab algoritm to execute the batch_file to do some simulations on abaqus. I am using the python program to help me extract the displacement output for only the nodeset I am interested in (which are 21 nodes) and writes it into a text file. Unfortunately it is giving me an error while I run the below program though I have used the right syntax.
P.S: I am using a loop on matlab program to do some simulations in sequence. Some of the simulations is doing well, but in some them the error apears.
Error message:
KeyError: Step-1
File "Out_Node1.py", line 8, in <module>
lastFrame = odb.steps['Step-1'].frames[-1]
Abaqus Error: cae exited with an error.
PS: if anyone of you can help me figure out what is wrong in the above code, it will be really helpful.
I thank you in advance
Hoping to hear from some one soon.
-George
PROGRAM:
#-----------------------------Out_Node1.py-------------------------------------------------------------
# Out_Node1.py is a python programme which reads the required field output (displacement of 21 nodes) data from an
# output data base and writes it into a text file
#----------------------------------------------------------------------------------------------------------
################################################################################
from odbAccess import *
#open abaqus output database
odb = openOdb(path='InputFile.odb')
# Create a variable that refers to the last frame of the first step.
lastFrame = odb.steps['Step-1'].frames[-1]
# Create a variable that refers to the displacement 'U' in the last frame of the first step.
displacement = lastFrame.fieldOutputs['U']
# Create a variable that refers to the node set 'All-Nodes'. The set is associated with the part instance 'PART-1-1'.
center = odb.rootAssembly.instances['PART-1-1'].nodeSets['NODE-1']
# Create a variable that refers to the displacement of the node set in the last frame of the first step.
centerDisplacement = displacement.getSubset(region=center)
# Finally, print some field output data from each node in the node set.
f = file("DisplacementPostInflation.txt", "w")
my_array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] # NODES POSITION (EXCEPTO THE 1ST ONE)
i = 0
for v in centerDisplacement.values:
i = i + 1
f.write (' %s, %16.8E\n'%(my_array,v.data[1])) # 0 = x, 1 = y e 2 = z
# Time must be times total value of pressure, load, etc.
# f.write(' 0000 , 0.000000000000')
f.close()
I am using a Matlab algoritm to execute the batch_file to do some simulations on abaqus. I am using the python program to help me extract the displacement output for only the nodeset I am interested in (which are 21 nodes) and writes it into a text file. Unfortunately it is giving me an error while I run the below program though I have used the right syntax.
P.S: I am using a loop on matlab program to do some simulations in sequence. Some of the simulations is doing well, but in some them the error apears.
Error message:
KeyError: Step-1
File "Out_Node1.py", line 8, in <module>
lastFrame = odb.steps['Step-1'].frames[-1]
Abaqus Error: cae exited with an error.
PS: if anyone of you can help me figure out what is wrong in the above code, it will be really helpful.
I thank you in advance
Hoping to hear from some one soon.
-George
PROGRAM:
#-----------------------------Out_Node1.py-------------------------------------------------------------
# Out_Node1.py is a python programme which reads the required field output (displacement of 21 nodes) data from an
# output data base and writes it into a text file
#----------------------------------------------------------------------------------------------------------
################################################################################
from odbAccess import *
#open abaqus output database
odb = openOdb(path='InputFile.odb')
# Create a variable that refers to the last frame of the first step.
lastFrame = odb.steps['Step-1'].frames[-1]
# Create a variable that refers to the displacement 'U' in the last frame of the first step.
displacement = lastFrame.fieldOutputs['U']
# Create a variable that refers to the node set 'All-Nodes'. The set is associated with the part instance 'PART-1-1'.
center = odb.rootAssembly.instances['PART-1-1'].nodeSets['NODE-1']
# Create a variable that refers to the displacement of the node set in the last frame of the first step.
centerDisplacement = displacement.getSubset(region=center)
# Finally, print some field output data from each node in the node set.
f = file("DisplacementPostInflation.txt", "w")
my_array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] # NODES POSITION (EXCEPTO THE 1ST ONE)
i = 0
for v in centerDisplacement.values:
i = i + 1
f.write (' %s, %16.8E\n'%(my_array,v.data[1])) # 0 = x, 1 = y e 2 = z
# Time must be times total value of pressure, load, etc.
# f.write(' 0000 , 0.000000000000')
f.close()