Error GridIn::read_msh(), mesh with multiple transfinite regions

38 views
Skip to first unread message

Matteo Malvestiti

unread,
Oct 15, 2024, 8:31:55 AM10/15/24
to deal.II User Group
[Errata corrige]
Hello everyone.
I'm getting an error when importing msh files in deal.II with GridIn::read_msh().

For the sake of simplicity I brought a very basic grid:
- Rectangle 2x1
- Divided in two squares 1x1, both uniformly meshed, transfinite, with different granularity

When I import it in deal.II with:
const std::string filename = "mesh.msh";
std::ifstream input_file(filename);
Triangulation<2> triangulation;
GridIn<2> grid_in;
grid_in.attach_triangulation(triangulation);
grid_in.read_msh(input_file);

I experience this error:

terminate called after throwing an instance of 'dealii::StandardExceptions::ExcMessage'
  what():  
--------------------------------------------------------
An error occurred in line <2594> of file </usr/src/dealii-v9.5.0/source/grid/tria.cc> in function
    static void dealii::internal::TriangulationImplementation::Implementation::process_subcelldata(const dealii::internal::TriangulationImplementation::CRS<T>&, dealii::internal::TriangulationImplementation::TriaObjects&, const std::vector<dealii::CellData<dim> >&, const std::vector<dealii::Point<spacedim> >&) [with int structdim = 1; int spacedim = 2; T = unsigned int]
The violated condition was:
    boundary_id != numbers::internal_face_boundary_id
Additional information:
    The input arguments for creating a triangulation specified a boundary
    id for an internal face. This is not allowed.
   
    The object in question has vertex indices 1,40, which are located at
    positions (1 0)(1 0.25).


Of course, I defined as physical curves only two edges at the boundary.

Can anybody help me to fix the issue please?
I attach the simple script to reproduce the error, together with the .geo and .msh files, as well as the CMakeLists to compile the code.

Thanks in advance.



Ticket-error-read_msh.zip

Praveen C

unread,
Oct 15, 2024, 10:27:00 AM10/15/24
to Deal. II Googlegroup
It is because you have not set ids for all boundary faces. Add this and try

Physical Curve("others", 3) = {2,4,5,6};

best
praveen

--
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/69854a0c-5be6-40db-8919-48c736d64baen%40googlegroups.com.
<Ticket-error-read_msh.zip>

Matteo Malvestiti

unread,
Oct 15, 2024, 10:48:03 AM10/15/24
to deal.II User Group
Hi, thanks for your time.

I implemented the suggested fix, but unfortunately it didn't change anything.
Still get the error:

terminate called after throwing an instance of 'dealii::StandardExceptions::ExcMessage'
  what():  
--------------------------------------------------------
An error occurred in line <2594> of file </usr/src/dealii-v9.5.0/source/grid/tria.cc> in function
    static void dealii::internal::TriangulationImplementation::Implementation::process_subcelldata(const dealii::internal::TriangulationImplementation::CRS<T>&, dealii::internal::TriangulationImplementation::TriaObjects&, const std::vector<dealii::CellData<dim> >&, const std::vector<dealii::Point<spacedim> >&) [with int structdim = 1; int spacedim = 2; T = unsigned int]
The violated condition was:
    boundary_id != numbers::internal_face_boundary_id
Additional information:
    The input arguments for creating a triangulation specified a boundary
    id for an internal face. This is not allowed.
   
    The object in question has vertex indices 1,40, which are located at
    positions (1 0)(1 0.25).


Wolfgang Bangerth

unread,
Oct 15, 2024, 10:53:25 AM10/15/24
to dea...@googlegroups.com
On 10/15/24 08:48, Matteo Malvestiti wrote:
>     The input arguments for creating a triangulation specified a boundary
>     id for an internal face. This is not allowed.
>
>     The object in question has vertex indices 1,40, which are located at
>     positions (1 0)(1 0.25).

If you read through the .msh file, is the error message a true statement? That
is, is there an edge in the input file for these vertices that indeed has an
attached boundary id? If so, you need to figure out how to tell gmsh not to
put one there.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Praveen C

unread,
Oct 15, 2024, 11:17:39 AM10/15/24
to Deal. II Googlegroup
The original mesh did have ids on interior edges.

You need to set physical tags to all boundary edges and to cells also.

Use attached filed and make sure to actually regenerate the mesh.

best
praveen

mesh.geo

Matteo Malvestiti

unread,
Oct 15, 2024, 11:27:10 AM10/15/24
to deal.II User Group
THANKS !
Actually what saved me was your " make sure to actually regenerate the mesh"
Because I had previously tried to add the physical curves after your first message.

Thanks a lot, for real.

Should I delete/close the discussion somehow?
I'm sorry, it's my first time.

Best,
Matteo

Wolfgang Bangerth

unread,
Oct 15, 2024, 11:41:00 AM10/15/24
to dea...@googlegroups.com
On 10/15/24 09:27, Matteo Malvestiti wrote:
>
> Should I delete/close the discussion somehow?
> I'm sorry, it's my first time.

Leave it in place -- it's a resource that may be useful to others as well!
Reply all
Reply to author
Forward
0 new messages