trilinos / Trilinos

Primary repository for the Trilinos Project
https://trilinos.org/
Other
1.22k stars 569 forks source link

MueLu: PCoarsen factory extension for serendipity element #13546

Open nasseralkmim opened 4 weeks ago

nasseralkmim commented 4 weeks ago

Question

Hi, I would like to try the Pcoarsen factory to create a 2-level hierarchy from a quadratic element to a linear element.

I noticed that Serendipity quad elements were introduced here https://github.com/trilinos/Trilinos/commit/c3b1a94753b3611e3f931a1a1b6e9f026b30ecb8.

But the interface in MueLu apparently is not updated to parse those https://github.com/trilinos/Trilinos/blob/fb58dc8b5611d9606664cebd251de0b8949892ed/packages/muelu/src/Transfers/PCoarsen/MueLu_IntrepidPCoarsenFactory_def.hpp#L180. Not sure if the rest of the PCoarsen factory is capable of supporting those elements.

Some questions:

  1. How to extend the Pcoarsen factory to support serendipity elements? (at least the BasisFactory seems straight forward).
  2. Is there an example of setting up a prolongation operator for transferring elements with two dofs per node? (the QUAD element has one dof per node https://github.com/trilinos/Trilinos/blob/master/packages/intrepid2/src/Discretization/Basis/Intrepid2_HGRAD_QUAD_C2_FEM.hpp , maybe with DerivedClasse?
  3. Is it possible to set up a 2-level hierarchy with PCoarsen prolongation, and as a coarse-level solver another hierarchy with MueLu? I know we can use Teko as a smoother, and we can use MueLu within Teko, so this may be an alternative.

Best regards, Nasser

github-actions[bot] commented 4 weeks ago

Automatic mention of the @trilinos/muelu team

cgcgcg commented 4 weeks ago

Depending on how you build the fine level operator, an alternative approach could be of interest. https://github.com/trilinos/Trilinos/blob/master/packages/panzer/disc-fe/src/Panzer_Interpolation.cpp This idea is to build the prolongator outside of MueLu and then pass it in on preconditioner construction. We use this in MiniEM for higher order https://github.com/trilinos/Trilinos/blob/master/packages/panzer/mini-em/example/BlockPrec/main.cpp

nasseralkmim commented 4 weeks ago

@cgcgcg Thanks, I will look into it.

Do you know anything about the multiple dof per node in intrepid2?

cgcgcg commented 3 weeks ago

@mperego @CamelliaDPG ?

CamelliaDPG commented 3 weeks ago

@nasseralkmim Can you explain why you want multiple dofs per node? Is it that you have multiple variables defined with the same basis? The usual thing for this is to use the single-dof basis multiple times. Intrepid2 would support multiple dofs per node through subclassing, but this seems like a much more complicated approach than just using the single-dof basis multiple times.

nasseralkmim commented 3 weeks ago

@CamelliaDPG I'm doing standard elasticity with multiple translations per node. Single dof basis multiple times seems the way to go in this case. I couldn't find an example of this though, are you aware of it?

In MueLu I need to pass a string with the basis, for example:

<Parameter name="pcoarsen: hi basis" type="string"   value="hgrad_quad_i2"/>
<Parameter name="pcoarsen: lo basis" type="string"   value="hgrad_quad_c1"/>

Then, the PCoarsenFactory instantiates the Intrepid2 basis. For example1:

if (deriv == "hgrad" && el == "quad" && poly == "c") {
  if (degree == 1)
    return rcp(new Intrepid2::Basis_HGRAD_QUAD_C1_FEM<KokkosExecutionSpace, Scalar, Scalar>());
  else
    return rcp(new Intrepid2::Basis_HGRAD_QUAD_Cn_FEM<KokkosExecutionSpace, Scalar, Scalar>(degree, Intrepid2::POINTTYPE_EQUISPACED));

Any idea on how to use single dof basis multiple times?

Footnotes

1 From MueLu_IntrepidPCoarsenFactory_def.hpp

CamelliaDPG commented 3 weeks ago

@nasseralkmim How you manage this will depend on how you're doing your local to global mapping. Are you using the Panzer DofManager? I'm not too familiar with the examples we have, but I do see that there is one at packages/panzer/dof-mgr/example/CartesianScaling/main.cpp which involves a pressure and temperature field both discretized with an H^1 hexahedral basis.

This example doesn't involve MueLu directly; perhaps @cgcgcg can weigh in on whether there's anything special you need to do with MueLu for this case and/or what a good multivariate MueLu examples to imitate would be.

nasseralkmim commented 3 weeks ago

@CamelliaDPG I'm not using panzer::DOFManager. Fine level operator is built in an independent application with custom element and material formulation.

I see the DOF manager is capable of managing multiple dofs per node and it is also used in the function mentioned by @cgcgcg.

The question now is how to integrate this panzer::buildInterpolation interpolation function1 with the Muelu PCoarsenFactory. If it is possible. In MueLu, the interpolation is done with this function2 GenerateLinearCoarsening_pn_kirby_to_p1, but I think it is limited to one dof per node.

Footnotes

1 https://github.com/trilinos/Trilinos/blob/master/packages/panzer/disc-fe/src/Panzer_Interpolation.cpp

2 https://github.com/trilinos/Trilinos/blob/fb58dc8b5611d9606664cebd251de0b8949892ed/packages/muelu/src/Transfers/PCoarsen/MueLu_IntrepidPCoarsenFactory_def.hpp#L546

cgcgcg commented 3 weeks ago

Maybe @csiefer2 can help.

csiefer2 commented 2 weeks ago

IntrepidPCoarsenFactory, as it currently exists, is restricted to nodal single-dof basis functions supported by Intrepid/Intrepid2.