← Back to team overview

dolfin team mailing list archive

Re: zero pivot

 

Hi,
I made a quick implementation for my dolfin 0.5.10. I got no time to check the 0.5.11 so I'm just telling you what I did, perhaps you can simply add it to the current version or to next release. If you think that it's not so urgent and you can wait till mid of january I can submit a patch then.

In src/la/dolfin/GMRES.h I added the lines (after setPreconditioner)
---------------
   /// Set ZeroPivot Boundary
   void setZeroPivot(real zeropivot);
---------------

In src/la/GMRES.cpp I added:
---------------
   //-----------------------------------------------------------------------------
   void GMRES::setZeroPivot(real zeropivot)
   {
     // Choose preconditioner
     PC pc;
     KSPGetPC(ksp, &pc);
   
     PCFactorSetZeroPivot(pc, zeropivot);
     dolfin_info("Changing ZeroPivot for GMRES solver from to %e.", zeropivot);
   }
---------------

That's all.
Now within my program I can simple set the ZeroPivot option like follows:
---------------
   // Set solver
   GMRES solver;
   solver.setZeroPivot(1e-14);
---------------

I think it should work the same for LU.

/Haiko

 
Discussion of DOLFIN development <dolfin-dev@xxxxxxxxxx> schrieb am 22.12.05 20:21:37:
> 
> ok, perhaps we should make KrylovSolver inherit from Parametrized and
> add an option "zero pivot tolerance"?
> 
> /Anders
> 
> 
> On Thu, Dec 22, 2005 at 06:46:09PM +0100, Garth N. Wells wrote:
> > It's possible to change the tolerance for zero pivots in PETSc. Have a
> > look at 
> > http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/PC/PCFactorSetZeroPivot.html#PCFactorSetZeroPivot
> > 
> > I made a change to the LU class a while ago so that it could deal with
> > matrices that have zeroes on the diagonal, such as Stokes flow with
> > Taylor-Hood elements.
> > 
> > Garth
> > 
> > On Thu, 2005-12-22 at 11:38 -0600, Anders Logg wrote:
> > > Then I have no idea. You can specify the tolerance for the GMRES
> > > solver in DOLFIN, but not the tolerance for checking for zero pivots
> > > in the ILU preconditioner. This is probably in the PETSc manual
> > > somewhere. If you find out how to make the adjustment in PETSc, then
> > > we can add a corresponding parameter in DOLFIN.
> > > 
> > > /Anders
> > > 
> > > 
> > > On Thu, Dec 22, 2005 at 06:24:33PM +0100, H. Etzel wrote:
> > > > Like the message is telling.
> > > > The matrix is bad conditioned, but it values are not zero if the tolerance
> > > > is not 1e-12 but 1e-20.
> > > > So the question is how to change the tolerance.
> > > > 
> > > > /Haiko
> > > > 
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: dolfin-dev-bounces@xxxxxxxxxx [mailto:dolfin-dev-bounces@xxxxxxxxxx] Im
> > > > Auftrag von Anders Logg
> > > > Gesendet: Donnerstag, 22. Dezember 2005 16:20
> > > > An: Discussion of DOLFIN development
> > > > Betreff: Re: [DOLFIN-dev] zero pivot
> > > > 
> > > > 
> > > > Looks like you are trying to solve a singular system. Most likely,
> > > > something is wrong with the matrix which PETSc rightly detects.
> > > > 
> > > > To be sure, try exporting the matrix to MATLAB/Octave and see if you
> > > > can invert it there or compute the condition number:
> > > > 
> > > > File file("matrix.m");
> > > > file << A;
> > > > 
> > > > Then just type
> > > > 
> > > >     matrix
> > > > 
> > > > in MATLAB/Octave and check if it looks ok.
> > > > 
> > > > /Anders
> > > > 
> > > > 
> > > > On Thu, Dec 22, 2005 at 04:02:19PM +0100, hetzel.devel@xxxxxx wrote:
> > > > > Hello everyone,
> > > > > I get a problem with my solver.
> > > > > I'm using the LU or alternative the GMRES solver, but by solving my
> > > > System, I always get the following message from Petsc:
> > > > > 
> > > > > [0]PETSC ERROR: MatLUFactorNumeric_SeqAIJ() line 516 in
> > > > src/mat/impls/aij/seq/aijfact.c
> > > > > [0]PETSC ERROR: Detected zero pivot in LU factorization
> > > > > see
> > > > http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Zer
> > > > oPivot!
> > > > > [0]PETSC ERROR: Zero pivot row 2950 value 4.17812e-13 tolerance 1e-12 * rs
> > > > 0.450719!
> > > > > [0]PETSC ERROR: MatLUFactorNumeric() line 1994 in
> > > > src/mat/interface/matrix.c
> > > > > [0]PETSC ERROR: PCSetUp_ILU() line 798 in
> > > > src/ksp/pc/impls/factor/ilu/ilu.c
> > > > > [0]PETSC ERROR: PCSetUp() line 798 in src/ksp/pc/interface/precon.c
> > > > > [0]PETSC ERROR: KSPSetUp() line 234 in src/ksp/ksp/interface/itfunc.c
> > > > > [0]PETSC ERROR: KSPSolve() line 332 in src/ksp/ksp/interface/itfunc.c
> > > > > 
> > > > > Is there an option for the solver to set the tolerance?
> > > > > 
> > > > > /Haiko
> > > > > __________________________________________________________________
> > > > > Nur bis 31.12.: 1&1 DSL mit WEB.DE Preisvorteil! Jetzt einsteigen 
> > > > > und die Vorteile sichern! http://1und1dsl.web.de/?mc=021130
> > > > > 
> > > > > 
> > > > > _______________________________________________
> > > > > DOLFIN-dev mailing list
> > > > > DOLFIN-dev@xxxxxxxxxx
> > > > > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> > > > > 
> > > > 
> > > 
> 
> -- 
> Anders Logg
> Research Assistant Professor
> Toyota Technological Institute at Chicago
> http://www.tti-c.org/logg/
> 
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev


__________________________________________________________________________
Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!		
Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131




Follow ups