[cig-commits] [commit] master: Improved documentation of heating models. Also moved the set_current_time function to a generic update function in the interface and all existing plugins to be similar to material model and gravity model. (e8de93d)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri May 16 18:39:53 PDT 2014


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

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/7b658caa05d489ae3f8d61b8049b015e7be94f77...cc43d3ac6f571573118eb54c2103bf92dfe8355f

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

commit e8de93d4a7d647f92587257c073c1e515e0d69cf
Author: Rene Gassmoeller <R.Gassmoeller at mailbox.org>
Date:   Fri May 16 12:40:02 2014 -0500

    Improved documentation of heating models. Also moved the set_current_time function to a generic update function in the interface and all existing plugins to be similar to material model and gravity model.


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

e8de93d4a7d647f92587257c073c1e515e0d69cf
 include/aspect/heating_model/function.h  | 18 ++++++------------
 include/aspect/heating_model/interface.h | 14 +++-----------
 source/heating_model/function.cc         |  3 ++-
 source/heating_model/interface.cc        |  6 ++----
 source/simulator/core.cc                 |  2 +-
 5 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/include/aspect/heating_model/function.h b/include/aspect/heating_model/function.h
index 0e35ee2..9ced471 100644
--- a/include/aspect/heating_model/function.h
+++ b/include/aspect/heating_model/function.h
@@ -50,7 +50,8 @@ namespace aspect
         Function ();
 
         /**
-         * Return the specific heating rate.
+         * Return the specific heating rate as calculated by the
+         * function object.
          */
         virtual
         double
@@ -61,19 +62,15 @@ namespace aspect
 
         /**
          * A function that is called at the beginning of each time step to
-         * indicate what the model time is for which the heating rate will
-         * next be evaluated. For the current class, the function passes to
-         * the parsed function what the current time is.
+         * allow the model to do whatever necessary. In this case the time
+         * of the function object is updated.
          */
         virtual
         void
-        set_current_time (const double time);
+        update ();
 
         /**
-         * Declare the parameters this class takes through input files. The
-         * default implementation of this function does not describe any
-         * parameters. Consequently, derived classes do not have to overload
-         * this function if they do not take any runtime parameters.
+         * Declare the parameters this class takes through input files.
          */
         static
         void
@@ -81,9 +78,6 @@ namespace aspect
 
         /**
          * Read the parameters this class declares from the parameter file.
-         * The default implementation of this function does not read any
-         * parameters. Consequently, derived classes do not have to overload
-         * this function if they do not take any runtime parameters.
          */
         virtual
         void
diff --git a/include/aspect/heating_model/interface.h b/include/aspect/heating_model/interface.h
index 77024af..e8a0ebd 100644
--- a/include/aspect/heating_model/interface.h
+++ b/include/aspect/heating_model/interface.h
@@ -67,9 +67,8 @@ namespace aspect
          * A function that is called at the beginning of each time step to
          * indicate what the model time is for which the boundary values will
          * next be evaluated. The default implementation of the function will
-         * simply record the time in the current_time member variable, but
-         * derived classes that need more elaborate setups for a given time
-         * step may overload the function.
+         * do nothing, but derived classes that need more elaborate setups
+         * for a given time step may overload the function.
          *
          * The point of this function is to allow complex heating
          * models to do an initialization step once at the beginning of each
@@ -78,7 +77,7 @@ namespace aspect
          */
         virtual
         void
-        set_current_time (const double time);
+        update ();
 
         /**
          * Return the specific heating rate as a function of position.
@@ -115,13 +114,6 @@ namespace aspect
          * Pointer to the geometry object in use.
          */
         const GeometryModel::Interface<dim> *geometry_model;
-
-        /**
-         * A variable that stores the current time of the simulation. Derived
-         * classes can query this variable. It is set at the beginning of each
-         * time step.
-         */
-        double current_time;
     };
 
 
diff --git a/source/heating_model/function.cc b/source/heating_model/function.cc
index 213bce0..b61355f 100644
--- a/source/heating_model/function.cc
+++ b/source/heating_model/function.cc
@@ -49,8 +49,9 @@ namespace aspect
 
     template <int dim>
     void
-    Function<dim>::set_current_time (const double time)
+    Function<dim>::update ()
     {
+      const double time = this->get_time();
       // we get time passed as seconds (always) but may want
       // to reinterpret it in years
       if (this->convert_output_to_years())
diff --git a/source/heating_model/interface.cc b/source/heating_model/interface.cc
index 3c87906..e0bbfa4 100644
--- a/source/heating_model/interface.cc
+++ b/source/heating_model/interface.cc
@@ -47,10 +47,8 @@ namespace aspect
 
     template <int dim>
     void
-    Interface<dim>::set_current_time (const double time)
-    {
-      current_time = time;
-    }
+    Interface<dim>::update ()
+    {}
 
 
 
diff --git a/source/simulator/core.cc b/source/simulator/core.cc
index 1b39c20..809eb69 100644
--- a/source/simulator/core.cc
+++ b/source/simulator/core.cc
@@ -550,7 +550,7 @@ namespace aspect
     // notify different system components that we started the next time step
     material_model->update();
     gravity_model->update();
-    heating_model->set_current_time(time);
+    heating_model->update();
   }
 
 



More information about the CIG-COMMITS mailing list