CONTACT_INCIDENT_INDEX

A call to the CONTACT_INCIDENT_INDEX utility subroutine returns the integer number (index) of incident currently active in the specified CONTACT (C++ Solver only).

Use

Called By

CNFSUB and CFFSUB only.

Calling Sequence in FORTRAN

CALL CONTACT_INCIDENTS (id, index, errflg)

Function Prototype (C/C++)

void get_contact_incident_index(int id, int *n, int *errflg)

Input Argument

 
id
An integer variable that provides the identifier of the CONTACT statement for which the incident index is incidents is requested.

Output Argument

 
index
An integer variable that provides the identifier (index) of the current incident of the CONTACT specified by id.
errflg
An integer variable that indicates if Adams successfully finds the incident index. If CONTACT_INCIDENT_INDEX detects an error, it sets errflg to a non-zero value before it returns to the calling subroutine.

Extended Definition

The User-Written Subroutines CNFSUB and CFFSUB are called once for each incident in a CONTACT. This utility function enables users the to scale or modify the computed force based on the incident index. Since the Contact incident index is valid only during Contact force calculation, this utility function should not be called from any User-Written Subroutines except CNFSUB and CFFSUB.
 
Note:  
Calling this function from the F77 Solver will generate an Error message.
 
Caution:  
Since Contact incidents can appear and disappear at any time, it is not possible to guarantee that the order in which incidents are returned from CONTACT_INCIDENT_INDEX will not change.

Example 1 (FORTRAN)

SUBROUTINE CNFSUB(ID, TIME, PAR, NPAR, LOCI, NI, LOCJ, NJ,
& GAP, GAPDOT, GAPDOTDOT, AREA, DFLAG, IFLAG, FORCE)
C
C === Type and dimension statements ===================
C
INTEGER ID, NPAR
DOUBLE PRECISION TIME
DOUBLE PRECISION PAR( * )
DOUBLE PRECISION LOCI(3)
DOUBLE PRECISION NI(3)
DOUBLE PRECISION LOCJ(3)
DOUBLE PRECISION NJ(3)
DOUBLE PRECISION GAP
DOUBLE PRECISION GAPDOT
DOUBLE PRECISION GAPDOTDOT
DOUBLE PRECISION AREA
LOGICAL DFLAG
LOGICAL IFLAG
DOUBLE PRECISION FORCE(3)
C
INTEGER ERRFLG, INDEX
C
C ===Executable code ==================================
C
 
ERRFLG = 0
 
IF ( .NOT. IFLAG ) THEN
C Get number of incidents for this contact
C
CALL CONTACT_INCIDENT_INDEX(ID, INDEX, ERRFLG)
 
ENDIF
 
RETURN
END
 

Example 2 (C/C++)

void Cnfsub(const struct sAdamsContactFriction* cnf, double TIME, const double* LOCI,
const double* NI, const double* LOCJ, const double* NJ, double GAP,
double GAPDOT, double GAPDOTDOT, double AREA, DFLAG, int IFLAG,
double* FORCE)
{
int Id = cnf->contact.ID;
int incidents = 0;
int errflg = 0, index = 0;
 
if (!IFLAG)
{
// get number of incidents for this contact
c_get_contact_incident_index(Id, &incidents, &errflg);
}
 
 
}