[cig-commits] [commit] master: Additinal parameters for spherical shell initial conditions and geometry (d4ea5e9)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Mon Aug 4 14:45:21 PDT 2014


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

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/3811725812cafa918bbabc2515f52af7857aad31...9a8086507e7ed22ed2a4d13771930e4ae6bc3a7d

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

commit d4ea5e9c1a5d684806ca315d6d219221a61c6e5b
Author: WDurkin <wjd73 at cornell.edu>
Date:   Tue Jul 15 17:02:04 2014 -0500

    Additinal parameters for spherical shell initial conditions and geometry
    
    Updated geometry_model/spherical_shell.cc
    Can specify number of mesh cells created in the first time step.
    
    New parameter:
      int Cell count
    
    ----------------------
    Updated initial_conditions/spherical_shell.cc
    Can specify the number of convective cells and their orientation.
    
    New parameters:
      int Lemniscate number
      double Rotation offset


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

d4ea5e9c1a5d684806ca315d6d219221a61c6e5b
 include/aspect/geometry_model/spherical_shell.h    |  7 +++
 .../aspect/initial_conditions/spherical_shell.h    | 20 +++++++
 source/geometry_model/spherical_shell.cc           |  9 +++-
 source/initial_conditions/spherical_shell.cc       | 62 +++++++++++++++++++++-
 4 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/include/aspect/geometry_model/spherical_shell.h b/include/aspect/geometry_model/spherical_shell.h
index 4b119f3..1d55cb5 100644
--- a/include/aspect/geometry_model/spherical_shell.h
+++ b/include/aspect/geometry_model/spherical_shell.h
@@ -132,6 +132,13 @@ namespace aspect
          * Opening angle of the section of the shell that we simulate.
          */
         double phi;
+
+        /**
+         * Number of tangential mesh cells when the initial global 
+         * refinement is set to zero.
+         */
+         int cell_count;
+
     };
   }
 }
diff --git a/include/aspect/initial_conditions/spherical_shell.h b/include/aspect/initial_conditions/spherical_shell.h
index 710734d..0b0405d 100644
--- a/include/aspect/initial_conditions/spherical_shell.h
+++ b/include/aspect/initial_conditions/spherical_shell.h
@@ -45,8 +45,27 @@ namespace aspect
         /**
          * Return the initial temperature as a function of position.
          */
+
+         /**
+         * Declare the parameters this class takes through input files.
+         */
+        static
+        void
+        declare_parameters (ParameterHandler &prm);
+
+        /**
+         * Read the parameters this class declares from the parameter file.
+         */
+        virtual
+        void
+        parse_parameters (ParameterHandler &prm);
         virtual
         double initial_temperature (const Point<dim> &position) const;
+     
+      private:
+        int lemniscate_number; 
+        double rotation_offset;   
+  
     };
 
 
@@ -93,6 +112,7 @@ namespace aspect
         double sigma;
         double sign;
         unsigned int npoint;
+        //int lemniscate_number;
         std::string initial_geotherm_table;
 
         std::vector<double> radial_position;
diff --git a/source/geometry_model/spherical_shell.cc b/source/geometry_model/spherical_shell.cc
index 5d873ad..de1b39d 100644
--- a/source/geometry_model/spherical_shell.cc
+++ b/source/geometry_model/spherical_shell.cc
@@ -42,7 +42,7 @@ namespace aspect
                                       Point<dim>(),
                                       R0,
                                       R1,
-                                      (dim==3) ? 96 : 12,
+                                      (dim==3) ? 8*cell_count : cell_count,
                                       true);
         }
       else if (phi == 90)
@@ -186,6 +186,12 @@ namespace aspect
                              Patterns::Double (0, 360),
                              "Opening angle in degrees of the section of the shell "
                              "that we want to build. Units: degrees.");
+         
+          prm.declare_entry ("Cell count", "12",
+                              Patterns::Integer (),
+                              "The number of tangential cells that are "
+                              "created when initial global refinement is zero."); 
+
         }
         prm.leave_subsection();
       }
@@ -205,6 +211,7 @@ namespace aspect
           R0  = prm.get_double ("Inner radius");
           R1  = prm.get_double ("Outer radius");
           phi = prm.get_double ("Opening angle");
+          cell_count = prm.get_integer ("Cell count");
         }
         prm.leave_subsection();
       }
diff --git a/source/initial_conditions/spherical_shell.cc b/source/initial_conditions/spherical_shell.cc
index 680d5d6..51843e1 100644
--- a/source/initial_conditions/spherical_shell.cc
+++ b/source/initial_conditions/spherical_shell.cc
@@ -25,6 +25,8 @@
 #include <iostream>
 #include <cstring>
 
+
+
 namespace aspect
 {
   namespace InitialConditions
@@ -59,6 +61,10 @@ namespace aspect
          For a plot, see
          http://www.wolframalpha.com/input/?i=plot+%28%282*sqrt%28x^2%2By^2%29-1%29%2B0.2*%282*sqrt%28x^2%2By^2%29-1%29*%281-%282*sqrt%28x^2%2By^2%29-1%29%29*sin%286*atan2%28x%2Cy%29%29%29%2C+x%3D-1+to+1%2C+y%3D-1+to+1
       */
+    
+      const double PI = 3.1415926535897932384626433832795028841971693993751058;
+
+      
       const double scale = ((dim==3)
                             ?
                             std::max(0.0,
@@ -68,7 +74,7 @@ namespace aspect
       const double phi   = std::atan2(position(0),position(1));
       const double s_mod = s
                            +
-                           0.2 * s * (1-s) * std::sin(6*phi) * scale;
+                           0.2 * s * (1-s) * std::sin(lemniscate_number*phi +(PI/2 + rotation_offset)) * scale;
 
       return (this->get_boundary_temperature().maximal_temperature()*(s_mod)
               +
@@ -166,6 +172,56 @@ namespace aspect
     }
 
 
+
+    template <int dim>
+    void
+    SphericalHexagonalPerturbation<dim>::declare_parameters (ParameterHandler &prm)
+    {
+      prm.enter_subsection("Initial conditions");
+      {
+        prm.enter_subsection("Spherical hexagonal perturbation");
+        {
+
+          prm.declare_entry ("Lemniscate number", "6",
+                              Patterns::Integer (),
+                              "The number of convection cells to perturb the system with.");   
+
+         prm.declare_entry  ("Rotation offset", "0",
+                              Patterns::Double (),
+                              "Amount to rotate the lemniscate in radians."
+                              "Default places a petal due north.");    
+ 
+        }
+        prm.leave_subsection ();
+      }
+      prm.leave_subsection ();
+    }
+
+   template <int dim>
+    void
+    SphericalHexagonalPerturbation<dim>::parse_parameters (ParameterHandler &prm)
+    {
+      prm.enter_subsection("Initial conditions");
+      {
+        prm.enter_subsection("Spherical hexagonal perturbation");
+        {
+          lemniscate_number = prm.get_integer ("Lemniscate number");
+          rotation_offset = prm.get_double  ("Rotation offset");
+
+        }
+        prm.leave_subsection ();
+      }
+      prm.leave_subsection ();
+    }
+
+
+
+
+
+
+
+
+
     template <int dim>
     void
     SphericalGaussianPerturbation<dim>::declare_parameters (ParameterHandler &prm)
@@ -174,6 +230,7 @@ namespace aspect
       {
         prm.enter_subsection("Spherical gaussian perturbation");
         {       
+ 
           prm.declare_entry ("Angle", "0e0",
                              Patterns::Double (0),
                              "The angle where the center of the perturbation is placed.");
@@ -210,6 +267,7 @@ namespace aspect
       {
         prm.enter_subsection("Spherical gaussian perturbation");
         {
+          //lemniscate_number = prm.get_integer ("Lemniscate number");
           angle = prm.get_double ("Angle");
           depth = prm.get_double ("Non-dimensional depth");
           amplitude  = prm.get_double ("Amplitude");
@@ -232,7 +290,7 @@ namespace aspect
     ASPECT_REGISTER_INITIAL_CONDITIONS(SphericalHexagonalPerturbation,
                                        "spherical hexagonal perturbation",
                                        "An initial temperature field in which the temperature "
-                                       "is perturbed following a six-fold pattern in angular "
+                                       "is perturbed following an N-fold pattern in a specified "
                                        "direction from an otherwise spherically symmetric "
                                        "state.")
 



More information about the CIG-COMMITS mailing list