Changing Results Values in ANSYS Mechanical APDL–DNSOL and *VPUT

So it is Friday afternoon and that big, involved, deep-dive into some arcane ANSYS capability is still not written.  So, time for plan B and the list of not so involved but still somewhat arcane capabilities that we like to expose in The Focus.  At the top of that list right now is how to change the results in an ANSYS Mechanical APDL (MAPDL) solve. 

One might ask why would you want to do this?  Well the most common usage is that you want to use APDL to calculate some result value and then display it in a plot.  Similarly, you may want to do some sort of calculation or post processing on MAPDL results but using and external piece of code, but still show the results in ANSYS.  Another common usage is to use MAPDL as a post processor for some external solver. 

And, it turns out, it is pretty easy.  And, as you probably have learned by now if you use MAPDL a lot, there is more than one way to do it.

The “Database”

Before we get into how to do this, we need to talk about the “database” in MAPDL. If you read through the documentation on the commands we will use, it will talk about the database.  This is not the jobname.db file.  That is the db file.  The database refers to the representation of your model, including results and the currently active loads, in memory when you are running MAPDL. 

When you do a RESUME command, MAPDL reads the DB file and stores the model, including geometry, mesh, loads, and run parameters, in memory.  When you do a SET command, it then adds the results and related information into memory. 

So when we use the commands we will talk about next, you are changing what is in the database, not what is in the DB file on your disk.  And you are storing it temporarily.  Many different commands cause the database to go back to its original values.  So you need to be very careful in how you use these tools, and don’t assume that once you have used them, the changes are permanent.  

DNSOL

The simplest way to do it is with the DNSOL command: DNSOL, NODE, Item, Comp, V1, V2, V3, V4, V5, V6

So, if you do a dnsol,32,u,x,3.145  the value in memory for deflection in the X direction will be changed to 3.145.  dnsol,32,s,x,1.1,2.2,3.3 will change the stress on node 32 in the X direction to 1.1, in the Y direction to 2.2, and in the Z direction to 3.3. 

The second argument can also be a component, so you can assign a uniform result value to many nodes at the same time. 

Here is an example, very simple, of a block where we set the deflection on the top nodes to 1 in.

   1: finish

   2: /clear

   3: /prep7

   4: blc4,-2,-2,4,4,20

   5: et,1,185

   6: mptemp,1,70

   7: mpdata,ex,1,1,20e6

   8: mpdata,nuxy,1,1,.23

   9: mpdata,dens,1,1,.001

  10:  

  11: vmesh,all

  12: /view,1,1,1,1

  13: /vup,1,z

  14: /RGB,INDEX,100,100,100, 0

  15: /RGB,INDEX, 80, 80, 80,13

  16: /RGB,INDEX, 60, 60, 60,14

  17: /RGB,INDEX, 0, 0, 0,15

  18: /show,png

  19: eplot

  20:  

  21: nsel,s,loc,z,0

  22: cm,nbt,node

  23: d,all,all

  24: nsel,s,loc,z,20

  25: cm,ntp,node

  26: f,all,fx,10

  27: f,all,fy,12

  28: allsel

  29: save

  30:  

  31: /solu

  32: solve

  33: finish

  34: /post1

  35: plnsol,u,sum

  36:  

  37: dnsol,ntp,u,y,1

  38: plnsol,u,sum

  39:  

  40: /show,close

 

 

aa1003The Fancy Mesh

aa1004The Normal Solution

aa1005Solution with 1” deflection DNSOL’d onto the top nodes

Pretty simple. 

NOTE: One key thing to remember is you can not use this with Powergraphics. You must have /graph,full turned on.

*VPUT

The DNSOL is great for a few nodes here and there, or a constant value. But it makes for a big nasty *do loop if you want to do a lot of nodes. So ANSYS, Inc. give us the *VPUT command:

*VPUT, ParR, Entity, ENTNUM, Item1, IT1NUM, Item2, IT2NUM, KLOOP

As you can see, this command has a lot of options, so read the Help before you use it. Most of the time you have an array that stores the value you want stuck on your model in an array (ParR).  Then you specify what MAPDL result you want to overwrite and it takes care of it for you.

*vput,nws1(1),node,1,s,1 will place new values for maximum principal stress on all the nodes covered in the array , starting at 1. 

Here is an example of the code, after the same solve as above, to do a *vput instead of a DNSOL:

   1: finish

   2: /post1

   3: plnsol,u,sum

   4:  

   5: *get,nmnd,node,,num,max

   6: *dim,nwux,,nmnd

   7: *do,i,1,nmnd

   8:     nwux(i) =  i

   9: *enddo

  10:     

  11: *vput,nwux(1),node,1,u,x

  12: plnsol,u,sum

aa1017

The code places a displacement in the X direction equal to its node number.  So node 80 has a UX of 80. 

A key thing to note with *vput is that it is much more transient. Pretty much any other command that involves anything other than plotting or listing blows away the values you assigned with *VPUT.  So we recommend that you do a *vput before every plot or listing you do.

Thoughts, Questions, and Conclusion

Of course you should never use this to fudge results. 

You can get very fancy with this. When I use it I often turn off all the plot controls and then create my own legend. That way I can put hours of life on as temperature or SX and then make my own legend that says LIFE or something of the sort. 

Another thing to note is that if you DNSOL or *VPUT a displacement, then ANSYS will distort your plot by that much.  That is OK if you are changing deflection, but not so good if you are plotting life or some esoteric stress value.

A common question when you play with these commands is if you can store the modified results in the RST file.  You can for degree of freedom results, but not for stresses.  You use LCDEF and RAPPND. 

And what about ANSYS Mechanical?  Well it works totally different, and better. You can do all of this using Design Assessment, which was covered in a webinar and a Focus article you can find here.

The key to using these two commands is pretty much the same as any APDL command: Start on a small test model, write a macro to do it, and keep things simple. And, read the manual.  Everything you need to know is in there.

Workshops for “Intro to Workbench Framework Scripting”

image

At noon Phoenix time today we will be presenting the Webinar “Intro to Workbench Scripting: Controlling Projects, Materials, and Solution Execution with Python”  This is a very high level, and probably short, introduction to the basics of using the python scripting in Workbench.

To support the talking, I’ve put together four workshops, mostly based on ANSYS material or examples we have presented before here on the Focus.  They should be enough for anyone that is a good programmer or better to customize the Workbench Framework.  We also present it here as a tool for those who don’t attend the webinar (and as this weeks Focus posting, cause we didn’t have time to write one…)

Warning: These were done in a hurry between meetings and some travel… so they are not great from a grammar or typo standpoint. Regardless, we hope you find them useful.

The files you need to run them are in this zip file:

The Workshop Document is here: 

We hope to add to this document over the next year or so and provide it as a more or less complete tutorial for those who want to automate their analysis.

Starting ANSYS Products From the Command Line

imageSometimes you just get tired of clicking on icons.  Sometimes you just need to feel the control and power of launching your applications from the command line.  You type it in, you hit the enter key, and sometimes you can actually hear the disk spin up or the fan run faster to cool the processor as the program you asked for, the program you took time to type out, leaps to life in front of you. Satisfaction.

OK, maybe not.  More often you are scripting some batch solves.  Or maybe you are using the graphical user interface in Workbench but you need to set options for the solvers you are running from within workbench.  Because most of the solvers in the ANSYS family of products predate such new-fangled concepts as GUI’s, and because they are often run remotely on other machines, they have command line interfaces. And that gives the knowledgeable user more power and control.

General Concepts for Launching from the Command Line

Although the number of options available changes from application to applications, there a few common things you should know. 

Paths

The first and most important concept is to be aware of the path.  This is where most errors happen. One of the big changes over the years is that as software gets more complicated, the executable program or script that you use to launch a solver is now buried deep down inside a directory structure.  Since we never run in that actual directory we need to tell the operating system where the executable is. You can do this by including the full directory path in your command line argument, or by adding it to your path. 

On Linux follow the directions in the help:

// Installation and Licensing Documentation // Linux Installation Guide // 5. Post-Installation Instructions

for each of the products you want to run. Generally, you need to set the PATH environmental variable in your .cshrc, .login, or .profile. 

On Windows it is not documented, the assumption being that you will be clicking on icons and not typing into a command window.  So a little detective work is needed. Use a file explorer and the Linux documentation on launching to locate the executable for solvers you want to use:

// Installation and Licensing Documentation // Linux Installation Guide // 5. Post-Installation Instructions // 5.3. Launching ANSYS, Inc. Products

The /ansys_inc part is usually replaced with c:\Program Files\ANSYS Inc.  The rest of the path is pretty much the same, swapping forward slashes with backward slashes.  Use these paths in your command line or add to your path by:

  • From the desktop, right-click My Computer and click Properties.
  • In the System Properties window, click on the Advanced tab.
  • In the Advanced section, click the Environment Variables button.
  • Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.

    Windows enviromental path settings

    Important note for Windows:  If you are typing the path in on the command line, you need to put it in double quotes.  The convention on Windows is to specify directories with spaces in the name.  But the convention is not to have a command line parser that recognizes this.  So you will get an error if you type:

    C:\Program Files\ANSYS Inc\v140\ansys\bin\winx64\ansys140.exe

    But if you put it in quotes, it works fine:

    "C:\Program Files\ANSYS Inc\v140\ansys\bin\winx64\ansys140.exe"

    Versions Numbering

    If you look at the example for launching MAPDL above you will notice that 140 is used in the directory path and in the name of the executable.  This will change with version:  v130, v145, etc…  Just be aware of that if you are reading this blog posting in 3 years and we are on release 16.5.  you would use:

    "C:\Program Files\ANSYS Inc\v165\ansys\bin\winx64\ansys165.exe"

    Where do you Launch From?

    You of course need a command line to launch a solver.  This is usually a window that lets you type operating system commands: called a Command Prompt in Windows or a shell on Linux.  On Linux it can be an xterm window, a console window, or some other terminal window you have opened. 

    But you can also launch from a script, and that script can be launched from a command prompt or shell, or it can be launched by an icon.  All that needs to happen is that the script needs to be executed with the environmental variables required for the command prompt/script or the GUI.  If you don’t know how to make that happen, contact your IT support or someone who understands your operating system and how it runs processes.

    ANSYS Mechanical APDL

    The solver with the most options and capabilities from the command line is Mechanical APDL. So we will start there.  It is important to know these even if you use Mechanical most of the time.  That is because you can set these, and better control your solves, under Tools->Options->Mechanical APDL.  Here is what that dialog looks like:

    image

    The most common settings have their own widgets,  and the others can all be accessed by using “- string” command line style arguments in the first text widget aptly named: Command Line Options.

    Here are the options, grouped for your studying pleasure:

    Option

    Type

    Description

    -ansexe

    Customization

    In the ANSYS Workbench environment, activates a custom ANSYS executable.

    -custom

    Customization

    Calls a custom ANSYS executable. See help on running custom executables for more

    -acc device

    HPC

    Enables the use of GPU compute accelerator. As this is written, nvidia is the only option. But as other cards become available look for this to have other options. Check the help.

    -dis

    HPC

    Enables Distributed ANSYS. See the Parallel Processing Guide for more information.

    machines

    HPC

    Specifies the machines on which to run a Distributed ANSYS analysis. See Starting Distributed ANSYS in the Parallel Processing Guide for more information.

    -mpi

    HPC

    Specifies the type of MPI to use. See the Parallel Processing Guide for more information.

    -mpifile

    HPC

    Specifies an existing MPI file (appfile) to be used in a Distributed ANSYS run. See Using MPI appfiles in the Parallel Processing Guide for more information.

    -np value

    HPC

    Specifies the number of processors to use when running Distributed ANSYS or Shared-memory ANSYS.

    -d device

    Interface

    Specifies the type of graphics device. This option applies only to interactive mode. For Linux systems, graphics device choices are X11, X11C, or 3D. For Windows systems, graphics device options are WIN32 or WIN32C, or 3D.

    -g

    Interface

    Launches the ANSYS program with the Graphical User Interface (GUI) on. Linux only. On windows do a /SHOW and /MENU,ON to get the GUI up.

    -l language

    Interface

    Specifies a language file to use other than US English.

    -b [list | nolist]

    Launch

    Activates the ANSYS program in batch mode. The options -b list or -b by itself cause the input listing to be included in the output. The -b nolist option causes the input listing not to be included

    -i inputname

    Launch

    Specifies the name of the file to read input into ANSYS for batch processing. On Linux, the preferred method to indicate an input file is <. Requried with -b option.

    -j Jobname

    Launch

    Specifies the initial jobname, a name assigned to all files generated by the program for a specific model. If you omit the -j option, the jobname is assumed to be file.

    -o outputname

    Launch

    Specifies the name of the file to store the output from a batch execution of ANSYS. On Linux, the preferred method to indicate an output file is >.

    -p productname

    Launch

    Defines which ANSYS product will run during the session (ANSYS Multiphysics, ANSYS Structural, etc.). This is how you pull a different licence from the default. Very handing if you have multiple licenses to choose from.

    -s [read | noread]

    Launch

    Specifies whether the program reads the start140.ans file at start-up. If you omit the -s option, ANSYS reads the start140.ans file in interactive mode and not in batch mode.

    -dir

    Luanch

    Defines the initial working directory. Remember to use double quotes if you have spaces in your directory path name. Using the -dir option overrides the ANSYS140_WORKING_DIRECTORY environment variable.

    -db value

    Memory

    Defines the portion of workspace (memory) to be used as the initial allocation for the database. This and -m are the two most important options. If you ever find that ANSYS is writing a *.PAGE file, up this number.

    -m value

    Memory

    Idefines the total memory to reserve for the program. It is always better to reserve it up front rather than letting ANSYS grab as it needs.

    -schost host name

    MFX

    Specifies the host machine on which the coupling service is running (to which the co-simulation participant/solver must connect) in a System Coupling analysis.

    -scname name of the solver

    MFX

    Specifies the unique name used by the co-simulation participant to identify itself to the coupling service in a System Coupling analysis. For Linux systems, you need to escape the quotes or escape the space to have the name recognized with a space:

    -scport port number

    MFX

    Specifies the port on the host machine upon which the coupling service is listening for connections from co-simulation participants in a System Coupling analysis.

    -mfm

    MFX

    Specifies the master field name in an ANSYS Multi-field solver – MFX analysis. See Starting and Stopping an MFX Analysis in the Coupled-Field Analysis Guide for more information.

    -ser value

    MFX

    Specifies the communication port number between ANSYS and CFX in an MFX analysis.

    -dvt

    Other

    Enables ANSYS DesignXplorer advanced task (add-on).

    -dyn

    Other

    Enables LS-DYNA.

    -v

    Other

    Returns the ANSYS release number, update number, copyright date, customer number, and license manager version number. Does not actually run ANSYS MAPDL.

    name value

    Params

    Defines ANSYS parameters at program start-up. The parameter name must be at least two characters long. These get passed into ANSYS and are used by any APDL scripts you run.

    The ones that everyone should know about are: –p, –m, –db.  We find that not using these to define what license to use (-p) or to control how memory is pre-allocated (-m, –db) generate the most tech support questions.    The next most important is the –np command. Use this to define more processors if you have HPC licenses.

    Cheating – Use the Launcher

    Sometimes the options can get long and confusing.  So what I do is I use the “ANSYS Mechanical APDL Launcher” and fill in all the forms. then go to tools->View Display Command Line and I can see all the options.

    image

    Here is a a fancy command line that got generated that way:

    "C:\Program Files\ANSYS Inc\v140\ANSYS\bin\winx64\ansys140.exe"  -g -p ane3flds -np 2 -acc nvidia -dir "c:\temp" -j "grgewrt1" -s read -m 5000 -db 1000 -l en-us -lstp1 32 -t -d win32 -custom "/temp/myansys.exe"  

    It runs interactive (-g), uses a multiphysics license (-p ane3flds), grabs two processors (-np 2), uses an NVIDEA GPU (-acc nvidia (I don’t have one…)), runs in my temp directory (-dir), uses a job name of grgewrt1 (-j), reads the start.ans file (-s), grabs 5000mb and 1000mb for memory (-m, –db), uses English, passes in a parameter called lstp1 and sets it to 32 (-), uses the win32 graphics driver (-d) and runs my custom ANSYS executable (-custom).

    I have no idea what –t is.  Some undocumented option I guess…

    ANSYS Workbench

  • ANSYS Workbench also has some command line arguments. not as rich as what is available in MAPDL, but still powerful. It allows you to run Mechanical in Batch or Interactive mode, supply python commands as needed.  The key thing to remember is that the workbench interface is not Mechanical or FLUENT. It is the infrastructure that other programs run on. Scripting in workbench allows you to control material properties, parameters, and how systems are created and executed.

    Here are the options:

    Argument

    Operation

    -B

    Run ANSYS Workbench in batch mode. In this mode, the user interface is not displayed and a console window is opened. The functionality of the console window is the same as the ANSYS Workbench Command Window.

    -R <ANSYS Workbench script file>

    Replay the specified ANSYS Workbench script file on start-up. If specified in conjunction with –B, ANSYS Workbench will start in batch mode, execute the specified script, and shut down at the completion of script execution.

    -I

    Run ANSYS Workbench in interactive mode. This is typically the default, but if specified in conjunction with –B, both the user interface and console window are opened.

    -X

    Run ANSYS Workbench interactively and then exit upon completion of script execution. Typically used in conjunction with –R.

    -F <ANSYS Workbench project file>

    Load the specified ANSYS Workbench project file on start-up.

    -E <command>

    Execute the specified ANSYS Workbench scripting command on start-up. You can issue multiple commands, separated with a semicolon (;), or specify this argument multiple times and the commands will be executed in order.

    The big deal in this list is the –B argument.  This allows you to run workbench, and applications controlled by the project page, in batch mode.  You will usually use the –R argument to specify the Iron Python script you want to run.  In most cases you will often want to throw in a –X to make sure it exists when the script is done. 

    Other ANSYS Products

    Here is where it gets boring.  The other products just don’t have all those options. At least not documented.  So you simply find the executable and run it.  Here is the list for Linux. Use it to find the location on Windows.

    Product

    Command

    Mechanical APDL

    /ansys_inc/v140/ansys/bin/ansys140

    ANSYS Workbench

    /ansys_inc/v140/Framework/bin/<platform>/runwb2

    ANSYS CFX

    /ansys_inc/v140/CFX/bin/cfx5

    ANSYS FLUENT

    /ansys_inc/v140/fluent/bin/fluent

    ANSYS ICEM CFD

    /ansys_inc/v140/icemcfd/<platform>/bin/icemcfd

    ANSYS POLYFLOW

    /ansys_inc/v140/polyflow/bin/polyman

    ANSYS CFD-Post

      /ansys_inc/v140/CFD-Post/bin/cfdpost

    ANSYS Icepak

    /ansys_inc/v140/Icepak/bin/icepak

    ANSYS TurboGrid

      /ansys_inc/v140/TurboGrid/bin/cfxtg

    ANSYS AUTODYN

    /ansys_inc/v140/autodyn/bin/autodyn140

    APDL Math–Access to the ANSYS Solver Matrices with APDL

    APDL Math.  It is one of the most powerful, uber-user, deep down under the hood, wrapping your hands around the neck of what FEA is, capabilities in the ANSYS Mechanical APDL (MAPDL) solver.  And most users don’t even know it is there.  It kind of snuck in over time, with the developers adding more and more capability each release.  Now it gives you access that you needed custom FORTRAN code to get to in the past… or NASTRAN DMAP, which is really something none of us ever want to do.

    There is a lot of capability in this tool. This posting is just going to cover the basics so that you know what the tool can be used for in case you need it in the future, and hopefully motivate some of you to take a long look at the help. 

    What is APDL Math?

    It is an extension to the APDL command language that drives MAPDL.   Although it runs in a different workspace (chunk of memory in the ANSYS database) it talks to standard APDL by importing and exporting APLD arrays (vectors or matrices).  It consists, at R14, of 18 commands that can be executed at the /SOLU level at any time.  All of the commands start with a * character and look and act like standard APDL commands.

    APDL Math is a tool for users to do two things: 1) get access to view, export or modify matrices and vectors created by the solver, and 2) to control import or modify matrices and vectors then solve them.  The most common uses we have seen is the exporting of a matrix from ANSYS for use in some other program, usually Matlab.  The other is working with sub-structure matrices.

    The entire tool is documented in the Mechanical APDL section of the help under  // ANSYS Parametric Design Language Guide // 4. APDL Math.

    The Commands

    Below is a list of the APDL math commands.  As usual, you really need to read the manual entries to get the full functionality explained.  Just like parameters and arrays in APDL, the matrices and vectors in APDL Math use names to identify them.  Note that you have a set of commands to create the matrix/vector you want, which includes reading from a file or importing an APDL array.  then you have commands to do basic matrix/vector math like multiply, find dot products, and do Fast Fourier Transformations.  Then there are solver commands.

    Commands to create and delete matrices and vectors

    *DMAT, Matrix, Type, Method, Val1, Val2, Val3, Val4, Val5

    Creates a dense matrix that is complex, double or integer. You can allocate it, resize an existing matrix, copy a matrix, or link to a portion of a matrix. You can also import from a file or an APDL variable.

    *SMAT, Matrix, Type, Method, Val1, Val2, Val3

    Creates a sparse matrix. Double or Complex, copied or imported.

    *VEC, Vector, Type, Method, Val1, Val2, Val3, Val4

    Creates a vector. Double, complex or integer. Similar arguments to *DMAT.

    *FREE, Name,

    Deletes a matrix or a solver object and frees its memory allocation. Important to remember to do.

     

    Commands to manipulate matrices

    *AXPY, vr, vi, M1, wr, wi, M2

    Performs the matrix operation M2= v*M1 + w*M2.

    *DOT, Vector1, Vector2, Par_Real, Par_Imag

    Computes the dot (or inner) product of two vectors.

    *FFT, Type, InputData, OutputData, DIM1, DIM2, ResultFormat

    Computes the fast Fourier transformation of the specified matrix or vector.

    *INIT, Name, Method, Val1, Val2, Val3

    Initializes a vector or dense matrix. Used to fill vectors or matrices with zero’s, constant values, random values, or values on the diaganol.

    *MULT, M1, T1, M2, T2, M3

    Performs the matrix multiplication M3 = M1(T1)*M2(T2).

    *NRM, Name, NormType, ParR, Normalize

    Computes the norm of the specified vector or matrix.

    *COMP, Matrix, Algorithm, Threshold

    Compresses the columns of a matrix using a specified Singular value decomposition algorithm (default) or Modified Gram-Schmidt algorithm

     

    Commands to perform solutions

    *LSENGINE, Type, EngineName, Matrix, Option

    Creates a linear solver engine and assignes a name to be used when you want to execute the solve. Does Boeing sparse, MKL sparse, LAPACK or Distributed Sparse.

    *LSFACTOR, EngineName, Option

    Performs the numerical factorization of a linear solver system.

    *LSBAC, EngineName, RhsVector, SolVector

    Performs the solve (forward/backward substitution) of a factorized linear system.

    *ITENGINE, Type, EngineName, PrecondName, Matrix, RhsVector, SolVector, MaxIter, Toler

    Performs a solution using an iterative solver.

    *EIGEN, Kmatrix, Mmatrix, Cmatrix, Evals, Evects

    Performs a modal solution with unsymmetric or damping matrices.

     

    Commands to output matrices

    *EXPORT, Matrix, Format, Fname, Val1, Val2, Val3

    Exports a matrix to a file in the specified format. Supports Matrix Market, ANSYS SUB, DMIG, Harwell-Boeing and ANSYS EMAT. Also used to put values in an APDL array or print in a formated way to a postscript file.

    *PRINT, Matrix, Fname

    Prints the non-zero matrix values to a text file.

     

    Useful APDL Commands

    /CLEAR, Read

    Wipes all APDL and APDL Math values from memory

    WRFULL, Ldstep

    Stops solution after assembling global matrices. Use this to make matrices you need when you don’t want a full solve

    /SYS, String
    Executes an operating system command. This can be used in APDL Math to do some sort of an external operation on a matrix you wrote out to a file, like running a matlab script. After execution the matrix can be read back in and used.

     

    How You Use APDL Math

    When using APDL math you should follow some basic steps.  I’m always a big proponent of the crawl-walk-run approach to anything, so I also recommend that you start with small, simple models to figure stuff out.

    First Step: Know the Math

    imageThe first step, or maybe the zero’th, is to understand your math.  If you charge in and start grabbing the stiffness matrix from the .FULL file and changing values, who knows what you will end up with. Chart out the math you want to do on paper or in a tool like Mathematica. 

    Then makes sure that you understand the math in ANSYS, and that includes the files being used by ANSYS.  A good place to look is in the Programmer’s Manual, Chapter 1 lists the various files and what is in them.  It might also not be a bad idea for you to crack open the theory manual  We all know that ANSYS solve Kx = F, but how, and what matrices and vectors are used.  Section 17.1 explains the static analysis approach used, with lots of links to more detailed explanations.

    Second Step: Create your Matrices/Vectors

    Since the whole point of using APDL math is to do stuff with Matrices/Vectors, you need to start by creating them.  Note that we are not doing anything with APDL Math yet.  We are using APDL, ANSYS, or an external program to get our matrix/vector so that we can then get it into APDL Math.. There are three types of sources you can get matrices/vectors from:

    1. Use APDL to create an array.  *DIM, *SET, *VREAD, *MOPER, etc… 
    2. Use ANSYS to make them as part of a solve, or as part of an “almost solve” using WRFULL.  You can read the .FULL, .EMAT, .SUB, .MODE or .RST
    3. Get a file from some other source and put it into a format that APDL Math can read. It supports Harwell-Boeing, Matrix Market, or NASTRAN DMIG format as well as APDL Math’s own format.

    Third Step: Get the Matrices/Vectors into APDL Math

    Using *DMAT, *SMAT, and *VEC you convert the APDL array, ANSYS file, or external format file into a matrix or a vector.  You can also use *INIT to make one from scratch, filling it with constants, zeros, random numbers or by setting the diagonal or anti-diagonal  values.

    Fourth Step: Manipulate the Matrices/Vectors

    In this step you can modify matrices in a lot of different ways.  The simplest is to use *MULT or *AXPY to do math with several matrices/vectors to get a new matrix/vector. 

    Another simple way to change things is to simply refer to the entries in the matrix using APDL.  As an example, to change the damping at I=4 and J =5 in a damping matrix called dmpmtrx just use dmpmtrx(4,5) – 124.321e4.

    You can take that one step further and use the APDL operators that work on arrays like *SET, *MOPER, *VGUN and whatever *DO loops you need. 

    If you can’t do the modification you need in APDL or APDL Math, then you can use *EXPORT to write the matrices out and use an external tool like matlab or Mathematica to do your manipulation. Of course you then use *DMAT with an IMPORT argument to read the modified matrix/vector back inside.

    Fifth Step: Use the Matrix

    Now it is finally time to use your matrices/vectors.  The most common use is to bundle it up in a substructure matrix (*EXPORT,,SUB) and use it in a solve.  What is great about this is that you can also (I know, we don’t want to use the N-word) save the file as a NASTRAN substructure and give it to that annoying DMAP guru who insists that NASTRAN is the only structural analysis code in the world.  He gets his file, and you get to use ANSYS.

    You can also solve using APDL Math.  This can require multiple steps depending on what you want to do. A typical solve involves using the *LSENGINE command to define how you want to solve, then factor your matrix with *LSFACTOR, then solve with *LSBAK.

    There are also ways to continue a solve in ANSYS after changing the EMAT file.  Unfortunately my plans to do an example of this have been thwarted and ANSYS did not provide one, so I’m not 100% sure on the steps required.  But a LSSOLVE that does not force ANSYS to recreate the matrices should work.  Maybe a topic for a future posting. 

    Other Stuff to Know About

    There is a lot more too this, and the help is where you can learn more.  But a few things everyone needs to be ware of are listed here.

    DOF Order

    A key area where people have problems is understanding how the DOF’s in your matrix or vector are ordered. This is because ANSYS reorders things for efficiency of memory and solve.  The nice thing is that ANSYS stores a map in the full file that you can use to convert back and forth using the *MULT command. 

    Please read section 4.4 ( // ANSYS Parametric Design Language Guide // 4. APDL Math // 4.4. Degree of Freedom Ordering) in the manual. They have a great description and some examples.

    Just remember to remember to deal with DOF ordering.

    Limitations

    This is still a new tool set and as users apply it to real world problems, they are adding functionality.  Right now there are some limitations. 

    • The biggest is that that all of this works on linear matrices.  So you have to be working on a linear problem. Material or geometric non-linarites just don’t work.  This makes perfect sense but may be one of those things some users might not figure out till they have invested some serious time.
    • You can not modify a sparse matrix in APDL Math.  You have to write it out using *EXPORT, modify it with something like matlab, then read it back in with *SMAT.
    • *MULT can not be used to multiply two sparse matrices. One or both must be dense.  the result is always dense.
    • The BCS, DSS and DSP solves only work with sparse matrices. Only the LAPACK solver works for a dense matrix.

    imageReal and Imaginary

    Most of the features in APDL math work with matrices that have imaginary terms in them. Be careful and read the help if you are using complex math, it can get tricky.  Especially read 4.3 on how to specify a position in a matrix for real or imaginary numbers.

    Examples

    There are not a lot out there.  The manual has some in section 4.7.  Take a look at these before you do anything. If you can not find a specific example, contact your technical support provider and see if they have one, or if they can ask development for one.

    Give it a Shot, and Share

    This is a new feature, and a power user feature.  So what is happening is some very smart people are doing some very cool things with it, and not sharing.  It is very important that you share your effort with your Channel Partner or ANSYS, Inc so that they can not only see how people use this tool, but also modify the tool to do even more cool things. 

    It would also be cool if you posted what you do on XANSYS for the masses to see.  Very cool.

    Dean Kamen Visits Phoenix

    Dean-Kamen-ASU-2012-02-22Inventor of medical devices, the man behind the Segway, and FIRST backer Dean Kamenvisited the Phoenix area yesterday and today and we were lucky enough to have people from PADT invited to two different events at which he spoke.  For engineers involved in product development, this is like a visit from an NFL quarterback for most people.  He turned out to be open, engaging, and a very good speaker. 

    We could go on in adoration and explore the guilt and envy we feel after seeing all that he has done.  Instead we thought we would highlight two things we learned from his visit:

    1. The FIRST program that he started and still heads is making a huge difference in this country and around the world.  PADT has been peripherally involved, focusing instead more on the underwater robot scholastic competitions that are very popular here in Phoenix.  But FIRST is now huge, and is still growing.  But what we learned is the positive impact it is having: Students who participate in FIRST are 3 times more likely to become engineers, 30% more likely to attend college, and twice as likely to volunteer in their communities. Those are some positive numbers.  Those of us in the engineering world should take advantage of that and support FIRST.

                                                                        http://www.usfirst.org/

    2. Second, he offered a unique perspective on how engineers see the world.  When he was young he heard the story of David and Goliath.   Most people see a religious message in this story, there are various interpretations. But as a child, Dean Kamen did not see those messages.  What he saw was that David won because he had better technology. He had a sling shot.  That is how he beat the giant.  I found that a very interesting point of view. If you don’t get it, ask an engineer.

    If you ever have the chance to explore what his company, DEKA, is currently doing with a revolutionary power generation and water purification solution for areas of the globe without power or clean water, do so.  It is very leading edge stirling engine and distillation technology

    ANSYS Training Face to Face

    This weeks Focus posting is not going to be very technical. In fact, it is a bit of an editorial.

    Over the past five years or so we have seen a lot of companies who use ANSYS, Inc products move away from traditional face-to-face training with instructors in a classroom.  There are a lot of reasons for this.  The two most common are that 1) the company does not have a travel budget and 2) that training labor hours are considered overhead and managers all have very strict overhead restrictions.  On top of these two, many companies are just plain trying to save money on the cost of training or limiting their overall training budgets.

    What we have seen is a larger number of users either trying to train themselves from manuals or downloaded training material, or people trying to do web-based training.  One can certainly learn how to use an FEA or CFD tool this way, but through our tech support we are starting to see the negative side of this shift: users only understand some of the aspects of the tools and do not have a depth of knowledge that goes beyond the basics.  So when they run into a problem that requires a move beyond those basics, or that might require a more nuanced approach, they struggle or they call tech support for on-the-spot training.

    Interaction

    Even though we engineers are not the most social sub-species of humans, we can still heavily benefit from face-to-face interaction during training.  When PADT teaches a training class we find that a small portion of the time is spent lecturing on and doing workshops for the basics.  Most of the time is spent answering questions that occur to students while they take these basics in.  Some are industry or user specific, some delve deeper into the tool than the training material does.  But they all provide an education to the whole class that never occurs otherwise.

    We have taught, and been students in, web based training classes. The interaction is just not the same.  There are not as many questions and the instructor is not able to use body language clues to see if the class is really getting what they are saying.  In fact, we feel this is the biggest issue. When you are on the phone and sharing a screen you can not even tell if the students are listening.  So the instructor pushes on, the students drift further away, and the true benefits of the class are lost.

    Make a Case for Classroom Training

    The point of all of this is that we feel users out there need to make a case for real classroom training.  When your boss says that there is no travel budget, not enough overhead allocation, or just not enough money, argue strongly that the cost differences of online or self training are not that significant when compared to the productivity problem of not having deep, interactive training.  If you are a boss, admit it, you know we are right.  You should fight a bit harder for the budget because in the long run you will save money.

    Another way to look at it is the relative cost of classroom training versus how much you will use the ANSYS tools you are trained on.  Even if we assume that the company you work for kind of sucks and most engineers move out of there in five years, one to three week of training is nothing when compared to five years as a user.  If your productivity is just 5% higher during that time, the savings are significant. 

    Do the full classroom training.  You will not regret it.

    As a full disclosure:
    We are partly motivated to express this opinion by the fact that we make money doing such training classes, but in reality very few of you reading this will do training with us (although you could use us if you wanted to… hint, hint).  Most of you do your training through other Channel Partners or ANSYS, Inc.  So this posting is not entirely self serving.

    About the pictures:
    I find the stock photographs of what are basically models so contrived and stereotypical that they are hilarious.  So I grabbed few of my favorites to share.  I love it when they always have someone crossing their arms, looking thoughtful. 

    Reducing the Size of your RST File–OUTRES is your Friend

    One of the most common questions on XANSYS, and a common tech support question for us is: “Is there any way to make my result file smaller?”  In fact, we just got a support call last week on that very topic.  So we thought it would be a good topic for The Focus, and besides the standard quick answer, we can go a bit deeper and explain why.

    Why so Big?

    The first thing you need to understand is why the result file is so big. One of the fundamental strengths of the ANSYS solver, back to the days when John Swanson and his team were writing the early versions, is that the wealth of information available from an FEA solution is not hidden from the user.  They took that approach that whatever can be calculated will be calculated so the user can get to it without having to solve again.  Most other tools out there do the most common calculations, average them, and then store that in the results file. 

    If you go back to your FEA fundamentals and take a look at our sample 2D mesh, you will quickly get an Idea of what is going on.

    FEA-Mesh-Parts

    When an FEA mesh is solved, the program calculates the Degree of Freedom results (DOF) at each integration point in each element. For most meshes that is at the corner of each element.  This DOF solution is then used to calculate the derived values, usually stress and strain, for each node based upon the solution at the integration points for each element. Then, during post processing, the user decides how they want to average those element

    So the stress in the X direction for Node 2 in our example is different for element 1 and element 2.  Element 1 uses the results it calculated with the elements shape function to get stresses and strains for node 2, and element 2 does the same thing. 

    Now most programs, they average these value at solve time and either store an element average, or a nodal average.  But ANSYS does not.  It stores the values for each node on each element in its results file.

    By default, node 5 in our example will be stored four times in the ANSYS RST file, and each instance will contain 12 result items for a linear run (SX, SY, SXY, S1, S2, S3, SINT, SEQV, EPELX, EPELY, EPELXY, EPELEQV) and even more for 3D, non-linear, and special capability elements.

    And Now if you want, let’s digress into the nitty gritty:

    You can actually see what is in the RST file because ANSYS Mechanical APDL has awesome documentation.  Modern programs don’t even come close to level of detail you can find in the ANSYS MAPDL help.  Go to the Mechanical APDL in the help and them the path:

    // Programmer’s Manual // I. Guide to Interfacing with ANSYS // 1. Format of Binary Data Files // 1.2. Description of the Results File. 

    Look at the file format in section 1.2.3.  Lots of headers and such, but if you take the time to study it you will be able to see how much space each type of thing stored in the result file uses.

    First is stores model information.  Everything that describes the model but the geometry and loads.  If you scroll down to the “Solution data header” (use find to jump there) you have the actual results. This is the big part.

    Scroll down past the constants to the NSL, or the node solution list: 

    C * NSL    dp       1  nnod*Sumdof  The DOF Solution for each node in the nodal coordinate system.

    This says that the size of this record is the number of nodes (nnod) times the number of Degrees of Freedom (Sumdof).  So for a structural solid model with 10,000 nodes and only UX, UY, and UZ DOF’s, it would be 30,000 double precision numbers long.

    After the DOF solutions we have velocity, acceleration, reaction forces, masters, and then boundary conditions and some loads. Even some crack tip info.

    Then comes the big part.  The Element solution information.  Take a look at it. You have miscellaneous data, element forces.  ETABLE type data, etc… Then there is the ENS record, the Element Nodal Component Stresses.  The size is marked as “varies” because there are so many variables that define how big this record is. Read the comments. It is long but goes into explaining the huge amount of information stored here. 

    Study this and you will know more than you ever wanted to about what is in the RST file!.

    Storing all of this information is the safest option. Everything a user might need during post processing is stored so that they do not have to rerun if they realize they need some other bit of information. But, as is usual with MAPDL, the user is given the option to change away from those defaults, and only store what they want. OUTRES really is your friend.

    You Are in Control: OUTRES

    OUTRES is a unique command.  It is cumulative.  Every time you issue a command it adds or removes what you specify from what is stored in the RST file.  The basics of the command are shown in the table below, and more info can be found in the online help.  Use OUTRES, STAT to see what the current state is at any point.  Always start with OUTRES,  ERASE to make sure you have erased any previous settings, including the defaults.  

    Remember that this command affects the current load step. The settings get written to the load step file when you do an LSWRITE.  So if you have multiple load steps and you want the same for each, set it on the first one and it will stay there for all the others.  But if you want to change it for a given load step, you can.

    If you are a GUI person you can access this from four different branches in the menus:

    Main Menu>Preprocessor>Loads>Analysis Type>Sol’n Controls>Basic
    Main Menu>Preprocessor>Loads>Load Step Opts>Output Ctrls>DB/Results File
    Main Menu>Solution>Analysis Type>Sol’n Controls>Basic
    Main Menu>Solution>Load Step Opts>Output Ctrls>DB/Results File

    The first thing to play with on the command is the first argument: Item. 

    The default is to write everything.  What we recommend is that for most runs, using OUTRES, BASIC is good enough.  It tells the program to store displacements, reaction forces, nodal loads, and element stresses. The big thing it skips are the strains. Unless you are looking at strains, why store them.  Same with the MISC values. Most users don’t ever access these. 

    The next thing you can use to reduce file size is to not store the results on every element.  Use the Cname argument to specify a component you want results for.  Maybe you have a huge model but you really care about the stress over time at a few key locations.  So use a node and element components to specify what results you want for which components.  Note, you can’t use ALL, BASIC or RSOL for this option.  You need to specify a specific type of result for each component.  Remember, the command is cumulative so use a series of OUTRES commands to control this.

    OUTRES, Item, Freq, Cname

    ITEM
    Results item for database and file write control:
    ALL — All solution items except SVAR and LOCI. This value is the default.
    CINT — J-integral results.
    ERASE — Resets OUTRES specifications to their default values.
    STAT — Lists the current OUTRES specifications.
    BASIC — Write only NSOL, RSOL, NLOAD, STRS, FGRAD, and FFLUX records to the results file and database.
    NSOL — Nodal DOF solution.
    RSOL— Nodal reaction loads.
    V — Nodal velocity (applicable to structural full transient analysis only(ANTYPE,TRANS)).
    A — Nodal acceleration (applicable to structural full transient analysis only(ANTYPE,TRANS)).
    ESOL— Element solution (includes all items following):
         NLOAD — Element nodal, input constraint, and force
                 loads (also used with the /POST1 commands 
                 PRRFOR, NFORCE, and FSUM to calculate 
                 reaction loads).
        STRS — Element nodal stresses.
        EPEL — Element elastic strains.
        EPTH — Element thermal, initial, and swelling strains.
        EPPL — Element plastic strains.
       
    EPCR — Element creep strains.
        EPDI — Element diffusion strains.
        FGRAD — Element nodal gradients.
        FFLUX — Element nodal fluxes.
        LOCI — Integration point locations.
        SVAR — State variables (used only by USERMAT).
        MISC — Element miscellaneous data
              (SMISC and NMISC items of the ETABLE command).

    Freq
    Specifies how often (that is, at which substeps) to write the specified solution results item. The following values are valid:
     

    Value Description
    n

    Writes the specified results item every nth (and the last) substep of each load step.

    -n

    Writes up to n equally spaced solutions (for automatic loading).

    NONE

    Suppresses writing of the specified results item for all substeps.

    ALL

    Writes the solution of the specified solution results item for every substep. This value is the default for a harmonic analysis (ANTYPE,HARMIC) and for any expansion pass (EXPASS,ON).

    LAST

    Writes the specified solution results item only for the last substep of each load step. This value is the default for a static (ANTYPE,STATIC) or transient (ANTYPE,TRANS) analysis.

    %array%

    Where array is the name of an n x 1 x 1 dimensional array parameter defining n key times, the data for the specified solution results item is written at those key times.
    Key times in the array parameter must appear in ascending order. Values must be greater than or equal to the beginning values of the load step, and less than or equal to the ending time values of the load step.
    For multiple-load-step problems, either change the parameter values to fall between the beginning and ending time values of the load step or erase the current settings and reissue the command with a new array parameter.
    For more information about defining array parameters, see the *DIM command documentation.

    Cname
    The name of the component, created with the CM command, defining the selected set of elements or nodes for which this specification is active. If blank, the set is all entities. A component name is not allowed with the ALL, BASIC, or RSOL items.

     

     

    Use What Works for You

    The help on the OUTRES command has a nice example where the user specifies different solutions for different sub steps. Check it out to get your head around what is happening:  // Command Reference // XVI. O Commands // OUTRES

    Next time you run a small but typical model for you, play with the options.  Most of the time when I have a lot of load steps or a large model, I use the following in my input deck:

    OUTRES,ERASE
    OUTRES,BASIC

    Sometimes I only care about surface stresses so they use (of course last can be replaced with all or any other frequency):

    NSEL,s,ext
    ESLN,S,0
    CM,nxtrnl,node
    CM,extrnl,elem
    OUTRES,erase
    OUTRES,nsol,last,nxtrnl
    OUTRES,strs,last,extrnl
    OUTRES,nload,last,extrnl
    OUTRES,stat

    Use OUTRES on the next couple of runs you do. Try BASIC, try some other things and see if you can save some disk space.

    Bringing the Value of Simulation into Perspective

    Those of us who do simulation for a living spend a lot of time focusing on faster, cheaper, better.  But we rarely deal with the hard, and cold reality that better often means safer.  Please take some time to read the blog entry below from an ANSYS employee who survived and insane crash, because a bunch of nerds at Nissan ran simulations over and over again on his car so that it would protect him.  Warning… may make you mist up a bit.

    http://blog.ansys.com/2012/01/26/nissan-understand-behind-realize-your-product-promise/

    Christmas Right–Left Gift Exchange Story: Film Noir Style

    For our Christmas parties at PADT we generally have over 40 employees so a traditional secret Santa gift exchange takes to long. So a couple of years ago we downloaded a right-left gift exchange story from the internet and it was a big hit. We ran out of stories on the internet, so we started writing our own, usually in some sort of over-the-top style.  This year it was sort of a Film Noir style with a hard boiled detective, a blond bombshell, and a can of Right Guard.  There is a Christmas connection, but you have to read it to get it.

    If you have never played this game before it is simple. Everyone gets their gift and forms a big circle in the middle of the room.  Someone with a strong voice reads the story and every the world LEFT is read, everyone passes the package they have to the left. Every time the world RIGHT is read, everyone passes the package they have to their right.  You should pause a bit at each LEFT/RIGHT to give people a chance to pass.  Using funny voices for the dialog also helps.

    We hope you get as many laughs out of it as we did.

    image


    Jack Hammer sat in his office on the 5th floor of the WRIGHT insurance company building. His RIGHT hand held a cold cup of coffee, and in his LEFT was a RIGHT guard deodorant can. He wore a hat cocked slightly to the LEFT and parted his hair on the RIGHT. Two streams of cheesy Christmas music were coming through his walls, from Doctor LEFTentowskeys office on his RIGHT, and the accountant’s office on his LEFT. He didn’t know the name of the accountant, but he had LEFT Jack a Christmas Card with a picture of reindeer on the LEFT bank of the Siene in Paris, which Jack felt was just not… appropriate.

    Christmas had been a lonely time for Jack ever since his wife Janice had LEFT him RIGHT before Christmas five years ago, waking up one morning and saying “We are not RIGHT for each other” She packed and walked RIGHT out the door.

    As he was remembering this he heard footsteps coming down the hallway from the LEFT, and they stopped RIGHT in front of his door. After a few seconds he heard a rhythmic rapping on his door, three knocks one RIGHT after another, a pause, then three more RIGHT after that. It LEFT him a bit puzzled, but RIGHT now he needed the work and the distraction from his depressing thoughts.

    He said “Come RIGHT In”. The door opened to reveal a stunning blond bombshell. The kind that comes RIGHT out of a pinup calendar. The kind that had come into his office several times in the past and LEFT him heart broken.

    Her ruby red lips parted and she asked, with a slight accent that sounded almost Italian: “You Jack Hammer? My name is Cemento Smerigliatrice. My friend Joey RITEnhaour said you were the RIGHT man for the job?”

    Her voice LEFT him a bit speechless, so he used the act of clearing off the RIGHT side of his desk to find a place to put the RIGHT guard down as an excuse to gain his composure. “I may be the RIGHT guy for the job, but it needs to be the RIGHT job.”

    She walked over to his desk and around the RIGHT side to sit RIGHT there in front of him on the RIGHT corner. She said, leaving no chance LEFT for misinterpretation: “I need you to kill Santa Clause”

    The statement hung there in the air, Jack was LEFT speechless.

    “Why?” he asked

    She pouted those red lips and leaned forward, putting her ample bosom RIGHT in front of his eyes and said: “Last year, that red coated jerk LEFT me coal. I came downstairs and found that he had eaten the cookies and drunk the milk I LEFT him. But hanging there RIGHT over the fireplace was my stocking full of coal. It just is not RIGHT!”

    Jack Hammer was used to trouble, and the part of him that didn’t get LEFT on the battlefields of the Pacific during WWII enjoyed the RIGHT kind of danger. But her whole attitude LEFT him a little nervous. She had LEFT something out that just didn’t seem RIGHT.

    He looked her up and down and stared RIGHT into her eyes, and noticed a small tear streaking down her LEFT cheek. He put his RIGHT and LEFT hand down on the LEFT and RIGHT arms of his chair and slowly pushed himself up until he stood RIGHT next to her. “RIGHT now gorgeous, I don’t care what is RIGHT and what is… not-RIGHT. Life has LEFT a hole RIGHT here in my heart” he lifted her RIGHT hand in his and placed it on the LEFT side of his chest. “It has LEFT me bitter, LEFT me without any hope. LEFT me without a lot of morals.”

    She looked up and smiled an evil smile at him. The kind of smile that LEFT you wondering if you took a wrong turn in a bad part of town… or maybe a RIGHT turn.

    He let go of her hand to reached out and pulled her body RIGHT up against his and whispered in her LEFT ear.

    “Looking at you I’m guessing that if Santa LEFT you coal, you deserved it. He has every RIGHT to leave you coal, because if you check his list you would be in that naughty column on the LEFT side of the sheet. “

    He then spun her around and pushed her RIGHT out the door. “The elevator is on your LEFT sweaty, you can ride it RIGHT down to hell!”

    Jack Hammer sat RIGHT back down in his chair and picked up the RIGHT guard that was sitting RIGHT on his desk. Somehow, the exchange LEFT him feeling good for the first time in a long time.

    Meanwhile, far up RIGHT on top of the World a large man in a red suite set a cup of hot cocoa on the LEFT side of his desk. He crossed out the name of Jack Hammer on the LEFT side of a long list, and wrote it in on the RIGHT side, under the heading of Nice. In a deep rumbly voice he said: “Ho Ho Ho. Every year I am LEFT with no doubt, that RIGHT around the world when people are LEFT with a simple choice, they always do what is… appropriate.

    2011 Is Winding Down–Thank You for a Great Year!

    snow_four_peaksNo great revealing article this week on how to use an obscure ANSYS Mechanical APDL element to model the behavior of fluid flow in plant stems.  No hints on getting images from Workbench that will appease a project engineer so that he will give you one more week to get the dang model to converge.  No description of some great new capability that you can’t live without. 

    This week we just want to take a few minutes of your time to thank each and every one of you who reads PADT’s The Focus for a fantastic year in 2011, to wish those of you with a winter-solstice-positioned-holiday a very happy whatever-that-holiday-is, and to pass along our hopes that 2012 will be a better year than 2011.

    Those of us who are involved in sales, support and services built around ANSYS, Inc’s products have had a great year.  Release 13 has been a very important release that has allowed many of our customers to do their jobs faster and with greater accuracy.  We hope that Santa will reward the busy little ANSYS developers around the world, they deserve it.

    During the year PADT has seen good growth both in new customers who purchase their ANSYS, Inc. tools through us as well as companies that have come to PADT asking us to do simulation or training for them  We have made some new friends along the way and have enjoyed working with those of you who we have known for a while.

    There are 2,334 people who have actually signed up to receive e-mails about The Focus, and a quick look at our Google Analytics data shows that over 83,856 unique page views to www.padtinc.com/blog.  

    If we dig a bit deeper into that data we find some interesting things:

    • The most visited article was the Pretty Plotting article.   Making nice plots does matter!
    • Second was an older article: 10 Things Every Mechanical APLD User Should Know!  That make us old MAPDL users very happy to see. 
    • Third was the article on Mapped Face Meshing.  That one kind of stumped us because it is kind of an obscure power user thing… so I guess that says you are mostly power users, which is cool.
    • If we look at what pages people linger at… we find that the longest view was when someone searched on “Self Penetration” and they looked at that result page for 29 minutes. There are a lot of ways we can go with that one… I’ll just let you guys take it as you want to.
    • 47% of the page views came from Europe, 38% North America, and 11% from Asia.  This international reach is something that we are very proud of.

    Looking Forward

    2012 is shaping up to be a great year.  R14 is out and we are using it, and liking it.  We also expect 14.5 to come out in 2012 so we will have even more new features to use and blog about.  Also, look for PADT to announce a new simulation product that we are going to start selling in 2012 that compliments the ANSYS, Inc. product line and opens up new markets for our sales, services and training .

    The biggest change you should notice in 2012 is a new PADT website.  I know, you all love the ramshackle hodge-podge of pages we have now. (Side note: in a meeting with a potential new customer the current www.PADTINC.com home page was described as being like that one house in the neighborhood where the owner does not trim the weeds, there is an old car out front, a few refrigerators, and a front porch that is falling down.)  This new site should be easier to navigate and much easier on the eyes, but full of the same rich content you have come to know and love.  We will be moving The Focus to a WordPress blog engine (giving up on windows based stuff) and expanding the blog to cover a lot more of what PADT does.  (don’t worry, you can just subscribe to The Focus and avoid articles about Doug Oatis’s latest climbing adventure).

    So to all of you out there:

    Best Holiday Wishes and a Very Happy New Year

    SnowManCFD1

    Found on the Web: Nice Video on converting MAPDL Material Properties to Engineering Data Properties

    While in San Diego this week to teach a training class, PADT’s Jason Krantz did what most PADT engineers do when they have an evening in a new, exciting city – he spent the night searching the internet for useful ANSYS knowledge.  OK, maybe not.  But he did stumble on something worth sharing.

    Sheldon Imaoka published a very useful ScreenCast on how to use Workbench systems to get ANSYS Mechanical APDL material properties into engineering data without having to write a translator from APDL to XML or typing the values into the Engineering Data interface.  Take a look:

     

    We also highly recomend you visit Sheldon’t web site, ansys.net, for tons more useful info.  You can also find articles published by Sheldon in the official ANSYS blog.

     

    Manipulating Text Strings in ANSYS Mechanical APDL

    The world is all gates, all opportunities, strings of tension waiting to be struck. – Ralph Waldo Emerson

    The ANSYS Parametric Design Language has a lot of features in it.  Over the years it has grown to meet the needs of a growing population of users and has gone from a simple command scrip to a fairly sophisticated programming tool.  One area of the tool that power users find significant value is are the functions that are used to manipulate text strings.  You can use these functions to do all sorts of things that are needed to automate a process or produce more informative results.  Some examples are:

    • Gather information about your model and create a screen for display on a plot or in a report
    • Get information about files and directories and use that to manage, create, delete, etc…, those files.
    • Build commands up so APDL can write APDL or input to other programs
    • Create or modify parameter names for use in your macros

    In this article we will look at strings in APDL and how to work with them.  You can find additional, more detailed information in the ANSYS Help, Mechanical APDL>ANSYS Parametric Deign Language Guide.  There is also more information on this topic and all things APDL in PADT’s Guide to the ANSYS Parametric Design Language (APDL).

    Strings in ANSYS Mechanical APDL

    Pull the string, and it will follow wherever you wish. Push it, and it will go nowhere at all. – Dwight D Eisenhower

    Before we talk about manipulating strings, we should do some background on strings. 

    Strings can either be stored as a character parameter or as a string array. Character parameters are nice because they don’t require indices when you use them, and you don’t have to define them with a *dim. The down side is that you are limited to 8 characters.

    You create a string parameter by using the parameter = method:

    myChr = ‘yeehah’

    To be more robust and avoid size issues, you should use a string array, which you create with a *dim command:

    *DIM,myString,STRING,80

    This would create a text string called myString that is 80 characters long.  And you would do this if you are going to use a function to fill it.  Once you create a string you refer to it with its name and an index for the start of the string.

    /title, Working on Model %myString(1)%

    For a character parameter, you don’t need the index:

    /title,Working on Model %myChr%

    Stuff you should know about strings in APDL:

    • You define the value of a string by putting the text in single quotes ‘string’
    • The longest string you can have is 256 character – but don’t worry, you can string strings together.
    • String arrays can be two dimensional, so if you have a bunch of text you want to keep together you can do that fairly easily.  You do have to use *dim if you do this:
      • *dim,comp,string,80,  3       [Fixed on 11/19/14 ]
        comp(1,1) = ‘leftSide’
        comp(1,2)=’rightside’
        comp(1,3)=’topside’
        *do,I,1,3
              cmsel,a,%comp(1,i)%
        *enddo
    • You can make an array of type Char as well. This is basically a list of several character parameters.
    • To look at what is in your array/parameter, use *stat.

    String Functions

    Money is the string with which a sardonic destiny directs the motions of its puppets. – W. Sumerset Maugham

    Now on to the fun stuff!

    Once you have a string you can manipulate it using the string functions.  We will look at each group.

    Strings to and from Numbers

    Sometimes you have a number as a string and you need it as a number, or you need to convert a number into a string.  Those numbers can be decimal or Octal or Hex.  This Table shows the functions for going back and forth.

    Function

    Description

    VALCHR(string) Converts a string that contains a valid  decimal or integer number as text into a double precision parameter
    VALOCT(string) Converts a string that contains a valid  Octal number as text into a double precision parameter
    VALHEX(string) Converts a string that contains a valid  Hexadecimal number as text into a double precision parameter
    CHRVAL(num) Converts a decimal number into a text string
    CHROCT(num) Converts a number into a text string octal number
    CHRHEX(num) Converts a number into a text string hexahedral number

    The most commonly used function in this group is CHARVAL() to truncate the number of decimals in a number.

    Standard String Functions

    If you have every programed in FORTRAN, C or any other “old school” language you are familiar with the standard set of commands that are used to manipulate strings. APDL supports most of them:

    Function

    Description

    STRSUB(Str1,nLoc,nChar) Returns a substring of the characters in Str1.  Returns characters number nLoc to nLoc+nChar as a string.
    STRCAT(Str1,Str2) Concatenates Str2 onto the end of Str1. Returns a string.
    STRFILL(Str1,Str2,nLoc) Fill in Str1 with Str2 starting at character number nLoc in Str1. Returns a string.
    STRCOMP(Str1) Compress Str1 by removing all the spaces in Str1. Returns a string.
    STRLEFT(Str1) Left justify Str1 by removing all leading spaces from Str1. Returns a string.
    STRPOS(Str1,Str2) Returns the position in Str1 where Str2 can be found.  If it is not found, it returns 0.  Returns a number.
    STRLENG(Str1) Returns the length of Str1, excluding training spaces. Returns a number.
    UPCASE(Str1) Converts all the characters in Str1 to Upper Case. Returns a string.
    LWCASE(Str1) Converts all the characters in Str1 to Lower Case. Returns a string.

    These are fairly standard and work as you would expect. 

    File Name Functions

    The last two functions are there for you to work with file names and directories.  There are three parts to a path name in ANSYS MAPDL:  the directory where the file is (directory), the portion of the filename before the period (filename) and the part after the period (ext).  The first function allow you to build a complete string that specifies a file and the second takes a complete path and divides it into its pieces.

    Function

    Description

    JOIN(directory,filename,extension) Creates a path string in the current OS (forward vs. backward slashes) from the supplied directory, filename, and extension.  Directory is optional.
    Split(Path,Option) Takes a full pathname in the current OS and splits it up into pieces. Option can be:
       DIR = give just the directory
       FILE = Give the filename and extension
       Name = just the filename, the part before the period
       EXT = give the extension, the part after the period.

    Using Strings in APDL

    There is geometry in the humming of the strings, there is music in the spacing of the spheres. – Pythagoras

    The examples above sort of hint at how to use strings in APDL but it is probably a good idea to explicitly talk about it.  You can use strings in commands in clever ways, some commands use strings as arguments, and you can write strings to files.

    String Substitution in a Command

    This is the most common usage and the most powerfully.  Any CHAR or STRING parameter can be put into any APDL command by simply putting it inside percent signs:  %myString%  

    So you can do something like:

    /title, Results for Substep %isbstp%.  Freq = %frq%

    Some people get very sophisticated with this and build their own commands this way.  Do note that this substitution also works for numbers.  cmsel,s,ncmp%i%  where i = 32 will look to the program like cmsel,s,ncmp32.

    Strings as Arguments

    This is fairly straightforward, if a command is looking for a string, give it a string.  There are not too many commands that take strings as arguments but there are a few.

    Writing Strings to Files

    There are three basic ways to write to a file in APDL:  *create, *cwrite, and *vwrite.  We are not going to get into there use here, but check out the usage of each in detail in the help.

    Conclusions

    There are strings in the human heart that had better not be vibrated. – Charles Dickens

    This has been a very brief overview of a powerful tool in ANSYS Mechanical APDL. Take a look at the help and other resources (xansys.org, ansys.net) to learn more and just start using it.  Fun stuff.

    Post Processing FEA Results in ANSYS CFD Post

    The other day there was a thread on XANSYS about the best way to create animations in ANSYS Mechanical APDL (MAPDL).  If you are an MAPDL user you know that the animation tools found there were actually way ahead of their time… in 2001.  Now they are a bit limited and the AVI file it creates uses a codec that are a bit old.  You can write a macro that creates PNG files that you can then string together into an AVI, WMV, MOOV or animated gif file.  Check out the thread (go to XANSYS and search on animation) and you can see some of the options suggested.

    As I was reading the thread I remembered that one of the CFD guys from ANSYS, Inc. once asked if we used CFX Post to post process our FEA results.  I of course pretended that I knew all about it and “just didn’t have time to play with it yet.”  The next time I had time at my desk I looked it up and there it was, under File->Load Results you can set the “Files of Type” drop down to read a whole slew of ANSYS Mechanical and MAPDL files:

    cap3

    I then promptly forgot about it till I was reading the thread.  So, I figure the best way to remember is to store it for posterity bouncing through the tubes of the interweb  as a blog posting.

    ANSYS CFD Post

    CFX Post has been generalized and renamed as CFD Post. As a long time ANSYS MAPDL bigot I have to say, and this is a very difficult admission, CFD Post is a a very nice post processor.  Maybe I think like a Torontonian or something, but no matter how long it has been since I’ve used it, I can jump right in and figure out what needs to be done.

    It is a CFD post processor and you can use it to post CFX, FLUENT, FIDAP, TASKFLOW and the general CGNS files that most CFD tools create.  So the terminology is definitely oriented towards CFD users.  But because CFX supports moving meshes and conjugate heat transfer, it has most things that you need to read and post process an FEA result.  It is also scriptable and can be run in batch for process automation.

    To access it you will need to have a license for one of ANSYS, Inc’s CFD tools. (this may be the justification for you to upgrade to a Multiphysics seat…)

    If you are not familiar with the tool I recommend that you go into help and find the CFD-Post manual.  Inside you will find a great user guide, but more importantly there are a set of thorough tutorials. The Mixing Elbow example will teach you the basics you need to know to find your way around the interface.

    Before we get into the details, it should be pointed out that you are not going to find some huge, awesome, fantastic feature in CFD Post that is not in ANSYS Mechanical.  It does pretty much the same things, just a little differently.  I find it a bit more intuitive and there are some key things it does better as well as some things that it only does.  What we recommend it for:

    • Fancy animations
    • Higher quality graphics
    • The ability to share a 3D results files that can be viewed with a free viewer
    • Batch post processing
    • Comparing multiple results

    The Key Things to Know

    Most things you want to do in CFD Post occur in the tree to the left of the view window.  It has multiple tabs but you will be using the Outline tab most of the time unless you are doing expressions and stuff (like *get’s in MAPDL, we will leave those as an exercise for the user).  Once you load a result you will see four top level folders:  Cases, User Locations and Plots, Report and Display Properties & Defaults:

    cap2

    The file you read in is shown in cases.  The external surface of your model is grouped as the Default Boundary.  You can pretty much ignore Report and Display Properties and Defaults unless you want to get fancy or for some reason you really hate the almost identical report generator in ANSYS Mechanical.

    This leaves the User Locations and Plots. This is where you specify what you want to see and how you want to see it.

    The most common thing to do is RMB on User Locations and Plots and insert a Contour Plot.  When you do so you get “Details” dialog below your tree that has all the options. To see the details on an existing menu item double-click on it or RMG->Edit:

    cap4

    Most of the options you need are in the first tab, Geometry.  The key option is the Variable. This is the result value you want to display.  The list is limited compared to MAPDL but has all of the values that are explicitly stored in the *.RST file.  You will want to set Range to local (min and max from the domain you have selected).  You can also add or delete contours with # of Contours.  I set this to 256 to get a smooth contour.

    At the bottom of the Detail there is an apply button, use this to update your plot as you play with the various options.

    By default the contour plot shows color bands and lines between color bands, called Isopleths in most programs. CFD Post calls them Contour lines. If you want them off, go to the Render tab and uncheck Show Contour Lines.  If you just want the lines and no color bands, then check Show Contour Lines and uncheck Show Contour Bands.  Below are some plots with the options used to create them.  Any values not specified were at their default value.

     

    p2

    • Tree:
      • Default Boundary – Off
      • Contour 1 – On
      • Default Legend View 1 – On
      • Wireframe – On
    • Detail – Geometry:
      • Domains –  All Domains
      • Locations – Default Boundary
      • Variable – Total Mesh Displacement
      • Range – Local
      • # of Contours – 11
    • Detail – Render
      • Show Contour Bands – On
      • Show Contour Lines – On
      • Line Width – 1
      • Constant Coloring – Off

    p2b

    • Tree:
      • Default Boundary – Off
      • Contour 1 – On
      • Default Legend View 1 – On
      • Wireframe – On
    • Detail – Geometry:
      • Domains –  All Domains
      • Locations – Default Boundary
      • Variable – Total Mesh Displacement
      • Range – Local
      • # of Contours – 256
    • Detail – Render
      • Show Contour Bands – On
      • Show Contour Lines – OFF

    p3

    • Tree:
      • Default Boundary – On
      • Contour 1 – On
      • Default Legend View 1 – On
      • Wireframe – On
    • Detail – Geometry:
      • Domains –  All Domains
      • Locations – Default Boundary
      • Variable – Total Mesh Displacement
      • Range – Local
      • # of Contours – 10
    • Detail – Render
      • Show Contour Bands – OFF
      • Show Contour Lines – On
      • Line Width – 5

    Every once in a while you need a black and white contour plot with isopleths.  You can do that in CFD Post very easily with contour options and by going into the Cases part of the tree and editing the Default Boundary options.  On the render tab, set the color to 0 and uncheck the Lighting.   Make sure that the Default Boundary is checked so it shows up.  Now go to the Contour and:

    • Adjust the number of contours to a reasonable number (10 is good)
    • Under the Labels tab check Show Numbers
    • Under the Render tab:
      • Uncheck Show Contour Bands
      • Check Show Contour Lines
      • Set line width to a larger number, 2 to 5 should work depending on your geometry
      • Check Constant Coloring
      • Make sure Color Mode is at Default
    • When you save your plot, set background to White (see below)

    p4

    I could fill up another 20 screens with all the options available.  Just get in there and play with it.

    Making Images, Including 3D

    The best way to get images out of CFD Post is to click the camera icon on the top toolbar, go to File->Save Picture… or use CTRL-P.

    cap5

    I like the PNG format, accurate but compressed well.  For higher quality you can set the resolution here as well.  I also like to check the White Background so it is easy to delete the background to make transparent images.

    But note the variety of options that you have.  For very high quality images you can use the PostScript option. This gives you a vector file rather than a raster file, so you can scale it as big as you want.  We recommend this if you are making posters or something like that.  The trick is that you need to turn off the legend, the triad, the scale and everything else except for your model. Then save to PostScript and bring it in to something Like Adobe Illustrator:

    cap6

    There are also two options in there for 3D “images.”  These are files that you can save and give to people to look at with free viewers.  Spin them around and such.  VRML is an older standard.

    Update 9/21/2016: Well, it looks like all of the viewers that were referenced in this original article are pretty much no longer supported. The good news is that two opensource tools that work with tesselated geometry that read VRML:

    • Meshlab is a big powerful sledge hammer of a tool that is for editing and viewing tesselated geometry.  It can be found at: meshlab.sourceforge.net/
    • Paraview is more a viewer, and is much more user friendly.  it can be found at: www.paraview.org/download/

    The other option is the CFD Viewer.  This is a free viewer that you can get from the ANSYS website.  We strongly recommend this as a way to get complex results, CFD or FEA to managers and customers if 2D static plots are just not good enough. The application is very fast and lightweight and easy enough to use for a manger!

    Here is a video of using the CFD Viewer:

    Multiple Result Steps

    If your result file has multiple result sets in it, maybe it is a transient run or has multiple load steps, you can access those results by clicking on the little Clock icon at the top of the CFD Post window:

    cap1

    You get a dialog that shows each of the steps in your *.RST along with times.  To look at a specific result, click on it and hit apply.

    cap7

    I have not found a way for this to work with modal results yet…  For now you need to use a macro to split your modes into separate RST files.

    Animation

    One of the key reasons to use CFD Post for an FEA model is to get keyframe animations.  Clinton wrote a great article on how to use this great feature a while back.   It doesn’t really do the type of 0 to result animation that we do in the FEA world (like say a mode shape animation)  What it is good at is transients.

    It has lots of nice options to make a high quality file.  It also has the ability to animate the motion of the camera, which may be nice to have.  Also, if you are animating a contour plot you want to enable global ranges on your contour. To do this read the section on global variables in the “Things to Know” section below.

    The defaults make an OK animation. To get a good animation you need to click on the Options button and then make sure that “White Background” is checked (or you will get JPEG’y distortion) and on the Advanced tab set Quality to High.  Last, check Don’t Encode Last MPEG frame so you can loop.

    I’ve included a couple of animations I did with it here:

    Basic plot:

    Simple2

    Fancy with camera moving.  Note that when converting to GIF you loose colors (GIF is only 256 colors).  The AVI looks much nicer.

    Fancy1

     

    A Valve fly through. I put this one on YouTube:

    Here is the animated gif:

    ValveFly

    Comparing Cases

    One of the very cool capabilities is the Compare Case function.  To use this you go to Tools->Compare Cases.  Pick two cases. That can be two files or two steps in the same file.

    cap8

    For our simple little example, you can see how it shows the results for case 1 and case 2 at the top, then the difference between the two at the bottom.  It works best if the mesh is the same but it will work with different meshes as long as the geometry is very close.

    This is probably the most useful thing you can do in CFD Post that is not easy to do in ANSYS Mechanical.

    Other Things to Know

    There are some limitations.  Take a look at the help for CFD Post in section 8.14.5.1

    Setting units is hidden a bit.  Go to Edit->Options->Units and set them to what you want.

    If you want a deformed shape on your plot, you access that by RMB’ing on the graphics window, but not on your part.  Then choose Deformation and then the level you want. Auto usually works best.

    By default CFD Post does not know the min and max values in your result file. So if you read in a file and plot it the default contour is global and it will not be right.  You need to change the Range to local or, if you want to be able to have a global contour, you need to tell CFD Post to figure out min and max values.  You will need to do this for Animations on transient runs.  To do it go to Edit->Options->CFD-Post->Files and check “Pre-calculate global variables ranges”

    How To Post Process ANSYS FEA Results in ANSYS CFD

    The other day there was a thread on XANSYS about the best way to create animations in ANSYS Mechanical APDL (MAPDL).  If you are an MAPDL user you know that the animation tools found there were actually way ahead of their time… in 2001.  Now they are a bit limited and the AVI file it creates uses a codec that are a bit old.  You can write a macro that creates PNG files that you can then string together into an AVI, WMV, MOOV or animated gif file.  Check out the thread (go to XANSYS and search on animation) and you can see some of the options suggested.

    As I was reading the thread I remembered that one of the CFD guys from ANSYS, Inc. once asked if we used CFX Post to post process our FEA results.  I of course pretended that I knew all about it and “just didn’t have time to play with it yet.”  The next time I had time at my desk I looked it up and there it was, under File->Load Results you can set the “Files of Type” drop down to read a whole slew of ANSYS Mechanical and MAPDL files:

     

    I then promptly forgot about it till I was reading the thread.  So, I figure the best way to remember is to store it for posterity bouncing through the tubes of the interweb  as a blog posting.

    ANSYS CFD Post

    CFX Post has been generalized and renamed as CFD Post. As a long time ANSYS MAPDL bigot I have to say, and this is a very difficult admission, CFD Post is a a very nice post processor.  Maybe I think like a Torontonian or something, but no matter how long it has been since I’ve used it, I can jump right in and figure out what needs to be done. 

    It is a CFD post processor and you can use it to post CFX, FLUENT, FIDAP, TASKFLOW and the general CGNS files that most CFD tools create.  So the terminology is defiantly oriented towards CFD users.  But because CFX supports moving meshes and conjugate heat transfer, it has most things that you need to read and post process an FEA result.  It is also scriptable and can be run in batch for process automation.

    If you are not familiar with the tool I recommend that you go into help and find the CFD-Post manual.  Inside you will find a great user guide, but more importantly there are a set of thorough tutorials. The Mixing Elbow example will teach you the basics you need to know to find your way around the interface.

    Before we get into the details, it should be pointed out that you are not going to find some huge, awesome, fantastic feature in CFD Post that is not in ANSYS Mechanical.  It does pretty much the same things, just a little differently.  I find it a bit more intuitive and there are some key things it does better as well as some things that it only does.  What we recommend it for is fancy animations, higher quality graphics, batch post processing, and comparing multiple results in one run.

    The Key Things to Know

    Most things you want to do in CFD Post occur in the tree to the left of the view window.  It has multiple tabs but you will be using the Outline tab most of the time unless you are doing expressions and stuff (like *get’s in MAPDL, we will leave those as an exercise for the user).  Once you load a result you will see four top level folders:  Cases, User Locations and Plots, Report and Display Properties & Defaults:

     

    The file you read in is shown in cases.  The external surface of your model is grouped as the Default Boundary.  You can pretty much ignore Report and Display Properties and Defaults unless you want to get fancy or for some reason you really hate the almost identical report generator in ANSYS Mechanical.

    This leaves the User Locations and Plots. This is where you specify what you want to see and how you want to see it. 

    The most common thing to do is RMB on User Locations and Plots and insert a Contour Plot.  When you do so you get “Details” dialog below your tree that has all the options. To see the details on an existing menu item double-click on it or RMG->Edit:

     

    Most of the options you need are in the first tab, Geometry.  The key option is the Variable. This is the result value you want to display.  The list is limited compared to MAPDL but has all of the values that are explicitly stored in the *.RST file.  You will want to set Range to local (min and max from the domain you have selected).  You can also add or delete contours with # of Contours.  I set this to 256 to get a smooth contour.

    At the bottom of the Detail there is an apply button, use this to update your plot as you play with the various options.

    By default the contour plot shows color bands and lines between color bands, called Isopleths in most programs. CFD Post calls them Contour lines. If you want them off, go to the Render tab and uncheck Show Contour Lines.  If you just want the lines and no color bands, then check Show Contour Lines and uncheck Show Contour Bands.  Below are some plots with the options used to create them.  Any values not specified were at their default value:

     

    • Tree:
      • Default Boundary – Off
      • Contour 1 – On
      • Default Legend View 1 – On
      • Wireframe – On
    • Detail – Geometry:
      • Domains –  All Domains
      • Locations – Default Boundary
      • Variable – Total Mesh Displacement
      • Range – Local
      • # of Contours – 11
    • Detail – Render
      • Show Contour Bands – On
      • Show Contour Lines – On
      • Line Width – 1
      • Constant Coloring – Off

     

    • Tree:
      • Default Boundary – Off
      • Contour 1 – On
      • Default Legend View 1 – On
      • Wireframe – On
    • Detail – Geometry:
      • Domains –  All Domains
      • Locations – Default Boundary
      • Variable – Total Mesh Displacement
      • Range – Local
      • # of Contours – 256
    • Detail – Render
      • Show Contour Bands – On
      • Show Contour Lines – OFF

     

    • Tree:
      • Default Boundary – On
      • Contour 1 – On
      • Default Legend View 1 – On
      • Wireframe – On
    • Detail – Geometry:
      • Domains –  All Domains
      • Locations – Default Boundary
      • Variable – Total Mesh Displacement
      • Range – Local
      • # of Contours – 10
    • Detail – Render
      • Show Contour Bands – OFF
      • Show Contour Lines – On
      • Line Width – 5

    Every once in a while you need a black and white contour plot with isopleths.  You can do that in CFD Post very easily with contour options and by going into the Cases part of the tree and editing the Default Boundary options.  On the render tab, set the color to 0.   Make sure that the Default Boundary is checked so it shows up.  Now go to the Contour and:

    • Adjust the number of contours to a reasonable number (10 is good)
    • Under the Labels tab check Show Numbers
    • Under the Render tab:
      • Uncheck Show Contour Bands
      • Check Show Contour Lines
      • Set line width to a larger number, 2 to 5 should work depending on your geometry
      • Check Constant Coloring
      • Make sure Color Mode is at Default

     

    I could fill up another 20 screens with all the options available.  Just get in there and play with it.

     

    Multiple Result Steps

    If your result file has multiple result sets in it, maybe it is a transient run or has multiple load steps, you can access those results by clicking on the little Clock icon at the top of the CFD Post window:

     

    You get a dialog that shows each of the steps in your *.RST along with times.  To look at a specific result, click on it and hit apply.

     

    I have not found a way for this to work with modal results yet…  For now you need to use a macro to split your modes into separate RST files.

    Animation

    One of the key reasons to use CFD Post for an FEA model is to get keyframe animations.  Clinton wrote a great article on how to use this great feature a while back.   It doesn’t really do the type of 0 to result animation that we do in the FEA world (like say a mode shape animation)  What it is good at is transients.

    It has lots of nice options to make a high quality file.  It also has the ability to animate the motion of the camera, which may be nice to have.  Also, if you are animating a contour plot you want to enable global ranges on your contour. To do this read the section on global variables in the “Things to Know” section below.

    The defaults make an OK animation. To get a good animation you need to click on the Options button and then make sure that “White Background” is checked (or you will get JPEG’y distortion) and on the Advanced tab set Quality to High.  Last, check Don’t Encode Last MPEG frame so you can loop.

    I’ve included a couple of animations I did with it here:

    Basic plot:

     

    Fancy with camera moving.  Note that when converting to GIF you loose colors (GIF is only 256 colors).  The AVI looks much nicer.

     

     

    A Valve fly through. I put this one on YouTube:

    http://www.youtube.com/user/padtinc#p/u/6/0Tg0caQThaA

    Here is the animated gif:

     

    Things to Know

    There are some limitations.  Take a look at the help for CFD Post in section 8.14.5.1

    Setting units is hidden a bit.  Go to Edit->Options->Units and set them to what you want.

    If you want a deformed shape on your plot, you access that by RMB’ing on the graphics window, but not on your part.  Then choose Deformation and then the level you want. Auto usually works best.

    Files for ANSYS Webinar on External Connections

    Here are the files for the webinar on External Connection from 10/14/2011.

    Example XML File: sampleconfig2.xml

    Example Python Script:  costcalc.py

    Sample Input File: costcalc.inp

    PDF Of PowerPoint: External_Connections_2011_10_14.pdf

    You can find a recording of this webinar and all others at: padtincevents.webex.com