[cig-commits] [commit] knepley/fix-faults-parallel: Fixes for clamped edges. (a6dcee9)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Tue May 27 08:29:18 PDT 2014


Repository : https://github.com/geodynamics/pylith

On branch  : knepley/fix-faults-parallel
Link       : https://github.com/geodynamics/pylith/compare/bc4ad8c1e4f7cbe0286a7c030323fe6906bf7cbf...a6dcee9c56c2ed915b63f90186133bd8ce8789a9

>---------------------------------------------------------------

commit a6dcee9c56c2ed915b63f90186133bd8ce8789a9
Author: Brad Aagaard <baagaard at usgs.gov>
Date:   Tue May 27 08:29:05 2014 -0700

    Fixes for clamped edges.
    
    Still have a bug related to buried edges and custom preconditioner.


>---------------------------------------------------------------

a6dcee9c56c2ed915b63f90186133bd8ce8789a9
 libsrc/pylith/faults/FaultCohesiveLagrange.cc | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/libsrc/pylith/faults/FaultCohesiveLagrange.cc b/libsrc/pylith/faults/FaultCohesiveLagrange.cc
index 1bd2449..d525336 100644
--- a/libsrc/pylith/faults/FaultCohesiveLagrange.cc
+++ b/libsrc/pylith/faults/FaultCohesiveLagrange.cc
@@ -649,7 +649,7 @@ pylith::faults::FaultCohesiveLagrange::calcPreconditioner(PetscMat* const precon
   _getJacobianSubmatrixNP(&jacobianNP, &indicesMatToSubmat, *jacobian, *fields);
   
   const int numVertices = _cohesiveVertices.size();
-  for (int iVertex=0, cV = 0; iVertex < numVertices; ++iVertex) {
+  for (int iVertex=0; iVertex < numVertices; ++iVertex) {
     const int e_lagrange = _cohesiveVertices[iVertex].lagrange;
     const int v_fault = _cohesiveVertices[iVertex].fault;
     const int v_negative = _cohesiveVertices[iVertex].negative;
@@ -718,15 +718,12 @@ pylith::faults::FaultCohesiveLagrange::calcPreconditioner(PetscMat* const precon
     PetscInt poff = 0;
     err = PetscSectionGetOffset(dispGlobalSection, v_fault, &poff);PYLITH_CHECK_ERROR(err);
 
-    for (int iDim=0; iDim < spaceDim; ++iDim)
-      MatSetValue(*precondMatrix,
-		  poff + iDim,
-		  poff + iDim,
-		  precondVertexL[iDim],
-		  INSERT_VALUES);
+    for (int iDim=0; iDim < spaceDim; ++iDim) {
+      MatSetValue(*precondMatrix, poff+iDim, poff+iDim, precondVertexL[iDim], INSERT_VALUES);
+    } // for
 
 #if 0 // DEBUGGING
-    std::cout << "1/P_vertex " << *e_lagrange << std::endl;
+    std::cout << "1/P_vertex " << e_lagrange << std::endl;
     for(int iDim = 0; iDim < spaceDim; ++iDim) {
       std::cout << "  " << precondVertexL[iDim] << std::endl;
     } // for
@@ -1898,12 +1895,16 @@ pylith::faults::FaultCohesiveLagrange::_getJacobianSubmatrixNP(PetscMat* jacobia
   int numIndicesNP = 0;
   for (int iVertex=0; iVertex < numVertices; ++iVertex) {
     const int e_lagrange = _cohesiveVertices[iVertex].lagrange;
+    if (e_lagrange < 0) { // Ignore clamped edges.
+      continue;
+    } // if
 
     // Compute contribution only if Lagrange constraint is local.
     PetscInt goff = 0;
     err = PetscSectionGetOffset(solutionGlobalSection, e_lagrange, &goff);PYLITH_CHECK_ERROR(err);
-    if (goff < 0)
+    if (goff < 0) {
       continue;
+    } // if
 
     numIndicesNP += 2;
   } // for
@@ -1914,6 +1915,10 @@ pylith::faults::FaultCohesiveLagrange::_getJacobianSubmatrixNP(PetscMat* jacobia
     const int v_negative = _cohesiveVertices[iVertex].negative;
     const int v_positive = _cohesiveVertices[iVertex].positive;
 
+    if (e_lagrange < 0) { // Ignore clamped edges.
+      continue;
+    } // if
+
     // Compute contribution only if Lagrange constraint is local.
     PetscInt gloff = 0;
     err = PetscSectionGetOffset(solutionGlobalSection, e_lagrange, &gloff);PYLITH_CHECK_ERROR(err);



More information about the CIG-COMMITS mailing list