[cig-commits] commit 2476 by ian.rose to /var/svn/dealii/aspect

dealii.demon at gmail.com dealii.demon at gmail.com
Fri Apr 11 07:16:05 PDT 2014


Revision 2476

Add parameter for maximum time step size

U   trunk/aspect/include/aspect/simulator.h
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=2476&peg=2476

Diff:
Modified: trunk/aspect/include/aspect/simulator.h
===================================================================
--- trunk/aspect/include/aspect/simulator.h	2014-04-11 13:26:19 UTC (rev 2475)
+++ trunk/aspect/include/aspect/simulator.h	2014-04-11 14:16:01 UTC (rev 2476)
@@ -176,6 +176,7 @@
         bool                           resume_computation;
         double                         start_time;
         double                         CFL_number;
+        double                         maximum_time_step;
         bool                           use_conduction_timestep;
         bool                           convert_to_years;
         std::string                    output_directory;

Modified: trunk/aspect/source/simulator/core.cc
===================================================================
--- trunk/aspect/source/simulator/core.cc	2014-04-11 13:26:19 UTC (rev 2475)
+++ trunk/aspect/source/simulator/core.cc	2014-04-11 14:16:01 UTC (rev 2476)
@@ -1368,6 +1368,9 @@
         // 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 = 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-11 13:26:19 UTC (rev 2475)
+++ trunk/aspect/source/simulator/parameters.cc	2014-04-11 14:16:01 UTC (rev 2476)
@@ -112,6 +112,14 @@
                        "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",
+                       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.");
 
     prm.declare_entry ("Use conduction timestep", "false",
                        Patterns::Bool (),
@@ -547,6 +555,11 @@
     convert_to_years        = prm.get_bool ("Use years in output instead of seconds");
     timing_output_frequency = prm.get_integer ("Timing output frequency");
 
+    maximum_time_step       = prm.get_double("Maximum time step");
+    if(convert_to_years == true)
+      maximum_time_step *= year_in_seconds;
+    
+
     if (prm.get ("Nonlinear solver scheme") == "IMPES")
       nonlinear_solver = NonlinearSolver::IMPES;
     else if (prm.get ("Nonlinear solver scheme") == "iterated IMPES")


More information about the CIG-COMMITS mailing list