On Sun, Apr 18, 2010 at 07:03:34PM +0400, Garth N. Wells wrote: > What about the other backends? > > Garth
You mean EpetraKrylovSolver and ITLKrylovSolver? I never use those so I forgot about them. Any others or just the two? -- Anders > -------- Original Message -------- > Subject: [Branch ~dolfin-core/dolfin/main] Rev 4692: Issue error by > default when solvers don't converge (parameter > "error_on_convergence") > Date: Thu, 15 Apr 2010 19:30:37 -0000 > From: [email protected] > Reply-To: [email protected] > To: Garth Wells <[email protected]> > > ------------------------------------------------------------ > revno: 4692 > committer: Anders Logg <[email protected]> > branch nick: dolfin-dev > timestamp: Thu 2010-04-15 20:57:43 +0200 > message: > Issue error by default when solvers don't converge (parameter > "error_on_convergence") > modified: > ChangeLog > dolfin/la/PETScKrylovSolver.cpp > dolfin/la/uBLASKrylovSolver.cpp > dolfin/la/uBLASKrylovSolver.h > dolfin/nls/NewtonSolver.cpp > dolfin/parameter/GlobalParameters.h > > > === modified file 'ChangeLog' > --- ChangeLog 2010-04-08 10:38:46 +0000 > +++ ChangeLog 2010-04-15 18:57:43 +0000 > @@ -1,3 +1,4 @@ > + - Issue error by default when solvers don't converge (parameter > "error_on_convergence") > - Add option to print matrix/vector for a VariationalProblem > - Trilinos backend now works in parallel > - Remove Mesh refine members functions. Use free refine(...) functions > instead > > === modified file 'dolfin/la/PETScKrylovSolver.cpp' > --- dolfin/la/PETScKrylovSolver.cpp 2010-04-05 17:22:50 +0000 > +++ dolfin/la/PETScKrylovSolver.cpp 2010-04-15 18:57:43 +0000 > @@ -1,11 +1,11 @@ > // Copyright (C) 2005 Johan Jansson. > // Licensed under the GNU LGPL Version 2.1. > // > -// Modified by Anders Logg, 2005-2009. > +// Modified by Anders Logg, 2005-2010. > // Modified by Garth N. Wells, 2005-2010. > // > // First added: 2005-12-02 > -// Last changed: 2010-04-05 > +// Last changed: 2010-04-15 > > #ifdef HAS_PETSC > > @@ -156,7 +156,13 @@ > KSPConvergedReason reason; > KSPGetConvergedReason(*_ksp, &reason); > if (reason < 0) > - warning("Krylov solver did not converge (PETSc reason %i).", reason); > + { > + bool error_on_nonconvergence = parameters["error_on_nonconvergence"]; > + if (error_on_nonconvergence) > + error("Krylov solver did not converge (PETSc reason %i).", reason); > + else > + warning("Krylov solver did not converge (PETSc reason %i).", reason); > + } > > // Get the number of iterations > int num_iterations = 0; > > === modified file 'dolfin/la/uBLASKrylovSolver.cpp' > --- dolfin/la/uBLASKrylovSolver.cpp 2009-09-08 16:38:36 +0000 > +++ dolfin/la/uBLASKrylovSolver.cpp 2010-04-15 18:57:43 +0000 > @@ -1,10 +1,10 @@ > // Copyright (C) 2006-2009 Garth N. Wells. > // Licensed under the GNU LGPL Version 2.1. > // > -// Modified by Anders Logg, 2006-2009. > +// Modified by Anders Logg, 2006-2010. > // > // First added: 2006-05-31 > -// Last changed: 2009-09-08 > +// Last changed: 2010-04-15 > > #include <boost/assign/list_of.hpp> > #include "uBLASILUPreconditioner.h" > > === modified file 'dolfin/la/uBLASKrylovSolver.h' > --- dolfin/la/uBLASKrylovSolver.h 2009-09-08 13:03:05 +0000 > +++ dolfin/la/uBLASKrylovSolver.h 2010-04-15 18:57:43 +0000 > @@ -1,10 +1,10 @@ > // Copyright (C) 2006-2009 Garth N. Wells. > // Licensed under the GNU LGPL Version 2.1. > // > -// Modified by Anders Logg, 2006-2008. > +// Modified by Anders Logg, 2006-2010. > // > // First added: 2006-05-31 > -// Last changed: 2009-09-08 > +// Last changed: 2010-04-15 > > #ifndef __UBLAS_KRYLOV_SOLVER_H > #define __UBLAS_KRYLOV_SOLVER_H > @@ -157,9 +157,15 @@ > error("Requested Krylov method unknown."); > > // Check for convergence > - if( !converged ) > - warning("Krylov solver failed to converge."); > - else if ( report ) > + if (!converged) > + { > + bool error_on_nonconvergence = parameters["error_on_nonconvergence"]; > + if (error_on_nonconvergence) > + error("Krylov solver failed to converge."); > + else > + warning("Krylov solver failed to converge."); > + } > + else if (report) > info("Krylov solver converged in %d iterations.", iterations); > > return iterations; > > === modified file 'dolfin/nls/NewtonSolver.cpp' > --- dolfin/nls/NewtonSolver.cpp 2010-04-05 17:22:50 +0000 > +++ dolfin/nls/NewtonSolver.cpp 2010-04-15 18:57:43 +0000 > @@ -6,7 +6,7 @@ > // Modified by Johan Hake, 2010. > // > // First added: 2005-10-23 > -// Last changed: 2010-03-04 > +// Last changed: 2010-04-15 > > #include <iostream> > #include <dolfin/common/NoDeleter.h> > @@ -110,7 +110,13 @@ > info(PROGRESS, "Newton solver finished in %d iterations and %d linear > solver iterations.", > newton_iteration, krylov_iterations); > else > - warning("Newton solver did not converge."); > + { > + bool error_on_nonconvergence = parameters["error_on_nonconvergence"]; > + if (error_on_nonconvergence) > + error("Newton solver did not converge."); > + else > + warning("Newton solver did not converge."); > + } > > end(); > > > === modified file 'dolfin/parameter/GlobalParameters.h' > --- dolfin/parameter/GlobalParameters.h 2010-03-22 12:48:12 +0000 > +++ dolfin/parameter/GlobalParameters.h 2010-04-15 18:57:43 +0000 > @@ -2,7 +2,7 @@ > // Licensed under the GNU LGPL Version 2.1. > // > // First added: 2009-07-02 > -// Last changed: 2010-03-22 > +// Last changed: 2010-04-15 > > #ifndef __GLOBAL_PARAMETERS_H > #define __GLOBAL_PARAMETERS_H > @@ -43,21 +43,24 @@ > p.add("optimize_use_tensor_cache", false); // Store > tensors in cache for reuse > p.add("optimize", false); // All of the > above > > - // Linear algebra --- > + // Linear algebra > #ifdef HAS_PETSC > p.add("linear_algebra_backend", "PETSc"); // Use PETSc if > available > #else > p.add("linear_algebra_backend", "uBLAS"); // Otherwise, > use uBLAS > #endif > > - // Floating-point precision (only relevant when using GMP) --- > + // Solvers > + p.add("error_on_nonconvergence", true); // Issue an > error if solver does not converge (otherwise warning) > + > + // Floating-point precision (only relevant when using GMP) > #ifdef HAS_GMP > p.add("floating_point_precision", 30); // Use higher > precision for GMP (can be changed) > #else > p.add("floating_point_precision", 16); // Use double > precision when GMP is not available > #endif > > - // Graph partitioner --- > + // Graph partitioner > p.add("mesh_partitioner", "ParMETIS"); > > return p; > > > _______________________________________________ > Mailing list: https://launchpad.net/~dolfin > Post to : [email protected] > Unsubscribe : https://launchpad.net/~dolfin > More help : https://help.launchpad.net/ListHelp
signature.asc
Description: Digital signature
_______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

