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.

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:

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.
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
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.
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:

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,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.

## ANSYS Mesh Connections–Another Tool for Meshing Surface Assemblies

Anyone who has had to mesh shell assemblies has probably run into trouble with edges that don’t quite line up, edges that meet in the middle of faces and other problems that make the meshing process difficult.  Often geometry operations were required to reconcile those problems and many times significant effort was required to get a continuous mesh.

Another historically used tool to connect shell assemblies was the use of constraint equations to connect edge nodes to surface nodes on the finite element level.  More recently, advances in contact technology have allowed for the use of nonlinear contact elements to connect shell assembly meshes.  Both of those techniques, while useful, have some drawbacks.  For example, constraint equations do not support large rotations of the geometry as the direction of application does not change as nodes rotate.  Also, contact elements increase the computational expense if they can otherwise be eliminated.

ANSYS, Inc. now provides us with another technique for handling shell assembly meshing, called Mesh Connections.  First available in version 13.0 and enhanced in version 14.0, mesh connections use the mesher itself to connect shell assemblies toward the goal of getting a continuous or conformal mesh across the surface bodies that make up the assembly.

Consider this boat hull example.  It consists of panel surfaces defining the hull as well as some stiffening ribs.  All geometry is composed of surface bodies.

Some of the ribs line up with edges in the hull surfaces, while others do not as shown in the close up image shown below.

We can now create mesh connections in the Connections branch after loading this geometry into the Mechanical editor in Workbench 14.0.

Upon generating the mesh, the mesher will attempt to create a continuous or conformal mesh even though we have do not have intersecting geometry.

With the default settings, we can see in this image that it did a fairly good job of creating the mesh for the ribs which do not intersect with the hull surfaces.  Nodes on the hull surface were adjusted so that they connect to the rib geometry.

In this case with relatively little effort we were able to obtain a continuous mesh between the ribs and the hull, even though the several of the ribs shared no intersections with the hull surfaces.  In fact, the mesh connections were able to overcome small gaps in between the geometry as well.

In 14.0, the mesh connections are generally performed after the initial mesh is created by default.  This means that if changes are made only to mesh connection settings, the remeshing operation is fairly quick since the initial mesh does not need to be regenerated in most cases.

Note that mesh connections exist in the Connections branch, not the Mesh branch. The mesh connection setup works in similar fashion to contact region creation in that searching for edges/faces to connect is based on proximity. The proximity value can be controlled via a slider or by entering an explicit distance, both available in the Mesh Connections details window.

To activate mesh connections, highlight the Connections branch and click on the Connection Group button in the context sensitive menu above the outline tree.  Change the Connection Type to Mesh Connection in the details.

Next right click on the Connections branch and select Create Automatic Connections.  You may need to adjust the auto detection tolerance in the details to make sure the tolerance distance is large enough to detect desired gaps between edges and faces or edges and edges for the mesh connection to work.

If any contact regions have been automatically created that you want to replace with mesh connections, delete or suppress them.  You have the choice of automatically creating mesh connections or manually creating them.  Both options are available by right clicking.

In the example shown here, mesh connections are edge to face.  Edge to edge mesh connections are also available.

With a couple of mesh settings added, we can obtain a better mesh:

Note that the hull surface nodes have moved a bit in order to allow for the mesh connections with the ribs.  Here is a view of the outer hull surface in the mesh connection region:

There are other considerations as well, such as which geometric entities should be the master or slave.  In general slave geometry is ‘pinched’ into the master geometry.  Also, mesh connections can be setup manually for cases where the auto detection is not appropriate or is not providing the desired level of control.  Note that the mesh can end up as an approximation of the geometry since the mesh will have moved to close gaps.  Here is an example:

In summary, mesh connections are another tool that are available to us in ANSYS meshing capabilities, having value for shell assemblies.  In cases where shell geometry edges do not meet at intersections we can still obtain a continuous mesh without having to perform additional geometry operations.  Mesh connections can be faster than using contact elements at the edges as well.  There are other features and considerations for mesh connections which are explained in the ANSYS 14.0 Help.  We recommend you give them a try if you are tasked with simulating shell type structures.

## 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/

## ANSYS R14 Quick Install Instructions for Windows

Editors note: For this weeks Focus posting I’m just taking a PowerPoint that Ted Harris created and putting it on the Blog so the search engines can find it easily.  We share this with our customers to help them quickly install the ANSYS software and hope you find it useful.  You can also download a PDF of the PowerPoint if you wish to keep a copy, share it with your co-workers, or print it out:

With the release of ANSYS 14.0, I thought it would be good to get this topic on the Focus blog. Quite often, we get tech support calls about installs that crash or hang. Most of the time it is traced back to the fact that the download was not complete or had an error that the user didn’t see at the time.  So how can you check that your download was successful before starting you install?  Easy. Check the md5sum.

When you go to download software from ANSYS, or many other locations, they post the md5sum hash table value as shown below.

Md5sum is an algorithm used to calculate an identifier that functions as a compact digital fingerprint of a file.  Most UNIX and LINUX systems have it as a built in function. The Wikipedia article on md5sum says that Windows has it too, but I have never found it. So I went out on the internet and found one. Many actually. Here is a direct link to get MD5Sums, a useful one at PC-Tools.net, a  reputable download site.

“Md5sums” is nice in that it is fast, taking only about 30 seconds for a 4GB file, and you can use it two ways.  As with most other executables, you can use it at a command line or in a script, like this:

md5sums –u *winx64* > checksums.txt

to get a file, “checksums.txt”, with formatted output like this for all the matching files in a directory.

9febae323d5df015187c84f373db7a45 *ansys140_winx64_dvd1.iso
c90e04fd5e5bd94d1a39101bcbe18258 *ansys140_winx64_dvd2.iso

But MD5sums also allows you to drag-n-drop files onto it in the file explorer  and it starts processing those files, or a whole directory, in pop-up window.

Then you just compare the output to the md5sum values that ANSYS posted on the download page.  If they are not the same, then something happened during the download process.  You’ll have to download the bad file again, but at least you haven’t started the install yet.

## Why You Need a Good Text Editor: Finding What Changed in Your Model

There seems to come a time in everyone’s career, at least once, but usually for me, once a week, where I have made a change to something and didn’t even know it.  I copied a model, or made what I thought was a copy, but the results are coming out different.  So how do you tell what’s changed?

Well, you can spend time checking individual boundary conditions, part names, material properties, etc.  This can take a long time, especially with interactive programs that have a different menu or dialog box for each one.  This is where a good text editor can save you hours of work and years worth of frustration and stress.

So what can a good text editor do for you? In such a case it can compare two files and show you quickly exactly what is different.  For my money, GVIM gets my vote as the best text editor available. (Partly because it’s free and didn’t take any of my money. )

The “Split Diff with…” option in GVIM will show multiple files, side by side, and highlight differences between them.  Lines that are different are highlighted pink, with the actual difference highlighted in red. Lines that are present in one file, but not in the other, are highlighted purple, while blank lines are added to the other file to keep the similarities lined up.

So how do you use this feature to compare ANSYS, CFX, or Fluent, or any other models?  Most analysis programs have an export or archive feature that rights the model out in text format. In ANSYS, you can write out a text archive, CDB file, with the CDWRTE command.  In CFX, as in this example, you can export a CCL file.  In this example, GVIM quickly highlights what different between two CCL files.

In this case, the option on one of the boundary conditions was different.

Another great thing about GVIM, is that it will also do the “Split Diff With…” on binary and Hex files, too. Now, you might not read hexadecimal, I don’t either, but at least you would know that the files differ somewhere.

There are a lot of good text editors out in the market these days. The key is to find one that you like, and learn it inside and out.  It can save you a lot of frustration and time in the long run.

# Resources:

• Other text editors with text comparison capabilities:
• Emacs is the other editor that came out of Unix that people swear by, if they are not Vim users.
• SlickEdit is not free, \$299 for a single user license, but it is one of PADT’s favorite paid text editors.
• A comprehensive list of text editors can be found on Wikipedia: http://en.wikipedia.org/wiki/Comparison_of_text_editors

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

No 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

## 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.

## Sifting through the wreckage: Element Birth and Death in Workbench

So the WebEx that expanded upon my article about load vs. sub-step in Workbench ended with me getting booted from the teleconference and unable to rejoin.  I handled as many questions as possible through the chat window, but one of them required a bit more than I was willing to answer via chat window.  That question was “do you have an example of element birth/death using command snippets”.

 It may not have been that bad…and I might not look that cool

I’ll first start by going over element birth and death.  This functionality allows you to remove the stiffness of groups of elements from a load-step (clarification:  it technically reduces the stiffness by the value defined with the ESTIF command, which defaults to 1E-6).  I’ve typically seen it used to analyze some chip-level component where you have multiple assembly steps where the component is heated, stuff poured on it, cooled, heated back up to a different temperature, and so on.  This functionality is accessed by using the ekill and ealive commands, which operate on the currently selected element set.  I should also point out that you can use these commands on contact elements to simulate assembly processes by eliminating contact interfaces from being detected from step to step (PROTIP:  not recommended for MPC-based contact).

Next, how to enact in Workbench.  The command snippets are fairly simple, the real leg work comes in selecting the elements you want to kill.  This is typically done through named selections or selecting elements by material.  The easiest way to use named selections is to scope the named selection to a body:

 Note the ‘part1’ is scoped to a body

When a named selection is scoped to a body, the MAPDL input file contains a component consisting of elements.  You can select these elements by using the command “cmsel,s,part1”.  If the named selection is scoped to a keypoint, line, or area, the corresponding component will consist of nodes.  You can ‘fight’ your way to the attached elements by doing a “esln” after you select the component (repeat as many times as you like in a *do loop).  This can get confusing if you’re using surface bodies (meshed with shells) as the surface and body ‘look’ like the same thing…just realize that it’s all in the details (window).

The other way (that I’m willing to discuss in this article) to select the elements is to ‘tag’ the material number in another command snippet.

 RMB on the geometry and insert a command snippet
 Note the documentation at the top of the snippet
So the trick here is reading the auto-inserted documentation (I know…no one ever reads the instructions).  It states that if you want to interact with the material for this body to use the parameter “matid”.  In the input deck, when the elements for this body are being read in, there is a scalar parameter named “matid” that contains the material property number.  All we need to do is transform that temporary value (it will increment up by one if there was another body after this) by assigning it to a different scalar.  As seen above, all I did was write “part2=matid”.  If we want to select these elements all we need to do is “esel,s,mat,,part2”.

Now I’ll put this all together into a simple thermal expansion model.  A simple 3-2-1 displacement constraint on 3 corners will be used, and I’ll kill off both inserts.  Here’s the command snippets:
 Like I said…the commands are simple

One thing that might happen is the auto-solver settings will have the inappropriate settings to properly support element birth death.  If that happens, you’ll get the dreaded “an unknown error has occurred” in the message window.  Looking into the ‘Solution Information’ window will then show:

 Also note the element selection status, the selection logic worked!
So we’ll modify the command snippet using the error suggestion:
 Happy now solver?

Here’s a comparison of the results with the command snippet active vs inactive:

 Element death results Standard results

Now if you want to bring elements back into the model, you just need to insert a command snippet and scope it to the proper load step:

 Solver Settings Ekill Command Snippet Details Ealive Command Snippet Details

The second command snippet just needs to contain the command “ealive,all” in order to bring everything back.  If you want to only bring back part of the model use the same selection logic as before.  I’m not going to show any results, as everything is linear, it’s late, and my dog isn’t very happy about me writing this article.  Hopefully you get the point.

In conclusion, some basic knowledge of MAPDL selection logic and load-step options within Mechanical, you can easily incorporate element birth and death into your model.

## You don’t wanna step to this: Breaking down Loadsteps and Substeps in ANSYS Mechanical

Did you know Warren G is still alive?!?  I obviously confused Nate Dogg with Warren G.  How embarrassing.  Anyways, on to the topic at hand…regulators, mount up.

 Nate Dogg and Warren G using ANSYS…what’s next?

So what exactly is the difference between a load-step and a sub-step?  A load-step should be thought of as a set of constraints/loads that are being solved for while the sub-steps are how you transition from one loading environment to the next.

So as shown in the graph above, at time=1 (for a static run time is meaningless, think of it more as a % of applied load where 1=100%) the applied load is 10 pounds.  Since it’s the first load-step, all applied values are ramped from 0 (by default), and there are 10-equal interval sub-steps that allow the solver to get from 0 to 10.  For load-step 2, which has an end time of 2 (load-steps must have increasing end-times), only 4 sub-steps that get progressively larger were used.  We’ll get into how that works, but the important take-away is that load-step 2 starts at the end of load-step1.

Within Mechanical, you define both load-step and sub-step controls in the ‘Analysis Settings’.

 Red = Load-step, Blue = Sub-step

By default the number of steps in an environment is 1, and the solver has control over how the loads are ramped.  As soon as you increase the number of steps you will see this reflected in the ‘Tabular Data’ window for any applied load or constraint.

When you first start defining the load for a multi-load-step analysis, Mechanical assumes that the loading will remain constant for all subsequent steps.  This is indicated by an ‘=’ sign shown in the tabular data.

 Mechanical assumes a constant value for LS2

So after you’ve gone through and defined an assembly loading process, large deflection plastic analysis to determine permanent set, or whatever else your heart desires…you can go back to define how the loads are ramped from one step to the next.

Toggling the ‘Auto Time Stepping’ to ‘On’ gives you even more options.

 Auto Time Step = On

You have the ability to define the ramping controls either by number of sub-steps or time.  Both represent the same thing, just presented through a different paradigm.

 Not to be confused with a pair-of-dimes…(I’ll be here all night, make sure you tip the wait staff)

Before I get into the difference between sub-step and time, I’ll touch on the Initial/Minimum/Maximum values (note the following explanation is valid for the sub-step paradigm).  The initial value is the initial ramping value used to start off the current load step.  If the solver was able to converge easily, it can increase the load increment until it hits the ‘minimum’ sub-step value.  If the sub-step was difficult to solve, or did not solve at all, the solver can reduce the increment and try again.

Assuming the end time of the load step is 1, here are equivalent sub-step controls (sub-step vs time) listed next to what the actual load increments are:

 Equivalent Settings Assuming End Time=1, Actual Load increments shown on right

One thing to note is that if you were to change the end time from 1 to 2, the sub-step-method would still ramp by the exact same amount for each sub-step whereas the time-method would ramp it slower.  Obviously if you are running a transient analysis these controls become very important as they determine what response frequencies you’ll pickup from your structure.  The documentation recommends a time-step size of (1/20*f), where f is the highest frequency assumed to contribute to the response.  If your time-steps are too large, you’ll miss the higher frequency content that could be more damaging.

So now you’re probably thinking “great, so now what?”.  First…watch that tone mister.  Second, this should be one of the first places you should turn when you run into model convergence issues.  If a model is poorly constrained you can run a first load-step with additional constraints and then ‘release’ it once the model has converged.  If you have a model held in place purely by contact you can run an initial no-applied-load-step to allow the contacts to ‘settle down’ and properly engage.  If you have a model that fails due to excessive distortion or accumulated plastic strain you can increase the number of sub-steps to ramp the loads slower.  Or you could use this information to create some fairly complex loading environments.

I’ll be going over all of this information and more (activating/deactivating loads, command snippet use, etc) in the upcoming PADT Webinar being held on November 17th.  Hope to see you there.

## 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:

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:

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 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)

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.

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:

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:

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:

Here is the animated gif:

# 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.

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:

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

## Importing and Exporting ANSYS Mechanical Loads as XML Files

I was futzing around with some loads the other day and noticed that, to my shock, that if you click on the value for a load and instead of typing a value in, click on the drop down menu and you will find that it has an Import and an Export on it.   I’m not sure when that became a capability, but I think it has been there for a while.  A quick check with the staff here at PADT and only a few knew about it.  Which makes it a great topic for The Focus.

# XML, Engineering Data, and Verbosity

The easiest way to check this out is to go into a model and insert a force into your model.  Go ahead and pick the geometry.  In the Details for the force, click on the magnitude cell and you will see a little drop-down menu triangle:

Click on that and you will see the menu:

Click on Export and give it a file name.  You will notice when you do this that it makes an XML file.  If you didn’t know it, ANSYS Mechanical uses a lot of XML.  In fact, they used to even store results in an XML file.  The good thing about XML files is that they kind of self-describe themselves and organize the data in them in a sort of object oriented way.  This makes them very easy to read and portable between programs.

XML stands for eXtensible Markup Language and it is an expansion of HTML to handle data. Check out the Wikipedia article on the topic to learn more.  XML is hear to stay and if you don’t get it, you might struggle with some advanced stuff in a lot of areas, not just ANSYS.

The down side of XML is that it is very wordy – verbose.  It has lots of text in there that specifies relationships, names, ID’s, etc…  Tags out the wazoo.  For those of us that grew up feeding our simulation programs fixed format or comma delimited files where the first line specified all the constants and the rest was the data, this can be a bit annoying.  But it does make the data portable and “human readable”

Let’s take a look at the XML file from applying a load of 0.0 lbf to our model.  The best way to view an XML file is to doubleclick on it. Your browser will bring it up and show what is inside.   If you have Dreamweaver or some other HTML editor, that will work even better.

Here is our example:

`   1: <?xml version="1.0" encoding="UTF-8" standalone="no" ?>   1.5: <ANSYS_EnggData>`

`   2:     <MaterialData/>`

`   3:     <ConvectionData/>`

`   4:     <LoadVariationData>`

`   5:           <MatML_Doc>`

`   6:               <LoadVariation>`

`   7:                     <BulkDetails>`

`   8:                         <Name>Force 2</Name>`

`   9:                         <Form>`

`  10:                               <Description/>`

`  11:                     </Form>`

`  12:                         <PropertyData property="pr1">`

`  13:                               <Data format="float">0.,0.</Data>`

`  14:                               <Qualifier>Force</Qualifier>`

`  15:                               <ParameterValue format="float" parameter="pa1">                                         0.,1.</ParameterValue>`

`  16:                     </PropertyData>`

`  17:                 </BulkDetails>`

`  18:                     <Metadata>`

`  19:                         <ParameterDetails id="pa1">`

`  20:                               <Name>Time</Name>`

`  21:                     </ParameterDetails>`

`  22:                         <PropertyDetails id="pr1">`

`  23:                               <Name>Force</Name>`

`  24:                     </PropertyDetails>`

`  25:                 </Metadata>`

`  26:             </LoadVariation>`

`  27:         </MatML_Doc>`

`  28:     </LoadVariationData>`

`  29:     <BeamSectionData/>`

`  30: </ANSYS_EnggData>`

The first thing you will notice is that the second tag (right after the XML version info) is <ANSYS_EnggData>.  That is because ANSYS already had a nice well defined format for putting tabular data into Workbench applications: EngineeringData.  So they just used the same format for loads.

The next thing you will notice is a lot of text to specify two value at two time points.  A lot of the data is just blank. There in case you need it.  To understand this let’s step back and look at tags in HTML.

A tag goes around some piece of information and describes what that information is.  Usually you have a starting tag which is the string with a less-than sign at the start and a greater-than sign at the back:

<tagString>

You then put in your information.  It could be data, text, more tags, whatever you want.  then when you are done, you close out the tag with the same string, but this time start with less-than followed by a forward slash. You still end with greater than:

</tagString>

You can nest these guys, with tags inside tags. This is how you get your object parent-child relationships.

So let’s look at our first couple of lines again, repeated here with the meat taken out (<…>) so we don’t have to scroll back and forth:

`   1: <?xml version="1.0" encoding="UTF-8" standalone="no" ?><ANSYS_EnggData>`

`   2:     <MaterialData/>`

`   3:     <ConvectionData/>`

`   4:     <LoadVariationData>`

`   5:           <MatML_Doc>`

`   6:               <LoadVariation>`

`   7:                     <BulkDetails>`

`   8:                         <...>`

`   9:                     </BulkDetails>`

`  10:                     <Metadata>`

`  11:                         <...>                       `

`  12:                     </Metadata>`

`  13:             </LoadVariation>`

`  14:         </MatML_Doc>`

`  15:     </LoadVariationData>`

`  16:     <BeamSectionData/>`

`  17: </ANSYS_EnggData>`

You will notice that a lot of the tags in our example end with a forward slash:

<tagString/>

This is an empty tag. It tells the program I got no data of this type. It does save some text compared to other market languages where you just have a blank start and end tag.

So, our example starts and ends with <ANSYS_EnggData> and </ANSYS_EnggData>  Everything between in engineering data.  Then it says no material data and no convection data.  It does say it has load variation data.  We then find the LoadVariationData tag.  This is what we actually have in the file.  It then goes one step down and has a MatML_Doc tag.  This tells the program the format of the data being given is in the MatML schema.  more on that below.

Then we break the load into two parts: The BulkDetails where the actual data values are specified and the MetaData, which tells the program information it needs to know about the data.  Then everything has its end tag, you tell the program you don’t have BeamSectionData, and you finish up.

If you want to, you can not include all the empty tags.  the <tagString/> tags.  Mechanical reads the file just fine without them.   But you can’t get rid of anything else.

# The MatML Language

MatML is “an extensible markup language (XML) developed especially for the interchange of materials information.”  You can read all about it at: http://www.matml.org/  History, examples, news, etc…  It is all there.   Like most standards, you can waste a lot of time saying what is good or bad about it.  But in the end, what matters is that everyone uses the same standard. (Of course, MatWeb doesn’t support this standard because they want you to pay for native format… grumble, grumble…).

# Looking at the Data and MetaData

Let’s look at the heart of our file, the actual data we want.  In MatML they call it BulkDetails:

`   1: <BulkDetails>`

`   2:     <Name>Force 2</Name>`

`   3:     <PropertyData property="pr1">`

`   4:         <Data format="float">0.,0.</Data>`

`   5:         <Qualifier>Force</Qualifier>`

`   6:         <ParameterValue format="float" parameter="pa1">0.,1.</ParameterValue>`

`   7:     </PropertyData>`

`   8: </BulkDetails>`

The first thing we find is the name.  This is not the name that will be used in the tree.  It is the name that will show up in the library if you combine a bunch of XML files and the name that will show up in your detail view for magnitude.  So if you make your own load, give it something descriptive here so you can pick it out of the library but not so long that you can’t read it in the detail. Calling it F1 will just tick you off in six months when you try to reuse a load.

Next is the PropertyData tag.  It will always have the name “prn” as far as I can tell, where n is an integer starting at 1 and increasing for each property in the file.  If you change it, everything gets messed up – so always use pr1.

Now the data.  You give it a format, float in most cases, then a comma delimited list.  That is it.

Then you tell the program that it is a Force with the Qualifier.

Last, you need to specify the parameters that your load will vary over.  Usually this is time.  Use <ParameterValue> to do this.  Notice how you specify a format and what the parameter is called, and this is always “pa1”  (or pan actually, where n starts at 1 and increases for each property in the file).

Now we have to tell the program some additional information about our data, which is called Meta Data.  For loads, the only thing that is supported is the definition of the type of load being specified:

`   1: <Metadata>`

`   2:     <ParameterDetails id="pa1">`

`   3:         <Name>Time</Name>`

`   4:     </ParameterDetails>`

`   5:     <PropertyDetails id="pr1">`

`   6:         <Name>Force</Name>`

`   7:     </PropertyDetails>`

`   8: </Metadata>`

Don’t worry too much about this formating stuff.  The best thing for you to do is make a load like the one you want in Mechanical, export it to XML, then modify the values inside as you see fit.  Much easier than understanding the schema… or even what a schema is.

# Units

Please notice that there are no units anywhere.  Right now all of your values must be in SI units, and Mechanical will convert when it displays the values.  This is because Mechanical always stores values internally as SI.  So, if you make your own load files, make sure you convert to SI.

This is the single biggest potential for error… so mind your units!

The process of reading in the loads is a bit more complicated then simply pointing to a file.  This is because each file can hold more than one load. You should think of the XML file as a library.

To read the file go to your Magnitude, click on the drop-down menu icon and choose “Import…”  This brings up the “Import Load History Data” dialog:

Note that instead of picking a file you are given a Data Source area and a Load History Data to Import area.  the top Data Source is the file.  Click Add… and point to your XML file.  Once it reads that file in it will always remember the file and every time you open this dialog box, it will re-read it and update the Load History data to Import values.

You can see our sample file, tt4.xml, is the library Data Source and within it are two loads.  You use the radio button to choose the load you want to apply.  Click OK and you will notice that your Details for the load now lists that name as the Magnitude:

As you can imagine, you can put a ton of loads in one file, maybe all the loads for your project.  Then use the filter to find the load you want in a big file.  This is again a reminder of why it is important to specify a useful name when you create the load.

# Formulas

The examples above deal with tabular data.  You can also store formulas in the file.  This looks a little different in the <BulkDetails> in that you specify format=”function> in the <Data> tag.  Here is an example:

# ` 1: <MatML_Doc>` ` 2: <LoadVariation>` ` 3: <BulkDetails>` ` 4: <Name>Force 2</Name>` ` 5: <Form>` ` 6: <Description/>` ` 7: </Form>` ` 8: <PropertyData property="pr1">` ` 9: <Data AngleInDegrees="1" AngularVelocityInRPM="1" ` ` 10: TemperatureUnit="3" UnitSystem="4" format="function">` ` 11: <Domain LowerLimit="0." UpperLimit="-999.">` ` 12: time` ` 13: </Domain>` ` 14: <Domain LowerLimit="0." UpperLimit="-999.">` ` 15: 1.2*sin(time/6)` ` 16: </Domain>` ` 17: </Data>` ` 18: <Qualifier>Force</Qualifier>` ` 19: <ParameterValue format="float" parameter="pa1">` ` 20: 0.,.1,.2,.3,.4,.5,.6,.7,.8,.9,` ` 21: 1.0,1.1,1.2,1.3,1.4,1.5,1.6,` ` 22: 1.7,1.8,1.9,2.0` ` 23: </ParameterValue>` ` 24: </PropertyData>` ` 25: </BulkDetails>` ` 26: <Metadata>` ` 27: <ParameterDetails id="pa1">` ` 28: <Name>Time</Name>` ` 29: </ParameterDetails>` ` 30: <PropertyDetails id="pr1">` ` 31: <Name>Force</Name>` ` 32: </PropertyDetails>` ` 33: </Metadata>` ` 34: </LoadVariation>` ` 35: MatML_Doc>`

A lot more complicated. The best way to make one of these is to do it interactively and export.