[cig-commits] [commit] knepley/fix-faults-parallel: Update unit tests for inclusion of fault halo. (ffea5cb)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Apr 18 13:33:44 PDT 2014


Repository : ssh://geoshell/pylith

On branch  : knepley/fix-faults-parallel
Link       : https://github.com/geodynamics/pylith/compare/1cbca9cbd832376cceca629383ad3c8e3db090f0...1169098c7387a0574706ddb12645c08f3401a304

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

commit ffea5cb01f0fd97731e44cab0328261981f4cebb
Author: Brad Aagaard <baagaard at usgs.gov>
Date:   Fri Apr 18 12:46:20 2014 -0700

    Update unit tests for inclusion of fault halo.


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

ffea5cb01f0fd97731e44cab0328261981f4cebb
 unittests/libtests/faults/TestFaultCohesiveKin.cc  | 28 +++++++----
 .../libtests/faults/data/CohesiveKinDataQuad4i.cc  | 58 +++++++++++-----------
 .../libtests/faults/data/CohesiveKinDataTri3g.cc   | 58 +++++++++++-----------
 3 files changed, 79 insertions(+), 65 deletions(-)

diff --git a/unittests/libtests/faults/TestFaultCohesiveKin.cc b/unittests/libtests/faults/TestFaultCohesiveKin.cc
index bc86050..2f36e88 100644
--- a/unittests/libtests/faults/TestFaultCohesiveKin.cc
+++ b/unittests/libtests/faults/TestFaultCohesiveKin.cc
@@ -169,9 +169,8 @@ pylith::faults::TestFaultCohesiveKin::testInitialize(void)
   CPPUNIT_ASSERT_EQUAL(_data->numCohesiveCells, fault.numCells());
 
 #if 0 // DEBUGGING
-  PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_ASCII_INFO_DETAIL);
-  DMView(fault._faultMesh->dmMesh(), PETSC_VIEWER_STDOUT_WORLD);
-  PetscViewerPopFormat(PETSC_VIEWER_STDOUT_WORLD);
+  mesh.view("::ascii_info_detail");
+  fault._faultMesh->view("::ascii_info_detail");
 #endif
 
   topology::SubMeshIS subpointIS(*fault._faultMesh);
@@ -193,6 +192,9 @@ pylith::faults::TestFaultCohesiveKin::testInitialize(void)
   CPPUNIT_ASSERT_EQUAL(_data->numFaultVertices, vEnd-vStart);
 
   // Check cohesive vertex info; permit different order of vertices.
+  PetscDMLabel clamped = NULL;
+  err = DMPlexGetLabel(dmMesh, "clamped", &clamped);PYLITH_CHECK_ERROR(err);
+
   const int numFaultVertices = _data->numFaultVertices;
   CPPUNIT_ASSERT_EQUAL(numFaultVertices, int(fault._cohesiveVertices.size()));
   int_array verticesFaultSorted(_data->verticesFault, numFaultVertices);
@@ -200,14 +202,16 @@ pylith::faults::TestFaultCohesiveKin::testInitialize(void)
   int* sortedEnd = &verticesFaultSorted[numFaultVertices];
   std::sort(sortedBegin, sortedEnd);
   for (int i=0; i < numFaultVertices; ++i) {
-    const int* iter = std::lower_bound(sortedBegin, sortedEnd, fault._cohesiveVertices[i].fault);
+    const PetscInt sign = (fault._cohesiveVertices[i].fault < 0) ? -1 : 1;
+    const PetscInt v_fault = sign*fault._cohesiveVertices[i].fault;
+    const int* iter = std::lower_bound(sortedBegin, sortedEnd, v_fault);
     CPPUNIT_ASSERT(iter != sortedEnd);
     const int index = iter - sortedBegin;
 
-    CPPUNIT_ASSERT_EQUAL(_data->verticesFault[index], fault._cohesiveVertices[i].fault);
-    CPPUNIT_ASSERT_EQUAL(_data->edgesLagrange[index], fault._cohesiveVertices[i].lagrange);
-    CPPUNIT_ASSERT_EQUAL(_data->verticesNegative[index], fault._cohesiveVertices[i].negative);
-    CPPUNIT_ASSERT_EQUAL(_data->verticesPositive[index], fault._cohesiveVertices[i].positive);
+    CPPUNIT_ASSERT_EQUAL(_data->verticesFault[index], sign*fault._cohesiveVertices[i].fault);
+    CPPUNIT_ASSERT_EQUAL(_data->edgesLagrange[index], sign*fault._cohesiveVertices[i].lagrange);
+    CPPUNIT_ASSERT_EQUAL(_data->verticesNegative[index], sign*fault._cohesiveVertices[i].negative);
+    CPPUNIT_ASSERT_EQUAL(_data->verticesPositive[index], sign*fault._cohesiveVertices[i].positive);
   } // for
 
   // Check cohesive cell info
@@ -337,8 +341,11 @@ pylith::faults::TestFaultCohesiveKin::testIntegrateJacobian(void)
   PetscDM dmMesh = mesh.dmMesh();CPPUNIT_ASSERT(dmMesh);
   topology::Stratum verticesStratum(dmMesh, topology::Stratum::DEPTH, 0);
 
+  PetscInt numClampedVertices = 0;
+  PetscErrorCode err = DMPlexGetLabelSize(fault._faultMesh->dmMesh(), "clamped", &numClampedVertices);PYLITH_CHECK_ERROR(err);
+
   CPPUNIT_ASSERT(_data->jacobian);
-  const int numDOF = verticesStratum.size() + _data->numFaultVertices;
+  const int numDOF = verticesStratum.size() + _data->numFaultVertices - numClampedVertices;
   const int spaceDim = _data->spaceDim;
   const PylithScalar* valsE = _data->jacobian;
   const PetscInt nrowsE = numDOF * _data->spaceDim;
@@ -564,6 +571,9 @@ pylith::faults::TestFaultCohesiveKin::testCalcTractionsChange(void)
 
     const PetscInt v_fault = fault._cohesiveVertices[i].fault;
     const PetscInt e_lagrange = fault._cohesiveVertices[i].lagrange;
+    if (e_lagrange < 0) { // skip clamped edges
+      continue;
+    } // if
 
     const PetscInt toff = tractionVisitor.sectionOffset(v_fault);
     CPPUNIT_ASSERT_EQUAL(spaceDim, tractionVisitor.sectionDof(v_fault));
diff --git a/unittests/libtests/faults/data/CohesiveKinDataQuad4i.cc b/unittests/libtests/faults/data/CohesiveKinDataQuad4i.cc
index 8558582..3599778 100644
--- a/unittests/libtests/faults/data/CohesiveKinDataQuad4i.cc
+++ b/unittests/libtests/faults/data/CohesiveKinDataQuad4i.cc
@@ -137,38 +137,40 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobianLumped[(15+3)
 
 
 
-const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_orientation[3*2*2] = {
+const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_orientation[4*2*2] = {
   0.0, +1.0,   1.0, 0.0,
+  0.0,  0.0,   0.0, 0.0,
   0.0, +1.0,   1.0, 0.0,
   0.0, +1.0,   1.0, 0.0,
 };
 
-const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_area[3] = {
+const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_area[4] = {
+  10.0,
    5.0,
   10.0,
    5.0,
 };
 
-const int pylith::faults::CohesiveKinDataQuad4i::_numFaultVertices = 3;
-const int pylith::faults::CohesiveKinDataQuad4i::_verticesFault[3] = {
-   4,  5,  6
+const int pylith::faults::CohesiveKinDataQuad4i::_numFaultVertices = 4;
+const int pylith::faults::CohesiveKinDataQuad4i::_verticesFault[4] = {
+  6,  7,  8,  9,
 };
-const int pylith::faults::CohesiveKinDataQuad4i::_edgesLagrange[3] = {
-  44, 45, 46
+const int pylith::faults::CohesiveKinDataQuad4i::_edgesLagrange[4] = {
+  44, 47, 45, 46,
 };
-const int pylith::faults::CohesiveKinDataQuad4i::_verticesNegative[3] = {
-   13,  16, 19
+const int pylith::faults::CohesiveKinDataQuad4i::_verticesNegative[4] = {
+  13, 14, 16, 19,
 };
-const int pylith::faults::CohesiveKinDataQuad4i::_verticesPositive[3] = {
-  21, 22, 23
+const int pylith::faults::CohesiveKinDataQuad4i::_verticesPositive[4] = {
+  21, 14, 22, 23,
 };
 
-const int pylith::faults::CohesiveKinDataQuad4i::_numCohesiveCells = 2;
-const int pylith::faults::CohesiveKinDataQuad4i::_cellMappingFault[2] = {
-  7, 8,
+const int pylith::faults::CohesiveKinDataQuad4i::_numCohesiveCells = 3;
+const int pylith::faults::CohesiveKinDataQuad4i::_cellMappingFault[3] = {
+  10, 11, 12,
 };
-const int pylith::faults::CohesiveKinDataQuad4i::_cellMappingCohesive[2] = {
-  7, 8,
+const int pylith::faults::CohesiveKinDataQuad4i::_cellMappingCohesive[3] = {
+  6, 7, 8,
 };
 
 
@@ -177,7 +179,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_residual[(15+3)*2] =
   0.0,  0.0, // 10
   0.0,  0.0, // 11
   0.0,  0.0, // 12
- +5.0*4.7, +5.0*6.6, // 13
+ +10.0*4.7, +10.0*6.6, // 13
   0.0,  0.0, // 14
   0.0,  0.0, // 15
  +10.0*4.9, +10.0*6.7, // 16
@@ -185,11 +187,11 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_residual[(15+3)*2] =
   0.0,  0.0, // 18
  +5.0*4.6, +5.0*6.8, // 19
   0.0,  0.0, // 20
- -5.0*4.7, -5.0*6.6, // 21
+ -10.0*4.7, -10.0*6.6, // 21
  -10.0*4.9, -10.0*6.7, // 22
  -5.0*4.6, -5.0*6.8, // 23
-  -5.0*(4.1-3.5 - 0.08241148423),
-  -5.0*(6.1-5.5 - 1.89546413727), // 44
+ -10.0*(4.1-3.5 - 0.08241148423),
+ -10.0*(6.1-5.5 - 1.89546413727), // 44
  -10.0*(4.3-3.8 - 0.14794836271),
  -10.0*(6.3-5.8 - 1.77538035254), // 45
   -5.0*(4.5-4.2 - 0.19186497837),
@@ -356,7 +358,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobian[(15+3)*2*(15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
- -5.0, 0.0, // 44
+-10.0, 0.0, // 44
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0, // 13y
@@ -374,7 +376,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobian[(15+3)*2*(15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
-  0.0,-5.0, // 44
+  0.0,-10.0, // 44
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0, // 14x
@@ -644,7 +646,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobian[(15+3)*2*(15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
- +5.0, 0.0, // 44
++10.0, 0.0, // 44
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0, // 21y
@@ -662,7 +664,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobian[(15+3)*2*(15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
-  0.0,+5.0, // 44
+  0.0,+10.0, // 44
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0, // 22x
@@ -741,7 +743,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobian[(15+3)*2*(15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
- -5.0, 0.0, // 13
+-10.0, 0.0, // 13
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
@@ -749,7 +751,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobian[(15+3)*2*(15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
- +5.0, 0.0, // 21
++10.0, 0.0, // 21
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
@@ -759,7 +761,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobian[(15+3)*2*(15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
-  0.0,-5.0, // 13
+  0.0,-10.0, // 13
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
@@ -767,7 +769,7 @@ const PylithScalar pylith::faults::CohesiveKinDataQuad4i::_jacobian[(15+3)*2*(15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
-  0.0,+5.0, // 21
+  0.0,+10.0, // 21
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
diff --git a/unittests/libtests/faults/data/CohesiveKinDataTri3g.cc b/unittests/libtests/faults/data/CohesiveKinDataTri3g.cc
index 5bc3159..514669b 100644
--- a/unittests/libtests/faults/data/CohesiveKinDataTri3g.cc
+++ b/unittests/libtests/faults/data/CohesiveKinDataTri3g.cc
@@ -112,50 +112,52 @@ const PylithScalar pylith::faults::CohesiveKinDataTri3g::_jacobianLumped[(9+2)*2
 };
 
 
-const PylithScalar pylith::faults::CohesiveKinDataTri3g::_orientation[2*2*2] = {
+const PylithScalar pylith::faults::CohesiveKinDataTri3g::_orientation[3*2*2] = {
+  0.0,  0.0,   0.0,  0.0,
   0.0, +1.0,  +1.0,  0.0,
   0.0, +1.0,  +1.0,  0.0,
 };
 
-const PylithScalar pylith::faults::CohesiveKinDataTri3g::_area[2] = {
+const PylithScalar pylith::faults::CohesiveKinDataTri3g::_area[3] = {
   1.0,
+  2.0,
   1.0,
 };
 
-const int pylith::faults::CohesiveKinDataTri3g::_numFaultVertices = 2;
-const int pylith::faults::CohesiveKinDataTri3g::_verticesFault[2] = {
-   2,  3,
+const int pylith::faults::CohesiveKinDataTri3g::_numFaultVertices = 3;
+const int pylith::faults::CohesiveKinDataTri3g::_verticesFault[3] = {
+  4,  5,  6,
 };
-const int pylith::faults::CohesiveKinDataTri3g::_edgesLagrange[2] = {
-  31, 32,
+const int pylith::faults::CohesiveKinDataTri3g::_edgesLagrange[3] = {
+  33, 31, 32,
 };
-const int pylith::faults::CohesiveKinDataTri3g::_verticesNegative[2] = {
-  10, 13,
+const int pylith::faults::CohesiveKinDataTri3g::_verticesNegative[3] = {
+   8, 10, 13,
 };
-const int pylith::faults::CohesiveKinDataTri3g::_verticesPositive[2] = {
-  15, 16,
+const int pylith::faults::CohesiveKinDataTri3g::_verticesPositive[3] = {
+  8, 15, 16,
 };
 
-const int pylith::faults::CohesiveKinDataTri3g::_numCohesiveCells = 1;
-const int pylith::faults::CohesiveKinDataTri3g::_cellMappingFault[1] = {
-  4,
+const int pylith::faults::CohesiveKinDataTri3g::_numCohesiveCells = 2;
+const int pylith::faults::CohesiveKinDataTri3g::_cellMappingFault[2] = {
+  7, 8,
 };
-const int pylith::faults::CohesiveKinDataTri3g::_cellMappingCohesive[1] = {
-  7,
+const int pylith::faults::CohesiveKinDataTri3g::_cellMappingCohesive[2] = {
+  6, 7,
 };
 
 const PylithScalar pylith::faults::CohesiveKinDataTri3g::_residual[(9+2)*2] = {
   0.0,  0.0, // 8
   0.0,  0.0, // 9
- +6.8, +8.8, // 10
+ +6.8*2, +8.8*2, // 10
   0.0,  0.0, // 11
   0.0,  0.0, // 12
  +6.0, +8.0, // 13
   0.0,  0.0, // 14
- -6.8, -8.8, // 15
+ -6.8*2, -8.8*2, // 15
  -6.0, -8.0, // 16
- -(6.9-6.3) + (0.08241148423),
- -(8.9-8.3) + (1.89546413727), // 31
+ -(6.9-6.3)*2 + (0.08241148423)*2,
+ -(8.9-8.3)*2 + (1.89546413727)*2, // 31
  -(7.1-6.6) + (0.14794836271),
  -(9.1-8.6) + (1.77538035254), // 32
 };
@@ -214,7 +216,7 @@ const PylithScalar pylith::faults::CohesiveKinDataTri3g::_jacobian[(9+2)*2*(9+2)
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
- -1.0, 0.0, // 31
+ -2.0, 0.0, // 31
   0.0, 0.0,
   0.0, 0.0, // 10y
   0.0, 0.0,
@@ -225,7 +227,7 @@ const PylithScalar pylith::faults::CohesiveKinDataTri3g::_jacobian[(9+2)*2*(9+2)
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
-  0.0,-1.0, // 31
+  0.0,-2.0, // 31
   0.0, 0.0,
   0.0, 0.0, // 11x
   0.0, 0.0,
@@ -324,7 +326,7 @@ const PylithScalar pylith::faults::CohesiveKinDataTri3g::_jacobian[(9+2)*2*(9+2)
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
- +1.0, 0.0, // 31
+ +2.0, 0.0, // 31
   0.0, 0.0,
   0.0, 0.0, // 15y
   0.0, 0.0,
@@ -335,7 +337,7 @@ const PylithScalar pylith::faults::CohesiveKinDataTri3g::_jacobian[(9+2)*2*(9+2)
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
-  0.0,+1.0, // 31
+  0.0,+2.0, // 31
   0.0, 0.0,
   0.0, 0.0, // 16x
   0.0, 0.0,
@@ -361,23 +363,23 @@ const PylithScalar pylith::faults::CohesiveKinDataTri3g::_jacobian[(9+2)*2*(9+2)
   0.0,+1.0, // 32
   0.0, 0.0, // 31x
   0.0, 0.0,
- -1.0, 0.0, // 10
+ -2.0, 0.0, // 10
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
- +1.0, 0.0, // 15
+ +2.0, 0.0, // 15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0, // 31y
   0.0, 0.0,
-  0.0,-1.0, // 10
+  0.0,-2.0, // 10
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,
-  0.0,+1.0, // 15
+  0.0,+2.0, // 15
   0.0, 0.0,
   0.0, 0.0,
   0.0, 0.0,



More information about the CIG-COMMITS mailing list