[cig-commits] r15923 - in short/3D/PyLith/branches/pylith-friction: . libsrc/faults unittests/libtests/faults
brad at geodynamics.org
brad at geodynamics.org
Tue Nov 3 13:22:16 PST 2009
Author: brad
Date: 2009-11-03 13:22:14 -0800 (Tue, 03 Nov 2009)
New Revision: 15923
Modified:
short/3D/PyLith/branches/pylith-friction/TODO
short/3D/PyLith/branches/pylith-friction/libsrc/faults/FaultCohesiveKin.cc
short/3D/PyLith/branches/pylith-friction/libsrc/faults/FaultCohesiveKin.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKin.cc
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKin.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinHex8.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinLine2.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinQuad4.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinQuad4e.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsHex8.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsLine2.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsQuad4.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsTet4.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsTri3.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTet4e.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTet4f.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTri3.hh
short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTri3d.hh
Log:
Added C++ unit test for FaultCohesiveKin::integrateJacobianAssembled() for lumped Jacobian. Added missing calls to integrateJacobianAssembled().
Modified: short/3D/PyLith/branches/pylith-friction/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-friction/TODO 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/TODO 2009-11-03 21:22:14 UTC (rev 15923)
@@ -36,7 +36,6 @@
Unit tests
FaultCohesiveKin
- integrateJacobian (lumped)
adjustSolnLumped
FaultCohesiveDynL
Modified: short/3D/PyLith/branches/pylith-friction/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/branches/pylith-friction/libsrc/faults/FaultCohesiveKin.cc 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/libsrc/faults/FaultCohesiveKin.cc 2009-11-03 21:22:14 UTC (rev 15923)
@@ -632,11 +632,10 @@
// require assembly across cells, vertices, or processors.
void
pylith::faults::FaultCohesiveKin::integrateJacobianAssembled(
- topology::Field<topology::Mesh>* jacobian,
+ topology::Field<topology::Mesh>& jacobian,
const double t,
topology::SolutionFields* const fields)
{ // integrateJacobianAssembled
- assert(0 != jacobian);
assert(0 != fields);
assert(0 != _fields);
@@ -668,7 +667,7 @@
const int spaceDim = _quadrature->spaceDim();
double_array jacobianVertex(spaceDim);
jacobianVertex = 1.0;
- const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
+ const ALE::Obj<RealSection>& jacobianSection = jacobian.section();
assert(!jacobianSection.isNull());
for (SieveSubMesh::label_sequence::iterator v_iter=verticesBegin;
v_iter != verticesEnd;
Modified: short/3D/PyLith/branches/pylith-friction/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/libsrc/faults/FaultCohesiveKin.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/libsrc/faults/FaultCohesiveKin.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -180,7 +180,7 @@
* @param t Current time
* @param fields Solution fields
*/
- void integrateJacobianAssembled(topology::Field<topology::Mesh>* jacobian,
+ void integrateJacobianAssembled(topology::Field<topology::Mesh>& jacobian,
const double t,
topology::SolutionFields* const fields);
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKin.cc 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKin.cc 2009-11-03 21:22:14 UTC (rev 15923)
@@ -521,12 +521,12 @@
topology::Jacobian jacobian(fields);
const double t = 2.134;
- fault.integrateJacobian(&jacobian, t, &fields);
+ fault.integrateJacobianAssembled(&jacobian, t, &fields);
CPPUNIT_ASSERT_EQUAL(false, fault.needNewJacobian());
jacobian.assemble("final_assembly");
- //MatView(jacobian, PETSC_VIEWER_STDOUT_WORLD); // DEBUGGING
+ // MatView(jacobian.matrix(), PETSC_VIEWER_STDOUT_WORLD); // DEBUGGING
const double* valsE = _data->valsJacobian;
const int nrowsE = dispSection->sizeWithBC();
@@ -576,6 +576,77 @@
} // testIntegrateJacobianAssembled
// ----------------------------------------------------------------------
+// Test integrateJacobianAssembled() with lumped Jacobian.
+void
+pylith::faults::TestFaultCohesiveKin::testIntegrateJacobianAssembledLumped(void)
+{ // testIntegrateJacobianAssembledLumped
+ topology::Mesh mesh;
+ FaultCohesiveKin fault;
+ topology::SolutionFields fields(mesh);
+ _initialize(&mesh, &fault, &fields);
+
+ topology::Field<topology::Mesh> jacobian(mesh);
+ jacobian.label("Jacobian");
+ jacobian.vectorFieldType(topology::FieldBase::VECTOR);
+ jacobian.newSection(topology::FieldBase::VERTICES_FIELD, _data->spaceDim);
+ jacobian.allocate();
+
+ const double t = 2.134;
+ fault.integrateJacobianAssembled(jacobian, t, &fields);
+ CPPUNIT_ASSERT_EQUAL(false, fault.needNewJacobian());
+ jacobian.complete();
+
+#if 0 // DEBUGGING
+ jacobian.view("JACOBIAN");
+#endif // DEBUGGING
+
+ const ALE::Obj<RealSection>& jacobianSection = jacobian.section();
+ CPPUNIT_ASSERT(!jacobianSection.isNull());
+
+ int iVertex = 0;
+ const double tolerance = 1.0e-06;
+ const int spaceDim = _data->spaceDim;
+ const ALE::Obj<SieveSubMesh>& faultSieveMesh = fault._faultMesh->sieveMesh();
+ CPPUNIT_ASSERT(!faultSieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ faultSieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+ const SieveSubMesh::label_sequence::iterator verticesBegin =
+ vertices->begin();
+ const SieveSubMesh::label_sequence::iterator verticesEnd = vertices->end();
+ SieveSubMesh::renumbering_type& renumbering =
+ faultSieveMesh->getRenumbering();
+ const SieveMesh::renumbering_type::const_iterator renumberingBegin =
+ renumbering.begin();
+ const SieveMesh::renumbering_type::const_iterator renumberingEnd =
+ renumbering.end();
+ for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
+ v_iter != verticesEnd;
+ ++v_iter, ++iVertex) {
+ SieveMesh::point_type meshVertex = -1;
+ bool found = false;
+
+ for (SieveMesh::renumbering_type::const_iterator r_iter = renumberingBegin;
+ r_iter != renumberingEnd;
+ ++r_iter) {
+ if (r_iter->second == *v_iter) {
+ meshVertex = r_iter->first;
+ found = true;
+ break;
+ } // if
+ } // for
+ CPPUNIT_ASSERT(found);
+ int fiberDim = jacobianSection->getFiberDimension(meshVertex);
+ CPPUNIT_ASSERT_EQUAL(spaceDim, fiberDim);
+ const double* jacobianVertex = jacobianSection->restrictPoint(meshVertex);
+ CPPUNIT_ASSERT(0 != jacobianVertex);
+ for (int iDim=0; iDim < spaceDim; ++iDim)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, jacobianVertex[iDim],
+ tolerance);
+ } // for
+} // testIntegrateJacobianAssembledLumped
+
+// ----------------------------------------------------------------------
// Test updateStateVars().
void
pylith::faults::TestFaultCohesiveKin::testUpdateStateVars(void)
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKin.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKin.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -101,6 +101,9 @@
/// Test integrateJacobianAssembled().
void testIntegrateJacobianAssembled(void);
+ /// Test integrateJacobianAssembled() with lumped Jacobian.
+ void testIntegrateJacobianAssembledLumped(void);
+
/// Test updateStateVars().
void testUpdateStateVars(void);
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinHex8.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinHex8.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST( testSplitField );
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinLine2.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinLine2.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinLine2.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST( testSplitField );
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinQuad4.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinQuad4.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST( testSplitField );
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinQuad4e.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinQuad4e.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinQuad4e.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST( testSplitField );
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsHex8.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsHex8.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsLine2.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsLine2.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsLine2.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -41,6 +41,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsQuad4.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsQuad4.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsTet4.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsTet4.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsTri3.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinSrcsTri3.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST_SUITE_END();
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTet4e.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTet4e.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTet4e.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST( testSplitField );
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTet4f.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTet4f.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTet4f.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST( testSplitField );
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTri3.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTri3.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST( testSplitField );
Modified: short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTri3d.hh
===================================================================
--- short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTri3d.hh 2009-11-03 20:51:27 UTC (rev 15922)
+++ short/3D/PyLith/branches/pylith-friction/unittests/libtests/faults/TestFaultCohesiveKinTri3d.hh 2009-11-03 21:22:14 UTC (rev 15923)
@@ -40,6 +40,8 @@
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testIntegrateResidual );
CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST( testIntegrateJacobianAssembled );
+ CPPUNIT_TEST( testIntegrateJacobianAssembledLumped );
CPPUNIT_TEST( testUpdateStateVars );
CPPUNIT_TEST( testCalcTractionsChange );
CPPUNIT_TEST( testSplitField );
More information about the CIG-COMMITS
mailing list