Returns node incident data in a contact incident as an array.
Called By
CNFSUB and CFFSUB only.
Calling Sequence in FORTRAN
FLEX_CONTACT_DATA (id, comp, data, errflag)
Function Prototype (C/C++)
void c_get_flex_contact_data(int id, int comp, double* data, int* errflag)
Input Argument
id | An integer variable specifying the ID of the corresponding CONTACT statement. |
comp | An integer value that specifies the component of the FLEX_CONTACT_DATA to be returned. All arrays are double precision. 1 - Array of (x,y,z) coordinates of nodes in I geometry coordinates. 2 - Array of (x,y,z) coordinates of nodes in J geometry coordinates. 3 - Array of (x,y,z) coordinates of node normal vectors in I geometry coordinates. 4 - Array of (x,y,z) coordinates of node normal vectors in J geometry coordinates. 5 - Array of node penetrations (gap). 6 - Array of first time-derivatives of node penetration (gapdot). 7 - Array of second time-derivatives of node penetration (gapdotdot). 8 - Array of contact deformation (slip) each node (available only in CFFSUB). 9 - Array of slip velocities at each node (available only in CFFSUB). 10 - Array of normal force magnitude at each node (available only in CFFSUB). |
Output Argument
data | A double precision array of requested node incident data. |
errflag | An integer variable that indicates if Adams successfully finds node incident data. If FLEX_CONTACT_DATA detects an error, it sets errflag to a non-zero value. |
Extended Definition
The arrays are composed of individual node data that is normally passed as input when CNFSUB/CFFSUB is called for each node. Calling CNFSUB/CFFSUB just once for all nodes is explained in documentation for Utility Subroutine N_NODE_INCIDENTS.
Example (FORTRAN)
SUBROUTINE CNFSUB(ID, TIME, PAR, NPAR, LOCI, NI, LOCJ, NJ,
& GAP, GAPDOT, GAPDOTDOT, AREA, DFLAG, IFLAG, FORCE_ARRAY)
C
C === Type and dimension statements ===================
IMPLICIT NONE
INTEGER ID
DOUBLE PRECISION TIME
DOUBLE PRECISION PAR(*)
INTEGER NPAR
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
INTEGER DFLAG
INTEGER IFLAG
DOUBLE PRECISION FORCE_ARRAY(*)
C
INTEGER ARRAY_SIZE, I, ERRFLG, NODE_INCIDENTS, ONE_CALL
DOUBLE PRECISION K, C, E, D, VEC(200)
DOUBLE PRECISION FORCE(3)
COMMON /SFCOM/ K, C, E, D
DOUBLE PRECISION, ALLOCATABLE, TARGET :: LOCI_ARRAY(:)
DOUBLE PRECISION, ALLOCATABLE, TARGET :: LOCJ_ARRAY(:)
DOUBLE PRECISION, ALLOCATABLE :: GAP_ARRAY(:)
DOUBLE PRECISION, ALLOCATABLE :: GAPDOT_ARRAY(:)
DOUBLE PRECISION, POINTER :: PTR(:)
SAVE ARRAY_SIZE
SAVE LOCI_ARRAY, LOCJ_ARRAY, GAP_ARRAY, GAPDOT_ARRAY
C
C ===Executable code ==================================
C
C Initialize Contact parameters
IF (IFLAG .EQ. 1) THEN
K = PAR(1)
E = PAR(2)
C = PAR(3)
D = PAR(4)
C Allocate arrays with initial size of 100
ARRAY_SIZE = 100
PTR => LOCI_ARRAY
C Allocate memory for arrays
IF (.NOT. ASSOCIATED(PTR)) THEN
ALLOCATE(LOCI_ARRAY(3*ARRAY_SIZE))
ALLOCATE(LOCJ_ARRAY(3*ARRAY_SIZE))
ALLOCATE(GAP_ARRAY(ARRAY_SIZE))
ALLOCATE(GAPDOT_ARRAY(ARRAY_SIZE))
ENDIF
ENDIF
C Initialize incidents to zero
NODE_INCIDENTS = 0
C ONE_CALL = 1 tells Solver we want a single call to this Usersub C for all nodes in incident
ONE_CALL = 1
C Get number of nodes for this incident
CALL N_NODE_INCIDENTS(ID, ONE_CALL, NODE_INCIDENTS, ERRFLG)
IF ((ONE_CALL .EQ. 1) .AND. (NODE_INCIDENTS .GT. 0) .AND.
& (IFLAG .EQ. 0)) THEN
C Check number of nodes against Array size
IF (NODE_INCIDENTS .GT. ARRAY_SIZE) THEN
DEALLOCATE(LOCI_ARRAY)
DEALLOCATE(LOCJ_ARRAY)
DEALLOCATE(GAP_ARRAY)
DEALLOCATE(GAPDOT_ARRAY)
ALLOCATE(LOCI_ARRAY(3*NODE_INCIDENTS))
ALLOCATE(LOCJ_ARRAY(3*NODE_INCIDENTS))
ALLOCATE(GAP_ARRAY(NODE_INCIDENTS))
ALLOCATE(GAPDOT_ARRAY(NODE_INCIDENTS))
ARRAY_SIZE = NODE_INCIDENTS
ENDIF
C Get Array data
CALL FLEX_CONTACT_DATA(ID, 1, LOCI_ARRAY, ERRFLG)
CALL FLEX_CONTACT_DATA(ID, 2, LOCJ_ARRAY, ERRFLG)
CALL FLEX_CONTACT_DATA(ID, 5, GAP_ARRAY, ERRFLG)
CALL FLEX_CONTACT_DATA(ID, 6, GAPDOT_ARRAY, ERRFLG)
C Compute Normal Force at each node
DO I = 1, NODE_INCIDENTS
CALL IMPACT(GAP_ARRAY(I), GAPDOT_ARRAY(I), 0.0D0, K, E, C,
& D, 0, FORCE, ERRFLG)
CALL ERRMES(ERRFLG,'ERROR CALLING IMPACT',ID,'STOP')
FORCE_ARRAY(I) = FORCE(1)
END DO
ELSE
C Case of ONE_CALL=0 or no nodes in incident
CALL IMPACT(GAP, GAPDOT, 0.0D0, K, E, C, D, 0, FORCE, ERRFLG)
CALL ERRMES(ERRFLG,'ERROR CALLING IMPACT',ID,'STOP')
ENDIF
C Deallocate memory
IF (IFLAG .EQ. 5) THEN
PTR => LOCI_ARRAY
IF (ASSOCIATED(PTR)) THEN
DEALLOCATE(LOCI_ARRAY)
DEALLOCATE(LOCJ_ARRAY)
DEALLOCATE(GAP_ARRAY)
DEALLOCATE(GAPDOT_ARRAY)
ENDIF
ENDIF
RETURN
END