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]
 DFLAG
 [logical]
 GAP
 [double precision]
 GAPDOT
 [double precision]
 GAPDOTDOT
 [double precision]
 ID
 [integer]
 IFLAG
 [logical]
 LOCI
 [double precision]
 LOCJ
 [double precision]
 NI
 [double precision]
 NJ
 [double precision]
 NPAR
 [integer]
 PAR
 [double precision]
 TIME
 [double precision]
Output
 RESULT
 [double precision]
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