4.8.3.2. BISTOP

Table 4.49 Function Name

Language type

Subroutine

FORTRAN

call rd_bistop(x, xdot, x1, x2, k, e, cmax, d, order, value, errflg) or bistop(x, xdot, x1, x2, k, e, cmax, d, order, value, errflg)

C/C++

rd_bistop(x, xdot, x1, x2, k, e, cmax, d, order, &value, &errflg) or bistop(x, xdot, x1, x2, k, e, cmax, d, order, &value, &errflg)

Table 4.50 Parameter information

Variable Name

Size

Description

x

double

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

xdot

double

Communicates to IMPACT the time derivative of X

x1

double

Specify the lower bound of x.

x2

double

Specify the upper bound of x.

k

double

Specify the stiffness of boundary surface interaction.

E

double

The nonlinear coefficient value on the surface of the spring force.

cmax

double

Specify the maximum damping coefficient.

d

double

The depth of infiltration that induces the maximum damping coefficient.

order

int

BISTOP & IMPACT

Order

value(1)

value(2)

value(3)

order=0

\(F(x,{\dot{x}})\)

0

0

\(F(x)\)

order=1

\(\frac{\partial{F(x,{\dot{x}})}}{\partial{x}}\)

\(\frac{\partial{F(x,{\dot{x}})}}{\partial{\dot{x}}}\)

0

\(\frac{\partial{F(x)}}{\partial{x}}\)

order=2

\(\frac{\partial^2{F(x,{\dot{x}})}}{\partial{x^2}}\)

\(\frac{\partial^2{F(x,{\dot{x}})}}{\partial{\dot{x}}\partial{x}}\)

0

\(\frac{\partial^2{F(x)}}{\partial{x^2}}\)

value

double

errflg

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.36 Fortran code for BISTOP
 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
       DOUBLE PRECISION MKID(6),PI
       INTEGER ID(2)
       LOGICAL ERRFLG

 C---- ASSIGN IMPACT PARAMETERS
       ID(1) = INT(UPAR(1))
       ID(2) = INT(UPAR(2))
       DO I = 1, 6
         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,VY,ERRFLG)

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

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

       RETURN
       END
Listing 4.37 C/C++ code for BISTOP
 #include "stdafx.h"
 #include "DllFunc.h"

 BISTOP_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[6],DY,VY;
   int id[2],errflg,i;

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

   for(i=0;i<6;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_bistop(DY,VY,mkid[0],mkid[1],mkid[2],mkid[3],mkid[4],mkid[5],0,&value[0],&errflg);

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

 }