dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #18452
Re: linear solvers
-
To:
Anders Logg <logg@xxxxxxxxx>
-
From:
"Garth N. Wells" <gnw20@xxxxxxxxx>
-
Date:
Tue, 01 Jun 2010 14:09:47 +0100
-
Cc:
DOLFIN Mailing List <dolfin@xxxxxxxxxxxxxxxxxxx>
-
In-reply-to:
<20100601092945.GS23810@olorin>
-
User-agent:
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4
On 01/06/10 10:29, Anders Logg wrote:
On Mon, May 31, 2010 at 01:58:08PM +0100, Garth N. Wells wrote:
On 31/05/10 13:50, Anders Logg wrote:
On Mon, May 31, 2010 at 01:17:15PM +0100, Garth N. Wells wrote:
At the moment, a linear solver is not associated with a particular
matrix. This makes it awkward and dangerous to re-use
preconditioners, factorisations, etc. I suggest that we change the
interface of the linear solver classes to accept a matrix at
construction, and that the solvers maintain a (smart) pointer to the
matrix. Opinions?
It feels awkward to associate a linear solver with a specific system.
Why is that? All our la backends do it. It seems natural to me since
solving a linear system involves a number of data structures which
are specific to the matrix.
Would would the interface look like?
LinearSolver solver(A);
This is more or less how how PETSc goes about creating solvers
(associating the matrix with the solver).
solver.parameters["preconditioner"] = "amg";
solver.solve(x, b); ?
x = solver.solve(b); ?
We would need to make sure that we avoid a copy constructor call for the
latter.
The other option would be to introduce a class LinearSystem:
LinearSystem system(A, b);
This is more or less how how AztecOO (Trilinos) goes about creating
solvers, except LinearSystem is just a holder, which used to create a solver
LinearSystem system(A, x, b);
KrylovSolver solver(system);
x = system.solve();
That would be analogous to VariationalProblem:
VariationalProblem problem(a, L);
u = problem.solve()
Looks like there are three options:
1. LinearSolver / VariationalSolver
2. LinearSystem / VariationalProblem
3. Both 1 and 2
Perhaps both. LinearSystem/VariationalProblem hold data, and
LinearSolver/VariationalSolver do something.
Garth
--
Anders
Garth
One option would be to have both Problem and Solver classes for linear
systems.
This is also related to the following blueprint that addresses the
issue of the inconsistency between the interfaces for linear systems
and variational problems:
https://blueprints.launchpad.net/dolfin/+spec/solver-interfaces
Follow ups
References