datv.f

Go to the documentation of this file.
00001 C Work performed under the auspices of the U.S. Department of Energy
00002 C by Lawrence Livermore National Laboratory under contract number 
00003 C W-7405-Eng-48.
00004 C
00005       SUBROUTINE DATV (NEQ, Y, TN, YPRIME, SAVR, V, WGHT, YPTEM, RES,
00006      *   IRES, PSOL, Z, VTEM, WP, IWP, CJ, EPLIN, IER, NRE, NPSL,
00007      *   RPAR,IPAR)
00008 C
00009 C***BEGIN PROLOGUE  DATV
00010 C***DATE WRITTEN   890101   (YYMMDD)
00011 C***REVISION DATE  900926   (YYMMDD)
00012 C
00013 C
00014 C-----------------------------------------------------------------------
00015 C***DESCRIPTION
00016 C
00017 C This routine computes the product
00018 C
00019 C   Z = (D-inverse)*(P-inverse)*(dF/dY)*(D*V),
00020 C
00021 C where F(Y) = G(T, Y, CJ*(Y-A)), CJ is a scalar proportional to 1/H,
00022 C and A involves the past history of Y.  The quantity CJ*(Y-A) is
00023 C an approximation to the first derivative of Y and is stored
00024 C in the array YPRIME.  Note that dF/dY = dG/dY + CJ*dG/dYPRIME.
00025 C
00026 C D is a diagonal scaling matrix, and P is the left preconditioning
00027 C matrix.  V is assumed to have L2 norm equal to 1.
00028 C The product is stored in Z and is computed by means of a
00029 C difference quotient, a call to RES, and one call to PSOL.
00030 C
00031 C      On entry
00032 C
00033 C          NEQ = Problem size, passed to RES and PSOL.
00034 C
00035 C            Y = Array containing current dependent variable vector.
00036 C
00037 C       YPRIME = Array containing current first derivative of y.
00038 C
00039 C         SAVR = Array containing current value of G(T,Y,YPRIME).
00040 C
00041 C            V = Real array of length NEQ (can be the same array as Z).
00042 C
00043 C         WGHT = Array of length NEQ containing scale factors.
00044 C                1/WGHT(I) are the diagonal elements of the matrix D.
00045 C
00046 C        YPTEM = Work array of length NEQ.
00047 C
00048 C         VTEM = Work array of length NEQ used to store the
00049 C                unscaled version of V.
00050 C
00051 C         WP = Real work array used by preconditioner PSOL.
00052 C
00053 C         IWP = Integer work array used by preconditioner PSOL.
00054 C
00055 C           CJ = Scalar proportional to current value of 
00056 C                1/(step size H).
00057 C
00058 C
00059 C      On return
00060 C
00061 C            Z = Array of length NEQ containing desired scaled
00062 C                matrix-vector product.
00063 C
00064 C         IRES = Error flag from RES.
00065 C
00066 C          IER = Error flag from PSOL.
00067 C
00068 C         NRE  = The number of calls to RES.
00069 C
00070 C         NPSL = The number of calls to PSOL.
00071 C
00072 C-----------------------------------------------------------------------
00073 C***ROUTINES CALLED
00074 C   RES, PSOL
00075 C
00076 C***END PROLOGUE  DATV
00077 C
00078       INTEGER NEQ, IRES, IWP, IER, NRE, NPSL, IPAR
00079       DOUBLE PRECISION Y, TN, YPRIME, SAVR, V, WGHT, YPTEM, Z, VTEM,
00080      1   WP, CJ, RPAR
00081       DIMENSION Y(*), YPRIME(*), SAVR(*), V(*), WGHT(*), YPTEM(*),
00082      1   Z(*), VTEM(*), WP(*), IWP(*), RPAR(*), IPAR(*)
00083       INTEGER I
00084       DOUBLE PRECISION EPLIN
00085       EXTERNAL  RES, PSOL
00086 C
00087       IRES = 0
00088 C-----------------------------------------------------------------------
00089 C Set VTEM = D * V.
00090 C-----------------------------------------------------------------------
00091       DO 10 I = 1,NEQ
00092  10     VTEM(I) = V(I)/WGHT(I)
00093       IER = 0
00094 C-----------------------------------------------------------------------
00095 C Store Y in Z and increment Z by VTEM.
00096 C Store YPRIME in YPTEM and increment YPTEM by VTEM*CJ.
00097 C-----------------------------------------------------------------------
00098       DO 20 I = 1,NEQ
00099         YPTEM(I) = YPRIME(I) + VTEM(I)*CJ
00100  20     Z(I) = Y(I) + VTEM(I)
00101 C-----------------------------------------------------------------------
00102 C Call RES with incremented Y, YPRIME arguments
00103 C stored in Z, YPTEM.  VTEM is overwritten with new residual.
00104 C-----------------------------------------------------------------------
00105       CONTINUE
00106       CALL RES(TN,Z,YPTEM,CJ,VTEM,IRES,RPAR,IPAR)
00107       NRE = NRE + 1
00108       IF (IRES .LT. 0) RETURN
00109 C-----------------------------------------------------------------------
00110 C Set Z = (dF/dY) * VBAR using difference quotient.
00111 C (VBAR is old value of VTEM before calling RES)
00112 C-----------------------------------------------------------------------
00113       DO 70 I = 1,NEQ
00114  70     Z(I) = VTEM(I) - SAVR(I)
00115 C-----------------------------------------------------------------------
00116 C Apply inverse of left preconditioner to Z.
00117 C-----------------------------------------------------------------------
00118       CALL PSOL (NEQ, TN, Y, YPRIME, SAVR, YPTEM, CJ, WGHT, WP, IWP,
00119      1   Z, EPLIN, IER, RPAR, IPAR)
00120       NPSL = NPSL + 1
00121       IF (IER .NE. 0) RETURN
00122 C-----------------------------------------------------------------------
00123 C Apply D-inverse to Z and return.
00124 C-----------------------------------------------------------------------
00125       DO 90 I = 1,NEQ
00126  90     Z(I) = Z(I)*WGHT(I)
00127       RETURN
00128 C
00129 C------END OF SUBROUTINE DATV-------------------------------------------
00130       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines