scfode.f

Go to the documentation of this file.
00001       SUBROUTINE SCFODE (METH, ELCO, TESCO)
00002 C***BEGIN PROLOGUE  SCFODE
00003 C***SUBSIDIARY
00004 C***PURPOSE  Set ODE integrator coefficients.
00005 C***TYPE      SINGLE PRECISION (SCFODE-S, DCFODE-D)
00006 C***AUTHOR  Hindmarsh, Alan C., (LLNL)
00007 C***DESCRIPTION
00008 C
00009 C  SCFODE is called by the integrator routine to set coefficients
00010 C  needed there.  The coefficients for the current method, as
00011 C  given by the value of METH, are set for all orders and saved.
00012 C  The maximum order assumed here is 12 if METH = 1 and 5 if METH = 2.
00013 C  (A smaller value of the maximum order is also allowed.)
00014 C  SCFODE is called once at the beginning of the problem,
00015 C  and is not called again unless and until METH is changed.
00016 C
00017 C  The ELCO array contains the basic method coefficients.
00018 C  The coefficients el(i), 1 .le. i .le. nq+1, for the method of
00019 C  order nq are stored in ELCO(i,nq).  They are given by a genetrating
00020 C  polynomial, i.e.,
00021 C      l(x) = el(1) + el(2)*x + ... + el(nq+1)*x**nq.
00022 C  For the implicit Adams methods, l(x) is given by
00023 C      dl/dx = (x+1)*(x+2)*...*(x+nq-1)/factorial(nq-1),    l(-1) = 0.
00024 C  For the BDF methods, l(x) is given by
00025 C      l(x) = (x+1)*(x+2)* ... *(x+nq)/K,
00026 C  where         K = factorial(nq)*(1 + 1/2 + ... + 1/nq).
00027 C
00028 C  The TESCO array contains test constants used for the
00029 C  local error test and the selection of step size and/or order.
00030 C  At order nq, TESCO(k,nq) is used for the selection of step
00031 C  size at order nq - 1 if k = 1, at order nq if k = 2, and at order
00032 C  nq + 1 if k = 3.
00033 C
00034 C***SEE ALSO  SLSODE
00035 C***ROUTINES CALLED  (NONE)
00036 C***REVISION HISTORY  (YYMMDD)
00037 C   791129  DATE WRITTEN
00038 C   890501  Modified prologue to SLATEC/LDOC format.  (FNF)
00039 C   890503  Minor cosmetic changes.  (FNF)
00040 C   930809  Renamed to allow single/double precision versions. (ACH)
00041 C***END PROLOGUE  SCFODE
00042 C**End
00043       INTEGER METH
00044       INTEGER I, IB, NQ, NQM1, NQP1
00045       REAL ELCO, TESCO
00046       REAL AGAMQ, FNQ, FNQM1, PC, PINT, RAGQ,
00047      1   RQFAC, RQ1FAC, TSIGN, XPIN
00048       DIMENSION ELCO(13,12), TESCO(3,12)
00049       DIMENSION PC(12)
00050 C
00051 C***FIRST EXECUTABLE STATEMENT  SCFODE
00052       GO TO (100, 200), METH
00053 C
00054  100  ELCO(1,1) = 1.0E0
00055       ELCO(2,1) = 1.0E0
00056       TESCO(1,1) = 0.0E0
00057       TESCO(2,1) = 2.0E0
00058       TESCO(1,2) = 1.0E0
00059       TESCO(3,12) = 0.0E0
00060       PC(1) = 1.0E0
00061       RQFAC = 1.0E0
00062       DO 140 NQ = 2,12
00063 C-----------------------------------------------------------------------
00064 C The PC array will contain the coefficients of the polynomial
00065 C     p(x) = (x+1)*(x+2)*...*(x+nq-1).
00066 C Initially, p(x) = 1.
00067 C-----------------------------------------------------------------------
00068         RQ1FAC = RQFAC
00069         RQFAC = RQFAC/NQ
00070         NQM1 = NQ - 1
00071         FNQM1 = NQM1
00072         NQP1 = NQ + 1
00073 C Form coefficients of p(x)*(x+nq-1). ----------------------------------
00074         PC(NQ) = 0.0E0
00075         DO 110 IB = 1,NQM1
00076           I = NQP1 - IB
00077  110      PC(I) = PC(I-1) + FNQM1*PC(I)
00078         PC(1) = FNQM1*PC(1)
00079 C Compute integral, -1 to 0, of p(x) and x*p(x). -----------------------
00080         PINT = PC(1)
00081         XPIN = PC(1)/2.0E0
00082         TSIGN = 1.0E0
00083         DO 120 I = 2,NQ
00084           TSIGN = -TSIGN
00085           PINT = PINT + TSIGN*PC(I)/I
00086  120      XPIN = XPIN + TSIGN*PC(I)/(I+1)
00087 C Store coefficients in ELCO and TESCO. --------------------------------
00088         ELCO(1,NQ) = PINT*RQ1FAC
00089         ELCO(2,NQ) = 1.0E0
00090         DO 130 I = 2,NQ
00091  130      ELCO(I+1,NQ) = RQ1FAC*PC(I)/I
00092         AGAMQ = RQFAC*XPIN
00093         RAGQ = 1.0E0/AGAMQ
00094         TESCO(2,NQ) = RAGQ
00095         IF (NQ .LT. 12) TESCO(1,NQP1) = RAGQ*RQFAC/NQP1
00096         TESCO(3,NQM1) = RAGQ
00097  140    CONTINUE
00098       RETURN
00099 C
00100  200  PC(1) = 1.0E0
00101       RQ1FAC = 1.0E0
00102       DO 230 NQ = 1,5
00103 C-----------------------------------------------------------------------
00104 C The PC array will contain the coefficients of the polynomial
00105 C     p(x) = (x+1)*(x+2)*...*(x+nq).
00106 C Initially, p(x) = 1.
00107 C-----------------------------------------------------------------------
00108         FNQ = NQ
00109         NQP1 = NQ + 1
00110 C Form coefficients of p(x)*(x+nq). ------------------------------------
00111         PC(NQP1) = 0.0E0
00112         DO 210 IB = 1,NQ
00113           I = NQ + 2 - IB
00114  210      PC(I) = PC(I-1) + FNQ*PC(I)
00115         PC(1) = FNQ*PC(1)
00116 C Store coefficients in ELCO and TESCO. --------------------------------
00117         DO 220 I = 1,NQP1
00118  220      ELCO(I,NQ) = PC(I)/PC(2)
00119         ELCO(2,NQ) = 1.0E0
00120         TESCO(1,NQ) = RQ1FAC
00121         TESCO(2,NQ) = NQP1/ELCO(1,NQ)
00122         TESCO(3,NQ) = (NQ+2)/ELCO(1,NQ)
00123         RQ1FAC = RQ1FAC/FNQ
00124  230    CONTINUE
00125       RETURN
00126 C----------------------- END OF SUBROUTINE SCFODE ----------------------
00127       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines