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

brad at geodynamics.org brad at geodynamics.org
Sun Dec 13 20:15:30 PST 2009


Author: brad
Date: 2009-12-13 20:15:30 -0800 (Sun, 13 Dec 2009)
New Revision: 16102

Modified:
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.hh
Log:
A little more work on setting up friction unit tests.

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc	2009-12-13 23:45:20 UTC (rev 16101)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc	2009-12-14 04:15:30 UTC (rev 16102)
@@ -92,10 +92,12 @@
 void
 pylith::faults::TestFaultCohesiveDynL::testInitialize(void)
 { // testInitialize
+  CPPUNIT_ASSERT(0 != _data);
+
   topology::Mesh mesh;
   FaultCohesiveDynL fault;
   topology::SolutionFields fields(mesh);
-  _initialize(&mesh, &fault, &fields);
+  _initialize(&mesh, &fault, &fields, _data->fieldIncrStick);
 
   const ALE::Obj<SieveSubMesh>& faultSieveMesh = fault._faultMesh->sieveMesh();
   CPPUNIT_ASSERT(!faultSieveMesh.isNull());
@@ -159,6 +161,31 @@
     CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->area[iVertex], areaVertex[0],
 				 tolerance);
   } // for
+
+  // Initial tractions
+  if (0 != fault._dbInitialTract) {
+    //fault._fields->get("initial traction").view("INITIAL TRACTIONS"); // DEBUGGING
+    const ALE::Obj<RealSection>& tractionSection = fault._fields->get(
+        "initial traction").section();
+    CPPUNIT_ASSERT(!tractionSection.isNull());
+    const int spaceDim = _data->spaceDim;
+    iVertex = 0;
+    for (SieveSubMesh::label_sequence::iterator v_iter = verticesBegin;
+        v_iter != verticesEnd;
+        ++v_iter, ++iVertex) {
+      const int fiberDim = orientationSection->getFiberDimension(*v_iter);
+      CPPUNIT_ASSERT_EQUAL(spaceDim, fiberDim);
+      const double* tractionVertex = tractionSection->restrictPoint(*v_iter);
+      CPPUNIT_ASSERT(0 != tractionVertex);
+
+      const double tolerance = 1.0e-06;
+      for (int i = 0; i < spaceDim; ++i) {
+        const int index = iVertex * spaceDim + i;
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->initialTractions[index],
+            tractionVertex[i], tolerance);
+      } // for
+    } // for
+  } // if
 } // testInitialize
 
 // ----------------------------------------------------------------------
@@ -166,7 +193,9 @@
 void
 pylith::faults::TestFaultCohesiveDynL::testConstrainSolnSpaceStick(void)
 { // testConstrainSolnSpaceStick
-  // STUFF GOES HERE
+  // STUFF GOES HERE (Surendra)
+  // No change to dispIncr field
+  // Slip field should be zero
 } // testConstrainSolnSpaceStick
 
 // ----------------------------------------------------------------------
@@ -174,7 +203,7 @@
 void
 pylith::faults::TestFaultCohesiveDynL::testConstrainSolnSpaceSlip(void)
 { // testConstrainSolnSpaceSlip
-  // STUFF GOES HERE
+  // STUFF GOES HERE (Brad)
 } // testConstrainSolnSpaceSlip
 
 // ----------------------------------------------------------------------
@@ -182,7 +211,7 @@
 void
 pylith::faults::TestFaultCohesiveDynL::testConstrainSolnSpaceOpen(void)
 { // testConstrainSolnSpaceOpen
-  // STUFF GOES HERE
+  // STUFF GOES HERE (Surendra)
 } // testConstrainSolnSpaceOpen
 
 // ----------------------------------------------------------------------
@@ -190,7 +219,7 @@
 void
 pylith::faults::TestFaultCohesiveDynL::testUpdateStateVars(void)
 { // testUpdateStateVars
-  // STUFF GOES HERE
+  // :TODO: Need to verify that fault constitutive updateStateVars is called.
 } // testUpdateStateVars
 
 // ----------------------------------------------------------------------
@@ -198,12 +227,18 @@
 void
 pylith::faults::TestFaultCohesiveDynL::testCalcTractions(void)
 { // testCalcTractions
+  CPPUNIT_ASSERT(0 != _data);
+
   topology::Mesh mesh;
   FaultCohesiveDynL fault;
   topology::SolutionFields fields(mesh);
-  _initialize(&mesh, &fault, &fields);
+  _initialize(&mesh, &fault, &fields, _data->fieldIncrStick);
   
-  // STUFF GOES HERE
+  // Test with dbInitialTract
+  // :TODO: STUFF GOES HERE (Brad)
+
+  // Test without dbInitialTract
+  // :TODO: STUFF GOES HERE (Brad)
 } // testCalcTractions
 
 // ----------------------------------------------------------------------
@@ -212,7 +247,8 @@
 pylith::faults::TestFaultCohesiveDynL::_initialize(
 					topology::Mesh* const mesh,
 					FaultCohesiveDynL* const fault,
-					topology::SolutionFields* const fields)
+					topology::SolutionFields* const fields,
+					const double* const fieldIncr)
 { // _initialize
   CPPUNIT_ASSERT(0 != mesh);
   CPPUNIT_ASSERT(0 != fault);
@@ -252,9 +288,8 @@
   int firstFaultVertex    = 0;
   int firstLagrangeVertex = mesh->sieveMesh()->getIntSection(_data->label)->size();
   int firstFaultCell      = mesh->sieveMesh()->getIntSection(_data->label)->size();
-  if (fault->useLagrangeConstraints()) {
+  if (fault->useLagrangeConstraints())
     firstFaultCell += mesh->sieveMesh()->getIntSection(_data->label)->size();
-  }
   fault->id(_data->id);
   fault->label(_data->label);
   fault->quadrature(_quadrature);

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh	2009-12-13 23:45:20 UTC (rev 16101)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh	2009-12-14 04:15:30 UTC (rev 16102)
@@ -108,10 +108,12 @@
    * @param mesh PETSc mesh to initialize
    * @param fault Cohesive fault interface condition to initialize.
    * @param fields Solution fields.
+   * @param fieldIncrVals Values for solution increment field.
    */
   void _initialize(topology::Mesh* const mesh,
 		   FaultCohesiveDynL* const fault,
-		   topology::SolutionFields* const fields);
+		   topology::SolutionFields* const fields,
+		   const double* const fieldIncrVals);
 
   /** Determine if vertex is a Lagrange multiplier constraint vertex.
    *

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.cc	2009-12-13 23:45:20 UTC (rev 16101)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.cc	2009-12-14 04:15:30 UTC (rev 16102)
@@ -29,13 +29,16 @@
   label(0),
   initialTractFilename(0),
   fieldT(0),
-  fieldIncr(0),
+  fieldIncrStick(0),
+  fieldIncrSlip(0),
+  fieldIncrOpen(0),
   jacobian(0),
   orientation(0),
+  initialTractions(0),
   area(0),
-  fieldIncrSlip(0),
+  fieldIncrSlipE(0),
   slipSlip(0),
-  fieldIncrOpen(0),
+  fieldIncrOpenE(0),
   slipOpen(0),
   constraintVertices(0),
   constraintCells(0),

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.hh	2009-12-13 23:45:20 UTC (rev 16101)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDynLData.hh	2009-12-14 04:15:30 UTC (rev 16102)
@@ -59,7 +59,9 @@
   /// @name Input fields
   //@{
   double* fieldT; ///< Solution field at time t.
-  double* fieldIncr; ///< Solution increment field at time t.
+  double* fieldIncrStick; ///< Soln increment field at time t for stick case.
+  double* fieldIncrSlip; ///< Soln increment field at time t for slipping case.
+  double* fieldIncrOpen; ///< Soln increment field at time t for opening case.
   double* jacobian; ///< Jacobian sparse matrix.
   //@}
 
@@ -67,9 +69,10 @@
   //@{
   double* orientation; ///< Expected values for fault orientation.
   double* area; ///< Expected values for fault area.
-  double* fieldIncrSlip; ///< Expected values for solution increment for slipping case.
+  double* initialTractions; ///< Expected values for initial tractions.
+  double* fieldIncrSlipE; ///< Expected values for solution increment for slipping case.
   double* slipSlip; ///< Expected values for slip for slipping case.
-  double* fieldIncrOpen; ///< Expected values for solution increment for opening case.
+  double* fieldIncrOpenE; ///< Expected values for solution increment for opening case.
   double* slipOpen; ///< Expected values for slip for opening case.
 
   int* constraintVertices; ///< Expected points for constraint vertices



More information about the CIG-COMMITS mailing list