Issue with neighbor_of_coarser_neighbor function: possible bug in dealii?

23 views
Skip to first unread message

Prashant Mital

unread,
Apr 6, 2015, 7:06:12 PM4/6/15
to dea...@googlegroups.com
I am working on a code that uses local mesh refinement. At one point I need to get the face and subface number of the current cell w.r.t. the neighboring (coarser) cell. The code looks like this: 

else if (cell->neighbor_is_coarser (face_no))

    {

    std::cout << "\nPoint of Failure\n";

    std::cout << face_no

    <<std::endl

  << cell->center()(0)

  << " " << cell->center()(1);


    const std::pair <unsigned int, unsigned int> neighbor_face = cell->neighbor_of_coarser_neighbor (1);

                                                                                   //Do something with neighbor_face

     }


The code compiles fine but when I run it, I get the following error message:

 Point of Failure
1
0.375 0.125
--------------------------------------------------------
An error occurred in line <1543> of file </usr/local/src/deal-branches/rev-8.1/source/grid/tria_accessor.cc> in function
    std::pair<unsigned int, unsigned int> dealii::CellAccessor<2, 2>::neighbor_of_coarser_neighbor(const unsigned int) const [dim = 2, spacedim = 2]
The violated condition was:
    (neighbor) < (GeometryInfo<dim>::faces_per_cell)
The name and call sequence of the exception was:
    ExcIndexRange((neighbor),0,(GeometryInfo<dim>::faces_per_cell))
Additional Information:
Index 1923559720 is not in [0,4[

As you can see, the face_no value is 1 when the neighbor_of_coarser_neghbor function is called, however it shows up as some (presumably junk/garbage) value in the 'Additional Information' section of the exception that is thrown. I tried to hard code the function call with face_no set to 1 and still got the same error. I am really lost as to what is going on here... Please help! 

Prashant Mital

unread,
Apr 6, 2015, 7:08:12 PM4/6/15
to dea...@googlegroups.com
Apologies, I posted the version of the code where the function call is actually made with '1' and not face_no. Still the problem is the same when I use

     const std::pair <unsigned int, unsigned int> neighbor_face = cell->neighbor_of_coarser_neighbor (face_no);


Please help!

Prashant Mital

unread,
Apr 6, 2015, 9:02:42 PM4/6/15
to dea...@googlegroups.com

This is what my grid looks like. The code always fails when 'cell' is pointing to the block marked with a star and face_no = 1 which means that the edge marked red is the interface in question. I am trying to extract the face and subface number of this interface w.r.t the larger cell on the bottom right. 


Prashant Mital

unread,
Apr 6, 2015, 9:06:02 PM4/6/15
to dea...@googlegroups.com
It also appears that the value of face_no in this case stops mattering. That is, the same error is thrown when this function on that particular cell irrespective of what the face_no is. I hardcoded and tried 0,2,3 and all yield the same result. The value passed to the function seems to be some garbage value and I have no idea where it is coming from!
Reply all
Reply to author
Forward
0 new messages