Let me explain you my task and I will ask you if it is possible to do so in ABAQUS. ABAQUS is a software tool for simulation which has works on python environment.
Please, Assume I am doing a simulation on a pulley (or a cylindrical solid) with single step as Load on the external surface.
I collect the necessary stress values(S22, von mises, etc) at each node on a selected surface of pulley.
I also collect the cylindrical coordinates for that nodes. Now I do some calculations in excel using the stress values(Max principal stress, minimum principal stress, S22, etc) and find out safety factor for each node.
So, I have a new variable with me called SF(safety factor) for each node. I will use CSV module of ABAQUS PYHTON to display this SF values in Kernel command line interface.
I hope you understood what I explained, please feel free to ask me if you did not understand any point.
Once I reflect the CSV values in Kernel command line interface, I am interested in displaying this SF value at the respective nodes in the Visualization module of the Pulley.
I am keen if you guys can shed some light on this as how can I proceed after this? I am able to print the tabular values containing the coordinates and safety factor in the command line.
I would highly appreciate you guys for your solution if this is possible or not? If not please let me know what can be the alternative solution for it. The sample table looks like this in excel
Node R T Z SF
27 30,7 0,00 -15,4 1
4970 30,7 0,07 -15,4 1
4971 30,7 0,13 -15,4 1
4973 30 0,27 -15,4 1.3
Sample output in kernel command line interface with the code.
import csv
import pprint
infile=open(filename,'r')
table = [row for row in csv.reader(infile,delimiter=' ')]
pprint.pprint(table)
Output
[['Node ; R ; T ; Z ; SF] ,
['20,7 ; 30,7 ; 0 ; -15,4 ; 1 ],
[4970 ; 30,7 ; 0,07 ; -15,4 ; 1 ],
['4971, ;30,7; 0,13 ; -15,4 ; 1 ],
['4975; 30 ; 0.40 ; -15,4 ; 1.3 ],]
Thank you so much for your time and patience.
Kind Regards,
Alluri Sai Preetham Reddy +33755735057
To visualize data in Abaqus, you need to create a new field output object inside your output database. This object can only be created inside a frame. Therefore, due to the ODB structure, you need to:
All of these can be created using Abaqus Python scripting interface.
In the code below I'm assuming table
, which contains the table from CSV, is already defined and filled.
import odbAccess
from abaqusConstants import NODAL, SCALAR
import numpy as np
odb = odbAccess.openOdb(path='pathToYourOdbContainingResults', readOnly=False)
# In case you run the script multiple times, the step will already be there
if odb.steps.has_key('Step-SF'):
step = odb.steps['Step-SF']
else:
step = odb.Step(name='Step-SF', description='Step containing SF values.')
frame = step.Frame(incrementNumber=0, frameValue=1.0, description='SF Frame')
fo = frame.FieldOutput(name='SF', description='Safety factor', type=SCALAR)
# Data being added to a field output must be stored in a contiguous piece of
# memory, which is not something pure Python lists can guarantee
labels = np.array([row[0] for row in table], dtype=np.int32)
values = np.array([row[4] for row in table], dtype=np.float32)
fo.addData(position=NODAL, instance='nameOfInstanceHoldingTheResults', labels=labels,
data=[[value] for value in values])
odb.save()
# Closing is necessary because the newly created steps, frames, and field
# outputs are not visible before the ODB is re-opened
odb.close()