]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
work on step-49
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 17 Feb 2013 18:47:46 +0000 (18:47 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 17 Feb 2013 18:47:46 +0000 (18:47 +0000)
git-svn-id: https://svn.dealii.org/trunk@28443 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-49/doc/intro.dox
deal.II/examples/step-49/doc/step-49.grid-5.png [new file with mode: 0644]
deal.II/examples/step-49/doc/step-49.grid-5a.png [new file with mode: 0644]
deal.II/examples/step-49/doc/step-49.grid-6.png [new file with mode: 0644]
deal.II/examples/step-49/doc/step-49.grid-6a.png [new file with mode: 0644]
deal.II/examples/step-49/doc/step-49.grid-7.png [new file with mode: 0644]
deal.II/examples/step-49/doc/step-49.grid-7a.png [new file with mode: 0644]
deal.II/examples/step-49/step-49.cc

index c9da6be05ebcec7ea50b68853a57eb5a65ca8daf..9e6cccb41a68cbdf1341fd0ab0c3567d35c6c763 100644 (file)
@@ -62,9 +62,10 @@ grid_1 in this example.
 Meshes can be generated from different tools like <a
 href="http://geuz.org/gmsh/" rel="nofollow">gmsh</a>, <a
 href="https://lagrit.lanl.gov/" rel="nofollow">lagrit</a> and <a
-href="http://cubit.sandia.gov/" rel="nofollow">cubit</a>. The problem is that
-deal.II needs meshes that only consist of quads and hexas -- tetrahedral
-meshes won't work (this means tools like tetgen can not be used directly).
+href="http://cubit.sandia.gov/" rel="nofollow">cubit</a>. See the
+documentation of GridIn for more information. The problem is that deal.II
+needs meshes that only consist of quads and hexas -- tetrahedral meshes won't
+work (this means tools like tetgen can not be used directly).
 
 We will describe a possible workflow using Gmsh. Gmsh is the smallest and
 quickest to set up open source tool, that we know of. It can generate
@@ -120,12 +121,54 @@ a given mesh in various ways. The usage of the functions GridTools::shift,
 GridTools::rotate, GridTools::scale is fairly obvious, so we won't discuss
 those functions here.
 
+The function GridTools::transform allows you to transform the vertices of a
+given mesh using a smooth function.
 
- GridTools::transform
-  - transform via smooth function
+In the function grid_5() we perturb the y coordinate of a mesh with
+a sin curve:
+<TABLE WIDTH="60%" ALIGN="center">
+  <tr>
+    <td ALIGN="center">
+        @image html step-49.grid-5a.png regular input mesh
+    </td>
+    <td ALIGN="center">
+        @image html step-49.grid-5.png output mesh 
+    </td>
+  </tr>
+</TABLE>
 
-  - perturb/randomize mesh
+Using the formula
+$(x,y) \mapsto (x,tanh(2*y)/tanh(2))$, we transform a regular refined
+unit square to a wall-adapted mesh in y direction. This is done in grid_6()
+of this tutorial:
+<TABLE WIDTH="60%" ALIGN="center">
+  <tr>
+    <td ALIGN="center">
+        @image html step-49.grid-6a.png regular input mesh
+    </td>
+    <td ALIGN="center">
+        @image html step-49.grid-6.png wall-adapted output mesh 
+    </td>
+  </tr>
+</TABLE>
 
+The function Triangulation::distort_random allows you to move vertices in the
+mesh (optionally ignoring boundary nodes) by a random amount. This is
+demonstrated in grid_7() and the result is as follows:
+<TABLE WIDTH="60%" ALIGN="center">
+  <tr>
+    <td ALIGN="center">
+        @image html step-49.grid-7a.png regular input mesh
+    </td>
+    <td ALIGN="center">
+        @image html step-49.grid-7.png perturbed output mesh 
+    </td>
+  </tr>
+</TABLE>
+
+Please note that while this allows you to negate some of the superconvergence
+effects one gets when studying convergence on regular meshes, it is better to
+work with a sequence of unstructured meshes (see possible extensions).
 
 
 <h4>Merge Meshes</h4>
@@ -208,4 +251,4 @@ above. This is the output from grid_4():
   - change boundary indicators
   - relax inner vertices
 - Database of unstructured meshes for convergence studies
-
+- GridTools::extract_boundary_mesh 
diff --git a/deal.II/examples/step-49/doc/step-49.grid-5.png b/deal.II/examples/step-49/doc/step-49.grid-5.png
new file mode 100644 (file)
index 0000000..5b0920d
Binary files /dev/null and b/deal.II/examples/step-49/doc/step-49.grid-5.png differ
diff --git a/deal.II/examples/step-49/doc/step-49.grid-5a.png b/deal.II/examples/step-49/doc/step-49.grid-5a.png
new file mode 100644 (file)
index 0000000..3257a9a
Binary files /dev/null and b/deal.II/examples/step-49/doc/step-49.grid-5a.png differ
diff --git a/deal.II/examples/step-49/doc/step-49.grid-6.png b/deal.II/examples/step-49/doc/step-49.grid-6.png
new file mode 100644 (file)
index 0000000..ba416ad
Binary files /dev/null and b/deal.II/examples/step-49/doc/step-49.grid-6.png differ
diff --git a/deal.II/examples/step-49/doc/step-49.grid-6a.png b/deal.II/examples/step-49/doc/step-49.grid-6a.png
new file mode 100644 (file)
index 0000000..34240c3
Binary files /dev/null and b/deal.II/examples/step-49/doc/step-49.grid-6a.png differ
diff --git a/deal.II/examples/step-49/doc/step-49.grid-7.png b/deal.II/examples/step-49/doc/step-49.grid-7.png
new file mode 100644 (file)
index 0000000..d56dfe6
Binary files /dev/null and b/deal.II/examples/step-49/doc/step-49.grid-7.png differ
diff --git a/deal.II/examples/step-49/doc/step-49.grid-7a.png b/deal.II/examples/step-49/doc/step-49.grid-7a.png
new file mode 100644 (file)
index 0000000..96f8f3b
Binary files /dev/null and b/deal.II/examples/step-49/doc/step-49.grid-7a.png differ
index a9851a4d8dd46efce821c1f820631d9c34e697ec..41150a9eb032c81df272a197bda6e58c239a2541 100644 (file)
@@ -14,6 +14,7 @@
 #include <deal.II/grid/tria_accessor.h>
 #include <deal.II/grid/tria_iterator.h>
 #include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_tools.h>
 #include <deal.II/grid/tria_boundary_lib.h>
 #include <deal.II/grid/grid_out.h>
 #include <deal.II/grid/grid_in.h>
@@ -148,7 +149,71 @@ void grid_4()
   
 }
 
+// demonstrate GridTools::transform
+void grid_5()
+{
+  Triangulation<2> tria;
+  std::vector< unsigned int > repetitions(2);
+  repetitions[0]=14;
+  repetitions[1]=2;
+  GridGenerator::subdivided_hyper_rectangle (tria, repetitions,
+                                             Point<2>(0.0,0.0), Point<2>(10.0,1.0));
+
+  struct Func
+  {
+      Point<2> operator() (const Point<2> & in) const
+       {
+         return Point<2>(in(0), in(1)+sin(in(0)/5.0*3.14159));
+       }      
+  };
+  
+  GridTools::transform(Func(), tria);
+  mesh_info(tria, "grid-5.eps");  
+}
+
+// demonstrate GridTools::transform
+void grid_6()
+{
+  Triangulation<2> tria;
+  std::vector< unsigned int > repetitions(2);
+  repetitions[0]=40;
+  repetitions[1]=40;
+  GridGenerator::subdivided_hyper_rectangle (tria, repetitions,
+                                             Point<2>(0.0,0.0), Point<2>(1.0,1.0));
 
+  struct Func
+  {
+      double trans(double x) const
+       {
+                                          //return atan((x-0.5)*3.14159);
+         return tanh(2*x)/tanh(2);//(x-0.5)*3.14159);
+       }
+      
+      Point<2> operator() (const Point<2> & in) const
+       {
+         return Point<2>((in(0)), trans(in(1)));
+       }      
+  };
+  
+  GridTools::transform(Func(), tria);
+  mesh_info(tria, "grid-6.eps");  
+}
+
+
+
+//demonstrate distort_random
+void grid_7()
+{
+  Triangulation<2> tria;
+  std::vector< unsigned int > repetitions(2);
+  repetitions[0]=16;
+  repetitions[1]=16;
+  GridGenerator::subdivided_hyper_rectangle (tria, repetitions,
+                                             Point<2>(0.0,0.0), Point<2>(1.0,1.0));
+
+  tria.distort_random(0.3, true);
+  mesh_info(tria, "grid-7.eps");  
+}
 
 // @sect3{The main function}
 
@@ -160,4 +225,7 @@ int main ()
   grid_2 ();
   grid_3 ();
   grid_4 ();
+  grid_5 ();
+  grid_6 ();
+  grid_7 ();
 }

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.