GeMA
The GeMA main application
ScriptsLib Reference

Through the combined use of standard Lua functions and the rich set of functions provided by GeMA itself, a great deal of flexibility is possible both while describing what will be simulated (the model file) and while defining how it will be simulated through the orchestration script (at the solution file).

Nevertheless, some patterns of usage are common to many problems and the set of operations needed for easily supporting those patterns can be packaged in functions.

The scripts library is just a set of auxilliary functions, all of them wiritten in Lua using only the same set of functions available to every GeMA simulation, that can speedup the writing of model files and the execution of common operations at the orchestration script.

Some of those functions are tailored for being used at the model file, while the simualtion data is being loaded, and others at the orchestration phase. The function documentation states its intended usage.

Available functions are divided in the folllowing libraries, grouped by purpose:

  • meshLib.lua: A set of utilitary functions for creating 2D and 3D, "grid like", meshes, add interface elements to 2D meshes and save meshes to model files.
  • fileLib.lua: A set of utilitary functions for working with paths and file names, also providing operations for creating, removing, renaming, copying and listing files and directories.
  • dumpLib.lua: A set of utilitary functions to help on the creation of state dumps during the execution of a simulation and for recovering a state from a dump file.
  • stressFunctionsLib.lua: A set of functions for providing node and cell user functions for calculating derived stress results (like principal stresses) from the physics calculated values.
  • vtkLib.lua: A set of utilitary functions for saving mesh data in vtk file format.
  • couplingLib.lua: A set of utilitary functions to run coupled simulations using some black box simulators.

To enable the use of any of the previous libraries, they must be loaded with a call to the standard Lua dofile() function, passing as argument the library file name. Their location can be obtained by the $SCRIPTS path macro. This call can be located anywhere in the master simulation file, in the model file or in the solution file, before using any of the functions, and outside of the ProcessScript() function.

Example:

--
-- Loads meshLib functions.
--
dofile('$SCRIPTS/meshLib.lua')