Feel++ supports PETSc
as it Linear algebra backend. PETSc
is a suite of data structures and routines for the scalable solution of scientific applications modeled by PDE available at http://www.mcs.anl.gov/petsc/petsc-as/
To select a backend in order to solve a linear system, we instantiate the Backend
class associated :
The backend provides an interface to solve
where is a
sparse matrix and
vectors of size
. The backend defines the
C++
types for each of these, e.g :
In practice, we use the boost::shared_ptr<>
shared pointer to ensure that we won't get memory leaks. The backends provide a corresponding typedef
where and
are function spaces providing the number of degrees of freedom that will define the size of the matrix and vectors thanks to the helpers functions
Backend::newMatrix()
and Backend::newVector
. In a parallel setting, the local/global processor mapping would be passed down by the function spaces.
To solve the linear problem , the backend provides a function
solve
.
Interface :
Required Parameters :
_matrix
: the matrix sparse_matrix_ptrtype
type _solution
: the solution vector_type
or vector_ptrtype
_rhs
: the second member vector vector_ptrtype
Optional Parameters
_prec
: preconditioner, instead of solving _
maxit : maximum number of iterations, this option is used with an iterative solving method _rtolerance
: residual tolerance, the fraction _atolerance
: absolute tolerance, _dtolerance
: different tolerance, sometimes, the residue doesn’t decrease continuously during the iterations. The difference between two plots doesn’t have to exceed the parameter choosen for the difference tolerance. _transpose
: boolean to use transpose matrix, instead of solving The library Boost::Parameters
allows you to enter parameters in the order you want. It supports deduced parameters, that is to say parameters whose identity can be deduced from their types.