[petsc-users] How to use F and G for TS

Zhang, Hong hongzhang at anl.gov
Fri Dec 3 11:13:15 CST 2021



On Dec 3, 2021, at 2:52 AM, Pierre Seize <pierre.seize at onera.fr<mailto:pierre.seize at onera.fr>> wrote:


Hello, I want to set a TS object for the time integration of my FV CFD solver.

The equation is M dQ/dt = f(Q) where M is a diagonal mass matrix filled with the cell volumes from my FV discretisation. I've read the PETSc manual and I found some interesting mails in the petsc-users archive, but I still do not understand something.

To me, there is three ways I could set my TS :
1. F(t, x, x') = Mx' - f(x)   and G(t, x) = 0 (default)
2. F(t, x, x') = Mx'          and G(t, x) = f(x)
3. F(t, x, x') = x' (default) and G(t, x) = M^{-1} f(x)

From (https://lists.mcs.anl.gov/pipermail/petsc-dev/2017-October/021545.html), I think that unless I'm using an IMEX method, whatever F and G, it does F <-- F - G internally, but I would like to be sure.


Will there be a difference be if I use an explicit method, as Euler or RK ? What about implicit method such as BEuler or Theta methods ?

To use an explicit method, you must use the explicit form (option 3 above). For implicit methods, all the three options will work.


If I use an implicit method (beuler), what happens if I don't give F' and/or G' ? Are their matrix-vector product approximated with finite difference ?

If the Jacobian is not provided, it will be approximated with finite-difference. If you prefer a matrix-free implementation, you can use -snes_mf.


What I understand is that for implicit-explicit methods, "G is treated explicitly while F is treated implicitly". In this case, am I right to assume it's useless to give the RHS Jacobian ? Then, when is G' used ?

Right. The RHS Jacobian (G') is not needed for IMEX. G’ is used if you switch to an implicit method such as beuler.


If I do not use an IMEX method, are the 3 formulations equivalent ?

Option 3 allows you to switch between explicit methods and implicit methods at runtime. Of course, it requires inverting the mass matrix, which is fine in your case but may be difficult for other applications (where option 1 can be used).  Option 2 is mostly useful for IMEX.

Hong (Mr.)


Thank you for your help


Pierre Seize


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211203/f5234448/attachment-0001.html>


More information about the petsc-users mailing list