[cig-commits] r12831 - short/3D/PyLith/trunk/pylith/problems

brad at geodynamics.org brad at geodynamics.org
Tue Sep 9 09:05:35 PDT 2008


Author: brad
Date: 2008-09-09 09:05:34 -0700 (Tue, 09 Sep 2008)
New Revision: 12831

Modified:
   short/3D/PyLith/trunk/pylith/problems/Implicit.py
Log:
Fixed bug related to reforming Jacobian with nonuniform time stepping. Moved reforming Jacobian from poststep() to prestep().

Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py	2008-09-08 22:14:22 UTC (rev 12830)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py	2008-09-09 16:05:34 UTC (rev 12831)
@@ -72,7 +72,7 @@
     self._loggingPrefix = "TSIm "
     self.solnField = {'name': "dispTBctpdt",
                       'label': "displacements"}
-    self._step0 = None
+    self._stepCount = None
     return
 
 
@@ -116,7 +116,7 @@
     self._debug.log(resourceUsageString())
 
     # Initial time step solves for total displacement field, not increment
-    self._step0 = True
+    self._stepCount = 0
     for constraint in self.constraints:
       constraint.useSolnIncr(False)
     for integrator in self.integrators:
@@ -148,9 +148,21 @@
     for constraint in self.constraints:
       constraint.setField(t+dt, dispTBctpdt)
 
+    # If finishing first time step, then switch from solving for total
+    # displacements to solving for incremental displacements
+    if 1 == self._stepCount:
+      self._info.log("Switching from total field solution to incremental " \
+                     "field solution.")
+      for constraint in self.constraints:
+        constraint.useSolnIncr(True)
+      for integrator in self.integrators:
+        integrator.useSolnIncr(True)
+      self._reformJacobian(t, dt)
+
     ### NONLINEAR: Might want to move logic into IntegrateJacobian() and set a flag instead
     needNewJacobian = False
     for integrator in self.integrators:
+      integrator.timeStep(dt)
       if integrator.needNewJacobian():
         needNewJacobian = True
     if needNewJacobian:
@@ -210,15 +222,16 @@
 
     # If finishing first time step, then switch from solving for total
     # displacements to solving for incremental displacements
-    if self._step0 and (t + dt) < self.timeStep.totalTime:
-      self._info.log("Switching from total field solution to incremental " \
-                     "field solution.")
-      for constraint in self.constraints:
-        constraint.useSolnIncr(True)
-      for integrator in self.integrators:
-        integrator.useSolnIncr(True)
-      self._reformJacobian(t, dt)
-      self._step0 = False
+    #if self._step0 and (t + dt) < self.timeStep.totalTime:
+    #  self._info.log("Switching from total field solution to incremental " \
+    #                 "field solution.")
+    #  for constraint in self.constraints:
+    #    constraint.useSolnIncr(True)
+    #  for integrator in self.integrators:
+    #    integrator.useSolnIncr(True)
+    #  self._reformJacobian(t, dt)
+    #  self._step0 = False
+    self._stepCount += 1
 
     self._logger.eventEnd(logEvent)
     return



More information about the cig-commits mailing list