[cig-commits] r16289 - in short/3D/PyLith/trunk: libsrc/friction unittests/libtests/friction unittests/libtests/friction/data
surendra at geodynamics.org
surendra at geodynamics.org
Sat Feb 20 20:04:52 PST 2010
Author: surendra
Date: 2010-02-20 20:04:52 -0800 (Sat, 20 Feb 2010)
New Revision: 16289
Added:
short/3D/PyLith/trunk/unittests/libtests/friction/TestRateStateAgeing.cc
short/3D/PyLith/trunk/unittests/libtests/friction/TestRateStateAgeing.hh
short/3D/PyLith/trunk/unittests/libtests/friction/data/RateStateAgeingData.cc
short/3D/PyLith/trunk/unittests/libtests/friction/data/RateStateAgeingData.hh
Modified:
short/3D/PyLith/trunk/libsrc/friction/RateStateAgeing.cc
short/3D/PyLith/trunk/unittests/libtests/friction/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/friction/TestFrictionModel.cc
Log:
Added unittests for RateStateAgeing (all tests passed)
Modified: short/3D/PyLith/trunk/libsrc/friction/RateStateAgeing.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/RateStateAgeing.cc 2010-02-21 03:26:01 UTC (rev 16288)
+++ short/3D/PyLith/trunk/libsrc/friction/RateStateAgeing.cc 2010-02-21 04:04:52 UTC (rev 16289)
@@ -164,7 +164,7 @@
std::ostringstream msg;
msg << "Spatial database returned nonpositive value for constitutive "
<< "parameter 'b' of Rate and State friction Ageing Law.\n"
- << "Rate and State parameter 'a' of Ageing Law of friction: " << b << "\n";
+ << "Rate and State parameter 'b' of Ageing Law of friction: " << b << "\n";
throw std::runtime_error(msg.str());
} // if
@@ -187,7 +187,6 @@
assert(nvalues == _RateStateAgeing::numProperties);
const double lengthScale = _normalizer->lengthScale();
- const double pressureScale = _normalizer->pressureScale();
const double timeScale = _normalizer->timeScale();
values[p_slipRate0] /= lengthScale / timeScale;
@@ -205,7 +204,6 @@
assert(nvalues == _RateStateAgeing::numProperties);
const double lengthScale = _normalizer->lengthScale();
- const double pressureScale = _normalizer->pressureScale();
const double timeScale = _normalizer->timeScale();
values[p_slipRate0] *= lengthScale / timeScale;
@@ -328,6 +326,8 @@
else
stateVars[s_state] = thetaN * expTerm +
L / slipRate * (1 - expTerm);
+
+ PetscLogFlops(6);
} // _updateStateVars
Modified: short/3D/PyLith/trunk/unittests/libtests/friction/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/Makefile.am 2010-02-21 03:26:01 UTC (rev 16288)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/Makefile.am 2010-02-21 04:04:52 UTC (rev 16289)
@@ -24,25 +24,29 @@
test_friction.cc \
TestFrictionModel.cc \
TestStaticFriction.cc \
- TestSlipWeakening.cc
+ TestSlipWeakening.cc \
+ TestRateStateAgeing.cc
noinst_HEADERS =
TestFrictionModel.hh \
TestStaticFriction.hh \
- TestSlipWeakening.hh
+ TestSlipWeakening.hh \
+ TestRateStateAgeing.hh
# Source files associated with testing data
testfriction_SOURCES += \
data/FrictionModelData.cc \
data/StaticFrictionData.cc \
- data/SlipWeakeningData.cc
+ data/SlipWeakeningData.cc \
+ data/RateStateAgeingData.cc
noinst_HEADERS += \
data/FrictionModelData.hh \
data/StaticFrictionData.hh \
- data/SlipWeakeningData.hh
+ data/SlipWeakeningData.hh \
+ data/RateStateAgeingData.hh
AM_CPPFLAGS = \
$(PYTHON_EGG_CPPFLAGS) -I$(PYTHON_INCDIR) \
Modified: short/3D/PyLith/trunk/unittests/libtests/friction/TestFrictionModel.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/TestFrictionModel.cc 2010-02-21 03:26:01 UTC (rev 16288)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/TestFrictionModel.cc 2010-02-21 04:04:52 UTC (rev 16289)
@@ -560,6 +560,7 @@
const double frictionE = _data->friction[iLoc];
const double tolerance = 1.0e-06;
+
if (0.0 != frictionE)
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, friction/frictionE, tolerance);
else
Added: short/3D/PyLith/trunk/unittests/libtests/friction/TestRateStateAgeing.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/TestRateStateAgeing.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/TestRateStateAgeing.cc 2010-02-21 04:04:52 UTC (rev 16289)
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestRateStateAgeing.hh" // Implementation of class methods
+
+#include "data/RateStateAgeingData.hh" // USES RateStateAgeingData
+
+#include "pylith/friction/RateStateAgeing.hh" // USES RateStateAgeing
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::friction::TestRateStateAgeing );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::friction::TestRateStateAgeing::setUp(void)
+{ // setUp
+ _friction = new RateStateAgeing();
+ _data = new RateStateAgeingData();
+ setupNormalizer();
+} // setUp
+
+// ----------------------------------------------------------------------
+// Test hasProperty().
+void
+pylith::friction::TestRateStateAgeing::testHasProperty(void)
+{ // testHasProperty
+ RateStateAgeing material;
+
+ CPPUNIT_ASSERT(material.hasProperty("reference_friction_coefficient"));
+ CPPUNIT_ASSERT(material.hasProperty("reference_slip_rate"));
+ CPPUNIT_ASSERT(material.hasProperty("characteristic_slip_distance"));
+ CPPUNIT_ASSERT(material.hasProperty("constitutive_parameter_a"));
+ CPPUNIT_ASSERT(material.hasProperty("constitutive_parameter_b"));
+ CPPUNIT_ASSERT(!material.hasProperty("aaa"));
+} // testHasProperty
+
+// ----------------------------------------------------------------------
+// Test hasStateVar().
+void
+pylith::friction::TestRateStateAgeing::testHasStateVar(void)
+{ // testHasStateVar
+ RateStateAgeing material;
+
+ CPPUNIT_ASSERT(material.hasStateVar("state_variable"));
+ CPPUNIT_ASSERT(!material.hasStateVar("aaa"));
+} // testHasStateVar
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/friction/TestRateStateAgeing.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/TestRateStateAgeing.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/TestRateStateAgeing.hh 2010-02-21 04:04:52 UTC (rev 16289)
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/friction/TestRateStateAgeing.hh
+ *
+ * @brief C++ TestRateStateAgeing object
+ *
+ * C++ unit testing for RateStateAgeing.
+ */
+
+#if !defined(pylith_friction_testelasticisotropic3d_hh)
+#define pylith_friction_testelasticisotropic3d_hh
+
+#include "TestFrictionModel.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace friction {
+ class TestRateStateAgeing;
+ } // friction
+} // pylith
+
+/// C++ unit testing for RateStateAgeing
+class pylith::friction::TestRateStateAgeing : public TestFrictionModel
+{ // class TestRateStateAgeing
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestRateStateAgeing );
+
+ CPPUNIT_TEST( testDBToProperties );
+ CPPUNIT_TEST( testNonDimProperties );
+ CPPUNIT_TEST( testDimProperties );
+ CPPUNIT_TEST( testDBToStateVars );
+ CPPUNIT_TEST( testNonDimStateVars );
+ CPPUNIT_TEST( testDimStateVars );
+ CPPUNIT_TEST( testHasProperty );
+ CPPUNIT_TEST( testHasStateVar );
+ CPPUNIT_TEST( test_calcFriction );
+ CPPUNIT_TEST( test_updateStateVars );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Test hasProperty().
+ void testHasProperty(void);
+
+ /// Test hasStateVar().
+ void testHasStateVar(void);
+
+}; // class TestRateStateAgeing
+
+#endif // pylith_friction_testelasticisotropic3d_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/friction/data/RateStateAgeingData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/data/RateStateAgeingData.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/data/RateStateAgeingData.cc 2010-02-21 04:04:52 UTC (rev 16289)
@@ -0,0 +1,174 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "RateStateAgeingData.hh"
+
+const int pylith::friction::RateStateAgeingData::_numLocs = 2;
+
+const int pylith::friction::RateStateAgeingData::_numProperties = 5;
+
+const int pylith::friction::RateStateAgeingData::_numStateVars = 1;
+
+const int pylith::friction::RateStateAgeingData::_numDBProperties = 5;
+
+const int pylith::friction::RateStateAgeingData::_numDBStateVars = 1;
+
+const int pylith::friction::RateStateAgeingData::_numPropsVertex = 5;
+
+const int pylith::friction::RateStateAgeingData::_numVarsVertex = 1;
+
+const double pylith::friction::RateStateAgeingData::_lengthScale = 1.00000000e+03;
+
+const double pylith::friction::RateStateAgeingData::_timeScale = 1.00000000e+00;
+
+const double pylith::friction::RateStateAgeingData::_pressureScale = 2.25000000e+10;
+
+const double pylith::friction::RateStateAgeingData::_densityScale = 1.00000000e+03;
+
+const int pylith::friction::RateStateAgeingData::_numPropertyValues[] = {
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+};
+
+const int pylith::friction::RateStateAgeingData::_numStateVarValues[] = {
+ 1,
+};
+
+const char* pylith::friction::RateStateAgeingData::_dbPropertyValues[] = {
+ "reference-friction-coefficient",
+ "reference-slip-rate",
+ "characteristic-slip-distance",
+ "constitutive-parameter-a",
+ "constitutive-parameter-b",
+};
+
+const char* pylith::friction::RateStateAgeingData::_dbStateVarValues[] = {
+ "state-variable",
+};
+
+const double pylith::friction::RateStateAgeingData::_dbProperties[] = {
+ 0.6,
+ 0.000001,
+ 0.0370,
+ 0.0125,
+ 0.0172,
+ 0.5,
+ 0.000002,
+ 0.0470,
+ 0.0225,
+ 0.0272,
+};
+
+const double pylith::friction::RateStateAgeingData::_dbStateVars[] = {
+ 92.7,
+ 93.7,
+};
+
+const double pylith::friction::RateStateAgeingData::_properties[] = {
+ 0.6,
+ 0.000001,
+ 0.0370,
+ 0.0125,
+ 0.0172,
+ 0.5,
+ 0.000002,
+ 0.0470,
+ 0.0225,
+ 0.0272,
+};
+
+const double pylith::friction::RateStateAgeingData::_stateVars[] = {
+ 92.7,
+ 93.7,
+};
+
+const double pylith::friction::RateStateAgeingData::_propertiesNondim[] = {
+ 0.6,
+ 0.000000001,
+ 0.0000370,
+ 0.0125,
+ 0.0172,
+ 0.5,
+ 0.000000002,
+ 0.0000470,
+ 0.0225,
+ 0.0272,
+};
+
+const double pylith::friction::RateStateAgeingData::_stateVarsNondim[] = {
+ 92.7,
+ 93.7,
+};
+
+const double pylith::friction::RateStateAgeingData::_friction[] = {
+ 1.285949009547604,
+ 1.164378652801948,
+};
+
+const double pylith::friction::RateStateAgeingData::_slip[] = {
+ 0.12,
+ 0.22,
+};
+
+const double pylith::friction::RateStateAgeingData::_slipRate[] = {
+ 0.0011,
+ 0.0021,
+};
+
+const double pylith::friction::RateStateAgeingData::_normalTraction[] = {
+ -2.2,
+ -2.3,
+};
+
+const double pylith::friction::RateStateAgeingData::_stateVarsUpdated[] = {
+ 92.7,
+ 93.7,
+};
+
+pylith::friction::RateStateAgeingData::RateStateAgeingData(void)
+{ // constructor
+ numLocs = _numLocs;
+ numProperties = _numProperties;
+ numStateVars = _numStateVars;
+ numDBProperties = _numDBProperties;
+ numDBStateVars = _numDBStateVars;
+ numPropsVertex = _numPropsVertex;
+ numVarsVertex = _numVarsVertex;
+ lengthScale = _lengthScale;
+ timeScale = _timeScale;
+ pressureScale = _pressureScale;
+ densityScale = _densityScale;
+ numPropertyValues = const_cast<int*>(_numPropertyValues);
+ numStateVarValues = const_cast<int*>(_numStateVarValues);
+ dbPropertyValues = const_cast<char**>(_dbPropertyValues);
+ dbStateVarValues = const_cast<char**>(_dbStateVarValues);
+ dbProperties = const_cast<double*>(_dbProperties);
+ dbStateVars = const_cast<double*>(_dbStateVars);
+ properties = const_cast<double*>(_properties);
+ stateVars = const_cast<double*>(_stateVars);
+ propertiesNondim = const_cast<double*>(_propertiesNondim);
+ stateVarsNondim = const_cast<double*>(_stateVarsNondim);
+ friction = const_cast<double*>(_friction);
+ slip = const_cast<double*>(_slip);
+ slipRate = const_cast<double*>(_slipRate);
+ normalTraction = const_cast<double*>(_normalTraction);
+ stateVarsUpdated = const_cast<double*>(_stateVarsUpdated);
+} // constructor
+
+pylith::friction::RateStateAgeingData::~RateStateAgeingData(void)
+{}
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/friction/data/RateStateAgeingData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/data/RateStateAgeingData.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/data/RateStateAgeingData.hh 2010-02-21 04:04:52 UTC (rev 16289)
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_friction_ratestateageingdata_hh)
+#define pylith_friction_ratestateageingdata_hh
+
+#include "FrictionModelData.hh"
+
+namespace pylith {
+ namespace friction {
+ class RateStateAgeingData;
+ } // pylith
+} // friction
+
+class pylith::friction::RateStateAgeingData : public FrictionModelData
+{
+
+public:
+
+ /// Constructor
+ RateStateAgeingData(void);
+
+ /// Destructor
+ ~RateStateAgeingData(void);
+
+private:
+
+ static const int _numLocs;
+
+ static const int _numProperties;
+
+ static const int _numStateVars;
+
+ static const int _numDBProperties;
+
+ static const int _numDBStateVars;
+
+ static const int _numPropsVertex;
+
+ static const int _numVarsVertex;
+
+ static const double _lengthScale;
+
+ static const double _timeScale;
+
+ static const double _pressureScale;
+
+ static const double _densityScale;
+
+ static const int _numPropertyValues[];
+
+ static const int _numStateVarValues[];
+
+ static const char* _dbPropertyValues[];
+
+ static const char* _dbStateVarValues[];
+
+ static const double _dbProperties[];
+
+ static const double _dbStateVars[];
+
+ static const double _properties[];
+
+ static const double _stateVars[];
+
+ static const double _propertiesNondim[];
+
+ static const double _stateVarsNondim[];
+
+ static const double _friction[];
+
+ static const double _slip[];
+
+ static const double _slipRate[];
+
+ static const double _normalTraction[];
+
+ static const double _stateVarsUpdated[];
+
+};
+
+#endif // pylith_friction_ratestateageingdata_hh
+
+// End of file
More information about the CIG-COMMITS
mailing list