Beruflich Dokumente
Kultur Dokumente
1 of 5
http://127.0.0.1:2080/v6.14/books/cmd/pt01ch03s02.html#cmd-int-ove...
03/11/2016 20:09
2 of 5
http://127.0.0.1:2080/v6.14/books/cmd/pt01ch03s02.html#cmd-int-ove...
Use the following commands to retrieve the script and the output database that is read by the script:
abaqus fetch job=odbExample
abaqus fetch job=viewer_tutorial
3.2.1 The example script
"""
odbExample.py
Script to open an output database, superimpose variables
from the last frame of different steps, and display a contour
plot of the result.
"""
from abaqus import *
from abaqusConstants import *
import visualization
myViewport = session.Viewport(name='Superposition example',
origin=(10, 10), width=150, height=100)
# Open the tutorial output database.
myOdb = visualization.openOdb(path='viewer_tutorial.odb')
# Associate the output database with the viewport.
myViewport.setValues(displayedObject=myOdb)
# Create variables that refer to the first two steps.
03/11/2016 20:09
3 of 5
http://127.0.0.1:2080/v6.14/books/cmd/pt01ch03s02.html#cmd-int-ove...
firstStep = myOdb.steps['Step-1']
secondStep = myOdb.steps['Step-2']
# Read displacement and stress data from the last frame
# of the first two steps.
frame1 = firstStep.frames[-1]
frame2 = secondStep.frames[-1]
displacement1 = frame1.fieldOutputs['U']
displacement2 = frame2.fieldOutputs['U']
stress1 = frame1.fieldOutputs['S']
stress2 = frame2.fieldOutputs['S']
# Find the added displacement and stress caused by
# the loading in the second step.
deltaDisplacement = displacement2 - displacement1
deltaStress = stress2 - stress1
# Create a Mises stress contour plot of the result.
myViewport.odbDisplay.setDeformedVariable(deltaDisplacement)
myViewport.odbDisplay.setPrimaryVariable(field=deltaStress,
outputPosition=INTEGRATION_POINT,
refinement=(INVARIANT, 'Mises'))
myViewport.odbDisplay.display.setValues(plotState=(
CONTOURS_ON_DEF,))
03/11/2016 20:09
4 of 5
http://127.0.0.1:2080/v6.14/books/cmd/pt01ch03s02.html#cmd-int-ove...
03/11/2016 20:09
5 of 5
http://127.0.0.1:2080/v6.14/books/cmd/pt01ch03s02.html#cmd-int-ove...
Similarly, these statements assign the stress field output in the last frame of the first and second steps to the
variables stress1 and stress2.
deltaDisplacement = displacement2 - displacement1
This statement subtracts the displacement field output from the last frame of the two steps and puts the
resulting field output into a new variable deltaDisplacement.
deltaStress = stress2 - stress1
Similarly, this statement subtracts the stress field output and puts the result in the variable deltaStress.
myViewport.odbDisplay.setDeformedVariable(deltaDisplacement)
This statement uses deltaDisplacement, the displacement field output variable that we created earlier,
to set the deformed variable. This is the variable that Abaqus will use to display the shape of the deformed
model.
myViewport.odbDisplay.setPrimaryVariable(field=deltaStress,
outputPosition=INTEGRATION_POINT,
refinement=(INVARIANT, 'Mises'))
This statement uses deltaStress, our stress field output variable, to set the primary variable. This is the
variable that Abaqus will display in a contour or symbol plot.
myViewport.odbDisplay.display.setValues(plotState=(CONTOURS_ON_DEF,))
The final statement sets the plot state to display a contour plot on the deformed model shape.
03/11/2016 20:09