[deal.ii]mesh import problem

72 views
Skip to first unread message

陈敏

unread,
Jun 7, 2020, 5:02:31 AM6/7/20
to dea...@googlegroups.com
Hi Deal.ii team,

I want to import the mesh file exported by gmsh.

First,I export mymodel.geo file to vtk file in gmsh, automatically,the first line of the vtk is “# vtk DataFile Version 2.0” , so I change it to “ # vtk DataFile Version 3.0”. However, an error is reported as follow:

libc++abi.dylib: terminating with uncaught exception of type dealii::StandardExceptions::ExcMessage:
--------------------------------------------------------
An error occurred in line <286> of file </Applications/deal.II.app/Contents/Resources/spack/src/dealii-v9.1.1/source/grid/grid_in.cc> in function
    void dealii::GridIn<2, 2>::read_vtk(std::istream &) [dim = 2, spacedim = 2]
The violated condition was:
    false
Additional information:
    While reading VTK file, unknown cell type encountered
--------------------------------------------------------


Then, I find out the CELLTYPE of VERTEX is recorded, Consequently, I deleted the point record in CELLS and CELL_TYPES. But there are still errors.

libc++abi.dylib: terminating with uncaught exception of type dealii::StandardExceptions::ExcNotImplemented:
--------------------------------------------------------
An error occurred in line <257> of file </Applications/deal.II.app/Contents/Resources/spack/src/dealii-v9.1.1/source/grid/grid_in.cc> in function
    void dealii::GridIn<2, 2>::read_vtk(std::istream &) [dim = 2, spacedim = 2]
The violated condition was:
    subcelldata.boundary_lines.size() == 0
Additional information:
    You are trying to use functionality in deal.II that is currently not implemented. In many cases, this indicates that there simply didn't appear much of a need for it, or that the author of the original code did not have the time to implement a particular case. If you hit this exception, it is therefore worth the time to look into the code to find out whether you may be able to implement the missing functionality. If you do, please consider providing a patch to the deal.II development sources (see the deal.II website on how to contribute).
--------------------------------------------------------


Other format are not imported successfully, for example, the inp format get the errors as follows:

Exception on processing internal UCD data:

--------------------------------------------------------
An error occurred in line <857> of file </Applications/deal.II.app/Contents/Resources/spack/src/dealii-v9.1.1/source/grid/grid_in.cc> in function
    void dealii::GridIn<2, 2>::read_ucd(std::istream &, const bool) [dim = 2, spacedim = 2]
The violated condition was:
    false
Additional information:
    While creating cell 0, you are referencing a vertex with index 0 but no vertex with this index has been described in the input file.
--------------------------------------------------------

libc++abi.dylib: terminating with uncaught exception of type dealii::StandardExceptions::ExcMessage:
--------------------------------------------------------
An error occurred in line <1064> of file </Applications/deal.II.app/Contents/Resources/spack/src/dealii-v9.1.1/source/grid/grid_in.cc> in function
    void dealii::GridIn<2, 2>::read_abaqus(std::istream &, const bool) [dim = 2, spacedim = 2]
The violated condition was:
    false
Additional information:
    Internal conversion from ABAQUS file to UCD format was unsuccessful. More information is provided in an error message printed above. Are you sure that your ABAQUS mesh file conforms with the requirements listed in the documentation?
--------------------------------------------------------

Could anyone let me known how to import mesh ?

Thank you, 
Chen

陈敏

unread,
Jun 7, 2020, 5:10:42 AM6/7/20
to dea...@googlegroups.com
Sorry to forget upload the files, the original files are here.

陈敏 <hkch...@gmail.com> 于2020年6月7日周日 下午5:02写道:
untitled.geo
untitled.vtk
untitled.inp

Wolfgang Bangerth

unread,
Jul 16, 2020, 7:52:55 PM7/16/20
to dea...@googlegroups.com

Chen,

> I want to import the mesh file exported by gmsh.
> [...]
>
> *Could anyone let me known how to import mesh ?*

First, our apologies for not replying to this issue earlier. These
interactions with other programs are really thorny :-(

I've taken a look at your input VTK file. The first issue is that our reader
in GridIn expects (maybe unreasonably so) that cells are listed before lines
in the CELLS section. This is relatively easy to fix by swapping the lines and
cells in the CELLS and CELL_TYPES section of your input file.

But the more relevant part is that one then runs into the following error:
...........................................
An error occurred in line <2690> of file
</home/bangerth/p/deal.II/1/dealii/source/grid/tria.cc> in function
static void
dealii::internal::TriangulationImplementation::Implementation::create_triangulation(const
std::vector<dealii::Point<dim> >&, const std::vector<dealii::CellData<2> >&,
const dealii::SubCellData&, dealii::Triangulation<2, spacedim>&) [with int
spacedim = 2]
The violated condition was:
line->boundary_id() != numbers::internal_face_boundary_id
Additional information:
The input data for creating a triangulation contained information about a
line with indices 1 and 49 that is described to have boundary indicator 0.
However, this is an internal line not located on the boundary. You cannot
assign a boundary indicator to it.

If this happened at a place where you call
Triangulation::create_triangulation() yourself, you need to check the
SubCellData object you pass to this function.

If this happened in a place where you are reading a mesh from a file, then you
need to investigate why such a line ended up in the input file. A typical case
is a geometry that consisted of multiple parts and for which the mesh
generator program assumes that the interface between two parts is a boundary
when that isn't supposed to be the case, or where the mesh generator simply
assigns 'geometry indicators' to lines at the perimeter of a part that are not
supposed to be interpreted as 'boundary indicators'.
...........................................

The description of the error message already suggests the problem. You need to
somehow convince gmsh to not output information about line segments at all.

Best
W.

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

Richard Schussnig

unread,
Jul 18, 2020, 5:10:22 AM7/18/20
to deal.II User Group
Hi Chen,
I successfully imported gmsh-generated meshes using the .msh file format once:
Try to set the physical ids in gmsh to get the right boundary_id and material_id in dealii and then export as version 2 ascii .msh and untick the box [export all elements]. This was working for dealii v 9.0.1 and might still do!
Good luck & kind regards,
Richard
Reply all
Reply to author
Forward
0 new messages