Abaqus_2018
Bioengineer
- May 3, 2018
- 2
Hi
I am going to extract hydrostatic and deviatoric (octahedral) stress from .Odb Abaqus file. I add a Pyton Script code to my .py file and run it, but I got this error "IndentationError: unexpected indent". Can anyone help me to fix it?
Pyton Script is:
from abaqusConstants import *
from odbAccess import *
# ******************************************************************************
# Modify the next variables accordingly:
odbPath = "Z:\ABAQUS\mySimulation" # path to output database
k = 0.5 # constant in 'Osteogenic Index'
# ******************************************************************************
odb = session.openOdb(name=odbPath,readOnly=FALSE)
allSteps = session.odbData[odbPath].steps.keys()
for i in range(len(allSteps)):
step = odb.steps[allSteps]
allFrames = session.odbData[odbPath].steps[allSteps].frames.keys()
for j in range(len(allFrames)):
frame = step.frames[j]
octahedral = (sqrt(2)/3) * frame.fieldOutputs['MISESONLY']
hydrostatic = frame.fieldOutputs['PRESSONLY']
OImaxmin = octahedral - k * hydrostatic
newField = frame.FieldOutput(name='OImaxmin', description='Osteogenic Index', field=OImaxmin)
print 'stepName = ', allSteps, ' frameNumber = ', allFrames[j]
odb.save()
odb.close()
I am going to extract hydrostatic and deviatoric (octahedral) stress from .Odb Abaqus file. I add a Pyton Script code to my .py file and run it, but I got this error "IndentationError: unexpected indent". Can anyone help me to fix it?
Pyton Script is:
from abaqusConstants import *
from odbAccess import *
# ******************************************************************************
# Modify the next variables accordingly:
odbPath = "Z:\ABAQUS\mySimulation" # path to output database
k = 0.5 # constant in 'Osteogenic Index'
# ******************************************************************************
odb = session.openOdb(name=odbPath,readOnly=FALSE)
allSteps = session.odbData[odbPath].steps.keys()
for i in range(len(allSteps)):
step = odb.steps[allSteps]
allFrames = session.odbData[odbPath].steps[allSteps].frames.keys()
for j in range(len(allFrames)):
frame = step.frames[j]
octahedral = (sqrt(2)/3) * frame.fieldOutputs['MISESONLY']
hydrostatic = frame.fieldOutputs['PRESSONLY']
OImaxmin = octahedral - k * hydrostatic
newField = frame.FieldOutput(name='OImaxmin', description='Osteogenic Index', field=OImaxmin)
print 'stepName = ', allSteps, ' frameNumber = ', allFrames[j]
odb.save()
odb.close()