Merging meshes and empty triangulation

93 views
Skip to first unread message

Val G

unread,
Aug 19, 2013, 4:03:22 PM8/19/13
to dea...@googlegroups.com
Hello,
 
I would like to create a mesh containing several  "hyper_cube_with_cylindrical_hole".
I studied tutorial 49 and tried the following:
 
void CellProb::make_grid ()
{
 Triangulation<2> tria1;
 GridGenerator::hyper_cube_with_cylindrical_hole (tria1, 0.25, 1.0);
  
        Triangulation<2> tria3;
 GridGenerator::hyper_cube_with_cylindrical_hole (tria3, 0.25, 1.0);
  GridTools::shift (Point<2>(0,-2), tria3);
 Triangulation<2> triangulation2;
 GridGenerator::merge_triangulations (tria1, tria3, triangulation2);

 mesh_info(triangulation2, "grid-2.eps");
 std::cout << "Number of active cells: "
            << triangulation.n_active_cells()
            << std::endl;
        std::cout << "Total number of cells: "
            << triangulation.n_cells()
            << std::endl;

}
 
but I get the following report:
 
============================ Remaking Makefile.dep
==============debug========= cell.cc  ->  cell.g.o
============================ Linking cell
============================ Running cell
terminate called after throwing an instance of 'dealii::internal::Triangulation::ExcGridHasInvalidCell'
  what():  --------------------------------------------------------
An error occurred in line <1672> of file </usr/local_rwth/sw/deal.II/deal.II-7.3.0/source/grid/tria.cc> in function
    static void dealii::internal::Triangulation::Implementation::create_triangulation(const std::vector<dealii::Point<spacedim, double>, std::allocator<dealii::Point<spacedim, double>>> &, const std::vector<dealii::CellData<2>, std::allocator<dealii::CellData<2>>> &, const dealii::SubCellData &, dealii::Triangulation<2, spacedim> &) [with spacedim = 2]
The violated condition was:
    needed_lines.find(std::make_pair(line_vertices.second, line_vertices.first)) == needed_lines.end()
The name and call sequence of the exception was:
    ExcGridHasInvalidCell(cell)
Additional Information:
Something went wrong when making cell 9. Read the docs and the source code for more information.
--------------------------------------------------------
make: *** [run] Aborted (core dumped)
 
I played around with the shift function but nothing helped.
Is there a function I missed?
 
 
My second question:
 
I tried grid_2 (from tutorial 49) with the simple version of Poisson's equation and I get the following:
 
 
============================ Remaking Makefile.dep
==============debug========= cell.cc  ->  cell.g.o
============================ Linking cell
============================ Running cell
Mesh info:
 dimension: 2
 no. of cells: 224
 boundary indicators: 0(88 times)
 written to grid-2.eps
Number of active cells: 224
Total number of cells: 294
--------------------------------------------------------
An error occurred in line <230> of file </usr/local_rwth/sw/deal.II/deal.II-7.3.0/source/dofs/dof_handler_policy.cc> in function
    static unsigned int dealii::internal::DoFHandler::Policy::Implementation::distribute_dofs(unsigned int, unsigned int, dealii::DoFHandler<dim, spacedim> &) [with dim = 2, spacedim = 2]
The violated condition was:
    tria.n_levels() > 0
The name and call sequence of the exception was:
    ExcMessage("Empty triangulation")
Additional Information:
Empty triangulation
Stacktrace:
-----------
#0  /usr/local_rwth/sw/deal.II/deal.II-7.3.0/lib/libdeal_II.g.so.7.3.0: unsigned int dealii::internal::DoFHandler::Policy::Implementation::distribute_dofs<2, 2>(unsigned int, unsigned int, dealii::DoFHandler<2, 2>&)
#1  /usr/local_rwth/sw/deal.II/deal.II-7.3.0/lib/libdeal_II.g.so.7.3.0: dealii::internal::DoFHandler::Policy::Sequential<2, 2>::distribute_dofs(dealii::DoFHandler<2, 2>&) const
#2  /usr/local_rwth/sw/deal.II/deal.II-7.3.0/lib/libdeal_II.g.so.7.3.0: dealii::DoFHandler<2, 2>::distribute_dofs(dealii::FiniteElement<2, 2> const&)
#3  ./cell: CellProb::setup_system()
#4  ./cell: CellProb::run()
#5  ./cell: main
--------------------------------------------------------
make: *** [run] Aborted (core dumped)
 
Why is the triangulation empty?
I called "triangulation.refine_global (2)" because the documentation says "since it will most likely be repopulated soon by the next refinement process", but it did not help.
 
 
Thank you a lot,
 
Val
 
 

Wolfgang Bangerth

unread,
Aug 31, 2013, 6:16:10 AM8/31/13
to dea...@googlegroups.com, Val G
I can reproduce this. Can you please open a bug report with the issue tracker,
including your small testcase that shows the problem?
Can you send us the code you used? This seems odd. Are you sure you have
associated the dof_handler object with the same triangulation for which you
output the mesh info?

Best
W.

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

Message has been deleted

Daniel Arndt

unread,
Oct 5, 2019, 11:33:09 PM10/5/19
to dea...@googlegroups.com
Erik,

Can you share your code and your mesh with us?

Best,
Daniel

Am Sa., 5. Okt. 2019 um 20:30 Uhr schrieb Erik Fujiyama <erikfu...@gmail.com>:
Hello, I think I'm having a similar problem to the OP. I searched a lot, but that's the closest that I could find. I'm trying to work with some meshes from gmsh, so I used the gridin functions to read them. 

  Triangulation<dim> triangulation;
  GridIn<dim> gridin;
  gridin.attach_triangulation(triangulation);
  std::ifstream f("plate4");
  gridin.read_msh(f);

The mesh was generated with the physical lines and physical surfaces as mentioned in step 49.

I even tested if it was actually reading by printing the number of active elements, and it is.

However, when I'm going to distribute the dofs, it gives this message

An error occurred in line <999> of file </home/erik/Downloads/dealii-9.0.1/source/dofs/dof_handler.cc> in function
    void dealii::DoFHandler<dim, spacedim>::distribute_dofs(const dealii::FiniteElement<dim, spacedim>&) [with int dim = 2; int spacedim = 2]
The violated condition was: 
    tria->n_levels() > 0
Additional information: 
    The Triangulation you are using is empty!


There's some problem that for some reason the information is lost in the next function when I call

  dof_handler.distribute_dofs (fe);

I double checked, and the DoF_handler is already associated with the triangulation

fe (FE_Q<dim>(order), dim),
  dof_handler (triangulation),

It is specially confusing to me, because if I generate a grid with the grid generator, it works perfectly fine. 

Respectfully
E.

--
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/c55e8e0d-02f0-4647-b767-c37d3903a343%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages