[cig-commits] r7184 - in short/3D/PyLith/trunk: . libsrc/faults libsrc/feassemble

brad at geodynamics.org brad at geodynamics.org
Tue Jun 12 17:45:24 PDT 2007


Author: brad
Date: 2007-06-12 17:45:24 -0700 (Tue, 12 Jun 2007)
New Revision: 7184

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
Log:
Temporary kludge fix to FaultCohesiveKin::integrateJacobian()[switched INSERT_VALUES to ADD_VALUES in updateOperator(). Need to prevent multiple contributions of Lagrange constraint information per vertex into Jacobian. Can't use INSERT_VALUES in updateOperator() because elasticity integrators use ADD_VALUES in updateOperator(), and we can't mix the two.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-06-13 00:25:47 UTC (rev 7183)
+++ short/3D/PyLith/trunk/TODO	2007-06-13 00:45:24 UTC (rev 7184)
@@ -2,10 +2,9 @@
 MAIN PRIORITIES (Brad)
 ======================================================================
 
-Python unit tests for FaultCohesiveKin
-  setConstraintSizes()
-  setConstraints()
-  setField()
+FaultCohesiveKin::integrateJacobian()
+  Need to prevent multiple contributions of orientation information for
+  each vertex, because we want to use ADD_VALUES in updateOperator().
 
 tests/1d/line2
 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2007-06-13 00:25:47 UTC (rev 7183)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2007-06-13 00:45:24 UTC (rev 7184)
@@ -20,6 +20,7 @@
 #include "pylith/feassemble/CellGeometry.hh" // USES CellGeometry
 #include "pylith/topology/FieldsManager.hh" // USES FieldsManager
 #include "pylith/utils/array.hh" // USES double_array
+#include <petscmat.h> // USES PETSc Mat
 
 #include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
 
@@ -308,6 +309,8 @@
   // direction cosines. Entries are associated with vertices ik, jk,
   // ki, and kj.
 
+  PetscErrorCode err = 0;
+
   // Get cohesive cells
   const ALE::Obj<ALE::Mesh::label_sequence>& cellsCohesive = 
     mesh->getLabelStratum("material-id", id());
@@ -369,8 +372,7 @@
 	    cellMatrix[row*numCorners*spaceDim+col]; // symmetric
 	} // for
     } // for
-    PetscErrorCode err = 
-      PetscLogFlops(numConstraintVert*spaceDim*spaceDim*4);
+    err = PetscLogFlops(numConstraintVert*spaceDim*spaceDim*4);
     if (err)
       throw std::runtime_error("Logging PETSc flops failed.");
 
@@ -378,8 +380,14 @@
     const ALE::Obj<Mesh::order_type>& globalOrder = 
       mesh->getFactory()->getGlobalOrder(mesh, "default", disp);
     // Update values (do not add)
+
+    // Most integrators will call the PETSc updateOperator() routine
+    // with ADD_VALUES, but with Lagrange multipler constraints, we
+    // call updateOperator() with INSERT_VALUES.
+
+    // :BUG: NEED TO USE INSERT_VALUES HERE
     err = updateOperator(*mat, mesh, disp, globalOrder,
-			 *c_iter, &cellMatrix[0], INSERT_VALUES);
+			 *c_iter, &cellMatrix[0], ADD_VALUES);
     if (err)
       throw std::runtime_error("Update to PETSc Mat failed.");
   } // for

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc	2007-06-13 00:25:47 UTC (rev 7183)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc	2007-06-13 00:45:24 UTC (rev 7184)
@@ -92,6 +92,8 @@
   assert(0 != fields);
   assert(!mesh.isNull());
 
+  PetscErrorCode err = 0;
+
   // Get cell information
   const ALE::Obj<ALE::Mesh::label_sequence>& cells = 
     mesh->getLabelStratum("material-id", _material->id());
@@ -197,8 +199,7 @@
         } // for
       } // for
     } // for
-    PetscErrorCode err = 
-      PetscLogFlops(numQuadPts*(3+numBasis*(1+numBasis*(6*spaceDim))));
+    err = PetscLogFlops(numQuadPts*(3+numBasis*(1+numBasis*(6*spaceDim))));
     if (err)
       throw std::runtime_error("Logging PETSc flops failed.");
 
@@ -219,7 +220,7 @@
 	  _cellVector[iBasis*spaceDim  ] -= N1*s11;
 	} // for
       } // for
-      PetscErrorCode err = PetscLogFlops(numQuadPts*(1+numBasis*5));
+      err = PetscLogFlops(numQuadPts*(1+numBasis*5));
       if (err)
 	throw std::runtime_error("Logging PETSc flops failed.");
 



More information about the cig-commits mailing list