Skip to main content

Abaqus scripting - variable is unavailable

Submitted by yentlswolfs on

Hi guys,

I've recently started scripting in Abaqus and I ran into a major issue. To clarify
my problem, I've uploaded a simplified version of my inputfile (http://www.box.net/shared/dd61iog2oc0hcpn4jcbf).
The model contains fibres and matrix. All fibres and matrix are
subjected to a displacement, except for the centre fibre. These boundary
conditions give rise to stress concentrations. The core of my work is
to determine this stress concentration.



I want to create a code that does the following:

Input: x,y,z (a random location)

Output: the stress S33 at x,y,z.

I keep on getting an OdpError when I'm calling a variable: "The
selected variable is unavailable." I have no idea on how to solve this.
I've posted my script below.



Any help would be highly appreciated.



# Import all the necessary packages

import os

import visualization

import sys

from odbAccess import *

from abaqusConstants import *



# The point at a random location (x, y, z) where we want to extract S33

locx = 25

locy = 25

locz = 25

point= ( (locx,locy,locz), )



# The path object to map all the values to

myPath=session.Path(name='track', type=POINT_LIST, expression=point)



# These parameters are used in XYDataFromPath

var_s33=(('S', INTEGRATION_POINT, ((COMPONENT, 'S33' ), )),)

session.paths['track']

StepName = 'Step-1'



# Setup the odb and viewport

myodb = openOdb(path = 'Small_model.odb')

viewport = session.viewports[session.viewports.keys()[-1]]

viewport.setValues(displayedObject=myodb)

viewport.odbDisplay.setPrimaryVariable(variableLabel = 'S',outputPosition = INTEGRATION_POINT, refinement=COMPONENT,'S33'))

viewport.odbDisplay.display.setValues(plotState=CONTOURS_ON_DEF,))

 # Map S33 values to the path

stress33XYData=session.XYDataFromPath(name='Stress in 33-direction',

                    path=myPath,

                    includeIntersections=False,

                    shape=DEFORMED,

                    labelType=TRUE_DISTANCE,

                    step=-1,

                    frame=-1,

                    variable=var_s33)

# Extract the S33 value from the XYData

stress33Value = stress33XYData.data[0][1]