## Using Probes to Obtain Contact Forces in ANSYS Mechanical

Recently we have had a few questions on obtaining contact results in ANSYS Mechanical. A lot of contact results can be accessed using the Contact Tool, but to obtain contact forces we use Probes. Since not everyone is familiar with how it’s done, we’ll explain the basics here.

Below is a screen shot of a Mechanical model involving two parts. One part has a load that causes it to be deflected into the other part.

We are interested in obtaining the total force that is being transmitted across the contact elements as the analysis progresses. Fortunately this is easy to do using Probes in Mechanical.

The first thing we do is click on the Solution branch in the tree so we can see the Probes button in the context toolbar. We then click on the Probe drop down button and select Force Reaction, as shown here:

Next, we click on the resulting Force Reaction result item under the Solution branch to continue with the configuration. We first change the Location Method from Boundary Condition to Contact Region:

We then specify the desired contact region for the force calculation from the Contact Region dropdown:

Note that the coordinate system for force calculation can either be Cartesian or Cylindrical. You can setup a coordinate system wherever you need it, selectable via the Orientation dropdown.

There is also an Extraction dropdown with various options for using the contact elements themselves, the elements underlying the contact elements, or the elements underlying the target elements (target elements themselves have no reaction forces or other results calculated). Care must be taken when using underlying elements to make sure we’re not also calculating forces from other contact regions that are part of the same elements, or from applied loads or constraints. In most cases you will want to use either Contact (Underlying Element) or Target (Underlying Element). If contact is non-symmetric, only one of these will have non zero values.

In this case, the setting Contact (Contact Element) was a choice that gave us appropriate results, based on our contact behavior method of Asymmetric:

Here are the details including the contact force results:

This is a close up of the force vs. ‘time’ graphs and table (this was a static structural analysis with a varying pressure load):

***** SUMMATION OF TOTAL FORCES AND MOMENTS IN THE GLOBAL COORDINATE SYSTEM *****

FX = -0.4640219E-04
FY = -251.1265
FZ = -0.1995618E-06
MX = 62.78195
MY = -0.1096794E-04
MZ = -688.9742
SUMMATION POINT= 0.0000 0.0000 0.0000

We hope this information is useful to you in being able to quickly and easily obtain your contact forces.

## Video Tips: Using ACT to change Default Settings in ANSYS Mechanical

A short video showing how ACT (ANSYS Customization Toolkit) can be used to change Default Settings for analyses done in ANSYS Mechanical.  This is a very small subset of the capabilities that ACT can provide.  Stay tuned for other videos showing further customization examples.

The example .xml and python file is located below.  Please bear in mind that to use these “scripted” ACT extension files you will need to have an ACT license.  Compiled versions of extensions don’t require any licenses to use.  Please send me an email (manoj@padtinc.com) if you are wondering how to translate this example into your own needs.

NLdefaults

## Integrating ANSYS Fluent and Mechanical with Flownex

Component boundaries generated in Flownex are useful in CFD simulation (inlet velocities, pressures, temperatures, mass flow). Generation of fluid and surface temperature distribution results from Flownex can also be useful in many FEA simulations. For this reason the latest release of Flownex SE was enhance to include several levels of integration with ANSYS.

## ANF Import

By simply clicking on an Import ANF icon on the Flownex Ribbon bar users can select the file that they want to import. The user will be requested to select whether the file must be imported as 3D Geometry which conserves the coordinates system or as an isometric drawing.

The user can also select the type of component which should be imported in the Flownex library. Since the import only supports lines and line related items this will typically be a pipe component.

Following a similar procedure, a DXF importer allows users to import files from AutoCAD.

This rapid model construction gives Flownex users the ability to create and simulate networks quicker. With faster model construction, users can easily get to results and spend less time constructing models.

## ANSYS Flow Solver Coupling and Generic Interface

The Flownex library was extended to include components for co-simulation with ANSYS Fluent and ANSYS Mechanical.

These include a flow solver coupling checks, combined convergence and exchanges data on each iteration, and a generic coupling that can be used for cases when convergence between the two software programs is not necessary.

The general procedure for both the Fluent and Mechanical co-simulation is the same:

1. By identifying specified named selections, Flownex will replace values in a Fluent journal file or ds.dat file in the case of Mechanical.
2. From Flownex, Fluent/Mechanical will then be run in batch mode
3. The ANSYS results are then written into text files that are used inputs into Flownex.
4. When applicable, specified convergence criteria will be checked and the procedure repeated if necessary.

## Some Tips on Configuring RSM as a User

If you’re not familiar with it, RSM is the ANSYS Remote Solve Manager.  In short, it allows you to submit solutions from various ANSYS tools so they can be solved remotely, such as on a compute cluster, remote number cruncher, or perhaps just another computer that isn’t being used very much.  Note that there is no additional licensing or installation is required (other than perhaps ANSYS HPC licensing to take advantage of multiple cores).  RSM is installed automatically when ANSYS is installed; it just needs to be configured to be activated.

According to PC Revive, in version 14.5 and 15.0, there is a nicely documented Setup Wizard that helps with the setup and configuration of RSM on compute servers.  This setup wizard as well as the rest of the RSM documentation in the ANSYS Help does a great job of explaining RSM and what must be done to setup and configure it.  This Focus entry assumes that your crack IT staff has installed RSM on your compute machine(s) and has decided where the Compute Server will be (can be on your local machine or on your ‘number cruncher’ or on a different machine).  So, our focus here is on what needs to be done as a user to send your solutions off to the remote solver using RSM.

As an example, we have RSM 15.0 configured with the Compute Server on a remote computer named cs3a. The first time running RSM, using Start > All Programs > ANSYS 15.0 > Remote Solve Manager > RSM 15.0, we get the window shown here:

Notice that it only shows our local machine (My Computer) and nothing about the actual remote computer on which we want to solve.

Therefore, we need to add the information on our cluster node which contains the compute server.

To do this, click on Tools > Options.  This is the resulting window.  Notice the Add button at lower left is grayed out:

What it’s waiting for us to do is type in the name of our desired remote computer, like this:

Now that a new name has been typed in the Name field, the Add button is active.  After clicking Add, we get this:

After clicking OK, we will now see that the new remote computer has been added in the RSM window:

The next step is to set your login password for accessing this computer.  Right click on the new hostname in the RSM window in the tree at left, and select Set Password.

If your accounts are fully setup, at this point you can run a test by right clicking on the localhost item in the tree under the remote computer name and selecting Test Server:

If the test is successful, you will see that the test job completed with a green checkmark on the folder icon in the upper right portion of the RSM window:

If your login is not configured properly, you will likely get an error like this one shown below.  Notice that the upper right portion now states that the job has failed and there is a red X rather than a green checkmark on the folder icon.  By clicking on the job in the upper right panel, we can see the job log in the lower right panel.  In this case, it says that the login failed due to an incorrect password.

The fix for the password problem is to ensure that the correct login is being accessed by RSM on the remote computer.  This is done from the RSM window by right clicking on the remote computer name and selecting Accounts.

If your account and/or password are different on the remote computer than they are on your local machine, you will need to establish an alternate account so that RSM knows to use the correct login on the remote computer.  Right click on your account in the Accounts pane, and select Add Alternate Account:

Enter your username and password for the remote computer in the resulting window.  Next, we need to associate that login with localhost on the remote computer.  This is down by checking the localhost box in the Compute Servers pane, like this:

Another problem we have seen is that the user doesn’t have permission for ANSYS to write to the default solve directory on the remote computer.  In that case, the test job log will have an error like this:

This fix in this case is to establish a solve directory manually, first by creating one on the remote computer, if needed, and second by specifying that RSM use that directory rather than the default.  The second step is accomplished in the RSM window via right clicking on the localhost item for the remote computer, then selecting Properties.  On the General tab, you should be able to change the Working Directory Location to User Specified, then enter the desired directory location as shown in the image below.  If that option is greyed out, either your password for the remote machine has not been entered correctly, or you are not part of the admin group on the remote computer.  In the case of the latter, either your RSM administrator has to do it for you, or you have to be granted the admin access.

At this point, if the test server runs have completed successfully you should be ready to try a real solution using RSM.  We’ll use Mechanical to show how it’s done.  In the Mechanical editor, click on Tools > Solve Process Settings.  Here we will need to specify the remote computer and queue we’ll be using for the solution.  Click on the Add Remote button:

In the resulting Rename Solve Process Settings button, type in a name for your remote solve option that makes sense to you.  We called ours RemoteSolve1.  This new option will now show up on the left side of the Solve Process Settings window:

The next step is to type in the name of the Solve Manager over on the right side.  In our case, the Solve Manager is on computer cs3a.  Any queues that are available to RSM for this Solve Manager will show in the Queue field, after a brief period of time to make the connection.  In our case, the only queue is a local queue on cs3a.

We are now ready to solve our Mechanical model remotely, using RSM.  Instead of clicking the Solve button in Mechanical, we will click on the drop down arrow to the right of the solve button.  From the dropdown, we select the remote solve option we created, RemoteSolve1:

Assuming the solution completes with no errors, this job will show up in the RSM window with a status of Finished when it is done.

The final step in this case is to download the results from the remote computer back to the client machine.  In the Mechanical editor, this is done by right clicking on the Solution branch and selecting Get Results as shown below.  Also note that you can monitor a nonlinear solution via Solution Information.  You’ll just need to right click during solution to have a snapshot of the nonlinear diagnostics brought back from the remote computer.

We hope this helps with the setup and utilization of RSM from a user perspective.  There are other options and applications for RSM that we didn’t discuss, but hopefully this is useful for those needing to get ‘over the hump’ in using RSM.

## Getting to know ANSYS – Rigid Body Dynamics (RBD)

This video is an introduction to ANSYS RBD – an add on module to ANSYS Mechanical for analyzing rigid mechanisms.

## ACT Extension for a PID Thermostat Controller (PART 2)

(View part one of this series here.)

So, I’ve done a little of this Workbench customization stuff in a past life. My customizations involved lots of Jscript, some APDL, sweat and tears. I literally would bang my head against Eric Miller’s office door jamb wondering (sometimes out loud) what I had done to be picked as the Workbench customization guy. Copious amounts of alcohol on weeknights helped some, but honestly it still royally sucked. Because of these early childhood scars, I’ve cringed at the thought of this ACT thingy until now. I figured I’d been there, done that and I had zero, and I mean zero desire to relive any of it.

So, I resisted ACT even after multiple “suggestions” from upper management that I figure out something to do with it. That was wrong of me; I should have been quicker to given ACT a fair shot. ACT is a whole bunch better than the bad ol’ days of JScript. How is it better? Well, it has documentation… Also, there are multiple helpful folks back at Canonsburg and elsewhere that know a few things about it. This is opposed to the days when just one (brilliant) guy in India named Rajiv Rath had ever done anything of consequence with JScript. (Without him, my previous customization efforts would simply have put me in the mad house. Oh, and he happens to know a thing or two about ACT as well…)

## Look Ma! My First ACT Extension!

In this post we are going to rig up the PID thermostat boundary condition as a new boundary condition type in Mechanical. In ACT jargon, this is known as adding a pre-processing feature. I’m going to refer you primarily to the training material and documentation for ACT that you can obtain from the ANSYS website on their customer portal. I strongly suggest you log on to the portal and download the training material for version 15.0 now.

### Planning the Extension

When we create an ACT extension we need to lay things out on the file system in a certain manner. At a high level, there are three categories of file system data that we will use to build our extension. These types of data are:

1. Code. This will be comprised of Python scripts and in our case APDL scripts.
2. XML. XML files are primarily used for plumbing and for making the rest of the world aware of who we are and what we do.
3. Resources. These files are typically images, icons, etc… that spice things up a little bit.

Any single extension will use all three of these categories of files, and so organizing this mess becomes priority number one when building the extension. Fortunately, there is a convention that ACT imposes on us to organize the files. The following image depicts the structure graphically.

We will call our extension PIDThermostat. Therefore, everywhere ExtensionName appears in the image above, we will replace that with PIDThermostat in our file structure.

### Creating a UI for our Load

The beauty of ACT is that it allows us to easily create professional looking user experiences for custom loads and results. Let’s start by creating a user interface for our load that looks like the following:

As you can see in the above user interface, all of the controls and inputs for our little PID controller that we designed in Part 1 of this blog series are present. Before we discuss how we create these user elements, let’s start with a description of what they each mean.

The first item in the UI is named Heat Source/Sink Location. This UI element presents to the user a choice between picking a piece of geometry from the model and specifying a named selection. Internal to the PID controller, this location represents where in the model we will attach the control elements such that they supply or remove energy from this location. ACT provides us two large areas of functionality here. First, it provides a way to graphically pick a geometric item from the model. Second, it provides routines to query the underlying mesh associated with this piece of geometry so that we can reference the nodes or elements in our APDL code. Each of these pieces of functionality is substantial in its size and complexity, yet we get it for free with ACT.

The second control is named Temperature Monitor Location. It functions similarly to the heat source/sink location. It gives the user the ability to specify where on the model the control element should monitor, or sense, the temperature. So, our PID controller will add or remove energy from the heat sink/source location to try to keep the monitor location at the specified set point temperature.

The third control group is named Thermostat Control Properties. This group aggregates the various parameters that control the functionality of the thermostat. That is, the user is allowed to specify gain values, and also what type of control is implemented.

The forth control group is named Thermostat Setpoint Properties. This group allows the user to specify how the setpoint changes with time. An interesting ACT feature is implemented with this control group. Based on the selection that the user makes in the “Setpoint Type” dropdown, a different control is presented below for the thermostat setpoint temperature. When the user selects, “User Specified Setpoint” then a control that provides a tabular input is presented. In this case, the user can directly input a table of temperature vs time data that specifies how the setpoint changes with time. However, if the user specifies “Use Model Entity as Setpoint” then the user is presented a geometry picker similar to the controls above to select a location in the model that will define the setpoint temperature. When this option is selected, the PID controller will function more like a follower element. That is, it will try to cause the monitor location to “follow” another location in the model by adding or removing energy from the heat source/sink location. The offset value allows the user to specify a DC offset that they would like to apply to the setpoint value. Internally, this offset term will be incorporated into the constraint equation averaging method to add in the DC offset.

Finally, the last control group allows the user to visualize plots of computed information regarding the PID controller after the solution is finished. Normally this would be presented in the results branch of the tree; however, the results I would like to present for these elements don’t map cleanly to the results objects in ACT. (At least, I can’t map them cleanly in my mind…) More detail on the results will be presented below.

So, now that we know what the control UI does, let’s look at how to specify it in ACT

### Specifying the UI in XML

As mentioned at the beginning, ACT relies on XML to specify the UI for controls. The following XML snippet describes the entire UI.

<extension version=“1” name=“ThermalTools”>

<guid shortid=“thermaltools”>852acb16-4731-4e91-bd00-b464be02b361</guid>

<script src=“thermaltools.py” />

<interface context=“Mechanical”>

<images>images</images>

<callbacks>

<oninit>initThermalToolsToolbar</oninit>

</callbacks>

<toolbar name=“thermtools” caption=“Thermal Tools”>

caption=“PID Thermostat Control”>

<callbacks>

</callbacks>

</entry>

</toolbar>

</interface>

<simdata context=“Mechanical”>

<callbacks>

<getcommands location=“post”>writePIDThermostatPost</getcommands>

<onremove>removePIDThermostat</onremove>

<onsuppress>suppressPIDThermostat</onsuppress>

<onunsuppress>unsuppressPIDThermostat</onunsuppress>

<oncleardata>cleardataPIDThermostat</oncleardata>

</callbacks>

<property name=“ConnectionGeo”  caption= “Heat Source/Sink Location”

control=“scoping”>

<attributes selection_filter=“vertex|edge|face” />

</property>

<property name=“MonitorGeo”  caption= “Temperature Monitor Location”

control=“scoping”>

<attributes selection_filter=“vertex|edge|face|body” />

</property>

<propertygroup name=“ControlProperties” caption=“Thermostat Control Properties”

display=“caption”>

<property name=“ControlType” caption=“Control Type”

control=“select” default=“Both Heat Source and Sink”>

<attributes options=“Heat Source,Heat Sink,Both Heat Source and Sink”/>

</property>

<property name=“ProportionalGain” caption=“Proportional Gain”

control=“float” default=“0”/>

<property name=“IntegralGain” caption=“Integral Gain”

control=“float” default=“0”/>

<property name=“DerivativeGain” caption=“Derivative Gain”

control=“float” default=“0”/>

</propertygroup>

<propertygroup name=“SetpointProperties” caption=“Thermostat Setpoint Properties”

display=“caption”>

<propertygroup name=“SetpointType” display=“property” caption=“Setpoint Type”

control=“select” default=“User Specified Setpoint”>

<attributes options=“User Specified Setpoint,Use Model Entity as Setpoint”/>

<propertytable name=“SetPointTemp” caption=“Thermostat Set Point Temperature”

display=“worksheet” visibleon=“User Specified Setpoint”

control=“applycancel” class=“Worksheet.PropertyGroupEditor.PGEditor”>

<property name=“Time” caption=“Time” unit=“Time” control=“float”></property>

<property name=“SetPoint” caption=“Set Point Temperature”

unit=“Temperature” control=“float”></property>

</propertytable>

<property name=“SetpointGeo”  caption= “Setpoint Geometry”

visibleon=“Use Model Entity as Setpoint” control=“scoping”>

<attributes selection_filter=“vertex|edge|face|body” />

</property>

</propertygroup>

<property name=“SetpointOffset” caption=“Offset” control=“float” default=“0”/>

</propertygroup>

<propertygroup name=“Results” caption=“Thermostat Results” display=“caption”>

<property name=“ViewResults” caption=“View Results?” control=“select” default=“No”>

<attributes options=“Yes,No”/>

<callbacks>

<onvalidate>onViewPIDResults</onvalidate>

</callbacks>

</property>

</propertygroup>

</simdata>

</extension>

Describing this in detail would take far longer than I have time for now, so I’m going to direct you to the ACT documentation. The gist of it is fairly simple though. XML provides a structured, hierarchical mechanism for describing the layout of the UI. Nested structures appear as child widgets of their parents. Callbacks are used within ACT to provide the hooks into the UI events so that we can respond to various user interactions. Beyond that, read the docs!! And, hey, before I hear any whining remember that in the old days of Jscript customization there wasn’t any documentation! When I was a Workbench Customization Kid we had to walk uphill, both ways, barefoot, in 8’ of snow for 35 miles… So shut it!

### Making the Magic Happen

So, the UI is snazzy and all, but the heavy lifting really happens under the hood. Ultimately, what ACT provides us, when we are creating new BCs for ANSYS, is a clever way to insert APDL commands into the ds.dat input stream. Remember that at its core all Mechanical is, is a glorified APDL generator. I’m sure the developers love me reducing their hard labor to such mundane terms, but it is what it is… So, at the end of the day, our little ACT load objects are nothing more than miniature APDL writers. You thought we were doing something cool…

So, the magic happens when we collect up all of the input data the user specifies in our snazzy UI and turn that into APDL code that implemented the PID controller. This is obviously why I started by developing the APDL code first outside of WB. The APDL code is the true magic. Collecting up the user inputs and writing them to the ds.dat file occurs inside the getcommands callback. If you look closely at the XML code, you will notice two getcommands callbacks. The first one calls a python function named: writePIDThermostatLoad. This callback is scheduled to fire when Mechanical is finished writing all of the standard loads and boundary conditions that it implements natively and is about to write the first APDL solve command. Our commands will end up in the ds.dat file right at this location. I chose this location for the following reason. Our APDL code for the PID thermostat will be generating new element types and new nodes and elements not generated by Workbench. Sometimes workbench implements certain boundary conditions using surface effect element types. So, these native loads and boundary conditions themselves may generate new elements and element types. Workbench knows about those, because it’s generating them directly; however, it has no idea what I might be up to in my PID thermostat load. So, if it were to write additional boundary conditions after my PID load, it very well might reuse some of my element type ids, and even node/element ids. The safer thing to do is to write our APDL code so that it is robust in the presence of an unknown maximum element type/real constant set/node number/etc… Then, we insert it right before the solve command, after WB has written all of its loads and boundary conditions. Thus, the likelihood of id collisions is greatly reduced or eliminated.

Note, too, that ACT provides some utility functions to generate a new element type id and increment the internal counter within Workbench; however, I have found that these functions do not account for loads and boundary conditions. Therefore, in my testing thus far, I haven’t found them safe to use.

The second getcommands callback is setup to fire when Workbench finishes writing all of the solve commands and has moved to the post processing part of the input stream. I chose to implement a graphing functionality for displaying the relevant output data from the PID elements. Thus, I needed to retrieve this data from ANSYS after the solution is complete so that I can present it to the user. I accomplished this by writing a little bit of APDL code to enter /post26 and export all of the data I wish to plot to a CSV file. By specifying this second getcommands callback, I could instruct Workbench to insert the APDL commands after the solve completed.

### Viewing the Results

Once the solution has completed, clicking on the “View Results?” dropdown and choosing “Yes” will bring up the following result viewer I implemented for the PID controller. All of the graphing functionality is provided by ACT in an import module called “chart”. This result viewer is simply implemented as a dialog with a single child control that is the ACT chart widget. This widget also allows you to layout multiple charts in a grid, as we have here. As you can see, we can display all of the relevant output data for the controls cleanly and efficiently using ACT! While this can also be accomplished in ANSYS Mechanical APDL, I think we would all agree that the results are far more pleasing visually when implemented in ACT.

## Where Do We Go from Here?

Now that I’ve written an ACT module, my next steps are to clean it up and try to make it a little more production ready. Once I’m satisfied with it, I’ll publish it on this blog and on the appropriate ANSYS library. Look for more posts along the way if I uncover additional insights or gotchas with ACT programming. I will leave you with this, however. If you have put off ACT programming you really should reconsider! Being mostly new to ACT, I was able to get this little boundary condition hooked up and functioning in less than a week’s time. Given the way the user interface turned out and the flexibility thus far of the control, I’m quite pleased with that. Without the documentation and general availability of ACT, this effort would have been far more intense. So, try out ACT! You won’t be disappointed.

## ACT Extension for a PID Thermostat Controller (PART 1)

I’m going to embark on a multipart blog series chronicling my efforts in writing a PID Thermostat control boundary condition for workbench. I picked this boundary condition for a few of reasons:

1. As far as I know, it doesn’t exist in WB proper.
2. It involves some techniques and element types in ANSYS Mechanical APDL that are not immediately intuitive to most users. Namely, we will be using the Combin37 element type to manage the control.
3. There are a number of different options and parameters that will be used to populate the boundary condition with data, and this affords an opportunity to explore many of the GUI items exposed in ACT.

This first posting goes over how to model a PID controller in ANSYS Mechanical APDL.  In future articles I will share my efforts to refine the model and us ACT to include it in ANSYS Workbench.

## PID Controller Background

Let’s begin with a little background on PID controllers. Full disclaimer, I’m not controls engineer, so take this info for what it is worth. PID stands for Proportional Integral Differential controller. The idea is fairly simple. Assume you have some output quantity you wish to control by varying some input value. That is, you have a known curve in time that represents what you would like the output to look like. For example:

The trick is to figure out what the input needs to look like in time so that you get the desired output. One way to do that is to use feedback. That is, you measure the current output value at some time, t, and you compare that to what the desired output should be at that time, t. If there is no difference in the measured value and the desired value, then you know whatever you have set the input to be, it is correct at least for this point in time. So, maybe it will be correct for the next moment in time. Let’s all hope…

However, chances are, there is some difference between what is measured and what is desired. For future reference we will call this the error term. The secret sauce is what to do with that information? To make things more concrete, we will ground our discussion in the thermal world and imagine we are trying to maintain something at a prescribed temperature. When the actual temperature of the device is lower than the desired temperature, we will define that as a positive error. Thus, I’m cold; I want to be warmer: that equals positive error. The converse is true. I’m hot; I want to be colder: that equals negative error.

One simple way we could try to control the input would be to say, “Let’s make the input proportional to the error term.” So, when the error term is positive, and thus I’m cold and wish to be warmer, we will add energy proportionate to the magnitude of the error term. Obviously the flip side is also true. If I’m hot and I wish to be cooler my negative error term would mean that remove energy proportionate to the magnitude of the error term. This sounds great! What more do you need? Well, what happens if I’m trying to hold a fixed temperature for a long time? If the system is not perfectly adiabatic, we still have to supply some energy to make up for whatever the system is losing to the surroundings. Obviously, this energy loss occurs even with the system is in a steady state configuration and at the prescribed temperature! But, if the system is exactly at the prescribed temperature, then the error term is zero. Anything proportionate to zero is… zero. That’s a bummer. I need something that won’t go to zero when my error term goes to zero.

What if I could keep a record of what I’ve done in the past? What if I accumulated all of the past error from forever? Obviously, this has the chance of being nonzero even if instantaneously my error term is zero. This sounds promising. Integrating a function of time with respect to time is analogous to accumulating the function values from history past. Thus, what if I integrated my error term and then made my input also proportional to that value? Wouldn’t that help the steady state issue above? Sure it would. Unfortunately, it also means I might go racing right on by my set point and it might take a while for that “mistake” to wash out of the system. Nothing is free. So, now I have kept a record of my entire past and used that to help me in the present, what if I could read the future? What if could extrapolate out in time?

Derivatives allow us to make a local extrapolation (in either direction) about a curve at a fixed point. So, if my curve is a function of time, which in our case the curves are, forward extrapolation is basically jumping ahead into the future. However, we can’t truly predict the future, we can only extrapolate on what has recently happened and make the leap of faith that it will continue to happen just as it has. So, if I take the derivative of my error term with respect to time, I can roll the dice a little a make some of my input proportional to this derivative term. That is, I can extrapolate out in time. If I do it right, I can actually make the system settle out a little faster. Remember that when the error term goes to zero and stays there, the derivative of the error term also goes to zero. So, when we are right on top of our prescribed value this term has no bearing on our input.

So, a PID controller simply takes the three concepts of how to specify an input value based on a function of the error term and mixes them together with differing proportions to arrive at the new value for the input. By “tuning” the system we can make it such that it responds quickly to change and it doesn’t wildly overshoot or oscillate.

## Implementing a PID controller in ANSYS MAPDL

We will begin by implementing a PID controller in MAPDL before moving on to implementing the boundary condition in ANSYS Workbench via the ACT. We would like the boundary condition to have the following features:

1. Ultimately we would like to “connect” this boundary condition to any number of nodes in our model. That is, we may want to have our energy input occur on a vertex, edge or face of the model in Workbench. So, we would like the boundary condition to support connecting to any number of nodes in the model.
2. Likewise, we would like the “measured output” to be influenced by any number of nodes in our model. That is, if more than one node is included in the “measured value” set, we would like ANSYS to use the average temperature of the nodes in that set as our “measured output”. Again, this will allow us to specify a vertex, edge, face or body of the model to function as our measurement location. The measured value should be the average temperature on this entity. Averaging needs to be intelligent. We need to weight the average based on some measure that accounts for the relative influence of a node attached to large elements vs one attached to small elements.
3. We would like to be able to independently control the proportional, integral and derivative components of the control algorithm.
4. It would be nice to be able to specify whether this boundary condition can only add energy, only remove energy or if it can do both.
5. We would like to allow the set point value to also be a function of time so that it too can change with time.
6. Finally, it would be nice to be able to post process some of the heat flow quantities, temperature values, etc… associated with this boundary condition.

This is a pretty exhaustive list of requirements for the boundary condition. Fortunately, ANSYS MAPDL has built into it an element type that is perfectly suited for this type of control. That element type is the combin37.

## Introducing the Combin37 Element Type

Understanding the combin37 element in ANSYS MAPDL takes a bit of a Zen state of mind… It’s, well, an element only a mother could love. Here is a picture lifted from the help:

OK. Clear as mud right? Actually, this thing can act as a thermostat whether you believe me from the picture or not. Like most/all ANSYS elements that can function in multiple roles, the combin37 is expressed in its structural configuration. It is up to you and me to mentally map it to a different set of physics. So, just trust me that you can forget the damping and FSLIDE and little springy looking thing in the picture. All we are going to worry about is the AFORCE thing. Mentally replace AFORCE with heat flow.

Notice those two little nodes hanging out there all by their lonesome selves labeled “control nodes”. I think they should have joysticks beside them personally, but ANSYS didn’t ask me. Those little guys are appropriately named. One of them, NODE K actually, will function as our set point node. That is, whatever temperature value we specify in time for NODE K, that same value represents the set point temperature we would like our “measured” location take on in time as well. So, that means we need to drive NODE K with our set point curve. That should be easy enough. Just apply a temperature boundary condition that is a function of time to that node and we’re good to go. Likewise, NODE L represents the “measured” temperature somewhere else in the model. So, we need to somehow hook NODE L up to our set of measurement nodes so that it magically takes on the average value of those nodes. More on that trick later.

Now, internally the combin37 subtracts the temperature at NODE K from NODE L to obtain an error term. Moreover, it allows us to specify different mathematical operations we can perform on the error term, and it allows us to take the output from those mathematical operations and drive the magical AFORCE thingy, which is heat flow. Guess what those mathematical operations are? If you guessed simply making the heat flow through the element proportional to the error, proportional to the time integral of the error and proportional to the time derivative of the error you would be right. Sounds like a PID controller doesn’t it? Now, the hard part is making sense of all the options and hooking it all up correctly. Let’s focus on the options first.

## Key Option One and the Magic Control Value

Key option 1 for the combin37 controls what mathematical operation we are going to perform on the error term. In order to implement a full PID controller, we are going to need three combin37 elements in our model with each one keyed to a different mathematical operation. ANSYS calls the result of the mathematical operation, Cpar. So, we have the following:

 KEYOPT(1) Value Mathematical Operation 0,1 2 3 4 5

Thus, for our purposes, we need to set keyopt(1) equal to 1,4 and 2 for each of the three elements respectively.

Feedback is realized by taking the control parameter Cpar and using it to modify the heat flow through the element, which is called AFORCE. The AFORCE value is specified as a real constant for the element; however, you can also rig up the element so that the value of AFORCE changes with respect to the control parameter. You do this by setting keyopt(6)=6. The manner in which ANSYS adjusts the AFORCE value, which again is heat flow, is described by the following equation:

Thus, the proportionality constant for the Proportional, Integral and Derivative components are specified with the C1 variable. RCONST, C3 and C4 are all set to zero. C2 is set to 1. Also note that ANSYS first takes the absolute value of the control parameter Cpar before plugging it into this equation. Furthermore, the direction of the AFORCE component is important. A positive value for AFORCE means that the element generates an element force (heatflow) in the direction specified in the diagram.  That is, it acts as a heat sink. So, assuming the model is attached to node J, the element acts as a heat sink when AFORCE is positive. Conversely, when AFORCE is negative, the element acts like a heat source. However, due to the absolute value, Cpar can never take on a negative value. Thus, when this element needs to act as an energy source to add heat to our model, the coefficient C1 must be negative. The opposite is true when the element needs to act as an energy sink.

## Key Option Four and Five and when is it Alive?

If things weren’t confusing enough already, hold on as we discuss Keyopt 4 and 5. Consider the figure below, again lifted straight from the help.

The combination of these two key options controls when the element switches on and becomes “alive”. Let’s take the simple case first. Let’s assume that we are adding energy to the model in order to bring it up to a given temperature. In this case, Cpar will be positive because our set point is higher than our current value. If the element is functioning as a heat source we would like it to be on in this condition. Furthermore, we would like it to stay on as long as our error is positive so that we continue adding energy to bring the system up to temperature. Consider the diagram in the upper left. Imagine that we set ONVAL = 0 and OFFVAL = 0.001. Whenever Cpar is greater than ONVAL.  So this sounds like exactly what we want when the element is functioning as a heat source. Thus, keyopt(4)=0 and keyopt(5)=0.001 with OFFVAL=ONVAL=0 is what we want when the element needs to function as a heat source.

What about when it is a heat sink?  In this case we want the element to be active when the error term is negative; that is, when the current temperature is higher than the set point temperature.  Consider the diagram in the middle left.  This time let OFFVAL=0 and OFFVAL=-0.001.  In this case, whenever Cpar is negative (less than OFFVAL) then the element will be active.  Thus, keyopt(4)=0 and keyopt(5)=1 with OFFVAL=-0.001 ONVAL=0 is what we want when the element needs to function as a heat sink.  Notice, that if you set ONVAL=OFFVAL then the element will always stay on; thus, we need to provide the small window to activate the switching nature of the element.

Thus, we see that we need six different combin37 elements, three for a PID controlled heat sink and three for a PID controlled heat source, to fully specify a PID controlled thermal boundary condition. Phew… However, if we set all of the proportionality constants for either set of elements defining the heat sink or heat source to zero, we can effectively turn the boundary condition into only a heat source or only a heat sink, thus meeting requirement four listed above. While we’re marking off requirements, we can also mark off requirements three and five. That is, with this combination of elements we can independently control the P, I and D proportionality constants for the controller. Likewise, by putting a time varying temperature constraint on control node K, we can effectively cause the set point value to change in time. Let’s see if we can now address requirements one and two.

## How do we Hook the Combin37 to the Rest of the Model?

We will address this question in two parts. First, how do we hook the “business” end of the combin37 to the part of the model to which we are going to add or remove energy? Second, how do we hook the “control” end of the combin37 to the nodes we want to monitor?

## Hooking to the Combin37 to the Nodes that Add or Remove Energy

To hook the combin37 to the model so that we can add or remove energy we will use the convection link elements, link34. These elements effectively act like little thermal resistors with the resistance equation being specified as:

In order to make things nice, we need to “match” the resistances so that each node effectively sees the same resistance back to the combin37 element. We do this by varying the “area” associated with each of these convective links. To get the area associated with a node we use the arnode() intrinsic function. See the listing for details.

## Hooking the Combin37 to the Nodes that Function as the Measured Value

As we mentioned in our requirements, we would like to be able to specify more than one or more nodes to function as the measured control value for our boundary condition. More precisely, if more than one node is included in the measurement node set, we would like ANSYS to average the temperatures at those nodes and use that average value as the measurement temperature. This will allow us to specify, for example, the average temperature of a body as the measurement value, not just one node on the body somewhere. However, we would also like for the scheme to work seamlessly if only one node is specified. So, how can we accomplish this? Constraint equations come to our rescue.

Remember that a constraint equation is defined as:

How can we use this to compute the average temperature of a set of nodes, and tie the control node of the combin37 to this average? Let’s begin by formulating an equation for the average temperature of a set of nodes. We would like this average to not be simply a uniform average, but rather be weighted by the relative contribution a given node should play in the overall average of a geometric entity. For example, assume we are interested in calculating the average temperature of a surface in our model. Obviously this surface will have associated with it many nodes connected to many different elements. Assume for the moment that we are interested in one node on this face that is connected to many large elements that span most of the area of this face. Shouldn’t this node’s temperature have a larger contribution to the “average” temperature of the face as say a node connected to a few tiny elements? If we just add up the temperature values and divide by the number of nodes, each node’s temperature has equal weight in the average. A better solution would be to area weight the nodal temperatures based on the area associated with each individual node. Something like:

That looks a little like our constraint equation. However, in the constraint equation I have to specify the constant term, whereas in the equation above, that is the value (Tavg) that I am interested in computing. What can I do? Well, let’s add in another node to our constraint equation that represents the “answer”. For convenience, we’ll make this the control node on our combin37 elements since we need the average temperature of the face to be driving that node anyway. Consider:

Now, our constant term is zero, and our Ci’s are Ai/AT and -1 for the control node. Voila! With this one constraint equation we’ve compute an area weighted average of the temperature over a set of nodes and assigned that value to our control node. CE’s rock!

## An Example Model

This post is already way too long, so let’s wrap things up with a little example model. This model will illustrate a simple PI heat source attached to an edge of a plate with a hole. The other outer edges of the plate are given a convective boundary condition to simulate removing heat. The initial condition of the plate is set to 20C. The set point for the thermostat is set to 100C. No attempt is made to tune the PI controller in this example, so you can clearly see the effects of the overshoot due to the integral component being large. However, you can also see how the average temperature eventually settles down to exactly the set point value.

The red squiggly represents where heat is being added with the PI controller. The blue squiggly represents where heat is being removed due to convection. Here is a plot of the average temperature of the body with respect to time where you can see the response of the system to the PI control.

Here is another run, where the set point value ramps up as well. I’ve also tweaked the control values a little to mitigate some of the overshoot. This is looking kind of promising, and it is fun to play with. Next time we will look to integrate it into the workbench environment via an actual ACT extension.

Part 2 is here

Model Listing

I’ve included the model listing below so that you can play with this yourself. In future posts, I will elaborate more on this technique and also look to integrate it into an ACT module.

finish

/clear

/prep7

*get,etmax_,etyp,0,num,max

P_et=etmax_+1

I_et=etmax_+2

D_et=etmax_+3

mass_et=etmax_+5

et,P_et,combin37

et,I_et,combin37

et,D_et,combin37

et,mass_et,mass71

Kp=1

Ki=2

Kd=0

keyopt,P_et,1,0    ! Control on UK-UL

keyopt,P_et,2,8    ! Control node DOF is Temp

keyopt,P_et,3,8    ! Active node DOF is Temp

keyopt,P_et,4,0    ! Wierdness for the ON/OFF range

keyopt,P_et,5,0    ! More wierdness for the ON/OFF range

keyopt,P_et,6,6    ! Use the force, Luke (aka Combin37)

keyopt,P_et,9,0    ! Use the equation, Duke (where is Daisy…)

keyopt,I_et,1,4    ! Control on integral wrt time

keyopt,I_et,2,8    ! Control node DOF is Temp

keyopt,I_et,3,8    ! Active node DOF is Temp

keyopt,I_et,4,0    ! Wierdness for the ON/OFF range

keyopt,I_et,5,0    ! More wierdness for the ON/OFF range

keyopt,I_et,6,6    ! Use the force, Luke (aka Combin37)

keyopt,I_et,9,0    ! Use the equation, Duke (where is Daisy…)

keyopt,D_et,1,2    ! Control on first derivative wrt time

keyopt,D_et,2,8    ! Control node DOF is Temp

keyopt,D_et,3,8    ! Active node DOF is Temp

keyopt,D_et,4,0    ! Wierdness for the ON/OFF range

keyopt,D_et,5,0    ! More wierdness for the ON/OFF range

keyopt,D_et,6,6    ! Use the force, Luke (aka Combin37)

keyopt,D_et,9,0    ! Use the equation, Duke (where is Daisy…)

keyopt,mass_et,3,1 ! Interpret real constant as DENS*C*Volume

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!        S M A L L   T E S T   M O D E L       !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

test_et=etmax_+10

et,test_et,plane55

mp,kxx,test_et,70

mp,dens,test_et,8050

mp,c,test_et,0.4

! Thickness of plate

r,test_et,0.1

! Plane55 element

keyopt,test_et,3,3

! Make a block

k,1

k,2,1,0

k,3,1,1

k,4,0,1

a,1,2,3,4

! Make a hole

cyl4,0.5,0.5,0.25

! Punch a hole

asba,1,2

type,test_et

mat,test_et

real,test_et

esize,0.025

amesh,all

! create an nodal component for the

! ‘attachment’ location

lsel,s,loc,x,0

nsll,s,1

cm,pid_attach_n,node

! create a nodal component for the

! ‘monitor’ location

allsel,all

cm,pid_monitor_n,node

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!        B E G I N   P I D   M O D E L         !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

! Real constant and mat prop for the mass element

mp,qrate,mass_et,0 ! Zero heat generation rate for the element

r,mass_et,1e-10  ! Extremely small thermal capacitance

! Material properties for convection element

! make the convection “large”

! Real constant for the combin37 elements

! that ack as heaters

on_val_=0

off_val_=1e-3

r,P_et,0,0,0,on_val_,off_val_,0

rmore,0,1,-Kp,1

r,I_et,0,0,0,on_val_,off_val_,0

rmore,0,1,-Ki,1

r,D_et,0,0,0,on_val_,off_val_,0

rmore,0,1,-Kd,1

! build the PID elements

*get,nmax_,node,0,num,max

BASE_NODE=nmax_+1

P_NODE_J=nmax_+2

I_NODE_J=nmax_+3

D_NODE_J=nmax_+4

NODE_K=nmax_+5

NODE_L=nmax_+6

! Create the nodes.  They can be all coincident

! as we will refer to them solely by their number.

! They will be located at the origin

*do,i_,1,6

n,nmax_+i_

*enddo

! Put a thermal mass on the K and L nodes

! for each control element to give them

! thermal DOFs

type,mass_et

mat,mass_et

real,mass_et

e,NODE_K

e,NODE_L

! Proportional element

type,P_et

mat,P_et

real,P_et

e,BASE_NODE,P_NODE_J,NODE_K,NODE_L

! Integral element

type,I_et

mat,I_et

real,I_et

e,BASE_NODE,I_NODE_J,NODE_K,NODE_L

! Derivative Element

type,D_et

mat,D_et

real,D_et

e,BASE_NODE,D_NODE_J,NODE_K,NODE_L

! Ground the base node

d,BASE_NODE,temp,0

! Get a list of the attachment nodes

cmsel,s,pid_attach_n

*get,numnod_,node,0,count

attlist_=

*dim,attlist_,,numnod_

*vget,attlist_(1),node,0,nlist

*get,rmax_,rcon,0,num,max

! Hook the attachment nodes to the

! end of the control element with

*do,i_,1,numnod_

n1_=attlist_(i_)

a1_=arnode(n1_)

r1_=rmax_+i_

r,r1_,a1_

real,r1_

e,P_NODE_J,n1_

e,I_NODE_J,n1_

e,D_NODE_J,n1_

*enddo

! Hook up the monitor nodes

cmsel,s,pid_monitor_n

*get,numnod_,node,0,count

monlist_=

monarea_=

*dim,monlist_,,numnod_

*dim,monarea_,,numnod_

*vget,monlist_(1),node,0,nlist

! We are going to need these areas

! so, hold on to them

*do,i_,1,numnod_

monarea_(i_)=arnode(i_)

*enddo

*vscfun,totarea_,sum,monarea_(1)

! Write the constraint equations

/pbc,ce,,0

ce,next,0,NODE_L,temp,-1

*do,i_,1,numnod_

ce,high,0,monlist_(i_),temp,monarea_(i_)/totarea_

*enddo

! Create a transient setpoint temperature

*dim,setpoint_,table,2,,,time

setpoint_(1,0)=0

setpoint_(2,0)=3600

setpoint_(1,1)=100

setpoint_(2,1)=100

! Constrain the temperature node to be

! at the setpoint value

allsel,all

d,NODE_K,temp,%setpoint_%

! Apply an initial condition of

! 20 C to everything

allsel,all

ic,all,temp,20

/solu

antype,trans,new

time,1000

deltim,1,1,1

lsel,s,loc,x,0.1,1

nsll,s,1

sf,all,conv,20,20

allsel,all

outres,all,all

solve

/post26

! Plot the response temperature

! and the setpoint temperature

nsol,2,NODE_L,temp,,temp_r

nsol,3,NODE_K,temp,,temp_s

xvar,1

plvar,2,3

## ANSYS, Inc. Unleashes New ACT Extensions for Version 15.0

If you haven’t noticed, ANSYS, Inc. has been making quite a few ACT extensions available for ANSYS 15.0 on the ANSYS Customer Portal. If you are not familiar with ACT (ANSYS Customization Toolkit) Extensions, please see our earlier blog entry, “There’s an Extension for That,” here.

As of this writing, there are 20 ACT extensions available for download from the Customer Portal for version 15.0. There is also a set of training files available from the same link.

Among the new additions is an extension allowing the use of Mechanical APDL User Programmable Features in the Mechanical editor. Previously this could only be done in MAPDL. You will still need to install the customization files as part of the ANSYS installation, and you will still need the proper versions of the FORTRAN compiler and Visual Studio. However, this extension unleashes a significant capability within the Workbench Mechanical tool that wasn’t there previously, access to UPF’s.

The documentation states that it works with both versions 14.5 and 15.0 of ANSYS.
To get to the 15.0 ACT Extensions download area, login to the ANSYS Customer Portal and navigate through Downloads > Extension Library > 15.0. We urge you to browse the list of available extension available from the Customer Portal to see which might have benefits to your simulations.

Here is a list of all of the current extensions:

ACT Intro Training_R150_v1

ACT Introductory Training Materials

ACT Templates for DM_R150_v1

Templates for educational purpose; demonstrates most common scenarios of ACT-based development needs in DesignModeler

ACT Templates for DX_R150_v1

Templates for educational purpose; demonstrate integration of external optimizers

ACT Templates_R150_v1

Templates for educational purpose; cover most common ACT-based development needs

Acoustics Extension R150_v42

Expose 3D acoustics solver capabilities

Convection Extension_R150_v4

Expose convection with pilot node capability in steady-state and transient thermal analyses

Coupled Diffusion_R150_v3

Introduce coupled diffusion analysis (structural diffusion, thermal diffusion, and structural thermal diffusion) in both static and full transient analysis

Coupled Field Physics Extension_R150_v1

Expose piezoelectric, thermal-piezoelectric and thermal-structural solver capabilities

DDAM_R150_v2

Expose the Dynamic Design Analysis Method (DDAM) in Mechanical interface

Design Modeler Utility_R150_v1

Expose some useful functions in DM interface

Distributed Mass_R150_v2

Add distributed mass (rather than a point mass) to a surface as either “total mass” or “mass per unit area”

Enforced Motion_R150_v3

In Mode-Superposition Harmonic and Transient Analyses, allows applying base excitation (displacement or acceleration). Excitation can be either constant or frequency/time dependent

FE Info Extension_R150_v9

Expose node and element related information

Map temperature and pressure loads (from a CFD calculation) to a multi-step Mechanical analysis for transient one-way FSI. Includes CFD-Post macros

Create follower forces and moments to follow geometric deformation

Hydrostatic Fluid_R150_v5

Expose hydrostatic fluid elements in Mechanical

MATLAB_Optimizers_for_DX_R150_v1

Expose MATLAB optimization algorithms and user programs in the Optimization component of ANSYS DesignXplorer

MatChange_R150_v2

Change material ID to user specified value for the selected bodies

Offshore_R150_v4

Expose the MAPDL offshore features in Mechanical

Piezo Extension_R150_v8

Expose piezo-electric solver capabilities

UPF Extension_R150_v1

Allow for the use of User Programmable Features (UPF) within Workbench

## Be a View Master: Customizing and Managing Views in ANSYS Mechanical

Accessing various predefined views in Mechanical is easy. You can click on the triad axes (including the negative sides of the axes) and view the model down those axes, or click the turquoise isometric ball for an isometric view. Or you can right click the graphics area and select from a variety of views (top, back, left, etc.) from the View menu.

But what if you want a predefined view that has the model rotated “just so” and zoomed out “just so?” What if you want to store these settings not just in your current model, but bring them into other models as well? Starting in R14.5 you can do this, using the Manage Views window.

To open the Manage Views window, click on the eye-in-a-box icon that looks like it was designed by Freemasons. The Managed Views window appears at the lower left of the GUI. The window consists of the following:

The labels are pretty self-explanatory, but let’s delve into a couple of examples. As you can see by observing the triad, the model viewpoint shown here does not coincide with any pre-defined view.

Click the Create a View button and give the view a name (defaults to View 1 but any name can be given):

After rotating, panning, and zooming, you can return to this view by clicking the Apply a View button.

As mentioned before, you can apply the same view between different models by using the View Export/Import capabilities. To do this, simply highlight the named view to be exported in the originating model and click the Export button. Specify the xml file to which the view is to be stored. In another model, click the Import button and browse to the xml file containing the view to be imported. This is basically the Mechanical equivalent of an APDL file containing /VIEW and /ZOOM commands. Example follows.

The following view is to be stored and exported to another model. Highlight the view name (“Sulk”) and click the Export button.

Frankie the Frowning Finite Element Model worries that views can’t be shared between models.

Specify the xml file name and click Save.

In a different model, click the Import button, browse to the xml stored in the previous step, and click open.

Highlight the imported view name and click the Apply a View button.

Sammy the Smiling Simulation Model is happy that views can be transferred between models.

The Managed Views window provides a significant amount of viewing versatility over the standard viewing definitions.

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

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

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

3D 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:  writstl.zip

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

```/*
---------------------------------------------------------------------------

Design Technologies

---------------------------------------------------------------------------
---------------------------------------------------------------------------

Package: ans2stl

File: ans2stl.c
Args: rootname
(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.

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

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

COMPILE:
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.
---------------------------------------------------------------------------
*/
/*======================================================

SAMPLE ANSYS INPUT DECK THAT SHOWS USAGE

finish
/clear
/file,a2stest
/PREP7
!----------
! Build silly geometry
BLC4,-0.6,0.35,1,-0.75,0.55
SPH4,-0.8,-0.4,0.45
CON4,-0.15,-0.55,0.05,0.35,0.55
!------------------------
! Mesh surface with non-solved (MESH200) triangles
et,1,200,4
MSHAPE,1,2D   ! Use triangles for Areas
MSHKEY,0      ! Free mesh
SMRTSIZE,,,,,5
AMESH,all
!----------------------
! Write out nodes and elements
nwrite,a2stest,node
ewrite,a2stest,elem
!--------------------
! Execute the ans2stl program
/sys,ans2stl_win.exe a2stest

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

#include
#include
#include

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 getnorm();

/*--------------------------------*/
main(argc,argv)
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");
exit(1);
}
sprintf(nfname,"%s.node",argv[1]);
sprintf(efname,"%s.elem",argv[1]);
sprintf(sfname,"%s.stl",argv[1]);

nf = nelem;

sfile = fopen(sfname,"wb");
swapit(&nelem,s4);    fwrite(s4,4,1,sfile);

for(i=0;i<nelem;i++){
i1 = np[ie[0][i]];
i2 = np[ie[1][i]];
i3 = np[ie[2][i]];
getnorm(&xn,&yn,&zn,i1,i2,i3);

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);
fwrite(s4,2,1,sfile);
}
fclose(sfile);
puts(" ");
printf("  STL Data Written to %s.stl \n",argv[1]);
puts("  Done!!!!!!!!!");
exit(0);
}

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

for(i=0;i<3;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]);
}
char    *fname;
{
long num,i;
FILE *nfile;
char    string[256],s1[7];

num = 0;
nfile = fopen(fname,"r");
if(!nfile){
puts(" error on element file open, bye!");
exit(1);
}
while(fgets(string,86,nfile)){
for(i=0;i<8;i++){
strncpy(s1,&string[6*i],6);
s1[6] = '\0';
sscanf(s1,"%d",&ie[i][num]);
}
num++;
}

return(num);
}

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

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

}
while(fgets(string,100,nfile)){
sscanf(string,"%d ",&nval);
switch(nval){
case(-888):
typeflag = 1;
break;
case(-999):
typeflag = 0;
break;
default:
np[nval] = num;
if(typeflag){
sscanf(string,"%d %g %g %g",
&ifoo,&coord[0][num],&coord[1][num],&coord[2][num]);
}else{
sscanf(string,"%d %g %g %g",
&ifoo,&coord[0][num],&coord[1][num],&coord[2][num]);
fgets(string,81,nfile);
}
num++;
break;
}

}
return(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];
}```

ans2stl_win_2014_01_28.zip

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

et,999,200,4

type,999

esurf,all

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

/copy,file,rst,,stl_temp,rst

/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

upgeom,1000,,,stl_temp,rst

!

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.

/copy,stl_temp,stl,,stl_temp,stl,..\..

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

/COPY FILE FROM FILE= file.rst

TO FILE= stl_temp.rst

FILE file.rst COPIED TO stl_temp.rst

1

***** ANSYS – ENGINEERING ANALYSIS SYSTEM RELEASE 15.0 *****

ANSYS Multiphysics

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

valve_stl–Static Structural (A5)

***** ANSYS ANALYSIS DEFINITION (PREP7) *****

ELEMENT TYPE 999 IS MESH200 3-NODE TRIA MESHING FACET

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

CURRENT NODAL DOF SET IS UX UY UZ

THREE-DIMENSIONAL MODEL

ELEMENT TYPE SET TO 999

GENERATE ELEMENTS ON SURFACE DEFINED BY SELECTED NODES

TYPE= 999 REAL= 1 MATERIAL= 1 ESYS= 0

NUMBER OF ELEMENTS GENERATED= 13648

USING FILE stl_temp.rst

THE SCALE FACTOR HAS BEEN SET TO 1000.0

USING FILE stl_temp.rst

ESEL FOR LABEL= TYPE FROM 999 TO 999 BY 1

13648 ELEMENTS (OF 43707 DEFINED) SELECTED BY ESEL COMMAND.

SELECT ALL NODES HAVING ANY ELEMENT IN ELEMENT SET.

6814 NODES (OF 53895 DEFINED) SELECTED FROM

13648 SELECTED ELEMENTS BY NELE COMMAND.

WRITE ALL SELECTED NODES TO THE NODES FILE.

START WRITING AT THE BEGINNING OF FILE stl_temp.node

6814 NODES WERE WRITTEN TO FILE= stl_temp.node

WRITE ALL SELECTED ELEMENTS TO THE ELEMENT FILE.

START WRITTING AT THE BEGINNING OF FILE stl_temp.elem

Using Format = 14(I6)

13648 ELEMENTS WERE WRITTEN TO FILE= stl_temp.elem

SYSTEM=

c:\temp\ans2stl_win.exe stl_temp

STL Data Written to stl_temp.stl

Done!!!!!!!!!

/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

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.

Note:
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 ( ). 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 HVPC w8i-KGPU
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
NVIDIA TESLA K20x
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.

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

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

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

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

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

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

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

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

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

## 10: 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).

## Thoughts

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.