Associating a MappingManifold with a Manifold

17 views
Skip to first unread message

Andreas Kyritsakis

unread,
Nov 12, 2019, 9:37:30 AM11/12/19
to deal.II User Group

Hi,

I want to use a real-to-reference-cell mapping which corresponds to cylindrical symmetry in 2D. In other words, the integration jacobian and the shape function gradients should contain the scale factor of the cylindrical coordinates. I tried to do it with the following code:

  QGauss<2> quadrature_formula(fe.degree + 1);
  CylindricalManifold<2> cyl_man(0);
  MappingManifold<2> mapping;
  auto &data = dynamic_cast< MappingManifold<2>::InternalData &>(*mapping.get_data(update_values | update_gradients | update_JxW_values, quadrature_formula));
  data.manifold = &cyl_man;

but it does not seem to work. I am afraid that this is not the correct way to associate the Manifold object  with the Mapping object, but I can't figure out how it should be done.

Can anyone help?

Best regards,
Andreas

luca.heltai

unread,
Nov 12, 2019, 1:04:04 PM11/12/19
to Deal.II Users
You don’t need to do anything special. Just create a MappingManifold, and pass it where required. The manifold that is used is the one associated to the triangulation. You don’t need to associate it to the Mapping, since the mapping is used on *all* objects of the triangulation, and it will know how to construct the data from the underlying manifold objects.

Best,
Luca.
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/9d0b3e81-6559-4dc9-bc89-0f4a74ec4921%40googlegroups.com.

Andreas Kyritsakis

unread,
Nov 13, 2019, 5:23:37 AM11/13/19
to deal.II User Group
Dear Luca,

Thank you very much for your help. I tried to use your recommendation, but it does not seem to work correctly. My code is:
  
CylindricalManifold<2> cylman(0);
triangulation.set_manifold(numbers::flat_manifold_id, cylman);

QGauss<2> quadrature_formula(fe.degree + 1);
MappingManifold<2> mapping;
FEValues<2> fe_values(mapping, fe, quadrature_formula,  update_values | update_gradients | update_JxW_values);

The fe_values object seems to have nonsense inside. All the shape_gradients are nans and the JxW values are zeros. I also tried to check whether the internaldata of the MappingManifold are correct, but they seem to not be initialized. I printed

auto &data = dynamic_cast< MappingManifold<2>::InternalData &>(*mapping.get_data(update_values | update_gradients | update_JxW_values, quadrature_formula));
std::cout << "MappingManifold manifold location:" << data.manifold << std::endl;
for (auto vol : data.volume_elements)
  std::cout << "volume elements :" << vol << std::endl;

The data.manifold seems to be a NULL while the data.volume_elements is empty. I guess I am not initializing something correctly, but I can't find what. 

Any help would be very much appreciated.

Best regards,
Andreas


> To unsubscribe from this group and stop receiving emails from it, send an email to dea...@googlegroups.com.

luca.heltai

unread,
Nov 16, 2019, 10:55:28 AM11/16/19
to Deal.II Users

> CylindricalManifold<2> cylman(0);
> triangulation.set_manifold(numbers::flat_manifold_id, cylman);

The flat_manifold_id is usually reserved for the flat manifold, and yours is not a flat manifold. Setting the flat manifold to the cylindrical manifold implies

You should set the manifold ids of the cells that you want to deform.

What triangulation are you using? if the Triangulation you are using contains the axis, then the CylindricalManifold is not well posed in the cells that touch or contain the axis, since the cylindrical transformation is not well posed there.

> QGauss<2> quadrature_formula(fe.degree + 1);
> MappingManifold<2> mapping;
> FEValues<2> fe_values(mapping, fe, quadrature_formula, update_values | update_gradients | update_JxW_values);
>
> The fe_values object seems to have nonsense inside.

Have you called fe_values.reinit(cell)?

> All the shape_gradients are nans and the JxW values are zeros. I also tried to check whether the internaldata of the MappingManifold are correct, but they seem to not be initialized.

The internal data is initialized by calls to fe_values.reinit(cell), and it is *not* owned by the mapping, but by the fevalues object. These are not thought to be used directly by the user.

> I guess I am not initializing something correctly, but I can't find what.

Take a look at the way this is used in the tests directory:

tests/mappings/mapping_manifold_*.cc
Reply all
Reply to author
Forward
0 new messages