[cig-commits] r17035 - in short/3D/PyLith/trunk: modulesrc/friction pylith pylith/friction unittests/pytests/friction
surendra at geodynamics.org
surendra at geodynamics.org
Sat Jul 10 07:59:34 PDT 2010
Author: surendra
Date: 2010-07-10 07:59:34 -0700 (Sat, 10 Jul 2010)
New Revision: 17035
Added:
short/3D/PyLith/trunk/modulesrc/friction/TimeWeakening.i
short/3D/PyLith/trunk/pylith/friction/TimeWeakening.py
short/3D/PyLith/trunk/unittests/pytests/friction/TestTimeWeakening.py
Modified:
short/3D/PyLith/trunk/modulesrc/friction/Makefile.am
short/3D/PyLith/trunk/modulesrc/friction/friction.i
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/friction/__init__.py
short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py
Log:
Added pytests and swig interface for Time-Weakening friction
Modified: short/3D/PyLith/trunk/modulesrc/friction/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/friction/Makefile.am 2010-07-10 14:43:32 UTC (rev 17034)
+++ short/3D/PyLith/trunk/modulesrc/friction/Makefile.am 2010-07-10 14:59:34 UTC (rev 17035)
@@ -22,7 +22,8 @@
FrictionModel.i \
StaticFriction.i \
SlipWeakening.i \
- RateStateAgeing.i
+ RateStateAgeing.i \
+ TimeWeakening.i
swigincludedir = $(pkgdatadir)/swig/$(subpackage)
swiginclude_HEADERS = \
Added: short/3D/PyLith/trunk/modulesrc/friction/TimeWeakening.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/friction/TimeWeakening.i (rev 0)
+++ short/3D/PyLith/trunk/modulesrc/friction/TimeWeakening.i 2010-07-10 14:59:34 UTC (rev 17035)
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/friction/TimeWeakening.i
+ *
+ * Python interface to C++ TimeWeakening object.
+ */
+
+namespace pylith {
+ namespace friction {
+
+ class TimeWeakening : public FrictionModel
+ { // class TimeWeakening
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ TimeWeakening(void);
+
+ /// Destructor.
+ ~TimeWeakening(void);
+
+ // PROTECTED METHODS //////////////////////////////////////////////
+ protected :
+
+ /** Compute properties from values in spatial database.
+ *
+ * @param propValues Array of property values.
+ * @param dbValues Array of database values.
+ */
+ void _dbToProperties(double* const propValues,
+ const double_array& dbValues) const;
+
+ /** Nondimensionalize properties.
+ *
+ * @param values Array of property values.
+ * @param nvalues Number of values.
+ */
+ void _nondimProperties(double* const values,
+ const int nvalues) const;
+
+ /** Dimensionalize properties.
+ *
+ * @param values Array of property values.
+ * @param nvalues Number of values.
+ */
+ void _dimProperties(double* const values,
+ const int nvalues) const;
+
+ /** Compute friction from properties and state variables.
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ */
+ double _calcFriction(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars);
+
+ }; // class TimeWeakening
+
+ } // friction
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/trunk/modulesrc/friction/friction.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/friction/friction.i 2010-07-10 14:43:32 UTC (rev 17034)
+++ short/3D/PyLith/trunk/modulesrc/friction/friction.i 2010-07-10 14:59:34 UTC (rev 17035)
@@ -24,6 +24,7 @@
#include "pylith/friction/StaticFriction.hh"
#include "pylith/friction/SlipWeakening.hh"
#include "pylith/friction/RateStateAgeing.hh"
+#include "pylith/friction/TimeWeakening.hh"
#include "pylith/utils/arrayfwd.hh"
#include "pylith/utils/sievetypes.hh"
@@ -57,6 +58,7 @@
%include "StaticFriction.i"
%include "SlipWeakening.i"
%include "RateStateAgeing.i"
+%include "TimeWeakening.i"
// End of file
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2010-07-10 14:43:32 UTC (rev 17034)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2010-07-10 14:59:34 UTC (rev 17035)
@@ -61,6 +61,7 @@
friction/StaticFriction.py \
friction/SlipWeakening.py \
friction/RateStateAgeing.py \
+ friction/TimeWeakening.py \
materials/__init__.py \
materials/ElasticMaterial.py \
materials/ElasticIsotropic3D.py \
Added: short/3D/PyLith/trunk/pylith/friction/TimeWeakening.py
===================================================================
--- short/3D/PyLith/trunk/pylith/friction/TimeWeakening.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/friction/TimeWeakening.py 2010-07-10 14:59:34 UTC (rev 17035)
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/friction/TimeWeakening.py
+##
+## @brief Python object implementing time Weakening.
+##
+## Factory: friction_model.
+
+from FrictionModel import FrictionModel
+from friction import TimeWeakening as ModuleTimeWeakening
+
+# TimeWeakening class
+class TimeWeakening(FrictionModel, ModuleTimeWeakening):
+ """
+ Python object implementing Time Weakening.
+
+ Factory: friction_model.
+ """
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="timeweakening"):
+ """
+ Constructor.
+ """
+ FrictionModel.__init__(self, name)
+ self.availableFields = \
+ {'vertex': \
+ {'info': ["static_coefficient",
+ "dynamic_coefficient",
+ "time_weakening_parameter",
+ "cohesion"],
+ 'data': ["Elapsed_time"]},
+ 'cell': \
+ {'info': [],
+ 'data': []}}
+ self._loggingPrefix = "FrStat "
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _createModuleObj(self):
+ """
+ Call constructor for module object for access to C++ object.
+ """
+ ModuleTimeWeakening.__init__(self)
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def friction_model():
+ """
+ Factory associated with TimeWeakening.
+ """
+ return TimeWeakening()
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/friction/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/friction/__init__.py 2010-07-10 14:43:32 UTC (rev 17034)
+++ short/3D/PyLith/trunk/pylith/friction/__init__.py 2010-07-10 14:59:34 UTC (rev 17035)
@@ -18,6 +18,7 @@
'StaticFriction',
'SlipWeakening',
'RateStateAgeing',
+ 'TimeWeakening',
]
Modified: short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am 2010-07-10 14:43:32 UTC (rev 17034)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am 2010-07-10 14:59:34 UTC (rev 17035)
@@ -24,7 +24,8 @@
TestFrictionModel.py \
TestStaticFriction.py \
TestSlipWeakening.py \
- TestRateStateAgeing.py
+ TestRateStateAgeing.py \
+ TestTimeWeakening.py
# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/friction/TestTimeWeakening.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/TestTimeWeakening.py (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/TestTimeWeakening.py 2010-07-10 14:59:34 UTC (rev 17035)
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/friction/TestTimeWeakening.py
+
+## @brief Unit testing of TimeWeakening object.
+
+import unittest
+
+from pylith.friction.TimeWeakening import TimeWeakening
+
+# ----------------------------------------------------------------------
+class TestTimeWeakening(unittest.TestCase):
+ """
+ Unit testing of TimeWeakening object.
+ """
+
+ def setUp(self):
+ """
+ Setup test subject.
+ """
+ self.friction = TimeWeakening()
+ return
+
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ return
+
+
+ def test_factory(self):
+ """
+ Test factory method.
+ """
+ from pylith.friction.TimeWeakening import friction_model
+ m = friction_model()
+ return
+
+
+# End of file
Modified: short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py 2010-07-10 14:43:32 UTC (rev 17034)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py 2010-07-10 14:59:34 UTC (rev 17035)
@@ -65,6 +65,9 @@
from TestRateStateAgeing import TestRateStateAgeing
suite.addTest(unittest.makeSuite(TestRateStateAgeing))
+ from TestTimeWeakening import TestTimeWeakening
+ suite.addTest(unittest.makeSuite(TestTimeWeakening))
+
from TestFrictionModel import TestFrictionModel
suite.addTest(unittest.makeSuite(TestFrictionModel))
More information about the CIG-COMMITS
mailing list