LS-DYNA can be customized with ACT (Ansys Customization Toolkit). You can create interactions between user-defined extensions and the LS-DYNA system. You can create objects or features for custom preprocessing in the context of Ansys Mechanical. Custom postprocessing is not supported.
This section assumes some degree of familiarity with ACT. Other Ansys guides provide related information:
For an introduction to writing scripts for Mechanical, see the Scripting in Mechanical Guide.
For descriptions of all ACT API objects, methods, and properties, see the ACT API Reference Guide.
For information on how to use ACT to create apps (extensions) that customize and automate Ansys products, see the ACT Developer's Guide.
For ACT usage, customization, and automation information specific to Mechanical, see the ACT Customization Guide for Mechanical.
An example of how to set up custom preprocessing is described here.
The following is an example from an XML file that sets up Rigid Bodies and Flexible Bodies categories in the Data panel, each with a Geometry field. The resulting load and Details panel are shown.
<simdata context="Mechanical"> <load name="Forming" version="1" caption="Forming Contact" icon="contact" issupport="false" isload="true" color="#0000FF"> <attributes custom_dyna="Yes"/> <propertygroup name="Rigid Bodies" caption="Rigid Bodies"> <property name="Geometry" control="scoping"> <attributes> <selection_filter>body</selection_filter> </attributes> </property> </propertygroup> <propertygroup name="Flexible Bodies" caption="Flexible Bodies"> <property name="Geometry" control="scoping"> <attributes> <selection_filter>body</selection_filter> </attributes> </property> </propertygroup> <callbacks> <getcommands location="pre" >writeSnippet</getcommands> </callbacks> </load> </simdata>
To enable a custom load for LS-DYNA usage, define the attribute custom_dyna
for the load, and set its value to yes. Additionally, if
the load needs to write information to the solver input file, the callback
getcommands
must be implemented. The getcommands
element
specifies the name of the IronPython function called when Mechanical writes the solver input
file.
<getcommands location = [string] order = [integer]>--> [function(solver,solverdata,stream)]</getcommands>
The solverdata
is a helper structure. It helps integrate user extensions with
LS-DYNA, particularly when the solver commands generated by the extension add entities that
have identifiers, like nodes, elements or components. Through the solverdata
structure, ACT provides an efficient method to manage the newly created IDs of these
entities with the existing IDs previously generated by LS-DYNA. It also enables reuse of
internally implemented keywords like materials or elements.
Note: The syntax shown for the methods is C#.
The following table and sections describe the available solverdata
methods.
Table 7.1: Solverdata Methods
CreateMaterialCreateMaterial |
Two different methods available to create materials for LS-DYNA. |
CreateNewElement |
Method to create an element keyword. |
GetNewPartId |
Method to get an unused part identifier. |
LSDynaSolverExtension.KeyWords.Part.Part CreateNewPart | Method to create a new part keyword. |
CreateSection |
Method to create a new section keyword. |
GetComponent |
Method to get the LS-DYNA equivalent of a mechanical Named Selection. |
GetContactId |
Method to get the solver contact identifier of the contact object. |
GetContactTargetId |
Method to get the solver contact identifier of the contact target object. |
GetCoordinateSystemSolverId |
Method to get the solver coordinate system identifier. |
GetEndTime |
Method to get the simulation end time. |
GetMaterialSolverId |
Method to get the material identifier of a body. |
GetNamedSelectionLSDYNAId |
Method to get the solver named selection identifier. |
GetNewContact |
Method to get an empty contact keyword. |
GetNewCurveId |
Method to get an unused curve identifier. |
GetNewElementId |
Method to get an unused element identifier. |
GetNewElementType |
Method to get an unused part identifier. |
GetNewNodeId |
Method to get an unused node identifier. |
GetNewVectorId |
Method to get an unused vector identifier. |
GetRemotePointNodeId | Method to get the master node identifier for a remote point. |
GetSolverUnitSystem | Method to get the solver unit system. |
ContainsDynamicRelaxation | Method to determine if dynamic relaxation is used in the model. |
CurrentStep | Method to get the current step. |
MaxElementId | Method to get the maximum element identifier. |
MaxElementType | Method to get the maximum part identifier. |
MaxNodeId | Method to get the maximum node identifier. |