CNFSUB

ModelingUsed to calculate normal forces for the Force_Contact element.

Use

Implements a custom normal force for contact.

<Force_Contact
     id                  = "301001"
     num_i_graphics      = "1"
     i_graphics_id       = "90000"
     num_j_graphics      = "1"
     j_graphics_id       = "90001"
     cnf_type            = "UserCNF"
     cnf_param_string    = "USER(500.,1.5,0.5,0.01)"
     cnf_fnc_name        = "CNFSUB"
     cnf_dll_name        = "NULL" 
     cff_type            = "Coulomb_On"
     mu_static           = "0.05"
     mu_dynamic          = "0.01"
     stiction_trans_vel  = "0.1"
     friction_trans_vel  = "0.5"
  />

Format

Fortran Calling Syntax
SUBROUTINE CNFSUB (ID, TIME, PAR, NPAR, LOCI, NI, LOCJ, NJ, GAP, GAPDOT, GAPDOTDOT, AREA, DFLAG, IFLAG, RESULTS)
C/C++ Calling Syntax
void STDCALL CNFSUB (int *id, double *time, double *par, int *npar, double *loci, double *ni, double *locj, double *nj, double *gap, double *gapdot, double *gapdotdot, int *dflag, int *iflag, double *result)
Python Calling Syntax
def CNFSUB(id, time, par, npar, loci, ni, locj, nj, gap, gapdot, gapdotdot, dflag, iflag):
    return result
MATLAB Calling Syntax
function vector = CNFSUB(id, time, par, npar, loci, ni, locj, nj, gap, gapdot, gapdotdot, dflag, iflag)

Attributes

AREA
[double precision]
The area of the contact patch.
DFLAG
[logical]
A Boolean variable that MotionSolve sets to true when it needs partial derivatives. Otherwise, it is set to false.
GAP
[double precision]
The gap between I_GRAPHICS_ID and J_GRAPHICS_ID. If GAP is positive or zero, there is no contact or penetration.
GAPDOT
[double precision]
The first time derivative of GAP.
GAPDOTDOT
[double precision]
The second time derivative of GAP.
ID
[integer]
Force_Contact element identifier.
IFLAG
[logical]
A Boolean variable that MotionSolve sets to true when it needs to know on which functions CNFSUB depends. When the flag is set to false, then the values of the user-defined expressions are computed.
LOCI
[double precision]
An array that contains the position vector of the contact point on I_GRAPHICS_ID with respect to the origin of the I_GRAPHICS_ID reference marker, resolved in the I_GRAPHICS_ID reference marker coordinate system.
LOCJ
[double precision]
An array that contains the position vector of the contact point on J_GRAPHICS_ID with respect to the origin of the J_GRAPHICS_ID reference marker, resolved in the J_GRAPHICS_ID reference marker coordinate system.
NI
[double precision]
An array that contains the surface normal vector at the contact point on I_GRAPHICS_ID, resolved in the I_GRAPHICS_ID reference marker coordinate system.
NJ
[double precision]
An array that contains the surface normal vector at the contact point on J_GRAPHICS_ID, resolved in the J_GRAPHICS_ID reference marker coordinate system.
NPAR
[integer]
The number of entries in the PAR array.
PAR
[double precision]
An array that contains the constant arguments from the list provided in the user-defined statement.
TIME
[double precision]
The current simulation time.

Output

RESULT
[double precision]
The value of the normal force.

Example

def CNFSUB(id, time, par, npar, loci, ni, locj, nj, gap, gapdot, gapdotdot, dflag, iflag):
    stiffness = par[0]
    exponent = par[1]
    damping = par[2]   
    dmax = par[3]

    spring_force = stiffness*pow(fabs(gap),exponent)
    [tmp,errflg] = py_step(gap,-dmax,damping,0.0,0.0,0)
    damping_force = -tmp*gapdot

        result =3*[0]
        result[0] = spring_force+damping_force
        if result[0]<0.0:
            result[0] = 0.0
    return result