Autodyn Users Subroutines Guide
Autodyn Users Subroutines Guide
ANSYS, ANSYS Workbench, AUTODYN, CFX, FLUENT and any and all ANSYS, Inc. brand, product, service and feature
names, logos and slogans are registered trademarks or trademarks of ANSYS, Inc. or its subsidiaries located in the
United States or other countries. ICEM CFD is a trademark used by ANSYS, Inc. under license. CFX is a trademark
of Sony Corporation in Japan. All other brand, product, service and feature names or trademarks are the property
of their respective owners. FLEXlm and FLEXnet are trademarks of Flexera Software LLC.
Disclaimer Notice
THIS ANSYS SOFTWARE PRODUCT AND PROGRAM DOCUMENTATION INCLUDE TRADE SECRETS AND ARE CONFID-
ENTIAL AND PROPRIETARY PRODUCTS OF ANSYS, INC., ITS SUBSIDIARIES, OR LICENSORS. The software products
and documentation are furnished by ANSYS, Inc., its subsidiaries, or affiliates under a software license agreement
that contains provisions concerning non-disclosure, copying, length and nature of use, compliance with exporting
laws, warranties, disclaimers, limitations of liability, and remedies, and other provisions. The software products
and documentation may be used, disclosed, transferred, or copied only in accordance with the terms and conditions
of that software license agreement.
ANSYS, Inc. and ANSYS Europe, Ltd. are UL registered ISO 9001: 2015 companies.
For U.S. Government users, except as specifically granted by the ANSYS, Inc. software license agreement, the use,
duplication, or disclosure by the United States Government is subject to restrictions stated in the ANSYS, Inc.
software license agreement and FAR 12.212 (for non-DOD licenses).
Third-Party Software
See the legal information in the product help files for the complete Legal Notice for ANSYS proprietary software
and third-party software. If you are unable to access the Legal Notice, contact ANSYS, Inc.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. iii
User Subroutines Guide
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
iv of ANSYS, Inc. and its subsidiaries and affiliates.
List of Tables
1.1. Material Modeling User Subroutines ....................................................................................................... 1
1.2. Additional User Subroutines ................................................................................................................... 1
3.1. User Subroutine Calling Sequence Types ............................................................................................... 18
3.2. User Subroutine Calling Sequence Descriptions ..................................................................................... 18
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. v
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
vi of ANSYS, Inc. and its subsidiaries and affiliates.
Chapter 1: User Subroutine Guide Introduction
This manual shows you how to create and use your own user subroutines in Autodyn. Topics covered
include:
Autodyn provides you with a number of standard alternatives for options such as Equations of State,
Yield Models, Boundary Conditions, and so on. However, you may wish to use your own custom models
for these options. Autodyn allows you to do this by including your own subroutines written in Fortran.
This guide shows you how to include these subroutines in your calculations and offers guidelines on
writing user subroutines. Table 1.1: Material Modeling User Subroutines (p. 1) and Table 1.2: Additional
User Subroutines (p. 1) show the user subroutines that are available for use with Autodyn.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 1
User Subroutine Guide Introduction
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
2 of ANSYS, Inc. and its subsidiaries and affiliates.
Chapter 2: How to Invoke User Subroutines
To explain how user subroutines are invoked in Autodyn we will look at a specific example. Most user
subroutines require a specification of user for a particular input specification. However, some user sub-
routines are always called as discussed in Timing of Calls to User Subroutines (p. 18).
In the following example, a sample user subroutine (supplied with the ANSYS install) is used to
demonstrate how to create a user subroutine project, compile a user subroutine into a custom Autodyn
executable, launch the custom-compiled Autodyn executable, and finally run a model which invokes
the user subroutine.
Use the options on the Plots menu to see the material locations and boundary conditions for the
problem. You will see that the problem consists of a tantalum cylinder impacting a rigid wall:
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 3
How to Invoke User Subroutines
Now select the Materials menu, and Review the material data for TANTALUM. You will notice that a
Von Mises yield model has been specified for this material. This model allows you to define a constant
yield stress.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
4 of ANSYS, Inc. and its subsidiaries and affiliates.
Suppose that instead of keeping it constant (Von Mises), you want to make the yield stress a function
of the effective plastic strain.
First click Modify. In the resulting dialog, expand the Strength section and inspect the available options
for yield models. The option Piecewise exists, which could be used to describe such a relationship.
However, in the interests of illustrating user subroutines, a user subroutine displaying the same behavior
as the piecewise strength model will be used in the ensuing sections. Therefore you will supply your
own custom yield model. To enable the use of the strength model user subroutine, change the selected
yield option from Von Mises to User Strength #1:
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 5
How to Invoke User Subroutines
You can now input the variables Shear Modulus (SC(1)), and SC(2) through SC(11), to be used in the
MD_STR_USER_1 module. Note that these predefined parameters are only present for demonstration
and can be tailored in terms of number of parameters, names, and units. It is also possible to add your
own option list and parameters from many of the existing standard Autodyn strength models.
The use of the input parameters allows you to code and link your user subroutine once, and then change
variable input values through Autodyn input. The user specifies the usage of these parameters in the
MD_STR_USER_1 module.
For the moment, enter a Shear Modulus of 0.692 as before with the Von Mises model, so that you can
close and save the data for the Tantalum material.
Save the model and press Run. The error dialog displayed below will be shown because no user sub-
routine has been written and compiled for User Strength #1. This will be done in the following steps.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
6 of ANSYS, Inc. and its subsidiaries and affiliates.
1. Save the model, then navigate to the Options menu and select Create User-Subroutine Project. You will
be prompted to choose a directory in which the user subroutine project will be created. After the user
subroutine project is created, navigate to the directory where it resides. You will see a folder called Autodyn
user_subroutines.
2. A user-subroutine for this example has already been created, and is located in the install directory in the
folder \v201\aisol\Samples\AUTODYN. Copy the file MDSTR_USER_1.tut to MDSTR_USER_1.f90
in the fsrc directory in the Autodyn user subroutines folder created in Step 1, selecting Yes if asked
whether to overwrite the existing file.
3. Navigate back to the Autodyn user_subroutines folder. Here you will find a solution file called
ad_usrsub.sln. On Windows, launch this file in Visual Studio (or another IDE) and build the solution
(for Linux see Linking your own User Subroutines on Linux Platforms (p. 30)). This will build both an
Autodyn executable and a slave executable (for parallel processing) which have the custom user subroutine
built in. Launch the resulting compiled master executable (ad_usrsub.exe).
4. Open the file user_strength_example_0 that was saved in Step 1. First head back to the materials
menu and select Modify. You will see that the parameters have changed in the strength section (see image
below). These parameters can be modified to change the material properties.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 7
How to Invoke User Subroutines
5. Press Run, and the problem will solve. The effects of changing the strength model from the user subroutine
can be tested by changing the parameters and observed within Autodyn.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
8 of ANSYS, Inc. and its subsidiaries and affiliates.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 9
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
10 of ANSYS, Inc. and its subsidiaries and affiliates.
Chapter 3: Writing Your Own User Subroutines
There are no absolute rules for writing your own user subroutines. What we will do here is to outline
some of the techniques that may be used and the tools that are available to help create user subroutines.
If we look at the examples given in User Subroutine Examples (p. 95), we will see some of the common
techniques and tools used to create user subroutines. These include:
• Accessing global variables in the Autodyn modules (for example: time, material data, cycle number, and so
on)
• Accessing Part grid variables (for example: pressure, density, velocity, and so on)
In order to link user subroutines on a Linux system, we recommend this version of the GCC compiler:
GNU GCC 6.3.0. As a convenience, you can download this compiler from the ANSYS, Inc. customer site:
1. From the ANSYS customer site, www.ansys.com/customercommunity, click Downloads > Current Release.
3. Select Primary Packages from the Select Download Type drop-down menu.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 11
Writing Your Own User Subroutines
For example:
setenv PATH <installed_location>/linux-toolchain-6.3.0/bin:$PATH (for csh/tcsh shell)
export PATH=<installed_location>/linux-toolchain-6.3.0/bin:$PATH (for sh/bash shell)
ANSYS Inc\v201\aisol\AUTODYN\<platform>
\fsrc
\2d\usrsub2.f90 Autodyn-2D specific user subroutines
\3d\usrsub3.f90 Autodyn-3D specific user subroutines
\material\mdeos_user_1.f90 User equation of state
mdstr_user_1.f90 User strength model
mdfai_user_1.f90 User failure model
mdero_user_1.f90 User erosion model
On the Windows operating systems, the following Intel/.NET project files should be used:
…..\AUTODYN\<platform>
\ad_usrsub.sln Intel/.NET Solution
\ad_usrsub.vfproj Intel/.NET Fortran project
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
12 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn Variables
The dummy subroutines have USE statements already defined for the most often required global data.
Also, the comments indicate which variables in these modules are likely to be of use.
Caution:
Be extremely careful if you modify variables other than the user variables (VAR01 through
VAR20), and that the modified values are consistent with the use of the variables. Global
variables are used by other routines and assigning bad values to them could cause Autodyn
to terminate unexpectedly.
There are two basic types of data storage and access used in Autodyn depending on whether you are
using the IJK based or Unstructured solvers. These are described in the sections:
3.5.1. IJK Solvers
3.5.2. Unstructured Solvers/Elements
3.5.3. Notes About Autodyn Variables
Grid variable arrays and pointers are defined in module mdgrid (p. 59) for 2D and mdgrid3 (p. 61)
for 3D. The listings for Autodyn-2D and Autodyn-3D give all grid variables and their associated
pointer names. Autodyn Variable Listings (p. 77) provides a definition of these variables. The grid arrays
and pointer names are used to reference all grid variables either:
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 13
Writing Your Own User Subroutines
By way of illustration, if we want to access the x-velocity at a particular (I,J,K) in the currently processed
Part in Autodyn-3D, we would include the mdgrid3 module in our subroutine:
USE mdgrid3
For node (I,J,K) of the current Part, we can obtain the index, IJK, for this node by including the state-
ment:
IJK = IJKSET3(I,J,K)
Note:
Then we can obtain the required velocity, XVEL, either directly through the array reference or by using
a function:
Direct: XVEL = UXN(IJK)
Where NUXN is the pointer index for the X-velocity array. GV3 (p. 22) is an Autodyn-3D function
which retrieves the specified variable value from the current Part (the equivalent Autodyn-2D function
is simply GV (p. 22)). The various Autodyn functions such as IJKSET3 (p. 21) and GV3 (p. 22) are de-
scribed in detail in Autodyn Utility Functions/Subroutines (p. 21).
Normally, the direct reference approach is recommended. This works best when there is a current
Part (NSUB) (see Timing of Calls to User Subroutines (p. 18)). For references to Parts other than current,
use of the functions is recommended.
In the Euler Godunov processor in 3D, the access to the dynamic memory management is slightly
different than the other processors. While, the function GV3 (p. 22) can be called as described before,
the direct access method uses Fortran90 pointers. Thus, to reference the x velocity for a 3D Euler
Godunov cell:
Direct: XVEL = MTSUB(IJK)%V(NNUXN)
The variable NNUXN is contained in the module mdgrid3 (p. 61). Any specific Euler Godunov variable
index is defined by NNname, where name is the Autodyn-3D internal variable name (see Autodyn-
3D – Structured (IJK) Solvers (p. 82)).
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
14 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn Variables
where
index_layer is the layer (integration point) number for each element. For single point integrated
solid elements index_layer can be selected as either 0 or 1. For shell elements index_layer defines
the shell sublayer number.
index_material indicates the material that is being referred to on a given node. For all nodes,
except NBS tetrahedral nodes, index_material can be selected as either 0 or 1. For NBS tetrahedral
nodes index_material defines the material number.
These functions copy data from the underlying data structures to local arrays. These arrays contain
the values of all possible variables. Only the variables used by the element/node identified in the
above calls will actually be set. To access these local arrays you will need to include
USE mdvar_all
RVL(index_var) will contain all real variables for the element/node
IVL(index_var) will contain all integer variables for the element/node
The values of index_var required to access a particular variable can be can be obtained through
the Output, Save, Review variables, Review all unstructured variables option in the interface.
For example, to retrieve the internal energy for an element, you could use the statement
INT_ENERGY = RVL(IVR_INT_ENERGY)
Only variables that are actually used in the analysis can be retrieved using the RVL(...) option. The
variables available depend on the element types and materials used in an analysis, and can be reviewed
through the Output, Save, Review variables, Review used unstructured variables option in the
interface.
The values of the variables in the array RVL and IVL can be updated and stored by first setting the
updated value in the RVL or IVL array: for example,
RVL(IVR_INT_ENERGY)= NEWVAL
This will place all the new data set for variables in the array RVL and IVL back into permanent main
storage for this element or node respectively.
Note:
• The values of user variables VAR01 to VAR20 can also be updated and stored by first setting
the updated value in the RVL array and then use the function PUT_ELEM_VAR to place the new
values back in permanent main storage for the element.
• See Access to Nodal Variables within an Element (p. 108) for an elaborated example on how to
retrieve and store element and nodal variables.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 15
Writing Your Own User Subroutines
If GET_ELEM_VAR (p. 23) is called for an element other than the one currently being processed in
the solver (or for a shell sublayer that differs from the current one being processed), it will not be
possible to tell whether the values in RVL for that element are from the current or the previous
computational cycle.
The above methods for retrieving and updating unstructured element or node data require the
global index_elem or index_node as input. For material modeling user subroutines, the index
of the current element will be available via
USE mdstring
Index_elem = ELEM_NOW
For other cases, there are a number of ways in which one can obtain the internal index for an element:
for example, direct access, looping over Parts, looping over a Group. Examples of various types of
element/node access are given by example in Unstructured Element Data Access (p. 105).
Where IJK is the index of the cell. After the call is made, the cell variables may be accessed according
to the following table:
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
16 of ANSYS, Inc. and its subsidiaries and affiliates.
Material Modeling User Subroutines
where
matno is the material number for a given material. These material numbers are assigned in sequence
when defining your problem, starting with 1.
You can determine what the material number is for a given material name by testing against the MA-
TERIALS(matno)%NAME array (see the examples in User Subroutine Examples (p. 95)).
In Autodyn-3D, the GETV3 (p. 23) function provides a functional method for accessing multi-material
variables without use of GETMLT3 (p. 25). This is discussed in Autodyn Utility Functions/Sub-
routines (p. 21).
Note that to save updated values of multi-material variables, a call PUTMLT3(IJK,0) must be made after
setting the data in the internal arrays listed above.
For Lagrange, ALE, Shell, SPH and Beam solvers of Autodyn-3D it is also possible to access and set data
in the material arrays directly using the following procedure: after setting IJK for each cell, use the call
ML => MTSUB(IJK)%V(1:NUMMLV)
This sets-up the pointer ML to look at the material data for the current cell. This data can be accessed
and set directly by addressing the appropriate index of the ML pointer array. For example, to set mater-
ial damage to one and internal energy to zero, we could now use
ML(NCDM) = 1.0
ML(NCEN) = 0.0
This direct method of access is significantly more efficient than using the GETMLT3 (p. 25)/PUTM-
LT3 (p. 25) calls in Autodyn-3D.
Routine Description
Nam_USER_1 A module to allow the user to define variables that can be defined
and accessed in any of the routines below (or anywhere with the
USE nam_USER_1 statement)
Init_nam_USER_1 A subroutine that allows the user to define the input parameters
for the material modeling option.
check_nam_USER_1 A subroutine that allows the user to perform checks on the input
data for the user model, during input of the data.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 17
Writing Your Own User Subroutines
Routine Description
Set_nam_USER_1 A subroutine to get the material input data from the internal
Autodyn data structures and assign local variables as required.
solve_nam_USER_1 A subroutine in which the user writes his material modeling
algorithm
Further details on how to implement material modeling user subroutines are given in the example user
subroutine in Subroutine MDSTR_USER_1 (p. 95).
For Types 3-7, a current Part (NSUB) is defined, such that variables may be directly referenced through
their array name and index (for example, UXN(IJK)). For other types, the user is advised to use the
Autodyn utility functions to obtain variables.
The table below provides a description of when the major user subroutines are called.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
18 of ANSYS, Inc. and its subsidiaries and affiliates.
Timing of Calls to User Subroutines
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 19
Writing Your Own User Subroutines
Note:
In situations where the extra subroutine is always called, with no user specification required,
the default dummy subroutines are programmed to have no effect.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
20 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn Utility Functions/Subroutines
Usage:
IJKSET3(I,J,K)
Purpose:
Gets the IJK index of node/zone (I,J,K) relative to the current Part.
Usage:
IJSET(I,J)
Purpose:
Gets the IJ index of node/zone (I,J) relative to the current Part
Usage:
IJKSETS3(I,J,K,N)
Purpose:
Gets the IJK index of node/zone (I,J,K) relative to all Parts, where N is the Part number (in order of
definition, starting with 1). See How to Determine the Part Number from the Part Name (p. 26) for ex-
ample of how to obtain Part number from a Part name.
Usage:
IJSETS(N,I,J)
Purpose:
Gets the IJ index of node/zone (I,J) relative to all Parts, where N is the Part number (in order of defin-
ition, starting with 1). See How to Determine the Part Number from the Part Name (p. 26) for example
of how to obtain Part number from a Part name.
Usage:
CALL IJANDK3 (IJKIN,I,J,K) ; IJKIN is input, I,J, and K are output
Purpose:
Gets the I,J, and K indices for IJK relative to the current Part.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 21
Writing Your Own User Subroutines
Usage:
CALL IANDJ (IJIN,I,J) ; IJIN is input, I and J are output
Purpose:
Gets the I and J indices for IJ relative to the current Part.
Usage:
CALL IJANDKS3 (IJKSIN,I,J,K) ; IJKSIN is input, I,J, and K are output
Purpose:
Gets the I,J, and K indices for IJK relative to the all Parts.
Usage:
CALL IANDJS (IJSIN,I,J,M,IJKL);IJSIN is input, I,J,M and IJKL are output
Purpose:
Gets the I and J indices for IJK relative to the all Parts. Also output is the Part number M and the local
IJK for that Part.
FUNCTION GV
Usage:
GV (NV,IJK) / GV3(NV,IJK)
Purpose:
Gets the value of Part variable NV for the node IJK relative to current Part. See modules mdgrid (p. 59)
and mdgrid3 (p. 61) for a list of values for NV.
FUNCTION GVS
Usage:
GVS (NV,IJKS) / GVS3(NV,IJKS)
Purpose:
Gets the value of Part variable NV for the node IJKS relative to all Parts. See module mdgrid (p. 59)
for a list of values for NV.
SUBROUTINE PUTGVS
Usage:
CALL PUTGVS(NV,IJKS,VALUE) / CALL PUTGVS3(NV,IJKS,VALUE)
Purpose:
Puts (stores) the VALUE of Part variable NV for the node/zone IJKS (relative to all Parts) in the dynamic
storage arrays.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
22 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn Utility Functions/Subroutines
Usage:
GETV3 (NV,IJK,MODE)
Purpose:
This is a general function that gets the variable NV for zone IJK for the current Part. Depending on
the value of MODE the following actions are taken:
MODE<0 : gets volume weighted average over all materials for multimaterial variable NV
FUNCTION NPK
Usage:
NPK (NV,IJK) / NPK3 (NV,IJK)
Purpose:
Gets the value of integer Part variable NV for the node IJK relative to current Part. See module md-
grid (p. 59) for list of index values for NV. To be used instead of GV (p. 22) when the variable is an integer
and not a real number.
FUNCTION NPKS
Usage:
NPKS (NV,IJKS) / NPKS3 (NV,IJKS)
Purpose:
Gets the value of integer Part variable NV for the node IJKS relative to all Parts. See module md-
grid (p. 59) for list of values for NV. To be used instead of GVS (p. 22) when the variable is an integer
and not a real number.
SUBROUTINE PUTNPKS
Usage:
CALL PUTNPKS(NV,IJKS,NVALUE) / CALL PUTNPKS3(NV,IJKS,NVALUE)
Purpose:
Puts (stores) the integer NVALUE of Part variable NV for the node/zone IJKS (relative to all Parts) in
the dynamic storage arrays. To be used instead of PUTGVS (p. 22) when the variable is an integer and
not a real number.
SUBROUTINE GET_ELEM_VAR
Usage:
CALL GET_ELEM_VAR(INDEX_ELEM,INDEX_LAYER)
Purpose:
INDEX_ELEM is the current global element number normally available via ELEM_NOW. INDEX_LAYER
is the current element layer for the current element. For solid elements this number has to be set to
0 or 1 else the local storage of variables is not properly retrieved. Copies the data from main storage
into local vector RVL (real data), IVL (integer data) accessible via
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 23
Writing Your Own User Subroutines
USE mdvar_all
To find the index of the variable in these vectors see Autodyn Variable Listings (p. 77). See also
Unstructured Solvers/Elements (p. 14) for more information.
SUBROUTINE PUT_ELEM_VAR
Usage:
CALL PUT_ELEM_VAR(INDEX_ELEM,INDEX_LAYER)
Purpose:
INDEX_ELEM is the current global element number normally available via ELEM_NOW. INDEX_LAYER
is the current element layer for the current element. For solid elements this number has to be set to
0 or 1 else the local storage of variables is not properly retrieved. Copies the data to main storage from
local vector RVL (real data), IVL (integer data) accessible via
USE mdvar_all
To find the index of the variable in these vectors see Autodyn Variable Listings (p. 77). See also
Unstructured Solvers/Elements (p. 14) for more information.
SUBROUTINE GET_NODE_VAR
Usage:
CALL GET_NODE_VAR(INDEX_NODE,INDEX_MATERIAL)
Purpose:
INDEX_NODE is the current global node number which can be retrieved via ELEM_NOW (see Access
to Nodal Variables for NBS Tetrahedral Elements (p. 109)) INDEX_MATERIAL is normally set to either
0 or 1. For NBS nodes, this indicates the material that is being referred to on this specific node (see the
example Access to Nodal Variables for NBS Tetrahedral Elements (p. 109)). Copies the data from main
storage into local vector RVL (real data), IVL (integer data) accessible via
USE mdvar_all
To find the index of the variable in these vectors see Autodyn Variable Listings (p. 77). See also Unstruc-
tured Solvers/Elements (p. 14) for more information.
SUBROUTINE PUT_NODE_VAR
Usage:
CALL PUT_NODE_VAR(INDEX_NODE,INDEX_MATERIAL)
Purpose:
INDEX_NODE is the current global node number which can be retrieved via ELEM_NOW (see Access
to Nodal Variables for NBS Tetrahedral Elements (p. 109)) INDEX_MATERIAL is normally set to either
0 or 1. For NBS nodes, this indicates the material that is being referred to on this specific node (see the
example Access to Nodal Variables for NBS Tetrahedral Elements (p. 109)). Copies the data to main
storage from local vector RVL (real data), IVL (integer data) accessible via
USE mdvar_all
To find the index of the variable in these vectors see Autodyn Variable Listings (p. 77). See also
Unstructured Solvers/Elements (p. 14) for more information.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
24 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn Utility Functions/Subroutines
SUBROUTINE GETMLT
Usage:
CALL GETMLT(IJK,0) / GETMLT3(IJK,0)
Purpose:
Gets the individual cell values of the multi-material variables for each material in the cell for the node
IJK. See Accessing Multiple Material Data – All IJK Solvers (p. 16) for more information.
SUBROUTINE PUTMLT
Usage:
CALL PUTMLT(IJK,0) / PUTMLT3(IJK,0)
Purpose:
Stores the updated cell values of the multi-material variables for each material in the cell for the node
IJK. See Accessing Multiple Material Data – All IJK Solvers (p. 16) for more information.
SUBROUTINE ADQUIT
Usage:
CALL ADQUIT ('Message to be displayed')
Purpose:
Terminates Autodyn execution immediately.
Example:
CALL ADQUIT ('Error #1 in routine EXEOS')
SUBROUTINE GETYON
Usage:
CALL GETYON (YON, 'Question')
Purpose:
Presents a question in the message area and awaits a yes/no answer. YON is the answer (Y or N, no
other input is accepted). Maximum text length is 80 characters.
Example:
CHARACTER*1 YON
CALL GETYON (YON, 'Stop run - are you sure?')
IF (YON=='Y') STOP
SUBROUTINE USR_MESSAG
Usage:
CALL USR_MESSAG ('message to be displayed')
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 25
Writing Your Own User Subroutines
Purpose:
Displays a message in the message window.
SUBROUTINE USR_ERROR
Usage:
CALL USR_ERROR (‘title’,'message to be displayed')
Purpose:
Displays a message in the message window.
Example:
CALL USR_ERROR (‘Warning !’,’Inconsistent strength model parameters’)
A better way to terminate execution is to call subroutine ADQUIT (p. 25) described in the previous
section. This will return you to the operating system in an orderly manner.
If want to stop executing a problem without quitting Autodyn you can do this by setting the wrapup
switch, NSWRAP equal to 99. A non-zero value of NSWRAP (found in module WRAPUP (p. 73)) will cause
Autodyn to stop execution at the end of the current cycle and return the user to the main menu. If
NSWRAP is set equal to 99, the message
Problem terminated by user subroutine
is displayed upon wrapup. Since the calculation will continue to the end of the cycle, it is necessary to
set the return parameters of your user subroutine to reasonable values so that they can be used, if ne-
cessary, without consequence for the current cycle.
3.11. How to Determine the Part Number from the Part Name
Sometimes it may be desirable to know the Part number for a particular Part. Part numbers are assigned
in their order of definition, starting with one. Structured and Unstructured Parts are contained and
stored in different constructs;
Structured Parts:
If you want the Part number associated with a specific Part name, the following coding will obtain that
number (NSB) :
USE SUBDEF
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
26 of ANSYS, Inc. and its subsidiaries and affiliates.
Variables Available through F90 Modules
END DO
! ERROR, PART NOT FOUND
IF (NSB= = 0) CALL USR_ERROR (‘ERROR !’, ‘PART NOT FOUND’)
If you are writing a user subroutine called within the computational cycle (types 3 and 5), the current
Part number (NSUB) will already be set (module subdef (p. 71)). You can then simply test the Part
names, for example NAMSUB(NSUB), to determine if the Part is the one you wish to perform some
action on.
Unstructured Parts:
USE mdpart
INTEGER(INT4) :: NPART, NPART_WANTED
NPART_WANTED = 0
DO NPART = 1, NUM_PARTS
IF (PARTS(NPART)%P%NAME/=‘Part name’) CYCLE
NPART_WANTED = NPART
END DO
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 27
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
28 of ANSYS, Inc. and its subsidiaries and affiliates.
Chapter 4: Compiling and Running Your User Subroutines
The procedure for linking your own user subroutines into Autodyn varies according to the system on
which you are running. The general procedure is to edit the existing dummy user subroutines, modifying
the appropriate subroutine to implement your modifications. By following the instructions that follow
for your platform, a customized Autodyn version can be created.
Note:
Due to a system limitation, the icons for some user interface buttons may not display correctly
when running a customized version of Autodyn. If the user observes this behavior, moving
the user subroutine folder to a location with a shorter pathname will resolve the issue.
Once the solution is loaded into the development environment, changes to the user subroutine files
can be made and the release and debug customized Autodyn versions can be compiled.
In order to run your customized Autodyn version from within Workbench, you should set the preferences
within Workbench as follows:
• Right click on Autodyn system's Setup cell and from the drop down menu that appears choose Select User
Executable. Navigate to the user compiled executable you wish to use for this Autodyn system.
• To deselect your own user executable and to run the standard Autodyn release version again, right click the
Setup cell of the Autodyn system and from the drop down menu that appears choose Remove user execut-
able.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 29
Compiling and Running Your User Subroutines
You can confirm which executable will be used for a given Autodyn system by right click on the system
Setup cell and select Properties.
If you require debugging of your customized Autodyn version, you must run the program from outside
of the Workbench environment. The development environment solution is setup to allow debugging
of the executables. Ensure that the solution configuration is set to Debug and select Start debugging
from the Debug drop down window.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
30 of ANSYS, Inc. and its subsidiaries and affiliates.
Linking your own User Subroutines on Linux Platforms
/ansys_inc/v201/autodyn/usrsub/linx64
We recommend that this whole directory and its subdirectories are copied to your home directory to
avoid any permissions conflicts when editing and compiling the customized versions on Linux.
Note:
On Red Hat 6.x Linux systems, you must install the following compatibility package in order
for the user subroutines to be compiled and linked correctly :
compat-libstdc++-33-3.2.3-69.el6.x86_64
The files for editing are contained within this directory, and the libraries needed for compilation contained
in the Module subdirectory. A script is supplied for compilation of customized Autodyn executables; to
execute the script, type ./autolnk within the user subroutine directory. This will compile each user
subroutine FORTRAN file in turn, and then link with the Autodyn library to produce a customized
Autodyn executable (and slave executable). Before running the autolnk script, the environment variable
MPI_ROOT should be set, or the path to the Platform MPI directory set in the script. By default, Platform
MPI is installed into the directory:
/ansys_inc/v201/commonfiles/MPI/Platform/9.1.4.3/<platform>
In order to run your customized Autodyn executable, you should set the environment variable CUSTOM-
IZED_AUTODYN to be the full path to the location of the customized Autodyn executables.
For example, for a customized Autodyn executable created in a user’s directory /home/auto-
dyn_user/autodyn/customize, using the C shell, the environment variable is defined by:
setenv CUSTOMIZED_AUTODYN /home/autodyn_user/autodyn/customize
Once this environment variable is set, run the standard Autodyn script (located by default in /an-
sys_inc/v201/autodyn/bin) and the customized executable will be run from the path defined
by the variable.
Note:
In case your customized executable will not run in parallel and provides the error message
"Autodyn License Error - could not find any available licenses",
setting the environment variable ANSYSLMD_LICENSE_FILE might resolve this problem:
In order to return to the standard Autodyn executable, you should be sure to unset the variable by
typing:
unsetenv CUSTOMIZED_AUTODYN
To run a customized parallel Autodyn simulation, the parallel configuration file (parallel.cfg) should
contain the paths for the customized Autodyn executables. Located in the same directory as the cus-
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 31
Compiling and Running Your User Subroutines
tomized Autodyn executables is a script called adslave201. This script sets up the environment variables
at runtime required for the slave to execute. For further information regarding the parallel configuration
files, please see the Autodyn Parallel Processing Guide.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
32 of ANSYS, Inc. and its subsidiaries and affiliates.
Chapter 5: Autodyn User Subroutine Modules
Autodyn modules contain most of the problem variables that a user might require in order to write a
user subroutine. The sections below provide a listing and description of the primary variables of interest.
Note that the listing below is not inclusive of all the Autodyn modules in the program. Also, note that
the modules are delivered in compiled form and therefore cannot be read as text.
Caution:
The user should be very careful about changing the values contained in the standard Autodyn
modules. Such actions may cause unpredictable results.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 33
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
34 of ANSYS, Inc. and its subsidiaries and affiliates.
GLOOPT, Global Options
MODULE fildef
USE kindef
IMPLICIT NONE
SAVE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 35
Autodyn User Subroutine Modules
SAVE
SAVE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
36 of ANSYS, Inc. and its subsidiaries and affiliates.
KINDEF, Constant Variable Definitions
SAVE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 37
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
38 of ANSYS, Inc. and its subsidiaries and affiliates.
MATDEF, Material Definitions
! **************************************************************
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 39
Autodyn User Subroutine Modules
! **************************************************************
IMPLICIT NONE
SAVE
! DEFINE PROCESSOR FLAGS - THESE SHOULD GO IN COMMON GRID MODULE WHEN INTEGRATED
INTEGER(INT4), PARAMETER :: ISLV_LAG = 1
INTEGER(INT4), PARAMETER :: ISLV_EULER = 2
INTEGER(INT4), PARAMETER :: ISLV_ALE = 3
INTEGER(INT4), PARAMETER :: ISLV_SHELL = 4
INTEGER(INT4), PARAMETER :: ISLV_EULER_GOD = 5
INTEGER(INT4), PARAMETER :: ISLV_FCT = 6
INTEGER(INT4), PARAMETER :: ISLV_SPH = 7
INTEGER(INT4), PARAMETER :: ISLV_BEAM = 8
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
40 of ANSYS, Inc. and its subsidiaries and affiliates.
MATDEF, Material Definitions
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 41
Autodyn User Subroutine Modules
For each cell, the following variables are defined, according to the material in that cell:
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
42 of ANSYS, Inc. and its subsidiaries and affiliates.
MATERIAL, Local Material Data
The array MATERIALS is allocated when a new model is loaded into the application.
The data for each material is stored in a type MAT contained in MODULE material. This contains the
following data:
TYPE MAT
! **************************************************************
! DESCRIBES A SET OF EQUATIONS/FLAGS FOR ONE MATERIAL
! NAME - MATERIAL NAME
! REFERENCE - A REFERENCE FOR THE MATERIAL
! NOTES - ADDITIONAL NOTES ON THE MATERIAL
! TYP - TYPE CLASSIFICATION OF MATERIAL (ISOTROPIC, ORTH, GAS ETC)
! RHOREF - SOLID REFERENCE DENSITY FOR MATERIAL
! STIFFMAT - THE MATERIAL STIFFNESS MATRIX (ISOTROPIC MATERIALS ONLY)
! FLAGS - LIST OF POSSIBLE FLAGS (MATERIAL MODELLIGN OPTIONS) ASSOCIATED
! WITH A MATERIAL
! MAIN - PROPERTIES FOR MAIN MODELING OPTIONS, USED TO ASSIST IN UI
! GENERATION
! IFSOLVER - FLAG TO INDICATE WHICH SOLVERS A MATERIAL CAN BE USED WITH
! THIS IS GENERATED AS A SUPERSET OF ALL THE SELECTED MATERIAL
! MODELING OPTION FLAGS
! **************************************************************
CHARACTER(LEN=30) :: NAME
CHARACTER(LEN=256) :: REFERENCE, NOTES
INTEGER(INT4) :: TYP
REAL(REAL8) :: RHOREF
REAL(REAL8), DIMENSION(3) :: STIFFMAT
TYPE(PARAMLIST), DIMENSION(NUMFLAGS) :: FLAGS
TYPE(MAINFLAG), DIMENSION(NFLAGS_MAIN) :: MAIN
INTEGER (INT4), DIMENSION(LIMSOL) :: IFSOLVER
END TYPE MAT
Within each material definition, the array FLAGS contains data for all material modeling options available,
NUMFLAGS. The index of all material modeling options (flags) is specified in matdef. Each option (flag)
has a module associated with it which defines/provides
• input parameters
• variables
• checks
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 43
Autodyn User Subroutine Modules
• equation solution
for that option. For example, IMF_EOS_LINEAR is the flag (index in the FLAGS array) for a linear equation
of state. The input parameters , variables, checks and equation solution for the linear equation of state
are contained within the module mdeos_linear.f90.
Within a PARAMLIST, the real parameters and options are defined through the types given below:
TYPE PRMT
! TYPE DEFINITION FOR A SINGLE MATERIAL INPUT PARAMETER
! NAME - NAME OF PARAMETER AS DISPLAYED IN UI
! D_L - POWER OF LENGTH UNIT
! D_T - POWER OF TIME UNIT
! D_M - POWER OF MASS UNIT
! D_H - POWER OF TEMEPRATURE UNIT
! VAL - CURRENT VALUE
! MIN - MINIMUM ALLOWABLE VALUE
! MAX - MAXIMUM ALLOWABLE VALUE
! DEFAULT - DEFAULT VALUE
! VISIBLE - VISIBILITY OF PARAMETER SWITCH
! REQUIRED - REQUIRED PARAMETER SWITCH
TYPE OPTION
! TYPE DEFINITION FOR A SINGLE MATERIAL INPUT OPTION
! NAME - OPTIONS NAME
! AUTH - AUTHORIZATION CODE
! REF - NAME OF THE REFERENCE FILE ABOUT THIS OPTION
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
44 of ANSYS, Inc. and its subsidiaries and affiliates.
Equation of State (EOS) Variables
TYPE OPTION_LIST
! TYPE DEFINITION FOR AN OPTION LIST
! NAME - OPTION LIST NAME
! NUMOPT - NUMBER OF OPTIONS IN THE LIST
! OPTS - DETAILS OF EACH OPTION
! DEFAULT - DEFAULT OPTION IN THE LIST
! SELETCED - CURRENT SELECTED OPTION
! IPOS - POSITION OF OPTION LIST WITHIN PARAMLIST
! REQUIRED - INDICATES WHETHER AN OPTION MUST BE SPECIFIED OR NOT
CHARACTER (LEN=30) :: NAME
INTEGER (INT4) :: NUMOPT
TYPE (OPTION), DIMENSION(:), POINTER :: OPTS
INTEGER (INT4) :: DEFAULT, SELECTED
INTEGER (INT4) :: IPOS, VISIBLE, REQUIRED
END TYPE
Local pointers used extensively throughout the code to create temporary shortcuts to the material data.
The most common are
MTL => MATERIALS(MATNO)
POINTER TO CURRENT MATERIAL
EQ => MTL%FLAGS(IMF_****)
POINTER TO PARAMETER LIST (FLAG) *** OF MATERIAL MATNO
Subroutine GETMAT sets up the pointer MTL to the current material MATNO. The name of a material
would subsequently be available as MTL%NAME.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 45
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
46 of ANSYS, Inc. and its subsidiaries and affiliates.
Equation of State (EOS) Variables
USE eos_jwl
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 47
Autodyn User Subroutine Modules
PT2 Parameter T2
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
48 of ANSYS, Inc. and its subsidiaries and affiliates.
Equation of State (EOS) Variables
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 49
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
50 of ANSYS, Inc. and its subsidiaries and affiliates.
Strength Model Variables
5.11.14. Compaction
To access local data
USE matdef
USE eos_compaction
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 51
Autodyn User Subroutine Modules
Piecewise Linear
PRETABn Tabular pressure values, n= 1 to 10
YLDTABn Tabular yield stress values, n= 1 to 10
Linear Hardening
SLOPEZ Hardening slope
Stassi Hardening
YLDSTC Yield in uniaxial strain - compressive
YLDSTT Yield in uniaxial strain - tension
KFACT Ratio YLDSTC/YLDSTT
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
52 of ANSYS, Inc. and its subsidiaries and affiliates.
Strength Model Variables
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 53
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
54 of ANSYS, Inc. and its subsidiaries and affiliates.
Crushable Foam (Isotropic)
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 55
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
56 of ANSYS, Inc. and its subsidiaries and affiliates.
Failure Model Variables
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 57
Autodyn User Subroutine Modules
FSLOPE Slope
HEALEXP Heal Exponential
DENFAIL0 Initial Failure Density
FHEAL0 Initial Fraction of Yield
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
58 of ANSYS, Inc. and its subsidiaries and affiliates.
MDGRID, Autodyn-2D Grid Variable Definitions
USE cycvar
USE gloopt
USE subdef
USE material
USE memory
USE microz
USE mltmat
USE prodef
USE kindef
IMPLICIT NONE
SAVE
TYPE MULTI_MATERIAL_POINTERS
TYPE (MULTI_ARRAY), DIMENSION(:), POINTER :: MTS
END TYPE MULTI_MATERIAL_POINTERS
TYPE (MULTI_MATERIAL_POINTERS), DIMENSION(LIMSUB) :: MTGRID
TYPE (MULTI_ARRAY), DIMENSION(:), POINTER :: MTSUB
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 59
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
60 of ANSYS, Inc. and its subsidiaries and affiliates.
MDGRID3, Autodyn-3D Grid Variable Definitions
USE kindef
USE memory
USE cycvar
USE gloopt
USE ijknow
USE subdef
USE mltmat3
USE microz3
USE prodef3
USE euldef
USE eulmem
USE verdef
USE fctshl
IMPLICIT NONE
SAVE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 61
Autodyn User Subroutine Modules
TYPE WET_PAR
REAL(REAL8),DIMENSION(6) :: FR
REAL(REAL8) :: SC
REAL(REAL8),DIMENSION(3) :: GD
INTEGER (INT1) :: M1,M2
END TYPE WET_PAR
TYPE SCPT
REAL (REAL8),POINTER :: PT
END TYPE SCPT
TYPE TRANS_VAR
INTEGER(INT1) :: NMP
INTEGER(INT4),DIMENSION(:),POINTER :: MT
REAL (REAL8),DIMENSION(:),POINTER :: VR
REAL (REAL8),DIMENSION(:),POINTER :: VTR1
REAL (REAL8),DIMENSION(:),POINTER :: VTR2
REAL (REAL8),DIMENSION(:),POINTER :: VTR3
END TYPE TRANS_VAR
TYPE MULTI_ARRAY_3D
INTEGER (INT4) :: NUMLT
INTEGER (INT4) :: NUMDT
INTEGER (INT4), DIMENSION(:), POINTER :: M
REAL (REAL8), DIMENSION(:), POINTER :: V
TYPE(TRANS_VAR), POINTER :: TRNS
TYPE(WET_PAR), POINTER :: WFRV
END TYPE MULTI_ARRAY_3D
TYPE TRMEM
TYPE(TRANS_VAR), DIMENSION(:), POINTER :: TR
INTEGER(INT4) , DIMENSION(:), POINTER :: IV
REAL (REAL8) , DIMENSION(:), POINTER :: RV
REAL (REAL8) , DIMENSION(:), POINTER :: VTR1
REAL (REAL8) , DIMENSION(:), POINTER :: VTR2
REAL (REAL8) , DIMENSION(:), POINTER :: VTR3
END TYPE TRMEM
TYPE MULTI_MATERIAL_POINTERS
TYPE (MULTI_ARRAY_3D), DIMENSION(:), POINTER :: MTS
END TYPE MULTI_MATERIAL_POINTERS
INTERFACE MEMALLOC
MODULE PROCEDURE MEMALLOC_MULTMAT_POINTER3
MODULE PROCEDURE MEMALLOC_MULTI_ARRAY3_3D
MODULE PROCEDURE MEMALLOC_TRANS_VAR_ARRAY3
MODULE PROCEDURE MEMALLOC_MICARRAY_POINTER3
END INTERFACE
INTERFACE MEMDEALLOC
MODULE PROCEDURE MEMDEALLOC_MULTMAT_POINTER3
MODULE PROCEDURE MEMDEALLOC_MULTI_ARRAY3_3D
MODULE PROCEDURE MEMDEALLOC_TRANS_VAR_ARRAY3
MODULE PROCEDURE MEMDEALLOC_MICARRAY_POINTER3
END INTERFACE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
62 of ANSYS, Inc. and its subsidiaries and affiliates.
MDGRID3, Autodyn-3D Grid Variable Definitions
TYPE MICRO_ARRAY_3D
INTEGER (INT1), DIMENSION(LIMMC,LIMMC,LIMMC) :: MAT
REAL (REAL8), DIMENSION(LIMMC,LIMMC,LIMMC) :: UX, UY, UZ, RHO, SIE
END TYPE MICRO_ARRAY_3D
TYPE MICRO_ARRAY_3D_POINTER
TYPE (MICRO_ARRAY_3D), POINTER :: MAR
END TYPE MICRO_ARRAY_3D_POINTER
TYPE MICROZONE_POINTERS_3D
TYPE (MICRO_ARRAY_3D_POINTER), DIMENSION(:), POINTER :: MCR
END TYPE MICROZONE_POINTERS_3D
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 63
Autodyn User Subroutine Modules
INTEGER, PARAMETER :: K02 = K01+1, K03 = K01+2, K04 = K01+3, K05 = K01+4
INTEGER, PARAMETER :: K06 = K01+5, K07 = K01+6, K08 = K01+7, K09 = K01+8
INTEGER, PARAMETER :: K10 = K01+9
INTEGER (INT1), DIMENSION(:), POINTER :: NPKMT, NPKMN, NPKMS, NPKBX
INTEGER (INT1), DIMENSION(:), POINTER :: NPKBY, NPKBZ, NPKBI, NPKBJ
INTEGER (INT1), DIMENSION(:), POINTER :: NPKBK, NPKRX, NPKRY, NPKRZ
INTEGER (INT1), DIMENSION(:), POINTER :: NPKNW, NPKAL, NPK01, NPK02
INTEGER (INT1), DIMENSION(:), POINTER :: NPK03, NPK04, NPK05, NPK06
INTEGER (INT1), DIMENSION(:), POINTER :: NPK07, NPK08, NPK09, NPK10
INTEGER (INT1), DIMENSION(:), POINTER :: NPKED, NPKIC
INTEGER (INT1), DIMENSION(:), POINTER :: NVAR, NTVR, KBIJK
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
64 of ANSYS, Inc. and its subsidiaries and affiliates.
MDGRID3, Autodyn-3D Grid Variable Definitions
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 65
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
66 of ANSYS, Inc. and its subsidiaries and affiliates.
MDSOLV, Unstructured Entity Types
USE mdvar_all
IMPLICIT NONE
! COMMON FLAGS
INTEGER (INT4), PARAMETER :: ISF_SOLVER = 1
! NODE TYPES
INTEGER(INT4), PARAMETER :: NDTYPE_BASIC =1
INTEGER(INT4), PARAMETER :: NDTYPE_3DOF =2
INTEGER(INT4), PARAMETER :: NDTYPE_6DOF_SHELL =3
INTEGER(INT4), PARAMETER :: NDTYPE_6DOF_BEAM =4
INTEGER(INT4), PARAMETER :: NDTYPE_6DOF_SHELL_BEAM =5
INTEGER(INT4), PARAMETER :: NDTYPE_3DOF_ANP =6
INTEGER(INT4), PARAMETER :: NDTYPE_6DOF_ANP =7
INTEGER(INT4), PARAMETER :: NDTYPE_ORIENT_BEAM =80
INTEGER(INT4), PARAMETER :: NDTYPE_EXTERNAL =99
INTEGER(INT4), PARAMETER :: NDTYPE_ALL =100
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 67
Autodyn User Subroutine Modules
! JOIN TYPES
INTEGER (INT4), PARAMETER :: JOINTYPE_BASIC = 1
INTEGER (INT4), PARAMETER :: JOINTYPE_IJKUS = 2
! CLASSIFICATION FLAGS
INTEGER (INT4), PARAMETER :: ICLASS_VOLUME = 1
INTEGER (INT4), PARAMETER :: ICLASS_SHELL = 2
INTEGER (INT4), PARAMETER :: ICLASS_BEAM = 3
INTEGER (INT4), PARAMETER :: ICLASS_POINT = 4
! TOPOLOGY FLAGS
INTEGER (INT4), PARAMETER :: ITOPO_NODE = 1
INTEGER (INT4), PARAMETER :: ITOPO_LINE = 2
INTEGER (INT4), PARAMETER :: ITOPO_TRI = 3
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
68 of ANSYS, Inc. and its subsidiaries and affiliates.
POLGON, Polygon Variable Definitions
TYPE SOLVER_DEF
CHARACTER(LEN=12) :: NAME
INTEGER(INT4) :: CLASS ! SOLID_ELEM, SHELL_ELEM, BEAM_ELEM
INTEGER(INT4) :: TOPOLOGY ! HEX, TET, QUAD
INTEGER(INT1), DIMENSION(NUM_RVAR_ALL) :: AVAILABLE_RVAR ! 1=AVAILABLE, 0=NOT
END TYPE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 69
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
70 of ANSYS, Inc. and its subsidiaries and affiliates.
SUBDEF, Global Part Variable Definitions
INTEGER (INT4) :: NUMSUB, NUMEUL, NSP, NUMJON, MAXIJK, NNMZVR, NUMZNS, NDAT1
INTEGER (INT4) :: NUMBOJ, IFIMPT, NERODED
INTEGER (INT4), DIMENSION(LIMSUB+1) :: IJKBAS
INTEGER (INT4), DIMENSION(LIMSUB) :: NUMPRO, NUMI, NUMJ, NUMK, MATSV
INTEGER (INT4), DIMENSION(LIMSUB) :: IDN,JDN,ISIZ,JSIZ,KSIZ,IJKSIZ
INTEGER (INT4), DIMENSION(LIMSUB) :: NSPACK, IOPRT, NUMEUP, NUMLAP, NMZNS
INTEGER (INT4), DIMENSION(LIMSUB) :: IBPRT, IEPRT, JBPRT, JEPRT, IJKBAZ
INTEGER (INT4), DIMENSION(LIMSUB) :: KBPRT, KEPRT, IFEBVL, NPLTSL
INTEGER (INT1), DIMENSION(LIMSUB,LIMSUB), TARGET :: JONSUB, MAPPED
INTEGER (INT4), DIMENSION(3) :: IJKMAX
INTEGER (INT1), DIMENSION(LIMSUB) :: IACTIV, IVOLOP
INTEGER (INT1), DIMENSION(LIMSUB,LIMSUB) :: IFSLAV
REAL (REAL8) :: TOLJON, TOTMAX, TOTWRK, TOTXIM, TOTYIM, TOTZIM, TOTHI
REAL (REAL8) :: TOTMSB, TOTVLB, TOTIEB, TOTKEB, TOTDEB
REAL (REAL8) :: TOTMS, TOTVL, TOTIE, TOTKE, TOTDE
REAL (REAL8) :: TOTXMB, TOTYMB, TOTZMB, TOTXM, TOTYM, TOTZM
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: XSUBMN, YSUBMN, ZSUBMN
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: XSUBMX, YSUBMX, ZSUBMX
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: USUBMX, ASUBMX, SUBMS, SUBVL
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: VARSB1, VARSB2, VARSB3, VARSB4, SUBDE
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: SUBMSB, SUBVLB, SUBDEB, SUBIE
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: SUBKE, SUBXM, SUBYM, SUBZM, SUBIEB
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: SUBKEB, SUBXMB, SUBYMB, SUBZMB
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: ACTIME, DCTIME, TSTPFC
REAL (REAL8), DIMENSION(LIMSUB), TARGET :: XNMIN, XNMAX, YNMIN, YNMAX, ZNMIN,
ZNMAX
REAL (REAL8), DIMENSION(LIMSUB) :: AVLEN
REAL (REAL8) :: AVLENL
CHARACTER(LEN=10), DIMENSION(LIMSUB) :: NAMSUB
CHARACTER(LEN=1), DIMENSION(LIMSUB) :: NEWSUB
INTEGER (INT4) :: NSUB, NPROC, IMAX, JMAX, KMAX, NWRKSB, NPLTSB, NZSUB, NSHTYP
INTEGER (INT4) :: NSBBEG, NSBEND, NSBLAY, MATLOC, IMAXP, JMAXP, KMAXP, KMAXBM
INTEGER (INT4) :: NPROE, NPROL, NUMIJK, NSBOLD, IFDEZN
REAL (REAL8) :: DUMMYV, ALERTI, ALERTJ, ALERTK, ALEFRX
CHARACTER(LEN=10) :: DUMMYN
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 71
Autodyn User Subroutine Modules
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
72 of ANSYS, Inc. and its subsidiaries and affiliates.
WRAPUP, Execution Termination Variables
SAVE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 73
Autodyn User Subroutine Modules
SAVE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
74 of ANSYS, Inc. and its subsidiaries and affiliates.
OBJECT, SPH Object Definitions
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 75
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
76 of ANSYS, Inc. and its subsidiaries and affiliates.
Chapter 6: Autodyn Variable Listings
The Autodyn variables for structured 2D and 3D are listed below. The external output name is first
given. This is the name shown on plots, printout, and when interactively examining values on the screen.
The next column is the array name used internally. These internal names are to be used when writing
user subroutines. Grid variables are either associated with a node (for example, X coordinate), or a cell
center (for example, Pressure), or with a particle (SPH only). These are indicated as Node, Cell, and
Particle respectively. Depending on the processor (solver), certain variables are not defined. This is in-
dicated by a blank entry in the table.
The listings are provided for both versions 4 (Fortran 90) and versions 3 (Fortran 77).
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 77
Autodyn Variable Listings
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
78 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn-2D – Structured (IJK) Solvers
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 79
Autodyn Variable Listings
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
80 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn-2D – Structured (IJK) Solvers
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 81
Autodyn Variable Listings
The index value for a given grid variable is Nname, where name is the internal variable name. For ex-
ample, if you wanted the index for x-velocity(UXN) it would be NUXN. This index could then be used
in the various Autodyn functions (for example, GV(NUXN,IJK).
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
82 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn-3D – Structured (IJK) Solvers
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 83
Autodyn Variable Listings
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
84 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn-3D – Structured (IJK) Solvers
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 85
Autodyn Variable Listings
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
86 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn-3D – Structured (IJK) Solvers
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 87
Autodyn Variable Listings
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
88 of ANSYS, Inc. and its subsidiaries and affiliates.
Autodyn-3D – Structured (IJK) Solvers
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 89
Autodyn Variable Listings
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
90 of ANSYS, Inc. and its subsidiaries and affiliates.
Notes
The index value for a given grid variable is Nname, where name is the internal variable name. For ex-
ample, if you wanted the index for x-velocity(UXN) it would be NUXN. This index could then be used
in the various Autodyn functions (for example, GV(NUXN,IJK).
6.3. Notes
A. ALPHA is a material model dependent variable, which can have the following meanings for the specified
material models:
B. Damage is not used in standard material models. It will only be non-zero if defined in user subroutines (for
example, EXDAM).
C. An explanation and the derivation of the equations for effective plastic strain, effective plastic strain rate
and effective strain are given below:
The plane which makes equal angles with each of the principal directions is called the octahedral
plane. The shear stress on this plane is given by:
where σij is the total stress tensor in the ij direction. Directions 11, 22 and 33 are the principal stress
directions.
The Von Mises yield criterion states that yielding begins when the octahedral shearing reaches a
critical value defined by:
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 91
Autodyn Variable Listings
Substituting these values in the above equations gives the uniaxial yield stress as:
In Autodyn at each cycle the stress state is checked against the yield criterion and if the yield criterion
is exceeded an increment of effective plastic strain is computed as follows:
The effective plastic strain is the integrated value of these increments during the calculation:
where
where εij is the total strain tensor in the ij direction which includes elastic and plastic components
D. When using the Euler and Euler Godunov processors a given cell may contain more than one material. In
such a case, there is not a single value for such variables as compression and energy. In order to obtain
these “multi-material” variables one has to reference the multiple material arrays. For Autodyn-2D, a mass-
weighted value for compression, internal energy, temperature, and alpha is available in the “standard” array
locations (for example: XMU, EN, TEMP, and ALPHA). In Autodyn-3D, the multi-material access method is
used for all processors including Lag/ALE and Shells.
Refer to the User Subroutine tutorial for further details and examples.
E. When using the Lagrange, ALE, Shell, Beam, SPH and FCT solvers, these variables are most efficiently accessed
from the multi-material array structure using the direct method: For each cell, set the material variable array
pointer using
ML => MTSUB(IJK)%V(1:NUMMLV)
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
92 of ANSYS, Inc. and its subsidiaries and affiliates.
Unstructured Solvers
ML(index).
For example, to set the cell damage to one and internal energy to zero use:
ML(NCDM) = 1.0
ML(NCEN) = 0.0
F. To define the pressure and energy on the Hugoniot requires the material shock velocity-particle velocity
relationship as material input. In Autodyn this is specified through:
where
The bulk acoustic sound speed is calculated from the bulk modulus (K) and density at initial state
(ρref ) :
The local material sound speed is calculated from the bulk modulus, shear modulus (G) and density
(ρ):
For a multi-material Euler element, the element sound speed (SOUNDSPEED) is calculated as a stiff-
ness-weighted average of the sound speed of the different material fractions.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 93
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
94 of ANSYS, Inc. and its subsidiaries and affiliates.
Chapter 7: User Subroutine Examples
The following sections provide selected examples and information about the use of Autodyn user sub-
routines.
7.1. Subroutine MDSTR_USER_1
7.2. Subroutine EXVEL
7.3. Subroutine EXALE
7.4. Subroutine EXEDIT - 2D
7.5. Subroutine EXEDIT3 – 3D
7.6. Unstructured Element Data Access
7.7. Subroutine EXFOR3
! MODULE STR_USER_1
! DEFINE VARIABLES THAT ARE COMMON BETWEEN THE ROUTINES BELOW
! SUBROUTINE INIT_STR_USER_1
! DEFINE THE INPUT PARAMETERS FOR THE USER STRENGTH MODEL
! SUBROUTINE CHECK_STR_USER_1
! CHECK PARAMETERS ARE VALID FOR THE USER STRENGTH MODEL
! SUBROUTINE SET_STR_USER_1
! SET SHORTCUTS TO PARAMETERS FOR THE USER STRENGTH MODEL
! SUBROUTINE SOLVE_STR_USER_1
! SOLVE THE USER STRENGTH MODEL
! ************************************************************************
MODULE STR_USER_1
USE kindef
IMPLICIT NONE
SAVE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 95
User Subroutine Examples
SUBROUTINE INIT_STR_USER_1(IFACT)
USE material
USE str_user_1
IMPLICIT NONE
! ************************************************************************
! FLAG - IMF_STR_USER_1
! ************************************************************************
IF (IFACT==1) THEN
CALL ALLOC_EQ ! DO NOT MODIFY THIS LINE, ALLOCATES MEMORY
! FOR EACH NON-OPTIONAL DEPENDANT (CHILD) FLAG/MODEL OPTION, ASSIGN DEPENDANT FLAG
!EQ%DEPFLG(1) = IMF_YP_PCWISE
ENDIF
RETURN
END SUBROUTINE INIT_STR_USER_1
SUBROUTINE SET_STR_USER_1
USE material
USE str_user_1
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
96 of ANSYS, Inc. and its subsidiaries and affiliates.
Subroutine MDSTR_USER_1
IMPLICIT NONE
! ************************************************************************
! ************************************************************************
! FOR EXAMPLE
SHRMDZ = EQ%PAR(1)%VAL ! THIS LINE MUST BE PRESENT
EP(1) = EQ%PAR(2)%VAL
EP(2) = EQ%PAR(3)%VAL
EP(3) = EQ%PAR(4)%VAL
YS(1) = EQ%PAR(5)%VAL
YS(2) = EQ%PAR(6)%VAL
YS(3) = EQ%PAR(7)%VAL
! ISEL_OPT = EQ%OPTION(1)%SELECTED
RETURN
SUBROUTINE CHECK_STR_USER_1
USE material
USE str_user_1
IMPLICIT NONE
! ************************************************************************
! ************************************************************************
RETURN
USE material
USE str_user_1
USE cycvar
USE edtdef
USE ijknow
USE wrapup
USE mdgrid
IMPLICIT NONE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 97
User Subroutine Examples
INTEGER (INT4) :: I, IM
! ************************************************************************
! INPUT PARAMETER
! PRES PRESSURE
! Tnn PRINCIPAL STRESSES
! XMUT COMPRESSION
! EPST EFFECTIVE PLASTIC STRAIN
! EPSD EFFECTIVE PLASTIC STRAIN RATE
! TEMP TEMPERATURE
! DAMAGE DAMAGE
! IFAIL STRESS STATE INDICATOR
! = 0 HYDRO
! = 1 ELASTIC
! = 2 PLASTIC
! = 3 BULK FAILURE (WITH HEAL)
! = 4 BULK FAILURE (NO HEAL)
! OUTPUT PARAMETERS
! MODULE 'IJKNOW'
! MODULE 'MATDEF'
! MATNO - THE MATERIAL NUMBER OF THE CURRENT MATERIAL
! MATERIALS(MATNO)%NAME - THE MATERIAL NAME OF THE CURRENT MATERIAL
! MODULE 'CYCVAR'
! NCYCLE - CURRENT CYCLE NUMBER
! TIME - CURRENT TIME
! DLTH - TIME STEP FOR CURRENT CYCLE
! MODULE 'EDTDEF'
! NTCODE - DIMENSIONS: 2 = 2D, 3 = 3D
! TO OBTAIN THE VALUE OF THE INDEX IJK FOR THE CURRENT CELL, USE
! IJK = IJKSET(INOW,JNOW,KNOW)
! THE INDEX IJK MUST ALSO BE DEFINED AS AN INTEGER: - INTEGER (INT4) :: IJK
! ************************************************************************
! TO ACCESS A V4.3 USER SUBROUITNE FOR AUTODYN-2D, UNCOMMENT THE NEXT LINE
!CALL EXYLD (PRES,TT1,TT2,TT3,XMUT,EPST,EPSD,TEMPT,YIELDT,IFAIL)
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
98 of ANSYS, Inc. and its subsidiaries and affiliates.
Subroutine MDSTR_USER_1
YIELDT = ZERO
GO TO 900
END IF
DO I = 2,3
IF (EPST<=EP(I)) THEN
IM = I-1
YIELDT = YS(IM) + (YS(I)-YS(IM))*(EPST-EP(IM))/(EP(I)-EP(IM))
EXIT
END IF
END DO
END IF
900 RETURN
USE material
USE str_user_1
USE cycvar
USE edtdef
USE ijknow
USE wrapup
USE mdgrid3
IMPLICIT NONE
! ************************************************************************
! INPUT PARAMETER
! PRES PRESSURE
! Tnn PRINCIPAL STRESSES
! XMUT COMPRESSION
! EPST EFFECTIVE PLASTIC STRAIN
! EPSD EFFECTIVE PLASTIC STRAIN RATE
! TEMP TEMPERATURE
! DAMAGE DAMAGE
! IFAIL STRESS STATE INDICATOR
! = 0 HYDRO
! = 1 ELASTIC
! = 2 PLASTIC
! = 3 BULK FAILURE (WITH HEAL)
! = 4 BULK FAILURE (NO HEAL)
! OUTPUT PARAMETERS
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 99
User Subroutine Examples
! MODULE 'IJKNOW'
! MODULE 'MATDEF'
! MATNO - THE MATERIAL NUMBER OF THE CURRENT MATERIAL
! MATERIALS(MATNO)%NAME - THE MATERIAL NAME OF THE CURRENT MATERIAL
! MODULE 'CYCVAR'
! NCYCLE - CURRENT CYCLE NUMBER
! TIME - CURRENT TIME
! DLTH - TIME STEP FOR CURRENT CYCLE
! MODULE 'EDTDEF'
! NTCODE - DIMENSIONS: 2 = 2D, 3 = 3D
! TO OBTAIN THE VALUE OF THE INDEX IJK FOR THE CURRENT CELL, USE
! IJK = IJKSET(INOW,JNOW,KNOW)
! THE INDEX IJK MUST ALSO BE DEFINED AS AN INTEGER: - INTEGER (INT4) :: IJK
! ************************************************************************
! TO ACCESS A V4.3 USER SUBROUITNE FOR AUTODYN-3D, UNCOMMENT THE NEXT LINE
!CALL EXYLD (PRES,TT1,TT2,TT3,XMUT,EPST,EPSD,TEMPT,YIELDT,IFAIL)
! ALSO NOTE:: USE mdgrid3 AND NOT mdgrid for AUTODYN-3D
900 RETURN
USE kindef
USE bnddef
USE ijknow
USE wrapup
IMPLICIT NONE
INTEGER (INT4) :: K
REAL (REAL8) :: UXT, UYT, XB, YB
REAL (REAL8), DIMENSION(5) :: RBC
CHARACTER (LEN=10) :: NAMVEL
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
100 of ANSYS, Inc. and its subsidiaries and affiliates.
Subroutine EXVEL
!
! ******************************************************************
!
! THIS IS A USER SUPPLIED SUBROUTINE WHICH APPLIES VELOCITY
! CONSTRAINTS TO NODES. THE ROUTINE IS CALLED ONCE PER CYCLE FOR
! EACH NODE ASSIGNED WITH THE USER VELOCITY CONSTRAINT
! THROUGH INPUT. THE USER VELOCITY CONSTRAINT IS USED WHEN THE
! X AND Y VELOCITY CONSTRAINTS CANNOT BE DESCRIBED BY A
! COMBINATION OF THE STANDARD VELOCITY CONSTRAINTS
! AVAILABLE IN AUTODYN INPUT PARAMETERS
! INPUT PARAMETERS
! OUTPUT PARAMETERS
!
! UXT X-VELOCITY AFTER CONSTRAINT HAS BEEN APPLIED
! UYT Y-VELOCITY AFTER CONSTRAINT HAS BEEN APPLIED
! NOTE: AFTER RETURNING FROM THIS ROUTINE,
! END OF CYCLE COORDINATES WILL BE COMPUTED USING:-
! XE = XB + UXT*DLTH YE = YB + UYT*DLTH
!
! SO YOU CAN CONSTRAIN THE DOMAIN OF X AND Y BY DIRECTLY
! MODIFYING UXT AND UYT TO ENSURE THAT XE AND/OR YE REMAIN
! WITHIN CERTAIN BOUNDS
! MODULE'IJKNOW'
! MODULE'BNDDEF'
! MODULE'KINDEF'
! PI = 3.1415927
! THIRD = 1.0/3.0
! SMALL = 1.0E-20
! ZERO = 0.0
! ONE = 1.0
! ******************************************************************
!
CHARACTER*40 TEXT40
!
IF (NAMVEL.EQ.'V-POSITIVE') THEN
UYT = MAX (UYT,0.0)
ELSE IF (NAMVEL.EQ.'V-NEGATIVE') THEN
UYT = MIN (UYT,0.0)
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 101
User Subroutine Examples
ELSE
WRITE (TEXT40,'(3A)') '$Error EXVEL is called as :',NAMVEL,'$'
CALL USR_MESSAG (TEXT40)
NSWRAP = 99
ENDIF
USE mdgrid
USE kindef
USE locsub
USE wrapup
IMPLICIT NONE
! ******************************************************************
!
! THIS SUBROUTINE COMPUTES THE CONSTRAINED GRID VELOCITIES FOR
! VERTICES ASSIGNED THE "USER" MOTION CONSTRAINT
!
! INPUT PARAMETERS:
!
! IREZ - I INDEX FOR VERTEX TO BE CONSTRAINED
! JREZ - J INDEX FOR VERTEX TO BE CONSTRAINED
! NREZ - PART # FOR VERTEX TO BE CONSTRAINED
! XREZ - CURRENT X-COORDINATE OF VERTEX
! YREZ - CURRENT Y-COORDINATE OF VERTEX
!
! OUTPUT PARAMETERS:
!
! XREZ - CONSTRAINED X-COORDINATE OF VERTEX
! YREZ - CONSTRAINED Y-COORDINATE OF VERTEX
!
! ******************************************************************
!
! THIS LOGIC SETS THE X-COORDINATE OF EACH VERTEX (I,J) TO THE
! X-VALUE AT VERTEX (I,JMAX) AND EQUALLY SPACES THE Y-COORDINATES
! BETWEEN (I,1) AND (I,JMAX)
!
IJMAX = IJSET(IREZ,JMAX)
IJ = IJSET(IREZ,JREZ)
XREZ = XN(IJMAX)
DYB = YN(IJMAX)/FLOAT(JMAX-1)
YREZ = DYB*FLOAT(JREZ-1)
!
! TERMINATION OF SUBROUTINE EXALE
RETURN
END SUBROUTINE EXALE
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
102 of ANSYS, Inc. and its subsidiaries and affiliates.
Subroutine EXEDIT - 2D
! ************************************************************************
! ************************************************************************
USE mdgrid
USE ranges
USE kindef
USE cycvar
USE wrapup
USE subdef
IMPLICIT NONE
! ************************************************************************
! ************************************************************************
! INITIALIZATION OF ARRAYS
IF (NCYCLE == 1) THEN
! LOOP OVER ALL PARTS
DO NS = 1, NUMSUB
NSUB = NS
CALL GETSUB
! LOOP OVER ALL CELLS
DO I = 1,IMAX
DO J = 1,JMAX
IJK = IJSET(I,J)
VAR01(IJK) = - BIG
VAR02(IJK) = - BIG
! END LOOP ON CELLS
END DO
END DO
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 103
User Subroutine Examples
END IF
END IF
RETURN
! ************************************************************************
! ************************************************************************
USE mdgrid3
USE ranges
USE kindef
USE cycvar
USE wrapup
USE subdef
IMPLICIT NONE
! ************************************************************************
! ************************************************************************
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
104 of ANSYS, Inc. and its subsidiaries and affiliates.
Unstructured Element Data Access
! INITIALIZATION OF ARRAYS
IF (NCYCLE == 1) THEN
! LOOP OVER ALL PARTS
DO NS = 1, NUMSUB
NSUB = NS
CALL GETSUB3
! LOOP OVER ALL CELLS
DO I = 1,IMAX
DO J = 1,JMAX
DO K = 1,KMAX
IJK = IJKSET3(I,J,K)
VAR01(IJK) = - BIG
VAR02(IJK) = - BIG
ENDDO
END DO
END DO
END DO ! END LOOP ON PARTS
END IF
MOM = MASS*RES_VEL
IF(MOM >= VAR01(IJK)) THEN
VAR01(IJK) = MOM
VAR02(IJK) = TIME
END IF
END DO
END DO
END DO
! END LOOP ON PARTS
END DO
END IF
RETURN
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 105
User Subroutine Examples
IMPLICIT NONE
NEL = 0
DO N = 1, NUM_ENTITY_ENTRIES(TYPE_ELEM)
IF (ENTITY_TYPES(TYPE_ELEM)%ID(N)==NEL_USER) THEN
NEL = N
EXIT
END IF
END DO
IMPLICIT NONE
DO NPART = 1, NUM_PARTS
PART => PARTS(NPART)%P
IF (PART%ELEM_CLASS/=ICLASS_VOLUME) CYCLE ! SKIP NON-SOLID ELEMENTS
! CALCULATE IMPEDANCE
RVL(IVR_VAR01) = RVL(IVR_DENSITY)*RVL(IVR_SOUNDSPEED)
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
106 of ANSYS, Inc. and its subsidiaries and affiliates.
Unstructured Element Data Access
USE mdpart
USE mdvar_all
USE mdsolv
USE mdcomponents
USE mdgrid3
IMPLICIT NONE
DO N = 1, NUM_COMPONENTS
COMP => COMPONENTS(N)%P
IF (COMP%NAME/='Solid') CYCLE
DO NN = 1, COMP%NUM_PART
NPART = COMP%PART_LIST(NN)
IF (NPART>NUMSUB) THEN
! UNSTRUCTURED PART
NPART = NPART-NUMSUB
PART => PARTS(NPART)%P
! CALCULATE IMPEDANCE
RVL(IVR_VAR01) = RVL(IVR_DENSITY)*RVL(IVR_SOUNDSPEED)
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 107
User Subroutine Examples
IMPLICIT NONE
DO N = 1, NUM_GROUPS
GRP => GROUPS(N)%P
IF (GRP%NAME/='Proj') CYCLE
! CALCULATE IMPEDANCE
RVL(IVR_VAR01) = RVL(IVR_DENSITY)*RVL(IVR_SOUNDSPEED)
ELSE
! GET STRUCTURED IJK INDEX
IJKS = GRP%IJKS_LIST(NN)
CALL IJANDKS3 (IJKS,I,J,K,M)
NSUB = M
CALL GETSUB3
IJK = IJKSET3(I,J,K)
IF (ASSOCIATED(VAR01)) THEN
VAR01(IJK) = DEN(IJK)*SSPD(IJK)
END IF
END IF
END DO ! END LOOP ON ELEMENTS
END DO ! END LOOP ON GROUPS
The local variable arrays RVL and IVL are used for the storage of element variables as well as nodal
variables. This routine highlights that a call to get_node_var in the internal loop over the eight nodes
of the element overwrites/replaces the element values in the RVL array by nodal values. In order to
store the time and average element z-location a new call to get_element_var is required first to retrieve
the element variables in the RVL array again before a call to put_elem_var can store the new values
in permanent element storage.
SUBROUTINE EXEDIT3
USE kindef
USE wrapup
USE mdpart
USE mdvar_all
USE cycvar
USE mdgrid3
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
108 of ANSYS, Inc. and its subsidiaries and affiliates.
Unstructured Element Data Access
USE mdsolv
USE cycvar
USE mdstring
IMPLICIT NONE
! ************************************************************************
! ************************************************************************
DO NP = 1, NUM_PARTS
DO NE = 1, PARTS(NP)%P%NUMELM
NENUM = PARTS(NP)%P%ELEMENT_LIST(NE)
INTPOI = 0
CALL GET_ELEM_VAR(NENUM,INTPOI)
ELTYPE = DATA_STR(NSTRING)%P%OPT(EL_SOPT_ELEMTYPE)
if(ELTYPE == ELTYPE_HEX8) then
NODENM(1) = IVL(IVI_CON1)
NODENM(2) = IVL(IVI_CON2)
NODENM(3) = IVL(IVI_CON3)
NODENM(4) = IVL(IVI_CON4)
NODENM(5) = IVL(IVI_CON5)
NODENM(6) = IVL(IVI_CON6)
NODENM(7) = IVL(IVI_CON7)
NODENM(8) = IVL(IVI_CON8)
DO I=1,8
CALL GET_NODE_VAR(NODENM(I),0)
NODE_Z_VALUE(I) = RVL(IVR_Z)
END DO
ELEMENT_Z_VALUE = SUM(NODE_Z_VALUE)/8.0
CALL GET_ELEM_VAR(NENUM,INTPOI)
RVL(IVR_VAR01) = TIME
RVL(IVR_VAR02) = ELEMENT_Z_VALUE
end if
CALL PUT_ELEM_VAR(NENUM,INTPOI)
END DO
END DO
RETURN
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 109
User Subroutine Examples
! MODULE ERO_USER_1
! DEFINE COMMON PARAMETERS TO BE ACCESSED IN ROUTINES BELOW
! SUBROUTINE INIT_ERO_USER_1
! ALLOCATE SPACE AND DEFINE THE PARAMETERS FOR A GIVEN FLAG
! SUBROUTINE CHECK_ERO_USER_1
! CHECK PARAMETERS ARE VALID FOR flagname
! SUBROUTINE SOLVE_ERO_USER_1_2D
! SUBROUTINE SOLVE_ERO_USER_1_3D
! SOLVE EQUATION (CALLED FROM SOLVER)
! ************************************************************************
MODULE ERO_USER_1
USE kindef
IMPLICIT NONE
SAVE
SUBROUTINE INIT_ERO_USER_1(IFACT)
USE material
USE ero_user_1
IMPLICIT NONE
! ************************************************************************
! FLAG - IMF_ERO_USER_1
! ************************************************************************
IF (IFACT==1) THEN
! ALLOCATE ARRAYS FOR EQUATION/FLAG
CALL ALLOC_EQ
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
110 of ANSYS, Inc. and its subsidiaries and affiliates.
Unstructured Element Data Access
EQ%IFSOLVER(ISLV_EULER) = 0
EQ%IFSOLVER(ISLV_EULER_GOD) = 0
RETURN
END SUBROUTINE INIT_ERO_USER_1
SUBROUTINE SET_ERO_USER_1
USE material
USE ero_user_1
USE mdvar_all
IMPLICIT NONE
! ************************************************************************
! THIS SUBROUTINE ASSIGNS EOS CONSTANTS FOR DIRECT USE IN THE SOLVER
! ************************************************************************
MAX_EPS = EQ%PAR(1)%VAL
IF_IVAR_ALL(IVI_EROSION) = 2
RETURN
SUBROUTINE CHECK_ERO_USER_1
USE material
USE ero_user_1
IMPLICIT NONE
! ************************************************************************
! ************************************************************************
! NO CHECKS REQUIRED
RETURN
USE material
USE ero_user_1
USE mdgrid
USE wrapup
IMPLICIT NONE
! ************************************************************************
! OUTPUT PARAMETER
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 111
User Subroutine Examples
! ************************************************************************
! TEMPORARY ERROR MESSAGE - REPLACE NEXT TWO LINES WITH YOUR OWN CODE
CALL USR_MESSAG ('User subroutine SOLVE_ERO_USER_1_2D missing')
NSWRAP = 9
RETURN
USE material
USE ero_user_1
USE mdgrid3
USE wrapup
USE mdvar_all
USE mdstring
USE mdsolv
USE cycvar
IMPLICIT NONE
! ************************************************************************
! OUTPUT PARAMETER
! ************************************************************************
ISTAT = 0
IF (ELEM_NOW == 0) GO TO 100
CALL GET_ELEM_VAR(ELEM_NOW,0)
! ASSESS WHETHER NBS ELEMENT OR NOT AND IF NOT RETURN
ELTYPE = DATA_STR(NSTRING)%P%OPT(EL_SOPT_ELEMTYPE)
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
112 of ANSYS, Inc. and its subsidiaries and affiliates.
Subroutine EXFOR3
NBS_TET_HGMODEL = DATA_STR(NSTRING)%P%OPT(EL_SOPT_NBS_HGMODEL)
TET_HG_COEFF = DATA_STR(NSTRING)%P%RPARAM(RPAR_NBS_HGCOEFF)
100 CONTINUE
RETURN
The direction of the force can be manipulated by modification of the variables COSX_USER,COSY_USER,
COSZ_USER (module: bnddef (mdcom.f90)). The calling routines check if they are modified (they are
set to BIG before entering); if so we use them (they all have to be modified). If not modified, the direction
defined on input in the graphical user interface will be used.
Please refer to the current and latest listing of the code in the routine usrsub33.f90.
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 113
Release 2020 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
114 of ANSYS, Inc. and its subsidiaries and affiliates.