[cig-commits] [commit] master: Introduce GeometryModel::has_curved_elements() (fe3cf22)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Jan 16 12:00:07 PST 2015


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

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/a402e9ee11ecde97fdd49aecc0a7604d514d446a...23371c522d510d3edddde05d16731fd7039d510b

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

commit fe3cf229bec8f035f2385c4ccba7fd5c8f50eede
Author: Timo Heister <timo.heister at gmail.com>
Date:   Thu Jan 15 17:29:43 2015 -0500

    Introduce GeometryModel::has_curved_elements()
    
    This allows us to switch to a Q1 mapping for box-like geometries.


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

fe3cf229bec8f035f2385c4ccba7fd5c8f50eede
 doc/modules/changes.h                           |  7 ++++++-
 include/aspect/geometry_model/box.h             |  9 +++++++++
 include/aspect/geometry_model/interface.h       | 11 +++++++++++
 include/aspect/geometry_model/sphere.h          |  9 +++++++++
 include/aspect/geometry_model/spherical_shell.h |  9 +++++++++
 source/geometry_model/box.cc                    |  6 ++++++
 source/geometry_model/interface.cc              |  7 +++++++
 source/geometry_model/sphere.cc                 |  7 +++++++
 source/geometry_model/spherical_shell.cc        |  7 +++++++
 source/simulator/core.cc                        | 11 ++++++++---
 10 files changed, 79 insertions(+), 4 deletions(-)

diff --git a/doc/modules/changes.h b/doc/modules/changes.h
index 1607308..2258038 100644
--- a/doc/modules/changes.h
+++ b/doc/modules/changes.h
@@ -6,11 +6,16 @@
  *
  *
  * <ol>
+ * <li> New: GeometryModel::has_curved_elements() will allow for optimizations
+ * if all boundaries (and manifold description) are straight.
+ * <br>
+ * (Timo Heister, 2015/01/16)
+ *
  * <li> Fixed: the inner solvers for the Stokes block preconditioner now start
  * with a zero initial guess. This should make the solvers more robust.
  * <br>
  * (Timo Heister, 2015/01/16)
-
+ *
  * <li> ASPECT now requires deal.II version 8.2 or later.
  * <br>
  * (Timo Heister, 2015/01/13)
diff --git a/include/aspect/geometry_model/box.h b/include/aspect/geometry_model/box.h
index e8027ab..7ca8028 100644
--- a/include/aspect/geometry_model/box.h
+++ b/include/aspect/geometry_model/box.h
@@ -113,6 +113,15 @@ namespace aspect
         std::set< std::pair< std::pair<types::boundary_id, types::boundary_id>, unsigned int> >
         get_periodic_boundary_pairs () const;
 
+	/**
+	 * @copydoc Interface::has_curved_elements()
+	 *
+	 * A box has only straight boundaries and cells, so return false.
+	 */
+	virtual
+	bool
+	has_curved_elements() const;
+
         /**
          * Declare the parameters this class takes through input files.
          */
diff --git a/include/aspect/geometry_model/interface.h b/include/aspect/geometry_model/interface.h
index 83005c7..531b3f0 100644
--- a/include/aspect/geometry_model/interface.h
+++ b/include/aspect/geometry_model/interface.h
@@ -226,6 +226,16 @@ namespace aspect
         std::set< std::pair< std::pair<types::boundary_id, types::boundary_id>, unsigned int> >
         get_periodic_boundary_pairs () const;
 
+	/**
+	 * If true, the geometry contains cells with boundaries that are not
+	 * straight and have a deal.II boundary object attached to it. If the
+	 * return value is @p false, certain operation can be optimized.The
+	 * default implementation of this function will return @p true.
+	 */
+	virtual
+	bool
+	has_curved_elements() const;
+	
         /**
          * Declare the parameters this class takes through input files. The
          * default implementation of this function does not describe any
@@ -245,6 +255,7 @@ namespace aspect
         virtual
         void
         parse_parameters (ParameterHandler &prm);
+
     };
 
 
diff --git a/include/aspect/geometry_model/sphere.h b/include/aspect/geometry_model/sphere.h
index 0cc60fe..3ca7c51 100644
--- a/include/aspect/geometry_model/sphere.h
+++ b/include/aspect/geometry_model/sphere.h
@@ -78,6 +78,15 @@ namespace aspect
         std::map<std::string,types::boundary_id>
         get_symbolic_boundary_names_map () const;
 
+	/**
+	 * @copydoc Interface::has_curved_elements()
+	 *
+	 * Return true because we have a curved boundary.
+	 */
+	virtual
+	bool
+	has_curved_elements() const;
+
         static
         void
         declare_parameters (ParameterHandler &prm);
diff --git a/include/aspect/geometry_model/spherical_shell.h b/include/aspect/geometry_model/spherical_shell.h
index 43b49ea..cfb2da1 100644
--- a/include/aspect/geometry_model/spherical_shell.h
+++ b/include/aspect/geometry_model/spherical_shell.h
@@ -94,6 +94,15 @@ namespace aspect
         std::map<std::string,types::boundary_id>
         get_symbolic_boundary_names_map () const;
 
+	/**
+	 * @copydoc Interface::has_curved_elements()
+	 *
+	 * Return true because we have a curved boundary.
+	 */
+	virtual
+	bool
+	has_curved_elements() const;
+
         /**
          * Declare the parameters this class takes through input files. The
          * default implementation of this function does not describe any
diff --git a/source/geometry_model/box.cc b/source/geometry_model/box.cc
index c713a63..2aec7a4 100644
--- a/source/geometry_model/box.cc
+++ b/source/geometry_model/box.cc
@@ -195,6 +195,12 @@ namespace aspect
       return extents[dim-1];
     }
 
+    template <int dim>
+    bool
+    Box<dim>::has_curved_elements() const
+    {
+      return false;
+    }
 
     template <int dim>
     void
diff --git a/source/geometry_model/interface.cc b/source/geometry_model/interface.cc
index bb3d31f..a741a9e 100644
--- a/source/geometry_model/interface.cc
+++ b/source/geometry_model/interface.cc
@@ -56,6 +56,13 @@ namespace aspect
       return std::set< std::pair< std::pair< types::boundary_id, types::boundary_id>, unsigned int > >();
     }
 
+    template <int dim>
+    bool
+    Interface<dim>::has_curved_elements() const
+    {
+      return true;
+    }
+    
 
     template <int dim>
     void
diff --git a/source/geometry_model/sphere.cc b/source/geometry_model/sphere.cc
index e915602..7584ab5 100644
--- a/source/geometry_model/sphere.cc
+++ b/source/geometry_model/sphere.cc
@@ -112,6 +112,13 @@ namespace aspect
       return R;
     }
 
+    template <int dim>
+    bool
+    Sphere<dim>::has_curved_elements () const
+    {
+      return true;
+    }
+
 
     template <int dim>
     void
diff --git a/source/geometry_model/spherical_shell.cc b/source/geometry_model/spherical_shell.cc
index 8b94419..5195f64 100644
--- a/source/geometry_model/spherical_shell.cc
+++ b/source/geometry_model/spherical_shell.cc
@@ -235,6 +235,13 @@ namespace aspect
       return phi;
     }
 
+    template <int dim>
+    bool
+    SphericalShell<dim>::has_curved_elements () const
+    {
+      return true;
+    }
+    
 
     template <int dim>
     void
diff --git a/source/simulator/core.cc b/source/simulator/core.cc
index cee0dae..48daf95 100644
--- a/source/simulator/core.cc
+++ b/source/simulator/core.cc
@@ -153,9 +153,14 @@ namespace aspect
                     Triangulation<dim>::smoothing_on_coarsening),
                    parallel::distributed::Triangulation<dim>::mesh_reconstruction_after_repartitioning),
 
-    //Fourth order mapping doesn't really make sense for free surface calculations, since we detatch the
-    //boundary indicators anyways.
-    mapping (parameters.free_surface_enabled?1:4),
+    //Fourth order mapping doesn't really make sense for free surface
+    //calculations (we disable curved boundaries) or we we only have straight
+    //boundaries
+    mapping (
+      (parameters.free_surface_enabled
+       ||
+       geometry_model->has_curved_elements() == false
+      )?1:4),
   
     // define the finite element. obviously, what we do here needs
     // to match the data we provide in the Introspection class



More information about the CIG-COMMITS mailing list