12.07.2015 Views

DOLFIN User Manual - FEniCS Project

DOLFIN User Manual - FEniCS Project

DOLFIN User Manual - FEniCS Project

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DOLFIN</strong> <strong>User</strong> <strong>Manual</strong>Hoffman, Jansson, Logg, Wells3.3 Linear solversA general interface to all linear solvers for systems of the form Ax = b isprovided through the class LinearSolver.In particular, wrappers for a direct LU solver and an iterative Krylov GMRESsolver are implemented in the classes LU and GMRES.To solve the linear system Ax = b using GMRES in <strong>DOLFIN</strong>, simply write:Vec x;GMRES solver;solver.solve(A,x,b);<strong>DOLFIN</strong> also provides a wrapper for an eigenvalue solver in PETSc. Thefollowing code computes the eigenvalues of the matrix A,Vector er, ec;EigenvalueSolver esolver;esolver.eigen(A,er,ec);The real components of the eigenvalues are returned in the vector er andthe complex components of the eigenvalues are returned in the vector ec.The procedure for computing the eigenvalues of a matrix is computationallyintensive and should only be used for relatively small matrices.3.4 PreconditioningThe Preconditioner class specifies the interface for user-defined Krylovmethod preconditioners. To implement our own preconditioner we only needto supply a function that approximately solves the linear system given aright-hand side.27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!