nitgm2 Interface

interface


Called by

interface~~nitgm2~~CalledByGraph interface~nitgm2 nitgm2 proc~gmres_solve gmres_solve proc~gmres_solve->interface~nitgm2 proc~quasilinear_solve quasilinear_solve proc~quasilinear_solve->proc~gmres_solve

public subroutine nitgm2(n, xcur, fcur, step, eta, f, jacv, rpar, ipar, ijacv, irpre, iksmax, iresup, ifdord, nfe, njve, nrpre, nli, kdmax, kdmaxp1, vv, rr, svbig, svsml, w, rwork, rsnrm, dinpr, dnorm, itrmks)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: n

Dimension of the problem

real(kind=r8), intent(in), dimension(n):: xcur

Array of length n containing the current value

real(kind=r8), intent(in), dimension(n):: fcur

Array of length n containing current approximate solution

real(kind=r8), intent(inout), dimension(n):: step

Vector of of length n containing trial step

real(kind=r8), intent(in) :: eta

Relative residual reduction factor

procedure(f_intr) :: f

User-supplied subroutine for evaluating the function the zero of which is sought.

procedure(jacv_intr) :: jacv

User-supplied subroutine for optionally evaluating or , where is the Jacobian of and is a right preconditioning operator. If neither analytic evaluations nor right preconditioning is used, this can be a dummy subroutine; if right preconditioning is used but not analytic evaluations, this need only evaluate .

real(kind=r8), intent(inout), dimension(*):: rpar

Parameter/work array passed to the f and jacv routines

integer, intent(inout), dimension(*):: ipar

Parameter/work array passed to the f and jacv routines

integer, intent(in) :: ijacv

Flag for determining method of evaluation. 0 (default) indicates finite-difference evaluation, while 1 indicates analytic evaluation.

integer, intent(in) :: irpre

Flag for right preconditioning. 0 indicates no preconditioning, while 1 inidcates right preconditioning.

integer, intent(in) :: iksmax

Maximum allowable number of GMRES iterations

integer, intent(in) :: iresup

Residual update flag. On GMRES restarts, the residual can be updated using a linear combination (iresup == 0) or by direct evaluation (iresup == 1). The first is cheap (one n-vector saxpy) but may lose accuracy with extreme residual reduction; the second retains accuracy better but costs one product.

integer, intent(in) :: ifdord

Order of the finite-difference formula (sometimes) used on GMRES restarts when 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, the precise meaning is as follows:

With GMRES, ifdord matters only if iresup = 1, in which case
it determines the order of the finite-difference formula used in evaluating the initial residual at each GMRES restart
(default 2). If iresup = 1 and ijacv = 0 on input to this
subroutine, then ijacv is temporarily reset to -1 at each
restart below to force a finite-difference evaluation of order ifdord. NOTE: This only affects initial residuals at restarts; first-order differences are always used within each GMRES
cycle. Using higher-order differences at restarts only should give the same accuracy as if higher-order differences were
used throughout; see K. Turner and H. F. Walker, "Efficient
high accuracy solutions with GMRES(m)," SIAM J. Sci. Stat.
Comput., 13 (1992), pp. 815--825.

integer, intent(inout) :: nfe

Number of function evaluations

integer, intent(inout) :: njve

Number of evaluations

integer, intent(inout) :: nrpre

Number of evaluations

integer, intent(inout) :: nli

Number of linear iterations

integer, intent(in) :: kdmax

Maximum Krylov subspace dimension; default 10.

integer, intent(in) :: kdmaxp1

kdmax + 1

real(kind=r8), intent(out), dimension(n, kdmaxp1):: vv

Matrix for storage of Krylov basis in GMRES; on return, the residual vector is contained in the first column.

real(kind=r8), intent(out), dimension(kdmax, kdmax):: rr

Matrix for storage of triangular matrix in GMRES.

real(kind=r8), intent(out), dimension(kdmax):: svbig

Vector for storage of estimate of singular vector of rr with largest singular value.

real(kind=r8), intent(out), dimension(kdmax):: svsml

Vector for storage of estimate of singular vector of rr with smallest singular value.

real(kind=r8), intent(out), dimension(kdmax):: w

Vector containing right-hand side of triangular system and least-squares residual norm in GMRES.

real(kind=r8), intent(out), dimension(n):: rwork

Work array

real(kind=r8), intent(out) :: rsnrm

GMRES residual norm on return

procedure(dinpr_intr) :: dinpr

Inner-product routine, either user-supplied or BLAS ddot.

procedure(dnorm_intr) :: dnorm

Norm routine, either user supplied or BLAS dnrm2.

integer, intent(out) :: itrmks

Termination flag. Values have the following meanings:

0
normal termination: acceptable step found
1
failure in nitjv
2
failure in nitjv
3
Acceptable step not found in iksmax GMRES iterations
4
Insignificant residual norm reduction of a cycle of kdmax steps (stagnation) before an acceptable step has been found.
5
Dangerous ill-conditioning detected before an acceptable step has been found.

Description

An interface to my modified versino of the nitsol implementation of the generalised minimal residual method (GMRES) for iteratively solving linear systems. It has been modified so that the user provides a non-zero initial guess of the solution.