*deck,userwear              parallel  USERDISTRIB                           sm
      subroutine userwear(WearInc,WearDir,TotWearOld,strain,
     x     stress,temperature,dtime,YieldStress,nTbprop,Tbprop,
     x     coor,kstat,elem,intpt,ndim,localr)
c *** Primary Function:   Calculates the Wear Increment and (optionally) wear direction
c *** Notice - This file contains ANSYS Confidential information ***
c
c
c         *** Copyright ANSYS.  All Rights Reserved.
c         *** ansys, inc.
c input arguments:
c     variable (type,sze,intent)    description
c
c     ndim     (int,sc,in)         - number of dimensions of the problem
c                                    = 2 2D
c                                    = 3 3D
c     TotWearOld(dp,ar(ndim),in)   - Total Wear at the contact point at the previous substep
c     strain   (dp,ar(3),in)   - current strain components in contact surface coordinate system
c                                    strain(1) = slip increment in direction 1
c                                    strain(2) = slip increment in direction 2 
c                                                (3D only)
c                                    strain(3) = contact normal gap/penetration
c                                    < 0 : gap
c                                    > 0 : penetration
c     stress   (dp,ar(3),in)   - stress components  in contact surface coordinate system
c                                    stress(1) = frictional stress in direction 1
c                                    stress(2) = frictional stress in direction 2 
c                                                (3D only)
c                                    stress(3) = contact normal pressure
c                                    > 0 : compression
c                                    < 0 : tension
c     temperature  (dp,sc,in)      - temperature
c     dtime (dp,sc,in)             - time increment
c     YieldStress (dp,sc,in)       - Yield stress of underlying element (defined only for Plastic material-see doc for restrictions)
c     nTbprop (int,sc,in)          - Number of TBdata for Tb,Wear per field
c     Tbprop (dp,ar(nTbprop,in)    - TB data for the the Tb,Wear option at the given temperature 
c     coor     (dp,ar(6),in)       - Coordinates of the contact detection point
c                                     coor(1) current x
c                                     coor(2) current y
c                                     coor(3) current z
c                                     coor(4) initial x
c                                     coor(5) initial y
c                                     coor(6) initial z
c     kstat    (int,sc,in)          - contact status (current substep)
c                                     3 : stick
c                                     2 : sliding
c                                     1 : open contact (near)
c                                     0 : open contact (far) 
c     elem     (int,sc,in)         - element number
c     intpt    (int,sc,in)         - element integration point number
c     localr   (dp,ar(3,3),in)     - the direction cosines of the local surface 
c                                    coordinate system at contact detection
c                                    localr(1,1),localr(1,2),localr(1,3) in 
c                                                          slip direction 1
c                                    localr(2,1),localr(2,2),localr(2,3) in
c                                                          slip direction 2
c                                    localr(3,1),localr(3,2),localr(3,3) in 
c                                                           normal direction
c Output Arguments:
c     variable (type,sze,intent)   description
c
c     WearInc  (dp,sc)             - Increment in the Wear (magnitude)- User must define
c     WearDir  (dp,ar(ndim),inout) - Direction cosines in global coordinate system
c                                    in which wear increment will be applied- Optional  
c                                    default coming in -Contact normal direction
#include "impcom.inc"  
c     input
      integer ndim,elem,intpt,nTbprop,kstat
      double precision TotWearOld(ndim),WearDir(ndim),strain(3),
     x     stress(3),temperature,dtime,YieldStress,Tbprop(nTbprop),
     x     coor(6),localr(3,3)
c     output
      double precision WearInc


 999   continue
      return
      end subroutine userwear
