# AMG preconditioning with physically distinct entities

(This topic came up before in https:/

This came up when solving a complex-valued problem with Dolfin. As is known, Dolfin doesn't support complex scalars, so the problem has to be converted into a real-imaginary formulation first. What comes out of this is a 2x2-block matrix (meaning that the matrix is made up from tiny little 2x2 blocks). Those type of block matrices come up whenever there are multidimensional entities living on the vertices (e.g., vectors).

What geometric multigrid naturally avoids is a mixing of the values of any of those separate entities, and AMG typically wants to do the same thing. Trilinos' ML has the option "PDE equations" for this; not sure about PETSc.

I suppose the easiest way to address this is would be to expose that option to the user.

I suppose it would also be possible to have this parameter automatically set by determining the (geometric) dimension of the space of test/trial functions.

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- DOLFIN Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Nico Schlömer

- Solved:
- 2013-03-23

- Last query:
- 2013-03-23

- Last reply:
- 2013-03-23

Jan Blechta (blechta) said : | #1 |

is this what are you searching for?

virtual void GenericPrecondi

Garth Wells (garth-wells) said : | #2 |

On 22 March 2013 06:06, Nico Schlömer

<email address hidden> wrote:

> New question #224865 on DOLFIN:

> https:/

>

> (This topic came up before in https:/

>

> This came up when solving a complex-valued problem with Dolfin. As is known, Dolfin doesn't support complex scalars, so the problem has to be converted into a real-imaginary formulation first. What comes out of this is a 2x2-block matrix (meaning that the matrix is made up from tiny little 2x2 blocks). Those type of block matrices come up whenever there are multidimensional entities living on the vertices (e.g., vectors).

>

> What geometric multigrid naturally avoids is a mixing of the values of any of those separate entities, and AMG typically wants to do the same thing. Trilinos' ML has the option "PDE equations" for this; not sure about PETSc.

>

I added some magic to DofMap a week or two ago to preserve blocks. I

tested it for elasticity. It needs to be checked for other equations.

Look in DofMap for a function called something like

compute_block_size.

> I suppose the easiest way to address this is would be to expose that option to the user.

>

You can pass a Teuchos:

be polished.

> I suppose it would also be possible to have this parameter automatically set by determining the (geometric) dimension of the space of test/trial functions.

>

Via PETSc, if the dofmap is blocked then this is set in the PETSc

matrix. I believe that PETSc passes this block info to ML. It

dramatically reduced to cost of the preconditioner construction.

You'll need to set the nullspace for ML. There are some handy

functions for this in DofMap.

I'll add a demo soon that uses smoothed aggregation AMG with setting

of the nullspace, block size, etc.

Garth

> --

> You received this question notification because you are a member of

> DOLFIN Team, which is an answer contact for DOLFIN.

Nico Schlömer (nschloe) said : | #3 |

> You can pass a Teuchos:

Found that, thanks! I was able to cut the number of Krylov iterations in half, in some cases even better, by setting "PDE equations" to 2.

> I added some magic to DofMap a week or two ago to preserve blocks. I tested it for elasticity. It needs to be checked for other equations.

I checked with my "complex-valued" problem, block size 2, and it's working well.

> I'll add a demo soon that uses smoothed aggregation AMG with setting of the nullspace, block size, etc.

That'd be perfect.