[cig-commits] commit 1881 by dannberg to /var/svn/dealii/aspect

dealii.demon at gmail.com dealii.demon at gmail.com
Wed Sep 11 07:59:51 PDT 2013


Revision 1881

add a minimum refinement level as input parameter

U   branches/j-dannberg/include/aspect/simulator.h
U   branches/j-dannberg/source/simulator/core.cc
U   branches/j-dannberg/source/simulator/parameters.cc


http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=1881&peg=1881

Diff:
Modified: branches/j-dannberg/include/aspect/simulator.h
===================================================================
--- branches/j-dannberg/include/aspect/simulator.h	2013-09-11 14:55:19 UTC (rev 1880)
+++ branches/j-dannberg/include/aspect/simulator.h	2013-09-11 14:58:00 UTC (rev 1881)
@@ -200,6 +200,7 @@
         unsigned int                   initial_adaptive_refinement;
         double                         refinement_fraction;
         double                         coarsening_fraction;
+        unsigned int                   min_grid_level;
         std::vector<double>            additional_refinement_times;
         unsigned int                   adaptive_refinement_interval;
         bool                           run_postprocessors_on_initial_refinement;

Modified: branches/j-dannberg/source/simulator/core.cc
===================================================================
--- branches/j-dannberg/source/simulator/core.cc	2013-09-11 14:55:19 UTC (rev 1880)
+++ branches/j-dannberg/source/simulator/core.cc	2013-09-11 14:58:00 UTC (rev 1881)
@@ -858,6 +858,12 @@
            cell != triangulation.end(); ++cell)
         cell->clear_refine_flag ();
 
+    // limit minimum refinement level
+    for (typename Triangulation<dim>::active_cell_iterator
+         cell = triangulation.begin_active(0);
+         cell != triangulation.end_active(parameters.min_grid_level); ++cell)
+      cell->clear_coarsen_flag ();
+
     std::vector<const LinearAlgebra::BlockVector *> x_system (2);
     x_system[0] = &solution;
     x_system[1] = &old_solution;

Modified: branches/j-dannberg/source/simulator/parameters.cc
===================================================================
--- branches/j-dannberg/source/simulator/parameters.cc	2013-09-11 14:55:19 UTC (rev 1880)
+++ branches/j-dannberg/source/simulator/parameters.cc	2013-09-11 14:58:00 UTC (rev 1881)
@@ -335,6 +335,11 @@
                          Patterns::Double(0,1),
                          "The fraction of cells with the smallest error that "
                          "should be flagged for coarsening.");
+      prm.declare_entry ("Minimum refinement level", "0",
+                         Patterns::Integer (0),
+                         "The minimum refinement level each cell should have, "
+                         "and that can not be exceeded by coarsening. "
+                         "Should be higher than Initial global refinement.");
       prm.declare_entry ("Additional refinement times", "",
                          Patterns::List (Patterns::Double(0)),
                          "A list of times so that if the end time of a time step "
@@ -547,11 +552,15 @@
       adaptive_refinement_interval= prm.get_integer ("Time steps between mesh refinement");
       refinement_fraction         = prm.get_double ("Refinement fraction");
       coarsening_fraction         = prm.get_double ("Coarsening fraction");
+      min_grid_level              = prm.get_integer ("Minimum refinement level");
 
       AssertThrow(refinement_fraction >= 0 && coarsening_fraction >= 0,
                   ExcMessage("Refinement/coarsening fractions must be positive."));
       AssertThrow(refinement_fraction+coarsening_fraction <= 1,
                   ExcMessage("Refinement and coarsening fractions must be <= 1."));
+      AssertThrow(min_grid_level <= initial_global_refinement,
+                  ExcMessage("Minimum refinement level must not be larger than "
+                		  "Initial global refinement."));
 
       // extract the list of times at which additional refinement is requested
       // then sort it and convert it to seconds


More information about the CIG-COMMITS mailing list