4.8.3.90. IMPACT

Table 4.225 Function Name

Language type

Subroutine

FORTRAN

call rd_impact(x, xdot, x1, k, e, cmax, d, order, value, errflg) or impact(x, xdot, x1, k, e, cmax, d, order, value, errflg)

C/C++

rd_impact(x, xdot, x1, k, e, cmax, d, order, &value[0], &errflg) or impact(x, xdot, x1, k, e, cmax, d, order, &value[0], &errflg)

Table 4.226 Parameter information

Variable Name

Size

Description

x

double

Specify the distance variable the user want to use to compute the force.

xdot

double

Communicate to IMPACT the time derivative of X.

x1

double

Specify the free length of x.

k

double

Specify the stiffness of boundary surface interaction.

e

double

Specify the exponent of the force deformation characteristic.

cmax

double

Specify the maximum damping coefficient.

d

double

The depth at which the damping coefficient reaches 0.

order

int

  1. order = 0

    \(\begin{aligned} & value[0]=\left\{ \begin{array}{*{35}{l}} k{{({{x}_{1}}-x)}^{e}}-\text{STEP}(x,{{x}_{1}}-d,cmax,{{x}_{1}},0)\times \dot{x} & x<{{x}_{1}} \\ 0 & x<{{x}_{1}}\And \text{IMPACT}<0 \\ 0 & x\ge {{x}_{1}} \\ \end{array} \right. \\ & value[1]=0 \\ & value[2]=0 \\ \end{aligned}\)

  2. order = 1

    \(\begin{aligned} & value[0]=\left\{ \begin{array}{*{35}{l}} -ke{{({{x}_{1}}-x)}^{e-1}}-\text{STEP}(x,{{x}_{1}}-d,cmax,{{x}_{1}},1)\times \dot{x} & x<{{x}_{1}} \\ 0 & x<{{x}_{1}}\And \text{IMPACT}<0 \\ 0 & x\ge {{x}_{1}} \\ \end{array} \right. \\ & value[1]=\left\{ \begin{array}{*{35}{l}} -\text{STEP}(x,{{x}_{1}}-d,cmax,{{x}_{1}},0) & x<{{x}_{1}} \\ 0 & x<{{x}_{1}}\And \text{IMPACT}<0 \\ 0 & x\ge {{x}_{1}} \\ \end{array} \right. \\ & value[2]=0 \\ \end{aligned}\)

  3. order = 2

    \(\begin{aligned} & value[0]=\left\{ \begin{array}{*{35}{l}} ke(e-1){{({{x}_{1}}-x)}^{e-2}}-\text{STEP}(x,{{x}_{1}}-d,cmax,{{x}_{1}},2)\times \dot{x} & x<{{x}_{1}} \\ 0 & x<{{x}_{1}}\And \text{IMPACT}<0 \\ 0 & x\ge {{x}_{1}} \\ \end{array} \right. \\ & value[1]=\left\{ \begin{array}{*{35}{l}} -\text{STEP}(x,{{x}_{1}}-d,cmax,{{x}_{1}},1) & x<{{x}_{1}} \\ 0 & x<{{x}_{1}}\And \text{IMPACT}<0 \\ 0 & x\ge {{x}_{1}} \\ \end{array} \right. \\ & value[2]=0 \\ \end{aligned}\)

value

double[3]

error

logical/int

If an error is encountered in invoking Predefined subroutine, this variable becomes true. This variable must be declared as a logical variable.

Listing 4.96 Fortran code for IMPACT
 C---- SUB. AXIAL_FORCE : AXIAL(TRA,ROT)
       SUBROUTINE AXIAL_FORCE
     &          (TIME,UPAR,NPAR,JFLAG,IFLAG,RESULT)
 C---- TO EXPORT * SUBROUTINE
       !DEC$ ATTRIBUTES DLLEXPORT,C::AXIAL_FORCE

 C---- INCLUDE SYSTEM CALL
       INCLUDE 'SYSCAL.F'

 C---- DEFINE VARIABLES
 C     Parameter Information
 C     TIME   : Simulation time of RD/Solver. (Input)
 C     UPAR   : Parameters defined by user. (Input)
 C     NPAR   : Number of user parameters. (Input)
 C     JFLAG  : When RD/Solver evaluates a Jacobian, the flag is true. (Input)
 C     IFLAG  : When RD/Solver initializes arrays, the flag is true. (Input)
 C     RESULT : Returned axial force or torque value. (Output)

       DOUBLE PRECISION TIME, UPAR(*)
       INTEGER NPAR
       LOGICAL JFLAG, IFLAG
       DOUBLE PRECISION RESULT[REFERENCE]

 C---- USER STATEMENT
 C---- LOCAL VARIABLE DEFINITIONs
       DOUBLE PRECISION VALUE(3), DY, VY
       INTEGER MKID(5),PI
       INTEGER ID(2)
       LOGICAL ERRFLG

 C---- ASSIGN IMPACT PARAMETERS
       ID(1) = INT(UPAR(1))
       ID(2) = INT(UPAR(2))
       DO I = 1, 5
         MKID(I) = UPAR(I+2)
       ENDDO
       PI = ACOS(-1,0D0)

 C---- CALL AUXILIARY SUBROUTINES FOR CALCULATIONS
       CALL SYSFNC('DY',ID,2,DY,ERRFLG)
       CALL SYSFNC('VY',ID,2,DY,ERRFLG)

       CALL RD_IMPACT(DY,VY,MKID(1),MKID(2),MKID(3)
     &               ,MKID(4),MKID(5),0,VALUE,ERRFLG)

 C---- ASSIGN THE RETURNED VALUE
       RESULT = VALUE(1)

       RETURN
       END
Listing 4.97 C/C++ code for IMPACT
 #include "stdafx.h"
 #include "DllFunc.h"

 LINSPL_API void __cdecl axial_force
   (double time, double upar[], int npar, int jflag, int iflag, double* result)
 {
   using namespace rd_syscall;
   // Parameter Information
   //   time   : Simulation time of RD/Solver. (Input)
   //   upar   : Parameters defined by user. (Input)
   //   npar   : Number of user parameters. (Input)
   //   jflag  : When RD/Solver evaluates a Jacobian, the flag is true. (Input)
   //   iflag  : When RD/Solver initializes arrays, the flag is true. (Input)
   //   result : Returned axial force or torque value. (Output)

   // User Statement
   // LOCAL VARIABLE DEFINITION
   double value[3], mkid[5], DY,VY;
   int ID[2], errflg, i;

   // Assign Impact Parameters
   ID[0] = (int)upar[0];
   ID[1] = (int)upar[1];

   for(i=0;i<5;i++){
       mkid[i] = upar[i+2];
   }

   // Call the Auxiliary subroutines for calculation
   sysfnc("DY",ID,2,&DY,&ERRFLG);
   sysfnc("VY",ID,2,&VY,&ERRFLG);
   rd_impact(DY,VY,mkid[0],mkid[1],mkid[2], mkid[3],mkid[4],0,&value[0],&errflg);

   // Assign the returned Value
   *result = value[0];
 }