[cig-commits] r16645 - in short/3D/PyLith/trunk: . pylith/faults pylith/feassemble pylith/problems

brad at geodynamics.org brad at geodynamics.org
Wed May 5 12:20:18 PDT 2010


Author: brad
Date: 2010-05-05 12:20:18 -0700 (Wed, 05 May 2010)
New Revision: 16645

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/pylith/faults/Fault.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveTract.py
   short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
   short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
   short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
   short/3D/PyLith/trunk/pylith/problems/Explicit.py
   short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py
   short/3D/PyLith/trunk/pylith/problems/ExplicitLumpedTet4.py
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
   short/3D/PyLith/trunk/pylith/problems/Implicit.py
Log:
Cleanup of output routines. Refactor writeData() from poststep(). Write output at time t for explicit time stepping and output at t+dt for implicit time stepping.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/TODO	2010-05-05 19:20:18 UTC (rev 16645)
@@ -92,21 +92,6 @@
     * hex8
     * tet4
 
-Benchmarks
-  * static
-    + CVMH (big test)
-    + solvertest (for preconditioning)
-  * quasistatic
-    + scecsrustdeform
-      - strikeslipnog
-      - reversenog (not finished)
-      - reverseg (to be done)
-      - savageprescott
-  * dynamic
-    + scecdynrup
-    + performance
-      - halfspace_strikeslip (Eqsim v. PyLith)
-
 Write up description of Savage and Prescott (1978) benchmark and
 distribute to Greg Lyzenga and Jay Parker
 

Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -168,15 +168,28 @@
     return
 
 
-  def poststep(self, t, dt, totalTime, fields):
+  def poststep(self, t, dt, fields):
     """
     Hook for doing stuff after advancing time step.
     """
     logEvent = "%spoststep" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
 
+    self.updateStateVars(t, fields)
+
+    self._eventLogger.eventEnd(logEvent)
+    return
+
+
+  def writeData(self, t, fields):
+    """
+    Write data at time t.
+    """
+    logEvent = "%swrite" % self._loggingPrefix
+    self._eventLogger.eventBegin(logEvent)
+
     self._info.log("Writing fault data.")
-    self.output.writeData(t+dt, fields)
+    self.output.writeData(t, fields)
 
     self._eventLogger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -143,15 +143,15 @@
     return
 
 
-  def poststep(self, t, dt, totalTime, fields):
+  def poststep(self, t, dt, fields):
     """
     Hook for doing stuff after advancing time step.
     """
     logEvent = "%spoststep" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
 
-    Integrator.poststep(self, t, dt, totalTime, fields)
-    FaultCohesive.poststep(self, t, dt, totalTime, fields)
+    Integrator.poststep(self, t, dt, fields)
+    FaultCohesive.poststep(self, t, dt, fields)
 
     self._eventLogger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -155,15 +155,15 @@
     return
 
 
-  def poststep(self, t, dt, totalTime, fields):
+  def poststep(self, t, dt, fields):
     """
     Hook for doing stuff after advancing time step.
     """
     logEvent = "%spoststep" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
 
-    Integrator.poststep(self, t, dt, totalTime, fields)
-    FaultCohesive.poststep(self, t, dt, totalTime, fields)
+    Integrator.poststep(self, t, dt, fields)
+    FaultCohesive.poststep(self, t, dt, fields)
 
     self._eventLogger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveTract.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveTract.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveTract.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -133,15 +133,15 @@
     return
 
 
-  def poststep(self, t, dt, totalTime, fields):
+  def poststep(self, t, dt, fields):
     """
     Hook for doing stuff after advancing time step.
     """
     logEvent = "%spoststep" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
 
-    Integrator.poststep(self, t, dt, totalTime, fields)
-    FaultCohesive.poststep(self, t, dt, totalTime, fields)
+    Integrator.poststep(self, t, dt, fields)
+    FaultCohesive.poststep(self, t, dt, fields)
 
     self._eventLogger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Constraint.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/feassemble/Constraint.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -29,6 +29,7 @@
               "useSolnIncr",
               "setField",
               "poststep",
+              "writeData",
               "finalize"]
   for attr in required:
     if not attr in available:
@@ -61,13 +62,20 @@
     return
 
 
-  def poststep(self, t, dt, totalTime, fields):
+  def poststep(self, t, dt, fields):
     """
     Hook for doing stuff after advancing time step.
     """
     return
   
 
+  def writeData(self, t, fields):
+    """
+    Write data at time t.
+    """
+    return
+  
+
   def finalize(self):
     """
     Cleanup.
@@ -96,6 +104,7 @@
               "constraints",
               "setField",
               "poststep",
+              "write",
               "finalize"]
     for event in events:
       logger.registerEvent("%s%s" % (self._loggingPrefix, event))

Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -89,7 +89,7 @@
     return
 
 
-  def poststep(self, t, dt, totalTime, fields):
+  def poststep(self, t, dt, fields):
     """
     Hook for doing stuff after advancing time step.
     """
@@ -102,6 +102,17 @@
     return
 
 
+  def writeData(self, t, fields):
+    """
+    Hook for writing data at time t.
+    """
+    logEvent = "%swrite" % self._loggingPrefix
+    self._eventLogger.eventBegin(logEvent)
+
+    self._eventLogger.eventEnd(logEvent)
+    return
+
+
   def finalize(self):
     """
     Cleanup after time stepping.
@@ -126,6 +137,7 @@
               "verify",
               "init",
               "poststep",
+              "write",
               "finalize"]
     for event in events:
       logger.registerEvent("%s%s" % (self._loggingPrefix, event))

Modified: short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -92,17 +92,15 @@
     return
   
   
-  def poststep(self, t, dt, totalTime, fields):
+  def writeData(self, t, fields):
     """
-    Hook for doing stuff after advancing time step.
+    Hook for writing data at time t.
     """
-    logEvent = "%spoststep" % self._loggingPrefix
+    logEvent = "%swrite" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
 
-    Integrator.poststep(self, t, dt, totalTime, fields)
-
     self._info.log("Writing material data.")
-    self.output.writeData(t+dt, fields)
+    self.output.writeData(t, fields)
 
     self._eventLogger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -67,7 +67,7 @@
     logEvent = "%sinit" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
     
-    Formulation.initialize(self, dimension, normalizer)
+    self._initialize(dimension, normalizer)
 
     from pylith.utils.petsc import MemoryLogger
     logger = MemoryLogger.singleton()
@@ -162,12 +162,14 @@
     logEvent = "%spoststep" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
     
-    # Note that Formulation.poststep is primarily output, and since
-    # the velocity and acceleration at time t depends on the
+    # The velocity and acceleration at time t depends on the
     # displacement at time t+dt, we want to output BEFORE updating the
     # displacement fields so that the displacement, velocity, and
     # acceleration files are all at time t.
-    Formulation.poststep(self, t, dt)
+    self._info.log("Writing solution fields.")
+    for output in self.output.components():
+      output.writeData(t, self.fields)
+    self._writeData(t)
 
     # Update displacement field from time t to time t+dt.
     dispIncr = self.fields.get("dispIncr(t->t+dt)")
@@ -178,6 +180,9 @@
     dispT += dispIncr
     dispIncr.zero()
 
+    # Complete post-step processing.
+    Formulation.poststep(self, t, dt)
+
     self._eventLogger.eventEnd(logEvent)    
     return
 

Modified: short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -18,12 +18,12 @@
 ##
 ## Factory: pde_formulation
 
-from Formulation import Formulation
+from Explicit import Explicit
 from problems import Explicit as ModuleExplicit
 from pylith.utils.profiling import resourceUsageString
 
 # ExplicitLumped class
-class ExplicitLumped(Formulation, ModuleExplicit):
+class ExplicitLumped(Explicit, ModuleExplicit):
   """
   Python ExplicitLumped object for solving equations using an explicit
   formulation.
@@ -43,7 +43,7 @@
 
   # INVENTORY //////////////////////////////////////////////////////////
 
-  class Inventory(Formulation.Inventory):
+  class Inventory(Explicit.Inventory):
     """
     Python object for managing ExplicitLumped facilities and properties.
 
@@ -66,26 +66,17 @@
                                      factory=SolverLumped)
     solver.meta['tip'] = "Algebraic solver."
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def __init__(self, name="explicit"):
+  def __init__(self, name="explicitlumped"):
     """
     Constructor.
     """
-    Formulation.__init__(self, name)
-    ModuleExplicit.__init__(self)
-    self._loggingPrefix = "TSEx "
+    Explicit.__init__(self, name)
     return
 
 
-  def elasticityIntegrator(self):
-    """
-    Get integrator for elastic material.
-    """
-    from pylith.feassemble.ElasticityExplicit import ElasticityExplicit
-    return ElasticityExplicit()
-
-
   def initialize(self, dimension, normalizer):
     """
     Initialize problem for explicit time integration.
@@ -93,7 +84,7 @@
     logEvent = "%sinit" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
     
-    Formulation.initialize(self, dimension, normalizer)
+    self._initialize(dimension, normalizer)
 
     from pylith.utils.petsc import MemoryLogger
     logger = MemoryLogger.singleton()
@@ -144,75 +135,13 @@
     return
 
 
-  def prestep(self, t, dt):
-    """
-    Hook for doing stuff before advancing time step.
-    """
-    logEvent = "%sprestep" % self._loggingPrefix
-    self._eventLogger.eventBegin(logEvent)
-    
-    dispIncr = self.fields.get("dispIncr(t->t+dt)")
-    for constraint in self.constraints:
-      constraint.setFieldIncr(t, t+dt, dispIncr)
-
-    needNewJacobian = False
-    for integrator in self.integratorsMesh + self.integratorsSubMesh:
-      integrator.timeStep(dt)
-      if integrator.needNewJacobian():
-        needNewJacobian = True
-    if needNewJacobian:
-      self._reformJacobian(t, dt)
-
-    self._eventLogger.eventEnd(logEvent)
-    return
-
-
-  def step(self, t, dt):
-    """
-    Advance to next time step.
-    """
-    logEvent = "%sstep" % self._loggingPrefix
-    self._eventLogger.eventBegin(logEvent)
-
-    self._reformResidual(t, dt)
-    
-    self._info.log("Solving equations.")
-    residual = self.fields.get("residual")
-    dispIncr = self.fields.get("dispIncr(t->t+dt)")
-    self.solver.solve(dispIncr, self.jacobian, residual)
-
-    self._eventLogger.eventEnd(logEvent)
-    return
-
-
-  def poststep(self, t, dt):
-    """
-    Hook for doing stuff after advancing time step.
-    """
-    logEvent = "%spoststep" % self._loggingPrefix
-    self._eventLogger.eventBegin(logEvent)
-    
-    dispIncr = self.fields.get("dispIncr(t->t+dt)")
-    dispT = self.fields.get("disp(t)")
-    dispTmdt = self.fields.get("disp(t-dt)")
-
-    dispTmdt.copy(dispT)
-    dispT += dispIncr
-    dispIncr.zero()
-
-    Formulation.poststep(self, t, dt)
-
-    self._eventLogger.eventEnd(logEvent)    
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
     """
     Set members based using inventory.
     """
-    Formulation._configure(self)
+    Explicit._configure(self)
     self.solver = self.inventory.solver
     return
 

Modified: short/3D/PyLith/trunk/pylith/problems/ExplicitLumpedTet4.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/ExplicitLumpedTet4.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/problems/ExplicitLumpedTet4.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -47,7 +47,6 @@
     Constructor.
     """
     ExplicitLumped.__init__(self, name)
-    self._loggingPrefix = "TSEx "
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -172,97 +172,15 @@
 
     self._eventLogger.eventEnd(logEvent)
     return
-  
 
+
   def initialize(self, dimension, normalizer):
     """
-    Create integrators for each element family.
+    Initialize formulation.
     """
-    logEvent = "%sinit" % self._loggingPrefix
-    self._eventLogger.eventBegin(logEvent)
+    raise NotImplementedError("Please implement 'initialize' in derived class.")
+  
 
-    self.timeStep.initialize(normalizer)
-
-    numTimeSteps = self.timeStep.numTimeSteps()
-    totalTime = self.timeStep.totalTime
-
-    from pylith.topology.SolutionFields import SolutionFields
-    self.fields = SolutionFields(self.mesh)
-    self._debug.log(resourceUsageString())
-
-    self._info.log("Initializing integrators.")
-    for integrator in self.integratorsMesh + self.integratorsSubMesh:
-      if not self.gravityField is None:
-        integrator.gravityField(self.gravityField)
-      integrator.initialize(totalTime, numTimeSteps, normalizer)
-    ModuleFormulation.meshIntegrators(self, self.integratorsMesh)
-    ModuleFormulation.submeshIntegrators(self, self.integratorsSubMesh)
-    ModuleFormulation.initialize(self)
-    self._debug.log(resourceUsageString())
-
-    self._info.log("Initializing constraints.")
-    for constraint in self.constraints:
-      constraint.initialize(totalTime, numTimeSteps, normalizer)
-    self._debug.log(resourceUsageString())
-
-    self._info.log("Setting up solution output.")
-    for output in self.output.components():
-      output.initialize(self.mesh, normalizer)
-      output.writeInfo()
-      output.open(totalTime, numTimeSteps)
-    self._debug.log(resourceUsageString())
-
-    # Setup fields
-    self._info.log("Creating solution field.")
-    from pylith.utils.petsc import MemoryLogger
-    memoryLogger = MemoryLogger.singleton()
-    memoryLogger.setDebug(0)
-    memoryLogger.stagePush("Problem")
-    self.fields.add("dispIncr(t->t+dt)", "displacement_increment")
-    self.fields.add("disp(t)", "displacement")
-    self.fields.add("residual", "residual")
-    self.fields.solutionName("dispIncr(t->t+dt)")
-
-    lengthScale = normalizer.lengthScale()
-    solution = self.fields.get("dispIncr(t->t+dt)")
-    solution.vectorFieldType(solution.VECTOR)
-    solution.scale(lengthScale.value)
-    solution.newSection(solution.VERTICES_FIELD, dimension)
-    if self.splitFields:
-      solution.splitDefault()
-      for integrator in self.integratorsMesh + self.integratorsSubMesh:
-        integrator.splitField(solution)
-    for constraint in self.constraints:
-      constraint.setConstraintSizes(solution)
-    solution.allocate()
-    for constraint in self.constraints:
-      constraint.setConstraints(solution)
-    for integrator in self.integratorsMesh + self.integratorsSubMesh:
-      integrator.checkConstraints(solution)
-
-    memoryLogger.stagePop()
-
-    # This creates a global order
-    solution.createVector()
-    solution.createScatter()
-
-    memoryLogger.stagePush("Problem")
-    dispT = self.fields.get("disp(t)")
-    dispT.vectorFieldType(dispT.VECTOR)
-    dispT.scale(lengthScale.value)
-
-    residual = self.fields.get("residual")
-    residual.vectorFieldType(residual.VECTOR)
-    residual.scale(lengthScale.value)
-
-    memoryLogger.stagePop()
-    memoryLogger.setDebug(0)
-    self._debug.log(resourceUsageString())
-
-    self._eventLogger.eventEnd(logEvent)
-    return
-
-
   def getStartTime(self):
     """
     Get start time for simulation.
@@ -320,15 +238,10 @@
     logEvent = "%spoststep" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
 
-    totalTime = self.timeStep.totalTime
-
-    self._info.log("Writing solution fields.")
-    for output in self.output.components():
-      output.writeData(t+dt, self.fields)
     for integrator in self.integratorsMesh + self.integratorsSubMesh:
-      integrator.poststep(t, dt, totalTime, self.fields)
+      integrator.poststep(t, dt, self.fields)
     for constraint in self.constraints:
-      constraint.poststep(t, dt, totalTime, self.fields)
+      constraint.poststep(t, dt, self.fields)
 
     self._eventLogger.eventEnd(logEvent)
     return
@@ -465,6 +378,91 @@
     return
   
 
+  def _initialize(self, dimension, normalizer):
+    """
+    Create integrators for each element family.
+    """
+    self.timeStep.initialize(normalizer)
+
+    numTimeSteps = self.timeStep.numTimeSteps()
+    totalTime = self.timeStep.totalTime
+
+    from pylith.topology.SolutionFields import SolutionFields
+    self.fields = SolutionFields(self.mesh)
+    self._debug.log(resourceUsageString())
+
+    self._info.log("Initializing integrators.")
+    for integrator in self.integratorsMesh + self.integratorsSubMesh:
+      if not self.gravityField is None:
+        integrator.gravityField(self.gravityField)
+      integrator.initialize(totalTime, numTimeSteps, normalizer)
+    ModuleFormulation.meshIntegrators(self, self.integratorsMesh)
+    ModuleFormulation.submeshIntegrators(self, self.integratorsSubMesh)
+    ModuleFormulation.initialize(self)
+    self._debug.log(resourceUsageString())
+
+    self._info.log("Initializing constraints.")
+    for constraint in self.constraints:
+      constraint.initialize(totalTime, numTimeSteps, normalizer)
+    self._debug.log(resourceUsageString())
+
+    self._info.log("Setting up solution output.")
+    for output in self.output.components():
+      output.initialize(self.mesh, normalizer)
+      output.writeInfo()
+      output.open(totalTime, numTimeSteps)
+    self._debug.log(resourceUsageString())
+
+    # Setup fields
+    self._info.log("Creating solution field.")
+    from pylith.utils.petsc import MemoryLogger
+    memoryLogger = MemoryLogger.singleton()
+    memoryLogger.setDebug(0)
+    memoryLogger.stagePush("Problem")
+    self.fields.add("dispIncr(t->t+dt)", "displacement_increment")
+    self.fields.add("disp(t)", "displacement")
+    self.fields.add("residual", "residual")
+    self.fields.solutionName("dispIncr(t->t+dt)")
+
+    lengthScale = normalizer.lengthScale()
+    solution = self.fields.get("dispIncr(t->t+dt)")
+    solution.vectorFieldType(solution.VECTOR)
+    solution.scale(lengthScale.value)
+    solution.newSection(solution.VERTICES_FIELD, dimension)
+    if self.splitFields:
+      solution.splitDefault()
+      for integrator in self.integratorsMesh + self.integratorsSubMesh:
+        integrator.splitField(solution)
+    for constraint in self.constraints:
+      constraint.setConstraintSizes(solution)
+    solution.allocate()
+    for constraint in self.constraints:
+      constraint.setConstraints(solution)
+    for integrator in self.integratorsMesh + self.integratorsSubMesh:
+      integrator.checkConstraints(solution)
+
+    memoryLogger.stagePop()
+
+    # This creates a global order
+    solution.createVector()
+    solution.createScatter()
+
+    memoryLogger.stagePush("Problem")
+    dispT = self.fields.get("disp(t)")
+    dispT.vectorFieldType(dispT.VECTOR)
+    dispT.scale(lengthScale.value)
+
+    residual = self.fields.get("residual")
+    residual.vectorFieldType(residual.VECTOR)
+    residual.scale(lengthScale.value)
+
+    memoryLogger.stagePop()
+    memoryLogger.setDebug(0)
+    self._debug.log(resourceUsageString())
+
+    return
+
+
   def _reformJacobian(self, t, dt):
     """
     Reform Jacobian matrix for operator.
@@ -502,6 +500,22 @@
     return
 
 
+  def _writeData(self, t):
+    """
+    Write data for time t.
+    """
+    logEvent = "%swrite" % self._loggingPrefix
+    self._eventLogger.eventBegin(logEvent)
+
+    for integrator in self.integratorsMesh + self.integratorsSubMesh:
+      integrator.writeData(t, self.fields)
+    for constraint in self.constraints:
+      constraint.writeData(t, self.fields)
+
+    self._eventLogger.eventEnd(logEvent)
+    return
+
+
   def _setupLogging(self):
     """
     Setup event logging.
@@ -521,6 +535,7 @@
               "prestep",
               "step",
               "poststep",
+              "write",
               "finalize"]
     for event in events:
       logger.registerEvent("%s%s" % (self._loggingPrefix, event))

Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py	2010-05-05 19:16:17 UTC (rev 16644)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py	2010-05-05 19:20:18 UTC (rev 16645)
@@ -107,10 +107,11 @@
     """
     Initialize problem for implicit time integration.
     """
-    Formulation.initialize(self, dimension, normalizer)
-
     logEvent = "%sinit" % self._loggingPrefix
     self._eventLogger.eventBegin(logEvent)
+
+    self._initialize(dimension, normalizer)
+
     from pylith.utils.petsc import MemoryLogger
     memoryLogger = MemoryLogger.singleton()
     memoryLogger.setDebug(0)
@@ -233,8 +234,15 @@
     disp += dispIncr
     dispIncr.zero()
 
+    # Complete post-step processing, then write data.
     Formulation.poststep(self, t, dt)
 
+    # Write data.
+    self._info.log("Writing solution fields.")
+    for output in self.output.components():
+      output.writeData(t+dt, self.fields)
+    self._writeData(t+dt)
+
     self._stepCount += 1
     return
 



More information about the CIG-COMMITS mailing list