AceGen and AceFEM

Share this on social media:

AceGen is a third-party Mathematica package from Joze Korelc, a professor at the University of Ljubljana’s faculty of civil and geodetic engineering, for automatically deriving numerical procedures formulae. A number of different techniques are combined to shorten the evolution route and the results can be exported as compiled FORTRAN or C code with automated interfacing. AceFEM, from the same source, is a finite element methods package offering parallel options for either manual exploration of behaviour or high speed black box computation of results. AceGen is set up to talk with other numerical environments, including its sibling AceFEM. Each package combines use of Mathematica’s facilities with external handling of intensive computation by compiled modules.


AceGen develops the approach of an earlier package called SMS (Symbolic Mechanics System), also by Korelc, dubbed ‘Simultaneous Stochastic Simplification of numerical code’ (SSS hereafter). The ‘simultaneous’ in SSS refers to optimisation of expressions as the solution is derived, instead of waiting until derivation is complete. A system of auxiliary variables, stored in an internal database and used to replace component expressions as they are found, reduces complexity on the fly. Where a new structure is found, it is assigned a new auxiliary variable, which is stored for reuse. This containment, in turn, reduces process volume and provides the execution speed benefit.


Quite apart from efficiency, the algebraic tools available in symbolic products like Mathematica do not (yet, at least) cope with either very large expressions or separated components within them. Through its external SSS treatment, AceGen is not just adding speed to Mathematica but manipulative capability too.



Examples from the documentation of AceGen (left document pane) and AceFEM (right document pane) are run in Mathematica.



In test use on past problems, AceGen showed a significant performance edge over previously used methods in most cases, though that is only half of the point: a significant part of the appeal is that it brings such methods under the control of an existing symbolic environment rather than requiring outport to new surroundings. You can manipulate and control this power from within Mathematica, either interactively or from source files; even if it only matched previous efficiency, it would still be well worth investigation.


Similar observations and considerations from the user viewpoint apply to AceFEM. Interaction (input, graphic output, solutions procedure control) are retained within Mathematica, but impressively high efficiency results from letting external components handle the computations out of sight, with communication between the parts via Mathlink.


Elements are stored in DLLs (Dynamic Link Libraries) from the C version (CDriver) of the numerical module or ‘m’ files if the Mathematica version (MDriver) is run. The choice of which way to go depends on relative importance of efficiency versus interactivity, with MDriver providing a richly rewarding way to explore the structure and behaviour of relatively small sets ( I ran it up to 27 unknowns without problems; the documentation recommends ‘less than 100’) while CDriver offers ‘several hundred thousand’ unknowns. I haven’t tested the limits, but can confirm from experiment that ‘several’ certainly exceeds two. There is a library of predefined elements or you can design new ones yourself (probably using MDriver) then debug and test them (for which AceGen is a good choice).

Before closing it’s worth mentioning that when I hit a problem (unique to my system and not, in itself, likely to interest or bother anyone else) support was immediate and effective – which is an important software value attribute in itself.