[cig-commits] r19538 - in short/3D/PyLith/branches/v1.6-stable/libsrc/pylith: faults feassemble friction materials meshio topology

brad at geodynamics.org brad at geodynamics.org
Tue Jan 31 16:29:20 PST 2012


Author: brad
Date: 2012-01-31 16:29:20 -0800 (Tue, 31 Jan 2012)
New Revision: 19538

Modified:
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/CohesiveTopology.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.icc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesive.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesive.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveDyn.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveDyn.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveLagrange.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/feassemble/IntegratorElasticity.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/FrictionModel.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/FrictionModel.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/RateStateAgeing.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/RateStateAgeing.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/SlipWeakening.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/SlipWeakening.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/StaticFriction.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/StaticFriction.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/TimeWeakening.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/TimeWeakening.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/materials/ElasticMaterial.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/materials/Material.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/CellFilterAvg.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/MeshBuilder.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/VertexFilterVecNorm.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/SubMesh.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/SubMesh.icc
Log:
Tweaks to friction implementation for quasi-static problems. More work on memory logging.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/CohesiveTopology.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/CohesiveTopology.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -51,7 +51,7 @@
 
   // Memory logging
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("FaultCreation");
+  logger.stagePush("xxFaultCohesiveCellsCreation");
 
   faultMesh->coordsys(mesh);
 
@@ -98,10 +98,10 @@
   fault->setSieve(faultSieve);
 
   logger.stagePop();
-  logger.stagePush("FaultStratification");
+  logger.stagePush("xxFaultCohesiveCellsStratification");
   fault->stratify();
   logger.stagePop();
-  logger.stagePush("FaultCreation");
+  logger.stagePush("xxFaultCohesiveCellsCreation");
   if (debug)
     fault->view("Fault mesh");
 
@@ -143,7 +143,7 @@
 
   // Memory logging
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("FaultCreation");
+  logger.stagePush("FaultCohesiveCellsCreation");
 
   const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
   assert(!sieveMesh.isNull());
@@ -212,7 +212,7 @@
 		<< vertexRenumber[*v_iter] << std::endl;
 
     logger.stagePop();
-    logger.stagePush("FaultStratification");
+    logger.stagePush("FaultCohesiveCellsStratification");
     // Add shadow and constraint vertices (if they exist) to group
     // associated with fault
     groupField->addPoint(firstFaultVertex, 1);
@@ -232,7 +232,7 @@
       ++firstLagrangeVertex;
     } // if
     logger.stagePop();
-    logger.stagePush("FaultCreation");
+    logger.stagePush("MeshIntSections");
 
     // Add shadow vertices to other groups, don't add constraint
     // vertices (if they exist) because we don't want BC, etc to act
@@ -246,13 +246,19 @@
       if (group->getFiberDimension(*v_iter))
         group->addPoint(firstFaultVertex, 1);
     } // for
+    logger.stagePop();
+    logger.stagePush("FaultCohesiveCellsCreation");
   } // for
+  logger.stagePop();
+  logger.stagePush("MeshIntSections");
   const std::set<std::string>::const_iterator namesEnd = groupNames->end();
   for(std::set<std::string>::const_iterator name = groupNames->begin();
       name != namesEnd;
       ++name) {
     sieveMesh->reallocate(sieveMesh->getIntSection(*name));
   } // for
+  logger.stagePop();
+  logger.stagePush("FaultCohesiveCellsCreation");
 
   // Split the mesh along the fault sieve and create cohesive elements
   const ALE::Obj<SieveSubMesh::label_sequence>& faces =
@@ -410,14 +416,14 @@
     // TODO: Need to reform the material label when sieve is reallocated
     sieveMesh->setValue(material, firstFaultCell, materialId);
     logger.stagePop();
-    logger.stagePush("FaultStratification");
+    logger.stagePush("FaultCohesiveCellsStratification");
 #if defined(FAST_STRATIFY)
     // OPTIMIZATION
     sieveMesh->setHeight(firstFaultCell, 0);
     sieveMesh->setDepth(firstFaultCell, 1);
 #endif
     logger.stagePop();
-    logger.stagePush("FaultCreation");
+    logger.stagePush("FaultCohesiveCellsCreation");
     sV2.clear();
     cV2.clear();
   } // for
@@ -606,10 +612,10 @@
     delete [] indices;
 #if !defined(FAST_STRATIFY)
   logger.stagePop();
-  logger.stagePush("FaultStratification");
+  logger.stagePush("FaultCohesiveCellsStratification");
   sieveMesh->stratify();
   logger.stagePop();
-  logger.stagePush("FaultCreation");
+  logger.stagePush("FaultCohesiveCellsCreation");
 #endif
   const std::string labelName("censored depth");
 
@@ -923,7 +929,7 @@
   } // if
 #endif
   
-#if 0 // DEBUGGING
+#if 1 // DEBUGGING
   sendParallelMeshOverlap->view("Send parallel fault overlap");
   recvParallelMeshOverlap->view("Recv parallel fault overlap");
 #endif

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -54,4 +54,44 @@
   return *_faultMesh;
 } // faultMesh
 
+
+// ----------------------------------------------------------------------
+// Get dimension of mesh.
+int
+pylith::faults::Fault::dimension(void) const
+{ // dimension
+  return (_faultMesh) ? _faultMesh->dimension() : 0;
+} // dimension
+
+
+// ----------------------------------------------------------------------
+// Get representative cone size for mesh.
+int
+pylith::faults::Fault::coneSize(void) const
+{ // coneSize
+  
+  return (_faultMesh && numCells() > 0) ? 
+    _faultMesh->sieveMesh()->getSieve()->getConeSize(*_faultMesh->sieveMesh()->heightStratum(1)->begin()) : 0;
+} // coneSize
+
+
+// ----------------------------------------------------------------------
+// Get number of vertices in mesh.
+int
+pylith::faults::Fault::numVertices(void) const
+{ // numVertices
+  return (_faultMesh) ? _faultMesh->numVertices() : 0;
+} // numVertices
+
+
+// ----------------------------------------------------------------------
+// Get number of cells in mesh.
+int
+pylith::faults::Fault::numCells(void) const
+{ // numCells
+  return (_faultMesh && !_faultMesh->sieveMesh().isNull() && _faultMesh->sieveMesh()->height() > 0) ? 
+    _faultMesh->sieveMesh()->heightStratum(1)->size() : 0;
+} // numCells
+
+
 // End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -85,13 +85,38 @@
    */
   const char* label(void) const;
 
-  /** Get the number of vertices on the fault.
+  /** Get dimension of mesh.
    *
+   * @returns Dimension of mesh.
+   */
+  int dimension(void) const;
+
+  /** Get representative cone size for mesh.
+   *
+   * @returns Representative cone size for mesh.
+   */
+  int coneSize(void) const;
+  
+  /** Get number of vertices in mesh.
+   *
+   * @returns Number of vertices in mesh.
+   */
+  int numVertices(void) const;
+  
+  /** Get number of cells in mesh.
+   *
+   * @returns Number of cells in mesh.
+   */
+  int numCells(void) const;
+
+  /** Get the number of vertices associated with the fault (before
+   * fault mesh exists).
+   *
    * @param mesh PETSc mesh
    * @return Number of vertices on the fault.
    */
   virtual
-  int numVertices(const topology::Mesh& mesh) const = 0;
+  int numVerticesNoMesh(const topology::Mesh& mesh) const = 0;
 
   /** Adjust mesh topology for fault implementation.
    *

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.icc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.icc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/Fault.icc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -48,5 +48,4 @@
   return _label.c_str();
 }
 
-
 // End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesive.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesive.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesive.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -78,10 +78,11 @@
 } // faultMeshFilename
 
 // ----------------------------------------------------------------------
-// Get number of vertices in fault.
+// Get the number of vertices associated with the fault (before
+// fault mesh exists).
 int
-pylith::faults::FaultCohesive::numVertices(const topology::Mesh& mesh) const
-{ // numVertices
+pylith::faults::FaultCohesive::numVerticesNoMesh(const topology::Mesh& mesh) const
+{ // numVerticesNoMesh
   int nvertices = 0;
 
   if (!_useFaultMesh) {
@@ -105,7 +106,7 @@
   } // else
 
   return nvertices;
-} // numVertices
+} // numVerticesNoMesh
 
 // ----------------------------------------------------------------------
 // Adjust mesh topology for fault implementation.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesive.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesive.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesive.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -74,12 +74,13 @@
    */
   void faultMeshFilename(const char* filename);
 
-  /** Get the number of vertices on the fault.
+  /** Get the number of vertices associated with the fault (before
+   * fault mesh exists).
    *
    * @param mesh PETSc mesh
    * @return Number of vertices on the fault.
    */
-  int numVertices(const topology::Mesh& mesh) const;
+  int numVerticesNoMesh(const topology::Mesh& mesh) const;
 
   /** Adjust mesh topology for fault implementation.
    *

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveDyn.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveDyn.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -149,6 +149,9 @@
   const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();
   assert(0 != cs);
 
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.stagePush("FaultFields");
+
   // Create field for relative velocity associated with Lagrange vertex k
   _fields->add("relative velocity", "relative_velocity");
   topology::Field<topology::SubMesh>& velRel = 
@@ -158,7 +161,7 @@
   velRel.vectorFieldType(topology::FieldBase::VECTOR);
   velRel.scale(_normalizer->lengthScale() / _normalizer->timeScale());
 
-  //logger.stagePop();
+  logger.stagePop();
 } // initialize
 
 // ----------------------------------------------------------------------
@@ -507,6 +510,13 @@
      const double_array&,
      const double_array&,
      const bool);
+  /// Member prototype for _constrainSolnSpaceImproveXD()
+  typedef void (pylith::faults::FaultCohesiveDyn::*constrainSolnSpaceImprove_fn_type)
+    (double_array*,
+     double_array*,
+     const double_array&,
+     const double_array&,
+     const double_array&);
 
   assert(0 != fields);
   assert(0 != _quadrature);
@@ -523,17 +533,15 @@
   const int indexN = spaceDim - 1;
 
   // Allocate arrays for vertex values
-  double_array tractionTpdtVertex(spaceDim);
-  double_array dTractionTpdtVertex(spaceDim);
-  double_array dDispRelVertex(spaceDim);
 
   // Get sections
-  double_array slipTpdtVertex(spaceDim);
+  double_array dDispRelVertex(spaceDim); // global coordinates
+  double_array slipTpdtVertex(spaceDim); // fault coordinates
   const ALE::Obj<RealSection>& dispRelSection = 
     _fields->get("relative disp").section();
   assert(!dispRelSection.isNull());
 
-  double_array slipRateVertex(spaceDim);
+  double_array slipRateVertex(spaceDim); // fault coordinates
   const ALE::Obj<RealSection>& velRelSection =
       _fields->get("relative velocity").section();
   assert(!velRelSection.isNull());
@@ -545,31 +553,39 @@
   const ALE::Obj<RealSection>& dispTSection = fields->get("disp(t)").section();
   assert(!dispTSection.isNull());
 
-  double_array dDispTIncrVertexN(spaceDim);
-  double_array dDispTIncrVertexP(spaceDim);
+  double_array dDispTIncrVertexN(spaceDim); // global coordinates
+  double_array dDispTIncrVertexP(spaceDim); // global coordinates
   const ALE::Obj<RealSection>& dispIncrSection =
       fields->get("dispIncr(t->t+dt)").section();
   assert(!dispIncrSection.isNull());
 
-  double_array dLagrangeTpdtVertex(spaceDim);
-  double_array dLagrangeTpdtVertexGlobal(spaceDim);
+  double_array tractionTpdtVertex(spaceDim); // fault coordinates
+  double_array dTractionTpdtVertex(spaceDim); // fault coordinates
+  double_array dLagrangeTpdtVertex(spaceDim); // global coordinates
   const ALE::Obj<RealSection>& dLagrangeTpdtSection =
       _fields->get("sensitivity dLagrange").section();
   assert(!dLagrangeTpdtSection.isNull());
 
   constrainSolnSpace_fn_type constrainSolnSpaceFn;
+  constrainSolnSpaceImprove_fn_type constrainSolnSpaceImproveFn;
   switch (spaceDim) { // switch
   case 1:
     constrainSolnSpaceFn = 
       &pylith::faults::FaultCohesiveDyn::_constrainSolnSpace1D;
+    constrainSolnSpaceImproveFn = 
+      &pylith::faults::FaultCohesiveDyn::_constrainSolnSpaceImprove1D;
     break;
   case 2: 
     constrainSolnSpaceFn = 
       &pylith::faults::FaultCohesiveDyn::_constrainSolnSpace2D;
+    constrainSolnSpaceImproveFn = 
+      &pylith::faults::FaultCohesiveDyn::_constrainSolnSpaceImprove2D;
     break;
   case 3:
     constrainSolnSpaceFn = 
       &pylith::faults::FaultCohesiveDyn::_constrainSolnSpace3D;
+    constrainSolnSpaceImproveFn = 
+      &pylith::faults::FaultCohesiveDyn::_constrainSolnSpaceImprove3D;
     break;
   default :
     assert(0);
@@ -696,25 +712,25 @@
 
     // Use fault constitutive model to compute traction associated with
     // friction.
-    dLagrangeTpdtVertex = 0.0;
+    dTractionTpdtVertex = 0.0;
     const bool iterating = true; // Iterating to get friction
     CALL_MEMBER_FN(*this,
-		   constrainSolnSpaceFn)(&dLagrangeTpdtVertex,
+		   constrainSolnSpaceFn)(&dTractionTpdtVertex,
 					 slipTpdtVertex, slipRateVertex,
 					 tractionTpdtVertex,
 					 iterating);
 
     // Rotate increment in traction back to global coordinate system.
-    dLagrangeTpdtVertexGlobal = 0.0;
+    dLagrangeTpdtVertex = 0.0;
     for (int iDim=0; iDim < spaceDim; ++iDim) {
       for (int jDim=0; jDim < spaceDim; ++jDim) {
-	dLagrangeTpdtVertexGlobal[iDim] += 
-	  orientationVertex[jDim*spaceDim+iDim] * dLagrangeTpdtVertex[jDim];
+	dLagrangeTpdtVertex[iDim] += 
+	  orientationVertex[jDim*spaceDim+iDim] * dTractionTpdtVertex[jDim];
       } // for
 
       // Add in potential contribution from adjusting Lagrange
       // multiplier for fault normal DOF of trial solution in Step 1.
-      dLagrangeTpdtVertexGlobal[iDim] += 
+      dLagrangeTpdtVertex[iDim] += 
 	orientationVertex[indexN*spaceDim+iDim] * dTractionTpdtVertexNormal;
     } // for
 
@@ -726,7 +742,7 @@
     std::cout << ",  slipRateVertex: ";
     for (int iDim=0; iDim < spaceDim; ++iDim)
       std::cout << "  " << slipRateVertex[iDim];
-    std::cout << ",  tractionVertex: ";
+    std::cout << ",  tractionTpdtVertex: ";
     for (int iDim=0; iDim < spaceDim; ++iDim)
       std::cout << "  " << tractionTpdtVertex[iDim];
     std::cout << ",  lagrangeTVertex: ";
@@ -735,19 +751,19 @@
     std::cout << ",  lagrangeTIncrVertex: ";
     for (int iDim=0; iDim < spaceDim; ++iDim)
       std::cout << "  " << lagrangeTIncrVertex[iDim];
+    std::cout << ",  dTractionTpdtVertex: ";
+    for (int iDim=0; iDim < spaceDim; ++iDim)
+      std::cout << "  " << dTractionTpdtVertex[iDim];
     std::cout << ",  dLagrangeTpdtVertex: ";
     for (int iDim=0; iDim < spaceDim; ++iDim)
       std::cout << "  " << dLagrangeTpdtVertex[iDim];
-    std::cout << ",  dLagrangeTpdtVertexGlobal: ";
-    for (int iDim=0; iDim < spaceDim; ++iDim)
-      std::cout << "  " << dLagrangeTpdtVertexGlobal[iDim];
     std::cout << std::endl;
 #endif
      
     // Set change in Lagrange multiplier
-    assert(dLagrangeTpdtVertexGlobal.size() ==
+    assert(dLagrangeTpdtVertex.size() ==
         dLagrangeTpdtSection->getFiberDimension(v_fault));
-    dLagrangeTpdtSection->updatePoint(v_fault, &dLagrangeTpdtVertexGlobal[0]);
+    dLagrangeTpdtSection->updatePoint(v_fault, &dLagrangeTpdtVertex[0]);
 
     // Update displacement in trial solution (if necessary) so that it
     // conforms to physical constraints.
@@ -933,28 +949,40 @@
       dSlipTpdtVertex[indexN] = -slipTpdtVertex[indexN];
     } // if
 
-    // Prevent over-correction in slip resulting in backslip.
+
+    // Improve estimate of slip and change in traction using dFriction/dD.
+    // Get friction properties and state variables.
+    _friction->retrievePropsStateVars(v_fault);
+
+    CALL_MEMBER_FN(*this,
+		   constrainSolnSpaceImproveFn)(&dTractionTpdtVertex, &dSlipTpdtVertex,
+						slipTVertex, slipTpdtVertex,
+						tractionTpdtVertex);
+
+#if 0 // OBSOLETE? Move to ImproveFn?
+    // Prevent over-correction in slip resulting in backslip
     double slipDot = 0.0;
     double tractionSlipDot = 0.0;
-
-    // :TODO:
-    //
-    // Need slipTVertex, slipTpdtVertex, dSlipTpdtVertex
-    // slipDot = (slipTpdtVertex - slipTVertex) dot dSlipVertex
-    //
-    // if slipDot < 0, dSlipVertex = -0.5*(slipTpdtVertex - slipTVertex)
-    
     for (int iDim=0; iDim < spaceDim-1; ++iDim)  { // :TODO: Optimize this
-      slipDot += (slipTpdtVertex[iDim] - slipTVertex[iDim]) * (slipTpdtVertex[iDim] + dSlipTpdtVertex[iDim] - slipTVertex[iDim]);
+      // Compute dot product between slip and increment in slip (want positive)
+      slipDot += 
+	(slipTpdtVertex[iDim] - slipTVertex[iDim]) * 
+	(slipTpdtVertex[iDim] + dSlipTpdtVertex[iDim] - slipTVertex[iDim]);
+      // Compute dot product of traction and slip
       tractionSlipDot += (tractionTpdtVertex[iDim] + dTractionTpdtVertex[iDim])
 	* (slipTpdtVertex[iDim] + dSlipTpdtVertex[iDim]);
     } // for
-    if (slipDot < 0.0 && tractionSlipDot < 0.0) {
+    if (slipDot < 0.0 &&
+	sqrt(fabs(slipDot)) > _zeroTolerance && 
+	tractionSlipDot < 0.0) {
+      // Correct backslip
       dTractionTpdtVertex *= 0.5; // Use bisection as guess for traction
       for (int iDim=0; iDim < spaceDim-1; ++iDim) {
-	dSlipTpdtVertex[iDim] *= -0.5*(slipTpdtVertex[iDim] - slipTVertex[iDim]);
+	// Use bisection for slip
+	dSlipTpdtVertex[iDim] = 0.5*(slipTVertex[iDim] - slipTpdtVertex[iDim]);
       } // for
-    } // if
+    } // if/else
+#endif
     
     // Update current estimate of slip from t to t+dt.
     slipTpdtVertex += dSlipTpdtVertex;
@@ -985,20 +1013,12 @@
     std::cout << ", dTractionTpdtVertex: ";
     for (int iDim=0; iDim < spaceDim; ++iDim)
       std::cout << "  " << dTractionTpdtVertex[iDim];
-    //std::cout << ", dLagrangeTpdtVertex: ";
-    //for (int iDim=0; iDim < spaceDim; ++iDim)
-    //  std::cout << "  " << dLagrangeTpdtVertex[iDim];
     std::cout << ", slipTpdtVertex: ";
     for (int iDim=0; iDim < spaceDim; ++iDim)
-      std::cout << "  " << slipTpdtVertex[iDim];
+      std::cout << "  " << slipTpdtVertex[iDim]-dSlipTpdtVertex[iDim];
     std::cout << ",  dSlipTpdtVertex: ";
     for (int iDim=0; iDim < spaceDim; ++iDim)
       std::cout << "  " << dSlipTpdtVertex[iDim];
-    //std::cout << ",  dDispRelVertex: ";
-    //for (int iDim=0; iDim < spaceDim; ++iDim)
-    //  std::cout << "  " << dDispRelVertex[iDim];
-    std::cout << ", slipDot: " << slipDot
-	      << ", tractionSlipDot: " << tractionSlipDot;
     std::cout << std::endl;
 #endif
 
@@ -1665,13 +1685,13 @@
   const ALE::Obj<RealSection>& tractionsSection = tractions->section();
   if (tractionsSection.isNull()) {
     ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-    //logger.stagePush("Fault");
+    logger.stagePush("FaultFields");
 
     const topology::Field<topology::SubMesh>& dispRel = 
       _fields->get("relative disp");
     tractions->cloneSection(dispRel);
 
-    //logger.stagePop();
+    logger.stagePop();
   } // if
   const double pressureScale = _normalizer->pressureScale();
   tractions->label("traction");
@@ -2192,13 +2212,13 @@
 // ----------------------------------------------------------------------
 // Constrain solution space in 1-D.
 void
-pylith::faults::FaultCohesiveDyn::_constrainSolnSpace1D(double_array* dLagrangeTpdt,
+pylith::faults::FaultCohesiveDyn::_constrainSolnSpace1D(double_array* dTractionTpdt,
          const double_array& slip,
          const double_array& sliprate,
 	 const double_array& tractionTpdt,
 	 const bool iterating)
 { // _constrainSolnSpace1D
-  assert(0 != dLagrangeTpdt);
+  assert(0 != dTractionTpdt);
 
   if (fabs(slip[0]) < _zeroTolerance) {
     // if compression, then no changes to solution
@@ -2206,7 +2226,7 @@
     // if tension, then traction is zero.
     
     const double dlp = -tractionTpdt[0];
-    (*dLagrangeTpdt)[0] = dlp;
+    (*dTractionTpdt)[0] = dlp;
   } // else
   
   PetscLogFlops(2);
@@ -2215,13 +2235,13 @@
 // ----------------------------------------------------------------------
 // Constrain solution space in 2-D.
 void
-pylith::faults::FaultCohesiveDyn::_constrainSolnSpace2D(double_array* dLagrangeTpdt,
+pylith::faults::FaultCohesiveDyn::_constrainSolnSpace2D(double_array* dTractionTpdt,
          const double_array& slip,
          const double_array& slipRate,
 	 const double_array& tractionTpdt,
 	 const bool iterating)
 { // _constrainSolnSpace2D
-  assert(0 != dLagrangeTpdt);
+  assert(dTractionTpdt);
 
   const double slipMag = fabs(slip[0]);
   const double slipRateMag = fabs(slipRate[0]);
@@ -2242,11 +2262,9 @@
 	// versus friction
 	const double dlp = -(tractionShearMag - frictionStress) *
 	  tractionTpdt[0] / tractionShearMag;
-	(*dLagrangeTpdt)[0] = dlp;
-	(*dLagrangeTpdt)[1] = 0.0;
+	(*dTractionTpdt)[0] = dlp;
       } else {
-	(*dLagrangeTpdt)[0] = -(*dLagrangeTpdt)[0];
-	(*dLagrangeTpdt)[1] = 0.0;
+	// No shear stress and no friction.
       } // if/else
     } else {
       // friction exceeds value necessary to stick
@@ -2257,8 +2275,8 @@
     } // if/else
   } else {
     // if in tension, then traction is zero.
-    (*dLagrangeTpdt)[0] = -tractionTpdt[0];
-    (*dLagrangeTpdt)[1] = -tractionTpdt[1];
+    (*dTractionTpdt)[0] = -tractionTpdt[0];
+    (*dTractionTpdt)[1] = -tractionTpdt[1];
   } // else
 
   PetscLogFlops(8);
@@ -2267,13 +2285,13 @@
 // ----------------------------------------------------------------------
 // Constrain solution space in 3-D.
 void
-pylith::faults::FaultCohesiveDyn::_constrainSolnSpace3D(double_array* dLagrangeTpdt,
+pylith::faults::FaultCohesiveDyn::_constrainSolnSpace3D(double_array* dTractionTpdt,
          const double_array& slip,
          const double_array& slipRate,
 	 const double_array& tractionTpdt,
 	 const bool iterating)
 { // _constrainSolnSpace3D
-  assert(0 != dLagrangeTpdt);
+  assert(dTractionTpdt);
 
   const double slipShearMag = sqrt(slip[0] * slip[0] +
              slip[1] * slip[1]);
@@ -2302,13 +2320,10 @@
 	const double dlq = -(tractionShearMag - frictionStress) * 
 	  tractionTpdt[1] / tractionShearMag;
 	
-	(*dLagrangeTpdt)[0] = dlp;
-	(*dLagrangeTpdt)[1] = dlq;
-	(*dLagrangeTpdt)[2] = 0.0;
+	(*dTractionTpdt)[0] = dlp;
+	(*dTractionTpdt)[1] = dlq;
       } else {
-	(*dLagrangeTpdt)[0] = -(*dLagrangeTpdt)[0];
-	(*dLagrangeTpdt)[0] = -(*dLagrangeTpdt)[0];
-	(*dLagrangeTpdt)[2] = 0.0;
+	// No shear stress and no friction.
       } // if/else	
       
     } else {
@@ -2320,13 +2335,329 @@
     } // if/else
   } else {
     // if in tension, then traction is zero.
-    (*dLagrangeTpdt)[0] = -tractionTpdt[0];
-    (*dLagrangeTpdt)[1] = -tractionTpdt[1];
-    (*dLagrangeTpdt)[2] = -tractionTpdt[2];
+    (*dTractionTpdt)[0] = -tractionTpdt[0];
+    (*dTractionTpdt)[1] = -tractionTpdt[1];
+    (*dTractionTpdt)[2] = -tractionTpdt[2];
   } // else
 
   PetscLogFlops(22);
 } // _constrainSolnSpace3D
 
 
+// ----------------------------------------------------------------------
+// Constrain solution space in 1-D.
+void
+pylith::faults::FaultCohesiveDyn::_constrainSolnSpaceImprove1D(
+	 double_array* dTractionTpdt,
+	 double_array* dSlipTpdt,
+         const double_array& slipT,
+         const double_array& slipTpdt,
+	 const double_array& tractionTpdt)
+{ // _constrainSolnSpaceImprove3D
+  assert(dTractionTpdt);
+  assert(dSlipTpdt);
+
+  // Improving slip estimate only applies in shear. Do nothing.
+
+  PetscLogFlops(0); // :TODO: Update this.
+} // _constrainSolnSpaceImprove1D
+
+
+// ----------------------------------------------------------------------
+// Constrain solution space in 3-D.
+void
+pylith::faults::FaultCohesiveDyn::_constrainSolnSpaceImprove2D(
+	 double_array* dTractionTpdt,
+	 double_array* dSlipTpdt,
+         const double_array& slipT,
+         const double_array& slipTpdt,
+	 const double_array& tractionTpdt)
+{ // _constrainSolnSpaceImprove2D
+  assert(dTractionTpdt);
+  assert(dSlipTpdt);
+
+#if 1 // DEBUGGING
+  std::cout << "BEFORE improvement"
+	    << ", dTractionTpdt:";
+  for (int i=0; i < 2; ++i)
+    std::cout << "  " << (*dTractionTpdt)[i];
+  std::cout << ", dSlipTpdt:";
+  for (int i=0; i < 2; ++i)
+    std::cout << "  " << (*dSlipTpdt)[i];
+  std::cout << std::endl;
+#endif
+
+  // Compute magnitude of slip and slip rate (with current increment).
+  const double slipShearMag = fabs(slipTpdt[0]);
+  const double slipShearNewMag = fabs(slipTpdt[0]+(*dSlipTpdt)[0]);
+  const double slipRateMag = fabs(slipTpdt[0]-slipT[0]) / _dt;
+  const double dSlipShearNewMag = fabs((*dSlipTpdt)[0]);
+
+  const double tractionNormal = tractionTpdt[1];
+
+  // Friction stress for old estimate of slip is tractionTpdt +
+  // dTractionTpdt.
+  const double frictionStress = 
+    fabs(tractionTpdt[0]+(*dTractionTpdt)[0]);
+  const double tractionShearMag = fabs(tractionTpdt[0]);
+  
+  if (fabs(slipTpdt[1] + (*dSlipTpdt)[1]) < _zeroTolerance &&
+      tractionNormal < -_zeroTolerance &&
+      dSlipShearNewMag > 0.0) {
+    // if in compression and no opening, and changing slip
+
+    // Calculate slope (Jacobian) of friction at slip before adding
+    // new increment.
+    const double slopeF = 
+      _friction->calcFrictionSlope(slipShearMag, slipRateMag, tractionNormal);
+
+#if 0 // linear space
+    const double slopeT = 
+      (frictionStress - tractionShearMag) / dSlipShearNewMag;
+
+    // Set adjustments to increments to original increments as default.
+    double dSlipShearNew2Mag = dSlipShearNewMag;
+    double dTractionShearNew2Mag = frictionStress - tractionShearMag;
+    if (slopeF > 0.0 && tractionShearMag > frictionStress) {
+      // Strengthening, so reduce increment in slip
+      dSlipShearNew2Mag = 
+	(tractionShearMag - frictionStress) / (slopeF-slopeT));
+      dTractionShearNew2Mag += slopeF * dSlipShearNew2Mag;
+    } // if
+    // Ignore other cases, because slip will exceed estimate based on
+    // elasticity
+
+#else // log space
+
+    const double slopeT = (frictionStress - tractionShearMag) / 
+      (log(slipShearNewMag) - log(slipShearMag));
+    
+    // Set adjustments to increments to original increments as default.
+    double dSlipShearNew2Mag = dSlipShearNewMag;
+    double dTractionShearNew2Mag = frictionStress - tractionShearMag;
+    if (slopeF > 0.0 && tractionShearMag > frictionStress) {
+      // Strengthening, so reduce increment in slip
+      const double slipShearMagEff = std::max(slipShearMag, _zeroTolerance);
+      dSlipShearNew2Mag = slipShearMagEff * 
+	(-1.0 + exp((tractionShearMag - frictionStress) / (slopeF-slopeT)));
+      dTractionShearNew2Mag += 
+	slopeF * log((slipShearMagEff + dSlipShearNew2Mag)/slipShearMagEff);
+
+    } // if
+    // Ignore other cases, because slip will exceed estimate based on
+    // elasticity
+#endif
+    
+    // Project slip and traction into vector components
+    (*dSlipTpdt)[0] *= dSlipShearNew2Mag / dSlipShearNewMag;
+
+    const double dTractionTpdtMag = fabs((*dTractionTpdt)[0]);
+    assert(dTractionTpdtMag > 0.0);
+    (*dTractionTpdt)[0] *= fabs(dTractionShearNew2Mag) / dTractionTpdtMag;
+
+    // Prevent over-correction in slip resulting in backslip.
+    // Expect slip direction to match tractions
+
+    // Compute dot product between slip and increment in slip (want positive)
+    const double slipDot = 
+      (slipTpdt[0] - slipT[0]) * (slipTpdt[0] + (*dSlipTpdt)[0] - slipT[0]);
+    // Compute dot product of traction and slip
+    const double tractionSlipDot = 
+      (tractionTpdt[0] + (*dTractionTpdt)[0]) * (slipTpdt[0] + (*dSlipTpdt)[0]);
+    if (slipDot < 0.0 &&
+	sqrt(fabs(slipDot)) > _zeroTolerance && 
+	tractionSlipDot < 0.0) {
+      // Correct backslip
+      (*dTractionTpdt)[0] *= 0.5; // Use bisection as guess for traction
+      // Use bisection for slip
+#if 0 // linear space
+      (*dSlipTpdt)[0] = 0.5*(slipT[0] - slipTpdt[0]);
+#else // log space
+      assert(slipT[0] * slipTpdt[0] > 0.0);
+      (*dSlipTpdt)[0] *= sqrt(slipT[0] * slipTpdt[0]) / dSlipShearNew2Mag;
+#endif
+    } // if/else
+
+#if 1 // DEBUGGING
+  std::cout << "AFTER improvement"
+	    << ", dTractionTpdt:";
+  for (int i=0; i < 2; ++i)
+    std::cout << "  " << (*dTractionTpdt)[i];
+  std::cout << ", dSlipTpdt:";
+  for (int i=0; i < 2; ++i)
+    std::cout << "  " << (*dSlipTpdt)[i];
+  std::cout << ", frictionStress: " << frictionStress
+	    << ", tractionShearMag: " << tractionShearMag
+	    << ", slopeF: " << slopeF
+	    << ", slopeT: " << slopeT
+	    << std::endl;
+#endif
+
+  } // if
+
+  PetscLogFlops(0); // :TODO: Update this.
+
+
+} // _constrainSolnSpaceImprove2D
+
+
+// ----------------------------------------------------------------------
+// Constrain solution space in 3-D.
+void
+pylith::faults::FaultCohesiveDyn::_constrainSolnSpaceImprove3D(
+	 double_array* dTractionTpdt,
+	 double_array* dSlipTpdt,
+         const double_array& slipT,
+         const double_array& slipTpdt,
+	 const double_array& tractionTpdt)
+{ // _constrainSolnSpaceImprove3D
+  assert(dTractionTpdt);
+  assert(dSlipTpdt);
+ 
+#if 1 // DEBUGGING
+  std::cout << "BEFORE improvement"
+	    << ", dTractionTpdt:";
+  for (int i=0; i < 2; ++i)
+    std::cout << "  " << (*dTractionTpdt)[i];
+  std::cout << ", dSlipTpdt:";
+  for (int i=0; i < 2; ++i)
+    std::cout << "  " << (*dSlipTpdt)[i];
+  std::cout << std::endl;
+#endif
+
+ // Compute magnitude of slip and slip rate (with current increment).
+  const double slipShearMag = 
+    sqrt(slipTpdt[0]*slipTpdt[0] +
+	 slipTpdt[1]*slipTpdt[1]);
+  const double slipShearNewMag = 
+    sqrt(pow(slipTpdt[0]+(*dSlipTpdt)[0], 2) +
+	 pow(slipTpdt[1]+(*dSlipTpdt)[1], 2));
+  const double slipRateMag = 
+    sqrt(pow(slipTpdt[0]-slipT[0], 2) +
+	 pow(slipTpdt[1]-slipT[1], 2)) / _dt;
+  const double dSlipShearNewMag = 
+    sqrt(pow((*dSlipTpdt)[0], 2) +
+	 pow((*dSlipTpdt)[1], 2));
+
+    // Friction stress for old estimate of slip is tractionTpdt +
+    // dTractionTpdt.
+    const double frictionStress = 
+      sqrt(pow(tractionTpdt[0]+(*dTractionTpdt)[0], 2) +
+	   pow(tractionTpdt[1]+(*dTractionTpdt)[1], 2));
+    const double tractionShearMag = 
+      sqrt(tractionTpdt[0]*tractionTpdt[0] +
+	   tractionTpdt[1]*tractionTpdt[1]);
+
+  const double tractionNormal = tractionTpdt[2] + (*dTractionTpdt)[2];
+
+  if (fabs(slipTpdt[2] + (*dSlipTpdt)[2]) < _zeroTolerance &&
+      tractionNormal < -_zeroTolerance &&
+      dSlipShearNewMag > 0.0) {
+    // if in compression and no opening, and changing slip
+
+    // Calculate slope (Jacobian) of friction at slip before adding
+    // new increment.
+    const double slopeF = 
+      _friction->calcFrictionSlope(slipShearMag, slipRateMag, tractionNormal);
+
+#if 0 // linear space
+    const double slopeT = 
+      (frictionStress - tractionShearMag) / dSlipShearNewMag;
+
+    // Set adjustments to increments to original increments as default.
+    double dSlipShearNew2Mag = dSlipShearNewMag;
+    double dTractionShearNew2Mag = frictionStress - tractionShearMag;
+    if (slopeF > 0.0 && tractionShearMag > frictionStress) {
+      // Strengthening, so reduce increment in slip
+      dSlipShearNew2Mag = 
+	(tractionShearMag - frictionStress) / (slopeF-slopeT));
+      dTractionShearNew2Mag += slopeF * dSlipShearNew2Mag;
+    } // if
+    // Ignore other cases, because slip will exceed estimate based on
+    // elasticity
+
+#else // log space
+
+    const double slopeT = (frictionStress - tractionShearMag) / 
+      (log(slipShearNewMag) - log(slipShearMag));
+    
+    // Set adjustments to increments to original increments as default.
+    double dSlipShearNew2Mag = dSlipShearNewMag;
+    double dTractionShearNew2Mag = frictionStress - tractionShearMag;
+    if (slopeF > 0.0 && tractionShearMag > frictionStress) {
+      // Strengthening, so reduce increment in slip
+      const double slipShearMagEff = std::max(slipShearMag, _zeroTolerance);
+      dSlipShearNew2Mag = slipShearMagEff * 
+	(-1.0 + exp((tractionShearMag - frictionStress) / (slopeF-slopeT)));
+      dTractionShearNew2Mag += 
+	slopeF * log((slipShearMagEff + dSlipShearNew2Mag)/slipShearMagEff);
+
+    } // if
+    // Ignore other cases, because slip will exceed estimate based on
+    // elasticity
+#endif
+    
+    // Project slip and traction into vector components
+    // keeping same direction as original
+    (*dSlipTpdt)[0] *= dSlipShearNew2Mag / dSlipShearNewMag;
+    (*dSlipTpdt)[1] *= dSlipShearNew2Mag / dSlipShearNewMag;
+
+    const double dTractionTpdtMag = 
+      sqrt(pow((*dTractionTpdt)[0], 2) +
+	   pow((*dTractionTpdt)[1], 2));
+    assert(dTractionTpdtMag > 0.0);
+    (*dTractionTpdt)[0] *= fabs(dTractionShearNew2Mag) / dTractionTpdtMag;
+    (*dTractionTpdt)[1] *= fabs(dTractionShearNew2Mag) / dTractionTpdtMag;
+
+    // Prevent over-correction in slip resulting in backslip.
+    // Expect slip direction to match tractions
+
+    // Compute dot product between slip and increment in slip (want positive)
+    const double slipDot = 
+      (slipTpdt[0] - slipT[0]) * (slipTpdt[0] + (*dSlipTpdt)[0] - slipT[0]) +
+      (slipTpdt[1] - slipT[1]) * (slipTpdt[1] + (*dSlipTpdt)[1] - slipT[1]);
+    // Compute dot product of traction and slip
+    const double tractionSlipDot = 
+      (tractionTpdt[0] + (*dTractionTpdt)[0]) * (slipTpdt[0] + (*dSlipTpdt)[0])+
+      (tractionTpdt[1] + (*dTractionTpdt)[1]) * (slipTpdt[1] + (*dSlipTpdt)[1]);
+    if (slipDot < 0.0 &&
+	sqrt(fabs(slipDot)) > _zeroTolerance && 
+	tractionSlipDot < 0.0) {
+      // Correct backslip
+      (*dTractionTpdt)[0] *= 0.5; // Use bisection as guess for traction
+      (*dTractionTpdt)[1] *= 0.5;
+      // Use bisection for slip
+#if 0 // linear space
+      (*dSlipTpdt)[0] = 0.5*(slipT[0] - slipTpdt[0]);
+      (*dSlipTpdt)[1] = 0.5*(slipT[1] - slipTpdt[1]);
+#else // log space
+      assert(slipT[0] * slipTpdt[0] > 0.0);
+      assert(slipT[1] * slipTpdt[1] > 0.0);
+
+      (*dSlipTpdt)[0] *= sqrt(slipT[0] * slipTpdt[0]) / dSlipShearNew2Mag; 
+      (*dSlipTpdt)[1] *= sqrt(slipT[1] * slipTpdt[1]) / dSlipShearNew2Mag;
+#endif
+    } // if
+
+#if 1 // DEBUGGING
+  std::cout << "AFTER improvement"
+	    << ", dTractionTpdt:";
+  for (int i=0; i < 2; ++i)
+    std::cout << "  " << (*dTractionTpdt)[i];
+  std::cout << ", dSlipTpdt:";
+  for (int i=0; i < 2; ++i)
+    std::cout << "  " << (*dSlipTpdt)[i];
+  std::cout << ", frictionStress: " << frictionStress
+	    << ", tractionShearMag: " << tractionShearMag
+	    << ", slopeF: " << slopeF
+	    << ", slopeT: " << slopeT
+	    << std::endl;
+#endif
+
+} // if
+
+  PetscLogFlops(0); // :TODO: Update this.
+} // _constrainSolnSpaceImprove3D
+
+
 // End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveDyn.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveDyn.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveDyn.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -199,45 +199,90 @@
    */
   void _sensitivityUpdateSoln(const bool negativeSide);
 
-  /** Constrain solution space with lumped Jacobian in 1-D.
+  /** Constrain solution space in 1-D.
    *
-   * @param dLagrangeTpdt Adjustment to Lagrange multiplier.
-   * @param slip Slip assoc. w/Lagrange multiplier vertex.
-   * @param slipRate Slip rate assoc. w/Lagrange multiplier vertex.
-   * @param tractionTpdt Fault traction assoc. w/Lagrange multiplier vertex.
+   * @param dTractionTpdt Adjustment to fault traction vector.
+   * @param slip Fault slip vector.
+   * @param slipRate Fault slip rate vector.
+   * @param tractionTpdt Fault traction vector.
+   * @param iterating True if iterating on solution, false otherwise.
    */
-  void _constrainSolnSpace1D(double_array* dLagrangeTpdt,
+  void _constrainSolnSpace1D(double_array* dTractionTpdt,
 			     const double_array& slip,
 			     const double_array& slipRate,
 			     const double_array& tractionTpdt,
 			     const bool iterating =true);
 
-  /** Constrain solution space with lumped Jacobian in 2-D.
+  /** Constrain solution space in 2-D.
    *
-   * @param dLagrangeTpdt Adjustment to Lagrange multiplier.
-   * @param slip Slip assoc. w/Lagrange multiplier vertex.
-   * @param slipRate Slip rate assoc. w/Lagrange multiplier vertex.
-   * @param tractionTpdt Fault traction assoc. w/Lagrange multiplier vertex.
+   * @param dTractionTpdt Adjustment to fault traction vector.
+   * @param slip Fault slip vector.
+   * @param slipRate Fault slip rate vector.
+   * @param tractionTpdt Fault traction vector.
+   * @param iterating True if iterating on solution, false otherwise.
    */
-  void _constrainSolnSpace2D(double_array* dLagrangeTpdt,
+  void _constrainSolnSpace2D(double_array* dTractionTpdt,
 			     const double_array& slip,
 			     const double_array& slipRate,
 			     const double_array& tractionTpdt,
 			     const bool iterating =true);
 
-  /** Constrain solution space with lumped Jacobian in 3-D.
+  /** Constrain solution space in 3-D.
    *
-   * @param dLagrangeTpdt Adjustment to Lagrange multiplier.
-   * @param slip Slip assoc. w/Lagrange multiplier vertex.
-   * @param slipRate Slip rate assoc. w/Lagrange multiplier vertex.
-   * @param tractionTpdt Fault traction assoc. w/Lagrange multiplier vertex.
+   * @param dTractionTpdt Adjustment to fault traction vector.
+   * @param slip Fault slip vector.
+   * @param slipRate Fault slip rate vector.
+   * @param tractionTpdt Fault traction vector.
+   * @param iterating True if iterating on solution, false otherwise.
    */
-  void _constrainSolnSpace3D(double_array* dLagrangeTpdt,
+  void _constrainSolnSpace3D(double_array* dTractionTpdt,
 			     const double_array& slip,
 			     const double_array& slipRate,
 			     const double_array& tractionTpdt,
 			     const bool iterating =true);
 
+  /** Improve slip estimate when constraining solution space in 1-D.
+   *
+   * @param dTractionTpdt Adjustment to fault traction vector.
+   * @param dSlipTpdt Adjustment to fault slip vector.
+   * @param slipT Fault slip vector at time t.
+   * @param slipTpdt Fault slip vector at time t+dt (without adjustment).
+   * @param tractionTpdt Fault traction vector (without adjustment).
+   */
+  void _constrainSolnSpaceImprove1D(double_array* dTractionTpdt,
+				    double_array* dSlipTpdt,
+				    const double_array& slipT,
+				    const double_array& slipTpdt,
+				    const double_array& tractionTpdt);
+
+  /** Improve slip estimate when constraining solution space in 2-D.
+   *
+   * @param dTractionTpdt Adjustment to fault traction vector.
+   * @param dSlipTpdt Adjustment to fault slip vector.
+   * @param slipT Fault slip vector at time t.
+   * @param slipTpdt Fault slip vector at time t+dt (without adjustment).
+   * @param tractionTpdt Fault traction vector (without adjustment).
+   */
+  void _constrainSolnSpaceImprove2D(double_array* dTractionTpdt,
+				    double_array* dSlipTpdt,
+				    const double_array& slipT,
+				    const double_array& slipTpdt,
+				    const double_array& tractionTpdt);
+
+  /** Improve slip estimate when constraining solution space in 3-D.
+   *
+   * @param dTractionTpdt Adjustment to fault traction vector.
+   * @param dSlipTpdt Adjustment to fault slip vector.
+   * @param slipT Fault slip vector at time t.
+   * @param slipTpdt Fault slip vector at time t+dt (without adjustment).
+   * @param tractionTpdt Fault traction vector (without adjustment).
+   */
+  void _constrainSolnSpaceImprove3D(double_array* dTractionTpdt,
+				    double_array* dSlipTpdt,
+				    const double_array& slipT,
+				    const double_array& slipTpdt,
+				    const double_array& tractionTpdt);
+
   // PRIVATE MEMBERS ////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveLagrange.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveLagrange.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveLagrange.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -105,7 +105,7 @@
     *_faultMesh);
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  //logger.stagePush("Fault");
+  logger.stagePush("FaultFields");
 
   // Allocate dispRel field
   const ALE::Obj<SieveSubMesh>& faultSieveMesh = _faultMesh->sieveMesh();
@@ -120,6 +120,8 @@
   dispRel.vectorFieldType(topology::FieldBase::VECTOR);
   dispRel.scale(_normalizer->lengthScale());
 
+  logger.stagePop();
+
   const ALE::Obj<SieveSubMesh::label_sequence>& cells =
       faultSieveMesh->heightStratum(0);
   assert(!cells.isNull());
@@ -130,26 +132,12 @@
   _quadrature->computeGeometry(*_faultMesh, cells);
 #endif
 
-  _fields->add("distribution", "distribution", pylith::topology::FieldBase::CELLS_FIELD, 1);
-  topology::Field<topology::SubMesh>& dist = _fields->get("distribution");
-  dist.allocate();
-  const ALE::Obj<RealSection>& distSection = dist.section();
-  assert(!distSection.isNull());
-  const double rank = (double) distSection->commRank();
-
-  // Loop over cells in fault mesh, set distribution
-  for (SieveSubMesh::label_sequence::iterator c_iter = cellsBegin; c_iter
-      != cellsEnd; ++c_iter) {
-    distSection->updatePoint(*c_iter, &rank);
-  } // for
-
   // Compute orientation at vertices in fault mesh.
   _calcOrientation(upDir);
 
   // Compute tributary area for each vertex in fault mesh.
   _calcArea();
 
-  //logger.stagePop();
 } // initialize
 
 // ----------------------------------------------------------------------
@@ -1206,6 +1194,9 @@
   double jacobianDet = 0;
   double_array refCoordsVertex(cohesiveDim);
 
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.stagePush("FaultFields");
+
   // Allocate orientation field.
   double_array orientationVertex(orientationSize);
   _fields->add("orientation", "orientation");
@@ -1223,6 +1214,8 @@
   orientation.allocate();
   orientation.zero();
 
+  logger.stagePop();
+
   // Get fault cells.
   const ALE::Obj<SieveSubMesh::label_sequence>& cells =
       faultSieveMesh->heightStratum(0);
@@ -1452,6 +1445,9 @@
       vertices->begin();
   const SieveSubMesh::label_sequence::iterator verticesEnd = vertices->end();
 
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.stagePush("FaultFields");
+
   // Allocate area field.
   _fields->add("area", "area");
   topology::Field<topology::SubMesh>& area = _fields->get("area");
@@ -1465,6 +1461,8 @@
   assert(!areaSection.isNull());
   UpdateAddVisitor areaVisitor(*areaSection, &areaCell[0]);
 
+  logger.stagePop();
+
   double_array coordinatesCell(numBasis * spaceDim);
   const ALE::Obj<RealSection>& coordinates = faultSieveMesh->getRealSection(
     "coordinates");
@@ -1551,13 +1549,13 @@
   const ALE::Obj<RealSection>& tractionsSection = tractions->section();
   if (tractionsSection.isNull()) {
     ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-    //logger.stagePush("Fault");
+    logger.stagePush("FaultFields");
 
     const topology::Field<topology::SubMesh>& dispRel = 
       _fields->get("relative disp");
     tractions->cloneSection(dispRel);
 
-    //logger.stagePop();
+    logger.stagePop();
   } // if
   assert(!tractionsSection.isNull());
   tractions->zero();
@@ -1713,7 +1711,7 @@
     return;
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("Output");
+  logger.stagePush("OutputFields");
 
   // Create vector field; use same shape/chart as relative
   // displacement field.
@@ -1739,7 +1737,7 @@
     return;
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("Output");
+  logger.stagePush("OutputFields");
 
   // Create vector field; use same shape/chart as area field.
   assert(0 != _faultMesh);
@@ -1854,10 +1852,41 @@
 pylith::faults::FaultCohesiveLagrange::cellField(const char* name,
                                                  const topology::SolutionFields* fields)
 { // cellField
-  if (0 == strcasecmp("distribution", name)) {
-    const topology::Field<topology::SubMesh>& dist = _fields->get("distribution");
-    return dist;
-  }
+  if (0 == strcasecmp("partition", name)) {
+
+    const ALE::Obj<SieveSubMesh>& faultSieveMesh = _faultMesh->sieveMesh();
+    assert(!faultSieveMesh.isNull());
+    const ALE::Obj<SieveSubMesh::label_sequence>& cells =
+      faultSieveMesh->heightStratum(0);
+    assert(!cells.isNull());
+    const SieveSubMesh::label_sequence::iterator cellsBegin = cells->begin();
+    const SieveSubMesh::label_sequence::iterator cellsEnd = cells->end();
+
+    ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+    logger.stagePush("OutputFields");
+
+    const int fiberDim = 1;
+    _fields->add("partition", "partition", 
+		 pylith::topology::FieldBase::CELLS_FIELD, fiberDim);
+    topology::Field<topology::SubMesh>& partition = _fields->get("partition");
+    partition.allocate();
+    const ALE::Obj<RealSection>& partitionSection = partition.section();
+    assert(!partitionSection.isNull());
+    
+    const double rank = (double) partitionSection->commRank();
+    // Loop over cells in fault mesh, set partition
+    for (SieveSubMesh::label_sequence::iterator c_iter = cellsBegin; 
+	 c_iter != cellsEnd;
+	 ++c_iter) {
+      partitionSection->updatePoint(*c_iter, &rank);
+    } // for
+
+    logger.stagePop();
+
+    return partition;    
+
+  } // if
+
   // Should not reach this point if requested field was found
   std::ostringstream msg;
   msg << "Request for unknown cell field '" << name << "' for fault '"

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/feassemble/IntegratorElasticity.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/feassemble/IntegratorElasticity.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -464,7 +464,7 @@
   
   if (!_outputFields->hasField("buffer (tensor)")) {
     ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-    logger.stagePush("Output");
+    logger.stagePush("OutputFields");
     _outputFields->add("buffer (tensor)", "buffer");
     topology::Field<topology::Mesh>& buffer =
       _outputFields->get("buffer (tensor)");

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/FrictionModel.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/FrictionModel.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/FrictionModel.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -324,6 +324,28 @@
 } // calcFriction
 
 // ----------------------------------------------------------------------
+// Compute change in friction with change in slip.
+double
+pylith::friction::FrictionModel::calcFrictionSlope(const double slip,
+						   const double slipRate,
+						   const double normalTraction)
+{ // calcFrictionSlope
+  assert(_fieldsPropsStateVars);
+  
+  assert(_propsFiberDim+_varsFiberDim == _propsStateVarsVertex.size());
+  const double* propertiesVertex = &_propsStateVarsVertex[0];
+  const double* stateVarsVertex = (_varsFiberDim > 0) ?
+    &_propsStateVarsVertex[_propsFiberDim] : 0;
+  
+  const double slope =
+    _calcFrictionSlope(slip, slipRate, normalTraction,
+		       propertiesVertex, _propsFiberDim,
+		       stateVarsVertex, _varsFiberDim);
+  
+  return slope;
+} // calcFrictionSlope
+
+// ----------------------------------------------------------------------
 // Update state variables (for next time step).
 void
 pylith::friction::FrictionModel::updateStateVars(const double slip,

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/FrictionModel.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/FrictionModel.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/FrictionModel.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -166,6 +166,21 @@
                       const double slipRate,
                       const double normalTraction);
   
+  /** Compute change in friction for a change in slip (Jacobian).
+   *
+   * @pre Must call retrievePropsAndVars for cell before calling
+   * calcFriction().
+   *
+   * @param slip Current slip at location.
+   * @param slipRate Current slip rate at location.
+   * @param normalTraction Normal traction at location.
+   *
+   * @returns Change in friction for a chance in slip (dT/dD).
+   */
+  double calcFrictionSlope(const double slip,
+			   const double slipRate,
+			   const double normalTraction);
+  
   /** Compute friction at vertex.
    *
    * @pre Must call retrievePropsAndVars for cell before calling
@@ -249,6 +264,8 @@
    * @param numProperties Number of properties.
    * @param stateVars State variables at location.
    * @param numStateVars Number of state variables.
+   *
+   * @returns Friction (magnitude of shear traction) at vertex.
    */
   virtual
   double _calcFriction(const double slip,
@@ -259,6 +276,27 @@
 		       const double* stateVars,
 		       const int numStateVars) = 0;
 
+  /** Compute change in friction for a change in slip (Jacobian).
+   *
+   * @param slip Current slip at location.
+   * @param slipRate Current slip rate at location.
+   * @param normalTraction Normal traction at location.
+   * @param properties Properties at location.
+   * @param numProperties Number of properties.
+   * @param stateVars State variables at location.
+   * @param numStateVars Number of state variables.
+   *
+   * @returns Change in friction for a chance in slip (dT/dD).
+   */
+  virtual
+  double _calcFrictionSlope(const double slip,
+			    const double slipRate,
+			    const double normalTraction,
+			    const double* properties,
+			    const int numProperties,
+			    const double* stateVars,
+			    const int numStateVars) = 0;
+  
   /** Update state variables (for next time step).
    *
    * @param slip Current slip at location.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/RateStateAgeing.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/RateStateAgeing.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/RateStateAgeing.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -343,7 +343,6 @@
 #else
 
     const double slipRateLinear = _minSlipRate;
-    const double slipRateFactor = 1.0e-3;
 
     const double f0 = properties[p_coef];
     const double a = properties[p_a];
@@ -352,15 +351,11 @@
     const double slipRate0 = properties[p_slipRate0];
     const double theta = stateVars[s_state];
 
-    if (slipRate > slipRateLinear) {
+    if (slipRate >= slipRateLinear) {
       mu_f = f0 + a*log(slipRate / slipRate0) + b*log(slipRate0*theta/L);
-    } else if (slipRate > slipRateFactor*slipRateLinear) {
-      mu_f = f0 + a*log(slipRateLinear / slipRate0) + b*log(slipRate0*theta/L) -
-	a*(1.0-slipRateFactor) * 
-	(1.0 - slipRate/slipRateLinear) / (1.0 - slipRateFactor);
     } else {
       mu_f = f0 + a*log(slipRateLinear / slipRate0) + b*log(slipRate0*theta/L) -
-	a*(1.0-slipRateFactor);
+	a*(1.0 - slipRate/slipRateLinear);
     } // else
 
     friction = -mu_f * normalTraction + properties[p_cohesion];
@@ -374,12 +369,48 @@
 #endif
   } // if
 
-  PetscLogFlops(11);
+  PetscLogFlops(12);
 
   return friction;
 } // _calcFriction
 
 // ----------------------------------------------------------------------
+// Compute change in friction for a change in slip (Jacobian).
+double
+pylith::friction::RateStateAgeing::_calcFrictionSlope(const double slip,
+						      const double slipRate,
+						      const double normalTraction,
+						      const double* properties,
+						      const int numProperties,
+						      const double* stateVars,
+						      const int numStateVars)
+{ // _calcFrictionSlope
+  assert(properties);
+  assert(_RateStateAgeing::numProperties == numProperties);
+  assert(numStateVars);
+  assert(_RateStateAgeing::numStateVars == numStateVars);
+
+  double slope = 0.0;
+  if (normalTraction <= 0.0) {
+    // if fault is in compression
+
+    const double a = properties[p_a];
+    const double slipRate0 = properties[p_slipRate0];
+
+    const double slipRateLinear = _minSlipRate;
+    const double slipRateEff = std::max(slipRate, slipRateLinear);
+
+    //slope = -slipRateEff / (slipRate0 * normalTraction * a);
+    slope = -normalTraction * a; // log space
+  } // if
+
+  PetscLogFlops(5);
+
+  return slope;
+} // _calcFrictionSlope
+
+
+// ----------------------------------------------------------------------
 // Update state variables (for next time step).
 void
 pylith::friction::RateStateAgeing::_updateStateVars(const double slip,

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/RateStateAgeing.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/RateStateAgeing.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/RateStateAgeing.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -141,6 +141,26 @@
 		       const double* stateVars,
 		       const int numStateVars);
 
+  /** Compute change in friction for a change in slip (Jacobian).
+   *
+   * @param slip Current slip at location.
+   * @param slipRate Current slip rate at location.
+   * @param normalTraction Normal traction at location.
+   * @param properties Properties at location.
+   * @param numProperties Number of properties.
+   * @param stateVars State variables at location.
+   * @param numStateVars Number of state variables.
+   *
+   * @returns Change in friction for a chance in slip (dT/dD).
+   */
+  double _calcFrictionSlope(const double slip,
+			    const double slipRate,
+			    const double normalTraction,
+			    const double* properties,
+			    const int numProperties,
+			    const double* stateVars,
+			    const int numStateVars);
+  
   /** Update state variables (for next time step).
    *
    * @param slip Current slip at location.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/SlipWeakening.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/SlipWeakening.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/SlipWeakening.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -294,15 +294,52 @@
       } else {
 	mu_f = properties[p_coefD];
       } // if/else
-    friction = - mu_f * normalTraction + properties[p_cohesion];
+    friction = -mu_f * normalTraction + properties[p_cohesion];
   } // if
 
-  PetscLogFlops(6);
+  PetscLogFlops(10);
 
   return friction;
 } // _calcFriction
 
 // ----------------------------------------------------------------------
+// Compute change in friction for a change in slip (Jacobian).
+double
+pylith::friction::SlipWeakening::_calcFrictionSlope(const double slip,
+						    const double slipRate,
+						    const double normalTraction,
+						    const double* properties,
+						    const int numProperties,
+						    const double* stateVars,
+						    const int numStateVars)
+{ // _calcFrictionSlope
+  assert(properties);
+  assert(_SlipWeakening::numProperties == numProperties);
+  assert(stateVars);
+  assert(_SlipWeakening::numStateVars == numStateVars);
+
+  double slope = 0.0;
+  if (normalTraction <= 0.0) {
+    // if fault is in compression
+    const double slipPrev = stateVars[s_slipPrev];
+    const double slipCum = stateVars[s_slipCum] + fabs(slip - slipPrev);
+
+    if (slipCum < properties[p_d0]) {
+      // if/else linear slip-weakening form of mu_f 
+      slope = -normalTraction * (properties[p_coefS] - properties[p_coefD]) 
+	/ properties[p_d0];
+      } else {
+      slope = 0.0;
+      } // if/else
+  } // if
+
+  PetscLogFlops(7);
+
+  return slope;
+} // _calcFrictionSlope
+
+
+// ----------------------------------------------------------------------
 // Update state variables (for next time step).
 void
 pylith::friction::SlipWeakening::_updateStateVars(const double slip,
@@ -322,13 +359,15 @@
   if (slipRate > tolerance && !_forceHealing) {
     const double slipPrev = stateVars[s_slipPrev];
 
-    stateVars[s_slipPrev] = stateVars[s_slipCum];
+    stateVars[s_slipPrev] = slip;
     stateVars[s_slipCum] += fabs(slip - slipPrev);
   } else {
     // Sliding has stopped, so reset state variables.
     stateVars[s_slipPrev] = slip;
     stateVars[s_slipCum] = 0.0;
   } // else
+
+  PetscLogFlops(3);
 } // _updateStateVars
 
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/SlipWeakening.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/SlipWeakening.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/SlipWeakening.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -129,6 +129,26 @@
 		       const double* stateVars,
 		       const int numStateVars);
 
+  /** Compute change in friction for a change in slip (Jacobian).
+   *
+   * @param slip Current slip at location.
+   * @param slipRate Current slip rate at location.
+   * @param normalTraction Normal traction at location.
+   * @param properties Properties at location.
+   * @param numProperties Number of properties.
+   * @param stateVars State variables at location.
+   * @param numStateVars Number of state variables.
+   *
+   * @returns Change in friction for a chance in slip (dT/dD).
+   */
+  double _calcFrictionSlope(const double slip,
+			    const double slipRate,
+			    const double normalTraction,
+			    const double* properties,
+			    const int numProperties,
+			    const double* stateVars,
+			    const int numStateVars);
+  
   /** Update state variables (for next time step).
    *
    * @param slip Current slip at location.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/StaticFriction.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/StaticFriction.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/StaticFriction.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -166,4 +166,21 @@
 } // _calcFriction
 
 
+// ----------------------------------------------------------------------
+// Compute change in friction for a change in slip (Jacobian).
+double
+pylith::friction::StaticFriction::_calcFrictionSlope(const double slip,
+						     const double slipRate,
+						     const double normalTraction,
+						     const double* properties,
+						     const int numProperties,
+						     const double* stateVars,
+						     const int numStateVars)
+{ // _calcFrictionSlope
+  const double slope = 0;
+
+  return slope;
+} // _calcFrictionSlope
+
+
 // End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/StaticFriction.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/StaticFriction.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/StaticFriction.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -94,6 +94,26 @@
 		       const double* stateVars,
 		       const int numStateVars);
 
+  /** Compute change in friction for a change in slip (Jacobian).
+   *
+   * @param slip Current slip at location.
+   * @param slipRate Current slip rate at location.
+   * @param normalTraction Normal traction at location.
+   * @param properties Properties at location.
+   * @param numProperties Number of properties.
+   * @param stateVars State variables at location.
+   * @param numStateVars Number of state variables.
+   *
+   * @returns Change in friction for a chance in slip (dT/dD).
+   */
+  double _calcFrictionSlope(const double slip,
+			    const double slipRate,
+			    const double normalTraction,
+			    const double* properties,
+			    const int numProperties,
+			    const double* stateVars,
+			    const int numStateVars);
+  
   // PRIVATE MEMBERS ////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/TimeWeakening.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/TimeWeakening.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/TimeWeakening.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -308,4 +308,21 @@
 } // _updateStateVars
 
 
+// ----------------------------------------------------------------------
+// Compute change in friction for a change in slip (Jacobian).
+double
+pylith::friction::TimeWeakening::_calcFrictionSlope(const double slip,
+						    const double slipRate,
+						    const double normalTraction,
+						    const double* properties,
+						    const int numProperties,
+						    const double* stateVars,
+						    const int numStateVars)
+{ // _calcFrictionSlope
+  const double slope = 0;
+
+  return slope;
+} // _calcFrictionSlope
+
+
 // End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/TimeWeakening.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/TimeWeakening.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/friction/TimeWeakening.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -123,6 +123,26 @@
 		       const double* stateVars,
 		       const int numStateVars);
 
+  /** Compute change in friction for a change in slip (Jacobian).
+   *
+   * @param slip Current slip at location.
+   * @param slipRate Current slip rate at location.
+   * @param normalTraction Normal traction at location.
+   * @param properties Properties at location.
+   * @param numProperties Number of properties.
+   * @param stateVars State variables at location.
+   * @param numStateVars Number of state variables.
+   *
+   * @returns Change in friction for a chance in slip (dT/dD).
+   */
+  double _calcFrictionSlope(const double slip,
+			    const double slipRate,
+			    const double normalTraction,
+			    const double* properties,
+			    const int numProperties,
+			    const double* stateVars,
+			    const int numStateVars);
+  
   /** Update state variables (for next time step).
    *
    * @param slip Current slip at location.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/materials/ElasticMaterial.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/materials/ElasticMaterial.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/materials/ElasticMaterial.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -304,7 +304,7 @@
     return;
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("Materials");
+  logger.stagePush("MaterialsFields");
 
   assert(0 != _initialFields);
   _initialFields->add("initial stress", "initial_stress");
@@ -450,7 +450,7 @@
     return;
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("Materials");
+  logger.stagePush("MaterialsFields");
 
   assert(0 != _initialFields);
   _initialFields->add("initial strain", "initial_strain");

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/materials/Material.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/materials/Material.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/materials/Material.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -117,7 +117,7 @@
   assert(0 != quadrature);
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("Materials");
+  logger.stagePush("MaterialsFields");
 
   // Get quadrature information
   const int numQuadPts = quadrature->numQuadPts();
@@ -384,7 +384,7 @@
     } // if
     if (!useCurrentField) {
       ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-      logger.stagePush("Output");
+      logger.stagePush("OutputFields");
       field->newSection(cells, totalFiberDim);
       field->allocate();
       logger.stagePop();
@@ -454,7 +454,7 @@
     } // if
     if (!useCurrentField) {
       ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-      logger.stagePush("Output");
+      logger.stagePush("OutputFields");
       field->newSection(cells, totalFiberDim);
       field->allocate();
       logger.stagePop();

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/CellFilterAvg.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/CellFilterAvg.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -121,7 +121,7 @@
 
   // Allocate field if necessary
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("Output");
+  logger.stagePush("OutputFields");
   if (0 == _fieldAvg) {
     _fieldAvg = new field_type(fieldIn.mesh());
     assert(0 != _fieldAvg);

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/MeshBuilder.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/MeshBuilder.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/MeshBuilder.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -222,7 +222,7 @@
   // Memory logging
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   //logger.setDebug(fault->debug()/2);
-  logger.stagePush("FaultCreation");
+  logger.stagePush("Creation");
 
   if (0 == rank) {
     assert(coordinates.size() == numVertices*spaceDim);
@@ -256,7 +256,7 @@
     faultBd = ALE::Selection<SieveFlexMesh>::boundary(tmpMesh);
 
     logger.stagePop();
-    logger.stagePush("FaultStratification");
+    logger.stagePush("Stratification");
     fault->stratify();
     logger.stagePop();
   } else {
@@ -265,7 +265,7 @@
     faultBd = ALE::Selection<SieveFlexMesh>::boundary(tmpMesh);
 
     logger.stagePop();
-    logger.stagePush("FaultStratification");
+    logger.stagePush("Stratification");
     fault->getSieve()->setChart(SieveMesh::sieve_type::chart_type());
     fault->getSieve()->allocate();
     fault->stratify();
@@ -275,20 +275,20 @@
 #if defined(ALE_MEM_LOGGING)
   std::cout
     << std::endl
-    << "FaultCreation " << logger.getNumAllocations("FaultCreation")
-    << " allocations " << logger.getAllocationTotal("FaultCreation")
+    << "FaultCreation " << logger.getNumAllocations("Creation")
+    << " allocations " << logger.getAllocationTotal("Creation")
     << " bytes" << std::endl
     
-    << "FaultCreation " << logger.getNumDeallocations("FaultCreation")
-    << " deallocations " << logger.getDeallocationTotal("FaultCreation")
+    << "FaultCreation " << logger.getNumDeallocations("Creation")
+    << " deallocations " << logger.getDeallocationTotal("Creation")
     << " bytes" << std::endl
     
-    << "FaultStratification " << logger.getNumAllocations("FaultStratification")
-    << " allocations " << logger.getAllocationTotal("FaultStratification")
+    << "FaultStratification " << logger.getNumAllocations("Stratification")
+    << " allocations " << logger.getAllocationTotal("Stratification")
     << " bytes" << std::endl
     
-    << "FaultStratification " << logger.getNumDeallocations("FaultStratification")
-    << " deallocations " << logger.getDeallocationTotal("FaultStratification")
+    << "FaultStratification " << logger.getNumDeallocations("Stratification")
+    << " deallocations " << logger.getDeallocationTotal("Stratification")
     << " bytes" << std::endl << std::endl;
 #endif
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/VertexFilterVecNorm.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/VertexFilterVecNorm.cc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/VertexFilterVecNorm.cc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -91,7 +91,7 @@
 
   // Allocation field if necessary
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("Output");
+  logger.stagePush("OutputFields");
   if (0 == _fieldVecNorm) {
     _fieldVecNorm = new field_type(fieldIn.mesh());
     _fieldVecNorm->label("vector norm");

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/SubMesh.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/SubMesh.hh	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/SubMesh.hh	2012-02-01 00:29:20 UTC (rev 19538)
@@ -126,6 +126,24 @@
    */
   int dimension(void) const;
 
+  /** Get representative cone size for mesh.
+   *
+   * @returns Representative cone size for mesh.
+   */
+  int coneSize(void) const;
+  
+  /** Get number of vertices in mesh.
+   *
+   * @returns Number of vertices in mesh.
+   */
+  int numVertices(void) const;
+  
+  /** Get number of cells in mesh.
+   *
+   * @returns Number of cells in mesh.
+   */
+  int numCells(void) const;
+
   /** Get MPI communicator associated with mesh.
    *
    * @returns MPI communicator.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/SubMesh.icc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/SubMesh.icc	2012-01-31 23:44:44 UTC (rev 19537)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/SubMesh.icc	2012-02-01 00:29:20 UTC (rev 19538)
@@ -64,6 +64,29 @@
   return (!_mesh.isNull()) ? _mesh->getDimension() : 0;
 }
 
+// Get representative cone size for mesh.
+inline
+int
+pylith::topology::SubMesh::coneSize(void) const {
+  
+  return (!_mesh.isNull() && numCells() > 0) ? 
+    _mesh->getSieve()->getConeSize(*_mesh->heightStratum(1)->begin()) : 0;
+}
+
+// Get number of vertices in mesh.
+inline
+int
+pylith::topology::SubMesh::numVertices(void) const {
+  return (!_mesh.isNull() && _mesh->depth() > 0) ? _mesh->depthStratum(0)->size() : 0;
+}
+
+// Get number of cells in mesh.
+inline
+int
+pylith::topology::SubMesh::numCells(void) const {
+  return (!_mesh.isNull() && _mesh->height() > 0) ? _mesh->heightStratum(1)->size() : 0;
+}
+
 // Get MPI communicator associated with mesh.
 inline
 const MPI_Comm



More information about the CIG-COMMITS mailing list