[cig-commits] r16185 - in short/3D/PyLith/trunk: libsrc/friction unittests/libtests/friction/data

surendra at geodynamics.org surendra at geodynamics.org
Tue Jan 26 16:25:53 PST 2010


Author: surendra
Date: 2010-01-26 16:25:53 -0800 (Tue, 26 Jan 2010)
New Revision: 16185

Modified:
   short/3D/PyLith/trunk/libsrc/friction/SlipWeakening.cc
   short/3D/PyLith/trunk/unittests/libtests/friction/data/SlipWeakeningData.cc
Log:
Finished implementing SlipWeakening and corresponding unittests - All tests passed

Modified: short/3D/PyLith/trunk/libsrc/friction/SlipWeakening.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/SlipWeakening.cc	2010-01-26 21:13:11 UTC (rev 16184)
+++ short/3D/PyLith/trunk/libsrc/friction/SlipWeakening.cc	2010-01-27 00:25:53 UTC (rev 16185)
@@ -26,7 +26,7 @@
 #include <cassert> // USES assert()
 #include <sstream> // USES std::ostringstream
 #include <stdexcept> // USES std::runtime_error
-
+#include <iostream>
 // ----------------------------------------------------------------------
 namespace pylith {
   namespace friction {
@@ -124,7 +124,7 @@
 
   const double db_static = dbValues[db_coefS];
   const double db_dynamic = dbValues[db_coefD];
-  const double db_d0 = dbValues[db_d0];
+  const double db_do = dbValues[db_d0];
  
   if (db_static <= 0.0) {
     std::ostringstream msg;
@@ -152,7 +152,8 @@
 
   propValues[p_coefS] = db_static;
   propValues[p_coefD] = db_dynamic;
-  propValues[p_d0] = db_d0;
+  propValues[p_d0] = db_do;
+
 } // _dbToProperties
 
 // ----------------------------------------------------------------------
@@ -251,26 +252,25 @@
   assert(0 != numStateVars);
   assert(_numVarsVertex == numStateVars);
 
-  // SURENDRA: Use p_coefS, p_coefD, p_d0, s_slipCum, s_slipPrev to
-  // unpack values.  Expression for friction should be efficient but
-  // easy to understand.
 
-  /*
-  const double friction = (normalTraction < 0) ?
-    ((stateVars[0] < properties[p_coef+2]) ?
-     properties[p_coef]-(properties[p_coef]-properties[p_coef+1]) *
-     stateVars[0] / properties[p_coef+2] * normalTraction : 
-     properties[p_coef+1] * normalTraction) : 0.0;
-  */
-
   // DO SOMETHING LIKE THIS:
   double friction = 0.0;
+  double mu_f = 0.0;
   if (normalTraction < 0.0) {
+    // if fault is in compression
+    if (stateVars[s_slipCum] < properties[p_coefD]) {
+	// 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];
+	friction = - mu_f * normalTraction;
+      } else {
+	mu_f = properties[p_coefD];
+	friction = - mu_f * normalTraction;
+      } // if/else
   } // if
 
-  PetscLogFlops(1); // SURENDRA: Update this with the number of
-		    // floating point operations (add, subtract,
-		    // multiply, divide)
+  PetscLogFlops(5);
 
   return friction;
 } // _calcFriction
@@ -289,10 +289,10 @@
   assert(0 != numStateVars);
   assert(0 != numProperties);
 
-  const double tmpPreviousSlip = stateVars[1];
+  const double tmpPreviousSlip = stateVars[s_slipPrev];
  
-  stateVars[1] = stateVars[0];
-  stateVars[0] += fabs(slip - tmpPreviousSlip);
+  stateVars[s_slipPrev] = stateVars[s_slipCum];
+  stateVars[s_slipCum] += fabs(slip - tmpPreviousSlip);
     
 } // _updateStateVars
 

Modified: short/3D/PyLith/trunk/unittests/libtests/friction/data/SlipWeakeningData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/data/SlipWeakeningData.cc	2010-01-26 21:13:11 UTC (rev 16184)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/data/SlipWeakeningData.cc	2010-01-27 00:25:53 UTC (rev 16185)
@@ -58,53 +58,55 @@
 
 const double pylith::friction::SlipWeakeningData::_dbProperties[] = {
   0.6,
+  0.5,
+  0.8,
   0.6,
-  0.8,
-  0.8,
-  0.7,
-  0.7,
+  0.5,
+  0.4,
 };
 
 const double pylith::friction::SlipWeakeningData::_dbStateVars[] = {
   0.4,
+  0.2,
   0.5,
-  0.2,
   0.1,
 };
 
 const double pylith::friction::SlipWeakeningData::_properties[] = {
   0.6,
+  0.5,
+  0.8,
   0.6,
-  0.8,
-  0.8,
-  0.7,
-  0.7,
+  0.5,
+  0.4,
 };
 
 const double pylith::friction::SlipWeakeningData::_stateVars[] = {
   0.4,
+  0.2,
   0.5,
-  0.2,
   0.1,
 };
 
 const double pylith::friction::SlipWeakeningData::_propertiesNondim[] = {
   0.6,
+  0.5,
+  0.0008,
   0.6,
-  0.8,
-  0.8,
+  0.5,
+  0.0004,
 };
 
 const double pylith::friction::SlipWeakeningData::_stateVarsNondim[] = {
-  0.4,
-  0.5,
-  0.2,
-  0.1,
+  0.0004,
+  0.0002,
+  0.0005,
+  0.0001,
 };
 
 const double pylith::friction::SlipWeakeningData::_friction[] = {
-  1.32,
-   0.0,
+  1.21,
+  1.15,
 };
 
 const double pylith::friction::SlipWeakeningData::_slip[] = {
@@ -119,14 +121,14 @@
 
 const double pylith::friction::SlipWeakeningData::_normalTraction[] = {
   -2.2,
-  0.8,
+  -2.3,
 };
 
 const double pylith::friction::SlipWeakeningData::_stateVarsUpdated[] = {
+  0.48,
   0.4,
+  0.65,
   0.5,
-  0.2,
-  0.1,
 };
 
 pylith::friction::SlipWeakeningData::SlipWeakeningData(void)



More information about the CIG-COMMITS mailing list