CFFSUB
ModelingUsed to calculate friction forces for the Force_Contact element.
Use
Implements a friction 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 = "Impact"
stiffness = "500."
exponent = "1.5"
damping = "0.5"
dmax = "0.01"
cff_type = "UserCFF"
cff_param_string = "USER(0.05,0.01,0.1,0.5)"
cff_fnc_name = "CFFSUB"
cff_dll_name = "NULL"
/>
Format
- Fortran Calling Syntax
-
SUBROUTINE CFFSUB (ID, TIME, PAR, NPAR, LOCI, LOCJ, X, XDOT, NFORCE, AREA, DFLAG, IFLAG, RESULTS)
- C/C++ Calling Syntax
-
void STDCALL CFFSUB (int *id, double *time, double *par, int *npar, double *loci, double *locj, double *x, double *xdot, double *nforce, int *dflag, int *iflag, double *result)
- Python Calling Syntax
-
def CFFSUB(id, time, par, npar, loci, locj, x, xdot, nforce, dflag, iflag): return result
- MATLAB Calling Syntax
-
function vector = CFFSUB(id, time, par, npar, loci, locj, x, xdot, nforce, dflag, iflag)
Attributes
- AREA
- [double precision]
- DFLAG
- [logical]
- ID
- [integer]
- IFLAG
- [logical]
- LOCI
- [double precision]
- LOCJ
- [double precision]
- NFORCE
- [double precision]
- NPAR
- [integer]
- PAR
- [double precision]
- TIME
- [double precision]
- X
- [double precision]
- XDOT
- [double precision]
Output
- RESULT
- [double precision]
Example
def CFFSUB(id, time, par, npar, loci, locj, x, xdot, nforce, dflag, iflag):
result = [0,0,0]
mu_sta =float(par[0])
mu_dyn = float(par[1])
vs = float(par[2])
vd = float(par[3])
v = sqrt(xdot[0]*xdot[0]+xdot[1]*xdot[1])
mu = 0.0
if v>=vd:
mu = mu_dyn
elif v>vs:
mu, errflg] = py_step(v, vs, mu_sta, vd, mu_dyn,0)
else:
[mu, errflg] = py_step(v, -vs, -mu_sta, vs, mu_sta,0)
result[0] = -mu*(nforce)*xdot[0]/v
result[1] = -mu*(nforce)*xdot[1]/v
return result