Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Custom Field Output 4

Status
Not open for further replies.

TifoTafi

Bioengineer
Jul 22, 2014
2
Hi Abaqus experts out there,

I am trying to create custom Field Output in Abaqus, where I relate two types of stress invariants to each other, for example MISES and PRESSURE, e.g.:
[tt]s15f1_MISESMAX - 0.35 * s15f1_PRESSONLY[/tt] (--> s15f1 = step 15 frame 1)

I know how to do this inside the Visualization module using the Create Field Output dialog box (Tools > Create Field Output > From Fields): this creates a Field Output object, but with the following limitations:
- Only stored as temporary step (by default: "Session Step") and not permanently saved to the ODB.
- Only applicable for 1 step and 1 frame (by default: last step and last frame) and not for more/all steps/frames.

I would like to overcome the above limitations, and make this custom Field Output 1) permanently available in the ODB, and 2) have this available for all analysis steps. However, at this point I do not know how to do this or where to even start (as I am a scripting newbie), and this is where I need your help...

My questions:
1) Should the focus be to manipulate the job input file (*.INP) or output database (*.ODB) to create this additional custom Field Output in the ODB?
2) Is it required to create a macro which records a sequence of Abaqus Scripting Interface commands or write a custom Python script for this? Or is there a more simple straightforward solution (like e.g. adding lines of Abaqus keyword commands to the job input file)?

Any help or suggestions are highly appreciated!

Kind regards,
David
 
Replies continue below

Recommended for you

Record and save a macro and then edit the .rpy file. You should be able to see how the python script was written without knowing much about python.

 
Hi corus,

Thanks for your help and sorry for my delayed response...
After aquiring the basic skills of Python programming, reading the Abaqus Scripting User's Manual, consulting the Abaqus Scripting Reference Manual, and analyzing the macro/replay file as you suggested, I put together the puzzle pieces into the below Python script. This script accomplished my desired task, and writes the custom Field Output (in my case 'Osteogenic Index') back to the Abaqus output database (*.ODB) for all analysis steps (independently of their names) and all frames.

Hope this code can be of any help for others facing similar tasks in the future...

David

----------------------------------------------
[tt]
from abaqusConstants import *
from odbAccess import *

# ******************************************************************************
# Modify the next variables accordingly:
odbPath = "D:\\Temp\\database_name.odb" [tab][tab]# path to output database
k = 0.35[tab][tab][tab][tab][tab][tab][tab][tab][tab][tab]# constant in 'Osteogenic Index'
# ******************************************************************************

odb = session.openOdb(name=odbPath,readOnly=FALSE)
allSteps = session.odbData[odbPath].steps.keys()
for i in range(len(allSteps)):
[tt]step = odb.steps[allSteps][/tt]

[tt]allFrames = session.odbData[odbPath].steps[allSteps].frames.keys()[/tt]

[tt]for j in range(len(allFrames)):[/tt]​
[tt]frame = step.frames[j][/tt]​
[tt]octahedral = (sqrt(2)/3) * frame.fieldOutputs['MISESONLY'][/tt]​
[tt]hydrostatic = frame.fieldOutputs['PRESSONLY'][/tt]​
[tt]OImaxmin = octahedral - k * hydrostatic[/tt]​
[tt]newField = frame.FieldOutput(name='OImaxmin', description='Osteogenic Index', field=OImaxmin)[/tt]​
[tt]print 'stepName = ', allSteps, ' frameNumber = ', allFrames[j][/tt]

odb.save()
odb.close()

# You must re-open the output database to see the new custom field output
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor