dstode Subroutine

subroutine dstode(Neq, Y, Yh, Nyh, Yh1, Ewt, Savf, Acor, Wm, Iwm, f, jac, pjac, slvs)

Uses

  • proc~~dstode~2~~UsesGraph proc~dstode~2 M_odepack.f90::dstode module~m_odepack M_odepack proc~dstode~2->module~m_odepack

NAME

dstode(3f) - [M_odepack] Performs one step of an ODEPACK integration.

SYNOPSIS

subroutine dstode(Neq,Y,Yh,Nyh,Yh1,Ewt,Savf,Acor,Wm,Iwm,f,jac,pjac,slvs)

 integer,parameter :: dp=kind(0.0d0)
 integer                     :: Neq(*)
 real(kind=dp),intent(inout) :: Y(*)
 integer                     :: Nyh
 real(kind=dp),intent(inout) :: Yh(Nyh,*)
 real(kind=dp),intent(inout) :: Yh1(*)
 real(kind=dp)               :: Ewt(*)
 real(kind=dp),intent(inout) :: Savf(*)
 real(kind=dp),intent(inout) :: Acor(*)
 real(kind=dp)               :: Wm(*)
 integer                     :: Iwm(*)
 external f
 external jac
 external pjac
 external slvs

DESCRIPTION

DSTODE performs one step of the integration of an initial value problem for a system of ordinary differential equations.

Note: DSTODE is independent of the value of the iteration method indicator dls1%MITER, when this is .ne. 0, and hence is independent of the type of chord method used, or the Jacobian structure.

Communication with DSTODE is done with the following variables:

NEQ

integer array containing problem size in NEQ(1), and passed as the NEQ argument in all calls to F and JAC.

Y

an array of length .ge. dls1%N used as the Y argument in all calls to F and JAC.

YH

an NYH by LMAX array containing the dependent variables and their approximate scaled derivatives, where LMAX = dls1%MAXORD + 1. YH(i,j+1) contains the approximate j-th derivative of y(i), scaled by dls1%h**j/factorial(j) (j = 0,1,…,NQ). on entry for the first step, the first two columns of YH must be set from the initial values.

NYH

a constant integer .ge. dls1%N, the first dimension of YH.

YH1

a one-dimensional array occupying the same space as YH.

EWT

an array of length dls1%N containing multiplicative weights for local error measurements. Local errors in Y(i) are compared to 1.0/EWT(i) in various error tests.

SAVF

an array of working storage, of length dls1%N. Also used for input of YH(*,dls1%MAXORD+2) when dls1%JSTART = -1 and dls1%MAXORD .lt. the current order NQ.

ACOR

a work array of length dls1%N, used for the accumulated corrections. On a successful return, ACOR(i) contains the estimated one-step local error in Y(i).

WM,IWM

real and integer work arrays associated with matrix operations in chord iteration (dls1%MITER .ne. 0).

PJAC

name of routine to evaluate and preprocess Jacobian matrix and P = I - dls1%hel0JAC, if a chord method is being used.

SLVS

name of routine to solve linear system in chord iteration.

GLOBAL VARIABLES

dls1%CCMAX

maximum relative change in dls1%h*el0 before PJAC is called.

dls1%H

the step size to be attempted on the next step. dls1%H is altered by the error control algorithm during the problem. dls1%H can be either positive or negative, but its sign must remain constant throughout the problem.

dls1%HMIN

the minimum absolute value of the step size dls1%h to be used.

dls1%HMXI

inverse of the maximum absolute value of dls1%h to be used. dls1%HMXI = 0.0 is allowed and corresponds to an infinite hmax. dls1%HMIN and dls1%HMXI may be changed at any time, but will not take effect until the next change of dls1%h is considered.

dls1%TN

the independent variable. dls1%TN is updated on each step taken.

dls1%JSTART

an integer used for input only, with the following values and meanings: 0 perform the first step. .gt.0 take a new step continuing from the last. -1 take the next step with a new value of dls1%H, dls1%MAXORD, dls1%N, dls1%METH, dls1%MITER, and/or matrix parameters. -2 take the next step with a new value of dls1%H, but with other inputs unchanged. On return, dls1%JSTART is set to 1 to facilitate continuation.

dls1%KFLAG

a completion code with the following meanings: 0 the step was succesful. -1 the requested error could not be achieved. -2 corrector convergence could not be achieved. -3 fatal error in PJAC or SLVS.

A return with dls1%KFLAG = -1 or -2 means either abs(dls1%H) = dls1%HMIN or 10 consecutive failures occurred. On a return with dls1%KFLAG negative, the values of dls1%TN and the YH array are as of the beginning of the last step, and dls1%H is the last step size attempted.

dls1%MAXORD

the maximum order of integration method to be allowed.

dls1%MAXCOR

the maximum number of corrector iterations allowed.

dls1%MSBP

maximum number of steps between PJAC calls (dls1%MITER .gt. 0).

dls1%MXNCF

maximum number of convergence failures allowed.

dls1%METH/dls1%MITER

the method flags. See description in driver.

dls1%N

the number of first-order differential equations.

The values of dls1%CCMAX, dls1%H, dls1%HMIN, dls1%HMXI, dls1%TN, dls1%JSTART, dls1%KFLAG, dls1%MAXORD, dls1%MAXCOR, dls1%MSBP, dls1%MXNCF, dls1%METH, dls1%MITER, and dls1%N are communicated via a global compound variable (DLS1)

Arguments

Type IntentOptional Attributes Name
integer :: Neq(*)
real(kind=dp), intent(inout) :: Y(*)
real(kind=dp), intent(inout) :: Yh(Nyh,*)
integer :: Nyh
real(kind=dp), intent(inout) :: Yh1(*)
real(kind=dp) :: Ewt(*)
real(kind=dp), intent(inout) :: Savf(*)
real(kind=dp), intent(inout) :: Acor(*)
real(kind=dp) :: Wm(*)
integer :: Iwm(*)
real :: f
integer :: jac
real :: pjac
real :: slvs

Calls

proc~~dstode~2~~CallsGraph proc~dstode~2 M_odepack.f90::dstode proc~dcfode~2 M_odepack::dcfode proc~dstode~2->proc~dcfode~2 proc~dvnorm~2 M_odepack::dvnorm proc~dstode~2->proc~dvnorm~2

Variables

Type Visibility Attributes Name Initial
real(kind=dp), public :: dcon
real(kind=dp), public :: ddn
real(kind=dp), public :: del
real(kind=dp), public :: delp
integer, public, parameter :: dp = kind(0.0d0)
real(kind=dp), public :: dsm
real(kind=dp), public :: dup
real(kind=dp), public :: exdn
real(kind=dp), public :: exsm
real(kind=dp), public :: exup
integer, public :: i
integer, public :: i1
integer, public :: iredo
integer, public :: iret
integer, public :: j
integer, public :: jb
integer, public :: m
integer, public :: ncf
integer, public :: newq
real(kind=dp), public :: r
real(kind=dp), public :: rh
real(kind=dp), public :: rhdn
real(kind=dp), public :: rhsm
real(kind=dp), public :: rhup
real(kind=dp), public :: told