[cig-commits] commit: Make 3D work

Mercurial hg at geodynamics.org
Fri Apr 8 08:09:06 PDT 2011


changeset:   5:ad16e6c42afe
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Fri Apr 08 07:50:41 2011 -0700
files:       madds-1.cc
description:
Make 3D work


diff -r 54bc181a2779 -r ad16e6c42afe madds-1.cc
--- a/madds-1.cc	Thu Apr 07 20:48:22 2011 -0700
+++ b/madds-1.cc	Fri Apr 08 07:50:41 2011 -0700
@@ -500,10 +500,10 @@ void StokesProblem<dim>::setup_dofs ()
 
   {
     constraints.clear ();
-    std::vector<bool> component_mask (dim+1, true);
+    std::vector<bool> component_mask (dim+1, false);
     component_mask[dim] = false;
 
-    component_mask[dim-2] = false;
+    component_mask[dim-1] = true;
     VectorTools::interpolate_boundary_values (dof_handler,
         				      1,
         				      TopBoundaryValues<dim>(),
@@ -516,6 +516,17 @@ void StokesProblem<dim>::setup_dofs ()
         				      RightBoundaryValues<dim>(),
         				      constraints,
         				      component_mask);
+
+    if(dim>2)
+      {
+        component_mask[dim-2] = false;
+        component_mask[dim-3] = true;
+        VectorTools::interpolate_boundary_values (dof_handler,
+                                                  3,
+                                                  RightBoundaryValues<dim>(),
+                                                  constraints,
+                                                  component_mask);
+      }
     DoFTools::make_hanging_node_constraints (dof_handler,
 					     constraints);
   }
@@ -796,17 +807,28 @@ void StokesProblem<dim>::run ()
   for (typename Triangulation<dim>::active_cell_iterator
 	 cell = triangulation.begin_active();
        cell != triangulation.end(); ++cell)
-    for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
-      if (triangulation.begin_active()->face(f)->center()[dim-1] == 1
-          || triangulation.begin_active()->face(f)->center()[dim-1] == 0)
+    {
+      for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
         {
-          cell->face(f)->set_all_boundary_indicators(1);
+          if (triangulation.begin_active()->face(f)->center()[dim-1] == 1
+              || triangulation.begin_active()->face(f)->center()[dim-1] == 0)
+            {
+              cell->face(f)->set_all_boundary_indicators(1);
+            }
+          else if (triangulation.begin_active()->face(f)->center()[dim-2] == 1
+                   || triangulation.begin_active()->face(f)->center()[dim-2] == 0)
+            {
+              cell->face(f)->set_all_boundary_indicators(2);
+            }
+          else if (dim>2 &&
+                   (triangulation.begin_active()->face(f)->center()[dim-3] == 1
+                    || triangulation.begin_active()->face(f)->center()[dim-3] == 0))
+            {
+              cell->face(f)->set_all_boundary_indicators(3);
+            }
         }
-      else if (triangulation.begin_active()->face(f)->center()[dim-2] == 1
-               || triangulation.begin_active()->face(f)->center()[dim-2] == 0)
-        {
-          cell->face(f)->set_all_boundary_indicators(2);
-        }
+    }
+
 
   triangulation.refine_global (parameters.initial_refinement);
 
@@ -857,7 +879,7 @@ int main (int argc, char *argv[])
 	  std::exit(1);
 	}
 
-      StokesProblem<2> flow_problem(argc==2 ?
+      StokesProblem<3> flow_problem(argc==2 ?
 				    argv[1] :
 				    "madds-1.prm");
       flow_problem.run ();



More information about the CIG-COMMITS mailing list