File:GMRESm.f90: Difference between revisions

From openpipeflow.org
Jump to navigation Jump to search
(Solve Ax=b for x, subject to constraint |x|<delta.)
 
mNo edit summary
Line 1: Line 1:
Solve Ax=b for x, subject to constraint |x|<delta.
{{latexPreamble}}
 
=== The Method ===
 
This implements the classic GMRES(m) method for solving the system \[A\vec{x}=\vec{b}\] for $\vec{x}$.  This implementation introduces the extra constraint $|\vec{x}|<\delta$, which may be ignored by putting $\delta$ large.
 
The main advantage of the method is that it only requires calculations of multiplies by $A$ for a given $\vec{x}$ -- it does not need to know $A$ itself.  This means that $A$ need not even be stored, and could correspond to a very complex linear 'action' on $\vec{x}$, e.g. a time integral with initial condition $\vec{x}$.  The method seeks eigenvectors in $\mathrm{span}\{\vec{x},\,A\vec{x},\,A^2\vec{x},...\}$, but uses Gram-Schmidt orthogonalisation to improve the suitability of the basis.
 
The extra constraint means that restarts are not straight forward.  m should be chosen sufficiently large to solve within the specified residual error, $|Ax-b|/|b|$<res.
 
To download, click the link above.  The routine needs to be passed an external functions that calculates dot products, and two external subroutines, one that calculates the action of multiplication by $A$, and another that replaces a vector with the action of a preconditioner matrix.  The latter may simply be an empty subroutine if no preconditioner is required.

Revision as of 03:44, 13 December 2016

$ \renewcommand{\vec}[1]{ {\bf #1} } \newcommand{\bnabla}{ \vec{\nabla} } \newcommand{\Rey}{Re} \def\vechat#1{ \hat{ \vec{#1} } } \def\mat#1{#1} $

The Method

This implements the classic GMRES(m) method for solving the system \[A\vec{x}=\vec{b}\] for $\vec{x}$. This implementation introduces the extra constraint $|\vec{x}|<\delta$, which may be ignored by putting $\delta$ large.

The main advantage of the method is that it only requires calculations of multiplies by $A$ for a given $\vec{x}$ -- it does not need to know $A$ itself. This means that $A$ need not even be stored, and could correspond to a very complex linear 'action' on $\vec{x}$, e.g. a time integral with initial condition $\vec{x}$. The method seeks eigenvectors in $\mathrm{span}\{\vec{x},\,A\vec{x},\,A^2\vec{x},...\}$, but uses Gram-Schmidt orthogonalisation to improve the suitability of the basis.

The extra constraint means that restarts are not straight forward. m should be chosen sufficiently large to solve within the specified residual error, $|Ax-b|/|b|$<res.

To download, click the link above. The routine needs to be passed an external functions that calculates dot products, and two external subroutines, one that calculates the action of multiplication by $A$, and another that replaces a vector with the action of a preconditioner matrix. The latter may simply be an empty subroutine if no preconditioner is required.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeDimensionsUserComment
current03:48, 26 June 2019 (5 KB)Apwillis (talk | contribs)Minor edits in comments only.
03:30, 13 December 2016 (5 KB)Apwillis (talk | contribs)Solve Ax=b for x, subject to constraint |x|<delta.