1.1.19 UEL
User subroutine to define an element.

Product: ABAQUS/Standard  

Warning:  This feature is intended for advanced users only. Its use in all but the simplest test examples will require considerable coding by the user/developer. User-defined elements, Section 26.15.1 of the ABAQUS Analysis User's Manual, should be read before proceeding.

References

Overview

User subroutine UEL:

  • will be called for each element that is of a general user-defined element type (i.e., not defined by a linear stiffness or mass matrix read either directly or from results file data) each time element calculations are required; and

  • (or subroutines called by user subroutine UEL) must perform all of the calculations for the element, appropriate to the current activity in the analysis.

Wave kinematic data

For ABAQUS/Aqua applications four utility routines—GETWAVE, GETWAVEVEL, GETWINDVEL, and GETCURRVEL—are provided to access the fluid kinematic data. These routines are used from within user subroutine UEL and are discussed in detail in Obtaining wave kinematic data in an ABAQUS/Aqua analysis, Section 2.1.10.

User subroutine interface

      SUBROUTINE UEL(RHS,AMATRX,SVARS,ENERGY,NDOFEL,NRHS,NSVARS,
     1 PROPS,NPROPS,COORDS,MCRD,NNODE,U,DU,V,A,JTYPE,TIME,DTIME,
     2 KSTEP,KINC,JELEM,PARAMS,NDLOAD,JDLTYP,ADLMAG,PREDEF,NPREDF,
     3 LFLAGS,MLVARX,DDLMAG,MDLOAD,PNEWDT,JPROPS,NJPROP,PERIOD)
C
      INCLUDE 'ABA_PARAM.INC'
C
      DIMENSION RHS(MLVARX,*),AMATRX(NDOFEL,NDOFEL),PROPS(*),
     1 SVARS(*),ENERGY(8),COORDS(MCRD,NNODE),U(NDOFEL),
     2 DU(MLVARX,*),V(NDOFEL),A(NDOFEL),TIME(2),PARAMS(*),
     3 JDLTYP(MDLOAD,*),ADLMAG(MDLOAD,*),DDLMAG(MDLOAD,*),
     4 PREDEF(2,NPREDF,NNODE),LFLAGS(*),JPROPS(*)


      user coding to define RHS, AMATRX, SVARS, ENERGY, and PNEWDT


      RETURN
      END

Variables to be defined

These arrays depend on the value of the LFLAGS array.

RHS

An array containing the contributions of this element to the right-hand-side vectors of the overall system of equations. For most nonlinear analysis procedures, NRHS=1 and RHS should contain the residual vector. The exception is the modified Riks static procedure (Static stress analysis, Section 6.2.2 of the ABAQUS Analysis User's Manual), for which NRHS=2 and the first column in RHS should contain the residual vector and the second column should contain the increments of external load on the element. RHS(K1,K2) is the entry for the K1th degree of freedom of the element in the K2th right-hand-side vector.

AMATRX

An array containing the contribution of this element to the Jacobian (stiffness) or other matrix of the overall system of equations. The particular matrix required at any time depends on the entries in the LFLAGS array (see below).

All nonzero entries in AMATRX should be defined, even if the matrix is symmetric. If you do not specify that the matrix is unsymmetric when you define the user element, ABAQUS/Standard will use the symmetric matrix defined by , where is the matrix defined as AMATRX in this subroutine. If you specify that the matrix is unsymmetric when you define the user element, ABAQUS/Standard will use AMATRX directly.

SVARS

An array containing the values of the solution-dependent state variables associated with this element. The number of such variables is NSVARS (see below). You define the meaning of these variables.

For general nonlinear steps this array is passed into UEL containing the values of these variables at the start of the current increment. They should be updated to be the values at the end of the increment, unless the procedure during which UEL is being called does not require such an update. This depends on the entries in the LFLAGS array (see below). For linear perturbation steps this array is passed into UEL containing the values of these variables in the base state. They should be returned containing perturbation values if you wish to output such quantities.

When KINC is equal to zero, the call to UEL is made for zero increment output (see Output, Section 4.1.1 of the ABAQUS Analysis User's Manual). In this case the values returned will be used only for output purposes and are not updated permanently.

ENERGY

For general nonlinear steps array ENERGY contains the values of the energy quantities associated with the element. The values in this array when UEL is called are the element energy quantities at the start of the current increment. They should be updated to the values at the end of the current increment. For linear perturbation steps the array is passed into UEL containing the energy in the base state. They should be returned containing perturbation values if you wish to output such quantities. The entries in the array are as follows:


ENERGY(1)Kinetic energy.
ENERGY(2)Elastic strain energy.
ENERGY(3)Creep dissipation.
ENERGY(4)Plastic dissipation.
ENERGY(5)Viscous dissipation.
ENERGY(6)“Artificial strain energy” associated with such effects as artificial stiffness introduced to control hourglassing or other singular modes in the element.
ENERGY(7)Electrostatic energy.
ENERGY(8)Incremental work done by loads applied within the user element.

When KINC is equal to zero, the call to UEL is made for zero increment output (see Output, Section 4.1.1 of the ABAQUS Analysis User's Manual). In this case the energy values returned will be used only for output purposes and are not updated permanently.

Variables that can be updated

PNEWDT

Ratio of suggested new time increment to the time increment currently being used (DTIME, see below). This variable allows you to provide input to the automatic time incrementation algorithms in ABAQUS/Standard (if automatic time incrementation is chosen). It is useful only during equilibrium iterations with the normal time incrementation, as indicated by LFLAGS(3)=1. During a severe discontinuity iteration (such as contact changes), PNEWDT is ignored unless CONVERT SDI=YES is specified for this step. The usage of PNEWDT is discussed below.

PNEWDT is set to a large value before each call to UEL.

If PNEWDT is redefined to be less than 1.0, ABAQUS/Standard must abandon the time increment and attempt it again with a smaller time increment. The suggested new time increment provided to the automatic time integration algorithms is PNEWDT × DTIME, where the PNEWDT used is the minimum value for all calls to user subroutines that allow redefinition of PNEWDT for this iteration.

If PNEWDT is given a value that is greater than 1.0 for all calls to user subroutines for this iteration and the increment converges in this iteration, ABAQUS/Standard may increase the time increment. The suggested new time increment provided to the automatic time integration algorithms is PNEWDT × DTIME, where the PNEWDT used is the minimum value for all calls to user subroutines for this iteration.

If automatic time incrementation is not selected in the analysis procedure, values of PNEWDT that are greater than 1.0 will be ignored and values of PNEWDT that are less than 1.0 will cause the job to terminate.

Variables passed in for information

Arrays:

PROPS

A floating point array containing the NPROPS real property values defined for use with this element. NPROPS is the user-specified number of real property values. See Defining the element properties” in “User-defined elements, Section 26.15.1 of the ABAQUS Analysis User's Manual.

JPROPS

An integer array containing the NJPROP integer property values defined for use with this element. NJPROP is the user-specified number of integer property values. See Defining the element properties” in “User-defined elements, Section 26.15.1 of the ABAQUS Analysis User's Manual.

COORDS

An array containing the original coordinates of the nodes of the element. COORDS(K1,K2) is the K1th coordinate of the K2th node of the element.

U, DU, V, A

Arrays containing the current estimates of the basic solution variables (displacements, rotations, temperatures, depending on the degree of freedom) at the nodes of the element at the end of the current increment. Values are provided as follows:

U(K1)Total values of the variables. If this is a linear perturbation step, it is the value in the base state.
DU(K1,KRHS)Incremental values of the variables for the current increment for right-hand-side KRHS. If this is an eigenvalue extraction step, this is the eigenvector magnitude for eigenvector KRHS. For steady-state dynamics, KRHS denotes real components of perturbation displacement and KRHS denotes imaginary components of perturbation displacement.
V(K1)Time rate of change of the variables (velocities, rates of rotation). Defined for implicit dynamics only (LFLAGS(1) 11 or 12).
A(K1)Accelerations of the variables. Defined for implicit dynamics only (LFLAGS(1) 11 or 12).

JDLTYP

An array containing the integers used to define distributed load types for the element. Loads of type Un are identified by the integer value n in JDLTYP; loads of type UnNU are identified by the negative integer value in JDLTYP. JDLTYP(K1,K2) is the identifier of the K1th distributed load in the K2th load case. For general nonlinear steps K2 is always 1.

ADLMAG

For general nonlinear steps ADLMAG(K1,1) is the total load magnitude of the K1th distributed load at the end of the current increment for distributed loads of type Un. For distributed loads of type UnNU, the load magnitude is defined in UEL; therefore, the corresponding entries in ADLMAG are zero. For linear perturbation steps ADLMAG(K1,1) contains the total load magnitude of the K1th distributed load of type Un applied in the base state. Base state loading of type UnNU must be dealt with inside UEL. ADLMAG(K1,2), ADLMAG(K1,3), etc. are currently not used.

DDLMAG

For general nonlinear steps DDLMAG contains the increments in the magnitudes of the distributed loads that are currently active on this element for distributed loads of type Un. DDLMAG(K1,1) is the increment of magnitude of the load for the current time increment. The increment of load magnitude is needed to compute the external work contribution. For distributed loads of type UnNU, the load magnitude is defined in UEL; therefore, the corresponding entries in DDLMAG are zero. For linear perturbation steps DDLMAG(K1,K2) contains the perturbation in the magnitudes of the distributed loads that are currently active on this element for distributed loads of type Un. K1 denotes the K1th perturbation load active on the element. K2 is always 1, except for steady-state dynamics, where K2=1 for real loads and K2=2 for imaginary loads. Perturbation loads of type UnNU must be dealt with inside UEL.

PREDEF

An array containing the values of predefined field variables, such as temperature in an uncoupled stress/displacement analysis, at the nodes of the element (Predefined fields, Section 27.6.1 of the ABAQUS Analysis User's Manual).

The first index of the array, K1, is either 1 or 2, with 1 indicating the value of the field variable at the end of the increment and 2 indicating the increment in the field variable. The second index, K2, indicates the variable: the temperature is stored if the index is 1, and the predefined field variables are stored if the indices are greater than or equal to 2. The third index, K3, indicates the local node number on the element.


PREDEF(K1,1,K3)Temperature.
PREDEF(K1,2,K3)First predefined field variable.
PREDEF(K1,3,K3)Second predefined field variable.
Etc.Any other predefined field variable.
PREDEF(K1,K2,K3)Total or incremental value of the K2th predefined field variable at the K3th node of the element.
PREDEF(1,K2,K3)Values of the variables at the end of the current increment.
PREDEF(2,K2,K3)Incremental values corresponding to the current time increment.

PARAMS

An array containing the parameters associated with the solution procedure. The entries in this array depend on the solution procedure currently being used when UEL is called, as indicated by the entries in the LFLAGS array (see below).

For implicit dynamics (LFLAGS(1) = 11 or 12) PARAMS contains the integration operator values, as:


PARAMS(1)
PARAMS(2)
PARAMS(3)

LFLAGS

An array containing the flags that define the current solution procedure and requirements for element calculations. Detailed requirements for the various ABAQUS/Standard procedures are defined earlier in this section.


LFLAGS(1)Defines the procedure type. See Results file output format, Section 5.1.2 of the ABAQUS Analysis User's Manual, for the key used for each procedure.
LFLAGS(2)=0Small-displacement analysis.
LFLAGS(2)=1Large-displacement analysis (nonlinear geometric effects included in the step; see General and linear perturbation procedures, Section 6.1.2 of the ABAQUS Analysis User's Manual).
LFLAGS(3)=1Normal implicit time incrementation procedure. User subroutine UEL must define the residual vector in RHS and the Jacobian matrix in AMATRX.
LFLAGS(3)=2Define the current stiffness matrix (AMATRX ) only.
LFLAGS(3)=3Define the current damping matrix (AMATRX ) only.
LFLAGS(3)=4Define the current mass matrix (AMATRX ) only. ABAQUS/Standard always requests an initial mass matrix at the start of the analysis.
LFLAGS(3)=5Define the current residual or load vector (RHS ) only.
LFLAGS(3)=6Define the current mass matrix and the residual vector for the initial acceleration calculation (or the calculation of accelerations after impact).
LFLAGS(3)=100Define perturbation quantities for output.
LFLAGS(4)=0The step is a general step.
LFLAGS(4)=1The step is a linear perturbation step.
LFLAGS(5)=0The current approximations to , etc. were based on Newton corrections.
LFLAGS(5)=1The current approximations were found by extrapolation from the previous increment.

TIME(1)

Current value of step time.

TIME(2)

Current value of total time.

Scalar parameters:

DTIME

Time increment.

PERIOD

Time period of the current step.

NDOFEL

Number of degrees of freedom in the element.

MLVARX

Dimensioning parameter used when several displacement or right-hand-side vectors are used.

NRHS

Number of load vectors. NRHS is 1 in most nonlinear problems: it is 2 for the modified Riks static procedure (Static stress analysis, Section 6.2.2 of the ABAQUS Analysis User's Manual), and it is greater than 1 in some linear analysis procedures and during substructure generation.

NJPROP

MCRD

MCRD is defined as the maximum of the user-defined maximum number of coordinates needed at any node point (Defining the maximum number of coordinates needed at any nodal point” in “User-defined elements, Section 26.15.1 of the ABAQUS Analysis User's Manual) and the value of the largest active degree of freedom of the user element that is less than or equal to 3. For example, if you specify that the maximum number of coordinates is 1 and the active degrees of freedom of the user element are 2, 3, and 6, MCRD will be 3. If you specify that the maximum number of coordinates is 2 and the active degrees of freedom of the user element are 11 and 12, MCRD will be 2.

JTYPE

Integer defining the element type. This is the user-defined integer value n in element type Un (Assigning an element type key to a user-defined element” in “User-defined elements, Section 26.15.1 of the ABAQUS Analysis User's Manual).

KSTEP

Current step number.

KINC

Current increment number.

JELEM

User-assigned element number.

NDLOAD

Identification number of the distributed load or flux currently active on this element.

MDLOAD

Total number of distributed loads and/or fluxes defined on this element.

NPREDF

Number of predefined field variables, including temperature. For user elements ABAQUS/Standard uses one value for each field variable per node.

UEL conventions

The solution variables (displacement, velocity, etc.) are arranged on a node/degree of freedom basis. The degrees of freedom of the first node are first, followed by the degrees of freedom of the second node, etc.

Usage with general nonlinear procedures

The values of (and, in direct-integration dynamic steps, and ) enter user subroutine UEL as their latest approximations at the end of the time increment; that is, at time .

The values of enter the subroutine as their values at the beginning of the time increment; that is, at time t. It is your responsibility to define suitable time integration schemes to update . To ensure accurate, stable integration of internal state variables, you can control the time incrementation via PNEWDT.

The values of enter the subroutine as the values of the total load magnitude for the th distributed load at the end of the increment. Increments in the load magnitudes are also available.

In the following descriptions of the user element's requirements, it will be assumed that LFLAGS(3)=1, unless otherwise stated.

Static analysis (LFLAGS(1)=1,2)

  • .

  • Automatic convergence checks are applied to the force residuals corresponding to degrees of freedom 1–7.

  • You must define AMATRX and RHS and update the state variables, .

Modified Riks static analysis (LFLAGS(1)=1) and (NRHS=2)

  • , where , and are fixed load parameters, and is the Riks (scalar) load parameter.

  • Automatic convergence checks are applied to the force residuals corresponding to degrees of freedom 1–7.

  • You must define AMATRX , RHS(1) , and RHS(2) and update the state variables, . RHS(2) is the incremental load vector.

Direct-integration dynamic analysis (LFLAGS(1)=11, 12)

  • Automatic convergence checks are applied to the force residuals corresponding to degrees of freedom 1–7.

  • LFLAGS(3)=1: Normal time increment. The Hilber-Hughes-Taylor time integration scheme is always used. This implies that

    where and ; that is, the highest time derivative of in and is , so that

    Therefore, you must store as an internal state vector. If half-step residual calculations are required, you must also store as an internal state vector, where indicates the time at the beginning of the previous increment. For , and is not needed. You must define AMATRX where and . RHS must also be defined and the state variables, , updated. Although the value of given in the dynamic step definition is passed into UEL, the value of can vary from element to element. For example, can be set to zero for some elements in the model where numerical dissipation is not desired.

  • LFLAGS(3)=5: Half-step residual () calculation. ABAQUS/Standard will adjust the time increment so that (where is specified in the dynamic step definition). For the Hilber-Hughes-Taylor algorithm the half-step residual is defined as

    where indicates the time at the beginning of the previous increment. You must define RHS . To evaluate and , you must calculate . These half-step values will not be saved. DTIME will still contain (not ). The values contained in U, V, A, and DU are half-step values.

  • LFLAGS(3)=4: Velocity jump calculation. ABAQUS/Standard solves for , so you must define AMATRX.

  • LFLAGS(3)=6: Initial acceleration calculation. ABAQUS/Standard solves for , so you must define AMATRX and RHS.

Subspace-based dynamic analysis (LFLAGS(1)=13)

  • The requirements are identical to those of static analysis, except that the Jacobian (stiffness), AMATRX, is not needed. No convergence checks are performed in this case.

Quasi-static analysis (LFLAGS(1)=21)

  • The requirements are identical to those of static analysis.

Steady-state heat transfer analysis (LFLAGS(1)=31)

  • The requirements are identical to those of static analysis, except that the automatic convergence checks are applied to the heat flux residuals corresponding to degrees of freedom 11, 12, …

Transient heat transfer analysis (Δθmax) (LFLAGS(1)=32, 33)

  • Automatic convergence checks are applied to the heat flux residuals corresponding to degrees of freedom 11, 12, …

  • The backward difference scheme is always used for time integration; that is, ABAQUS/Standard assumes that , where and so always. For degrees of freedom 11, 12, …, will be compared against the user-prescribed maximum allowable nodal temperature change in an increment, , for controlling the time integration accuracy.

  • You need to define AMATRX , where is the heat capacity matrix and RHS , and must update the state variables, .

Geostatic analysis (LFLAGS(1)=61)

  • Identical to static analysis, except that the automatic convergence checks are applied to the residuals corresponding to degrees of freedom 1–8.

Steady-state coupled pore fluid diffusion/stress analysis (LFLAGS(1)=62, 63)

  • Identical to static analysis, except that the automatic convergence checks are applied to the residuals corresponding to degrees of freedom 1–8.

Transient coupled pore fluid diffusion/stress (consolidation) analysis (Δuwmax) (LFLAGS(1)=64, 65)

  • Automatic convergence checks are applied to the residuals corresponding to degrees of freedom 1–8.

  • The backward difference scheme is used for time integration; that is, , where .

  • For degree of freedom 8, will be compared against the user-prescribed maximum wetting liquid pore pressure change, , for automatic control of the time integration accuracy.

  • You must define AMATRX , where is the pore fluid capacity matrix and RHS , and must update the state variables, .

Steady-state fully coupled thermal-stress analysis (LFLAGS(1)=71)

  • Identical to static analysis, except that the automatic convergence checks are applied to the residuals corresponding to degrees of freedom 1–7 and 11, 12, …

Transient fully coupled thermal-stress analysis (Δθmax) (LFLAGS(1)=72,73)

  • Automatic convergence checks are applied to the residuals corresponding to degrees of freedom 1–7 and 11, 12, …

  • The backward difference scheme is used for time integration; that is, , where .

  • For degrees of freedom 11, 12, …, will be compared against the user-prescribed maximum allowable nodal temperature change in an increment, , for automatic control of the time integration accuracy.

  • You must define AMATRX , where is the heat capacity matrix and RHS , and must update the state variables, .

Steady-state coupled thermal-electrical analysis (LFLAGS(1)=75)

  • The requirements are identical to those of static analysis, except that the automatic convergence checks are applied to the current density residuals corresponding to degree of freedom 9, in addition to the heat flux residuals.

Transient coupled thermal-electrical analysis (Δθmax) (LFLAGS(1)=76, 77)

  • Automatic convergence checks are applied to the current density residuals corresponding to degree of freedom 9 and to the heat flux residuals corresponding to degree of freedom 11.

  • The backward difference scheme is always used for time integration; that is, ABAQUS/Standard assumes that , where . Therefore, always. For degree of freedom 11 will be compared against the user-prescribed maximum allowable nodal temperature change in an increment, , for controlling the time integration accuracy.

  • You must define AMATRX , where is the heat capacity matrix and RHS , and must update the state variables, .

Usage with linear perturbation procedures

General and linear perturbation procedures, Section 6.1.2 of the ABAQUS Analysis User's Manual, describes the linear perturbation capabilities in ABAQUS/Standard. Here, base state values of variables will be denoted by , , etc. Perturbation values will be denoted by , , etc.

ABAQUS/Standard will not call user subroutine UEL for the following procedures: eigenvalue buckling prediction, response spectrum, transient modal dynamic, steady-state dynamic (modal and direct), and random response.

Static analysis (LFLAGS(1)=1, 2)

  • ABAQUS/Standard will solve for , where is the base state stiffness matrix and the perturbation load vector, , is a linear function of the perturbation loads, ; that is, .

  • LFLAGS(3)=1: You must define AMATRX and RHS .

  • LFLAGS(3)=100: You must compute perturbations of the internal variables, , and define RHS for output purposes.

Eigenfrequency extraction analysis (LFLAGS(1)=41)

  • .

  • ABAQUS/Standard will solve for and , where is the base state stiffness matrix and is the base state mass matrix.

  • LFLAGS(3)=2: Define AMATRX .

  • LFLAGS(3)=4: Define AMATRX .

Example: Structural and heat transfer user element

Both a structural and a heat transfer user element have been created to demonstrate the usage of subroutine UEL. These user-defined elements are applied in a number of analyses. The following excerpt is from the verification problem that invokes the structural user element in an implicit dynamics procedure:

*USER ELEMENT, NODES=2, TYPE=U1, PROPERTIES=4, COORDINATES=3, 
VARIABLES=12
1, 2, 3
*ELEMENT, TYPE=U1
101, 101, 102
*ELGEN, ELSET=UTRUSS
101, 5
*UEL PROPERTY, ELSET=UTRUSS
0.002, 2.1E11, 0.3, 7200.
The user element consists of two nodes that are assumed to lie parallel to the x-axis. The element behaves like a linear truss element. The supplied element properties are the cross-sectional area, Young's modulus, Poisson's ratio, and density, respectively.

The next excerpt shows the listing of the subroutine. The user subroutine has been coded for use in a perturbation static analysis; general static analysis, including Riks analysis with load incrementation defined by the subroutine; eigenfrequency extraction analysis; and direct-integration dynamic analysis. The names of the verification input files associated with the subroutine and these procedures can be found in UEL, Section 4.1.11 of the ABAQUS Verification Manual. The subroutine performs all calculations required for the relevant procedures as described earlier in this section. The flags passed in through the LFLAGS array are used to associate particular calculations with solution procedures.

During a modified Riks analysis all force loads must be passed into UEL by means of distributed load definitions such that they are available for the definition of incremental load vectors; the load keys Un and UnNU must be used properly, as discussed in User-defined elements, Section 26.15.1 of the ABAQUS Analysis User's Manual. The coding in subroutine UEL must distribute the loads into consistent equivalent nodal forces and account for them in the calculation of the RHS and ENERGY arrays.

      SUBROUTINE UEL(RHS,AMATRX,SVARS,ENERGY,NDOFEL,NRHS,NSVARS,
     1     PROPS,NPROPS,COORDS,MCRD,NNODE,U,DU,V,A,JTYPE,TIME,
     2     DTIME,KSTEP,KINC,JELEM,PARAMS,NDLOAD,JDLTYP,ADLMAG,
     3     PREDEF,NPREDF,LFLAGS,MLVARX,DDLMAG,MDLOAD,PNEWDT,
     4     JPROPS,NJPROP,PERIOD)
C     
      INCLUDE 'ABA_PARAM.INC'
      PARAMETER ( ZERO = 0.D0, HALF = 0.5D0, ONE = 1.D0 )
C
      DIMENSION RHS(MLVARX,*),AMATRX(NDOFEL,NDOFEL),
     1     SVARS(NSVARS),ENERGY(8),PROPS(*),COORDS(MCRD,NNODE),
     2     U(NDOFEL),DU(MLVARX,*),V(NDOFEL),A(NDOFEL),TIME(2),
     3     PARAMS(3),JDLTYP(MDLOAD,*),ADLMAG(MDLOAD,*),
     4     DDLMAG(MDLOAD,*),PREDEF(2,NPREDF,NNODE),LFLAGS(*),
     5     JPROPS(*)
      DIMENSION SRESID(6)
C
C UEL SUBROUTINE FOR A HORIZONTAL TRUSS ELEMENT
C
C     SRESID - stores the static residual at time t+dt
C     SVARS  - In 1-6, contains the static residual at time t 
C              upon entering the routine. SRESID is copied to 
C              SVARS(1-6) after the dynamic residual has been 
C              calculated.
C            - For half-step residual calculations: In 7-12, 
C              contains the static residual at the beginning 
C              of the previous increment. SVARS(1-6) are copied 
C              into SVARS(7-12) after the dynamic residual has 
C              been calculated.
C
      AREA = PROPS(1)
      E    = PROPS(2)
      ANU  = PROPS(3)
      RHO  = PROPS(4)
C     
      ALEN = ABS(COORDS(1,2)-COORDS(1,1))
      AK   = AREA*E/ALEN
      AM   = HALF*AREA*RHO*ALEN
C
      DO K1 = 1, NDOFEL                      
        SRESID(K1) = ZERO
        DO KRHS = 1, NRHS
          RHS(K1,KRHS) = ZERO
        END DO
        DO K2 = 1, NDOFEL
          AMATRX(K2,K1) = ZERO
        END DO
      END DO
C
      IF (LFLAGS(3).EQ.1) THEN
C       Normal incrementation
        IF (LFLAGS(1).EQ.1 .OR. LFLAGS(1).EQ.2) THEN
C         *STATIC
          AMATRX(1,1) =  AK  
          AMATRX(4,4) =  AK  
          AMATRX(1,4) = -AK  
          AMATRX(4,1) = -AK
          IF (LFLAGS(4).NE.0) THEN
            FORCE  = AK*(U(4)-U(1))
            DFORCE = AK*(DU(4,1)-DU(1,1))
            SRESID(1) = -DFORCE
            SRESID(4) =  DFORCE
            RHS(1,1) = RHS(1,1)-SRESID(1)
            RHS(4,1) = RHS(4,1)-SRESID(4)
            ENERGY(2) = HALF*FORCE*(DU(4,1)-DU(1,1))
     *           + HALF*DFORCE*(U(4)-U(1))
     *           + HALF*DFORCE*(DU(4,1)-DU(1,1))
          ELSE
            FORCE = AK*(U(4)-U(1))
            SRESID(1) = -FORCE
            SRESID(4) =  FORCE
            RHS(1,1) = RHS(1,1)-SRESID(1)
            RHS(4,1) = RHS(4,1)-SRESID(4)
            DO KDLOAD = 1, NDLOAD
              IF (JDLTYP(KDLOAD,1).EQ.1001) THEN
                RHS(4,1)  = RHS(4,1)+ADLMAG(KDLOAD,1)
                ENERGY(8) = ENERGY(8)+(ADLMAG(KDLOAD,1)
     *               - HALF*DDLMAG(KDLOAD,1))*DU(4,1)
                IF (NRHS.EQ.2) THEN
C                 Riks
                  RHS(4,2) = RHS(4,2)+DDLMAG(KDLOAD,1)
                END IF
              END IF
            END DO
            ENERGY(2) = HALF*FORCE*(U(4)-U(1))
          END IF
        ELSE IF (LFLAGS(1).EQ.11 .OR. LFLAGS(1).EQ.12) THEN
C         *DYNAMIC
          ALPHA = PARAMS(1)
          BETA  = PARAMS(2)
          GAMMA = PARAMS(3)
C                  
          DADU = ONE/(BETA*DTIME**2)
          DVDU = GAMMA/(BETA*DTIME)
C                  
          DO K1 = 1, NDOFEL
            AMATRX(K1,K1) = AM*DADU
            RHS(K1,1) = RHS(K1,1)-AM*A(K1)
          END DO
          AMATRX(1,1) = AMATRX(1,1)+(ONE+ALPHA)*AK  
          AMATRX(4,4) = AMATRX(4,4)+(ONE+ALPHA)*AK  
          AMATRX(1,4) = AMATRX(1,4)-(ONE+ALPHA)*AK  
          AMATRX(4,1) = AMATRX(4,1)-(ONE+ALPHA)*AK
          FORCE = AK*(U(4)-U(1))
          SRESID(1) = -FORCE
          SRESID(4) =  FORCE
          RHS(1,1) = RHS(1,1) -
     *         ((ONE+ALPHA)*SRESID(1)-ALPHA*SVARS(1))
          RHS(4,1) = RHS(4,1) -
     *         ((ONE+ALPHA)*SRESID(4)-ALPHA*SVARS(4))
          ENERGY(1) = ZERO
          DO K1 = 1, NDOFEL
            SVARS(K1+6) = SVARS(k1)
            SVARS(K1)   = SRESID(K1)
            ENERGY(1)   = ENERGY(1)+HALF*V(K1)*AM*V(K1)
          END DO
          ENERGY(2) = HALF*FORCE*(U(4)-U(1))
        END IF
      ELSE IF (LFLAGS(3).EQ.2) THEN
C       Stiffness matrix
        AMATRX(1,1) =  AK  
        AMATRX(4,4) =  AK  
        AMATRX(1,4) = -AK  
        AMATRX(4,1) = -AK
      ELSE IF (LFLAGS(3).EQ.4) THEN
C       Mass matrix
        DO K1 = 1, NDOFEL
          AMATRX(K1,K1) = AM
        END DO
      ELSE IF (LFLAGS(3).EQ.5) THEN
C       Half-step residual calculation
        ALPHA = PARAMS(1)
        FORCE = AK*(U(4)-U(1))
        SRESID(1) = -FORCE
        SRESID(4) =  FORCE
        RHS(1,1) = RHS(1,1)-AM*A(1)-(ONE+ALPHA)*SRESID(1)
     *       + HALF*ALPHA*( SVARS(1)+SVARS(7) )
        RHS(4,1) = RHS(4,1)-AM*A(4)-(ONE+ALPHA)*SRESID(4)
     *       + HALF*ALPHA*( SVARS(4)+SVARS(10) )
      ELSE IF (LFLAGS(3).EQ.6) THEN
C       Initial acceleration calculation
        DO K1 = 1, NDOFEL
          AMATRX(K1,K1) = AM
        END DO
        FORCE = AK*(U(4)-U(1))
        SRESID(1) = -FORCE
        SRESID(4) =  FORCE
        RHS(1,1) = RHS(1,1)-SRESID(1)
        RHS(4,1) = RHS(4,1)-SRESID(4)
        ENERGY(1) = ZERO
        DO K1 = 1, NDOFEL
          SVARS(K1) = SRESID(K1)
          ENERGY(1) = ENERGY(1)+HALF*V(K1)*AM*V(K1)
        END DO
        ENERGY(2) = HALF*FORCE*(U(4)-U(1))
      ELSE IF (LFLAGS(3).EQ.100) THEN
C       Output for perturbations
        IF (LFLAGS(1).EQ.1 .OR. LFLAGS(1).EQ.2) THEN
C         *STATIC
          FORCE  = AK*(U(4)-U(1))
          DFORCE = AK*(DU(4,1)-DU(1,1))
          SRESID(1) = -DFORCE
          SRESID(4) =  DFORCE
          RHS(1,1) = RHS(1,1)-SRESID(1)
          RHS(4,1) = RHS(4,1)-SRESID(4)
          ENERGY(2) = HALF*FORCE*(DU(4,1)-DU(1,1))
     *         + HALF*DFORCE*(U(4)-U(1))
     *         + HALF*DFORCE*(DU(4,1)-DU(1,1))
          DO KVAR = 1, NSVARS
            SVARS(KVAR) = ZERO
          END DO
          SVARS(1) = RHS(1,1)
          SVARS(4) = RHS(4,1)
        ELSE IF (LFLAGS(1).EQ.41) THEN
C         *FREQUENCY
          DO KRHS = 1, NRHS
            DFORCE = AK*(DU(4,KRHS)-DU(1,KRHS))
            SRESID(1) = -DFORCE
            SRESID(4) =  DFORCE
            RHS(1,KRHS) = RHS(1,KRHS)-SRESID(1)
            RHS(4,KRHS) = RHS(4,KRHS)-SRESID(4)
          END DO
          DO KVAR = 1, NSVARS
            SVARS(KVAR) = ZERO
          END DO
          SVARS(1) = RHS(1,1)
          SVARS(4) = RHS(4,1)
        END IF
      END IF
C
      RETURN
      END