"Salazar De Troya, Miguel" <[email protected]> writes:

> The error is:
>
>
> Linear Elasticity_ solve did not converge due to DIVERGED_PCSETUP_FAILED 
> iterations 0

This is PETSc output due to

  -Elasticity_ksp_converged_reason

It doesn't set an error.

>                                       PCSETUP_FAILED due to FACTOR_NOERROR

Is there really no other output?  Always send all the output.

> The program actually continues, Is there any way I can catch this divergence 
> and do some operation like writing to disk?
>
> Thanks
> Miguel
>
>
>
> ________________________________
> From: Jed Brown <[email protected]>
> Sent: Saturday, November 11, 2017 1:43:32 PM
> To: Salazar De Troya, Miguel; [email protected]
> 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" <[email protected]> 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
>> [email protected]
>> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to