[cig-commits] r20805 - short/3D/PyLith/branches/v1.7-trunk/pylith/problems

brad at geodynamics.org brad at geodynamics.org
Fri Oct 5 10:40:39 PDT 2012


Author: brad
Date: 2012-10-05 10:40:39 -0700 (Fri, 05 Oct 2012)
New Revision: 20805

Modified:
   short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Explicit.py
Log:
Cache stable time step for explicit time stepping so value is calculated once rather than every time step.

Modified: short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Explicit.py	2012-10-05 17:16:46 UTC (rev 20804)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Explicit.py	2012-10-05 17:40:39 UTC (rev 20805)
@@ -85,6 +85,7 @@
     Formulation.__init__(self, name)
     ModuleExplicit.__init__(self)
     self._loggingPrefix = "TSEx "
+    self.dtStable = None
     return
 
 
@@ -277,6 +278,23 @@
     return
 
 
+  def getTimeStep(self):
+    """
+    Get stable time step for advancing forward in time. Use cached
+    value if available.
+
+    Assume stable time step depends only on initial elastic properties
+    and original mesh geometry.
+    """
+    logEvent = "%stimestep" % self._loggingPrefix
+    self._eventLogger.eventBegin(logEvent)
+
+    if self.dtStable is None:
+      self.dtStable = self.timeStep.timeStep(self.mesh, self.integratorsMesh + self.integratorsSubMesh)
+    self._eventLogger.eventEnd(logEvent)
+    return self.dtStable
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):



More information about the CIG-COMMITS mailing list