Thank you Daniel and Jean-Paul. Indeed I am using PETSc wrappers and the columns manipulation is not active. And indeed if I run a little less academic example, i.e. more than a single element, CG converges. Just to know, in case of a single element CG does not, likely this is not unexpected. The error message is quite self-explanatory (note that the solution is actually zero...):
*----------------------------------------------------* *Exception on processing: * *--------------------------------------------------------* *An error occurred in line <151> of file <../source/lac/petsc_solver.cc> in function* * void dealii::PETScWrappers::SolverBase::solve(const dealii::PETScWrappers::MatrixBase &, dealii::PETScWrappers::VectorBase &, const dealii::PETScWrappers::VectorBase &, const dealii::PETScWrappers::PreconditionerBase &)* *The violated condition was: * * false* *The name and call sequence of the exception was:* * SolverControl::NoConvergence (solver_control.last_step(), solver_control.last_value())* *Additional Information: * *Iterative method reported convergence failure in step 0. The residual in the last step was nan.* *This error message can indicate that you have simply not allowed a sufficiently large number of iterations for your iterative solver to converge. This often happens when you increase the size of your problem. In such cases, the last residual will likely still be very small, and you can make the error go away by increasing the allowed number of iterations when setting up the SolverControl object that determines the maximal number of iterations you allow.* *The other situation where this error may occur is when your matrix is not invertible (e.g., your matrix has a null-space), or if you try to apply the wrong solver to a matrix (e.g., using CG for a matrix that is not symmetric or not positive definite). In these cases, the residual in the last iteration is likely going to be large.* *--------------------------------------------------------* *Aborting!* *----------------------------------------------------* *Program ended with exit code: 1* I am again very grateful with deal.II community, this is a great plus and I hope one day to contribute, once my expertise will allow me to. Final questions to close this call: 1 - Can I manage the exception in a way that in case CG does not converge I can try GMRes rather than aborting? Is the usual try-catch instruction working? 2 - I see that the class PETScWrappers implements both BiCGStab and GMRes. Can you pinpoint to an example? Thanks Alberto *Alberto Salvadori* Dipartimento di Ingegneria Civile, Architettura, Territorio, Ambiente e di Matematica (DICATAM) Universita` di Brescia, via Branze 43, 25123 Brescia Italy tel 030 3711239 fax 030 3711312 e-mail: alberto.salvad...@unibs.it web-pages: http://m4lab.unibs.it/faculty.html http://dicata.ing.unibs.it/salvadori On Thu, Apr 20, 2017 at 5:20 AM, Daniel Arndt < daniel.ar...@iwr.uni-heidelberg.de> wrote: > Alberto, > > Now I understand your concern. The boolean flag that is passed as the >> final parameter to MatrixTools::apply_boundary_values >> <https://www.dealii.org/8.5.0/doxygen/deal.II/namespaceMatrixTools.html#a9ad0eb7a8662628534586716748d62fb> >> determines whether column elimination is performed. You've set it to false, >> so this is not done and the RHS is unaltered. So switching it to true (the >> default) should preserve the symmetry of the system and make the necessary >> adjustments to the RHS vector. >> > While this is true in general, for PETSc and Trilinos matrices only the > case "eliminate_columns = false" is implemented [1]. > This means that your system matrix will not be symmetric if you are using > MatrixTools::apply_boundary_values, but a CG will likely still work [2, > Global elimination]. > > Best, > Daniel > > [1] https://www.dealii.org/developer/doxygen/deal.II/ > namespaceMatrixTools.html#a96d8a143c787e0dca41ce6168152dc04 > [2] https://www.dealii.org/developer/doxygen/deal.II/ > namespaceMatrixTools.html > > -- > The deal.II project is located at http://www.dealii.org/ > For mailing list/forum options, see https://groups.google.com/d/ > forum/dealii?hl=en > --- > You received this message because you are subscribed to the Google Groups > "deal.II User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to dealii+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Informativa sulla Privacy: http://www.unibs.it/node/8155 -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.