Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MueLu: PCoarsen factory extension for serendipity element #13546

Open
nasseralkmim opened this issue Oct 24, 2024 · 10 comments
Open

MueLu: PCoarsen factory extension for serendipity element #13546

nasseralkmim opened this issue Oct 24, 2024 · 10 comments

Comments

@nasseralkmim
Copy link

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

Copy link

Automatic mention of the @trilinos/muelu team

@cgcgcg
Copy link
Contributor

cgcgcg commented Oct 24, 2024

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
Copy link
Author

@cgcgcg Thanks, I will look into it.

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

@cgcgcg
Copy link
Contributor

cgcgcg commented Oct 28, 2024

@mperego @CamelliaDPG ?

@CamelliaDPG
Copy link
Contributor

@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
Copy link
Author

@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
Copy link
Contributor

@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
Copy link
Author

@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

void IntrepidPCoarsenFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::GenerateLinearCoarsening_pn_kirby_to_p1(const LOFieldContainer &hi_elemToNode,

@cgcgcg
Copy link
Contributor

cgcgcg commented Oct 31, 2024

Maybe @csiefer2 can help.

@csiefer2
Copy link
Member

csiefer2 commented Nov 5, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants