N_CONTACT_INCIDENTS

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

Use

Called By

Any user-written subroutine.

Calling Sequence in FORTRAN

CALL N_CONTACT_INCIDENTS (id, n, errflg)

Function Prototype (C/C++)

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

Input Argument

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

Output Argument

 
n
An integer variable that provides the identifier of the CONTACT statement for which the number is incidents is requested.
errflg
An integer variable that indicates if Adams successfully finds the number of incidents. If N_CONTACT_INCIDENTS 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. Users may wish to scale or modify the computed force based on the total number of incidents. This utility function provides such capability. Users may also wish to access the number of incidents in other user subroutines such as REQSUB.
 
Note:  
Calling this function from the F77 Solver will generate an Error message.
 

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
C
C ===Executable code ==================================
C
 
ERRFLG = 0
 
IF ( .NOT. IFLAG ) THEN
C Get number of incidents for this contact
C
CALL N_CONTACT_INCIDENTS(ID, INCIDENTS, 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;
 
if (!IFLAG)
{
// get number of incidents for this contact
c_get_n_contact_incidents(Id, &incidents, &errflg);
}
 
 
}