[cig-commits] [commit] master: add some comments and remove the maximum grid level input parameter from the tag_additional_cells function (6c171b2)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Tue May 20 07:34:48 PDT 2014


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/426fbfcad3568313f61490f77127c5e1c97a005d...a871ef437febf4fd67ce6f1ff7349b8a57987c8a

>---------------------------------------------------------------

commit 6c171b23418eff17a1c69639c0587f9c396f601d
Author: Juliane Dannberg <dannberg at gfz-potsdam.de>
Date:   Tue May 20 04:46:55 2014 +0200

    add some comments and remove the maximum grid level input parameter from the tag_additional_cells function


>---------------------------------------------------------------

6c171b23418eff17a1c69639c0587f9c396f601d
 include/aspect/mesh_refinement/interface.h         | 13 +++++------
 .../mesh_refinement/minimum_refinement_function.h  |  4 +---
 include/aspect/simulator.h                         |  6 +++++
 source/mesh_refinement/interface.cc                |  6 ++---
 .../mesh_refinement/minimum_refinement_function.cc | 27 +++++++++++++---------
 source/simulator/core.cc                           |  2 +-
 6 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/include/aspect/mesh_refinement/interface.h b/include/aspect/mesh_refinement/interface.h
index 81b5f46..0ae8291 100644
--- a/include/aspect/mesh_refinement/interface.h
+++ b/include/aspect/mesh_refinement/interface.h
@@ -73,7 +73,8 @@ namespace aspect
         ~Interface ();
 
         /**
-         * Execute this mesh refinement criterion.
+         * Execute this mesh refinement criterion. The default implementation
+         * sets all the error indicators to zero.
          *
          * @param[out] error_indicators A vector that for every active cell of
          * the current mesh (which may be a partition of a distributed mesh)
@@ -86,14 +87,12 @@ namespace aspect
 
         /**
          * After cells have been marked for coarsening/refinement, apply
-         * additional criteria independent of the error estimate.
-         *
-         * @param[in] max_grid_level The maximum refinement level of the
-         * mesh
+         * additional criteria independent of the error estimate. The
+         * default implementation does nothing.
          */
         virtual
         void
-        tag_additional_cells (unsigned int max_grid_level) const;
+        tag_additional_cells () const;
       
         /**
          * Declare the parameters this class takes through input files.
@@ -171,7 +170,7 @@ namespace aspect
          */
         virtual
         void
-        tag_additional_cells (unsigned int max_grid_level) const;
+        tag_additional_cells () const;
 
         /**
          * Declare the parameters of all known mesh refinement plugins, as
diff --git a/include/aspect/mesh_refinement/minimum_refinement_function.h b/include/aspect/mesh_refinement/minimum_refinement_function.h
index 21f645f..963c603 100644
--- a/include/aspect/mesh_refinement/minimum_refinement_function.h
+++ b/include/aspect/mesh_refinement/minimum_refinement_function.h
@@ -49,12 +49,10 @@ namespace aspect
          * After cells have been marked for coarsening/refinement, apply
          * additional criteria independent of the error estimate.
          *
-         * @param[in] max_grid_level The maximum refinement level of the
-         * mesh
          */
         virtual
         void
-        tag_additional_cells (unsigned int max_grid_level) const;
+        tag_additional_cells () const;
 
         /**
          * Declare the parameters this class takes through input files.
diff --git a/include/aspect/simulator.h b/include/aspect/simulator.h
index 235ac13..cfaa325 100644
--- a/include/aspect/simulator.h
+++ b/include/aspect/simulator.h
@@ -573,6 +573,12 @@ namespace aspect
        * on this new mesh, and interpolate the old solutions onto the new
        * mesh.
        *
+       * @param[in] max_grid_level The maximum refinement level of the
+       * mesh. This is the sum of the initial global refinement and the
+       * initial adaptive refinement (as provided by the user in the input
+       * file) and in addition it gets increased by one at each additional
+       * refinement time.
+       *
        * This function is implemented in
        * <code>source/simulator/core.cc</code>.
        */
diff --git a/source/mesh_refinement/interface.cc b/source/mesh_refinement/interface.cc
index f2d653f..e56a60a 100644
--- a/source/mesh_refinement/interface.cc
+++ b/source/mesh_refinement/interface.cc
@@ -48,7 +48,7 @@ namespace aspect
 
     template <int dim>
     void
-    Interface<dim>::tag_additional_cells (unsigned int) const
+    Interface<dim>::tag_additional_cells () const
     {}
 
 
@@ -213,7 +213,7 @@ namespace aspect
 
     template <int dim>
     void
-    Manager<dim>::tag_additional_cells (unsigned int max_grid_level) const
+    Manager<dim>::tag_additional_cells () const
     {
       Assert (mesh_refinement_objects.size() > 0, ExcInternalError());
 
@@ -226,7 +226,7 @@ namespace aspect
         {
           try
             {
-              (*p)->tag_additional_cells (max_grid_level);
+              (*p)->tag_additional_cells ();
             }
 
           // plugins that throw exceptions usually do not result in
diff --git a/source/mesh_refinement/minimum_refinement_function.cc b/source/mesh_refinement/minimum_refinement_function.cc
index 0ba2180..532e279 100644
--- a/source/mesh_refinement/minimum_refinement_function.cc
+++ b/source/mesh_refinement/minimum_refinement_function.cc
@@ -31,7 +31,7 @@ namespace aspect
   {
     template <int dim>
     void
-    MinimumRefinementFunction<dim>::tag_additional_cells (unsigned int max_grid_level) const
+    MinimumRefinementFunction<dim>::tag_additional_cells () const
     {
       // evaluate a single point per cell
       const QMidpoint<dim> quadrature_formula;
@@ -44,20 +44,18 @@ namespace aspect
                                update_quadrature_points );
 
       // ensure minimum refinement level
-      const unsigned int max_level = std::min(max_grid_level+1,this->get_triangulation().n_levels());
-      for (unsigned int level=0; level < max_level;++level)
-        for (typename Triangulation<dim>::active_cell_iterator
-             cell = this->get_triangulation().begin_active(level);
-             cell != this->get_triangulation().end_active(level); ++cell)
+      for (typename Triangulation<dim>::active_cell_iterator
+           cell = this->get_triangulation().begin_active();
+           cell != this->get_triangulation().end(); ++cell)
         {
           if (cell->is_locally_owned())
           {
         	fe_values.reinit(cell);
         	const double depth = this->get_geometry_model().depth(fe_values.quadrature_point(0));
         	const Point<1> point(depth);
-          	if (level <= std::rint(min_refinement_level.value(point)))
+          	if (cell->level() <= std::rint(min_refinement_level.value(point)))
               cell->clear_coarsen_flag ();
-          	if (level <  std::rint(min_refinement_level.value(point)))
+          	if (cell->level() <  std::rint(min_refinement_level.value(point)))
               cell->set_refine_flag ();
           }
         }
@@ -70,11 +68,16 @@ namespace aspect
     {
       prm.enter_subsection("Mesh refinement");
       {
+
         prm.enter_subsection("Minimum refinement function");
         {
+          /**
+           * Let the function that describes the minimal level of refinement
+           * as a function of depth declare its parameters.
+           * This defines the minimum refinement level each cell should have,
+           * and that can not be exceeded by coarsening.
+           */
           Functions::ParsedFunction<1>::declare_parameters (prm, 1);
-          /*               "The minimum refinement level each cell should have, "
-                           "and that can not be exceeded by coarsening. " */
         }
         prm.leave_subsection();
       }
@@ -107,6 +110,8 @@ namespace aspect
                                               "minimum refinement function",
                                               "A mesh refinement criterion that ensures a "
                                               "minimum refinement level described by an "
-                                              "explicit formula with the depth as argument.")
+                                              "explicit formula with the depth as argument. "
+                                              "After reading in the function, its values are "
+                                              "rounded to the nearest integer. ")
   }
 }
diff --git a/source/simulator/core.cc b/source/simulator/core.cc
index 1322804..7da6210 100644
--- a/source/simulator/core.cc
+++ b/source/simulator/core.cc
@@ -998,7 +998,7 @@ namespace aspect
                                        parameters.refinement_fraction,
                                        parameters.coarsening_fraction);
 
-    mesh_refinement_manager.tag_additional_cells (max_grid_level);
+    mesh_refinement_manager.tag_additional_cells ();
     
     
     // limit maximum refinement level



More information about the CIG-COMMITS mailing list