Mesh coarsening fails on periodic triangulation

25 views
Skip to first unread message

M Graham

unread,
Jul 14, 2022, 9:15:05 AM7/14/22
to deal.II User Group
** Please ignore delete my first post that went out without a subject **

Hallo everyone,
I'm very happy to be starting my first project with deal.II and hope to possibly contribute to it.  I am working on a diffusion homogenisation problem with periodic boundary conditions.

I have implemented the periodic boundary conditions with the following lines 

a) in setup system
  std::vector<
    GridTools::PeriodicFacePair<typename DoFHandler<dim,dim>::cell_iterator>>
    periodicity_vector;
 
  std::vector<unsigned int> masters {{0,2,4}}; // the periodic faces which will be duplicated
  std::vector<unsigned int> slaves {{1,3,5}}; // where they will be duplicated
 
  for (unsigned int d=0; d<dim; d++)
  {
    GridTools::collect_periodic_faces(dof_handler,
                                      masters[d],
                                      slaves[d],
                                      d,
                                      periodicity_vector );  
  }
                                     
  DoFTools::make_periodicity_constraints<dim, dim, double_t>(periodicity_vector,
                                                 constraints );

                                                
but also immediately after grid generation (which makes me wonder now why I duplicated that effort):

          std::vector<GridTools::PeriodicFacePair<
            typename  Triangulation<dim>::cell_iterator>>
          periodicity_vector;
          std::vector<unsigned int> masters {{0,2,4}};
          std::vector<unsigned int> slaves {{1,3,5}};
         
          for (unsigned int d=0; d<dim; d++)
            GridTools::collect_periodic_faces(tria,
                                              masters[d],
                                              slaves[d],
                                              d,
                                              periodicity_vector );
          tria.add_periodicity(periodicity_vector);          
  


But I get the following error :

An error occurred in line <743> of file <./source/grid/tria.cc> in function
    void dealii::{anonymous}::update_periodic_face_map_recursively(const typename dealii::Triangulation<dim, spacedim>::cell_iterator&, const typename dealii::Triangulation<dim, spacedim>::cell_iterator&, unsigned int, unsigned int, const std::bitset<3>&, std::map<std::pair<typename dealii::Triangulation<dim, spacedim>::cell_iterator, unsigned int>, std::pair<std::pair<typename dealii::Triangulation<dim, spacedim>::cell_iterator, unsigned int>, std::bitset<3> > >&) [with int dim = 3; int spacedim = 3; typename dealii::Triangulation<dim, spacedim>::cell_iterator = dealii::TriaIterator<dealii::CellAccessor<3, 3> >]
The violated condition was:
    dim == 1 || std::abs(cell_1->level() - cell_2->level()) < 2

which I am fairly sure is related to coarsening on the periodic domain.  It's related to coarsening because it disappears when I disable coarsening. The link to the periodic domain is because of the stacktrace:

Stacktrace:
-----------
#0  /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.4.0:
#1  /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.4.0:
#2  /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.4.0:
#3  /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.4.0:
#4  /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.4.0:
#5  /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.4.0:
#6  /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.4.0: dealii::Triangulation<3, 3>::update_periodic_face_map()
#7  /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.4.0: dealii::Triangulation<3, 3>::execute_coarsening_and_refinement()
#8  ./homodiff2: HomDiff<3>::refine_grid()
#9  ./homodiff2: HomDiff<3>::run(unsigned int, double)
#10  ./homodiff2: main


So I will be digging in to this now but I thought it might be worth posting here because
  • I might have missed some critical information
  • This might be a known problem
  • Maybe somebody else will have the same problem in the meantime and it will be good to gather information.
Any tips on where to look are welcome.


Best regards,

Marc

Wolfgang Bangerth

unread,
Jul 14, 2022, 1:02:52 PM7/14/22
to dea...@googlegroups.com
On 7/14/22 07:15, M Graham wrote:
>
> So I will be digging in to this now but I thought it might be worth posting
> here because
>
> * I might have missed some critical information
> * This might be a known problem
> * Maybe somebody else will have the same problem in the meantime and it will
> be good to gather information.
>
> Any tips on where to look are welcome.

Marc:
the usual advice applies: Shrink your program to the smallest possible one,
removing everything that is not necessary to show the problem -- generating
output, solving linear systems, assembling linear systems, everything you can
remove should be removed one by one. This approach makes it so much easier to
see what the real problem is.

Best
W>


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

Reply all
Reply to author
Forward
0 new messages