32.1.1. Solver Performance with UDFs

UDFs are interpreted by Ansys Polyflow’s interpreter, which is part of the CLIPS package, originally developed at NASA. Each time the UDF is called, CLIPS will perform a number of tasks, such as build argument lists, and so on. This will generally result in a reduction of Ansys Polyflow’s speed.

Also, Ansys Polyflow’s building of stiffness matrices requires the computation of numerical derivatives of the equations that are based on UDFs. These tasks can be CPU-intensive, and for this reason Ansys Polyflow has been optimized so that the number of UDF calls per element is minimized. Acceleration tables and approximations of derivatives are used to reduce the number of needed calls.

It is not possible to give an exact figure for the performance penalty of using UDFs, since the performance strongly depends upon the number of arguments, the complexity of the function and the context in which it is used. For EVOL-based UDFs, you can expect only a small performance penalty.

For PMAT-based UDFs, on a 3D mesh with 5000 elements, the overhead of using a CLIPS-based function is on the order of 20% for a UDF with a small number of variables, mostly because of the need to compute numerical derivatives. This percentage can be larger for 2D problems (especially viscoelastic problems where the CPU time required to build finite-element matrices is large) or when a small number of elements is used. Because UDFs for boundary conditions are called once per evolution step, the performance penalty is negligible.