[cig-commits] r16150 - in short/3D/PyLith/trunk/libsrc: . friction
brad at geodynamics.org
brad at geodynamics.org
Wed Jan 20 17:11:31 PST 2010
Author: brad
Date: 2010-01-20 17:11:30 -0800 (Wed, 20 Jan 2010)
New Revision: 16150
Added:
short/3D/PyLith/trunk/libsrc/friction/StaticFriction.cc
short/3D/PyLith/trunk/libsrc/friction/StaticFriction.hh
Modified:
short/3D/PyLith/trunk/libsrc/Makefile.am
short/3D/PyLith/trunk/libsrc/friction/FrictionModel.hh
short/3D/PyLith/trunk/libsrc/friction/Makefile.am
short/3D/PyLith/trunk/libsrc/friction/frictionfwd.hh
Log:
Started work on static friction model.
Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am 2010-01-20 02:38:30 UTC (rev 16149)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am 2010-01-21 01:11:30 UTC (rev 16150)
@@ -77,6 +77,7 @@
feassemble/IntegratorElasticityLgDeform.cc \
feassemble/ElasticityImplicitLgDeform.cc \
feassemble/ElasticityExplicitLgDeform.cc \
+ friction/StaticFriction.cc \
materials/Metadata.cc \
materials/Material.cc \
materials/ElasticMaterial.cc \
Modified: short/3D/PyLith/trunk/libsrc/friction/FrictionModel.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/FrictionModel.hh 2010-01-20 02:38:30 UTC (rev 16149)
+++ short/3D/PyLith/trunk/libsrc/friction/FrictionModel.hh 2010-01-21 01:11:30 UTC (rev 16150)
@@ -30,7 +30,7 @@
#include <string> // HASA std::string
-// Material -------------------------------------------------------------
+// FrictionModel --------------------------------------------------------
/** @brief C++ abstract base class for FrictionModel object.
*
* Interface definition for a friction model. The physical properties
@@ -49,7 +49,7 @@
*
* @param metadata Metadata for physical properties and state variables.
*/
- FrictionModel(const Metadata& metadata);
+ FrictionModel(const pylith::materials::Metadata& metadata);
/// Destructor.
virtual
@@ -102,8 +102,8 @@
*/
void normalizer(const spatialdata::units::Nondimensional& dim);
- /** Initialize material by getting physical property parameters from
- * database.
+ /** Initialize friction model by getting physical property
+ * parameters from database.
*
* @pre Must call Quadrature::computeGeometry() before calling
* initialize().
@@ -115,26 +115,28 @@
void initialize(const topology::Mesh& mesh,
feassemble::Quadrature<topology::Mesh>* quadrature);
- /** Check whether material has a field as a property.
+ /** Check whether friction model has a field as a property.
*
* @param name Name of field.
*
- * @returns True if material has field as a property, false otherwise.
+ * @returns True if friction model has field as a property, false
+ * otherwise.
*/
bool hasProperty(const char* name);
- /** Check whether material has a field as a state variable.
+ /** Check whether friction model has a field as a state variable.
*
* @param name Name of field.
*
- * @returns True if material has field as a state variable, false otherwise.
+ * @returns True if friction model has field as a state variable,
+ * false otherwise.
*/
bool hasStateVar(const char* name);
/** Get physical property or state variable field. Data is returned
* via the argument.
*
- * @param field Field over material cells.
+ * @param field Field over fault interface cells.
* @param name Name of field to retrieve.
*/
void getField(topology::Field<topology::SubMesh> *field,
@@ -251,17 +253,16 @@
double _dt; ///< Current time step
- /// Field containing physical properties of material.
+ /// Field containing physical properties of friction model.
topology::Field<topology::SubMesh> *_properties;
- /// Field containing the state variables for the material.
+ /// Field containing the state variables for the friction model.
topology::Field<topology::SubMesh> *_stateVars;
spatialdata::units::Nondimensional* _normalizer; ///< Nondimensionalizer
int _numProps; ///< Number of properties per quad point.
int _numVars; ///< Number of state variables per quad point.
- const int _dimension; ///< Spatial dimension associated with material.
// PRIVATE METHODS ////////////////////////////////////////////////////
private :
@@ -281,10 +282,10 @@
// PRIVATE MEMBERS ////////////////////////////////////////////////////
private :
- /// Database of parameters for physical properties of material.
+ /// Database of parameters for physical properties of friction model.
spatialdata::spatialdb::SpatialDB* _dbProperties;
- /// Database of initial state variables for the material.
+ /// Database of initial state variables for the friction model.
spatialdata::spatialdb::SpatialDB* _dbInitialState;
std::string _label; ///< Label of friction model.
Modified: short/3D/PyLith/trunk/libsrc/friction/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/Makefile.am 2010-01-20 02:38:30 UTC (rev 16149)
+++ short/3D/PyLith/trunk/libsrc/friction/Makefile.am 2010-01-21 01:11:30 UTC (rev 16150)
@@ -15,6 +15,7 @@
subpkginclude_HEADERS = \
FrictionModel.hh \
+ StaticFriction.hh \
frictionfwd.hh
Added: short/3D/PyLith/trunk/libsrc/friction/StaticFriction.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/StaticFriction.cc (rev 0)
+++ short/3D/PyLith/trunk/libsrc/friction/StaticFriction.cc 2010-01-21 01:11:30 UTC (rev 16150)
@@ -0,0 +1,147 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "StaticFriction.hh" // implementation of object methods
+
+#include "pylith/materials/Metadata.hh" // USES Metadata
+
+#include "pylith/utils/array.hh" // USES double_array
+#include "pylith/utils/constdefs.h" // USES MAXDOUBLE
+
+#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
+
+#include "petsc.h" // USES PetscLogFlops
+
+#include <cassert> // USES assert()
+#include <sstream> // USES std::ostringstream
+#include <stdexcept> // USES std::runtime_error
+
+// ----------------------------------------------------------------------
+namespace pylith {
+ namespace friction {
+ namespace _StaticFriction {
+
+ // Number of physical properties.
+ const int numProperties = 1;
+
+ // Physical properties.
+ const pylith::materials::Metadata::ParamDescription properties[] = {
+ { "friction-coefficient", 1, pylith::topology::FieldBase::SCALAR },
+ };
+
+ // Values expected in spatial database
+ const int numDBProperties = 1;
+ const char* dbProperties[] = { "friction-coefficient" };
+
+ } // _StaticFriction
+ } // friction
+} // pylith
+
+// Indices of physical properties
+const int pylith::friction::StaticFriction::p_coef = 0;
+
+// Indices of database values (order must match dbProperties)
+const int pylith::friction::StaticFriction::db_coef = 0;
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::friction::StaticFriction::StaticFriction(void) :
+ FrictionModel(Metadata(_StaticFriction::properties,
+ _StaticFriction::numProperties,
+ _StaticFriction::dbProperties,
+ _StaticFriction::numDBProperties,
+ 0, 0,
+ 0, 0))
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+pylith::friction::StaticFriction::~StaticFriction(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Compute properties from values in spatial database.
+void
+pylith::friction::StaticFriction::_dbToProperties(
+ double* const propValues,
+ const double_array& dbValues) const
+{ // _dbToProperties
+ assert(0 != propValues);
+ const int numDBValues = dbValues.size();
+ assert(_StaticFriction::numDBProperties == numDBValues);
+
+ const double coef = dbValues[db_coef];
+
+ if (coef <= 0.0) {
+ std::ostringstream msg;
+ msg << "Spatial database returned nonpositive value for coefficient "
+ << "of friction.\n"
+ << "coefficient of friction: " << coef << "\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ propValues[p_coef] = coef;
+} // _dbToProperties
+
+// ----------------------------------------------------------------------
+// Nondimensionalize properties.
+void
+pylith::friction::StaticFriction::_nondimProperties(double* const values,
+ const int nvalues) const
+{ // _nondimProperties
+ assert(0 != _normalizer);
+ assert(0 != values);
+ assert(nvalues == _StaticFriction::numProperties);
+
+ // No dimensions
+} // _nondimProperties
+
+// ----------------------------------------------------------------------
+// Dimensionalize properties.
+void
+pylith::friction::StaticFriction::_dimProperties(double* const values,
+ const int nvalues) const
+{ // _dimProperties
+ assert(0 != _normalizer);
+ assert(0 != values);
+ assert(nvalues == _StaticFriction::numProperties);
+
+ // No dimensions
+} // _dimProperties
+
+// ----------------------------------------------------------------------
+// Compute friction from properties and state variables.
+double
+pylith::friction::StaticFriction::_calcFriction(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars)
+{ // _calcFriction
+ assert(0 != properties);
+ assert(_numProps == numProperties);
+ assert(0 == numStateVars);
+
+ const double friction = (normalTraction < 0) ?
+ properties[p_coef] * normalTraction : 0.0;
+
+ PetscLogFlops(1);
+} // _calcFriction
+
+
+// End of file
Added: short/3D/PyLith/trunk/libsrc/friction/StaticFriction.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/StaticFriction.hh (rev 0)
+++ short/3D/PyLith/trunk/libsrc/friction/StaticFriction.hh 2010-01-21 01:11:30 UTC (rev 16150)
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file libsrc/friction/StaticFriction.hh
+ *
+ * @brief C++ static friction fault constitutive model.
+ */
+
+#if !defined(pylith_friction_staticfriction_hh)
+#define pylith_friction_staticfriction_hh
+
+// Include directives ---------------------------------------------------
+#include "FrictionModel.hh" // ISA FrictionModel
+
+// StaticFriction -------------------------------------------------------
+/** @brief C++ static friction fault constitutive model.
+ *
+ * Friction is equal to the product of a coefficient of friction and
+ * the normal traction.
+ */
+
+class pylith::friction::StaticFriction : public FrictionModel
+{ // class StaticFriction
+ friend class TestStaticFriction; // unit testing
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ StaticFriction(void);
+
+ /// Destructor.
+ ~StaticFriction(void);
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+ /// These methods should be implemented by every constitutive model.
+
+ /** 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);
+
+ // PRIVATE MEMBERS ////////////////////////////////////////////////////
+private :
+
+ static const int p_coef;
+ static const int db_coef;
+
+ // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+ StaticFriction(const StaticFriction&); ///< Not implemented.
+ const StaticFriction& operator=(const StaticFriction&); ///< Not implemented
+
+}; // class StaticFriction
+
+#endif // pylith_friction_staticfriction_hh
+
+
+// End of file
Modified: short/3D/PyLith/trunk/libsrc/friction/frictionfwd.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/frictionfwd.hh 2010-01-20 02:38:30 UTC (rev 16149)
+++ short/3D/PyLith/trunk/libsrc/friction/frictionfwd.hh 2010-01-21 01:11:30 UTC (rev 16150)
@@ -26,6 +26,8 @@
class FrictionModel;
+ class StaticFriction;
+
} // friction
} // pylith
More information about the CIG-COMMITS
mailing list