vector operations in ansys
TRANSCRIPT
A Quick Look at Some Vector Operations in
Mechanical APDL
Rick Fischer
Principal Engineer
Argonne National Laboratory
November 3, 2010
11/8/2010
Nuclear Engineering Division - Engineering Operations
2
What are vector commands?
A vector command operates on an
entire array of values. One command
completely fills
an array.
11/8/2010
Nuclear Engineering Division - Engineering Operations
3
Compare that to a scalar command, which
operates on a single-valued parameter.
11/8/2010
Nuclear Engineering Division - Engineering Operations
4
Why use vector operations?
Because they are FAST!!
•The cube below has 1,030,301 nodes.
•Let’s get the x and y coordinate for every node.
•The do loop makes a separate trip into the data
base and comes out with one value, so it must
enter the database 1,030,301 times.
•The vector command enters the database once
and comes out with 1,030,301 values.
•The savings in IO time is huge!
2.052 min.
0.000 min.
11/8/2010
Nuclear Engineering Division - Engineering Operations
5
Before I can use a vector command, I must create arrays.
This is done with the *DIM command. The array will be
initially filled with zeros.
11/8/2010
Nuclear Engineering Division - Engineering Operations
6
Where can I use vector commands?1. Mechanical (i.e. Workbench) in a command snippet.
2. Mechanical APDL (i.e. Ansys Classic) at the
command line.
11/8/2010
Nuclear Engineering Division - Engineering Operations
7
There are lots of
vector commands.
Some have many
options, some are
simple. Rather than
going through the
commands one at a
time, which is time
consuming and
boring, lets look at a
couple of typical
problems and see
how they can be
solved with vector
commands.
11/8/2010
Nuclear Engineering Division - Engineering Operations
8
PROBLEM #1: Find the total change in heat energy in a model with multiple
materials during a transient thermal analysis.
APPROACH: Find the change in heat per element and sum across the model.
eieie TcVqQ
multi-body part
applied temps
11/8/2010
Nuclear Engineering Division - Engineering Operations
9
First, lets get some raw data. We need to get nodal
geometry, elemental geometry, and material constants. We’ll
use *VGET to speed things up.
Just a simple do-loop for this. Only three materials, so a vector command
is not needed.
Note that we used seven *VGET commands. On a million
node model, that would take 14 minutes!
11/8/2010
Nuclear Engineering Division - Engineering Operations
10
At this point we have the material properties by material types,
but we don’t have them associated with an element.
mat #
density
specific
heat
element
centroid
coordinates
element
volumeelement #
11/8/2010
Nuclear Engineering Division - Engineering Operations
11
We will use the
*VOPER command
to “gather” the
material
properties to the
correct location.
11/8/2010
Nuclear Engineering Division - Engineering Operations
12
ParR(j)=Par1(Par2(j))
ParR(Par2(j))=Par1(j)
data orderPar2 ParR
Par1
This command is impossible to
describe verbally. Use the
diagrams below to decypher it.
11/8/2010
Nuclear Engineering Division - Engineering Operations
13
Next, we need to get temperatures. Temps are available only as
nodal temps, and we need an elemental temp. We could try and
do some boring, repetitive math and average the nodal temps
to get an elemental value, but here’s a slicker way.
Not a great description. It’s true, but
the MAP option is not limited to
mapping results. It can map any kind
of data from one set of reference
points to another set.
11/8/2010
Nuclear Engineering Division - Engineering Operations
14
An ncount x 3 matrix of nodal
x, y and z coordinates.
An ncount x 1 vector of nodal
temperatures.
An ecount x 3 matrix of
element centroid x, y and z
coordinates.
An ecount x 1 vector of
elemental temperatures. 3D
locations
data
We can use the *MOPER,,,MAP command to interpolate data (nodal
temps in TDAT) from a cloud of reference points (nodal coordinates in
NDATA) to a new cloud of points(element centroids in EDATA).
11/8/2010
Nuclear Engineering Division - Engineering Operations
15
11/8/2010
Nuclear Engineering Division - Engineering Operations
16
All that’s left is the math.
We’ll use *VSCFUN (vector scalar function) to sum the individual
elemental heat losses across the entire model.
Note that in the first *voper, Par2 = tinit, a scalar parameter. Either
Par1 or Par2 or both can be a constant.
Note: four more
vector operations =
eight more minutes
saved!
11/8/2010
Nuclear Engineering Division - Engineering Operations
17
Back in Workbench Ansys Mechanical…
Create a command snippet
under Solution and insert
your APDL commands.
Note that these commands
will be executed after the
POST1 command.
11/8/2010
Nuclear Engineering Division - Engineering Operations
18
Next, run the solution.
11/8/2010
Nuclear Engineering Division - Engineering Operations
19
Then, click on Solution Information, and scroll down to find your results.
11/8/2010
Nuclear Engineering Division - Engineering Operations
20
CHECKING YOUR WORK: In Mechanical APDL, there are a couple
ways to see what kind of damage you are doing.
click here
To look at your Data array, click
parameters, Array Parameters,
Define/Edit, choose DATA, then click
on EDIT. The window below, right will
appear, displaying the DATA array
11/8/2010
Nuclear Engineering Division - Engineering Operations
21
Another method that allows dirrect access to a known locatiopn
is to use the *STATUS command. If you want to look at the
entries for element 567 in the DATA array, at the command line
type:
*status,data,567,567,1,10
11/8/2010
Nuclear Engineering Division - Engineering Operations
22
PROBLEM #2: Calculate high cycle fatigue damage at every node in a model of a
hydraulic pump and display it as a contour plot.
APPROACH:
1. Assign fatigue parameters for each material to each node.
2. Obtain minimum and maximum stress at each node. Calculate mean and
alternating stress.
3. Calculate the fatigue stress and damage at each node.
4. Plot the damage as a contour plot.
11/8/2010
Nuclear Engineering Division - Engineering Operations
23
First, lets get the material data we’ll
need for the fatigue calculations.
Estimate an S-N curve using the method given in Shigley, and fit it to
a straight line in log-log space. Then input the material data needed
for fatigue calculations.
Next, select the component element HEAD, and select all the nodes
associated with it.
Now, use *VGET to create a “mask” based on nodal selection status.
11/8/2010
Nuclear Engineering Division - Engineering Operations
24
What’ a mask? A mask is a column of 0s and 1s that
can be used to control the execution of the first vector
command that follows it.
Notice how the mask generated with the *vget
command controls the action of the *vfill command.
Last element
with MAT=1 (not
selected)
First element with
MAT=2 (selected)
-1 = defined, not
selected
1 = defined,
selected
Column 1 only gets filled when column 6 = 1
11/8/2010
Nuclear Engineering Division - Engineering Operations
25
Next, lets retrieve some stresses
and crunch the math.Modified Goodman line
adjust for a non-zero mean stress
find theoretical life
11/8/2010
Nuclear Engineering Division - Engineering Operations
26
To create our plot, we’ll use *vput
to put our calculated damage into
the database for plotting. Pick a
result that you are not using in
your report. Lets use sx, st, and
sz.
For this to work:
•No Powergraphics (/graphics,full).
•Can’t write over a derived result (e.g. s,eqv).
11/8/2010
Nuclear Engineering Division - Engineering Operations
27
Here’s a very useful undocumented *VPUT option.
Change the selection status to coincide with the mask specified by ParR
11/8/2010
Nuclear Engineering Division - Engineering Operations
28
At a glance, I can see every
potential fatigue hot-spot
everywhere on the entire
assembly.
The head has a hot-spot in the
fillet around the discharge port
11/8/2010
Nuclear Engineering Division - Engineering Operations
29
The real high damage on the
stainless steel housing is due the a
BC, (bonded contact on the
housing-head interface), so I can
ignore it if I want.
We specified an endurance limit for the
steel mounting flange, and it was above
Sf everywhere on the part. The macro
sets N to 108 cycles, so at 100,00 cycles,
the damage is 0.001.