#### FUNCTION

###### Parameters and functions
*FUNCTION
"Optional title"
fid, derivative, $f(0)$, $\dot{f}(0)$, type${}_{\mathrm{x}}$, type${}_{\mathrm{y}}$
expression
##### Parameter definition
VariableDescription
fid Function ID
derivative Function derivative level
options:
0 $\rightarrow$ $f(.,t)$ = expression
1 $\rightarrow$ $\dot{f}(t)$ = expression
2 $\rightarrow$ $\ddot{f}(t)$ = expression
$f(0)$ Function value at time 0 (used if derivative > 0)
$\dot{f}(0)$ First derivative of function at time 0 (used if derivative = 2)
type${}_{\mathrm{x}}$ Abscissa data type
options: time, strain, none
type${}_{\mathrm{y}}$ Ordinate data type
options: time, disp, length, velo, acc, force, stress, strain, pressure, temp, energy, none
expression Analytical expression
##### Description

This command can be used to define analytical functions to be used in the same way as curves (see CURVE) when applying loads or boundary conditions. Note that a curve and a function can not have the same ID. Functions can be defined to depend on certain simulation results, for example node velocities and contact forces. A complete listing of built in functions and parameters is given in the General section. Abscissa and ordinate data types only need to be specified if the function is to be subjected to an automatic unit conversion. A conversion is not possible for multi-dimensional functions.

If derivative=1 the expression defines the first derivative of the function (with respect to time):

$\displaystyle{ f(t) = f(0) + \int_0^t (expression) \mathrm{d}\tau }$

With derivative=2 the expression defines the second derivative of the function:

$\displaystyle{ f(t) = f(0) + \int_0^t \left[ \dot{f}(0) + \int_0^{\tau} (expression) \mathrm{d}\tau' \right] \mathrm{d}\tau }$
##### Example
###### Analytical stress-strain curve

Material hardening curves can be defined as analytical functions by using the built in variable epsp. epsp is the current effective plastic strain at the integration point where the function is evaluated.

*PARAMETER
%A = 220.0e6
%Q = 120.0e6
%C = 4.5
*MAT_METAL
"aluminium"
1, 2700.0, 70.0e9, 0.33
10
*FUNCTION
10
%A + %Q*(1 - exp(-%C*epsp))
###### Prescribed motion with feedback from sensor

Prescribed motion of a binder to match a given blank holder force. The velocity of the binder is a function of the difference between the actual force fzc(333) and the target force 1MN. fzc(333) is the z-force in contact interface with ID 333. erf is the classical error function.

*PARAMETER
%velocity = 0.1
%force = 1.0e6
*CONTACT
"blank to binder"
333
P, 2, P, 1, 0.1, 1.0e13
*BC_MOTION
"binder"
P, 1
V, Z, 123
*FUNCTION
123
%velocity * erf( 100*(fzc(333)-%force)/%force )
###### Function defined from its first derivative

Function defining the leakage of water through a hole in a tank.

*PARAMETER
# hole area
area = 0.01
# tank volume
vol = 100.0
# leakage shape coefficient
cval = 0.7
# initial tank pressure
p0 = 2.0e5
# water bulk modulus
bulk = 2.25e9
#
# tank pressure
*FUNCTION
1
%p0 - %bulk * fcn(2)/%vol
#
# leakage
*FUNCTION
2, 1
0.5*%cval*%area*fcn(1)^2
###### Function referencing a curve

Function defining a contact pressure dependent coefficient of friction. The variable pres is the local contact pressure.

*PARAMETER
mu0 = 0.2, "coefficient of friction at zero pressure"
*CONTACT
"general"
1
ALL, 0, ALL, 0, fcn(123)
*FUNCTION
"friction law"
123
%mu0*fcn(444, pres)
*CURVE
"friction scale factor"
444
0.0, 1.0
1.0e6, 1.0
2.0e6, 0.5
1.0e7, 0.5