dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #02101
Re: zero pivot
PETSc solvers have a lot of options, so DOLFIN will never provide
wrappers for all of them. What you can do is ask KrylovSolver to return
the pointer to the PETSc solver. For example,
KrylovSolver solver;
KSP ksp;
ksp = solver.solver();
PC pc;
KSPGetPC(ksp, &pc);
PCFactorSetShiftPd(pc, PETSC_TRUE);
This was you don't need to touch the file KrylovSolver.cpp and you have access to
all PETSc functionality.
Garth
On Tue, 2006-02-28 at 09:43 +0000, Alexander Jarosch wrote:
> Hi,
>
> I experience zero pivot problems when I solve Stokes problems with high
> viscosities, order of 1e13 and such viscous fluids like ice and earth
> mantle material. I helped myself with this Petsc parameter in the
> KrylovSolver.cpp
>
> PCFactorSetShiftPd(pc, PETSC_TRUE);
>
> works nice.
>
> Alex
>
> Garth N. Wells wrote:
>
> > I've never observed the KrylovSolver (or preconditioner)to have
> > problems with zero pivots. Things work OK for the Taylor-Hood element
> > at least. The PETSC LU solver does have problems (and did have with
> > Taylor-Hood element), and something was added a while ago to LU to
> > deal with this.
> >
> > Garth
> >
> > Anders Logg wrote:
> >
> >> I have added this to KrylovSolver as a temporary fix. All parameters
> >> should
> >> be moved to the new parameter system (including tolerances, iterations
> >> etc).
> >>
> >> /Anders
> >>
> >> On Fri, Dec 23, 2005 at 10:46:05AM +0100, hetzel.devel@xxxxxx wrote:
> >>
> >>> 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
> >>>>>>>>
> >>>
> >>> __________________________________________________________________________
> >>>
> >>> Erweitern Sie FreeMail zu einem noch leistungsstärkeren
> >>> E-Mail-Postfach!
> >>> Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
> >>>
> >>>
> >>> _______________________________________________
> >>> DOLFIN-dev mailing list
> >>> DOLFIN-dev@xxxxxxxxxx
> >>> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> >>>
> >>
> >
> >
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> >
>
>
--
Dr. Garth N. Wells
Faculty of Civil Engineering and Geosciences
Delft University of Technology
Stevinweg 1
2628 CN Delft
The Netherlands
tel. +31 15 278 7922
fax. +31 15 278 6383
e-mail g.n.wells@xxxxxxxxxx
url http://www.mechanics.citg.tudelft.nl/~garth
References