← Back to team overview

dolfin team mailing list archive

Re: KrylovSolver and zero Pivot

 

On Wed, Mar 22, 2006 at 10:13:22AM +0000, Alexander Jarosch wrote:
> I got a bit lost in the current updates and now I just have a short 
> question. I set up my solver like this:
> 
>  // Discretize equation
>  Matrix A;
>  Vector x, b;
>  FEM::assemble(*a, *L, A, b, mesh, bc);
> 
>  // Solve the linear system
>  KrylovSolver solver(Preconditioner::ilu);
>  KSP ksp;
>  ksp = solver.solver();
> 
>  PC pc;
>  KSPGetPC(ksp, &pc);
>  PCFactorSetShiftNonzero(pc, PETSC_DECIDE);
>  //PCFactorSetShiftPd(pc, PETSC_TRUE);
> 
>  solver.set("Krylov relative tolerance", 1e-14);
> 
>  solver.solve(A, x, b);
> 
> but Petsc still complains about zero Pivot. should the line 
> "PCFactorSetShiftNonzero(pc, PETSC_DECIDE);" not take care of that.

The problem is that KrylovSolver::solve() reads all parameters from
the (DOLFIN) database, including "Krylov relative tolerance", and sets
them before each solve. The solve() function also sets the
preconditioner. Therefore, setting options manually by PETSc calls
might not always work.

The plan is to remove the KrylovSolver::solve() function if no one
objects (Garth?). This will leave two options: either use the simple
(but limited) DOLFIN wrapper or get the PETSc data structures and
solve using PETSc calls:

Mat Amat = A.mat();
Vec xvec = x.vec();

PETSc calls...

That said, I will (re-)add a parameter for "Krylov shift nonzero" so
you can do this natively in DOLFIN.

I'll await comments from Garth and others before going ahead.

/Anders



Follow ups

References