Named Selections + Object Generator = Awesome

Guess who’s back…back again.  Yes, just like Slim Shady, I’m back (returned to PADT and writing Focus blogs).

So run and go tell your friends that horrible pop cultural references have returned to ANSYS blog posts.  It’s been too long.

Getting back on track, the object generator debuted in R14.5 Mechanical.  You can access this feature in the toolbar (image below taken from R15):

How the pro's generate objects

What exactly does the object generator do?  Simple answer…it makes your life better.  It uses named selections and a single instance of an object (joint, spring, bolt pretension, etc) and replicates it across all entities in the named selection.  Let’s play around with this feature on the following (dummy) assembly:


Above is a t-pipe with three covers, one of them has bolt ‘bodies’ modeled.  We’ll use fixed-fixed joints to connect the two ‘bolt-less’ bodies together, and then define bolt preloads on the bolt pattern.  To get started, we need to build up the named selections. 

I’m planning on defining the fixed-fixed joint between the two cylindrical surfaces:


This is a pretty simple assembly, and I could easily just manually select them all, right-mouse-click, and generate the named selection.  In the real world, things aren’t always so easy, so we’ll get a little fancy.  First, create a named selection of the bodies that contain faces we want to joint together:


I’ve created two named selections, called ‘joint_cover’ and ‘joint_pipe’ and utilized the ‘random colors’ option to display them in different colors.  Next, I insert a named selection but set the scoping method to be ‘by worksheet’:


I’ll then use selection logic (MAPDL hipsters will recognize the logic as the xSEL commands):


Now, order is important here, as the selection logic ‘flows’ from top to bottom.  First, this named selection selects the bodies contained in the existing named selection ‘joint_cover’ (note:  this object MUST exist above the worksheet-created named selection in the tree).  At this point in time, we have two bodies selected.  Next, it converts my body selection to faces belonging to those bodies.  Finally, it filters out any face that has a radius less than .05m (units are set by the ‘units’ drop-down menu, values entered in worksheet scale when units are changed).  Hit ‘generate’ and you get the following:


You may need to switch to the ‘graphics’ tab (circled in red in the above image).  This is great, we now have all of our faces highlighted.  Next, we need to reproduce this behavior on the pipe.  Rather than redo all of this work, just right-mouse-click on our new named selection and select ‘duplicate’. 

image image

Select the duplicated named selection, and edit the first line to use a different named selection.  Hit generate:


Perfect.  We can go back and add/remove bodies to the existing named selections and re-generate the named selections to have it automatically re-create these named selections. 

Next, we’ll create the original ‘joint’ we want to re-create across the two flanges. 


After making the joint, make note of which part is the ‘reference’ and ‘mobile’.  For the image above, the cover is the ‘reference’ while the pipe is the ‘mobile’.  Highlight this joint and select the object generator:


If we use the object generator on a joint, it will ask us to define the named selections that contain the reference and mobile faces.  From above, we know that the cover faces are contained in the ‘cover_faces’ named selection.  We then duplicated that and swapped the body selection, meaning the faces for the pipe are contained in ‘cover_faces 2’ (I’m lazy and didn’t rename it…sorry).  Next, we define the minimum distance between centroids.  This acts as a filter for re-creating each joint.  What happens when we hit ‘generate’ is it looks at the distance between the centroids of each face in the two named selections.  If it finds ‘matching’ faces within that distance it creates the joint. 


In the image above, if I use a distance equal to the red line, I will get incorrect joints defined.  I’ll get the following (a=cover, b=pipe): 1a-1b, 1a-2b, 2a-2b, 2a-1b…

What I need to do is limit the distance to the blue line, which is big enough to find the correct pairs but filter out the wrong ones.  To figure out a proper distance, you can use the ‘selection information’ window to figure out the centroid information:


Once you’re set, hit ‘generate’:


What a time to be alive!  It’s always a good idea to go through joint-by-joint to make sure everything is correct…or you can always just count the number of joints created and confirm that the number is correct (I have 15 total faces in the cover_faces named selection…so I should have 15 joints…and I do).

Next, let’s look at the bolt pretension definition.  We start with a named selection of the face where the bolt pretension will be applied:


Next, we create our original bolt pretension load:


I’ve setup my bolt pretension to solve for a 100N axial load in load step 1 and then lock the solved-for relative displacement in for load step 2.  We select the bolt pretension in the tree, then select the object generator:


Select the named selection that contains the bolt faces, and hit generate:


This is incredibly useful for bolt pretension for two reasons.  The first reason is obvious…it significantly cuts down on the amount of work you need to do for large bolt patterns.  The second reason…you can only make changes to bolt pretension objects one at a time.  By that, I mean you cannot multi-select all your bolt pretensions and change the load and step behavior (e.g. change load to 200N, open in load step 2, etc). 


If you select all the bolt pretensions, the changes you make in the tabular data window are only applied to the first selected object.  All other bolt pretensions are kept the same.  So if you suddenly realize the pretension was setup incorrectly, it’s best to delete all but one of the pretension object, make the necessary changes, then duplicate it.  That way you can be sure all the bolt pretensions are correct (unless you’re simulating a bolt opening up…then ignore). 

One very important thing to note is that the object generator is not parametrically linked to anything.  If I go back and change the number of holes/bolts/etc in my model, I may need to re-generate the duplicated joints/bolts/etc.  The named selections should update just fine, assuming you didn’t open the hole up bigger than the selection tolerance.  I would recommend deleting all but the original joint/bolt pretension and just re-create everything after the CAD update (this may actually speed up the CAD transfer as it’s not trying to link up incorrect entity IDs).

Hopefully this will save you some time/frustration in your next analysis.  The documentation in R15 can be accessed here:  help/wb_sim/ds_object_generator.html

ANSYS & 3D Printing: Converting your ANSYS Mechanical or MAPDL Model into an STL File

image3D printing is all the rage these days.  PADT has been involved in what should be called Additive Manufacturing since our founding twenty years ago.  So people in the ANSYS world often come to us for advice on things 3D Printer’ish.  And last week we got an email asking if we had a way to convert a deformed mesh into a STL file that can be used to print that deformed geometry.  This email caused neurons to fire that had not fired in some time. I remembered writing something but it was a long time ago.

Fortunately I have Google Desktop on my computer so I searched for ans2stl, knowing that I always called my translators ans2nnn of some kind. There it was.  Last updated in 2001, written in maybe 1995. C.  I guess I shouldn’t complain, it could have been FORTRAN. The notes say that the program has been successfully tested on Windows NT. That was a long time ago.

So I dusted it off and present it here as a way to get results from your ANSYS Mechanical or ANSYS Mechanical APDL model as a deformed STL file.

UPDATE – 7/8/2014

Since this article was written, we have done some more work with STL files. This Macro works fine on a tetrahedral mesh, but if you have hex elements, it won’t work – it assumes triangles on the face.  It also requires a macro and some ‘C’ code, which is an extra pain. So we wrote a more generic macro that works with Hex or Tet meshes, and writes the file directly. It can be a bit slow but no annoyingly slow.  We recommend you use this method instead of the ones outlined below.

Here is the macro:

The Process

An STL file is basically a faceted representation of geometry. Triangles on the surface of your model. So to get an STL file of an FEA model, you simply need to generate triangles on your mesh face, write them out to a file, and convert them to an STL format.  If you want deformed geometry, simply use the UPGEOM command to move your nodes to the deformed position.

The Program

Here is the source code for the windows version of the program:


 PADT--------------------------------------------------- Phoenix Analysis &
                                                        Design Technologies


       Package: ans2stl

          File: ans2stl.c
          Args: rootname
        Author: Eric Miller, PADT
		(480) 813-4884

	Simple program that takes the nodes and elements from the
	surface of an ANSYS FE model and converts it to a binary
	STL file.

		Create and ANSYS surface mesh one of two ways:
			1: amesh the surface with triangles
			2: esurf an existing mesh with triangles
         	Write the triangle surface mesh out with nwrite/ewrite
		Run ans2stl with the rootname of the *.node and *.elem files
		   as the only argument
		This should create a binary STL file

		The ANSYS elements are 4 noded shells (MESH200 is suggested)
		in triangular format (nodes 3 and 4 the same)

		This code has been succesfully compiled and tested
		on WindowsNT

		NOTE: There is a known issue on UNIX with byte order
				Please contact me if you need a UNIX version

		gcc -o ans2stl_win ans2stl_win.c

       10/31/01:       Cleaned up for release to XANSYS and such
       1/13/2014:	Yikes, its been 12+ years. A little update 
       			and publish on The Focus blog
			Checked it to see if it works with Windows 7. 
			It still compiles with GCC just fine.

PADT, Inc. provides this software to the general public as a curtesy.
Neither the company or its employees are responsible for the use or
accuracy of this software.  In short, it is free, and you get what
you pay for.


! Build silly geometry
! Mesh surface with non-solved (MESH200) triangles
MSHAPE,1,2D   ! Use triangles for Areas
MSHKEY,0      ! Free mesh
! Write out nodes and elements
! Execute the ans2stl program
/sys,ans2stl_win.exe a2stest

======================================================= */


typedef struct vertStruct *vert;
typedef struct facetStruct *facets;
typedef struct facetListStruct *facetList;

        int     ie[8][999999];
        float   coord[3][999999];
        int	np[999999];

struct vertStruct {
  float	x,y,z;
  float	nx,ny,nz;
  int  ivrt;
  facetList	firstFacet;

struct facetListStruct {
  facets	facet;
  facetList	next;

struct facetStruct {
  float	xn,yn,zn;
  vert	v1,v2,v3;

facets	theFacets;
vert	theVerts;

char	stlInpFile[80];
float	xmin,xmax,ymin,ymax,zmin,zmax;
float   ftrAngle;
int	nf,nv;  

void swapit();
void readBin();
void getnorm();
long readnodes();
long readelems();

     int argc;
     char *argv[];
  char nfname[255];
  char efname[255];
  char sfname[255];
  char s4[4];
  FILE	*sfile;
  int	nnode,nelem,i,i1,i2,i3;
  float	xn,yn,zn;

  if(argc <= 1){
        puts("Usage:  ans2stl file_root");

  nnode = readnodes(nfname);
  nelem = readelems(efname);
  nf = nelem;

  sfile = fopen(sfname,"wb");
  fwrite("PADT STL File, Solid Binary",80,1,sfile);
  swapit(&nelem,s4);    fwrite(s4,4,1,sfile);

      i1 = np[ie[0][i]];
      i2 = np[ie[1][i]];
      i3 = np[ie[2][i]];

      swapit(&xn,s4);	fwrite(s4,4,1,sfile);
      swapit(&yn,s4);	fwrite(s4,4,1,sfile);
      swapit(&zn,s4);	fwrite(s4,4,1,sfile);

      swapit(&coord[0][i1],s4);	fwrite(s4,4,1,sfile);
      swapit(&coord[1][i1],s4);	fwrite(s4,4,1,sfile);
      swapit(&coord[2][i1],s4);	fwrite(s4,4,1,sfile);

      swapit(&coord[0][i2],s4);	fwrite(s4,4,1,sfile);
      swapit(&coord[1][i2],s4);	fwrite(s4,4,1,sfile);
      swapit(&coord[2][i2],s4);	fwrite(s4,4,1,sfile);

      swapit(&coord[0][i3],s4);	fwrite(s4,4,1,sfile);
      swapit(&coord[1][i3],s4);	fwrite(s4,4,1,sfile);
      swapit(&coord[2][i3],s4);	fwrite(s4,4,1,sfile);
    puts(" ");
  printf("  STL Data Written to %s.stl \n",argv[1]);
    puts("  Done!!!!!!!!!");

void  getnorm(xn,yn,zn,i1,i2,i3)
	float	*xn,*yn,*zn;
	int	i1,i2,i3;
	float	v1[3],v2[3];
	int	i;

	  v1[i] = coord[i][i3] - coord[i][i2];
	  v2[i] = coord[i][i1] - coord[i][i2];

	*xn = (v1[1]*v2[2]) - (v1[2]*v2[1]);
	*yn = (v1[2]*v2[0]) - (v1[0]*v2[2]);
	*zn = (v1[0]*v2[1]) - (v1[1]*v2[0]);
long readelems(fname)
        char    *fname;
        long num,i;
        FILE *nfile;
        char    string[256],s1[7];

        num = 0;
        nfile = fopen(fname,"r");
			puts(" error on element file open, bye!");
            s1[6] = '\0';

        printf("Number of element read: %d\n",num);

long readnodes(fname)
        char	*fname;
        FILE    *nfile;
        long     num,typeflag,nval,ifoo;
        char    string[256];

        num = 0;
        nfile = fopen(fname,"r");
			puts(" error on node file open, bye!");

          sscanf(string,"%d ",&nval);
                typeflag = 1;
                typeflag = 0;
                np[nval] = num;
                        sscanf(string,"%d %g %g %g",
                        sscanf(string,"%d %g %g %g",

        printf("Number of nodes read %d\n",num);


/* A Little ditty to swap the byte order, STL files are for DOS */
void swapit(s1,s2)
     char s1[4],s2[4];
  s2[0] = s1[0];
  s2[1] = s1[1];
  s2[2] = s1[2];
  s2[3] = s1[3];

Creating the Nodes and Elements

I’ve created a little example macro that can be used to make an STL of deformed geometry.  If you do not want the deformed geometry, simply remove or comment out the UPGEOM command.  This macro is good for MAPDL or ANSYS Mechanical, just comment out the last line  to use it with MAPDL:




finish ! exit whatever preprocessor your in

! move the RST file to a temp file for the UPCOORD. Comment out if you want

! the original geometry


/prep7 ! Go in to PREP7

et,999,200,4 ! Create a dummy triangle element type, non-solved (200)

type,999 ! Make it the active type

esurf,all ! Surface mesh your model


! Update the geometry to the deformed shape

! The first argument is the scale factor, adjust to the appropriate level

! Comment this line out if you don’t want deformed geometry



esel,type,999 ! Select those new elements

nelem ! Select the nodes associated with them

nwrite,stl_temp,node ! write the node file

ewrite,stl_temp,elem ! Write the element file

! Run the program to convert

! This assumes your executable in in c:\temp. If not, change to the proper

! location

/sys,c:\temp\ans2stl_win.exe stl_temp

! If this is a ANSYS Mechanical code snippet, then copy the resulting STL file up to

! the root directory for the project

! For MAPDL, Comment this line out.


An Example

To prove this out using modern computing technology (remember, last time I used this was in 2001) I brought up my trusty valve body model and slammed 5000 lbs on one end, holding it on the top flange.  I then inserted the Commands object into the post processing branch:


When the model is solved, that command object will get executed after ANSYS is done doing all of its post processing, creating an STL of the deformed geometry. Here is what it looks like in the output file. You can see what it looks like when APDL executes the various commands:


TO FILE= stl_temp.rst

FILE file.rst COPIED TO stl_temp.rst



ANSYS Multiphysics

65420042 VERSION=WINDOWS x64 08:39:44 JAN 14, 2014 CP= 22.074

valve_stl–Static Structural (A5)

Note – This ANSYS version was linked by Licensee



KEYOPT( 1- 6)= 4 0 0 0 0 0

KEYOPT( 7-12)= 0 0 0 0 0 0

KEYOPT(13-18)= 0 0 0 0 0 0







USING FILE stl_temp.rst


USING FILE stl_temp.rst








6814 NODES WERE WRITTEN TO FILE= stl_temp.node



Using Format = 14(I6)

13648 ELEMENTS WERE WRITTEN TO FILE= stl_temp.elem


c:\temp\ans2stl_win.exe stl_temp

Number of nodes read 6814

Number of element read: 13648

STL Data Written to stl_temp.stl


/COPY FILE FROM FILE= stl_temp.stl

TO FILE= ..\..\stl_temp.stl

FILE stl_temp.stl COPIED TO ..\..\stl_temp.stl


The resulting STL file looks great:


I use MeshLab to view my STL files because… well it is free.  Do note that the mesh looks coarser.  This is because the ANSYS mesh uses TETS with midside nodes.  When those faces get converted to triangles those midside nodes are removed, so you do get a coarser looking model.

And after getting bumped from the queue a couple of times by “paying” jobs, our RP group printed up a nice FDM version for me on one of our Stratasys uPrint Plus machines:


It’s kind of hard to see, so I went out to the parking lot and recorded a short video of the part, twisting it around a bit:

Here is the ANSYS Mechanical project archive if you want to play with it yourself.

Other Things to Consider

Using FE Modeler

You can use FE Modeler in a couple of different ways with STL files. First off, you can read an STL file made using the method above. If you don’t have an STL preview tool, it is an easy way to check your distorted mesh.  Just chose STL as the input file format:


You get this:


If you look back up at the open dialog you will notice that it reads a bunch of mesh formats. So one thing you could do instead of using my little program, is use FE Modeler to make your STL.  Instead of executing the program with a /SYS command, simply use a CDWRITE,DB command and then read the resulting *.CDB file into FE Modeler.  To write out the STL, just set the “Target System” to STL and then click “Write Solver File”


You may know, or may have noticed in the image above, that FE Modeler can read other FEA meshes.  So if you are using some other FEA package, which you should not, then you can make an STL file in FE Modeler as well.

Color Contours

The next obvious question is how do I get my color contours on the plot. Right now we don’t have that type of printer here at PADT, but I believe that the dominant 3D Color printer out, the former Z-Corp and now 3D Systems machines, will read ANSYS results files. Stratasys JUST announced a new color 3D Printer that makes usable parts. Right now they don’t have a way to do contours, but as soon as they do we will publish something.

Another option is to use a /SHOW,vrml option and then convert that to STL with the color information.


Scaling is something you should think about. Not only the scaling on your deformed geometry, but the scaling on your model for printing.  Units can be tricky with STL files so make sure you check your model size before you print.

Smoother STL Surfaces

Your FEA mesh may be kind of coarse and the resulting STL file is even coarser because of the whole midside node thing.  Most of the smoothing tools out there will also get rid of sharp edges, so you don’t want those. Your best best is to refine your mesh or using a tool like Geomagic.

Making a CAD Model from my Deformed Mesh

Perhaps you stumbled on this posting not wanting to print your model. Maybe you want a CAD model of your deformed geometry.  You would use the same process, and then use Geomagic Studio.  It actually works very well and give you a usable CAD model when you are done.

Efficient Engineering Data, Part 2: Setting Default Materials and Assignments aka No, You’re Not Stuck with Structural Steel for the Rest of Your Life

Longer ago than I care to admit, I wrote an article about creating and using your own material libraries in Workbench. This is the long awaited follow-up, which concerns setting the default Engineering Data materials and default material assignments in Mechanical and other analysis editors.

Part of the reason it’s taken me this long is that I moved to New Mexico to help staff PADT’s new office there, and to shadow Walter White. It has been a hectic, exhausting endeavor but I’m here and I’m finally settled in. If you’re in New Mexico and are interested in ANSYS, engineering services, product development, or rapid prototyping (e.g. 3D printing), please feel free to contact me.

In order to make the best use of the procedures here, you will probably want to know how to create your own material libraries. Part 1 describes how to do this. This will also work with the material libraries that come with the ANSYS installation, though.

Pick Favorites

The first step is to get into Engineering Data and expose the material libraries by clicking on the book stack button ( image ). Then, drag the materials of your choice from the appropriate library(ies) to the Favorites Data Source. These can include materials you want to have available in Mechanical by default as well as materials that you would like to consolidate into a single location for quick access. At this point, the default material availability and assignments have not been altered. These will be handled in the next couple of steps.


Drag and Drop Materials to Favorites

Set Default Material Availability

To specify which materials will be immediately available for assignment in future analyses, go to the Favorites Data Source and check all applicable materials in column D. Though not assigned to the immediate set of engineering data, these will be on the default list of available materials in subsequent analyses, i.e. when you create a new analysis in the same project schematic or when you exit and reopen Workbench.


Check to Add to Default List of Available Materials


Materials Immediately Available Inside Mechanical

Set Default Material Assignment

Now our most commonly used materials are immediately available in our analysis editor. But Structural Steel still lingers. In many, if not most, cases, we would prefer our default assignment to be something else.

The fix is easy. Once again, go to the Favorites Data Source, right click the material you wish to have as your default material, and select Default Solid Material (and if you’re doing Emag or CFD, you can set your default fluid or field material with the right-click menu too). Your default solid material will now replace Structural Steel in subsequent analyses.


Example: Aluminum 6061-T651 Set as Default Material Assignment


Becomes Default Material Assignment in Analysis

Note that you can stop at any step in this process. If you want to consolidate favorite materials, but don’t want to have them immediately in your analysis editor, you can do that. If you want a default list of materials to select from without specifying a default material assignment, you can do that too. More than likely, though, you’ll want to do all three.

Video Tips: Parallel Part by Part Meshing in ANSYS v15.0

This video shows you a new capability in ANSYS v15.0 that allows multiple parts to be simultaneously meshed on multiple CPU cores…with no additional licenses required!

Exercising Parallel Meshing in ANSYS Mechanical R15

[The following is an email that Manoj sent the tech support staff at PADT. I thought is was perfect for a The Focus posting, so here it is – Eric]

First of all I found out a way to get Mesh Generation time (if no one knew about this).  In ANSYS Mechanical go to Tools->Options->Miscellaneous and turn “Report Performance Diagnostics in Messages” to Yes.  It will give you “Elapsed Time for Last Mesh Generation” in the Messages window.



Next I did a benchmark on the Parallel Part by Part meshing of a Helicopter Rotor Hub with 502 bodies.  The mesh settings were getting a mesh of about 560,026 elements and 1.23 million nodes.


I did Parallel Part by Part Meshing on this model with 1,2,4,6 and 8 cores and here are the results.

Can I say “I LIKE IT!”

1 core: 172 seconds (1.0)
2 core:  89 seconds (1.9)
4 core:  52 seconds (3.3)
6 core:  38 seconds (4.5)
8 core:  33 seconds (5.2)


Of course this is a small mesh so as the number of cores goes up, the benefits go down.   I will be doing some testing on some models that take a lot longer to mesh but wanted to start simple. I’ll make a video summarizing that study showing how to set up the whole process and the results.

If you are curious, Manoj is running on a PADT CUBE server. As configured it would cost around $19k. You could drop a few thousand of the price if you changed up cards or went with CPU’s that were not so leading edge.

Here are the SPECs:

CUBE Mid-Tower Chassis – 26db quiet edition
Two XEON e5-2637 v2 (4 cores per, 3.5GHz each)
128 GB of DDR3-1600 ECC Reg RAM
7.1 HD Audio (to really rock your webinars…)
SMC LSI 2208 RAID Card – 6Gbps
OS Drive: 2 x 256GB SSD 6gbps
Solver Array: 3 x 600GB SAS2 15k RPM 6Gbps

The 10 Coolest New Features in R15 of ANSYS Mechanical

It’s that time of year again, time for a new release of ANSYS, Inc’s products.  R15 is being released in stages to the user community this week so we thought we would take some time to point out ten features in R15 of ANSYS Mechanical that we find useful, important, or just plain cool.  There are a ton of new features and we will try and cover most of them in the coming months, but these are the ones we felt every user should know about.

This posting will focus on features in ANSYS Mechanical that are unique to ANSYS Mechanical.  Later this week or next week we will do the same for ANSYS Mechanical APDL, and we will cover solver changes that impact ANSYS Mechanical there as well.

image1: Mesh Based Geometry

This is by far the most far-reaching enhancement in R15.  A fundamental limitation of ANSYS Mechanical from the beginning was the requirement that you had to have a valid BREP geometry that can be correctly meshed in ANSYS Mechanical. For most problems this is fine, you have a CAD model, you mesh it, and you move on.  But there are often situations where you have a legacy model or a mesh from another source that you want to use. And in such cases you were just stuck. Most things in ANSYS Mechanical work on geometry and if you just have a mesh, and no geometry, there area not a lot of options.

No longer.  Yipidee yapidee dooooooo daaaa!!!!  That gets a leap for joy gif:

It works through an External Model system in the Workbench project page.  There are a slew of options to copy, translate, change units, etc.. for the model. However, the most important option is the tolerance angle. The way the mesh geometry import works is that it takes the external faces of your mesh and treats them as facets. Any facets that have an angle less than the tolerance angle are considered to be on the same face. Any angle greater than the tolerance treats the edge between facets as an edge on a face.  This is key to understanding how using an mesh in Mechanical works.

I’ll resist the temptation to get into the details and save that for a future posting where we can dig deep. 

To prove it out I searched my hard drive for old *.DB files and found one from 2001. A generic turbine blade ad disk model I made for some cyclic-symmetry testing ANSYS was doing.  Here is what is looks like in ANSYS Mechanical APDL:


And here it what it looks like in ANSYS Mechanical:


That is a sight for sore eyes.  It’s not perfect, the trailing edge muffs things up a big because the mesh is a bit coarse there. But a little work playing with the tolerance angle and/or named selections in MAPDL and that can be cleaned up. More on that in that promised post on this capability.  Here is a wireframe where you can see the internal cooling passages, and the funky elements.


Changing the tolerance from the default 45deg to 55deg cleans up most of the problems:


image2: Assembly Mechanical Models

A related capability to the mesh geometry mentioned above is the ability to create an assembly of multiple external models (mesh based) and other Mechanical Models.

You can take as many External Model, Mechanical Model, or various Analysis systems as you want, and feed them all into a new mechanical model or any analysis system you want to use them in. ANSYS, Inc. provided this really cool example of a model of a pad lock:


As much information as is possible is transferred over, depending on what makes sense.  Also note that you can apply transformations and units conversions to each model, so if you build your parts in different coordinate systems, you can move them around and get them set up when you build the assembled model.

image3: Parallel Meshing by Part

The first step in making meshing fully parallel in ANSYS Mechanical has been released in R15: parallel part meshing.  Basically, if you have more than one part, the program will mesh each part on its own CPU.  So if you have 8 cores and 6 parts, it will mesh on 6 cores at one time.  The default setting is 0, which tells the program to run on as many cores as it can.  Most users will want to keep it there, but if you do a lot of models with lots of large parts, you may want to set it at N-1 where N is the number of cores on your machine.  Leave one open to watch YouTube on while you are meshing.

The settings are in Tools->Options->Meshing->Meshing->Meshing->Number of CPUs for Meshing Methods

image4: Mechanical Shortcut Keys

You may love this one, or it may generate a “Meh.”  Shortcut Keys are almost a religious thing.  If you are on the “true believer” side then you now can use function and control keys to do the following actions:

Tree Outline Actions

F1: opens the Mechanical User’s Guide.
F2: rename a selected tree object.
Ctrl + S: save the project.

Graphics Actions

F6: toggles between the Shaded Exterior and Edges, Shaded Exterior, and Wireframe views
F7: executes Zoom to Fit option
F8: hide selected faces.
F9: hide selected bodies.
Ctrl + A: selects all entities based on the active selection filter (bodies, faces, edges, vertices, nodes).

Selection Filters

Ctrl + B: activate Body selection.
Ctrl + E: activate Edge selection.
Ctrl + F: activate Face selection.
Ctrl + P: activate Vertex selection.

Even if you are not a Shortcut Key acolyte, the selection filters and the F7 options look pretty useful.

image5: Element Selection and Grouping

In the last release the developers at ANSYS, Inc. gave users full access to nodes in ANSYS Mechanical. At R15 they have opened up access to elements.  Using the term “opened up access” is a bit misleading, they did not just change a parameter from FALSE to TRUE and boom, you have elements.  It was a major change to how data is stored and accessed in the program. 

Selecting works as you would expect, just like nodes. You choose “Select Mesh” from the Select Type icon:


Then you choose the Select “Body/Element” from the type choices (the green cube).  Here is where you can use those shortcuts: Ctrl + B selects it for you. Now you can pick elements or use box select to get what you want.

Names selections for elements work just like nodes.  Very useful indeed. And they do get converted to components in Mechanical APDL, avoiding that annoying snippet where you had to convert a nodal component into an element component.

image6: Mapping Enhancements

One feature set in ANSYS Mechanical that makes users of other ANSYS products jealous are the mapping tools. And at this release they got even better, adding more functionality, feedback, and making some beta features released features. If you are not familiar with mapping tools, they allow you to take a load specified on points in space, and interpolate that load on to your model. Again, this is a topic worthy of its own posting, but here are the highlights:

  • Support for Velocity
  • Support for Initial Stress or Strain
  • Support for Body Force Density (forces from an electromagnetic solution)
  • Pressure can now be applied to nodes as well as to elements
  • Acoustic loads from a Harmonic Response Analysis can be mapped as velocities
  • UV Mapping is now available for surfaces that don’t really line up.

That last one, UV Mapping, may be one of the more powerful. It is not that uncommon for you to get pressures on a surface that does not really sit on your model surface.

image7: Better Control of Hydrostatic Pressure

This is pretty specialized, but if you work on parts that see hydrostatic loading you always had to play around with APDL snippets to get the control you needed.  At R15 they have added those controls into the program for us.


The first addition is that you can turn the pressure on and off for a given load step.  This is not necessarily done in an intuitive way, but it works.  Select the step in the graph or in the table when you have the load selected in the tree. Then Right Mouse Button to get the context menu and activate or deactivate the load. It doesn’t show anything in the table, but it does show on the graph that the load is turned off.  Note, you can’t change the acceleration, you can only turn it on or off.

The second addition is simply that the values for fluid density and magnitude are parameters.


image8: Multiple GPU Support, and Intel Phi Support

GPU usage for ANSYS Mechanical solves is growing.  We are seeing good enhancements in performance at every release, and R15 is no exception.  But that is solver stuff and I said we would not talk about solver stuff…  What is important in this area for ANSYS Mechanical users is that you can now specify more than one GPU for a solve, and at R15 the new Intel Phi coprocessor, which is really not a GPU, is supported. You access the control, and all settings for HPC, under Tools-> Solve Process Settings-> Advanced.  Note that there are different settings for solving interactive and in the background.


image9: Follower Load for Rigid Body Dynamics

Because Rigid Body Dynamics are, well rigid body dynamics, they are generally inherently large deflection.  When you apply a load to an object you usually want that load to move with the objects motion, to follow it.  In the past, you had to create a dummy rigid part and apply a pressure to get this.  Now at R15 you can set “Follower Load” to yes in the details view for a Remote Force and it will go along for the ride.  If you do RBD, this is critical.


image10: Bearing Enhancements

The last item on our top ten list for this release are improvements to modeling bearings in ANSYS Mechanical. The ANSYS Mechanical APDL solver supports a wide range of bearing capabilities, and with this release most of them are now exposed in ANSYS Mechanical. 

The big change is that all of the solvers that support bearings are now supported in ANSYS Mechanical. In the past, it was only modal analysis. Now you can simplify your model and get the proper stiffness and damping of your bearing for transient, static, and any other type of run you want to do.

As you would expect with the support of the bearing joint on the pre-processing side, they have added a probe that allows you to get key information out of your bearing after the solve. Since a bearing joint is basically two spring-dampers, you can get spring type info for each spring: elastic force, damping force, elongation, and velocity (for transient runs).


If you look at this list you should notice one common thread, that most of these changes are not general, they are for specific analysis types.  As time has gone by ANSYS Mechanical has grown and matured, and there are less and less basic or general features that need to be added. So now we are in to the fun stuff, digging down into the nitty gritty and exposing more and more of the most powerful solver available (ANSYS Mechanical APDL), through what is the most powerful user interface for structural mechanics, ANSYS Mechanical.

This May Be the Fastest ANSYS Mechanical Workstation we Have Built So Far

The Build Up

Its 6:30am and a dark shadow looms in Eric’s doorway. I wait until Eric finishes his Monday morning company updates. “Eric check this out, the CUBE HVPC w16i-k20x we built for our latest customer ANSYS Mechanical scaled to 16 cores on our test run.” The left eyebrow of Eric’s slightly rises up. I know I have him now I have his full and complete attention.

Why is this huge news?

This is why; Eric knows and probably many of you reading this also know that solving differential equations, distributed, parallel along with using graphic processing unit makes our hearts skip a beat. The finite element method used for solving these equations is CPU intensive and I/O intensive. This is headline news type stuff to us geek types. We love scratching our way along the compute processing power grids to utilize every bit of performance out of our hardware!

Oh and yes a lower time to solve is better! No GPU’s were harmed in this tests. Only one NVIDIA TESLA k20X GPU was used during the test.

Take a Deep Breath and Start from the Beginning:

I have been gathering and hording years’ worth of ANSYS mechanical benchmark data. Why? Not sure really after all I am wanna-be ANSYS Analysts. However, it wasn’t until a couple weeks ago that I woke up to the why again. MY CUBE HVPC team sold a dual socket INTEL Ivy bridge based workstation to a customer out of Washington state. Once we got the order, our Supermicro reseller‘s phone has been bouncing of the desk. After some back and forth, this is how the parts arrive directly from Supermicro, California. Yes, designed in the U.S.A.  And they show up in one big box:


Normal is as Normal Does

As per normal is as normal does, I ran the series of ANSYS benchmarks. You know the type of benchmarks that perform coupled-physics simulations and solving really huge matrix numbers. So I ran ANSYS v14sp-5, ANSYS FLUENT benchmarks and some benchmarks for this customer, the types of runs they want to use the new machine for. So I was talking these benchmark results over with Eric. He thought that now is a perfect time to release the flood of benchmark data. Well some/a smidge of the benchmark data. I do admit the data does get overwhelming so I have tried to trim down the charts and graphs to the bare minimum. So what makes this workstation recipe for the fastest ANSYS Mechanical workstation so special? What is truly exciting enough to tip me over in my overstuffed black leather chair?

The Fastest Ever? Yup we have been Changed Forever

Not only is it the fastest ANSYS Mechanical workstation running on CUBE HVPC hardware.  It uses two INTEL CPU’s at 22 nanometers. Additionally, this is the first time that we have had an INTEL dual socket based workstation continue to gain faster times on and up to its maximum core count when solving in ANSYS Mechanical APDL.

Previously the fastest time was on the CUBE HVPC w16i-GPU workstation listed below. And it peaked at 14 cores. 

Unfortunately we only had time before we shipped the system off to gather two runs: 14 and 16 cores on the new machine. But you can see how fast that was in this table.  It was close to the previous system at 14 cores, but blew past it at 16 whereas the older system actually got clogged up and slowed down:

  Run Time (Sec)
Cores Used Config B Config C Config D
14 129.1 95.1 91.7
16 130.5 99 83.5

And here are the results as a bar graph for all the runs with this benchmark:


  We can’t wait to build one of these with more than one motherboard, maybe a 32 core system with infinband connecting the two. That should allow some very fast run times on some very, very large problems.

ANSYS V14sp-5 ANSYS R14 Benchmark Details

  • Elements : SOLID187, CONTA174, TARGE170
  • Nodes : 715,008
  • Materials : linear elastic
  • Nonlinearities : standard contact
  • Loading : rotational velocity
  • Other : coupling, symentric, matrix, sparse solver
  • Total DOF : 2.123 million
  • ANSYS 14.5.7

Here are the details and the data of the March 8, 2013 workstation:

Configuration C = CUBE HVPC w16i-GPU

  • CPU: 2x INTEL XEON e5-2690 (2.9GHz 8 core)
  • GPU: NVIDIA TESLA K20 Companion Processor
  • RAM: 128GB DDR3 1600Mhz ECC
  • HD RAID Controller: SMC LSI 2208 6Gbps
  • HDD: (os and apps): 160GB SATA III SSD
  • HDD: (working directory):6x 600GB SAS2 15k RPM 6Gbps
  • OS: Windows 7 Professional 64-bit, Linux 64-bit
  • Other: ANSYS R14.0.8 / ANSYS R14.5

Here are the details from the new, November 1, 2013 workstation:

Configuration D = CUBE HVPC w16i-k20x

  • CPU: 2x INTEL XEON e5-2687W V2 (3.4GHz)
  • GPU: NVIDIA TESLA K20X Companion Processor
  • RAM: 128GB DDR3 1600Mhz ECC
  • HDD: (os and apps): 4 x 240GB Enterprise Class Samsung SSD 6Gbps
  • OS: Windows 7 Professional 64-bit, Linux 64-bit
  • Other: ANSYS 14.5.7

You can view the output from the run on the newer box (Configuration D) here:

Here is a picture of the Configuration D machine with the info on its guts:


What is Inside that Chip:

The one (or two) CPU that rules them all:

Intel® Xeon® Processor E5-2687W v2

  • Status: Launched
  • Launch Date: Q3’13
  • Processor Number: E5-2687WV2
  • # of Cores: 8
  • # of Thread: 16
  • Clock Speed: 3.4 GHz
  • Max Turbo Frequency: 4 GHz
  • Cache:  25 MB
  • Intel® QPI Speed:  8 GT/s
  • # of QPI Link:  2
  • Instruction Se:  64-bit
  • Instruction Set Extension:  Intel® AVX
  • Embedded Options Available:  No
  • Lithography:  22 nm
  • Scalability:  2S Only
  • Max TDP:  150 W
  • VID Voltage Range:  0.65–1.30V
  • Recommended Customer Price:  BOX : $2112.00, TRAY: $2108.00

The GPU’s that just keep getting better and better:





Number and Type of GPU


Kepler GK110

Kepler GK110

Peak double precision floating point performance

515 Gflops

1.31 Tflops

1.17 Tflops

Peak single precision floating point performance

1.03 Tflops

3.95 Tflops

3.52 Tflops

Memory Bandwidth (ECC off)

144 GB/sec

250 GB/sec

208 GB/sec

Memory Size (GDDR5)




CUDA Cores





Ready to Try one Out?

If you are as impressed as we are, then it is time for you to try out this next iteration of the Intel chip, configured for simulation by PADT, on your problems.  There is no reason for you to be using a CAD box or a bloated web server as your HPC workstation for running ANSYS Mechanical and solving in ANSYS Mechanical APDL.  Give us a call, our team will take the time to understand the types of problems you run, the IT environment you run in, and custom configure the right system for you:,
or call 480.813.4884

Recommendations to Avoid ANSYS Mechanical Database Corruption

It’s late. The report for the project that you have spent over 140 hours on in the past two weeks is due in the morning. It is crunch time. Your computer resources are maxed out while you are running a final test scenario, post-processing another Workbench Mechanical module, and grabbing screenshots while you finish up your report formatting. Then, the unutterable occurs, ok, well maybe isn’t utter-able since I’m writing it, but, in short, your run is complete, you hit save, your computer locks up, you have to force quit, but you are sure that your save was successful. And it was…mostly.

Upon re-opening your project you find that all but one of your Mechanical databases are healthy and happy. But that one, the one that you needed a final image from, is corrupted. You know this because of the error messages that pop up with the slew of text that might look something like this:


Your frustration is building. You have already used results from that Mechanical model and reflected it in your report, so you do not want to lose it. I feel your pain.

Since this error message pin-points the SYS.mechdb file as the problem, it is unlikely that you can recover it. I know, not what you wanted to hear. But there is a chance that the database is not corrupt. To verify that, follow the steps Ted Harris outlined in a post he made earlier this year here.

If your Mechanical model is, indeed, corrupt and you were not able to recover it from steps outlined by Ted, make note of the following list of guidelines to help avoid database corruption in the future. I received this list of recommendations from ANSYS Inc. after one of our customers experienced a similar scenario as described above.

  1. Open your project from a Local mounted disk drive
  2. Do not work off of a network drive. It is OK to save to it after you are done
  3. Do not work off of a portable USB flash drive. It is OK to save to it after you are done
  4. Software backup programs can often lock a file and prevent WB from writing to the file
  5. Virus scan programs can also lock the file, and prevent WB from writing to the file
  6. Virus scan program can sometimes find a false positive in the file, and “disinfect” it, causing corruption
  7. Determine if the problem is related to the particular computer. ANSYS has seen bad memory or failing disk drives cause problems with saving files
  8. Use Windows Update regularly
  9. Update graphics drivers as needed

Bullet points 4, 5, and 6 are items that can possibly cause corruption while running, so be aware of the times they are generally run. In addition, ANSYS has recommended that disabling the Pre-Load of the Mechanical (and Meshing) editors can reduce the risk of database corruption. Here are the steps to do that:

  1. Reboot the computer (or Close/kill all AnsysFWW.exe and AnsysWBU.exe processes)
  2. Start a new instance of Workbench to change the settings:
    Tools > Options > Mechanical > Pre-Load the Mechanical Editor (disable)
    Tools > Options > Meshing > Pre-Load the Meshing Editor
  3. Exit Workbench
  4. Start a new instance of Workbench and work normally

As a disclaimer, even if you follow the above guidelines, there is still the chance of losing data. To avoid losing all of your data, follow the motto: save early, save often, and with backups! You can create backups by archiving your project as you make progress so that there is always a version to fall back on. Or, if you have the disk space to handle it, you can simply “Save As.” We hope following these recommendations will save you from headache down the road.

Making Charts and Tables in ANSYS Mechanical

imageOne of the nicer features in ANSYS Mechanical is the fact that when you enter in any type of tabular data, or look at any type of tabular results, you can view it as a table or as a graph.  But what if you want to make your own graph, maybe even viewing values from two different solutions?  ANSYS Mechanical has a little used feature called “New Chart and Table” that will allow you to make a table or a graph (chart) of quantities in your model tree that make sense when displayed as a graph or table: Time, loads applied over time, and results over time.


I have found myself exporting data to excel and making graphs all the time. And this is OK if you just do it once. But if you make a change to the model, you need to export again and redo your graph.  The Chart and Table function makes this an automatic step, right there in your model tree.

For this posting, we will just use a simple plasticity bending example. We hold the bottom of a round bar with a grove cut in the bottom part and push on the top with forces.

In its simplest form the “Chart and Table” duplicates what you see in the graph and Tabular Data windows when you click on a load or a result. Here is what you get when you click on a displacement:


And if you select the probe in the tree and click on the “New Chart and Table” icon you get:


No woop.  But even if I want to just plot one value, I can now customize the look of the graph a bit.  Take a look at the Details for the Chart:


With the Chart Controls you can define what is shown on the X axis; if you want lines, points or both with Plot Style, log or linear scale, and if you want horizontal, vertical, neither, or both gridlines.


This is what it looks like if I turn on both gridlines and use a log scale for the Y Axis.

Next, we can add axis labels with “Axis Labels:”


The “Report” Section tells the program what to do when a report is generated. By Default you get a table and a graph.  But you can do either, both, or you can suppress it in the report.  You can give the plot and/or table in the report a caption by filling in the Caption field.  It comes out nice:


Note that it actually includes a legend in the report. If you want the legend when you are looking at a graph interacively, just Right Mouse Button on the graph and choose “Show Legend” to turn it on:



Note that the legend shows the name of the branch in the tree. That is not very informative. So I change it to something useful and now the legend is useful:



So even with a basic graph, we can do a lot. But the real power is when you want to look at more. Let’s say I want to plot the force and the stress over time. I create a new chart with the icon then select the force and the stress results as my “Outline Selection”


I get a lot of stuff on my graph. That is because the program starts by plotting all the components for the load, and all max and min stress over time for the result. I simply change the ones I don’t want from “Display” to “Omit.”  Then I get:


Much more useful.  Note that it does not create two separate Y axis. Instead it normalizes the values between the min and max for each. This is not ideal, and hopefully in the future they will support multiple axis, but it still works for most cases when you want to compare things. Note that I renamed the branches in my tree so they show up in the legend correctly.  Next I will add some labels and turn on gridlines.


We have been neglecting the table. It also gets created:


As with any table in ANSYS Mechanical, it can be exported to Excel. So if you find yourself grabbing data from multiple input or result tables and pasted them into Excel, make a Chart and Table item to grab all the data you want in one place, then export it once.  To be honest, the quality of the graphs that are made are good enough for engineering, but maybe not good enough for a presentation. By making a Chart & Table of what you need, then exporting to Excel or some other graphing tool, you can still save a lot of time.

Next, let us look at plotting values from multiple simulations.  If you look at the tree, you will notice that the charts are a child of the model, not the simulations.  This signals that we can show data form the same model, but different simulations:


In our example I’ve simply made one with a tip force in the Y direction, and one with a tip force in the X direction. And I can show that by making a chart:


And I get a table:


HINT: If you want to make a single table or chart that shows all your input loads over time, in a single simulation or across multiple simulations, this is the way to do it.  If I add a third simulation where I vary the load in all three directions, I can capture all three cases in one table:


These examples show loads. Here is what it looks like if we review the deflection on the tip probe over time for two simulations:


Or mash it all up, and show stress and deflection for both cases:


In every case so far we have used time (Load Step for static) as our X axis. But you can put any value you want on the X axis.  Here is Force applied vs Tip Deflection:


Make sure you turn off Time and loads you don’t want to see.  This is a great way to plot hysteresis effects.

You may notice the plots in this posting are nice and big and have a good aspect ratio. And your screen looks like this:


Every window in ANSYS Mechanical can be dragged out of the frame and positioned/sized however you want. So I pull off the Graph window by itself and resize it to the aspect ratio I want. Now when I want to save the image all I have to do is select that window and hit Alt-Print Screen. The image is now stored in the clipboard and I can past it where I want.


To get the normal window configuration back, click View>Windows>Reset Layout.

As always, play with it to figure more out. I’ve included my simple test case in case you want to play with it first:

Making APDL Parameters Available in the ANSYS Parameter Manager or DesignXplorer: Prep, Solve, and Post

This is one of those questions that comes up every once in a while that is not so obvious at first glance, but that is simple once you understand how ANSYS Mechanical interacts with ANSYS Mechanical APDL.  After a couple of email exchanges around a tech support question, we thought it would be good to share with everyone.

Before we get started, if you need a refresher on Command Objects in ANSYS Mechanical, the way in which you send APDL commands to the ANSYS Mechanical APDL solver, here is a seminar from a couple of years ago that covers the whole deal:

The basic problem is this: you have an APDL script you execute as a command object that does some sort of model interrogation or stores the result of some calculation, and you want to use that parameter in the parameter manager or in DesignXplorer.  If you look at the details view for a command object you will notice that it only supports input parameters: ARG1-ARG9.


If you look at the example (silly) macro you will see that it:

  1. Grabs component (named selection) END1
  2. Figures out how many nodes are attached to END1 (NMND)
  3. Takes ARG1 as the total load applied load
  4. Calculates the per node load by dividing the total load by the number of loads.
  5. Applies that per node load
  6. Reselects all the nodes

If I want to know how many nodes I put the load on and what the per node load is I’m kind of stuck here.  Any command object you add to the tree above the Solution branch only allows input parameters.

But a command snippet applied in the Solution branch is different, it allows you to pull parameters back and share them through the parameter manager.

When you first insert a command object you only get input parameters (ARG1-ARG9) as usual, and an empty section called “Results”


The way you get result parameters, or what I think should be called “Output Parameters” is you create a parameter in the command object’s APDL script that starts with “my_”  When you click outside the text input window the program parses you script and if it finds any “my_” parameters in the text, it sticks them in the Results section:


Note, the default is “my_” but you can change it n the “Output Search Prefix” line in the Definition block.

Initially they will show up pinkish because the model has not been run and they are not defined. Click on the box to make them parameters that get passed outside of the program and then run:


If you pop back out to the project view you will see that we now have a Parameter Set bar with both input and output parameters:


And if you open the parameter manager up you can see the input and output parameters:


This works because all ANSYS mechanical is doing is making one big batch input file for ANSYS MAPDL.  That file contains any command objects you insert into the tree and extracts any parameters that you tagged in a post processing command object for return to ANSYS Mechanical.

20 APDL Commands Every ANSYS Mechanical User Should Know

One of the most powerful things about ANSYS Mechanical is the fact that it creates an input file that is sent to ANSYS Mechanical APDL (MAPDL) to solve. This is awesome because you as a user have complete and full access to the huge breadth and depth available in the MAPDL program.  MAPDL is a good old-fashioned command driven program that takes in text commands one line at a time and executes them. So to access all those features, you just need to enter in the commands you want.

For many older users this is not a problem because we grew up using the text commands. But new users did not get the chance to be exposed to the power of APDL (ANSYS Parametric Design Language) so getting access to those advanced capabilities can be tough. 

In fact, I was in a room next to one of our support engineers while they were showing a customer how to change the elements that the solver would solve (Mechanical defaults to the most common formulation, but you can change them to whatever still makes sense) and the user had to admit he had never really used or even seen APDL commands before. 

So, as a way to get ANSYS Mechanical users out there started down the road of loving APDL commands, we got together and came up with a list of 20 APDL commands that every user should know.  Well, actually, it is more than 20 because we grouped some of them together.  We are not going to give too much detail on their usage, the APDL help is fantastic and it explains everything.  In fact, if you use a copy of PeDAL you can get the help right there live as you type (yes, that was a plug for you to go out and plop down $49 and buy PeDAL).

Also note that we are not getting in to how to script with APDL. It is a truly parametric command language in that you can replace most values in commands with parameters. It also has control logic, functions and other capabilities that you find in most scripting languages.  We will focus on actual commands you use to do things in the program here. If you want to learn more about how to program with APDL, you can purchase a copy of our “Introduction to the ANSYS Parametric Design Language” book. (another plug)

Some APDL Basics

APDL was developed back in the day of punch cards.  It was much easier to use than the other programs out there because the commands you entered didn’t have to be formatted in columns.  Instead arguments for commands are separated by commas.  Therefore, instead of defining a Node in your model as:

345   12.456    17.4567   0.0034 

(note that the location of that decimal point is critical). You create a line as:

N,345,12.456,17.4567, 0.0034

Trust me, that was a big deal. But what you need to know now is that all APDL commands start with a keyword and are followed by arguments. The arguments are explained in the Command Reference in the help.  So the entry for creating a node looks like this:


The documentation is very consistent and you will quickly get the hang of how to get what you need out of it.  The layout is explained in the help:  // Command Reference // 3. Command Dictionary

Another key thing to know about commands in MAPDL is that most entities you create (not loads and boundary conditions) have an ID number. You refer to entities by their ID number.  This is a key concept that gets lost if you grew up using GUI’s.  So if you want to make a coordinate system and use it, you define an ID for it and then refer to that ID. Same thing goes for element definitions (Element Types), material properties, etc…  Remember this, it hangs up a lot of newer users.

To use MAPDL commands you simply enter each command on a line in a command object that you place in your model tree. We did a seminar on this very subject about two years ago that you can watch here.

The idea of entity selection is fundamental to APDL.  Above we point out that all entities have an ID.  You can interact with each entity by specifying its ID.  But when you have a lot of them, like nodes and elements, it would be a pain.  So APDL deals with this by letting you select entities of a given type and making them “selected” or “unselected”  Then when you execute commands, instead of specifying an ID, you can specify “ALL” and all of the selected entities are used for that command.  Sometimes we refer to entities as being selected, and sometimes we refer to them as “active.”  The basic concept is that any entity in ANSYS Mechanical APDL can be one of two states: active/selected or inactive/unselected.  inactive/unselected entities are not used by whatever command you might be executing.

If you want to see all of the APDL command that ANSYS Mechanical writes out, simply select the setup branch of your model tree and choose Tools->Write Input File.  You can view it in a text editor, or even better, in PeDAL.


One last important note before we go through our list of commands: the old GUI for MAPDL can be used to modify or create models as well as ANSYS Mechanical. Every action you take in the old GUI is converted into a command and stored in the jobname.log file.  Many users will carry out the actions they want in an interactive session, then save the commands they need from the log file.

Wait, one more thing:  Right now you need these commands. But at every release more and more of the solver is exposed in ANSYS Mechanical FUI and we end up using less and less APDL scripts.  So before you write a script, make sure that ANSYS Mechanical can’t already do what you want.

The Commands

1. !

An exclamation point is a comment in APDL. Any characters to the right of one are ignored by the program. Use them often and add great comments to help you and others remember what the heck you were trying to do.


The MAPDL program consists of a collection of 10 processors (there were more, but they have been undocumented.) Commands only work in some processors, and most only in one.  If you enter in a preprocessor command when you are in the postprocessor, you will get an error.

When you create a command object in your ANSYS Mechanical model, it will be executed in either the Pre processor, the Solution processor, or in the Post processor.  Depending on where in the model tree you insert the command object.   If you need to go into another processor you can, you simply issue the proper command to change processors.  JUST REMEMBER TO GO BACK TO THE PROCESSOR YOU STARTED IN when you are done with your commands.

/PREP7 – goes to the pre processor. Use this to change elements, create things, or modify your mesh in any way.

/SOLU – goes to the solution processor.  Most of the time you will start there so you most often will use this command if you went into /PREP7 and need to get back. Modify loads, boundary conditions, and solver settings in this processor.

/POST1 – goes to the post processor. This is where you can play with your results, make your own plots, and do some very sophisticated post-processing.

FINISH – goes to the begin level. You will need to go there if you are going to play with file names.


You only really need to know these commands if you will be making your own elements… but one of those things everyone should know because the assignment of element attributes is fundamental to the way APDL works…. so read on even if you don’t need to make your own elements.

Every element in your model is assigned properties that define the element.  When you define an element, instead of specifying all of its properties for each element, you create definitions and give them numbers, then assign the number to each element.  The simplest example are material properties. You define a set of material properties, give it a number, then assign that number to all the elements in your model that you want to solve with those properties.

But you do not specify the ID’s when you create the elements, that would be a pain. Instead, you make the ID for each property type “active” and every element you create will be assigned the active ID’s. 

The commands are self explanatory: Type sets the Element Type, MAT sets the material ID, REAL set the real constant number, and SECNUM sets the active section number. 

So, if  you do the following:


you get:

      1  34   4   2   0 112      1     2     3     4    11    12    13    14
      2   3   4   4   0 200    101   102   103   104   111   112   113   114

4. ET

The MAPDL solver supports hundreds of elements.   ANSYS Mechanical picks the best element for whatever simulation you want to do from a general sense.  But that may not be the best for your model. In such cases, you can redefine the element definition that ANSYS Mechanical used.

Note: The new element must have the same topology. You can’t change a 4 noded shell into an 8 noded hex.  But if the node ordering is the same (the topology) then you can make that change using the ET command. 


If you define a real constant, element type, or material ID in APDL and you want to change a bunch of elements to those new ID’s, you use EMODIF.  This is the fastest way to change an elements definition.


Probably the most commonly needed APDL command for ANSYS Mechanical users are the  basic material property commands. Linear properties are defined with MP command for a polynomial vs. temperature or MPDATA and MPTEMP for a piece-wise linear temperature response.  Nonlinear material properties are defined with the TB, TBDATA, and TBTEMP commands.

It is always a good idea to stick your material definitions in a text file so you 1) have a record of what you used, and 2) can reuse the material model on other simulation jobs.


If you define an elements formulation with options on the ET command, and the material properties on the material commands, where do you specify other stuff like shell thickness, contact parameters, or hourglass stiffness?  You put them in real constants.  If you are new to the MAPDL solver the idea of Real constants is a bit hard to get used to. 

The official explanation is:

Data required for the calculation of the element matrices and load vectors, but which cannot be determined by other means, are input as real constants. Typical real constants include hourglass stiffness, contact parameters, stranded coil parameters, and plane thicknesses.

It really is a place to put stuff that has no other place.  R creates a real constant, and RMODIF can be used to change them.


As mentioned, selection logic is a huge part of how MAPDL works.  You never want to work on each object you want to view, change, load, etc… Instead you want to place entities of a given type into an “active” group and then operate on all “active” entities. (you can group them and give them names as well, see CM-CMSEL-CMDELE below to learn about components)

When accessing MAPDL from ANSYS Mechanical you are most often working with either nodes or elements.  NSEL and ESEL are used to manage what nodes and elements are active. These commands have a lot of options, so review the help.


You often select nodes and then need the elements attached to those nodes. Or you select elements and you need the nodes on those elements.  NSLE and ESLN do that.  NSLE selects all of the nodes on the currently active elements and ESLN does the opposite.


A very common mistake for people writing little scripts in APDL for ANSYS Mechanical is they use selection logic to select things that they want to operate on, and then they don’t remember to reselect all the nodes and elements.  If you issue an NSEL and get say the nodes on the top of your part that you want to apply a load to. If you just stop there the solver will generate errors because those will be the only active nodes in the model. 

ALLSEL fixes this. It simply makes everything active. It is a good idea to just stick it at the end of your scripts if you do any selecting.

11. CM – CMSEL

If you use ANSYS Mechanical you should be very familiar with the concept of Named Selections. These are groups of entities (nodes, elements, surfaces, edges, vertices) that you have put into a group so you can scope based on them rather than selecting each time. In ANSYS MAPDL these are called components and commands that work with them start with CM.

Any named selection you create for geometry in ANSYS Mechanical gets turned into a nodal component – all of the nodes that touch the geometry in the Named Selection get thrown into the component. You can also create your own node or element Named Selections and those also get created as components in MAPDL. 

You can use CM to create your own components in your APDL scripts.  You give it a name and operate away.  You can also select components with the CMSEL command.

12. *GET

This is the single most awesomely useful command in APDL.  It is a way to interrogate your model to find out all sorts of useful information: number of nodes, largest Z value for node position, if a node is selected, loads on a node, result information, etc… 

Check out the help on the command. If you ever find yourself writing a script and going “if I only knew blah de blah blah about my model…” then you probably need to use *get.


Coordinate systems are very important in ANSYS Mechanical and ANSYS MAPDL.  In most cases you should create any coordinate systems you need in ANSYS Mechanical. They will be available to you in ANSYS MAPDL, but by default ANSYS Mechanical assigns a default ID. To use a coordinate system in MAPDL you should specify the coordinate system number in the details for a given coordinate system by changing “Coordinate System” from “Program Defined” to “Manual” and then specifying a number for “Coordinate System ID”


If you need to make a coordinate system in your APDL script, use the LOCAL command. 

When you want to use a coordinate system, use CSYS to make a given coordinate system active.

Note: Coordinate system 0 is the global Cartesian system. If you change the active coordinate system make sure you set it back to the global system with CSYS,0

RSYS is like CSYS but for results. If you want to plot or list result information in a coordinate system other than the global Cartesian, use RSYS to make the coordinate system you want active.


One thing to be very aware of is that each node in a model has a rotation associated with it. By default, the UX, UY, and UZ degrees of freedom are oriented with the global Cartesian coordinate system. In ANSYS Mechanical, when you specify a load or a boundary condition as normal or tangent to a surface, the program actually rotates all of those nodes so a degree of freedom is normal to that surface.

If you need to do that yourself because you want to apply a load or boundary condition in a certain direction besides the global Cartesian, use NROTATE.  You basically select the nodes you want to rotate, specify the active coordinate system with CSYS, then issue NROTATE,ALL to rotate them.

Be careful though. You don’t want to screw with any rotations that ANSYS Mechanical specified.

15. D

The most common boundary condition is displacement, even for temperature.  To specify those in an ANSYS MAPDL script, use the D command.  Most people use nodal selection or components to apply displacements to multiple nodes.

In its simplest form you apply a single value for displacement to one node in one degree of freedom.  But you can specify multiple nodes, multiple degrees of freedom, and more powerfully, the value for deflection can be a table. Learn about tables here.

16. F

The F command is the same as the D command, except it defines forces instead of displacement.  Know, it, use it.

17. SF – SFE

If you need to apply a pressure load, you use either SF to apply to nodes ore SFE to apply to elements. It works a lot like the D and F commands.


When the ANSYS MAPDL solver is solving away it writes bits and pieces of information to a file called jobename.out, where jobname is the name of your solver job.  Sometimes you may want to write out specific information, say list the stresses for all the currently selected nodes, to a file. use /OUTPUT,filename to redirect output to a file. When you are done specify /OUTPUT with no options and it will go back to the standard output.

19. /SHOW

ANSYS MAPDL has some very sophisticated plotting capabilities.  There are a ton of command and options used to setup and create a plot, but the most important is /SHOW,png.  This tells ANSYS MAPDL that all plots from now on will be written in PNG format to a file. Read all about how to use this command, and how to control your plots, here.



The ANSYS MAPDL solver solves for a lot of values. The more complex the element you are using, the more the number of values you can store.  But how do you get access to the more obscure ones? ETABLE.  Issue 38 of The Focus from 2005 goes in to some of the things you can do with ETABLE.

Where to go From Here

This is certainly not the definitive list.  Ask 20 ANSYS MAPDL users what APDL commands all ANSYS Mechanical users should know, and you might get five or six in common. But based on the support calls we get and the scripts we write, this 20 are the most common that we use.

Command help is your friend here.  Use it a lot.

The other thing you should do is open up ANSYS MAPDL interactively and play with these commands. See what happens when you execute them.

Video Tips: Section Planes in ANSYS 14.5

A quick video showing a new way to create section planes by using coordinate systems.

Submodeling in ANSYS Mechanical: Easy, Efficient, and Accurate

Back “in the day” when we rode horses into work as Finite Element Analysis Engineers, we had somewhat limited compute capacity.  70,000 elements was a hard and fast limit.  But we still needed accurate results with local refinement in areas of concern.  The way we accomplished that was with a  process called submodeling where you make a refined local model just of the area you care about, and a coarse mesh that modeled the whole part but still fit on the computer.  The displacement field from the coarse model was then applied as a boundary condition on the refined model.

We called the refined model a zoom model or a submodel.  It worked very well for many years. Then computers got bigger and we just started meshing the heck out of those areas of interest in the full part model.  And in many cases that is still the best solution for an accurate localized stress: localized refinement.

Submodeling is one of those “tricks” in stress analysis that used to be used all the time. But until recently it was a bit of a pain to do in ANSYS Mechanical so it fell out of use.  Now, the process of doing submodeling is easy, efficient, and accurate.  The purpose of this posting is to introduce the concept to newer users who have not used it before, and show experienced (old) users how much easier it is to do in ANSYS Mechanical vs. Mechanical APDL.

What is Submodeling?

The best description of submodeling is the illustration that has been in the ANSYS help system, in one form or another, for over 25 years:


The basic idea is that you have a coarse model of your whole part or assembly.  You ignore small features in the mesh that don’t have an impact on the overall response of the system – the local stiffness does not have influence on the strain beyond that local region. You then make a very refined model, the submodel, of the region of interest. You use the displacement field (and temperature if you have a temperature gradient) from the coarse model and apply it to the submodel as a boundary condition to get the accurate highly-refined response in the area of interest.

The process is based on St. Venant’s principle: “… the difference between the effects of two different but statically equivalent loads becomes very small at sufficiently large distances from load.”

An aside:
What a cool name this guy had:
Adhémar Jean Claude Barré de Saint-Venant.  To top it off he was not just a mathematician, but he was given the title of Count as well… a count mathematician. And, I have to say, I have serious beard envy.  He had some very nice facial hair, I can’t even grow thick stubble.

Anyhow, what he showed was that if you are looking at the stresses in a part far away from where loads are applied, how those loads are applied does not matter. So we can replace the forces/pressures/etc… from our course model as an equivalent static deflection load and the stress field will be the same.

The way this is done in a Finite Element model is you determine what faces in your submodel are “inside” your course model. These are called the cut boundary faces and the nodes on those faces are the cut boundary nodes. and you apply the displacement field from the coarse model onto the nodes

The most common use is to add mesh refinement in an area without having to solve the whole model. Another common usage is to actually mesh small features like fillets, holes, and groves that were left out of or under-meshed in the full model.  It can also be used to capture material non-linearities if that behavior is highly localized.

But probably the most beneficial use today is to study the parametric variation of small features like the size of a fillet or a hole.  If changing the size of such features does not change the overall response of the system, then you only need to do a parametric study on the submodel – as the guy with the great beard proved, if the static load does not change with your geometric variations, you don’t have to look at the whole structure.

And don’t forget the new crack growth capabilities. You will probably want to do that on a submodel around your crack and not on your whole geometry.

Here is a more modern version of the original example geometry:


The red highlight shows the cut boundaries. this is where you need to apply the displacement field.


This is the nasty coarse mesh. Now if you were modeling a single part, you would just mesh the fillets and be done with it.  But assume this is in a large assembly.


The Submodel. Nice elements in the key area.

You can even set up the radius as a parameter and do a study, where only the Submodel is modified and updated.



The Process

The process is fairly simple:

  1. Make and solve your full model
  2. Make a geometry model of the area you want a submodel in
  3. Attach the submodel to the engineering data and solution of the full model
  4. Set up and solve the submodel

Before we get started, here is a ANSYS 14.5 archived project for both models we will discuss in this posting:  PADT-Focus-Submodeling-2013_08_14.wbpz

For the sample geometry we showed above, the system looks like this:


When you go into ANSYS Mechanical for the sample model, you have a new model branch:


When you first get in there, the branch is empty, you have to insert Body Temperature and/or Displacement:


The Details for the Displacement object are as follows:


There are a lot of options here. It is basically using the external load mapper to map the displacements. Consult the help and just play around with the options to understand them better. In most cases, all you need to do is specify the faces that you want the displacement field applied to for the Scope section.

A cool feature is that once you have specified the faces, you can “Import Load” and then view them by clicking on the object. Graphics Control –>Data = All shows vectors. Total/X/Y/Z shows the applied displacement field as a contour:



Now you just need to make sure your Submodel is set up correctly, you have the mesh you want, and any other loads that are applied directly to the Submodel are the same as the loads in the full model (see next section).  Run and you get your refined results.

Here is that same process with a more realistic model of a beam with a tube welded on it.  The welds are not modeled in the full model and the fillets in the beam are very coarse.

So here is the geometry. Imagine that these two parts are actually part of a very large assembly so we really can’t refine them the way we want.


This is what the systems look like. Note that the geometry comes from one source. I made the submodel in the same solid model in DesignModeler and just suppress the parts I don’t want in each Mechanical model.


The loading is simple. I fix one end and put a force on the top of the tube.


And here is my coarse mesh. I could probably mesh the tube with a lot more elements, especially along the axis.


The results. Not too useful from a stress standpoint. Deflections are good, but the fillet is missing and beam is too coarse.


So here is the submodel.  All the fillets are in there and it is just the area around the connection.


I used advanced meshing to get a really nice refined mesh. It only solves in about 20 seconds so I can really refine it.


Here are the cut boundaries. The bottom of the beam ribs are also selected.


And here is the result. A really accurate look at the stresses in the fillet.  I could even put a probe in there and do some nice fatigue or crack growth.


The other thing that showed up were some stress problems on the bottom of the beam.  Those could be an issue under a high load. The fillet stress on top my yield out but these stresses under the beam could be a fatigue problem.


Tips and Hints

In most cases, doing a sub model is pretty simple. But there is a lot more to it than what we covered here.  Because I need to get back to some very pressing HR tasks, I’ll just list them here so you know that you are aware of them:

  1. Label your systems in the project page with some sort of “full” and “sub” terminology Things get really confusing fast if you don’t.
  2. You can do submodeling with a transient or multiple substep model. In your Imported Displacement/Body Temperature, specify what load step to grab the loads from.
  3. Don’t forget temperature. One of the most common problems is when a user applies temperature and therefore gets thermal stress.  They then forget to apply that to their submodel and everything is wrong.
  4. Make sure you don’t change material properties. Remember, these models are statically identical, you are just looking at a chunk with greater refinement.
  5. Remember that loads need to be away from the area you are zooming in on.  Don’t cut where a load is applied, or even near where one is applied. The exception is temperature. (Sometimes you can get away with pressure loads too, but you have to be very careful to get the same load over the area)
  6. Your can’t have geometry in the submodel sticking too far out of the coarse mesh. The displacement is interpolated onto the fine mesh and if a node on the fine mesh is outside the coarse mesh, the program extrapolates and that can sometimes induce errors. If you see spotty or high stresses on your cut boundaries, that is why.  There are tools in the Submodeling details to help diagnose and fix that.
  7. If you are going to do a parametric study on geometry changes in the submodel, use a separate geometry file to create that model (I just duplicate the original and suppress the full geometry in DM).  Why? Because if you change a parameter in your geometry model, both models will need to resolve since they both use the same geometry file, even if the geometry change occurs on a part that is suppressed in the full model.
  8. You can do submodels of submodels as many levels down as you want.
  9. You can have multiple submodels in one system
  10. Read the help, it is fairly detailed

That is about all for now. As always: crawl, walk, run.  Start with a very simple sub model with obvious cut boundaries and get experienced.

Utilizing a Thermal Contact Conductance Table in ANSYS ANSYS Mechanical

We recently had a tech support request from a customer, asking for the ability to define a spatially varying thermal contact conductance (TCC) on a contact region in ANSYS Mechanical. We came up with a solution for ANSYS 14.5 via an example which includes a couple of verification plots.

The test model consists of two solids, connected via a contact region. The thermal contact conductance at the contact region was defined as a table, with the rows and columns of the table corresponding to local coordinates within the plane of the contact surface. The table was defined and implemented using Mechanical APDL commands in the Mechanical tree.


Low values of TCC were used for testing purposes. This helped verify that the tabular values were actually being used as intended. A constant temperature was applied to the face at one end of the model, while a different constant temperature was applied to the face at the extreme other end of the model. This temperature differential caused heat to flow through the contact region, subject to the resistance defined via TCC values.

The coordinates in the plane of the contact surface were Y and Z. Thus, the table of TCC values varied in the Y and Z directions, as shown here:

  Y |  0.0        1.0
0.0 | 0.0001    0.0005
1.0 | 0.0005    0.0002

Three ANSYS Mechanical APDL command objects were inserted into the tree in the Mechanical editor. The first command object simply added a scalar parameter to keep track of the contact element type/real constant set number for use later:


The second command object was placed in the analysis type branch, meaning this set of commands would be executed just prior to the Solve command. This command object does three things:

1. Defines the TCC table vs. Y and Z coordinates.

2. Reads the table in as an MAPDL real constant for the contact elements identified in the first command object.

3. Issues the command, “rstsuppress,none”. More on this later.

This is how the second command object was defined:


That third step mentioned above was a key to getting this technique to work in 14.5. The rstsuppress command is not documented currently, but Al Hanq of ANSYS, Inc. has told me that it will be documented in the future. The default setting turns off contact results from being written to the results file in a thermal analysis. The idea is to help keep results file sizes from getting excessively large, especially for transient thermal runs. In this case, we actually wanted the thermal contact results in the results file, so we issued “rstsuppress,none” so the thermal contact results were not suppressed.

The final command object was for verification of the applied TCC values. This set of commands generates two plots using MAPDL postprocessing commands. The first plot is of heat flux going through the contact elements. The second plot displays the TCC values for node ‘i’ of each contact element (averaged).

Here is the third command object:


Both of these plots show up in the tree, labeled as Post Output and Post Output 2 in the image above.

This is the resulting thermal flux at the contact surface:


Here is the applied thermal contact conductance, as mapped from the table defined in the second command object:


In summary, we took advantage of Mechanical APDL command objects to apply thermal contact conductance values that vary along the contact region. We also used MAPDL commands to create two plots that help verify that the TCC values were applied as intended. Hopefully this is a helpful example.

Corrupt ANSYS Mechanical Database? You Might Be Able to Recover

Most of the time ANSYS Mechanical does a great job of keeping track of all our input and output files needed for a particular simulation. Every once in a while though, a glitch can happen which could lead to a corrupt database that gives you errors, say, if you try to reopen the ANSYS Mechanical editor. If you suspect that somehow your project database for a Mechanical model (or any other model that uses the same interface as ANSYS Mechanical) has been corrupted, you just might be able to recover it using these steps:

1. Copy any .mechdb files from the project directory to a different location. Rename them to a .mechdat extension. These will be named SYS.mechdb, SYS-1.mechdb, etc. The easiest way to find these files is to click on View > Files from the Workbench window, then scroll through the list until you find the .mechdb file or files. Then right click on each one and select “Open Containing Folder.” This will open Windows Explorer in the directory in which the file resides. You can then copy the files to a new location and rename them to .mechdat extensions.



2. Copy any .agdb (DesignModeler) files or other geometry files from the project directory to a different location. These will be named SYS.agdb , SYS-1.agdb, etc. (for DesignModeler) and can be found using View > Files as I described above. No need to rename these.


3. Start a new Workbench session.

4. Click File > Import. Set the type of file to import to “Importable Mechanical File”. Browse to the two .mechdat files created in step 1 (by renaming the copied .mechdb files) and import each.


5. If needed for geometry files, in the resulting Project Schematic in the Workbench window, right click on the first block’s geometry cell and select Replace Geometry > Browse. Browse to the copied SYS.agdb file or other geometry file from step 2. Repeat any additional analysis block in similar fashion.


6. Then save the project with a new name and directory. 

This should allow you to recreate a Workbench project that allows you to continue working. We hope this suggestion is helpful if the need ever arises to use it.


(Artwork by Eric… Ted does much nicer smiley faces)