@@ -650,16 +650,23 @@ namespace aspect
650650 }
651651 catch (const std::exception &exc)
652652 {
653- // Test that we are trying to handle exceptions and that
654- // the exception we got is one of the two documented by
655- // throw_linear_solver_failure_exception(). If not, we have a genuine
653+ // We get here if the Stokes solve above failed. Let's see first
654+ // why that happened:
655+
656+ // If the exception we got is not one of the two documented by
657+ // throw_linear_solver_failure_exception(), then we have a genuine
656658 // problem here, and will need to get outta here right away:
657- if (newton_handler->parameters .use_Newton_failsafe == false ||
658- ((dynamic_cast <const ExcMessage *>(&exc)==nullptr ) &&
659- (dynamic_cast <const QuietException *>(&exc)==nullptr )))
659+ if ((dynamic_cast <const ExcMessage *>(&exc)==nullptr ) &&
660+ (dynamic_cast <const QuietException *>(&exc)==nullptr ))
661+ throw ;
662+
663+ // Otherwise, the solver presumably failed because the Newton matrix
664+ // is not symmetric or not definite. If we do not actually want to
665+ // handle this case, then again leave:
666+ if (newton_handler->parameters .use_Newton_failsafe == false )
660667 throw ;
661668
662- // start the solve over again and try with a stabilized version
669+ // Otherwise, start the solve over again and try with a stabilized version:
663670 pcout << " failed, trying again with stabilization" << std::endl;
664671 newton_handler->parameters .preconditioner_stabilization = Newton::Parameters::Stabilization::SPD;
665672 newton_handler->parameters .velocity_block_stabilization = Newton::Parameters::Stabilization::SPD;
0 commit comments