[cig-commits] r21403 - in short/3D/PyLith/branches/pylith-scecdynrup: libsrc/pylith libsrc/pylith/faults libsrc/pylith/friction libsrc/pylith/meshio libsrc/pylith/problems libsrc/pylith/topology modulesrc/friction pylith pylith/friction tests/topology unittests/libtests/bc unittests/libtests/faults unittests/libtests/feassemble unittests/libtests/friction unittests/libtests/friction/data unittests/libtests/materials unittests/libtests/meshio unittests/libtests/topology unittests/libtests/utils unittests/pytests/friction
brad at geodynamics.org
brad at geodynamics.org
Tue Feb 26 15:35:12 PST 2013
Author: brad
Date: 2013-02-26 15:35:11 -0800 (Tue, 26 Feb 2013)
New Revision: 21403
Added:
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTimeStable.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTimeStable.hh
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/SlipWeakeningTimeStable.i
short/3D/PyLith/branches/pylith-scecdynrup/pylith/friction/SlipWeakeningTimeStable.py
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestSlipWeakeningTimeStable.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestSlipWeakeningTimeStable.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeStableData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeStableData.hh
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/TestSlipWeakeningTimeStable.py
Modified:
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/faults/FaultCohesiveDyn.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTime.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTime.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/frictionfwd.hh
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/meshio/DataWriterHDF5.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/problems/Solver.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/problems/SolverNonlinear.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/Field.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/Jacobian.cc
short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/MeshRefiner.cc
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/friction.i
short/3D/PyLith/branches/pylith-scecdynrup/pylith/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/tests/topology/test_topology.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/test_bc.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/test_faults.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/feassemble/test_feassemble.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestFrictionModel.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/RateStateAgeingData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningStressData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/StaticFrictionData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/TimeWeakeningData.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/test_friction.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/materials/test_materials.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/test_meshio.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/test_topology.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/utils/test_utils.cc
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/Makefile.am
short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/testfriction.py
Log:
Merge from v1.7-trunk.
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/Makefile.am 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/Makefile.am 2013-02-26 23:35:11 UTC (rev 21403)
@@ -105,6 +105,7 @@
friction/StaticFriction.cc \
friction/SlipWeakening.cc \
friction/SlipWeakeningTime.cc \
+ friction/SlipWeakeningTimeStable.cc \
friction/SlipWeakeningStress.cc \
friction/RateStateAgeing.cc \
friction/TimeWeakening.cc \
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/faults/FaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/faults/FaultCohesiveDyn.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/faults/FaultCohesiveDyn.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -1992,7 +1992,7 @@
for (int i=0; i < subnrows; ++i) {
indicesLocal[iCohesiveCell*subnrows+indicesPerm[i]] = i;
} // for
- cellsIS[iCohesiveCell] = PETSC_NULL;
+ cellsIS[iCohesiveCell] = NULL;
err = ISCreateGeneral(PETSC_COMM_SELF, indicesGlobal.size(), &indicesGlobal[0], PETSC_COPY_VALUES, &cellsIS[iCohesiveCell]);CHECK_PETSC_ERROR(err);
} // for
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTime.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTime.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTime.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -294,12 +294,13 @@
PylithScalar mu_f = 0.0;
if (normalTraction <= 0.0) {
// if fault is in compression
- if (stateVars[s_slipCum] < properties[p_d0] &&
- t < properties[p_weaktime]) {
+ const PylithScalar slipPrev = stateVars[s_slipPrev];
+ const PylithScalar slipCum = stateVars[s_slipCum] + fabs(slip - slipPrev);
+
+ if (slipCum < properties[p_d0] && t < properties[p_weaktime]) {
// if/else linear slip-weakening form of mu_f
- mu_f = properties[p_coefS] -
- (properties[p_coefS] - properties[p_coefD]) *
- stateVars[s_slipCum] / properties[p_d0];
+ mu_f = properties[p_coefS] - (properties[p_coefS] - properties[p_coefD]) *
+ slipCum / properties[p_d0];
} else {
mu_f = properties[p_coefD];
} // if/else
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTime.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTime.hh 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTime.hh 2013-02-26 23:35:11 UTC (rev 21403)
@@ -18,7 +18,7 @@
/** @file libsrc/friction/SlipWeakeningTime.hh
*
- * @brief C++ slip weakening fault constitutive model.
+ * @brief C++ slip + time weakening fault constitutive model.
*/
#if !defined(pylith_friction_slipweakeningtime_hh)
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTimeStable.cc (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/friction/SlipWeakeningTimeStable.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTimeStable.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTimeStable.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,362 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "SlipWeakeningTimeStable.hh" // implementation of object methods
+
+#include "pylith/materials/Metadata.hh" // USES Metadata
+
+#include "pylith/utils/array.hh" // USES scalar_array
+#include "pylith/utils/constdefs.h" // USES MAXSCALAR
+
+#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 _SlipWeakeningTimeStable {
+
+ // Number of physical properties.
+ const int numProperties = 6;
+
+ // Physical properties.
+ const pylith::materials::Metadata::ParamDescription properties[6] = {
+ { "static_coefficient", 1, pylith::topology::FieldBase::SCALAR },
+ { "dynamic_coefficient", 1, pylith::topology::FieldBase::SCALAR },
+ { "slip_weakening_parameter", 1, pylith::topology::FieldBase::SCALAR },
+ { "cohesion", 1, pylith::topology::FieldBase::SCALAR },
+ { "time_weakening_time", 1, pylith::topology::FieldBase::SCALAR },
+ { "time_weakening_parameter", 1, pylith::topology::FieldBase::SCALAR },
+ };
+
+ // Number of State Variables.
+ const int numStateVars = 2;
+
+ // State Variables.
+ const pylith::materials::Metadata::ParamDescription stateVars[2] = {
+ { "cumulative_slip", 1, pylith::topology::FieldBase::SCALAR },
+ { "previous_slip", 1, pylith::topology::FieldBase::SCALAR },
+ };
+
+ // Values expected in spatial database
+ const int numDBProperties = 6;
+ const char* dbProperties[6] = { "static-coefficient",
+ "dynamic-coefficient",
+ "slip-weakening-parameter",
+ "cohesion",
+ "time-weakening-time",
+ "time-weakening-parameter",
+ };
+
+ const int numDBStateVars = 2;
+ const char* dbStateVars[2] = { "cumulative-slip",
+ "previous-slip",
+ };
+
+ } // _SlipWeakeningTimeStable
+ } // friction
+} // pylith
+
+// Indices of physical properties
+const int pylith::friction::SlipWeakeningTimeStable::p_coefS = 0;
+const int pylith::friction::SlipWeakeningTimeStable::p_coefD =
+ pylith::friction::SlipWeakeningTimeStable::p_coefS + 1;
+const int pylith::friction::SlipWeakeningTimeStable::p_d0 =
+ pylith::friction::SlipWeakeningTimeStable::p_coefD + 1;
+const int pylith::friction::SlipWeakeningTimeStable::p_cohesion =
+ pylith::friction::SlipWeakeningTimeStable::p_d0 + 1;
+const int pylith::friction::SlipWeakeningTimeStable::p_weaktime =
+ pylith::friction::SlipWeakeningTimeStable::p_cohesion + 1;
+const int pylith::friction::SlipWeakeningTimeStable::p_t0 =
+ pylith::friction::SlipWeakeningTimeStable::p_weaktime + 1;
+
+// Indices of database values (order must match dbProperties)
+const int pylith::friction::SlipWeakeningTimeStable::db_coefS = 0;
+const int pylith::friction::SlipWeakeningTimeStable::db_coefD =
+ pylith::friction::SlipWeakeningTimeStable::db_coefS + 1;
+const int pylith::friction::SlipWeakeningTimeStable::db_d0 =
+ pylith::friction::SlipWeakeningTimeStable::db_coefD + 1;
+const int pylith::friction::SlipWeakeningTimeStable::db_cohesion =
+ pylith::friction::SlipWeakeningTimeStable::db_d0 + 1;
+const int pylith::friction::SlipWeakeningTimeStable::db_weaktime =
+ pylith::friction::SlipWeakeningTimeStable::db_cohesion + 1;
+const int pylith::friction::SlipWeakeningTimeStable::db_t0 =
+ pylith::friction::SlipWeakeningTimeStable::db_weaktime + 1;
+
+// Indices of state variables.
+const int pylith::friction::SlipWeakeningTimeStable::s_slipCum = 0;
+const int pylith::friction::SlipWeakeningTimeStable::s_slipPrev =
+ pylith::friction::SlipWeakeningTimeStable::s_slipCum + 1;
+
+// Indices of database values (order must match dbProperties)
+const int pylith::friction::SlipWeakeningTimeStable::db_slipCum = 0;
+const int pylith::friction::SlipWeakeningTimeStable::db_slipPrev =
+ pylith::friction::SlipWeakeningTimeStable::db_slipCum + 1;
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::friction::SlipWeakeningTimeStable::SlipWeakeningTimeStable(void) :
+ FrictionModel(materials::Metadata(_SlipWeakeningTimeStable::properties,
+ _SlipWeakeningTimeStable::numProperties,
+ _SlipWeakeningTimeStable::dbProperties,
+ _SlipWeakeningTimeStable::numDBProperties,
+ _SlipWeakeningTimeStable::stateVars,
+ _SlipWeakeningTimeStable::numStateVars,
+ _SlipWeakeningTimeStable::dbStateVars,
+ _SlipWeakeningTimeStable::numDBStateVars))
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+pylith::friction::SlipWeakeningTimeStable::~SlipWeakeningTimeStable(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Compute properties from values in spatial database.
+void
+pylith::friction::SlipWeakeningTimeStable::_dbToProperties(
+ PylithScalar* const propValues,
+ const scalar_array& dbValues) const
+{ // _dbToProperties
+ assert(propValues);
+ const int numDBValues = dbValues.size();
+ assert(_SlipWeakeningTimeStable::numDBProperties == numDBValues);
+
+ const PylithScalar db_static = dbValues[db_coefS];
+ const PylithScalar db_dynamic = dbValues[db_coefD];
+ const PylithScalar db_do = dbValues[db_d0];
+ const PylithScalar db_c = dbValues[db_cohesion];
+ const PylithScalar db_tw = dbValues[db_weaktime];
+ const PylithScalar db_tp = dbValues[db_t0];
+
+ if (db_static < 0.0) {
+ std::ostringstream msg;
+ msg << "Spatial database returned negative value for static coefficient "
+ << "of friction.\n"
+ << "static coefficient of friction: " << db_static << "\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ if (db_dynamic < 0.0) {
+ std::ostringstream msg;
+ msg << "Spatial database returned negative value for dynamic coefficient "
+ << "of friction.\n"
+ << "dynamic coefficient of friction: " << db_dynamic << "\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ if (db_d0 <= 0.0) {
+ std::ostringstream msg;
+ msg << "Spatial database returned nonpositive value for slip weakening parameter.\n"
+ << "slip weakening parameter: " << db_d0 << "\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ if (db_tw < 0.0) {
+ std::ostringstream msg;
+ msg << "Spatial database returned negative value for time-weakening time.\n"
+ << "weakening time: " << db_tw << "\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ if (db_t0 <= 0.0) {
+ std::ostringstream msg;
+ msg << "Spatial database returned nonpositive value for time-weakening paramter.\n"
+ << "time-weakening parameter: " << db_t0 << "\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ propValues[p_coefS] = db_static;
+ propValues[p_coefD] = db_dynamic;
+ propValues[p_d0] = db_do;
+ propValues[p_cohesion] = db_c;
+ propValues[p_weaktime] = db_tw;
+ propValues[p_t0] = db_tp;
+
+} // _dbToProperties
+
+// ----------------------------------------------------------------------
+// Nondimensionalize properties.
+void
+pylith::friction::SlipWeakeningTimeStable::_nondimProperties(PylithScalar* const values,
+ const int nvalues) const
+{ // _nondimProperties
+ assert(_normalizer);
+ assert(values);
+ assert(nvalues == _SlipWeakeningTimeStable::numProperties);
+
+ const PylithScalar lengthScale = _normalizer->lengthScale();
+ const PylithScalar pressureScale = _normalizer->pressureScale();
+ const PylithScalar timeScale = _normalizer->timeScale();
+
+ values[p_d0] /= lengthScale;
+ values[p_cohesion] /= pressureScale;
+ values[p_weaktime] /= timeScale;
+ values[p_t0] /= timeScale;
+} // _nondimProperties
+
+// ----------------------------------------------------------------------
+// Dimensionalize properties.
+void
+pylith::friction::SlipWeakeningTimeStable::_dimProperties(PylithScalar* const values,
+ const int nvalues) const
+{ // _dimProperties
+ assert(_normalizer);
+ assert(values);
+ assert(nvalues == _SlipWeakeningTimeStable::numProperties);
+
+ const PylithScalar lengthScale = _normalizer->lengthScale();
+ const PylithScalar pressureScale = _normalizer->pressureScale();
+ const PylithScalar timeScale = _normalizer->timeScale();
+
+ values[p_d0] *= lengthScale;
+ values[p_cohesion] *= pressureScale;
+ values[p_weaktime] *= timeScale;
+ values[p_t0] *= timeScale;
+} // _dimProperties
+
+// ----------------------------------------------------------------------
+// Compute state variables from values in spatial database.
+void
+pylith::friction::SlipWeakeningTimeStable::_dbToStateVars(
+ PylithScalar* const stateValues,
+ const scalar_array& dbValues) const
+{ // _dbToStateVars
+ assert(stateValues);
+ const int numDBValues = dbValues.size();
+ assert(_SlipWeakeningTimeStable::numDBStateVars == numDBValues);
+
+ const PylithScalar cumulativeSlip = dbValues[db_slipCum];
+ const PylithScalar previousSlip = dbValues[db_slipPrev];
+
+ stateValues[s_slipCum] = cumulativeSlip;
+ stateValues[s_slipPrev] = previousSlip;
+} // _dbToStateVars
+
+// ----------------------------------------------------------------------
+// Nondimensionalize state variables.
+void
+pylith::friction::SlipWeakeningTimeStable::_nondimStateVars(PylithScalar* const values,
+ const int nvalues) const
+{ // _nondimStateVars
+ assert(_normalizer);
+ assert(values);
+ assert(nvalues == _SlipWeakeningTimeStable::numStateVars);
+
+ const PylithScalar lengthScale = _normalizer->lengthScale();
+
+ values[s_slipCum] /= lengthScale;
+ values[s_slipPrev] /= lengthScale;
+} // _nondimStateVars
+
+// ----------------------------------------------------------------------
+// Dimensionalize state variables.
+void
+pylith::friction::SlipWeakeningTimeStable::_dimStateVars(PylithScalar* const values,
+ const int nvalues) const
+{ // _dimStateVars
+ assert(_normalizer);
+ assert(values);
+ assert(nvalues == _SlipWeakeningTimeStable::numStateVars);
+
+ const PylithScalar lengthScale = _normalizer->lengthScale();
+
+ values[s_slipCum] *= lengthScale;
+ values[s_slipPrev] *= lengthScale;
+} // _dimStateVars
+
+// ----------------------------------------------------------------------
+// Compute friction from properties and state variables.
+PylithScalar
+pylith::friction::SlipWeakeningTimeStable::_calcFriction(const PylithScalar t,
+ const PylithScalar slip,
+ const PylithScalar slipRate,
+ const PylithScalar normalTraction,
+ const PylithScalar* properties,
+ const int numProperties,
+ const PylithScalar* stateVars,
+ const int numStateVars)
+{ // _calcFriction
+ assert(properties);
+ assert(_SlipWeakeningTimeStable::numProperties == numProperties);
+ assert(stateVars);
+ assert(_SlipWeakeningTimeStable::numStateVars == numStateVars);
+
+ PylithScalar friction = 0.0;
+ PylithScalar mu_f = 0.0;
+ if (normalTraction <= 0.0) {
+ // if fault is in compression
+ const PylithScalar slipPrev = stateVars[s_slipPrev];
+ const PylithScalar slipCum = stateVars[s_slipCum] + fabs(slip - slipPrev);
+
+ const PylithScalar slipWeak = (slipCum >= properties[p_d0]) ? 1.0 : slipCum / properties[p_d0];
+ PylithScalar timeWeak = 1.0;
+ if (t < properties[p_weaktime]) {
+ timeWeak = 0.0;
+ } else if (t < properties[p_weaktime] + properties[p_t0]) {
+ timeWeak = (t - properties[p_weaktime]) / properties[p_t0];
+ } // if/else
+ mu_f = properties[p_coefS] - (properties[p_coefS] - properties[p_coefD]) * std::max(slipWeak, timeWeak);
+ friction = - mu_f * normalTraction + properties[p_cohesion];
+ } // if
+
+ PetscLogFlops(6);
+
+ return friction;
+} // _calcFriction
+
+// ----------------------------------------------------------------------
+// Update state variables (for next time step).
+void
+pylith::friction::SlipWeakeningTimeStable::_updateStateVars(const PylithScalar t,
+ const PylithScalar slip,
+ const PylithScalar slipRate,
+ const PylithScalar normalTraction,
+ PylithScalar* const stateVars,
+ const int numStateVars,
+ const PylithScalar* properties,
+ const int numProperties)
+{ // _updateStateVars
+ assert(properties);
+ assert(_SlipWeakeningTimeStable::numProperties == numProperties);
+ assert(stateVars);
+ assert(_SlipWeakeningTimeStable::numStateVars == numStateVars);
+
+ const PylithScalar tolerance = 1.0e-12;
+ if (slipRate > tolerance) {
+ const PylithScalar slipPrev = stateVars[s_slipPrev];
+
+ stateVars[s_slipPrev] = slip;
+ stateVars[s_slipCum] += fabs(slip - slipPrev);
+ } else {
+ // Sliding has stopped, so reset state variables.
+ stateVars[s_slipPrev] = slip;
+ stateVars[s_slipCum] = 0.0;
+ } // else
+} // _updateStateVars
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTimeStable.hh (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/friction/SlipWeakeningTimeStable.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTimeStable.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/SlipWeakeningTimeStable.hh 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,190 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file libsrc/friction/SlipWeakeningTimeStable.hh
+ *
+ * @brief C++ slip + time weakening fault constitutive model.
+ *
+ * This constitutive model is used in the SCEC spontaneous rupture
+ * benchmarks suite.
+ *
+ * This version of slip + time weakening contains a time constant to
+ * make it more stable then SlipWeakeningTime.
+ */
+
+#if !defined(pylith_friction_slipweakeningtimestable_hh)
+#define pylith_friction_slipweakeningtimestable_hh
+
+// Include directives ---------------------------------------------------
+#include "FrictionModel.hh" // ISA FrictionModel
+
+// SlipWeakeningTimeStable -------------------------------------------------------
+/** @brief C++ slip weakening fault constitutive model.
+ *
+ * Friction is equal to the product of a coefficient of friction (function
+ * of slip path length) and the normal traction.
+ */
+
+class pylith::friction::SlipWeakeningTimeStable : public FrictionModel
+{ // class SlipWeakeningTimeStable
+ friend class TestSlipWeakeningTimeStable; // unit testing
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ SlipWeakeningTimeStable(void);
+
+ /// Destructor.
+ ~SlipWeakeningTimeStable(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(PylithScalar* const propValues,
+ const scalar_array& dbValues) const;
+
+ /** Nondimensionalize properties.
+ *
+ * @param values Array of property values.
+ * @param nvalues Number of values.
+ */
+ void _nondimProperties(PylithScalar* const values,
+ const int nvalues) const;
+
+ /** Dimensionalize properties.
+ *
+ * @param values Array of property values.
+ * @param nvalues Number of values.
+ */
+ void _dimProperties(PylithScalar* 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.
+ */
+ void _dbToStateVars(PylithScalar* const stateValues,
+ const scalar_array& dbValues) const;
+
+ /** Nondimensionalize state variables.
+ *
+ * @param values Array of initial state values.
+ * @param nvalues Number of values.
+ */
+ void _nondimStateVars(PylithScalar* const values,
+ const int nvalues) const;
+
+ /** Dimensionalize state variables.
+ *
+ * @param values Array of initial state values.
+ * @param nvalues Number of values.
+ */
+ void _dimStateVars(PylithScalar* const values,
+ const int nvalues) const;
+
+ /** Compute friction from properties and state variables.
+ *
+ * @param t Time in simulation.
+ * @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.
+ */
+ PylithScalar _calcFriction(const PylithScalar t,
+ const PylithScalar slip,
+ const PylithScalar slipRate,
+ const PylithScalar normalTraction,
+ const PylithScalar* properties,
+ const int numProperties,
+ const PylithScalar* stateVars,
+ const int numStateVars);
+
+ /** Update state variables (for next time step).
+ *
+ * @param t Time in simulation.
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ */
+ void _updateStateVars(const PylithScalar t,
+ const PylithScalar slip,
+ const PylithScalar slipRate,
+ const PylithScalar normalTraction,
+ PylithScalar* const stateVars,
+ const int numStateVars,
+ const PylithScalar* properties,
+ const int numProperties);
+
+ // PRIVATE MEMBERS ////////////////////////////////////////////////////
+private :
+
+ /// Indices for properties in section and spatial database.
+ static const int p_coefS;
+ static const int p_coefD;
+ static const int p_d0;
+ static const int p_cohesion;
+ static const int p_weaktime;
+ static const int p_t0;
+
+ static const int db_coefS;
+ static const int db_coefD;
+ static const int db_d0;
+ static const int db_cohesion;
+ static const int db_weaktime;
+ static const int db_t0;
+
+ /// Indices for state variables in section and spatial database.
+ static const int s_slipCum;
+ static const int s_slipPrev;
+
+ static const int db_slipCum;
+ static const int db_slipPrev;
+
+ // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+ SlipWeakeningTimeStable(const SlipWeakeningTimeStable&); ///< Not implemented.
+ const SlipWeakeningTimeStable& operator=(const SlipWeakeningTimeStable&); ///< Not implemented
+
+}; // class SlipWeakeningTimeStable
+
+#endif // pylith_friction_slipweakeningtimestable_hh
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/frictionfwd.hh
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/frictionfwd.hh 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/friction/frictionfwd.hh 2013-02-26 23:35:11 UTC (rev 21403)
@@ -35,6 +35,7 @@
class StaticFriction;
class SlipWeakening;
class SlipWeakeningTime;
+ class SlipWeakeningTimeStable;
class SlipWeakeningStress;
class RateStateAgeing;
class TimeWeakening;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/meshio/DataWriterHDF5.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/meshio/DataWriterHDF5.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -21,6 +21,8 @@
#include "HDF5.hh" // USES HDF5
#include "Xdmf.hh" // USES Xdmf
+#include "petscviewerhdf5.h"
+
#include <cassert> // USES assert()
#include <sstream> // USES std::ostringstream
#include <stdexcept> // USES std::runtime_error
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/problems/Solver.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/problems/Solver.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/problems/Solver.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -190,9 +190,9 @@
// Allocate just the diagonal.
err = MatSeqAIJSetPreallocation(_jacobianPCFault, 1,
- PETSC_NULL); CHECK_PETSC_ERROR(err);
- err = MatMPIAIJSetPreallocation(_jacobianPCFault, 1, PETSC_NULL,
- 0, PETSC_NULL); CHECK_PETSC_ERROR(err);
+ NULL); CHECK_PETSC_ERROR(err);
+ err = MatMPIAIJSetPreallocation(_jacobianPCFault, 1, NULL,
+ 0, NULL); CHECK_PETSC_ERROR(err);
// Set preconditioning matrix in formulation
formulation->customPCMatrix(_jacobianPCFault);
@@ -221,16 +221,16 @@
if (separateComponents) {
PetscMat* precon = new PetscMat[numSpaces];
for (int i=0; i < numSpaces; ++i) {
- precon[i] = PETSC_NULL;
+ precon[i] = NULL;
} // for
precon[numSpaces-1] = _jacobianPCFault;
- constructFieldSplit(solutionSection, PETSC_DETERMINE, PETSC_NULL, PETSC_NULL,
- sieveMesh->getFactory()->getGlobalOrder(sieveMesh, "default", solutionSection), precon, PETSC_NULL, solution.vector(), *pc);
+ constructFieldSplit(solutionSection, PETSC_DETERMINE, NULL, NULL,
+ sieveMesh->getFactory()->getGlobalOrder(sieveMesh, "default", solutionSection), precon, NULL, solution.vector(), *pc);
delete[] precon; precon = 0;
} else {
int numFields[2] = {spaceDim, (numSpaces > spaceDim) ? 1 : 0};
- MatNullSpace nullsp[2] = {PETSC_NULL, PETSC_NULL};
- PetscMat precon[2] = {PETSC_NULL, _jacobianPCFault};
+ MatNullSpace nullsp[2] = {NULL, NULL};
+ PetscMat precon[2] = {NULL, _jacobianPCFault};
int* fields = new int[numSpaces];
// Create rigid body null space.
@@ -284,7 +284,7 @@
err = VecCopy(solution.vector(), mode[d]);CHECK_PETSC_ERROR(err);
} // for
for (int i=0; i < dim; ++i) {
- err = VecNormalize(mode[i], PETSC_NULL);CHECK_PETSC_ERROR(err);
+ err = VecNormalize(mode[i], NULL);CHECK_PETSC_ERROR(err);
} // for
/* Orthonormalize system */
for (int i = dim; i < m; ++i) {
@@ -293,7 +293,7 @@
err = VecMDot(mode[i], i, mode, dots);CHECK_PETSC_ERROR(err);
for(int j=0; j < i; ++j) dots[j] *= -1.0;
err = VecMAXPY(mode[i], i, dots, mode);CHECK_PETSC_ERROR(err);
- err = VecNormalize(mode[i], PETSC_NULL);CHECK_PETSC_ERROR(err);
+ err = VecNormalize(mode[i], NULL);CHECK_PETSC_ERROR(err);
} // for
err = MatNullSpaceCreate(sieveMesh->comm(), PETSC_FALSE, m, mode, &nullsp[0]);CHECK_PETSC_ERROR(err);
for(int i=0; i< m; ++i) {err = VecDestroy(&mode[i]);CHECK_PETSC_ERROR(err);}
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/problems/SolverNonlinear.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/problems/SolverNonlinear.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -140,7 +140,7 @@
PetscErrorCode err = 0;
const PetscVec solutionVec = solution->vector();
- err = SNESSolve(_snes, PETSC_NULL, solutionVec); CHECK_PETSC_ERROR(err);
+ err = SNESSolve(_snes, NULL, solutionVec); CHECK_PETSC_ERROR(err);
_logger->eventEnd(solveEvent);
_logger->eventBegin(scatterEvent);
@@ -235,13 +235,13 @@
ierr = SNESLineSearchGetLambda(linesearch, &lambda);CHKERRQ(ierr);
ierr = SNESLineSearchGetSNES(linesearch, &snes);CHKERRQ(ierr);
ierr = SNESLineSearchGetMonitor(linesearch, &monitor);CHKERRQ(ierr);
- ierr = SNESLineSearchGetTolerances(linesearch, &minlambda, &maxstep, PETSC_NULL, PETSC_NULL, PETSC_NULL, &max_its);CHKERRQ(ierr);
- ierr = SNESGetTolerances(snes, PETSC_NULL, PETSC_NULL, &stol, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
+ ierr = SNESLineSearchGetTolerances(linesearch, &minlambda, &maxstep, NULL, NULL, NULL, &max_its);CHKERRQ(ierr);
+ ierr = SNESGetTolerances(snes, NULL, NULL, &stol, NULL, NULL);CHKERRQ(ierr);
bt = (PetscSNESLineSearch_BT *)linesearch->data;
alpha = bt->alpha;
- ierr = SNESGetJacobian(snes, &jac, PETSC_NULL, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
+ ierr = SNESGetJacobian(snes, &jac, NULL, NULL, NULL);CHKERRQ(ierr);
if (!jac) {
SETERRQ(((PetscObject)linesearch)->comm, PETSC_ERR_USER, "SNESLineSearchBT requires a Jacobian matrix");
}
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/Field.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/Field.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -375,7 +375,7 @@
CHECK_PETSC_ERROR(err);
} else {
err = VecCreateSeqWithArray(PETSC_COMM_SELF,
- blockSize, 0, PETSC_NULL,
+ blockSize, 0, NULL,
&sinfo.scatterVec);
CHECK_PETSC_ERROR(err);
} // else
@@ -785,7 +785,7 @@
&sinfo.scatterVec);CHECK_PETSC_ERROR(err);
} else {
err = VecCreateSeqWithArray(PETSC_COMM_SELF,
- blockSize, 0, PETSC_NULL,
+ blockSize, 0, NULL,
&sinfo.scatterVec);CHECK_PETSC_ERROR(err);
} // else
@@ -864,7 +864,7 @@
&sinfo.scatterVec);CHECK_PETSC_ERROR(err);
} else {
err = VecCreateSeqWithArray(PETSC_COMM_SELF,
- blockSize, 0, PETSC_NULL,
+ blockSize, 0, NULL,
&sinfo.scatterVec);CHECK_PETSC_ERROR(err);
} // else
@@ -944,7 +944,7 @@
&sinfo.scatterVec);CHECK_PETSC_ERROR(err);
} else {
err = VecCreateSeqWithArray(PETSC_COMM_SELF,
- blockSize, 0, PETSC_NULL,
+ blockSize, 0, NULL,
&sinfo.scatterVec);CHECK_PETSC_ERROR(err);
} // else
@@ -1020,7 +1020,7 @@
&sinfo.scatterVec);CHECK_PETSC_ERROR(err);
} else {
err = VecCreateSeqWithArray(PETSC_COMM_SELF,
- blockSize, 0, PETSC_NULL,
+ blockSize, 0, NULL,
&sinfo.scatterVec);CHECK_PETSC_ERROR(err);
} // else
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/Jacobian.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/Jacobian.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/Jacobian.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -138,7 +138,7 @@
for(PetscInt r = rStart; r < rEnd; ++r) {
PetscInt c;
- err = MatGetRow(_matrix,r, &ncols, &cols, PETSC_NULL);CHECK_PETSC_ERROR(err);
+ err = MatGetRow(_matrix,r, &ncols, &cols, NULL);CHECK_PETSC_ERROR(err);
if (!ncols) {
std::ostringstream msg;
msg << "ERROR: Empty row " << r << " in ["<<rStart<<","<<rEnd<<")" << std::endl;
@@ -152,7 +152,7 @@
msg << "ERROR: Row " << r << " in ["<<rStart<<","<<rEnd<<") is missing diagonal element" << std::endl;
throw std::runtime_error(msg.str().c_str());
}
- err = MatRestoreRow(_matrix,r, &ncols, &cols, PETSC_NULL);CHECK_PETSC_ERROR(err);
+ err = MatRestoreRow(_matrix,r, &ncols, &cols, NULL);CHECK_PETSC_ERROR(err);
}
#endif
Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/MeshRefiner.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/MeshRefiner.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/pylith/topology/MeshRefiner.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -40,8 +40,8 @@
template<typename cellrefiner_type>
ALE::MeshRefiner<cellrefiner_type>::~MeshRefiner(void)
{ // destructor
- delete _orderOldMesh; _orderOldMesh = PETSC_NULL;
- delete _orderNewMesh; _orderNewMesh = PETSC_NULL;
+ delete _orderOldMesh; _orderOldMesh = NULL;
+ delete _orderNewMesh; _orderNewMesh = NULL;
} // destructor
// ----------------------------------------------------------------------
@@ -792,10 +792,10 @@
}
#endif
newMesh->setCalculatedOverlap(true);
- delete [] oldVerticesStartNormalP; oldVerticesStartNormalP = PETSC_NULL;
- delete [] oldVerticesStartFaultP; oldVerticesStartFaultP = PETSC_NULL;
- delete [] newVerticesStartNormalP; newVerticesStartNormalP = PETSC_NULL;
- delete [] newVerticesStartFaultP; newVerticesStartFaultP = PETSC_NULL;
+ delete [] oldVerticesStartNormalP; oldVerticesStartNormalP = NULL;
+ delete [] oldVerticesStartFaultP; oldVerticesStartFaultP = NULL;
+ delete [] newVerticesStartNormalP; newVerticesStartNormalP = NULL;
+ delete [] newVerticesStartFaultP; newVerticesStartFaultP = NULL;
refiner.overlapAddNewVertices(newMesh, *_orderNewMesh, mesh, *_orderOldMesh);
// We have to do flexible assembly since we add the new vertices separately
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/Makefile.am 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/Makefile.am 2013-02-26 23:35:11 UTC (rev 21403)
@@ -29,6 +29,7 @@
StaticFriction.i \
SlipWeakening.i \
SlipWeakeningTime.i \
+ SlipWeakeningTimeStable.i \
SlipWeakeningStress.i \
RateStateAgeing.i \
TimeWeakening.i
Copied: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/SlipWeakeningTimeStable.i (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/modulesrc/friction/SlipWeakeningTimeStable.i)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/SlipWeakeningTimeStable.i (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/SlipWeakeningTimeStable.i 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/friction/SlipWeakeningTimeStable.i
+ *
+ * Python interface to C++ SlipWeakeningTimeStable object.
+ */
+
+namespace pylith {
+ namespace friction {
+
+ class SlipWeakeningTimeStable : public FrictionModel
+ { // class SlipWeakeningTimeStable
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ SlipWeakeningTimeStable(void);
+
+ /// Destructor.
+ ~SlipWeakeningTimeStable(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(PylithScalar* const propValues,
+ const scalar_array& dbValues) const;
+
+ /** Nondimensionalize properties.
+ *
+ * @param values Array of property values.
+ * @param nvalues Number of values.
+ */
+ void _nondimProperties(PylithScalar* const values,
+ const int nvalues) const;
+
+ /** Dimensionalize properties.
+ *
+ * @param values Array of property values.
+ * @param nvalues Number of values.
+ */
+ void _dimProperties(PylithScalar* const values,
+ const int nvalues) const;
+
+ /** Compute friction from properties and state variables.
+ *
+ * @param t Current time.
+ * @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.
+ */
+ PylithScalar _calcFriction(const PylithScalar t,
+ const PylithScalar slip,
+ const PylithScalar slipRate,
+ const PylithScalar normalTraction,
+ const PylithScalar* properties,
+ const int numProperties,
+ const PylithScalar* stateVars,
+ const int numStateVars);
+
+ }; // class SlipWeakeningTimeStable
+
+ } // friction
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/friction.i
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/friction.i 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/modulesrc/friction/friction.i 2013-02-26 23:35:11 UTC (rev 21403)
@@ -30,6 +30,7 @@
#include "pylith/friction/StaticFriction.hh"
#include "pylith/friction/SlipWeakening.hh"
#include "pylith/friction/SlipWeakeningTime.hh"
+#include "pylith/friction/SlipWeakeningTimeStable.hh"
#include "pylith/friction/SlipWeakeningStress.hh"
#include "pylith/friction/RateStateAgeing.hh"
#include "pylith/friction/TimeWeakening.hh"
@@ -67,6 +68,7 @@
%include "StaticFriction.i"
%include "SlipWeakening.i"
%include "SlipWeakeningTime.i"
+%include "SlipWeakeningTimeStable.i"
%include "SlipWeakeningStress.i"
%include "RateStateAgeing.i"
%include "TimeWeakening.i"
Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/Makefile.am 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/Makefile.am 2013-02-26 23:35:11 UTC (rev 21403)
@@ -71,6 +71,7 @@
friction/StaticFriction.py \
friction/SlipWeakening.py \
friction/SlipWeakeningTime.py \
+ friction/SlipWeakeningTimeStable.py \
friction/SlipWeakeningStress.py \
friction/RateStateAgeing.py \
friction/TimeWeakening.py \
Copied: short/3D/PyLith/branches/pylith-scecdynrup/pylith/friction/SlipWeakeningTimeStable.py (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/pylith/friction/SlipWeakeningTimeStable.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/friction/SlipWeakeningTimeStable.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/friction/SlipWeakeningTimeStable.py 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2011 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/friction/SlipWeakeningTimeStable.py
+##
+## @brief Python object implementing slip weakening with forced
+## weakening at a give time (sometimes used for nucleation).
+##
+## Factory: friction_model.
+
+from FrictionModel import FrictionModel
+from friction import SlipWeakeningTimeStable as ModuleSlipWeakeningTimeStable
+
+# SlipWeakeningTimeStable class
+class SlipWeakeningTimeStable(FrictionModel, ModuleSlipWeakeningTimeStable):
+ """
+ Python object implementing Slip Weakening.
+
+ Factory: friction_model.
+ """
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="slipweakening"):
+ """
+ Constructor.
+ """
+ FrictionModel.__init__(self, name)
+ self.availableFields = \
+ {'vertex': \
+ {'info': ["static_coefficient",
+ "dynamic_coefficient",
+ "slip_weakening_parameter",
+ "cohesion",
+ "time_weakening_time",
+ "time_weakening_parameter"],
+ 'data': ["cumulative_slip",
+ "previous_slip"]},
+ 'cell': \
+ {'info': [],
+ 'data': []}}
+ self._loggingPrefix = "FrSWT "
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _createModuleObj(self):
+ """
+ Call constructor for module object for access to C++ object.
+ """
+ ModuleSlipWeakeningTimeStable.__init__(self)
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def friction_model():
+ """
+ Factory associated with SlipWeakeningTimeStable.
+ """
+ return SlipWeakeningTimeStable()
+
+
+# End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/tests/topology/test_topology.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests/topology/test_topology.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests/topology/test_topology.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -39,7 +39,7 @@
{ // main
std::string meshFilename = "data/tet4.exo";
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Initialize Python
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/test_bc.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/test_bc.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/bc/test_bc.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -38,8 +38,7 @@
try {
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv,
- PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Initialize Python (to eliminate need to initialize when
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/test_faults.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/test_faults.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/faults/test_faults.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -38,8 +38,7 @@
try {
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv,
- PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Initialize Python (to eliminate need to initialize when
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/feassemble/test_feassemble.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/feassemble/test_feassemble.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/feassemble/test_feassemble.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -38,8 +38,7 @@
try {
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv,
- PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Initialize Python (to eliminate need to initialize when
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/Makefile.am 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/Makefile.am 2013-02-26 23:35:11 UTC (rev 21403)
@@ -32,6 +32,7 @@
TestStaticFriction.cc \
TestSlipWeakening.cc \
TestSlipWeakeningTime.cc \
+ TestSlipWeakeningTimeStable.cc \
TestSlipWeakeningStress.cc \
TestRateStateAgeing.cc \
TestTimeWeakening.cc
@@ -42,6 +43,7 @@
TestStaticFriction.hh \
TestSlipWeakening.hh \
TestSlipWeakeningTime.hh \
+ TestSlipWeakeningTimeStable.hh \
TestSlipWeakeningStress.hh \
TestRateStateAgeing.hh \
TestTimeWeakening.hh
@@ -52,6 +54,7 @@
data/StaticFrictionData.cc \
data/SlipWeakeningData.cc \
data/SlipWeakeningTimeData.cc \
+ data/SlipWeakeningTimeStableData.cc \
data/SlipWeakeningStressData.cc \
data/RateStateAgeingData.cc \
data/TimeWeakeningData.cc
@@ -62,6 +65,7 @@
data/StaticFrictionData.hh \
data/SlipWeakeningData.hh \
data/SlipWeakeningTimeData.hh \
+ data/SlipWeakeningTimeStableData.hh \
data/SlipWeakeningStressData.hh \
data/RateStateAgeingData.hh \
data/TimeWeakeningData.hh
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestFrictionModel.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestFrictionModel.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestFrictionModel.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -444,10 +444,11 @@
const PylithScalar tolerance = 1.0e-06;
for (int i=0; i < propertiesSize; ++i) {
- if (fabs(propertiesE[i]) > tolerance)
+ if (fabs(propertiesE[i]) > tolerance) {
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, properties[i]/propertiesE[i], tolerance);
- else
+ } else {
CPPUNIT_ASSERT_DOUBLES_EQUAL(propertiesE[i], properties[i], tolerance);
+ } // if/else
} // for
} // for
} // testDBToProperties
@@ -680,10 +681,11 @@
const PylithScalar tolerance = 1.0e-06;
- if (0.0 != frictionE)
+ if (0.0 != frictionE) {
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, friction/frictionE, tolerance);
- else
+ } else {
CPPUNIT_ASSERT_DOUBLES_EQUAL(frictionE, friction, tolerance);
+ } // if/else
} // for
} // _testCalcFriction
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestSlipWeakeningTimeStable.cc (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/friction/TestSlipWeakeningTimeStable.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestSlipWeakeningTimeStable.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestSlipWeakeningTimeStable.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestSlipWeakeningTimeStable.hh" // Implementation of class methods
+
+#include "data/SlipWeakeningTimeStableData.hh" // USES SlipWeakeningTimeStableData
+
+#include "pylith/friction/SlipWeakeningTimeStable.hh" // USES SlipWeakeningTimeStable
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::friction::TestSlipWeakeningTimeStable );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::friction::TestSlipWeakeningTimeStable::setUp(void)
+{ // setUp
+ _friction = new SlipWeakeningTimeStable();
+ _data = new SlipWeakeningTimeStableData();
+ setupNormalizer();
+} // setUp
+
+// ----------------------------------------------------------------------
+// Test properties metadata.
+void
+pylith::friction::TestSlipWeakeningTimeStable::testPropertiesMetadata(void)
+{ // testPropertiesMetadata
+ SlipWeakeningTimeStable model;
+
+ CPPUNIT_ASSERT_EQUAL(6, model._metadata.numDBProperties());
+ const char* const* names = model._metadata.dbProperties();
+ CPPUNIT_ASSERT_EQUAL(std::string("static-coefficient"),
+ std::string(names[0]));
+ CPPUNIT_ASSERT_EQUAL(std::string("dynamic-coefficient"),
+ std::string(names[1]));
+ CPPUNIT_ASSERT_EQUAL(std::string("slip-weakening-parameter"),
+ std::string(names[2]));
+ CPPUNIT_ASSERT_EQUAL(std::string("cohesion"),
+ std::string(names[3]));
+ CPPUNIT_ASSERT_EQUAL(std::string("time-weakening-time"),
+ std::string(names[4]));
+ CPPUNIT_ASSERT_EQUAL(std::string("time-weakening-parameter"),
+ std::string(names[5]));
+} // testPropertiesMetadata
+
+// ----------------------------------------------------------------------
+// Test state variable metadata.
+void
+pylith::friction::TestSlipWeakeningTimeStable::testStateVarsMetadata(void)
+{ // testStateVarsMetadata
+ SlipWeakeningTimeStable model;
+
+ CPPUNIT_ASSERT_EQUAL(2, model._metadata.numDBStateVars());
+ const char* const* names = model._metadata.dbStateVars();
+ CPPUNIT_ASSERT_EQUAL(std::string("cumulative-slip"),
+ std::string(names[0]));
+ CPPUNIT_ASSERT_EQUAL(std::string("previous-slip"),
+ std::string(names[1]));
+} // testStateVarsMetadata
+
+// ----------------------------------------------------------------------
+// Test hasPropStateVar().
+void
+pylith::friction::TestSlipWeakeningTimeStable::testHasPropStateVar(void)
+{ // testHasPropStateVar
+ SlipWeakeningTimeStable material;
+
+ CPPUNIT_ASSERT(material.hasPropStateVar("static_coefficient"));
+ CPPUNIT_ASSERT(material.hasPropStateVar("dynamic_coefficient"));
+ CPPUNIT_ASSERT(material.hasPropStateVar("slip_weakening_parameter"));
+ CPPUNIT_ASSERT(material.hasPropStateVar("cohesion"));
+ CPPUNIT_ASSERT(material.hasPropStateVar("time_weakening_time"));
+ CPPUNIT_ASSERT(material.hasPropStateVar("time_weakening_parameter"));
+ CPPUNIT_ASSERT(!material.hasPropStateVar("aaa"));
+ CPPUNIT_ASSERT(material.hasPropStateVar("cumulative_slip"));
+ CPPUNIT_ASSERT(material.hasPropStateVar("previous_slip"));
+} // testHasPropStateVar
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestSlipWeakeningTimeStable.hh (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/friction/TestSlipWeakeningTimeStable.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestSlipWeakeningTimeStable.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/TestSlipWeakeningTimeStable.hh 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/friction/TestSlipWeakeningTimeStable.hh
+ *
+ * @brief C++ TestSlipWeakeningTimeStable object
+ *
+ * C++ unit testing for SlipWeakeningTimeStable.
+ */
+
+#if !defined(pylith_friction_testslipweakeningtimestable_hh)
+#define pylith_friction_testslipweakeningtimestable_hh
+
+#include "TestFrictionModel.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace friction {
+ class TestSlipWeakeningTimeStable;
+ } // friction
+} // pylith
+
+/// C++ unit testing for SlipWeakeningTimeStable
+class pylith::friction::TestSlipWeakeningTimeStable : public TestFrictionModel
+{ // class TestSlipWeakeningTimeStable
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSlipWeakeningTimeStable );
+
+ CPPUNIT_TEST( testPropertiesMetadata );
+ CPPUNIT_TEST( testStateVarsMetadata );
+ CPPUNIT_TEST( testDBToProperties );
+ CPPUNIT_TEST( testNonDimProperties );
+ CPPUNIT_TEST( testDimProperties );
+ CPPUNIT_TEST( testDBToStateVars );
+ CPPUNIT_TEST( testNonDimStateVars );
+ CPPUNIT_TEST( testDimStateVars );
+ CPPUNIT_TEST( testHasPropStateVar );
+ CPPUNIT_TEST( test_calcFriction );
+ CPPUNIT_TEST( test_updateStateVars );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Test properties metadata.
+ void testPropertiesMetadata(void);
+
+ /// Test state variable metadata.
+ void testStateVarsMetadata(void);
+
+ /// Test hasPropStateVar().
+ void testHasPropStateVar(void);
+
+}; // class TestSlipWeakeningTimeStable
+
+#endif // pylith_friction_testslipweakeningtimestable_hh
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/RateStateAgeingData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/RateStateAgeingData.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/RateStateAgeingData.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -129,8 +129,8 @@
};
const PylithScalar pylith::friction::RateStateAgeingData::_friction[] = {
- 1000001.285949009547604,
- 1000001.164378652801948,
+ 11.285949009547604e+5,
+ 11.164378652801948e+5,
};
const PylithScalar pylith::friction::RateStateAgeingData::_slip[] = {
@@ -144,8 +144,8 @@
};
const PylithScalar pylith::friction::RateStateAgeingData::_normalTraction[] = {
- -2.2,
- -2.3,
+ -2.2e+5,
+ -2.3e+5,
};
const PylithScalar pylith::friction::RateStateAgeingData::_stateVarsUpdated[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningData.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningData.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -121,8 +121,8 @@
};
const PylithScalar pylith::friction::SlipWeakeningData::_friction[] = {
- 1000001.21,
- 1000001.15,
+ 11.188e+5,
+ 11.150e+5,
};
const PylithScalar pylith::friction::SlipWeakeningData::_slip[] = {
@@ -136,8 +136,8 @@
};
const PylithScalar pylith::friction::SlipWeakeningData::_normalTraction[] = {
- -2.2,
- -2.3,
+ -2.2e+5,
+ -2.3e+5,
};
const PylithScalar pylith::friction::SlipWeakeningData::_stateVarsUpdated[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningStressData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningStressData.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningStressData.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -136,8 +136,8 @@
};
const PylithScalar pylith::friction::SlipWeakeningStressData::_normalTraction[] = {
- -2.2,
- -2.3,
+ -2.2e+5,
+ -2.3e+5,
};
const PylithScalar pylith::friction::SlipWeakeningStressData::_stateVarsUpdated[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeData.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeData.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -129,13 +129,13 @@
};
const PylithScalar pylith::friction::SlipWeakeningTimeData::_friction[] = {
- 1000001.21,
- 1000001.15,
+ 11.188e+5,
+ 11.150e+5,
};
const PylithScalar pylith::friction::SlipWeakeningTimeData::_slip[] = {
0.12,
- 0.25,
+ 0.1,
};
const PylithScalar pylith::friction::SlipWeakeningTimeData::_slipRate[] = {
@@ -144,15 +144,15 @@
};
const PylithScalar pylith::friction::SlipWeakeningTimeData::_normalTraction[] = {
- -2.2,
- -2.3,
+ -2.2e+5,
+ -2.3e+5,
};
const PylithScalar pylith::friction::SlipWeakeningTimeData::_stateVarsUpdated[] = {
0.48,
0.12,
- 0.65,
- 0.25,
+ 0.5,
+ 0.1,
};
pylith::friction::SlipWeakeningTimeData::SlipWeakeningTimeData(void)
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeStableData.cc (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/friction/data/SlipWeakeningTimeStableData.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeStableData.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeStableData.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,356 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "SlipWeakeningTimeStableData.hh"
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numLocs = 6;
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numProperties = 6;
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numStateVars = 2;
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numDBProperties = 6;
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numDBStateVars = 2;
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numPropsVertex = 6;
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numVarsVertex = 2;
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_lengthScale = 1.00000000e+03;
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_timeScale = 1.00000000e+01;
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_pressureScale = 2.25000000e+10;
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_densityScale = 1.00000000e+03;
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_dt = 0.01;
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numPropertyValues[6] = {
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+};
+
+const int pylith::friction::SlipWeakeningTimeStableData::_numStateVarValues[2] = {
+ 1,
+ 1,
+};
+
+const char* pylith::friction::SlipWeakeningTimeStableData::_dbPropertyValues[6] = {
+ "static-coefficient",
+ "dynamic-coefficient",
+ "slip-weakening-parameter",
+ "cohesion",
+ "time-weakening-time",
+ "time-weakening-parameter",
+};
+
+const char* pylith::friction::SlipWeakeningTimeStableData::_dbStateVarValues[2] = {
+ "cumulative-slip",
+ "previous-slip",
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_dbProperties[6*6] = {
+ 0.6,
+ 0.5,
+ 0.8,
+ 1000000,
+ 2.0,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.8,
+ 1000000,
+ 1.25,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.8,
+ 1000000,
+ 0.6,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.4,
+ 1000000,
+ 2.0,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.4,
+ 1000000,
+ 1.25,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.4,
+ 1000000,
+ 0.6,
+ 0.5,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_dbStateVars[6*2] = {
+ 0.15,
+ 0.1,
+
+ 0.15,
+ 0.1,
+
+ 0.15,
+ 0.1,
+
+ 0.8,
+ 0.4,
+
+ 0.8,
+ 0.4,
+
+ 0.8,
+ 0.4,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_properties[6*6] = {
+ 0.6,
+ 0.5,
+ 0.8,
+ 1000000,
+ 2.0,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.8,
+ 1000000,
+ 1.25,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.8,
+ 1000000,
+ 0.6,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.4,
+ 1000000,
+ 2.0,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.4,
+ 1000000,
+ 1.25,
+ 0.5,
+
+ 0.6,
+ 0.5,
+ 0.4,
+ 1000000,
+ 0.6,
+ 0.5,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_stateVars[6*2] = {
+ 0.15,
+ 0.1,
+
+ 0.15,
+ 0.1,
+
+ 0.15,
+ 0.1,
+
+ 0.8,
+ 0.4,
+
+ 0.8,
+ 0.4,
+
+ 0.8,
+ 0.4,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_propertiesNondim[6*6] = {
+ 0.6,
+ 0.5,
+ 0.0008,
+ 0.000044444444,
+ 0.2,
+ 0.05,
+
+ 0.6,
+ 0.5,
+ 0.0008,
+ 0.000044444444,
+ 0.125,
+ 0.05,
+
+ 0.6,
+ 0.5,
+ 0.0008,
+ 0.000044444444,
+ 0.06,
+ 0.05,
+
+ 0.6,
+ 0.5,
+ 0.0004,
+ 0.000044444444,
+ 0.2,
+ 0.05,
+
+ 0.6,
+ 0.5,
+ 0.0004,
+ 0.000044444444,
+ 0.125,
+ 0.05,
+
+ 0.6,
+ 0.5,
+ 0.0004,
+ 0.000044444444,
+ 0.06,
+ 0.05,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_stateVarsNondim[6*2] = {
+ 0.00015,
+ 0.0001,
+
+ 0.00015,
+ 0.0001,
+
+ 0.00015,
+ 0.0001,
+
+ 0.0008,
+ 0.0004,
+
+ 0.0008,
+ 0.0004,
+
+ 0.0008,
+ 0.0004,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_friction[6] = {
+ 11.265e+5,
+ 11.210e+5,
+ 11.100e+5,
+ 11.15e+5,
+ 11.15e+5,
+ 11.15e+5,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_slip[6] = {
+ 0.15,
+ 0.15,
+ 0.15,
+ 0.6,
+ 0.6,
+ 0.6,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_slipRate[6] = {
+ 0.74,
+ 0.74,
+ 0.74,
+ 0.64,
+ 0.64,
+ 0.64,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_normalTraction[6] = {
+ -2.2e+5,
+ -2.2e+5,
+ -2.2e+5,
+ -2.3e+5,
+ -2.3e+5,
+ -2.3e+5,
+};
+
+const PylithScalar pylith::friction::SlipWeakeningTimeStableData::_stateVarsUpdated[6*2] = {
+ 0.20,
+ 0.15,
+
+ 0.20,
+ 0.15,
+
+ 0.20,
+ 0.15,
+
+ 1.0,
+ 0.6,
+
+ 1.0,
+ 0.6,
+
+ 1.0,
+ 0.6,
+};
+
+pylith::friction::SlipWeakeningTimeStableData::SlipWeakeningTimeStableData(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<PylithScalar*>(_dbProperties);
+ dbStateVars = const_cast<PylithScalar*>(_dbStateVars);
+ dt = _dt;
+ properties = const_cast<PylithScalar*>(_properties);
+ stateVars = const_cast<PylithScalar*>(_stateVars);
+ propertiesNondim = const_cast<PylithScalar*>(_propertiesNondim);
+ stateVarsNondim = const_cast<PylithScalar*>(_stateVarsNondim);
+ friction = const_cast<PylithScalar*>(_friction);
+ slip = const_cast<PylithScalar*>(_slip);
+ slipRate = const_cast<PylithScalar*>(_slipRate);
+ normalTraction = const_cast<PylithScalar*>(_normalTraction);
+ stateVarsUpdated = const_cast<PylithScalar*>(_stateVarsUpdated);
+} // constructor
+
+pylith::friction::SlipWeakeningTimeStableData::~SlipWeakeningTimeStableData(void)
+{}
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeStableData.hh (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/friction/data/SlipWeakeningTimeStableData.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeStableData.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/SlipWeakeningTimeStableData.hh 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_friction_slipweakeningtimestabledata_hh)
+#define pylith_friction_slipweakeningtimestabledata_hh
+
+#include "FrictionModelData.hh"
+
+namespace pylith {
+ namespace friction {
+ class SlipWeakeningTimeStableData;
+ } // pylith
+} // friction
+
+class pylith::friction::SlipWeakeningTimeStableData : public FrictionModelData
+{
+
+public:
+
+ /// Constructor
+ SlipWeakeningTimeStableData(void);
+
+ /// Destructor
+ ~SlipWeakeningTimeStableData(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 PylithScalar _lengthScale;
+
+ static const PylithScalar _timeScale;
+
+ static const PylithScalar _pressureScale;
+
+ static const PylithScalar _densityScale;
+
+ static const PylithScalar _dt;
+
+ static const int _numPropertyValues[];
+
+ static const int _numStateVarValues[];
+
+ static const char* _dbPropertyValues[];
+
+ static const char* _dbStateVarValues[];
+
+ static const PylithScalar _dbProperties[];
+
+ static const PylithScalar _dbStateVars[];
+
+ static const PylithScalar _properties[];
+
+ static const PylithScalar _stateVars[];
+
+ static const PylithScalar _propertiesNondim[];
+
+ static const PylithScalar _stateVarsNondim[];
+
+ static const PylithScalar _friction[];
+
+ static const PylithScalar _slip[];
+
+ static const PylithScalar _slipRate[];
+
+ static const PylithScalar _normalTraction[];
+
+ static const PylithScalar _stateVarsUpdated[];
+
+};
+
+#endif // pylith_friction_slipweakeningtimestabledata_hh
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/StaticFrictionData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/StaticFrictionData.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/StaticFrictionData.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -84,7 +84,7 @@
const PylithScalar* pylith::friction::StaticFrictionData::_stateVarsNondim = 0;
const PylithScalar pylith::friction::StaticFrictionData::_friction[] = {
- 1000001.32,
+ 11.32e+5,
1.0e+6,
};
@@ -99,8 +99,8 @@
};
const PylithScalar pylith::friction::StaticFrictionData::_normalTraction[] = {
- -2.2,
- 0.8,
+ -2.2e+5,
+ 0.8e+5,
};
const PylithScalar* pylith::friction::StaticFrictionData::_stateVarsUpdated = 0;
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/TimeWeakeningData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/TimeWeakeningData.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/data/TimeWeakeningData.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -113,8 +113,8 @@
};
const PylithScalar pylith::friction::TimeWeakeningData::_friction[] = {
- 1000001.21,
- 1000001.15,
+ 11.21e+5,
+ 11.15e+5,
};
const PylithScalar pylith::friction::TimeWeakeningData::_slip[] = {
@@ -128,8 +128,8 @@
};
const PylithScalar pylith::friction::TimeWeakeningData::_normalTraction[] = {
- -2.2,
- -2.3,
+ -2.2e+5,
+ -2.3e+5,
};
const PylithScalar pylith::friction::TimeWeakeningData::_stateVarsUpdated[] = {
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/test_friction.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/test_friction.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/friction/test_friction.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -38,8 +38,7 @@
try {
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv,
- PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Initialize Python (to eliminate need to initialize when
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/materials/test_materials.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/materials/test_materials.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/materials/test_materials.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -38,8 +38,7 @@
try {
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv,
- PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Initialize Python (to eliminate need to initialize when
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/test_meshio.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/test_meshio.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/meshio/test_meshio.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -42,7 +42,7 @@
try {
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Initialize Python
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/test_topology.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/test_topology.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/topology/test_topology.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -40,7 +40,7 @@
try {
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Create event manager and test controller
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/utils/test_utils.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/utils/test_utils.cc 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/libtests/utils/test_utils.cc 2013-02-26 23:35:11 UTC (rev 21403)
@@ -37,7 +37,7 @@
try {
// Initialize PETSc
- PetscErrorCode err = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+ PetscErrorCode err = PetscInitialize(&argc, &argv, NULL, NULL);
CHKERRQ(err);
// Create event manager and test controller
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/Makefile.am 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/Makefile.am 2013-02-26 23:35:11 UTC (rev 21403)
@@ -31,6 +31,7 @@
TestStaticFriction.py \
TestSlipWeakening.py \
TestSlipWeakeningTime.py \
+ TestSlipWeakeningTimeStable.py \
TestSlipWeakeningStress.py \
TestRateStateAgeing.py \
TestTimeWeakening.py
Copied: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/TestSlipWeakeningTimeStable.py (from rev 21402, short/3D/PyLith/branches/v1.7-trunk/unittests/pytests/friction/TestSlipWeakeningTimeStable.py)
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/TestSlipWeakeningTimeStable.py (rev 0)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/TestSlipWeakeningTimeStable.py 2013-02-26 23:35:11 UTC (rev 21403)
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2011 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/friction/TestSlipWeakeningTimeStable.py
+
+## @brief Unit testing of SlipWeakeningTimeStable object.
+
+import unittest
+
+from pylith.friction.SlipWeakeningTimeStable import SlipWeakeningTimeStable
+
+# ----------------------------------------------------------------------
+class TestSlipWeakeningTimeStable(unittest.TestCase):
+ """
+ Unit testing of SlipWeakeningTimeStable object.
+ """
+
+ def setUp(self):
+ """
+ Setup test subject.
+ """
+ self.friction = SlipWeakeningTimeStable()
+ return
+
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ return
+
+
+ def test_factory(self):
+ """
+ Test factory method.
+ """
+ from pylith.friction.SlipWeakeningTimeStable import friction_model
+ m = friction_model()
+ return
+
+
+# End of file
Modified: short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/testfriction.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/testfriction.py 2013-02-26 07:38:03 UTC (rev 21402)
+++ short/3D/PyLith/branches/pylith-scecdynrup/unittests/pytests/friction/testfriction.py 2013-02-26 23:35:11 UTC (rev 21403)
@@ -71,6 +71,9 @@
from TestSlipWeakeningTime import TestSlipWeakeningTime
suite.addTest(unittest.makeSuite(TestSlipWeakeningTime))
+ from TestSlipWeakeningTimeStable import TestSlipWeakeningTimeStable
+ suite.addTest(unittest.makeSuite(TestSlipWeakeningTimeStable))
+
from TestSlipWeakeningStress import TestSlipWeakeningStress
suite.addTest(unittest.makeSuite(TestSlipWeakeningStress))
More information about the CIG-COMMITS
mailing list