Dear community
in these days I am particularly bothering you, I apologize. Today, I wonder if I can receive some clarifications on catching the exception SolverControl::NoConvergence in using trilinos.
I wrote the code below for a linear system solver:
SolverControl bicgstab_solver_control ( bicgstab_max_iterations , tolerance );
SolverControl gmres_solver_control ( gmres_max_iterations , tolerance );
#ifdef USE_PETSC_LA
PETScWrappers::SolverBicgstab bicgstab (bicgstab_solver_control, this->mpi_communicator);
PETScWrappers::SolverGMRES gmres (gmres_solver_control, this->mpi_communicator, PETScWrappers::SolverGMRES::AdditionalData(50, true));
#else
TrilinosWrappers::SolverBicgstab::AdditionalData solver_data;
TrilinosWrappers::SolverBicgstab bicgstab (bicgstab_solver_control, solver_data );
TrilinosWrappers::SolverGMRES gmres (gmres_solver_control, TrilinosWrappers::SolverGMRES::AdditionalData(50, true));
#endif
if ( PreconditionIsAMG )
{
LA::MPI::PreconditionAMG preconditioner;
LA::MPI::PreconditionAMG::AdditionalData data;
preconditioner.initialize(this->system_matrix, data);
try
{
iterate_on_tolerance = false ;
this->pcout << " AMG - Bicgstab " << std::flush ;
bicgstab.solve (this->system_matrix, distributed_incremental_displacement, this->system_rhs, preconditioner);
solver_control_last_step = bicgstab_solver_control.last_step();
}
catch ( SolverControl::NoConvergence )
{
iterate_on_tolerance = true ;
try
{
... whatever ...
}
My idea is: whenever bicgstab.solve fails, for instance because the accuracy is higher than the tolerance, I want to catch the exception SolverControl::NoConvergence and do something else. I am insecure if the above code is fine for this purpose, could you please address me to a broader explanation ?
At any rate, it turns out that the code above works OK for PETSc, but not for trilinos - I do would like to use trilinos for the sake of memory leaks. Apparently , errors of kind
aztec00 error code #
take the lead with trilinos and the exception is not caught properly. I must have done something wrong.
I appreciate your help.
Alberto