problem with merge triangulation in codim one

38 views
Skip to first unread message

nicola giuliani

unread,
Dec 2, 2015, 5:34:58 AM12/2/15
to deal.II User Group
Dear all,

I need to build a codim-one mesh consisting of two parallel planes. The planes needs to be on the x,z plane and split along the y coordinate. This is the code I am using 

  Triangulation<2,3> triangulation1, triangulation, triangulation2;
  Point<3> P1(-1,0,-1), P2(1,0,1), P3(-1,-1,-1), P4(1,-1,1);

  std::vector<unsigned int> repetitions(2);
  repetitions[0]=2;
  repetitions[1]=2;

  GridGenerator::subdivided_hyper_rectangle(triangulation1,repetitions, P3, P4);
  GridGenerator::subdivided_hyper_rectangle(triangulation2,repetitions, P1, P2);
  GridGenerator::merge_triangulations(triangulation1, triangulation2, triangulation);

And I get

An error occurred in line <406> of file </Users/nicolagiuliani/dealii/source/grid/grid_reordering.cc> in function

    void dealii::internal::GridReordering2d::GridReordering::build_graph(const std::vector<CellData<2> > &)

The violated condition was: 

    false

The name and call sequence of the exception was:

    ExcInternalError()

Additional Information: 

This exception -- which is used in many places in the library -- usually indicates that some condition which the author of the code thought must be satisfied at a certain point in an algorithm, is not fulfilled. An example would be that the first part of an algorithm sorts elements of an array in ascending order, and a second part of the algorithm later encounters an an element that is not larger than the previous one.


There is usually not very much you can do if you encounter such an exception since it indicates an error in deal.II, not in your own program. Try to come up with the smallest possible program that still demonstrates the error and contact the deal.II mailing lists with it to obtain help.



I have noted that instead if I try the following

  Triangulation<2,3> triangulation1, triangulation, triangulation2;
  Point<3> P1(-1,-1,0), P2(1,1,0), P3(-1,-1,-1), P4(1,1,-1);

  std::vector<unsigned int> repetitions(2);
  repetitions[0]=2;
  repetitions[1]=2;

  GridGenerator::subdivided_hyper_rectangle(triangulation1,repetitions, P3, P4);
  GridGenerator::subdivided_hyper_rectangle(triangulation2,repetitions, P1, P2);
  GridGenerator::merge_triangulations(triangulation1, triangulation2, triangulation);

It works just fine as expected. Do you have any idea about what's going on?

Bests,
Nicola

nicola giuliani

unread,
Dec 2, 2015, 5:45:56 AM12/2/15
to deal.II User Group
Actually the problems appears to be GridGenerator::subdivided_hyper_rectangle when using the first set of points.

Nicola

nicola giuliani

unread,
Dec 2, 2015, 5:55:32 AM12/2/15
to deal.II User Group
I've seen now the last part of the documentation, all this is expected since the last argument of p2 is ignored. So the real question is, do you have any suggestions on how to overcome such a problem?

Nicola

Timo Heister

unread,
Dec 2, 2015, 1:41:46 PM12/2/15
to dea...@googlegroups.com
I had to look at the code of subdivided_hyper_rectangle() to figure
this out, but for dim=2 and spacedim=3, the hyper_rectangle will
generate the mesh along the first 2 axes (x and y) and not (what you
are hoping for) along x and z. The code is missing some error checks
and documentation.

One thing you can do is create it along x,y and then use
GridTools::transform() to rotate it.
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.



--
Timo Heister
http://www.math.clemson.edu/~heister/

Timo Heister

unread,
Dec 2, 2015, 2:56:11 PM12/2/15
to dea...@googlegroups.com
Nicola,

can you please take a look at the documentation changes I did here

https://github.com/dealii/dealii/pull/1936

and tell me if that makes more sense to you now?

nicola giuliani

unread,
Dec 9, 2015, 8:07:17 AM12/9/15
to deal.II User Group
Timo,

sorry for the late answer.

Yes it makes more sense now. Actually, as you and Wolfgang pointed out in the discussion, the Point<spacedim> thing was a little misleading. Thank you very much for the suggestion for the grid rotations.

Bests,
Nicola
Reply all
Reply to author
Forward
0 new messages