← Back to team overview

dolfin team mailing list archive

A note on the new solve() function

 

It's now possible to use all Krylov methods and preconditioners by
just calling solve(). Here are some examples:

  solve(A, x, b);
  solve(A, x, b, lu);
  solve(A, x, b, gmres);
  solve(A, x, b, gmres, ilu);
  solve(A, x, b, bicgstab, sor);
  solve(A, x, b, cg, amg);

Without any options, solve() will just use LU.

Note that each time solve is called, a new solver object will be
created and then destroyed. This means that if you want to solve
repeatedly, it will be a little more efficient to create a solver
object instead of calling solve() many times. But the good thing
is that the overhead is small. In a simple test I made (which is
in sandbox/la/solve), the overhead was only 5%:

  --- Calling solve repeatedly: 22.8 seconds
  --- Reusing solver: 21.64 seconds

  --- Calling solve repeatedly: 22.81 seconds
  --- Reusing solver: 21.75 seconds

This is for solving a 263169 x 263169 system (Poisson) 10 times with
GMRES (from PETSc) and AMG (from PETSc/Hypre).

I don't know how to get this working in the Python interface, since
the enum variables don't seem to get wrapped. Anyone knows how to
fix this?

-- 
Anders


Follow ups