[cig-commits] r16177 - in short/3D/PyLith/trunk: . unittests/libtests/faults unittests/libtests/faults/data

brad at geodynamics.org brad at geodynamics.org
Mon Jan 25 17:27:01 PST 2010


Author: brad
Date: 2010-01-25 17:27:01 -0800 (Mon, 25 Jan 2010)
New Revision: 16177

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinData.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinData.hh
Log:
Worked on unit tests for adjustSolnLumped().

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2010-01-26 01:13:30 UTC (rev 16176)
+++ short/3D/PyLith/trunk/TODO	2010-01-26 01:27:01 UTC (rev 16177)
@@ -8,12 +8,12 @@
   Better PETSc settings or Laplacian based preconditioner
 
 * Data structure to hold label of fault Lagrange vertices and
-conventional vertices 
-  array of structure (lagrange, positive, negative, fault)
+  conventional vertices
+    array of structure (lagrange, positive, negative, fault)
 
-  no mesh queries? Just loops?
+    no mesh queries? Just loops?
 
-* Drucker-Prager elastoplastic (or viscoelastoplastic?)
+* Drucker-Prager elastoplastic
 
 * Friction
 
@@ -28,15 +28,15 @@
   + full-scale testing
   + Code cleanup
 
-    Remove constraintCells from unitests/libtests/faults/data?
+    Add elasticPrestep() to Formulation
+    Remove solnIncr, keep setField()
+
 ----------------------------------------------------------------------
 FRICTION
 ----------------------------------------------------------------------
 
 Initial tractions
   Integrate over fault surface (should be current implementation)
-Constitutive model parameters
-  Integrate over faces to get weighted averages
 
 FaultCohesiveDyn -> FaultCohesiveDynNoL
 FaultCohesiveDynL -> FaultCohesiveDyn
@@ -44,13 +44,6 @@
   integrateResidualAssembled()
     updateSlip() [implemented for FaultCohesiveKin, not for FaultCohesiveDyn]
 
-3. pylith::friction::FrictionModel
-  (base class for fault constitutive models) [Brad]
-  similar to Material + ElasticMaterial
-
-4. Constant friction [Surendra]
-  Simplest friction model with constant coefficient of friction
-
 5. SlipWeakening [Surendra]
   Slip-weakening friction model
 
@@ -63,7 +56,9 @@
 LUMPED SOLVER
 ----------------------------------------------------------------------
 
-S (sensitivity matrix) - assume diagonal (check with assert)
+FaultCohesiveKin
+  adjustSolnLumped()
+    S (sensitivity matrix) - assume diagonal (check with assert)
 
 Unit tests
 

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc	2010-01-26 01:13:30 UTC (rev 16176)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc	2010-01-26 01:27:01 UTC (rev 16177)
@@ -656,7 +656,6 @@
   topology::SolutionFields fields(mesh);
   _initialize(&mesh, &fault, &fields);
 
-#if 0
   const int spaceDim = _data->spaceDim;
   const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
   CPPUNIT_ASSERT(!sieveMesh.isNull());
@@ -677,17 +676,6 @@
     } // for
   } // setup disp
 
-  { // setup residual
-    const ALE::Obj<RealSection>& resisualSection = fields.get("residual").section();
-    CPPUNIT_ASSERT(!residualSection.isNull());
-    int iVertex = 0;
-    for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
-        v_iter != verticesEnd;
-        ++v_iter, ++iVertex) {
-        residualSection->updatePoint(*v_iter, &_data->residualE[iVertex*spaceDim]);
-    } // for
-  } // setup residual
-
   // Set Jacobian values
   topology::Field<topology::Mesh> jacobian(mesh);
   jacobian.label("Jacobian");
@@ -706,9 +694,18 @@
   } // setup disp
   jacobian.complete();
 
+  // compute residual so that slip and residual are setup
+  const double t = 2.134;
+  const double dt = 0.01;
+  fault.timeStep(dt);
+  topology::Field<topology::Mesh>& residual = fields.get("residual");
+  fault.integrateResidual(residual, t, &fields);
+  residual.complete();
+  fault.integrateResidualAssembled(residual, t, &fields);
+
   fault.adjustSolnLumped(&fields, jacobian);
 
-  const topology::Field<topology::Mesh>& solution = fields->get("dispIncr(t->t+dt)");
+  const topology::Field<topology::Mesh>& solution = fields.get("dispIncr(t->t+dt)");
 #if 0 // DEBUGGING
   solution.view("ADJUSTED SOLUTION");
 #endif // DEBUGGING
@@ -718,17 +715,7 @@
 
   int iVertex = 0;
   const double tolerance = 1.0e-06;
-  const int spaceDim = _data->spaceDim;
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  CPPUNIT_ASSERT(!sieveMesh.isNull());
-  const ALE::Obj<SieveMesh::label_sequence>& vertices =
-    sieveMesh->depthStratum(0);
-  CPPUNIT_ASSERT(!vertices.isNull());
-  const SieveMesh::label_sequence::iterator verticesBegin =
-    vertices->begin();
-  const SieveMesh::label_sequence::iterator verticesEnd = vertices->end();
-
-  const double* solutionE = _data->fieldIncrAdjustedE;
+  const double* solutionE = _data->fieldIncrAdjusted;
   for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
        v_iter != verticesEnd;
        ++v_iter, ++iVertex) {
@@ -737,13 +724,12 @@
     const double* solutionVertex = solutionSection->restrictPoint(*v_iter);
     CPPUNIT_ASSERT(0 != solutionVertex);
     for (int iDim=0; iDim < spaceDim; ++iDim)
-      if (0.0 != solutionE[index])
-        CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, solutionVertex[iDim]/solutionE[index],
+      if (0.0 != solutionE[iVertex])
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, solutionVertex[iDim]/solutionE[iVertex],
           tolerance);
       else
-        CPPUNIT_ASSERT_DOUBLES_EQUAL(solutionE[index], solutionVertex[iDim], tolerance);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(solutionE[iVertex], solutionVertex[iDim], tolerance);
   } // for
-#endif
 } // testAdjustSolnLumped
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinData.cc	2010-01-26 01:13:30 UTC (rev 16176)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinData.cc	2010-01-26 01:27:01 UTC (rev 16177)
@@ -32,12 +32,15 @@
   riseTimeFilename(0),
   matPropsFilename(0),
   fieldT(0),
+  fieldIncr(0),
+  jacobianLumped(0),
   orientation(0),
   area(0),
-  constraintVertices(0),
   residual(0),
   residualIncr(0),
   jacobian(0),
+  fieldIncrAdjusted(0),
+  constraintVertices(0),
   numConstraintVert(0)
 { // constructor
 } // constructor

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinData.hh	2010-01-26 01:13:30 UTC (rev 16176)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveKinData.hh	2010-01-26 01:27:01 UTC (rev 16177)
@@ -77,6 +77,9 @@
 
   double* jacobian; ///< Expected values from Jacobian calculation.
 
+  /// Expected values for solution increment after adjustment.
+  double* fieldIncrAdjusted;
+
   int* constraintVertices; ///< Expected points for constraint vertices
   int numConstraintVert; ///< Number of constraint vertices
   //@}



More information about the CIG-COMMITS mailing list