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

TransfiniteInterpolationManifold: fix codimension one case #13744

Merged
merged 2 commits into from May 17, 2022

Conversation

tamiko
Copy link
Member

@tamiko tamiko commented May 16, 2022

TransfiniteInterpolationManifold: fix codimension one case

The codimension one case currently fails with an assertion:

An error occurred in line <290> of file <source/grid/grid_tools.cc> in function
    std::pair<DerivativeForm<1, dim, spacedim>, Tensor<1, spacedim>> dealii::GridTools::affine_cell_approximation(const ArrayView<const Point<spacedim>> &) [dim = 2, spacedim = 3]
The violated condition was:
    ::dealii::deal_II_exceptions::internals::compare_for_equality(vertices.size(), GeometryInfo<dim>::vertices_per_cell)
Additional information:
    Dimension 9 not equal to 4.

This is triggered because we take a compatibility branch in case of
dim < spacedim (in include/deal.II/fe/mapping_q_internal.h):

908         if (real_support_points.size() ==
909               GeometryInfo<dim>::vertices_per_cell ||
910             dim < spacedim)
911           {

but still initialize the vector unit_points by a subdivided quadrature
(which is needed for the default quadratic approximation; in
source/grid/manifold_lib.cc):

1686   std::vector<Point<dim>> unit_points =
1687     QIterated<dim>(QTrapez<1>(), 2).get_points();
1688   std::vector<Point<spacedim>> real_points(unit_points.size());

Fix this by simply initializing unit_points with the right number of
interpolation points for the dim < spacedim variant.

Closes: #13734

The codimension one case currently fails with an assertion:
```
An error occurred in line <290> of file <source/grid/grid_tools.cc> in function
    std::pair<DerivativeForm<1, dim, spacedim>, Tensor<1, spacedim>> dealii::GridTools::affine_cell_approximation(const ArrayView<const Point<spacedim>> &) [dim = 2, spacedim = 3]
The violated condition was:
    ::dealii::deal_II_exceptions::internals::compare_for_equality(vertices.size(), GeometryInfo<dim>::vertices_per_cell)
Additional information:
    Dimension 9 not equal to 4.
```
This is triggered because we take a compatibility branch in case of
`dim < spacedim` (in `include/deal.II/fe/mapping_q_internal.h`):
```
908         if (real_support_points.size() ==
909               GeometryInfo<dim>::vertices_per_cell ||
910             dim < spacedim)
911           {
```
but still initialize the vector `unit_points` by a subdivided quadrature
(which is needed for the default quadratic approximation; in
`source/grid/manifold_lib.cc`):
```
1686   std::vector<Point<dim>> unit_points =
1687     QIterated<dim>(QTrapez<1>(), 2).get_points();
1688   std::vector<Point<spacedim>> real_points(unit_points.size());
```

Fix this by simply initializing `unit_points` with the right number of
interpolation points for the `dim < spacedim` variant.
@tamiko
Copy link
Member Author

tamiko commented May 16, 2022

/rebuild

@tamiko tamiko force-pushed the transfinite_fix_codim_one branch from 5de8a5b to 6e0cc72 Compare May 16, 2022 19:13
Copy link
Member

@kronbichler kronbichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the fix.

@kronbichler kronbichler merged commit c64238d into dealii:master May 17, 2022
@tamiko tamiko deleted the transfinite_fix_codim_one branch November 30, 2022 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TransfiniteInterpolationManifold in co-dimension 1
2 participants