Configure petsc solver options

Hi,

I will appreciate if someone could help me figure how to configure the petsc_options with following choices:

  1. iterative solver: gmres
  2. preconditioner: mg
  3. presmoother: sor
  4. postmoother: soru vector
  5. coarse solver: mumps

My installation is dolfinx 0.7.x through conda. In case it helps, I am solving the complex vector helmholtz equation in 3D with Nedelec elements and the model comprises around 10^6 dofs. I would welcome any suggestion for other configurations that might give good convergence.

Thanks a lot in advance!

Finding a good preconditioner for FE problems is a research topic. Someone may come in and help (unfortunately, not me, since that is not my field), but you should asking your advisor what they suggest and/or start carrying out a literature review on what the current state of the art is.

In case it helps, I am solving the complex vector helmholtz equation in 3D with Nedelec elements

That’s relevant information that you must take into account in your literature review.

1 Like

Thanks a lot for your quick feedback! I am going without any advisor on this.

While I will gratefully take any pointer about going further on this subject, my question for now is about how to specify the indicated solver configuration to dolfinx. I suspect it goes somewhat like this:

{"ksp_type": "gmres", "pc_type": "mg"}

but then I do not know how to indicate pre and post smoother as well as the coarse solver type. If it is not possible, that will also be a valuable thing to know.

As DOLFINx uses PETSc4py for solving the problem, you can pass anything into these options than can then be passed to petsc4py and its ksp object. See for instance: PCMG — PETSc 3.20.4 documentation
That being said, to use “mg”, you need to send in extra operators, similar to:
maxwell/solver.py at master · jpdean/maxwell · GitHub

However, we do not have out of the box support for multigrid restriction and prolongation operators.
We hope that we can get some progress on these during this summer’s Google Summer of Code.

1 Like

Hi dokken,

Has there been any recent progress on this during summer?

Yes, there has. Please see @schnellerhase post: Google Summer of Code 2024 - Multigrid for FEniCSx | schnellerhase

1 Like