Request for additional documentation on Petsc-related functions

Hello,

I initially learned Petsc and am now trying to use FreeFem to call Petsc. However, when I attempted to use it to solve problems, I found that FreeFem offers very little documentation regarding Petsc-related functions (such as ChangeNumbering, SNESSolve, plotMPI, etc.) on the official website. The “Functions” section in the documentation only covers some basic functions, while the usage of other functions can only be explored blindly through examples. In Petsc’s official documentation,every function is well-explained.
Would it be possible to improve the related content on the FreeFem website? Perhaps I have missed some study materials. If there are relevant pages, could you please share the link with me?

Best regards,
Lina

1 Like

Both https://www.youtube.com/watch?v=-Aw2O46V2bo and FreeFem-tutorial should explain things in greater details.

Watching a YouTube series to find a signature and description for a function is quite… hard. Examples in the link to the tutorial have minimal comments. The PDF has the following description for ChangeNumbering:
ChangeNumbering(Mat,K[int]), without specifying what obligatory arguments are, and worse, in all examples the function is used with 3 parameters, for example:
ChangeNumbering(T, w[], u, exchange = true, inverse = true);

Is there no other way to learn than to blind experimenting? I am currently trying to understand this thing from an example:
TSSolve(T, funcJ, funcRes, wPETSc, sparams = "-ts_type beuler -ts_dt 0.1 -ts_max_time 100 -ts_exact_final_time interpolate -ts_max_snes_failures -1 -ts_view -pc_type lu -ts_adapt_type basic -ts_rtol 1e-3", monitor = funcM);
, that on the PETSc website has a highly different signature:
PetscErrorCode TSSolve(TS ts, Vec u)
and it is really hard to even guess where to look for explanations :frowning:

You can have a look here: https://arxiv.org/pdf/1806.01437. Depending on the TSType, the parameters are either F, G, or the Jacobians.

Thanks for all the links and the answers. If you don’t mind, I am trying to understand this example: FreeFem-sources/examples/hpddm/heat-TS-2d-PETSc.edp at develop · FreeFem/FreeFem-sources · GitHub

From the article you provided, I understand that w/wPETSc is the solution and funcJ is the j function provided to TSSetIJacobian. In the article, there is no explanation of what M or f are. In the example, it seems M is a vector of 1s while f is the stiffness matrix, which appears counterintuitive, so I think I am wrong. Do you know what these symbols mean?

funcRes() (resp. funcJ()) implements IFunctionHeat() (resp. IJacobianHeat()) from https://petsc.org/release/src/ts/tutorials/ex3.c.html, which are respectively used in TSSetIFunction — PETSc 3.22.2 documentation and TSSetIJacobian — PETSc 3.22.2 documentation.

1 Like