The petsc options for the system are as follows:
-Elasticity_ksp_monitor_true_residual -Elasticity_ksp_converged_reason -Elasticity_ksp_type cg -Elasticity_log_view -Elasticity_mg_levels_esteig_ksp_type cg -Elasticity_mg_levels_ksp_chebyshev_esteig_steps 50 -Elasticity_mg_levels_ksp_type chebyshev -Elasticity_mg_levels_pc_type sor -Elasticity_pc_type gamg -Elasticity_pc_gamg_verbose 7 -Elasticity_pc_gamg_type agg -Elasticity_pc_gamg_agg_nsmooths 1 -Elasticity_pc_gamg_threshold 0.001 -Elasticity_snes_linesearch_type basic -Elasticity_snes_atol 1e-6 -Elasticity_ksp_atol 1e-7 -Elasticity_ksp_rtol 1e-9 -Elasticity_ksp_norm_type unpreconditioned I pass the rigid body modes to the solver. ________________________________ From: Jed Brown <j...@jedbrown.org> Sent: Saturday, November 11, 2017 1:43:32 PM To: Salazar De Troya, Miguel; libmesh-users@lists.sourceforge.net Subject: Re: [Libmesh-users] try-catch in a PETSc solve() What is your error message? If the error is raised in PETSc, there is usually a setting to make it return without raising an error (instead setting a "diverged" reason). "Salazar De Troya, Miguel" <salazardet...@llnl.gov> writes: > Hello > > > I have an optimization problem for which at a certain iteration, PETSc fails > to build the preconditioner. I would like to catch that error and print my > EquationSystem to disk so I can rerun the PETSc solve at that optimization > iteration from the start. I cannot just rerun my optimization and write to > disk at the iteration I know it is going to fail. The reason is that in > parallel the optimization slightly differs every time I run it so the > iteration it is going to fail at keeps changing. Maybe something along this > lines: > > > try{ > > system.solve() > > } > > catch(...){ > > EquationSystem & es = system.get_equation_systems(); > > es.write("eq_output.xdr") > > } > > > Thanks > > Miguel > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libmesh-users ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users