[cig-commits] commit 2417 by heister to /var/svn/dealii/aspect

dealii.demon at gmail.com dealii.demon at gmail.com
Mon Apr 7 11:53:03 PDT 2014


Revision 2417

add the option to subdivide the box geometry

U   trunk/aspect/TODO
U   trunk/aspect/doc/modules/changes.h
U   trunk/aspect/include/aspect/geometry_model/box.h
U   trunk/aspect/source/geometry_model/box.cc


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

Diff:
Modified: trunk/aspect/TODO
===================================================================
--- trunk/aspect/TODO	2014-04-07 15:19:22 UTC (rev 2416)
+++ trunk/aspect/TODO	2014-04-07 18:53:01 UTC (rev 2417)
@@ -15,7 +15,6 @@
 
 Topics for preview release:
 ---------------------------
-- provide the possibility of subdividing the box geometry
 - unify readme.html in aspect/ and from the webpage again
 - make run-time parameters lower-case in the .prm file
 - temperature equation must contain adiabatic terms in the compressible case

Modified: trunk/aspect/doc/modules/changes.h
===================================================================
--- trunk/aspect/doc/modules/changes.h	2014-04-07 15:19:22 UTC (rev 2416)
+++ trunk/aspect/doc/modules/changes.h	2014-04-07 18:53:01 UTC (rev 2417)
@@ -8,6 +8,11 @@
 </p>
 
 <ol>
+  <li>New: The box geometry allows you to specify a repetition
+  argument in each coordinate direction.
+  <br>
+  (Timo Heister, 2014/04/07)
+
   <li>New: On startup, ASPECT now prints out whether it is
   running in debug or optimized mode. This is now part of a general
   status message at the top of every run.

Modified: trunk/aspect/include/aspect/geometry_model/box.h
===================================================================
--- trunk/aspect/include/aspect/geometry_model/box.h	2014-04-07 15:19:22 UTC (rev 2416)
+++ trunk/aspect/include/aspect/geometry_model/box.h	2014-04-07 18:53:01 UTC (rev 2417)
@@ -115,6 +115,12 @@
          * Flag whether the box is periodic in the x-, y-, and z-direction.
          */
         bool periodic[dim];
+
+        /**
+         * The number of cells in each coordinate direction
+         */
+        unsigned int repetitions[dim];
+
     };
   }
 }

Modified: trunk/aspect/source/geometry_model/box.cc
===================================================================
--- trunk/aspect/source/geometry_model/box.cc	2014-04-07 15:19:22 UTC (rev 2416)
+++ trunk/aspect/source/geometry_model/box.cc	2014-04-07 18:53:01 UTC (rev 2417)
@@ -37,11 +37,12 @@
     Box<dim>::
     create_coarse_mesh (parallel::distributed::Triangulation<dim> &coarse_grid) const
     {
-      GridGenerator::hyper_rectangle (coarse_grid,
-                                      Point<dim>(),
-                                      extents);
-      for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
-        coarse_grid.begin_active()->face(f)->set_boundary_indicator(f);
+      std::vector<unsigned int> rep_vec(repetitions, repetitions+dim);
+      GridGenerator::subdivided_hyper_rectangle (coarse_grid,
+          rep_vec,
+          Point<dim>(),
+          extents,
+          true);
 
       //Tell p4est about the periodicity of the mesh.
 #if (DEAL_II_MAJOR*100 + DEAL_II_MINOR) >= 801
@@ -173,6 +174,17 @@
                              Patterns::Double (0),
                              "Extent of the box in z-direction. This value is ignored "
                              "if the simulation is in 2d Units: m.");
+
+          prm.declare_entry ("X repetitions", "1",
+                             Patterns::Integer (1),
+                             "Number of cells in X direction.");
+          prm.declare_entry ("Y repetitions", "1",
+                             Patterns::Integer (1),
+                             "Number of cells in Y direction.");
+          prm.declare_entry ("Z repetitions", "1",
+                             Patterns::Integer (1),
+                             "Number of cells in Z direction.");
+
           prm.declare_entry ("X periodic", "false",
                              Patterns::Bool (),
                              "Whether the box should be periodic in X direction");
@@ -182,6 +194,7 @@
           prm.declare_entry ("Z periodic", "false",
                              Patterns::Bool (),
                              "Whether the box should be periodic in Z direction");
+
         }
         prm.leave_subsection();
       }
@@ -200,17 +213,20 @@
         {
           extents[0] = prm.get_double ("X extent");
           periodic[0] = prm.get_bool ("X periodic");
+          repetitions[0] = prm.get_integer ("X repetitions");
 
           if (dim >= 2)
             {
               extents[1] = prm.get_double ("Y extent");
               periodic[1] = prm.get_bool ("Y periodic");
+              repetitions[1] = prm.get_integer ("Y repetitions");
             }
 
           if (dim >= 3)
             {
               extents[2] = prm.get_double ("Z extent");
               periodic[2] = prm.get_bool ("Z periodic");
+              repetitions[2] = prm.get_integer ("Z repetitions");
             }
         }
         prm.leave_subsection();


More information about the CIG-COMMITS mailing list