[cig-commits] r16290 - in short/3D/PyLith/trunk: modulesrc/friction pylith pylith/friction unittests/pytests/friction
surendra at geodynamics.org
surendra at geodynamics.org
Sat Feb 20 20:26:07 PST 2010
Author: surendra
Date: 2010-02-20 20:26:06 -0800 (Sat, 20 Feb 2010)
New Revision: 16290
Added:
short/3D/PyLith/trunk/modulesrc/friction/RateStateAgeing.i
short/3D/PyLith/trunk/pylith/friction/RateStateAgeing.py
short/3D/PyLith/trunk/unittests/pytests/friction/TestRateStateAgeing.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 pytest of RateStateAgeing (test passed)
Modified: short/3D/PyLith/trunk/modulesrc/friction/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/friction/Makefile.am 2010-02-21 04:04:52 UTC (rev 16289)
+++ short/3D/PyLith/trunk/modulesrc/friction/Makefile.am 2010-02-21 04:26:06 UTC (rev 16290)
@@ -21,7 +21,8 @@
friction.i \
FrictionModel.i \
StaticFriction.i \
- SlipWeakening.i
+ SlipWeakening.i \
+ RateStateAgeing.i
swigincludedir = $(pkgdatadir)/swig/$(subpackage)
swiginclude_HEADERS = \
Added: short/3D/PyLith/trunk/modulesrc/friction/RateStateAgeing.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/friction/RateStateAgeing.i (rev 0)
+++ short/3D/PyLith/trunk/modulesrc/friction/RateStateAgeing.i 2010-02-21 04:26:06 UTC (rev 16290)
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/friction/RateStateAgeing.i
+ *
+ * Python interface to C++ RateStateAgeing object.
+ */
+
+namespace pylith {
+ namespace friction {
+
+ class RateStateAgeing : public FrictionModel
+ { // class RateStateAgeing
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ RateStateAgeing(void);
+
+ /// Destructor.
+ ~RateStateAgeing(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 RateStateAgeing
+
+ } // friction
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/trunk/modulesrc/friction/friction.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/friction/friction.i 2010-02-21 04:04:52 UTC (rev 16289)
+++ short/3D/PyLith/trunk/modulesrc/friction/friction.i 2010-02-21 04:26:06 UTC (rev 16290)
@@ -23,6 +23,7 @@
#include "pylith/friction/FrictionModel.hh"
#include "pylith/friction/StaticFriction.hh"
#include "pylith/friction/SlipWeakening.hh"
+#include "pylith/friction/RateStateAgeing.hh"
#include "pylith/utils/arrayfwd.hh"
%}
@@ -52,6 +53,7 @@
%include "FrictionModel.i"
%include "StaticFriction.i"
%include "SlipWeakening.i"
+%include "RateStateAgeing.i"
// End of file
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2010-02-21 04:04:52 UTC (rev 16289)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2010-02-21 04:26:06 UTC (rev 16290)
@@ -59,6 +59,7 @@
friction/FrictionModel.py \
friction/StaticFriction.py \
friction/SlipWeakening.py \
+ friction/RateStateAgeing.py \
materials/__init__.py \
materials/ElasticMaterial.py \
materials/ElasticIsotropic3D.py \
Added: short/3D/PyLith/trunk/pylith/friction/RateStateAgeing.py
===================================================================
--- short/3D/PyLith/trunk/pylith/friction/RateStateAgeing.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/friction/RateStateAgeing.py 2010-02-21 04:26:06 UTC (rev 16290)
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/friction/RateStateAgeing.py
+##
+## @brief Python object implementing Rate and State with Ageing Law.
+##
+## Factory: friction_model.
+
+from FrictionModel import FrictionModel
+from friction import RateStateAgeing as ModuleRateStateAgeing
+
+# RateStateAgeing class
+class RateStateAgeing(FrictionModel, ModuleRateStateAgeing):
+ """
+ Python object implementing Rate and State with Ageing Law.
+
+ Factory: friction_model.
+ """
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="ratestateageing"):
+ """
+ Constructor.
+ """
+ FrictionModel.__init__(self, name)
+ self.availableFields = \
+ {'vertex': \
+ {'info': ["reference_friction_coefficient","reference_slip_rate","characteristic_slip_distance","constitutive_parameter_a","constitutive_parameter_b","state_variable"],
+ 'data': []},
+ 'cell': \
+ {'info': [],
+ 'data': []}}
+ self._loggingPrefix = "FrStat "
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _createModuleObj(self):
+ """
+ Call constructor for module object for access to C++ object.
+ """
+ ModuleRateStateAgeing.__init__(self)
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def friction_model():
+ """
+ Factory associated with RateStateAgeing.
+ """
+ return RateStateAgeing()
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/friction/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/friction/__init__.py 2010-02-21 04:04:52 UTC (rev 16289)
+++ short/3D/PyLith/trunk/pylith/friction/__init__.py 2010-02-21 04:26:06 UTC (rev 16290)
@@ -17,6 +17,7 @@
__all__ = ['FrictionModel',
'StaticFriction',
'SlipWeakening',
+ 'RateStateAgeing',
]
Modified: short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am 2010-02-21 04:04:52 UTC (rev 16289)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am 2010-02-21 04:26:06 UTC (rev 16290)
@@ -23,7 +23,8 @@
noinst_PYTHON = \
TestFrictionModel.py \
TestStaticFriction.py \
- TestSlipWeakening.py
+ TestSlipWeakening.py \
+ TestRateStateAgeing.py
# End of file
Added: short/3D/PyLith/trunk/unittests/pytests/friction/TestRateStateAgeing.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/TestRateStateAgeing.py (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/TestRateStateAgeing.py 2010-02-21 04:26:06 UTC (rev 16290)
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/friction/TestRateStateAgeing.py
+
+## @brief Unit testing of RateStateAgeing object.
+
+import unittest
+
+from pylith.friction.RateStateAgeing import RateStateAgeing
+
+# ----------------------------------------------------------------------
+class TestRateStateAgeing(unittest.TestCase):
+ """
+ Unit testing of RateStateAgeing object.
+ """
+
+ def setUp(self):
+ """
+ Setup test subject.
+ """
+ self.friction = RateStateAgeing()
+ return
+
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ return
+
+
+ def test_factory(self):
+ """
+ Test factory method.
+ """
+ from pylith.friction.RateStateAgeing 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-02-21 04:04:52 UTC (rev 16289)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py 2010-02-21 04:26:06 UTC (rev 16290)
@@ -62,6 +62,9 @@
from TestSlipWeakening import TestSlipWeakening
suite.addTest(unittest.makeSuite(TestSlipWeakening))
+ from TestRateStateAgeing import TestRateStateAgeing
+ suite.addTest(unittest.makeSuite(TestRateStateAgeing))
+
from TestFrictionModel import TestFrictionModel
suite.addTest(unittest.makeSuite(TestFrictionModel))
More information about the CIG-COMMITS
mailing list