Ansys Mechanical APDL | Performing Thermal Analysis
Offsetting Temperature Results to Degrees Absolute
Users performing thermal analysis occasionally want to change the plotted temperature result to degrees absolute. Or, conversely, to convert a result in degrees absolute into the usual scale.
This article illustrates a small macro that switches a temperature result in degrees Fahrenheit into degrees Rankine by adding 459.67 degrees to the temperature at each selected node. Additionally, the macro can be easily adapted to work with Celsius/Kelvin.
Here, the macro presented uses vectorized commands so that the conversion is quick when dealing with very large FEA models. Its action will typically be faster than a SET command that retrieves a result from the RTH results file for a large model.
Method | Given Temperature Assumptions in the User’s Model
The following macro assumes that a temperature result exists in the user’s model. In addition, the result is usually loaded by a SET command that points to the desired load step and substep. However, it is up to the user to make a suitable selection of elements and nodes (usually the entire model), and to use the SET command to load the thermal result of interest, before applying the macro below to raise the temperatures at nodes by the amount 459.67.
Loading the Thermal Result of Interest
The macro can be easily changed to add 273.15 so that a Celsius result is converted to a Kelvin result.
! Adjust temperature result by +459.67 degrees.
! Method using vectorized commands.
! This adjustment is undone by a SET command.
! Perform some basic error checking
No nodes are selected. Stopping.
No temperature result, node %G. Stopping.
*del,tempvec,,nopr ! In case it exists
! Add the temperature offset, *VPUT into result
! Clean up and plot
/title,Temperatures were offset.
/com, Warning–temperature results of selected nodes were raised.
Plot Title Change to Inform of Temperature Modification
Two checks on the model are performed. There is a check that at least one node is selected, and a check that a temperature result exists for the lowest numbered node. Masking is employed with *VMASK so that a model with gaps in node numbering will work. Minimum to maximum node numbers are used so that the arrays are as small as possible. A plot title change is provided to warn users that the temperatures presented have been modified.
The macro is easily misapplied by a user, such as using it two times in a row, further increasing the temperature values. Another error would be to add to the node selection after running the macro.
Vectorized Commands to Convert Fahrenheit
Vectorized commands could be used to convert between Celsius and Fahrenheit, or to perform other conversions.
A return to the results file temperature is performed if a SET command is executed by the user, preferably with all nodes and elements selected.
The RTH results file is not affected by the above macro.
Many users will want to modify the above macro—it is intended to serve as a starting point for other work. Possible changes could include providing the offset temperature value in a first argument ARG1 for the macro, or providing ARG1 as an integer value that selects the desired temperature conversion type, noting that there are 12 possible conversions among Fahrenheit, Rankine, Celsius and Kelvin.
Conclusions | Offsetting Temperature Results to Degrees Absolute
A small macro can convert temperature results in an Ansys Mechanical APDL analysis. An example has been provided to convert degrees Fahrenheit to degrees Rankine. Vectorizing the commands employed lets the macro run very quickly with large FEA models.
Correct use of such a macro is up to the user. The example presented is intended as a starting point for whatever other conversions might be wanted.