Dear FreeFem users,
I would like to access the residual history using FreeFem-PETSc, so that can change the absolute-relative tolerance in the iteration. I have the following questions regarding this topic:
-
KSPSetResidualHistory
seems to be added in FreeFem-sources/PETSc-code.hpp at develop · FreeFem/FreeFem-sources · GitHub, but I am not able to make it work - see the MWE attached. Could anyone give a hint what should be added in the API/what am I doing wrong? - I would like to try out the same in a matrix-free formulation. However, since
KSPSetResidualHistory
accesses aMat
, the internal KSP object created in the API should be accesses. I think the key piece of code should be added after this line in the API, but I am a bit confused what KSP routines should be used, and what are the FreeFem/PETSc types and the conversions. I think this question is strongly related o the previous one.
Remark: this is not a crucial part of the problem I am working on, I think the computational speedup that I may achieved is a few 10%, so I might just skip it. However, if adding the extra piece of code is not that hard, I may try it out anyway.
PETSc_KSPSetResidualHistory.edp (829 Bytes)