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

Add new Mapping based on agglomerates #133

Merged
merged 4 commits into from
Sep 29, 2024
Merged

Add new Mapping based on agglomerates #133

merged 4 commits into from
Sep 29, 2024

Conversation

fdrmrc
Copy link
Owner

@fdrmrc fdrmrc commented Sep 16, 2024

So far, we have been using a MappingFEField machinery which required the definition of an auxiliary DoFHandler and an Eulerian vector describing the vertices of boxes associated with agglomerates. After this setup, this mapping was given to FEValues-like objects with properly scaled quadrature weights and normals since our weights and normals were already in real space. This was rather unfortunate and was explained in #58 (comment)


This PR depends on #132. First relevant commit is 1869db1.

It provides a new MappingBox class responsible for mappings associated with the bounding box of agglomerates and aware of the fact that we are in real space. It describes the affine transformation $F(\hat{x}) = J\hat{x} + c$ from reference space to the (real) bounding box. In this case $J$ is diagonal with entries $h_x,h_y,h_z$.
It is very close to what MappingCartesian does but it considers the fact that quantities such as weights and normals must not be scaled in our case, as they are collected from real space.

Its construction requires only the vector of local BoundingBox<dim> objects and a map which translates from the (master) cell index to the associated box index (which coincides with the polytope index). We can then construct FEValues-like objects with such a MappingBox object.

This approach completely removes the need for the mentioned MappingFEField and allows removing all the tricks with scaling factors that we had to do before. This is clear by looking at changes in source/agglomeration_handler.cc.

@luca-heltai What do you think? The performance gain with this new design is quite large:

Wall-clock time to assemble DG stiffness matrix

  • Size of original tria: 98304
  • N polytopes: 100
  • Simplex mesh

$$ \begin{aligned} & \text {Wall-clock time [s] for assemble system()}\\ &\begin{array}{cccc} \hline \hline \text { Degree } & \text { Before this PR } & \text { This PR } \\ \hline 1 & 11.23 & 0.618 \\ 2 & 17.68 & 2.98 \\ 3 & 40.04 & 22.06 \\ \hline \end{array} \end{aligned} $$

@fdrmrc fdrmrc added enhancement New feature or request design Related to code design labels Sep 16, 2024
@fdrmrc fdrmrc requested a review from luca-heltai September 16, 2024 15:30
@fdrmrc
Copy link
Owner Author

fdrmrc commented Sep 16, 2024

The failing test will be fixed in #134

@fdrmrc fdrmrc marked this pull request as ready for review September 29, 2024 11:57
@fdrmrc fdrmrc merged commit c7859af into main Sep 29, 2024
1 of 3 checks passed
@luca-heltai luca-heltai deleted the add_mapping_box branch November 21, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Related to code design enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant