[cig-commits] commit 2488 by bangerth to /var/svn/dealii/aspect

dealii.demon at gmail.com dealii.demon at gmail.com
Sat Apr 12 04:39:39 PDT 2014


Revision 2488

Rework the definition of the maximum time step a bit so that we don't need a special value any more.

U   trunk/aspect/source/simulator/core.cc
U   trunk/aspect/source/simulator/parameters.cc


http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=2488&peg=2488

Diff:
Modified: trunk/aspect/source/simulator/core.cc
===================================================================
--- trunk/aspect/source/simulator/core.cc	2014-04-12 11:39:06 UTC (rev 2487)
+++ trunk/aspect/source/simulator/core.cc	2014-04-12 11:39:37 UTC (rev 2488)
@@ -1367,10 +1367,8 @@
         // returned by compute_time_step is unused, will be
         // added to statistics later
         old_time_step = time_step;
-        time_step = compute_time_step().first;
-        time_step = ( (parameters.maximum_time_step > 0.0 && 
-                       time_step > parameters.maximum_time_step) ? 
-                      parameters.maximum_time_step : time_step);
+        time_step = std::min (compute_time_step().first,
+                              parameters.maximum_time_step);
         time_step = termination_manager.check_for_last_time_step(time_step);
 
         if (parameters.convert_to_years == true)

Modified: trunk/aspect/source/simulator/parameters.cc
===================================================================
--- trunk/aspect/source/simulator/parameters.cc	2014-04-12 11:39:06 UTC (rev 2487)
+++ trunk/aspect/source/simulator/parameters.cc	2014-04-12 11:39:37 UTC (rev 2488)
@@ -24,6 +24,7 @@
 #include <aspect/global.h>
 
 #include <deal.II/base/parameter_handler.h>
+#include <boost/lexical_cast.hpp>
 
 #include <dirent.h>
 
@@ -112,14 +113,18 @@
                        "here, one can choose the time step as large as one wants (in particular, "
                        "one can choose $c>1$) though a CFL number significantly larger than "
                        "one will yield rather diffusive solutions. Units: None.");
-    prm.declare_entry ("Maximum time step", "0.0",
+    prm.declare_entry ("Maximum time step",
+                       boost::lexical_cast<std::string>(std::numeric_limits<double>::max() /
+                                                        year_in_seconds),
                        Patterns::Double (0),
                        "Set a maximum time step size for the solver to use. Generally the time step "
                        "based on the CFL number should be sufficient, but for complicated models "
                        "or benchmarking it may be useful to limit the time step to some value. "
-                       "Maximum time step should be in years or seconds, depending on the ``Use years "
-                       "in output instead of seconds'' parameter.  Set zero for this parameter "
-                       "to have no maximum time step.");
+                       "The default value is a value so that when converted from years into seconds "
+                       "it equals the largest number representable by a floating "
+                       "point number, implying an unlimited time step."
+                       "Units: Years or seconds, depending on the ``Use years "
+                       "in output instead of seconds'' parameter.");
 
     prm.declare_entry ("Use conduction timestep", "false",
                        Patterns::Bool (),


More information about the CIG-COMMITS mailing list