nitstb2 Subroutine

subroutine nitstb2(n, xcur, fcur, step, eta, f, jacv, rpar, ipar, ijacv, irpre, iksmax, ifdord, nfe, njve, nrpre, nli, r, rtil, p, phat, v, t, rwork1, rwork2, rsnrm, dinpr, dnorm, itrmks)


FCNRM is no longer an argument, as it needs to be calculated from the residual, which isn't known until a little way into this routine. It could be calculated by the calling routine, but that would mean doing the calculation twice.


step = vector of length n, (trial) step.

eta = relative residual reduction factor.

f = name of user-supplied subroutine for evaluating the function the zero of which is sought; this routine has the form

             subroutine f(n, xcur, fcur, rpar, ipar, itrmf)

       where xcur is the array containing the current x value, fcur 
       is f(xcur) on output, rpar and ipar are, respectively, real 
       and integer parameter/work arrays for use by the subroutine,
       and itrmf is an integer termination flag.  The meaning of
       itrmf is as follows:
         0 => normal termination; desired function value calculated.
         1 => failure to produce f(xcur).

jacv = name of user-supplied subroutine for evaluating Jv or P(inverse)v, where J is the Jacobian of f and P is a right preconditioning operator. If neither analytic Jv evaluations nor right preconditioning is used, this can be a dummy subroutine; if right preconditioning is used but not analytic Jv evaluations, this need only evaluate P(inverse)*v. The form is

       subroutine jacv(n, xcur, fcur, ijob, v, z, rpar, ipar, itrmjv)

       where xcur and fcur are vectors of length n containing the 
       current x and f values, ijob is an integer flag indicating 
       which product is desired, v is a vector of length n to be 
       multiplied, z is a vector of length n containing the desired 
       product on output, rpar and ipar are, respectively, real 
       and integer parameter/work arrays for use by the subroutine, 
       and itrmjv is an integer termination 
       flag. The meaning of ijob is as follows: 
         0 => z = J*v
         1 => z = P(inverse)*v 
       The meaning of itrmjv is as follows:
         0 => normal termination; desired product evaluated. 
         1 => failure to produce J*v.
         2 => failure to produce P(inverse)*v. 
       This subroutine is called only from nitjv, and is always 
       called with v .ne. z.

rpar = real parameter/work array passed to the f and jacv routines.

ipar = integer parameter/work array passed to the f and jacv routines.

ijacv = flag for determining method of J*v evaluation. 0 => finite-difference evaluation (default). 1 => analytic evaluation.

irpre = flag for right preconditioning. 0 => no right preconditioning 1 => right preconditioning

iksmax = maximum allowable number of BiCGSTAB iterations.

ifdord = order of the finite-difference formula used in BiCGSTAB when J*v products are evaluated using finite-differences. When ijacv = 0 on input to nitsol, ifdord is set to 1, 2, or 4 in nitsol; otherwise, it is irrelevant. When ijacv = 0 on input to this subroutine, ifdord determines the order of the finite-difference formula used at each BiCGSTAB iteration (default 1). In this case, ijacv is set to -1 below to signal to nitjv that the order of the finite-difference formula is to be determined by ifdord. The original value ijacv = 0 is restored on return.

nfe = number of function evaluations.

njve = number of J*v evaluations.

nrpre = number of P(inverse)*v evaluations.

nli = number of linear iterations.

r = residual vector

rtil = "r-tilde" vector used in BiCGSTAB

p = vector used in BiCGSTAB

phat = vector used in BiCGSTAB

v = vector used in BiCGSTAB

t = vector used in BiCGSTAB

rwork1 = work vector, passed on to nitjv

rwork2 = work vector, passed on to nitjv

rsnrm = BiCGSTAB residual norm on return.

dinpr = inner-product routine, either user-supplied or blas ddot.

dnorm = norm routine, either user-supplied or blas dnrm2.

itrmks = termination flag; values have the following meanings: 0 => normal termination: acceptable step found. 1 => Jv failure in nitjv. 2 => P(inverse)v failure in nitjv. 3 => acceptable step not found in iksmax BiCGSTAB iterations. 4 => BiCGSTAB breakdown.

         Note: On return, nitsol terminates if itrmks is 1 or 2. 
         If itrmks is 3 or 4, nitsol may terminate or continue. 
         In this event, the step returned is a meaningful inexact 
         Newton step only if the residual norm has been reduced. 
         A decision on termination/continuation is made in nitdrv 
         according to whether there is sufficient residual norm 
         reduction, even though the desired inexact Newton condition 
         may not hold.

Subroutines required by this and all called routines:

user supplied: f, jacv

nitsol routines: nitjv, nitfd

blas routines: daxpy, dcopy, dscal

lapack routine:  dlamch

user supplied or blas: dinpr, dnorm

explanation: In nitsol, dinpr and dnorm are set to either the blas 
ddot and dnrm2 routines or the user-supplied usrnpr and usrnrm 
routines.

This subroutine called by: nitdrv

Subroutines called by this subroutine: daxpy, dcopy, dscal, dinpr, dlamch, dnorm, nitjv

Common block:


<<<<<<<<<<<<<<<<<<<<< TAKEN FROM nitprint.h >>>>>>>>>>>>>>>>>>>>>>>>>

Include these declaratinos and common blocks directly so that the include files are not needed in isoft.


 Do not set the step to 0, as it contains an initial guess at the 
 solution.

C do 10 i = 1, n C step(i) = 0.d0 C 10 continue


 Because the initial step is not zero, the residual must include an
 evaluation of the left-hand-side..

Arguments

Type IntentOptional AttributesName
integer :: n
double precision :: xcur(n)
double precision :: fcur(n)
double precision :: step(n)
double precision :: eta
real :: f
integer :: jacv
double precision :: rpar(*)
integer :: ipar(*)
integer :: ijacv
integer :: irpre
integer :: iksmax
integer :: ifdord
integer :: nfe
integer :: njve
integer :: nrpre
integer :: nli
double precision :: r(n)
double precision :: rtil(n)
double precision :: p(n)
double precision :: phat(n)
double precision :: v(n)
double precision :: t(n)
double precision :: rwork1(n)
double precision :: rwork2(n)
double precision :: rsnrm
double precision :: dinpr
double precision :: dnorm
integer :: itrmks

Calls

proc~~nitstb2~~CallsGraph proc~nitstb2 nitstb2 dcopy dcopy proc~nitstb2->dcopy nitjv nitjv proc~nitstb2->nitjv daxpy daxpy proc~nitstb2->daxpy dscal dscal proc~nitstb2->dscal dlamch dlamch proc~nitstb2->dlamch

Contents


Common Blocks


If diagnostic information is desired, include this common block in the main program and set iplvl and ipunit according to the following:

 iplvl = 0 =&gt; no printout
       = 1 =&gt; iteration numbers and F-norms
       = 2 =&gt; ... + some stats, step norms, and linear model norms
       = 3 =&gt; ... + some Krylov solver and backtrack information
       = 4 =&gt; ... + more Krylov solver and backtrack information

 ipunit = printout unit number.

Type AttributesNameInitial
integer :: iplvl
integer :: ipunit