4.8.3.90. IMPACT
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) |
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 |
|
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. |
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
#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];
}