Autodyn User Subroutines: Advanced Training Course
Autodyn User Subroutines: Advanced Training Course
Autodyn User Subroutines: Advanced Training Course
15.0 Release
August 5, 2013
Release 15.0
Course Content
Installed files
Microsoft .NET development environment
Provided user subroutines
Creating user executable
Debugging user executable
Template Files
Formal Parameters
AUTODYN Modules
Utility Functions / Subroutines
Hands-on Example #1
AUTODYN Grid Variables
Hands-on Example #2 and #3
Material Modeling Modules
Hands-on Example #4
Using the Debugger
Workshop
August 5, 2013
Release 15.0
August 5, 2013
Release 15.0
The files required for creating and using AUTODYN User Subroutines are
August 5, 2013
Release 15.0
User Subroutines
Development Environment
August 5, 2013
Release 15.0
..\AUTODYN user_subroutines
\fsrc
\2d\usrsub2.f90
\3d\usrsub3.f90
\materials\mdeos_user_1.f90
mdstr_user_1.f90
mdfai_user_1.f90
mdero_user_1.f90
\ad_usrsub.sln
\ad_usrsub.vfproj
\ad_usrsub_slave.vfproj
August 5, 2013
Release 15.0
Double click on this file to open the project in the Microsoft .NET
development environment
August 5, 2013
Release 15.0
Choose
Debug or Release
August 5, 2013
Choose
x64 or win32
Release 15.0
ad_usrsub
mdeos_user_1.f90
mdero_user_1.f90
mdfai_user_1.f90
mdstr_user_1.f90
usrsub2.f90
usrsub33.f90
August 5, 2013
Release 15.0
MDSTR_USER_1
MDFAI_USER_1
MDERO_USER_1
EXBULK
EXCOMP
EXCRCK
EXDAM
EXPLRN
EXSHR
EXSTIF
EXTAB
August 5, 2013
10
Release 15.0
EXALE
EXEDIT
Custom edits
EXFLOW
EXLOAD
EXPOR
EXSAVE
EXSIE
EXSTR
EXVAL
EXVEL
EXZONE
August 5, 2013
11
Release 15.0
Select Platform/Optimisation
ad_usersub.exe
Primary executable
ad_usrsub_slave.exe
Slave executable for parallel
processing
August 5, 2013
12
Release 15.0
August 5, 2013
13
Release 15.0
August 5, 2013
14
Release 15.0
/ansys_inc/v150/autodyn/usrsub/<platform>
The platform directory is either:
August 5, 2013
15
Release 15.0
Define the path for HP-MPI directory in autolnk, OR, set environment
/ansys_inc/v150/autodyn/hpmpi/<platform>
August 5, 2013
16
Release 15.0
For parallel processing, path in parallel.cfg file should also point to the
path of customized AUTODYN executable
August 5, 2013
17
Release 15.0
August 5, 2013
18
Release 15.0
Double click it
to open the file
August 5, 2013
19
Release 15.0
! OUTPUT PARAMETERS
Formal Parameters
IMPLICIT NONE
Data modules
! MODULE 'IJKNOW'
Y2
Subroutine description
! ************************************************************************
! THIS IS A USER SUPPLIED SUBROUTINE WHICH COMPUTES A BOUNDARY
! PRESSURE FOR A CELL FACE. THE FACE OF THE CELL MUST EITHER BE
! ON A GRID BOUNDARY (I=1,I=IMAX,J=1,J=JMAX) OR MUST BE ADJACENT
! TO AN UNUSED CELL. EXSTR IS CALLED ONCE PER CYCLE FOR EACH CELL
! FACE ASSIGNED THE USER STRESS CONDITION THROUGH INPUT. EXSTR IS
! USED IF THE BOUNDARY PRESSURE CANNOT BE DEFINED USING ONE OF THE
! STANDARD FUNCTIONS PROVIDED BY AUTODYN.
! MODULE 'CYCVAR'
!
!
!
Useful Variables
contained in data
modules
! ************************************************************************
! TEMPORARY ERROR MESSAGE - REPLACE WITH YOUR OWN CODE
CALL USR_MESSAG ('$User subroutine EXSTR missing$')
NSWRAP = 9
! INPUT PARAMETERS
! NAMSTR BOUNDARY CONDITION NAME (DEFINED BY USER DURING INPUT)
! RBC(1-5) INPUT PARAMETERS FOR BOUNDARY CONDITION
! I1,J1
!
! I2,J2
PRES
Definition of
Output
Parameters
RETURN
(replace it with
required coding)
)
) CELL FACE RUNS FROM (I1,J1) TO (I2,J2)
)
! X1,Y1
COORDINATES OF (I1,J1)
! X2,Y2
COORDINATES OF (I2,J2)
Definition of input
parameters
August 5, 2013
20
Release 15.0
Data Modules
Function calls
Input parameters Output parameter
August 5, 2013
21
Release 15.0
August 5, 2013
22
YB
Release 15.0
August 5, 2013
23
Release 15.0
Type
Timing of calls
August 5, 2013
24
Release 15.0
Usage:
Purpose:
August 5, 2013
25
Usage:
Purpose:
Release 15.0
Purpose:
Example:
CHARACTER*1 YON
CALL GETYON (YON, 'Stop run - are you sure?')
IF (YON=='Y') STOP
August 5, 2013
26
Release 15.0
Purpose:
Example:
August 5, 2013
27
Release 15.0
August 5, 2013
28
Release 15.0
Used for structured Lagrange, Euler, ALE, Shell and Beam meshes (grids)
Data can be accessed directly in the dynamically allocated grid arrays
(fastest)
Functions can optionally be used to assist retrieval and storage of grid
data
Must be used to access data in multi-material Euler cells
Unstructured solvers
August 5, 2013
29
Release 15.0
August 5, 2013
30
Release 15.0
August 5, 2013
31
Release 15.0
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
SUBROUTINE IANDJ (inverse of IJSET) (2D only)
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 any Part
SUBROUTINE IANDJS (inverse of IJSETS) (2D only)
August 5, 2013
32
Release 15.0
August 5, 2013
33
Release 15.0
FUNCTION GVS
Usage: GVS (NV,IJS) / GVS3(NV,IJKS)
Purpose: Gets the value of Part variable NV for the node/element IJS
/ IJKS relative to any Part
SUBROUTINE PUTGVS
Usage: CALL PUTGVS (NV,IJS,VALUE) / CALL PUTGVS3 (NV,IJKS,VALUE) ;
all values are input
Purpose: Puts (stores) the VALUE of Part variable NV for the
node/element IJS / IJKS in the dynamic storage arrays.
August 5, 2013
34
Release 15.0
August 5, 2013
35
Release 15.0
August 5, 2013
Multi-material variable
Internal array
CVF(1,matno)
Material mass
CMS(1,matno)
Material compression
CMU(1,matno)
CEN(1,matno)
Material temperature
CTP(1,matno)
Material alpha
CAL(1,matno)
CBF(1,matno)*
Material damage
CDM(1,matno)*
CPS(1,matno)*
AUTODYN-3D only
36
Release 15.0
IJ1
IJ1
IJ2
IJ2
CVF(1,M) CVF(2,M)
0.25
0.15
0.0
0.0
CVF(1,M) CVF(2,M)
0.4
0.0
0.25
0.15
0.0
0.0
0.0
0.5
0.4
0.0
0.0
0.5
August 5, 2013
37
Release 15.0
Node and element variables must be accessed and stored using the
following function calls
CALL GET_ELEM_VAR (index_elem, index_layer)
CALL GET_NODE_VAR (index_node, index_layer)
CALL PUT_ELEM_VAR (index_elem, index_layer)
CALL PUT_NODE_VAR (index_node, index_layer)
where
index_elem is the internal index for an element
index_node is the internal index for a node
index_layer is the layer (integration point) number for each
element/node
August 5, 2013
38
Release 15.0
August 5, 2013
39
Release 15.0
August 5, 2013
40
Release 15.0
August 5, 2013
41
Release 15.0
August 5, 2013
42
Release 15.0
August 5, 2013
43
Release 15.0
VAR02) to:
store the maximum pressure over time for each element / cell
store the impedance (c) of the material with the largest volume
fraction in each element / cell
Use the user executable for a 2D blast analysis
August 5, 2013
44
Release 15.0
VAR02) to:
store the maximum von-Mises stress over time for each element
store the time at which this maximum stress occurs in each element
Use the user executable for a 3D Taylor test analysis
August 5, 2013
45
Release 15.0
Equation of state
MDSTR_USER_1
MDFAI_USER_1
Failure criteria
MDERO_USER_1
Erosion criteria
August 5, 2013
46
Release 15.0
August 5, 2013
47
Release 15.0
monotonic increasing
August 5, 2013
48
Release 15.0
Example
MODULE STR_USER_1
USE kindef
IMPLICIT NONE
SAVE
! SPECIFY COMMON VARIABLES TO BE ACCESSED BY ROUTINES BELOW
HERE
! INTEGER(INT4) ::
! REAL(REAL8) ::
REAL (REAL8), DIMENSION(3) :: EP, YS
END MODULE STR_USER_1
August 5, 2013
49
Release 15.0
Custom coding
SUBROUTINE INIT_STR_USER_1(IFACT)
.
.
EQ%NAME = 'User Strength #1'
EQ%NPAR = 11 ! NUMBER OF REAL INPUT PARAMETERS
! FOR EACH REAL INPUT PARAMETER, ASSIGN DATA
! ('name ' L, T,M,H, val, min,max,default,0,required)
EQ%PAR(1)=PRMT (1,'Shear Modulus',-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,1)
EQ%PAR(2)=PRMT (2,'SC(2)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(3)=PRMT (3,'SC(3)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(4)=PRMT (4,'SC(4)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(5)=PRMT (5,'SC(5)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(6)=PRMT (6,'SC(6)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(7)=PRMT (7,'SC(7)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(8)=PRMT (8,'SC(8)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(9)=PRMT (9,'SC(9)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(10)=PRMT(10,'SC(10)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
EQ%PAR(11)=PRMT(11,'SC(11)'
,-1,-2,1,0,ZERO,ZERO,BIG,ZERO ,0,0)
.
.
August 5, 2013
50
Release 15.0
Custom coding
SUBROUTINE SET_STR_USER_1
USE material
USE str_user_1
IMPLICIT NONE
! *****************************************************
! THIS SUBROUTINE ASSIGNS SHORTCUTS
! FOR DIRECT USE IN THE SOLVER
! *****************************************************
SHRMDZ = EQ%PAR(1)%VAL
SC(1) = EQ%PAR(1)%VAL
SC(2) = EQ%PAR(2)%VAL
SC(3) = EQ%PAR(3)%VAL
SC(4) = EQ%PAR(4)%VAL
SC(5) = EQ%PAR(5)%VAL
SC(6) = EQ%PAR(6)%VAL
SC(7) = EQ%PAR(7)%VAL
SC(8) = EQ%PAR(8)%VAL
SC(9) = EQ%PAR(9)%VAL
SC(10) = EQ%PAR(10)%VAL
SC(11) = EQ%PAR(11)%VAL
RETURN
END SUBROUTINE SET_STR_USER_1
August 5, 2013
SUBROUTINE SET_STR_USER_1
USE material
USE str_user_1
IMPLICIT NONE
! *****************************************************
! THIS SUBROUTINE ASSIGNS SHORTCUTS
! FOR DIRECT USE IN THE SOLVER
! *****************************************************
SHRMDZ = EQ%PAR(1)%VAL
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
RETURN
END SUBROUTINE SET_STR_USER_1
51
Release 15.0
Example
SUBROUTINE CHECK_STR_USER_1
USE material
USE str_user_1
IMPLICIT NONE
INTEGER (INT4) :: IERROR
! ************************************************************************
! THIS SUBROUTINE CHECKS EOS INPUT DATA
! ************************************************************************
! PLACE USER CHECKS HERE
! CHECK THAT EPS IS MONOTONICALLY INCREASING
IERROR = 0
IF (EP(1)>EP(2).OR.EP(1)>EP(3)) IERROR = 1
IF (EP(2)>EP(3)) IERROR = 1
IF (IERROR==1) THEN
CALL USR_ERROR (' ERROR !','USER STRENGTH MODEL. Plastic strain must be monotonically
increasing.')
END IF
RETURN
END SUBROUTINE CHECK_STR_USER_1
August 5, 2013
52
Release 15.0
Example
SUBROUTINE SOLVE_STR_USER_1_2D
(PRES,TT1,TT2,TT3,XMUT,EPST,EPSD,TEMPT,DAMAGE,YIELDT,IFAIL)
.
! SUBROUTINE CALLED BY ALL STRENGTH MODELS SO SKIP OUT, BY DEFAULT
IF (NSTR/=IMF_STR_USER_1) GO TO 900
! THIS ROUTINE IS ONLY WRITTEN FOR TANTALUM.
! CHECK THAT NO OTHER MATERIAL TRIES TO USE THIS ROUTINE.
IF (MTL%NAME(1:8)/='TANTALUM') THEN
CALL USR_MESSAG ('USER STRENGTH MODEL called for invalid material')
NSWRAP = 99
YIELDT = ZERO
GO TO 900
END IF
August 5, 2013
53
Release 15.0
900 RETURN
END SUBROUTINE SOLVE_STR_USER_1_2D
August 5, 2013
54
Release 15.0
August 5, 2013
55
Release 15.0
August 5, 2013
56
Release 15.0
August 5, 2013
57
Release 15.0
August 5, 2013
58
Release 15.0
August 5, 2013
59
Release 15.0
August 5, 2013
60
Release 15.0
User Subroutines
Workshop
August 5, 2013
61
Release 15.0