*deck,uservp       USERDISTRIB  parallel                                dc
      subroutine uservp (elem,mat,kfirst,kfsteq,g,prop,timval,timinc,
     x tem,toffst,delepn,svrn,svri,usvr,epeln,epeli,strn,stri,depdt,
     x cee,eta,norm)
c
c *** primary function:    update the nonlinear strain history for a
c                          user-defined material for the viscoxxx elements
c *** secondary functions: compute the material tangent terms
c                     accessed with tb,user and keyopt(1) = 1
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c
c         *** Copyright ANSYS.  All Rights Reserved.
c         *** ansys, inc.
c
c  input arguments:
c     variable (type,sze,intent)    description
c
c     elem     (int,sc,in)         - element number (label)
c     mat      (int,sc,in)         - material reference number
c     kfirst   (int,sc,in)         - 1 if first time through, 0 otherwise
c                                    (useful for initializing state variables
c                                    to a non-zero value)
c     kfsteq   (int,sc,in)         - 1 if first equilibrium iteration of a
c                                    substep, 0 otherwise
c
c     g        (dp,sc,in)          - shear modulus
c     prop     (dp,ar(13),in)      - linear material property array
c                                    (ex,ey,ez, gxy,gyz,gxz, nuxy,nuyz,nuxz,
c                                     alpx,alpy,alpz, dens)
c
c     timval   (dp,sc,in)          - current time value
c     timinc   (dp,sc,in)          - time increment over this substep
c
c     tem      (dp,sc,in)          - temperature at the end of this substep
c     toffst   (dp,sc,in)          - temperature offset from absolute zero
c
c     delepn   (dp,ar(3,3),in)     - hencky strain increment over the substep
c
c     svrn     (dp,sc,in)          - state variable from previous substep
c     svri     (dp,sc,inout)       - state variable from previous iteration
c     usvr     (dp,ar(*),inout)    - additional state variables from previous
c                                    iteration (saved if the nsvr command is
c                                    used)
c
c     epeln    (dp,ar(3,3),in)     - elastic strain from previous substep
c     epeli    (dp,ar(3,3),inout)  - elastic strain from previous iteration
c
c     strn     (dp,ar(3,3),in)     - stress from previous substep
c     stri     (dp,ar(3,3),inout)  - stress from previous iteration
c
c     depdt    (dp,sc,inout)       - effective inelastic deformation rate
c                                    (d(deppl)/dt) from previous iteration
c
c  output arguments:
c     variable (type,sze,intent)    description
c
c     svri     (dp,sc,inout)       - updated state variable
c     usvr     (dp,ar(*),inout)    - updated additional state variables
c
c     epeli    (dp,ar(3,3),inout)  - updated elastic strain
c     stri     (dp,ar(3,3),inout)  - updated stress
c
c     depdt    (dp,sc,inout)       - effective inelastic deformation rate
c
c     cee      (dp,sc,out)         - scalar linearization modulus (see below)
c     eta      (dp,sc,out)         - radial return factor (see below)
c     norm   (dp,ar(3,3),out)      - direction of plastic flow
c
c  fortran parameters (to be defined by the author):
c     variable (type)              description
c     numinp   (int)               - number of data items in the user-defined
c                                    data table (tbdat commands)
c     nuval    (int)               - number of additional state variables per
c                                    integration point
c     nintp    (int)               - maximum number of integration points of
c                                    an element to be used with this routine
c                                    (8 is the maximum)
c         note:  nuval x nintp cannot exceed 840!
c
#include "impcom.inc"


       external erhandler

c
c  author-defined fortran parameters
c     --- size of usvr data
      integer nuval,nintp
      parameter (nuval=1,nintp=1)
c     --- number of data items in the user-defined data table (tbdat commands)
      integer numinp
      parameter (numinp=1)
c
c  external subroutines and functions
      external tbuser
c
c  integer variables
      integer elem,mat,kfirst,kfsteq
c
c  double precision variables
      double precision g,prop(*),timval,timinc,tem,toffst,delepn(3,3),
     x svrn,svri,usvr(nuval,nintp),epeln(3,3),epeli(3,3),strn(3,3),
     x stri(3,3),depdt,cee,eta,norm(3,3),
     x proptb(numinp)
c
c -----------------------------------------------------------------------
c
c   all strains are the hencky (i.e. log) strains. all quantities are
c   rotation-neutralized and are in the global coordinate system. all
c   non-scalar quantities are in tensor (3x3 matrix) form. the ordering
c   is:
c                   x  xy  xz
c                  yx   y  yz
c                  zx  zy   z
c
c   all terms are presumed to be symmetric, i.e. yx=xy.
c
c   the underlying assumptions this routine (and the viscoxxx elements)
c   use are:
c      1. the material response is isotropic
c      2. the yield is pressure insensitive (deviatoric plasticity only)
c   the user routine userpl may be used if these assumptions are violated.
c
c   the isotropic material tangent is formed using:
c      'DT = K*1x1 + 2G*ETA*[I - 1/3*1x1] - 2G*(ETA - CEE)*NORMxNORM'
c   where:      1 = second order unit tensor (identity matrix)
c              'x'= tensor product
c               i = fourth order unit tensor 'DikDjl + DilDjk'
c               k = bulk modulus, ex/(3*(1-2*nuxy))
c               eta,cee,norm = author-defined values
c   note: for elastic materials (or for the initial-stiffness newton-
c   raphson approach), the author-defined values would be:
c         eta = cee = 1,   norm = 1/sqrt(3)*[identity matrix]
c
c -----------------------------------------------------------------------
c
c                     ***** initializations *****
c
c --- initial checks
c     --- author should remove the warning below when making any changes
c
      if (kfirst.eq.1)
     Xcall erhandler('uservp',5000,2,
     x 'ANSYS,INC.-supplied version of coding for USERVP has been used.'
     x ,0.0d0,' ')
c

c     --- check that author-defined usvr size is within bounds
c
      if (nuval*nintp.gt.840)
     Xcall erhandler('uservp',5010,4,
     x 'Maximum storage allowed by USVR has been exceeded.'
     x ,0.0d0,' ')
c

c
c        ***** retrieve the user-specified material data *****
c
      call tbuser (mat,numinp,proptb(1))
c
c           ***** calculate the inelastic deformation *****
c
c --- no example coding is currently supplied
c
      call erhandler('uservp',5020,4,
     x 'User-defined viscoplasticity (USERVP) is not programmed.'
     x ,0.0d0,' ')
c

c
      return
      end
