[cig-commits] r1356 - in trunk/aspect: include/aspect source/simulator

heien at dealii.org heien at dealii.org
Fri Nov 9 22:03:48 PST 2012


Author: heien
Date: 2012-11-09 23:03:48 -0700 (Fri, 09 Nov 2012)
New Revision: 1356

Modified:
   trunk/aspect/include/aspect/simulator.h
   trunk/aspect/source/simulator/core.cc
   trunk/aspect/source/simulator/helper_functions.cc
   trunk/aspect/source/simulator/simulator_access.cc
Log:
Changed compute_time_step return variable


Modified: trunk/aspect/include/aspect/simulator.h
===================================================================
--- trunk/aspect/include/aspect/simulator.h	2012-11-10 04:36:50 UTC (rev 1355)
+++ trunk/aspect/include/aspect/simulator.h	2012-11-10 06:03:48 UTC (rev 1356)
@@ -1174,13 +1174,12 @@
        * of the mesh. If specified in the parameter file, the time step
        * will be the minimum of the convection *and* conduction time
        * steps. Also returns whether the timestep is dominated by
-       * convection or conduction.
+       * convection (true) or conduction (false).
        *
        * This function is implemented in
        * <code>source/simulator/helper_functions.cc</code>.
        */
-      void compute_time_step (double &new_time_step,
-                              bool &convection_dominant) const;
+      std::pair<double,bool> compute_time_step () const;
 
       /**
        * Compute the artificial diffusion coefficient value on a cell

Modified: trunk/aspect/source/simulator/core.cc
===================================================================
--- trunk/aspect/source/simulator/core.cc	2012-11-10 04:36:50 UTC (rev 1355)
+++ trunk/aspect/source/simulator/core.cc	2012-11-10 06:03:48 UTC (rev 1356)
@@ -1336,9 +1336,12 @@
         pcout << std::endl;
 
         // update the time step size
-        bool convection_dominant; // for now this is unused, will be added to statistics later
+        // for now the bool (convection/conduction dominated)
+        // is unused, will be added to statistics later
+        std::pair<double, bool>   time_step_result;
         old_time_step = time_step;
-        compute_time_step(time_step, convection_dominant);
+        time_step_result = compute_time_step();
+        time_step = time_step_result.first;
 
         if (parameters.convert_to_years == true)
           statistics.add_value("Time step size (years)", time_step / year_in_seconds);

Modified: trunk/aspect/source/simulator/helper_functions.cc
===================================================================
--- trunk/aspect/source/simulator/helper_functions.cc	2012-11-10 04:36:50 UTC (rev 1355)
+++ trunk/aspect/source/simulator/helper_functions.cc	2012-11-10 06:03:48 UTC (rev 1356)
@@ -207,7 +207,7 @@
 
 
   template <int dim>
-  void Simulator<dim>::compute_time_step (double &new_time_step, bool &convection_dominant) const
+  std::pair<double,bool> Simulator<dim>::compute_time_step () const
   {
     const QIterated<dim> quadrature_formula (QTrapez<1>(),
                                              parameters.stokes_velocity_degree);
@@ -220,6 +220,8 @@
     const FEValuesExtractors::Vector velocities (0);
     const FEValuesExtractors::Scalar pressure (dim);
     const FEValuesExtractors::Scalar temperature (dim+1);
+    double new_time_step;
+    bool convection_dominant;
 
     double max_local_speed_over_meshsize = 0;
     double min_local_conduction_timestep = std::numeric_limits<double>::max(), min_conduction_timestep;
@@ -289,6 +291,8 @@
                                  (parameters.CFL_number / (parameters.temperature_degree * max_global_speed_over_meshsize)));
         convection_dominant = (new_time_step < min_conduction_timestep);
       }
+
+    return std::make_pair(new_time_step, convection_dominant);
   }
 
 
@@ -1159,7 +1163,7 @@
   template void Simulator<dim>::extract_composition_values_at_q_point (const std::vector<std::vector<double> > &composition_values, \
                                                                        const unsigned int q, \
                                                                        std::vector<double> &composition_values_at_q_point) const;  \
-  template void Simulator<dim>::compute_time_step (double &new_time_step, bool &convection_dominant) const; \
+  template std::pair<double,bool> Simulator<dim>::compute_time_step () const; \
   template void Simulator<dim>::make_pressure_rhs_compatible(LinearAlgebra::BlockVector &vector); \
   template void Simulator<dim>::compute_depth_average_field(const unsigned int index, std::vector<double> &values) const; \
   template void Simulator<dim>::compute_depth_average_viscosity(std::vector<double> &values) const; \

Modified: trunk/aspect/source/simulator/simulator_access.cc
===================================================================
--- trunk/aspect/source/simulator/simulator_access.cc	2012-11-10 04:36:50 UTC (rev 1355)
+++ trunk/aspect/source/simulator/simulator_access.cc	2012-11-10 06:03:48 UTC (rev 1356)
@@ -266,7 +266,7 @@
 
 
   template <int dim>
-  const std::set<types::boundary_id_t>&
+  const std::set<types::boundary_id_t> &
   SimulatorAccess<dim>::get_fixed_temperature_boundary_indicators () const
   {
     return simulator->parameters.fixed_temperature_boundary_indicators;



More information about the CIG-COMMITS mailing list