]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added warning for unsuccessful case in GridTools::collect_periodic_faces 3649/head
authorJean-Paul Pelteret <jppelteret@gmail.com>
Wed, 30 Nov 2016 16:10:14 +0000 (17:10 +0100)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Wed, 30 Nov 2016 16:50:07 +0000 (17:50 +0100)
A note and assert has been added to provide a warning for the case where
collect_periodic_faces doesn't find any matched faces. This may happen
if there is no colouring on the coarsest level mesh (i.e. grid
refinement before boundary id definition) or where they've accidentally
called the function with the wrong boundary id's (or direction?).

Fixes #3280

include/deal.II/grid/grid_tools.h
source/grid/grid_tools.cc

index 786b1a24e3dd95fb37c2d8c1696e7941a13bfa5c..6b4ed1ab68c20e46148f038af746e01bafaa8ece 100644 (file)
@@ -1434,6 +1434,12 @@ namespace GridTools
    * times with different boundary ids to generate a vector with all periodic
    * pairs.
    *
+   * @note Since the periodic face pairs are found on the coarsest mesh level,
+   * it is necessary to ensure that the coarsest level faces have the correct
+   * boundary indicators set. In general, this means that one must first set
+   * all boundary indicators on the coarse grid before performing any global
+   * or local grid refinement.
+   *
    * @author Daniel Arndt, Matthias Maier, 2013 - 2015
    */
   template <typename MeshType>
index 7d09959df7447c8abfdddaf358c7060e026cece2..86be8b5e310db322428991399d5bcc6542eb4084 100644 (file)
@@ -3742,6 +3742,11 @@ next_cell:
     Assert (pairs1.size() == pairs2.size(),
             ExcMessage ("Unmatched faces on periodic boundaries"));
 
+    Assert (pairs1.size() > 0,
+            ExcMessage("No new periodic face pairs have been found. "
+                       "Are you sure that you've selected the correct boundary "
+                       "id's and that the coarsest level mesh is colorized?"));
+
     // and call match_periodic_face_pairs that does the actual matching:
     match_periodic_face_pairs(pairs1, pairs2, direction, matched_pairs, offset,
                               matrix);
@@ -3799,6 +3804,10 @@ next_cell:
     Assert (pairs1.size() == pairs2.size(),
             ExcMessage ("Unmatched faces on periodic boundaries"));
 
+    Assert (pairs1.size() > 0,
+            ExcMessage("No new periodic face pairs have been found. "
+                       "Are you sure that you've selected the correct boundary "
+                       "id's and that the coarsest level mesh is colorized?"));
 
 #ifdef DEBUG
     const unsigned int size_old = matched_pairs.size();

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.