[cig-commits] r16552 - in short/3D/PyLith/trunk: libsrc/friction pylith/friction tests/2d/quad4

surendra at geodynamics.org surendra at geodynamics.org
Wed Apr 14 01:01:03 PDT 2010


Author: surendra
Date: 2010-04-14 01:01:02 -0700 (Wed, 14 Apr 2010)
New Revision: 16552

Added:
   short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningCompression.py
   short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningOpening.py
   short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningShearSliding.py
   short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningShearStick.py
   short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_compression.cfg
   short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_compression_soln.py
   short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_opening.cfg
   short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_opening_soln.py
   short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_sliding.cfg
   short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_sliding_soln.py
   short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_stick.cfg
   short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_stick_soln.py
Modified:
   short/3D/PyLith/trunk/libsrc/friction/RateStateAgeing.cc
   short/3D/PyLith/trunk/libsrc/friction/SlipWeakening.cc
   short/3D/PyLith/trunk/pylith/friction/RateStateAgeing.py
   short/3D/PyLith/trunk/pylith/friction/SlipWeakening.py
   short/3D/PyLith/trunk/pylith/friction/StaticFriction.py
   short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am
   short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py
Log:
Worked on tests for .vtk files of slip-weakening friction

Modified: short/3D/PyLith/trunk/libsrc/friction/RateStateAgeing.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/RateStateAgeing.cc	2010-04-14 04:14:17 UTC (rev 16551)
+++ short/3D/PyLith/trunk/libsrc/friction/RateStateAgeing.cc	2010-04-14 08:01:02 UTC (rev 16552)
@@ -349,7 +349,7 @@
   stateVars[s_state] = thetaTpdtVertex;
 
   std::cout << "STATEVAR before: " << thetaTVertex << ", after: " << thetaTpdtVertex << std::endl;
-  std::cout << "TIME-STEP: " << dt << std::endl;
+  std::cout << "SLIP RATE: " << slipRate << std::endl;
   PetscLogFlops(6);
 } // _updateStateVars
 

Modified: short/3D/PyLith/trunk/libsrc/friction/SlipWeakening.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/SlipWeakening.cc	2010-04-14 04:14:17 UTC (rev 16551)
+++ short/3D/PyLith/trunk/libsrc/friction/SlipWeakening.cc	2010-04-14 08:01:02 UTC (rev 16552)
@@ -302,6 +302,7 @@
  
   stateVars[s_slipPrev] = stateVars[s_slipCum];
   stateVars[s_slipCum] += fabs(slip - slipPrev);
+  std::cout << "SLIP RATE: " << slipRate << std::endl;
  
 } // _updateStateVars
 

Modified: short/3D/PyLith/trunk/pylith/friction/RateStateAgeing.py
===================================================================
--- short/3D/PyLith/trunk/pylith/friction/RateStateAgeing.py	2010-04-14 04:14:17 UTC (rev 16551)
+++ short/3D/PyLith/trunk/pylith/friction/RateStateAgeing.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -36,8 +36,13 @@
     FrictionModel.__init__(self, name)
     self.availableFields = \
         {'vertex': \
-           {'info': ["reference_friction_coefficient","reference_slip_rate","characteristic_slip_distance","constitutive_parameter_a","constitutive_parameter_b","state_variable"],
-            'data': []},
+           {'info': ["reference_friction_coefficient",
+                     "reference_slip_rate",
+                     "characteristic_slip_distance",
+                     "constitutive_parameter_a",
+                     "constitutive_parameter_b",
+                     "cohesion"],
+            'data': ["state_variable"]},
          'cell': \
            {'info': [],
             'data': []}}

Modified: short/3D/PyLith/trunk/pylith/friction/SlipWeakening.py
===================================================================
--- short/3D/PyLith/trunk/pylith/friction/SlipWeakening.py	2010-04-14 04:14:17 UTC (rev 16551)
+++ short/3D/PyLith/trunk/pylith/friction/SlipWeakening.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -36,8 +36,12 @@
     FrictionModel.__init__(self, name)
     self.availableFields = \
         {'vertex': \
-           {'info': ["static_coefficient","dynamic_coefficient","slip_weakening_parameter","cohesion"],
-            'data': []},
+           {'info': ["static_coefficient",
+                     "dynamic_coefficient",
+                     "slip_weakening_parameter",
+                     "cohesion"],
+            'data': ["cumulative_slip",
+                     "previous_slip"]},
          'cell': \
            {'info': [],
             'data': []}}

Modified: short/3D/PyLith/trunk/pylith/friction/StaticFriction.py
===================================================================
--- short/3D/PyLith/trunk/pylith/friction/StaticFriction.py	2010-04-14 04:14:17 UTC (rev 16551)
+++ short/3D/PyLith/trunk/pylith/friction/StaticFriction.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -36,7 +36,8 @@
     FrictionModel.__init__(self, name)
     self.availableFields = \
         {'vertex': \
-           {'info': ["friction_coefficient","cohesion"],
+           {'info': ["friction_coefficient",
+                     "cohesion"],
             'data': []},
          'cell': \
            {'info': [],

Modified: short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am	2010-04-14 04:14:17 UTC (rev 16551)
+++ short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am	2010-04-14 08:01:02 UTC (rev 16552)
@@ -38,6 +38,10 @@
 	friction_shear_stick_soln.py \
 	friction_shear_sliding_soln.py \
 	friction_opening_soln.py \
+	slipweakening_compression_soln.py \
+	slipweakening_shear_stick_soln.py \
+	slipweakening_shear_sliding_soln.py \
+	slipweakening_opening_soln.py \
 	testpylith.py
 
 dist_noinst_DATA = \
@@ -54,7 +58,11 @@
 	friction_compression.cfg \
 	friction_shear_stick.cfg \
 	friction_shear_sliding.cfg \
-	friction_opening.cfg
+	friction_opening.cfg \
+	slipweakening_compression.cfg \
+	slipweakening_shear_stick.cfg \
+	slipweakening_shear_sliding.cfg \
+	slipweakening_opening.cfg
 
 noinst_TMP = \
 	axial_disp.spatialdb \
@@ -88,7 +96,19 @@
 	friction_shear_sliding-elastic_t0000000.vtk \
 	friction_opening_t0000000.vtk \
 	friction_opening-elastic_info.vtk \
-	friction_opening-elastic_t0000000.vtk
+	friction_opening-elastic_t0000000.vtk \
+	slipweakening_compression_t0000000.vtk \
+	slipweakening_compression-elastic_info.vtk \
+	slipweakening_compression-elastic_t0000000.vtk \
+	slipweakening_shear_stick_t0000000.vtk \
+	slipweakening_shear_stick-elastic_info.vtk \
+	slipweakening_shear_stick-elastic_t0000000.vtk \
+	slipweakening_shear_sliding_t0000000.vtk \
+	slipweakening_shear_sliding-elastic_info.vtk \
+	slipweakening_shear_sliding-elastic_t0000000.vtk \
+	slipweakening_opening_t0000000.vtk \
+	slipweakening_opening-elastic_info.vtk \
+	slipweakening_opening-elastic_t0000000.vtk
 
 
 TESTS_ENVIRONMENT = $(PYTHON)

Added: short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningCompression.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningCompression.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningCompression.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/TestSlipWeakeningCompression.py
+##
+## @brief Test suite for testing pylith with 2-D axial compression with slipweakening.
+
+import numpy
+from TestQuad4 import TestQuad4
+from slipweakening_compression_soln import AnalyticalSoln
+from pylith.utils.VTKDataReader import has_vtk
+from pylith.utils.VTKDataReader import VTKDataReader
+from pylith.tests.Fault import check_vertex_fields
+
+# Local version of PyLithApp
+from pylith.apps.PyLithApp import PyLithApp
+class SWCompressionApp(PyLithApp):
+  def __init__(self):
+    PyLithApp.__init__(self, name="slipweakening_compression")
+    return
+
+
+# Helper function to run PyLith
+def run_pylith():
+  """
+  Run pylith.
+  """
+  if not "done" in dir(run_pylith):
+    # Run PyLith
+    app = SWCompressionApp()
+    app.run()
+    run_pylith.done = True
+  return
+
+
+class TestSlipWeakeningCompression(TestQuad4):
+  """
+  Test suite for testing pylith with 2-D axial compression with slipweakening.
+  """
+
+  def setUp(self):
+    """
+    Setup for test.
+    """
+    TestQuad4.setUp(self)
+    self.mesh['nvertices'] = 81+9
+    self.nverticesO = 81
+    self.faultMesh = {'nvertices': 9,
+                      'spaceDim': 3,
+                      'ncells': 8,
+                      'ncorners': 2}
+
+    run_pylith()
+    self.outputRoot = "slipweakening_compression"
+    if has_vtk():
+      self.reader = VTKDataReader()
+      self.soln = AnalyticalSoln()
+    else:
+      self.reader = None
+    return
+
+
+  def test_fault_info(self):
+    """
+    Check fault information.
+    """
+    if self.reader is None:
+      return
+
+    filename = "%s-fault_info.vtk" % self.outputRoot
+    fields = ["strike_dir", "normal_dir", "initial_traction"]
+    check_vertex_fields(self, filename, self.faultMesh, fields)
+
+    return
+
+
+  def test_fault_data(self):
+    """
+    Check fault information.
+    """
+    if self.reader is None:
+      return
+
+    filename = "%s-fault_t0000000.vtk" % self.outputRoot
+    fields = ["slip", "traction"]
+    check_vertex_fields(self, filename, self.faultMesh, fields)
+
+    return
+
+
+  def calcDisplacements(self, vertices):
+    """
+    Calculate displacement field given coordinates of vertices.
+    """
+    return self.soln.displacement(vertices, self.nverticesO)
+
+
+  def calcStateVar(self, name, vertices, cells):
+    """
+    Calculate state variable.
+    """
+    ncells = self.mesh['ncells']
+    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
+    if name == "total_strain":
+      stateVar = self.soln.strain(pts)
+    elif name == "stress":
+      stateVar = self.soln.stress(pts)
+    else:
+      raise ValueError("Unknown state variable '%s'." % name)
+
+    return stateVar
+
+
+  def calcFaultField(self, name, vertices):
+    """
+    Calculate fault info.
+    """
+
+    strikeDir = (0.0, -1.0)
+    normalDir = (-1.0, 0.0)
+    initialTraction = (0.0, -1.0e+6)
+
+    nvertices = self.faultMesh['nvertices']
+
+    if name == "strike_dir":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = strikeDir[0]
+      field[:,1] = strikeDir[1]
+
+    elif name == "normal_dir":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = normalDir[0]
+      field[:,1] = normalDir[1]
+
+    elif name == "initial_traction":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = initialTraction[0]
+      field[:,1] = initialTraction[1]
+
+    elif name == "slip":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+
+    elif name == "traction":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = 0.0
+      field[:,1] = -2.2e+6
+      
+    else:
+      raise ValueError("Unknown fault field '%s'." % name)
+
+    return field
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningOpening.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningOpening.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningOpening.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,164 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/TestSlipWeakeningOpening.py
+##
+## @brief Test suite for testing pylith with 2-D opening with slipweakening.
+
+import numpy
+from TestQuad4 import TestQuad4
+from slipweakening_opening_soln import AnalyticalSoln
+from pylith.utils.VTKDataReader import has_vtk
+from pylith.utils.VTKDataReader import VTKDataReader
+from pylith.tests.Fault import check_vertex_fields
+
+# Local version of PyLithApp
+from pylith.apps.PyLithApp import PyLithApp
+class SWOpeningApp(PyLithApp):
+  def __init__(self):
+    PyLithApp.__init__(self, name="slipweakening_opening")
+    return
+
+
+# Helper function to run PyLith
+def run_pylith():
+  """
+  Run pylith.
+  """
+  if not "done" in dir(run_pylith):
+    # Run PyLith
+    app = SWOpeningApp()
+    app.run()
+    run_pylith.done = True
+  return
+
+
+class TestSlipWeakeningOpening(TestQuad4):
+  """
+  Test suite for testing pylith with 2-D opening with slipweakening.
+  """
+
+  def setUp(self):
+    """
+    Setup for test.
+    """
+    TestQuad4.setUp(self)
+    self.mesh['nvertices'] = 81+9
+    self.nverticesO = 81
+    self.faultMesh = {'nvertices': 9,
+                      'spaceDim': 3,
+                      'ncells': 8,
+                      'ncorners': 2}
+
+    run_pylith()
+    self.outputRoot = "slipweakening_opening"
+    if has_vtk():
+      self.reader = VTKDataReader()
+      self.soln = AnalyticalSoln()
+    else:
+      self.reader = None
+    return
+
+
+  def test_fault_info(self):
+    """
+    Check fault information.
+    """
+    if self.reader is None:
+      return
+
+    filename = "%s-fault_info.vtk" % self.outputRoot
+    fields = ["strike_dir", "normal_dir", "initial_traction"]
+    check_vertex_fields(self, filename, self.faultMesh, fields)
+
+    return
+
+
+  def test_fault_data(self):
+    """
+    Check fault information.
+    """
+    if self.reader is None:
+      return
+
+    filename = "%s-fault_t0000000.vtk" % self.outputRoot
+    fields = ["slip", "traction"]
+    check_vertex_fields(self, filename, self.faultMesh, fields)
+
+    return
+
+
+  def calcDisplacements(self, vertices):
+    """
+    Calculate displacement field given coordinates of vertices.
+    """
+    return self.soln.displacement(vertices, self.nverticesO)
+
+
+  def calcStateVar(self, name, vertices, cells):
+    """
+    Calculate state variable.
+    """
+    ncells = self.mesh['ncells']
+    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
+    if name == "total_strain":
+      stateVar = self.soln.strain(pts)
+    elif name == "stress":
+      stateVar = self.soln.stress(pts)
+    else:
+      raise ValueError("Unknown state variable '%s'." % name)
+
+    return stateVar
+
+
+  def calcFaultField(self, name, vertices):
+    """
+    Calculate fault info.
+    """
+
+    strikeDir = (0.0, -1.0)
+    normalDir = (-1.0, 0.0)
+    initialTraction = (0.0, -1.0e+6)
+    slip = (0.0, 1.0)
+
+    nvertices = self.faultMesh['nvertices']
+
+    if name == "strike_dir":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = strikeDir[0]
+      field[:,1] = strikeDir[1]
+
+    elif name == "normal_dir":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = normalDir[0]
+      field[:,1] = normalDir[1]
+
+    elif name == "initial_traction":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = initialTraction[0]
+      field[:,1] = initialTraction[1]
+
+    elif name == "slip":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = slip[0]
+      field[:,1] = slip[1]
+
+    elif name == "traction":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      
+    else:
+      raise ValueError("Unknown fault field '%s'." % name)
+
+    return field
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningShearSliding.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningShearSliding.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningShearSliding.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,174 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/TestSlipWeakeningShearSliding.py
+##
+## @brief Test suite for testing pylith with 2-D shear sliding with slipweakening.
+
+import numpy
+from TestQuad4 import TestQuad4
+from slipweakening_shear_sliding_soln import AnalyticalSoln
+from pylith.utils.VTKDataReader import has_vtk
+from pylith.utils.VTKDataReader import VTKDataReader
+from pylith.tests.Fault import check_vertex_fields
+
+# Local version of PyLithApp
+from pylith.apps.PyLithApp import PyLithApp
+class SWShearSlidingApp(PyLithApp):
+  def __init__(self):
+    PyLithApp.__init__(self, name="slipweakening_shear_sliding")
+    return
+
+
+# Helper function to run PyLith
+def run_pylith():
+  """
+  Run pylith.
+  """
+  if not "done" in dir(run_pylith):
+    # Run PyLith
+    app = SWShearSlidingApp()
+    app.run()
+    run_pylith.done = True
+  return
+
+
+class TestSlipWeakeningShearSliding(TestQuad4):
+  """
+  Test suite for testing pylith with 2-D shear sliding with slipweakening.
+  """
+
+  def setUp(self):
+    """
+    Setup for test.
+    """
+    TestQuad4.setUp(self)
+    self.mesh['nvertices'] = 81+9
+    self.nverticesO = 81
+    self.faultMesh = {'nvertices': 9,
+                      'spaceDim': 3,
+                      'ncells': 8,
+                      'ncorners': 2}
+
+    run_pylith()
+    self.outputRoot = "slipweakening_shear_sliding"
+    if has_vtk():
+      self.reader = VTKDataReader()
+      self.soln = AnalyticalSoln()
+    else:
+      self.reader = None
+    return
+
+
+  def test_fault_info(self):
+    """
+    Check fault information.
+    """
+    if self.reader is None:
+      return
+
+    filename = "%s-fault_info.vtk" % self.outputRoot
+    fields = ["strike_dir", "normal_dir", "initial_traction"]
+    check_vertex_fields(self, filename, self.faultMesh, fields)
+
+    return
+
+
+  def test_fault_data(self):
+    """
+    Check fault information.
+    """
+    if self.reader is None:
+      return
+
+    filename = "%s-fault_t0000000.vtk" % self.outputRoot
+    fields = ["slip", "traction"]
+    check_vertex_fields(self, filename, self.faultMesh, fields)
+
+    return
+
+
+  def calcDisplacements(self, vertices):
+    """
+    Calculate displacement field given coordinates of vertices.
+    """
+    return self.soln.displacement(vertices, self.nverticesO)
+
+
+  def calcStateVar(self, name, vertices, cells):
+    """
+    Calculate state variable.
+    """
+    ncells = self.mesh['ncells']
+    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
+    if name == "total_strain":
+      stateVar = self.soln.strain(pts)
+    elif name == "stress":
+      stateVar = self.soln.stress(pts)
+    else:
+      raise ValueError("Unknown state variable '%s'." % name)
+
+    return stateVar
+
+
+  def calcFaultField(self, name, vertices):
+    """
+    Calculate fault info.
+    """
+
+    strikeDir = (0.0, -1.0)
+    normalDir = (-1.0, 0.0)
+    initialTraction = (0.0, -1.0e+6)
+
+    uy_l = 1.0
+    len = 8000.0
+    sigma_f = 0.6e+6
+    p_density = 2500.0
+    p_vs = 3000.0
+    p_mu = p_density*p_vs**2
+    D = uy_l - len * sigma_f/p_mu
+    slip = (D, 0.0)
+
+    nvertices = self.faultMesh['nvertices']
+
+    if name == "strike_dir":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = strikeDir[0]
+      field[:,1] = strikeDir[1]
+
+    elif name == "normal_dir":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = normalDir[0]
+      field[:,1] = normalDir[1]
+
+    elif name == "initial_traction":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = initialTraction[0]
+      field[:,1] = initialTraction[1]
+
+    elif name == "slip":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = slip[0]
+      field[:,1] = slip[1]
+
+    elif name == "traction":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = 0.6e+6
+      field[:,1] = -1.0e+6
+      
+    else:
+      raise ValueError("Unknown fault field '%s'." % name)
+
+    return field
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningShearStick.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningShearStick.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/TestSlipWeakeningShearStick.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/TestSlipWeakeningShearStick.py
+##
+## @brief Test suite for testing pylith with 2-D shear stick with slipweakening.
+
+import numpy
+from TestQuad4 import TestQuad4
+from slipweakening_shear_stick_soln import AnalyticalSoln
+from pylith.utils.VTKDataReader import has_vtk
+from pylith.utils.VTKDataReader import VTKDataReader
+from pylith.tests.Fault import check_vertex_fields
+
+# Local version of PyLithApp
+from pylith.apps.PyLithApp import PyLithApp
+class SWShearStickApp(PyLithApp):
+  def __init__(self):
+    PyLithApp.__init__(self, name="slipweakening_shear_stick")
+    return
+
+
+# Helper function to run PyLith
+def run_pylith():
+  """
+  Run pylith.
+  """
+  if not "done" in dir(run_pylith):
+    # Run PyLith
+    app = SWShearStickApp()
+    app.run()
+    run_pylith.done = True
+  return
+
+
+class TestSlipWeakeningShearStick(TestQuad4):
+  """
+  Test suite for testing pylith with 2-D shear stick with slipweakening.
+  """
+
+  def setUp(self):
+    """
+    Setup for test.
+    """
+    TestQuad4.setUp(self)
+    self.mesh['nvertices'] = 81+9
+    self.nverticesO = 81
+    self.faultMesh = {'nvertices': 9,
+                      'spaceDim': 3,
+                      'ncells': 8,
+                      'ncorners': 2}
+
+    run_pylith()
+    self.outputRoot = "slipweakening_shear_stick"
+    if has_vtk():
+      self.reader = VTKDataReader()
+      self.soln = AnalyticalSoln()
+    else:
+      self.reader = None
+    return
+
+
+  def test_fault_info(self):
+    """
+    Check fault information.
+    """
+    if self.reader is None:
+      return
+
+    filename = "%s-fault_info.vtk" % self.outputRoot
+    fields = ["strike_dir", "normal_dir", "initial_traction"]
+    check_vertex_fields(self, filename, self.faultMesh, fields)
+
+    return
+
+
+  def test_fault_data(self):
+    """
+    Check fault information.
+    """
+    if self.reader is None:
+      return
+
+    filename = "%s-fault_t0000000.vtk" % self.outputRoot
+    fields = ["slip", "traction"]
+    check_vertex_fields(self, filename, self.faultMesh, fields)
+
+    return
+
+
+  def calcDisplacements(self, vertices):
+    """
+    Calculate displacement field given coordinates of vertices.
+    """
+    return self.soln.displacement(vertices, self.nverticesO)
+
+
+  def calcStateVar(self, name, vertices, cells):
+    """
+    Calculate state variable.
+    """
+    ncells = self.mesh['ncells']
+    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
+    if name == "total_strain":
+      stateVar = self.soln.strain(pts)
+    elif name == "stress":
+      stateVar = self.soln.stress(pts)
+    else:
+      raise ValueError("Unknown state variable '%s'." % name)
+
+    return stateVar
+
+
+  def calcFaultField(self, name, vertices):
+    """
+    Calculate fault info.
+    """
+
+    strikeDir = (0.0, -1.0)
+    normalDir = (-1.0, 0.0)
+    initialTraction = (0.0, -1.0e+7)
+
+    nvertices = self.faultMesh['nvertices']
+
+    if name == "strike_dir":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = strikeDir[0]
+      field[:,1] = strikeDir[1]
+
+    elif name == "normal_dir":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = normalDir[0]
+      field[:,1] = normalDir[1]
+
+    elif name == "initial_traction":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = initialTraction[0]
+      field[:,1] = initialTraction[1]
+
+    elif name == "slip":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+
+    elif name == "traction":
+      field = numpy.zeros( (nvertices, 3), dtype=numpy.float64)
+      field[:,0] = 1.0e+6
+      field[:,1] = -1.0e+7
+      
+    else:
+      raise ValueError("Unknown fault field '%s'." % name)
+
+    return field
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_compression.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_compression.cfg	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_compression.cfg	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,183 @@
+# -*- Python -*-
+[slipweakening_compression]
+
+[slipweakening_compression.launcher] # WARNING: THIS IS NOT PORTABLE
+command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+[slipweakening_compression.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solvernonlinear = 1
+#meshioascii = 1
+#homogeneous = 1
+#elasticityimplicit = 1
+#fiatlagrange = 1
+#quadrature1d = 1
+#faultcohesivedyn = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+[slipweakening_compression.mesh_generator]
+#debug = 1
+reader = pylith.meshio.MeshIOCubit
+
+[slipweakening_compression.mesh_generator.reader]
+filename = mesh.exo
+coordsys.space_dim = 2
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+[slipweakening_compression.timedependent]
+dimension = 2
+normalizer.length_scale = 1.0*m
+formulation = pylith.problems.Implicit
+formulation.solver = pylith.problems.SolverNonlinear
+
+# Set bc to an array with 3 boundary conditions: 'x_neg', 'y_neg' and 'x_pos'.
+bc = [x_neg,y_neg,x_pos]
+bc.x_pos = pylith.bc.Neumann
+
+# Set interfaces to an array with 1 fault: 'fault'.
+interfaces = [fault]
+
+
+[slipweakening_compression.timedependent.formulation.time_step]
+total_time = 0.0*s
+dt = 1.0*s
+
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+# Specify the material information for the problem.
+# The material type is isotropic elastic formulated for plane strain.
+[slipweakening_compression.timedependent.materials]
+material = pylith.materials.ElasticPlaneStrain
+
+[slipweakening_compression.timedependent.materials.material]
+
+# We give a label of 'elastic material' to this material.
+label = elastic material
+
+# The cells associated with this material are given a material ID of 1
+# in the mesh file.
+id = 1
+
+# The properties for this material are given in the spatial database file
+# 'matprops.spatialdb'.
+db_properties.iohandler.filename = matprops.spatialdb
+
+# Set cell type to quadrilateral (2-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 2
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+# Provide information on the boundary conditions.
+
+# Boundary conditions to be applied to the negative x-side of the mesh.
+[slipweakening_compression.timedependent.bc.x_neg]
+bc_dof = [0]
+label = 21
+
+# Boundary conditions to be applied to the negative y-side of the mesh.
+[slipweakening_compression.timedependent.bc.y_neg]
+bc_dof = [1]
+label = 24
+
+# Boundary conditions to be applied to the positive x-side of the mesh.
+[slipweakening_compression.timedependent.bc.x_pos]
+label = 20
+
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Neumann BC +x edge
+db_initial.values = [traction-shear,traction-normal]
+db_initial.data = [0.0*MPa,-1.2*MPa]
+
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+# ----------------------------------------------------------------------
+# faults
+# ----------------------------------------------------------------------
+# Provide information on the fault (interface).
+[slipweakening_compression.timedependent.interfaces]
+
+fault = pylith.faults.FaultCohesiveDyn
+
+# Define fault properties.
+[slipweakening_compression.timedependent.interfaces.fault]
+
+# The nodes associated with this fault have the name 'fault' in the mesh file.
+label = 10
+
+# The quadrature for a 2D fault is 1D with a linear shape.
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+db_initial_tractions = spatialdata.spatialdb.UniformDB
+db_initial_tractions.label = Initial fault tractions
+db_initial_tractions.values = [traction-shear,traction-normal]
+db_initial_tractions.data = [0.0*Pa, -1.0*MPa]
+
+friction = pylith.friction.SlipWeakening
+
+friction.db_properties = spatialdata.spatialdb.UniformDB
+friction.db_properties.label = Slip weakening
+friction.db_properties.values = [static-coefficient,dynamic-coefficient,slip-weakening-parameter,cohesion]
+friction.db_properties.data = [0.61,0.6,0.2*m,0.0*Pa]
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[slipweakening_compression.petsc]
+pc_type = asm
+
+# Change the preconditioner settings.
+sub_pc_factor_shift_type = nonzero
+
+ksp_rtol = 1.0e-8
+ksp_max_it = 100
+ksp_gmres_restart = 50
+snes_max_it = 200
+
+#ksp_monitor = true
+#ksp_view = true
+#ksp_converged_reason = true
+
+#snes_monitor = true
+#snes_view = true
+#snes_converged_reason = true
+
+#log_summary = true
+#start_in_debugger = true
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+# Give basename for VTK domain output of solution over domain.
+[slipweakening_compression.problem.formulation.output.output.writer]
+filename = slipweakening_compression.vtk
+
+# Give basename for VTK fault output.
+[slipweakening_compression.timedependent.interfaces.fault.output]
+writer.filename = slipweakening_compression-fault.vtk
+vertex_info_fields = [strike_dir,normal_dir,initial_traction]
+
+# Give basename for VTK output of state variables.
+[slipweakening_compression.timedependent.materials.material.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = slipweakening_compression-elastic.vtk
+
+# Give basename for VTK friction output.
+[slipweakening_compression.timedependent.interfaces.fault.friction.output]
+writer.filename = slipweakening_compression-statevars.vtk
+vertex_info_fields = [static_coefficient,dynamic_coefficient,slip_weakening_parameter,cohesion]
+

Added: short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_compression_soln.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_compression_soln.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_compression_soln.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/slipweakening_compression_soln.py
+##
+## @brief Analytical solution to compression problem with slipweakening.
+
+import numpy
+
+# Physical properties
+p_density = 2500.0
+p_vs = 3000.0
+p_vp = 5291.502622129181
+
+p_mu = p_density*p_vs**2
+p_lambda = p_density*p_vp**2 - 2*p_mu
+
+# Uniform stress field (plane strain)
+sxx = -1.2e+6
+sxy = 0.0
+syy = 0.0
+szz = p_lambda/(2*p_lambda+2*p_mu)*(sxx+syy)
+
+# Uniform strain field
+exx = 1.0/(2*p_mu) * (sxx - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+eyy = 1.0/(2*p_mu) * (syy - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+ezz = 1.0/(2*p_mu) * (szz - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+
+exy = 1.0/(2*p_mu) * (sxy)
+
+#print exx,eyy,exy,ezz,szz
+#print -exx*p_lambda/(p_lambda+2*p_mu)
+
+# ----------------------------------------------------------------------
+class AnalyticalSoln(object):
+  """
+  Analytical solution to slipweakening_compression problem.
+  """
+
+  def __init__(self):
+    return
+
+
+  def displacement(self, locs, nlocsO):
+    """
+    Compute displacement field at locations.
+    """
+    (nlocs, dim) = locs.shape
+
+    disp = numpy.zeros( (nlocs, 3), dtype=numpy.float64)
+    disp[:,0] = exx*(locs[:,0]+max(abs(locs[:,0])))
+    disp[:,1] = eyy*(locs[:,1]+max(abs(locs[:,1])))
+    return disp
+
+
+  def strain(self, locs):
+    """
+    Compute strain field at locations.
+    """
+    (npts, dim) = locs.shape
+    strain = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    strain[:,0] = exx
+    strain[:,1] = eyy
+    strain[:,2] = exy
+    return strain
+  
+
+  def stress(self, locs):
+    """
+    Compute stress field at locations.
+    """
+    (npts, dim) = locs.shape
+    stress = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    stress[:,0] = sxx
+    stress[:,1] = syy
+    stress[:,2] = sxy
+    return stress
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_opening.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_opening.cfg	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_opening.cfg	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,203 @@
+# -*- Python -*-
+[slipweakening_opening]
+
+[slipweakening_opening.launcher] # WARNING: THIS IS NOT PORTABLE
+command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+# The settings below turn on journal info for the specified components.
+# If you want less output to stdout, you can turn these off.
+[slipweakening_opening.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solvernonlinear = 1
+#meshioascii = 1
+#homogeneous = 1
+#elasticityimplicit = 1
+#fiatlagrange = 1
+#quadrature1d = 1
+#faultcohesivedyn = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+# The settings below control the mesh generation (importing mesh info).
+# Turn on debugging output for mesh generation.
+[slipweakening_opening.mesh_generator]
+#debug = 1
+reader = pylith.meshio.MeshIOCubit
+
+# This component specification means we are using PyLith ASCII format,
+# and we then specify the filename and number of space dimensions for
+# the mesh.
+[slipweakening_opening.mesh_generator.reader]
+filename = mesh.exo
+coordsys.space_dim = 2
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+# Specify the problem settings.
+# This is a time-dependent problem, so we select this as our problem type.
+# We select a total time of 0 sec, and a time step size of 1 sec, so we
+# are performing a single time step.
+# The spatial dimension for this problem is 2.
+# For an implicit formulation (using implicit.cfg), we will perform 1
+# implicit time step from t = -1.0 to t = 0.0 (elastic solution step).
+[slipweakening_opening.timedependent]
+dimension = 2
+normalizer.length_scale = 1.0*m
+formulation = pylith.problems.Implicit
+formulation.solver = pylith.problems.SolverNonlinear
+
+# Set bc to an array with 2 boundary conditions: 'x_neg', 'x_pos'
+bc = [x_neg,x_pos]
+bc.x_pos=pylith.bc.DirichletBoundary
+
+# Set interfaces to an array with 1 fault: 'fault'.
+interfaces = [fault]
+
+
+[slipweakening_opening.timedependent.formulation.time_step]
+total_time = 0.0*s
+dt = 1.0*s
+
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+# Specify the material information for the problem.
+# The material type is isotropic elastic formulated for plane strain.
+[slipweakening_opening.timedependent.materials]
+material = pylith.materials.ElasticPlaneStrain
+
+[slipweakening_opening.timedependent.materials.material]
+
+# We give a label of 'elastic material' to this material.
+label = elastic material
+
+# The cells associated with this material are given a material ID of 0
+# in the mesh file.
+id = 1
+
+# The properties for this material are given in the spatial database file
+# 'matelastic2D.spatialdb'.
+db_properties.iohandler.filename = matprops.spatialdb
+
+# Set cell type to quadrilateral (2-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 2
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+# Provide information on the boundary conditions.
+
+# Boundary conditions to be applied to the negative x-side of the mesh.
+[slipweakening_opening.timedependent.bc.x_neg]
+
+# We are fixing the 0 (x) and 1 (y) degree of freedom.
+bc_dof = [0,1]
+
+# The nodes associated with this boundary condition have the name
+# 'x_neg' in the mesh file.
+label = 21
+
+# Boundary conditions to be applied to the positive x-side of the mesh.
+[slipweakening_opening.timedependent.bc.x_pos]
+
+# We are fixing the 1 (y) and prescribing 0 (x) degree of freedom.
+bc_dof = [0,1]
+
+# The nodes associated with this boundary condition have the name
+# 'x_pos' in the mesh file.
+label = 20
+
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Dirichlet BC +x edge
+db_initial.values = [displacement-x,displacement-y]
+db_initial.data = [1.0*m,0.0*m]
+
+# ----------------------------------------------------------------------
+# faults
+# ----------------------------------------------------------------------
+# Provide information on the fault (interface).
+[slipweakening_opening.timedependent.interfaces]
+
+fault = pylith.faults.FaultCohesiveDyn
+
+# Define fault properties.
+[slipweakening_opening.timedependent.interfaces.fault]
+
+# The nodes associated with this fault have the name 'fault' in the mesh file.
+label = 10
+
+# NOTE: It is possible to assign an ID number to a fault (e.g.,
+# 'id = 10').  Care must be taken when doing this, however, because the
+# assigned ID will become the material ID for the cohesive element.
+# This ID must not conflict with any of the material ID numbers for
+# volume elements.  The default ID for a fault is 100.  If you have a
+# fault in your mesh you must:
+# 1.  If you create your own fault ID, make sure it does not conflict
+#     with any of you material ID's.
+# 2.  If you use the default fault ID, make sure that none of your
+#     material ID's are equal to 100.
+
+# The quadrature for a 2D fault is 1D with a linear shape.
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+db_initial_tractions = spatialdata.spatialdb.UniformDB
+db_initial_tractions.label = "Initial fault tractions"
+db_initial_tractions.values = [traction-shear,traction-normal]
+db_initial_tractions.data = [0.0*Pa, -1.0*MPa]
+
+friction.db_properties = spatialdata.spatialdb.UniformDB
+friction.db_properties.label = Static friction
+friction.db_properties.values = [friction-coefficient,cohesion]
+friction.db_properties.data = [0.6,0.0*Pa]
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[slipweakening_opening.petsc]
+pc_type = asm
+
+# Change the preconditioner settings.
+sub_pc_factor_shift_type = nonzero
+
+ksp_rtol = 1.0e-8
+ksp_max_it = 100
+ksp_gmres_restart = 50
+snes_max_it = 200
+
+#ksp_monitor = true
+#ksp_view = true
+#ksp_converged_reason = true
+
+#snes_monitor = true
+#snes_view = true
+#snes_converged_reason = true
+
+#log_summary = true
+#start_in_debugger = true
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+# Give basename for VTK domain output of solution over domain.
+[slipweakening_opening.problem.formulation.output.output.writer]
+filename = slipweakening_opening.vtk
+
+# Give basename for VTK fault output.
+[slipweakening_opening.timedependent.interfaces.fault.output]
+writer.filename = slipweakening_opening-fault.vtk
+vertex_info_fields = [strike_dir,normal_dir,initial_traction]
+
+# Give basename for VTK output of state variables.
+[slipweakening_opening.timedependent.materials.material.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = slipweakening_opening-elastic.vtk

Added: short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_opening_soln.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_opening_soln.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_opening_soln.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/slipweakening_compression_soln.py
+##
+## @brief Analytical solution to compression problem with slipweakening.
+
+import numpy
+
+# Physical properties
+p_density = 2500.0
+p_vs = 3000.0
+p_vp = 5291.502622129181
+
+p_mu = p_density*p_vs**2
+p_lambda = p_density*p_vp**2 - 2*p_mu
+
+# Uniform stress field (plane strain)
+sxx = 0.0
+sxy = 0.0
+syy = 0.0
+szz = p_lambda/(2*p_lambda+2*p_mu)*(sxx+syy)
+
+# Uniform strain field
+exx = 1.0/(2*p_mu) * (sxx - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+eyy = 1.0/(2*p_mu) * (syy - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+ezz = 1.0/(2*p_mu) * (szz - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+
+exy = 1.0/(2*p_mu) * (sxy)
+
+#print exx,eyy,exy,ezz,szz
+#print -exx*p_lambda/(p_lambda+2*p_mu)
+
+# ----------------------------------------------------------------------
+class AnalyticalSoln(object):
+  """
+  Analytical solution to slipweakening_compression problem.
+  """
+
+  def __init__(self):
+    return
+
+
+  def displacement(self, locs, nlocsO):
+    """
+    Compute displacement field at locations.
+    """
+    (nlocs, dim) = locs.shape
+
+    disp = numpy.zeros( (nlocs, 3), dtype=numpy.float64)
+    disp[0:nlocs/2,0] = 1.0
+    return disp
+
+
+  def strain(self, locs):
+    """
+    Compute strain field at locations.
+    """
+    (npts, dim) = locs.shape
+    strain = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    strain[:,0] = exx
+    strain[:,1] = eyy
+    strain[:,2] = exy
+    return strain
+  
+
+  def stress(self, locs):
+    """
+    Compute stress field at locations.
+    """
+    (npts, dim) = locs.shape
+    stress = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    stress[:,0] = sxx
+    stress[:,1] = syy
+    stress[:,2] = sxy
+    return stress
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_sliding.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_sliding.cfg	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_sliding.cfg	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,239 @@
+# -*- Python -*-
+[slipweakening_shear_sliding]
+
+[slipweakening_shear_sliding.launcher] # WARNING: THIS IS NOT PORTABLE
+command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+# The settings below turn on journal info for the specified components.
+# If you want less output to stdout, you can turn these off.
+[slipweakening_shear_sliding.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solvernonlinear = 1
+#meshioascii = 1
+#homogeneous = 1
+#elasticityimplicit = 1
+#fiatlagrange = 1
+#quadrature1d = 1
+#faultcohesivedyn = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+# The settings below control the mesh generation (importing mesh info).
+# Turn on debugging output for mesh generation.
+[slipweakening_shear_sliding.mesh_generator]
+#debug = 1
+reader = pylith.meshio.MeshIOCubit
+
+# This component specification means we are using PyLith ASCII format,
+# and we then specify the filename and number of space dimensions for
+# the mesh.
+[slipweakening_shear_sliding.mesh_generator.reader]
+filename = mesh.exo
+coordsys.space_dim = 2
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+# Specify the problem settings.
+# This is a time-dependent problem, so we select this as our problem type.
+# We select a total time of 0 sec, and a time step size of 1 sec, so we
+# are performing a single time step.
+# The spatial dimension for this problem is 2.
+# For an implicit formulation (using implicit.cfg), we will perform 1
+# implicit time step from t = -1.0 to t = 0.0 (elastic solution step).
+[slipweakening_shear_sliding.timedependent]
+dimension = 2
+normalizer.length_scale = 1.0*m
+formulation = pylith.problems.Implicit
+formulation.solver = pylith.problems.SolverNonlinear
+
+# Set bc to an array with 2 boundary conditions: 'x_neg', 'x_pos'
+bc = [x_neg,x_pos,y_pos_fault,y_neg_fault]
+bc.x_pos = pylith.bc.DirichletBoundary
+bc.y_pos_fault = pylith.bc.Neumann
+bc.y_neg_fault = pylith.bc.Neumann
+
+# Set interfaces to an array with 1 fault: 'fault'.
+interfaces = [fault]
+
+
+[slipweakening_shear_sliding.timedependent.formulation.time_step]
+total_time = 0.0*s
+dt = 1.0*s
+
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+# Specify the material information for the problem.
+# The material type is isotropic elastic formulated for plane strain.
+[slipweakening_shear_sliding.timedependent.materials]
+material = pylith.materials.ElasticPlaneStrain
+
+[slipweakening_shear_sliding.timedependent.materials.material]
+
+# We give a label of 'elastic material' to this material.
+label = elastic material
+
+# The cells associated with this material are given a material ID of 0
+# in the mesh file.
+id = 1
+
+# The properties for this material are given in the spatial database file
+# 'matelastic2D.spatialdb'.
+db_properties.iohandler.filename = matprops.spatialdb
+
+# Set cell type to quadrilateral (2-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 2
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+# Provide information on the boundary conditions.
+
+# Boundary conditions to be applied to the negative x-side of the mesh.
+[slipweakening_shear_sliding.timedependent.bc.x_neg]
+
+# We are fixing the 0 (x) and 1 (y) degrees of freedom.
+bc_dof = [0,1]
+
+# The nodes associated with this boundary condition have the name
+# 'x_neg' in the mesh file.
+label = 21
+
+# Boundary conditions to be applied to the positive x-side of the mesh.
+[slipweakening_shear_sliding.timedependent.bc.x_pos]
+
+# We are fixing the 0 (x) and prescribing 1 (y) degree of freedom.
+bc_dof = [0,1]
+
+# The nodes associated with this boundary condition have the name
+# 'x_pos' in the mesh file.
+label = 20
+
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Dirichlet BC +x edge
+db_initial.values = [displacement-x,displacement-y]
+db_initial.data = [0.0*m,1.0*m]
+
+
+
+# Boundary conditions to be applied to the positive y-side of the mesh.
+[slipweakening_shear_sliding.timedependent.bc.y_pos_fault]
+
+# The nodes associated with this boundary condition have the name
+# 'y_pos_fault' in the mesh file.
+label = 22
+
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Neumann BC +y edge
+db_initial.values = [traction-shear,traction-normal]
+db_initial.data = [-0.6*MPa, 0.0*MPa]
+
+# Set cell type to quadrilateral (1-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+# Boundary conditions to be applied to the negative y-side of the mesh.
+[slipweakening_shear_sliding.timedependent.bc.y_neg_fault]
+
+# The nodes associated with this boundary condition have the name
+# 'y_neg_fault' in the mesh file.
+label = 23
+
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Neumann BC -y edge
+db_initial.values = [traction-shear,traction-normal]
+db_initial.data = [-0.6*MPa, 0.0*MPa]
+
+# Set cell type to quadrilateral (1-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+# ----------------------------------------------------------------------
+# faults
+# ----------------------------------------------------------------------
+# Provide information on the fault (interface).
+[slipweakening_shear_sliding.timedependent.interfaces]
+
+fault = pylith.faults.FaultCohesiveDyn
+
+# Define fault properties.
+[slipweakening_shear_sliding.timedependent.interfaces.fault]
+
+# The nodes associated with this fault have the name 'fault' in the mesh file.
+label = 10
+
+# NOTE: It is possible to assign an ID number to a fault (e.g.,
+# 'id = 10').  Care must be taken when doing this, however, because the
+# assigned ID will become the material ID for the cohesive element.
+# This ID must not conflict with any of the material ID numbers for
+# volume elements.  The default ID for a fault is 100.  If you have a
+# fault in your mesh you must:
+# 1.  If you create your own fault ID, make sure it does not conflict
+#     with any of you material ID's.
+# 2.  If you use the default fault ID, make sure that none of your
+#     material ID's are equal to 100.
+
+# The quadrature for a 2D fault is 1D with a linear shape.
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+db_initial_tractions = spatialdata.spatialdb.UniformDB
+db_initial_tractions.label = "Initial fault tractions"
+db_initial_tractions.values = [traction-shear,traction-normal]
+db_initial_tractions.data = [0.0*Pa, -1.0*MPa]
+
+friction.db_properties = spatialdata.spatialdb.UniformDB
+friction.db_properties.label = Static friction
+friction.db_properties.values = [friction-coefficient,cohesion]
+friction.db_properties.data = [0.6,0.0*Pa]
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[slipweakening_shear_sliding.petsc]
+pc_type = asm
+
+# Change the preconditioner settings.
+sub_pc_factor_shift_type = nonzero
+
+ksp_rtol = 1.0e-8
+ksp_max_it = 100
+ksp_gmres_restart = 50
+snes_max_it = 200
+
+#ksp_monitor = true
+#ksp_view = true
+#ksp_converged_reason = true
+
+#snes_monitor = true
+#snes_view = true
+#snes_converged_reason = true
+
+#log_summary = true
+#start_in_debugger = true
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+# Give basename for VTK domain output of solution over domain.
+[slipweakening_shear_sliding.problem.formulation.output.output.writer]
+filename = slipweakening_shear_sliding.vtk
+
+# Give basename for VTK fault output.
+[slipweakening_shear_sliding.timedependent.interfaces.fault.output]
+writer.filename = slipweakening_shear_sliding-fault.vtk
+vertex_info_fields = [strike_dir,normal_dir,initial_traction]
+
+# Give basename for VTK output of state variables.
+[slipweakening_shear_sliding.timedependent.materials.material.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = slipweakening_shear_sliding-elastic.vtk

Added: short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_sliding_soln.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_sliding_soln.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_sliding_soln.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/slipweakening_compression_soln.py
+##
+## @brief Analytical solution to compression problem with slipweakening.
+
+import numpy
+
+# Physical properties
+p_density = 2500.0
+p_vs = 3000.0
+p_vp = 5291.502622129181
+
+p_mu = p_density*p_vs**2
+p_lambda = p_density*p_vp**2 - 2*p_mu
+
+# Uniform stress field (plane strain)
+sxx = 0.0
+sxy = 0.6e+6
+syy = 0.0
+szz = p_lambda/(2*p_lambda+2*p_mu)*(sxx+syy)
+
+# Uniform strain field
+exx = 1.0/(2*p_mu) * (sxx - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+eyy = 1.0/(2*p_mu) * (syy - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+ezz = 1.0/(2*p_mu) * (szz - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+
+exy = 1.0/(2*p_mu) * (sxy)
+
+# Calculate slip
+uy_l = 1.0
+len = 8000.0
+sigma_f = 0.6e+6
+D = uy_l - len * sigma_f/p_mu
+
+#print exx,eyy,exy,ezz,szz
+#print -exx*p_lambda/(p_lambda+2*p_mu)
+
+# ----------------------------------------------------------------------
+class AnalyticalSoln(object):
+  """
+  Analytical solution to slipweakening_compression problem.
+  """
+
+  def __init__(self):
+    return
+
+
+  def displacement(self, locs, nlocsO):
+    """
+    Compute displacement field at locations.
+    """
+    (nlocs, dim) = locs.shape
+
+    disp = numpy.zeros( (nlocs, 3), dtype=numpy.float64)
+    disp[0:nlocs/2,1] = 2 * exy * (locs[0:nlocs/2,0] + len/2) + D
+    disp[nlocs/2:nlocs,1] = 2 * exy * (locs[nlocs/2:nlocs,0] + len/2)
+    return disp
+
+
+  def strain(self, locs):
+    """
+    Compute strain field at locations.
+    """
+    (npts, dim) = locs.shape
+    strain = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    strain[:,0] = exx
+    strain[:,1] = eyy
+    strain[:,2] = exy
+    return strain
+  
+
+  def stress(self, locs):
+    """
+    Compute stress field at locations.
+    """
+    (npts, dim) = locs.shape
+    stress = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    stress[:,0] = sxx
+    stress[:,1] = syy
+    stress[:,2] = sxy
+    return stress
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_stick.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_stick.cfg	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_stick.cfg	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,253 @@
+# -*- Python -*-
+[slipweakening_shear_stick]
+
+[slipweakening_shear_stick.launcher] # WARNING: THIS IS NOT PORTABLE
+command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+# The settings below turn on journal info for the specified components.
+# If you want less output to stdout, you can turn these off.
+[slipweakening_shear_stick.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solvernonlinear = 1
+#meshioascii = 1
+#homogeneous = 1
+#elasticityimplicit = 1
+#fiatlagrange = 1
+#quadrature1d = 1
+#faultcohesivedyn = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+# The settings below control the mesh generation (importing mesh info).
+# Turn on debugging output for mesh generation.
+[slipweakening_shear_stick.mesh_generator]
+#debug = 1
+reader = pylith.meshio.MeshIOCubit
+
+# This component specification means we are using PyLith ASCII format,
+# and we then specify the filename and number of space dimensions for
+# the mesh.
+[slipweakening_shear_stick.mesh_generator.reader]
+filename = mesh.exo
+coordsys.space_dim = 2
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+# Specify the problem settings.
+# This is a time-dependent problem, so we select this as our problem type.
+# We select a total time of 0 sec, and a time step size of 1 sec, so we
+# are performing a single time step.
+# The spatial dimension for this problem is 2.
+# For an implicit formulation (using implicit.cfg), we will perform 1
+# implicit time step from t = -1.0 to t = 0.0 (elastic solution step).
+[slipweakening_shear_stick.timedependent]
+dimension = 2
+normalizer.length_scale = 1.0*m
+formulation = pylith.problems.Implicit
+formulation.solver = pylith.problems.SolverNonlinear
+
+# Set bc to an array with 3 boundary conditions: 'x_neg', 'x_pos_disp', 'x_pos_tract'
+bc = [x_neg,x_pos_disp,x_pos_tract,y_pos_fault,y_neg_fault]
+bc.x_pos_tract = pylith.bc.Neumann
+bc.y_pos_fault = pylith.bc.Neumann
+bc.y_neg_fault = pylith.bc.Neumann
+
+# Set interfaces to an array with 1 fault: 'fault'.
+interfaces = [fault]
+
+[slipweakening_shear_stick.timedependent.formulation.time_step]
+total_time = 0.0*s
+dt = 1.0*s
+
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+# Specify the material information for the problem.
+# The material type is isotropic elastic formulated for plane strain.
+[slipweakening_shear_stick.timedependent.materials]
+material = pylith.materials.ElasticPlaneStrain
+
+[slipweakening_shear_stick.timedependent.materials.material]
+
+# We give a label of 'elastic material' to this material.
+label = elastic material
+
+# The cells associated with this material are given a material ID of 0
+# in the mesh file.
+id = 1
+
+# The properties for this material are given in the spatial database file
+# 'matelastic2D.spatialdb'.
+db_properties.iohandler.filename = matprops.spatialdb
+
+# Set cell type to quadrilateral (2-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 2
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+# Provide information on the boundary conditions.
+
+# Boundary conditions to be applied to the negative x-side of the mesh.
+[slipweakening_shear_stick.timedependent.bc.x_neg]
+
+# We are fixing the 0 (x) and 1 (y) degrees of freedom.
+bc_dof = [0,1]
+
+# The nodes associated with this boundary condition have the name
+# 'x_neg' in the mesh file.
+label = 21
+
+# Boundary conditions to be applied to the positive x-side of the mesh.
+[slipweakening_shear_stick.timedependent.bc.x_pos_disp]
+
+# We are fixing the 0 (x) degree of freedom.
+bc_dof = [0]
+
+# The nodes associated with this boundary condition have the name
+# 'x_pos' in the mesh file.
+label = 20
+
+# Boundary conditions to be applied to the positive x-side of the mesh.
+[slipweakening_shear_stick.timedependent.bc.x_pos_tract]
+
+# The nodes associated with this boundary condition have the name
+# 'x_pos' in the mesh file.
+label = 20
+
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Neumann BC +x edge
+db_initial.values = [traction-shear,traction-normal]
+db_initial.data = [1.0*MPa,0.0*MPa]
+
+# Set cell type to quadrilateral (1-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+
+
+
+# Boundary conditions to be applied to the positive y-side of the mesh.
+[slipweakening_shear_stick.timedependent.bc.y_pos_fault]
+
+# The nodes associated with this boundary condition have the name
+# 'y_pos_fault' in the mesh file.
+label = 22
+
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Neumann BC +y edge
+db_initial.values = [traction-shear,traction-normal]
+db_initial.data = [-1.0*MPa, 0.0*MPa]
+
+# Set cell type to quadrilateral (1-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+# Boundary conditions to be applied to the negative y-side of the mesh.
+[slipweakening_shear_stick.timedependent.bc.y_neg_fault]
+
+# The nodes associated with this boundary condition have the name
+# 'y_neg_fault' in the mesh file.
+label = 23
+
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Neumann BC -y edge
+db_initial.values = [traction-shear,traction-normal]
+db_initial.data = [-1.0*MPa, 0.0*MPa]
+
+# Set cell type to quadrilateral (1-d Lagrange).
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+
+
+# ----------------------------------------------------------------------
+# faults
+# ----------------------------------------------------------------------
+# Provide information on the fault (interface).
+[slipweakening_shear_stick.timedependent.interfaces]
+
+fault = pylith.faults.FaultCohesiveDyn
+
+# Define fault properties.
+[slipweakening_shear_stick.timedependent.interfaces.fault]
+
+# The nodes associated with this fault have the name 'fault' in the mesh file.
+label = 10
+
+# NOTE: It is possible to assign an ID number to a fault (e.g.,
+# 'id = 10').  Care must be taken when doing this, however, because the
+# assigned ID will become the material ID for the cohesive element.
+# This ID must not conflict with any of the material ID numbers for
+# volume elements.  The default ID for a fault is 100.  If you have a
+# fault in your mesh you must:
+# 1.  If you create your own fault ID, make sure it does not conflict
+#     with any of you material ID's.
+# 2.  If you use the default fault ID, make sure that none of your
+#     material ID's are equal to 100.
+
+# The quadrature for a 2D fault is 1D with a linear shape.
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 1
+
+db_initial_tractions = spatialdata.spatialdb.UniformDB
+db_initial_tractions.label = "Initial fault tractions"
+db_initial_tractions.values = [traction-shear,traction-normal]
+db_initial_tractions.data = [0.0*Pa, -10.0*MPa]
+
+friction.db_properties = spatialdata.spatialdb.UniformDB
+friction.db_properties.label = Static friction
+friction.db_properties.values = [friction-coefficient,cohesion]
+friction.db_properties.data = [0.6,0.0*Pa]
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[slipweakening_shear_stick.petsc]
+pc_type = asm
+
+# Change the preconditioner settings.
+sub_pc_factor_shift_type = nonzero
+
+ksp_rtol = 1.0e-8
+ksp_atol = 1.0e-15
+ksp_max_it = 100
+ksp_gmres_restart = 50
+snes_max_it = 200
+
+#ksp_monitor = true
+#ksp_view = true
+#ksp_converged_reason = true
+
+#snes_monitor = true
+#snes_view = true
+#snes_converged_reason = true
+
+#log_summary = true
+#start_in_debugger = true
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+# Give basename for VTK domain output of solution over domain.
+[slipweakening_shear_stick.problem.formulation.output.output.writer]
+filename = slipweakening_shear_stick.vtk
+
+# Give basename for VTK fault output.
+[slipweakening_shear_stick.timedependent.interfaces.fault.output]
+writer.filename = slipweakening_shear_stick-fault.vtk
+vertex_info_fields = [strike_dir,normal_dir,initial_traction]
+
+# Give basename for VTK output of state variables.
+[slipweakening_shear_stick.timedependent.materials.material.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = slipweakening_shear_stick-elastic.vtk

Added: short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_stick_soln.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_stick_soln.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests/2d/quad4/slipweakening_shear_stick_soln.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/slipweakening_compression_soln.py
+##
+## @brief Analytical solution to compression problem with slipweakening.
+
+import numpy
+
+# Physical properties
+p_density = 2500.0
+p_vs = 3000.0
+p_vp = 5291.502622129181
+
+p_mu = p_density*p_vs**2
+p_lambda = p_density*p_vp**2 - 2*p_mu
+
+# Uniform stress field (plane strain)
+sxx = 0.0
+sxy = 1.0e+6
+syy = 0.0
+szz = p_lambda/(2*p_lambda+2*p_mu)*(sxx+syy)
+
+# Uniform strain field
+exx = 1.0/(2*p_mu) * (sxx - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+eyy = 1.0/(2*p_mu) * (syy - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+ezz = 1.0/(2*p_mu) * (szz - p_lambda/(3*p_lambda+2*p_mu) * (sxx+syy+szz))
+
+exy = 1.0/(2*p_mu) * (sxy)
+
+#print exx,eyy,exy,ezz,szz
+#print -exx*p_lambda/(p_lambda+2*p_mu)
+
+# ----------------------------------------------------------------------
+class AnalyticalSoln(object):
+  """
+  Analytical solution to slipweakening_compression problem.
+  """
+
+  def __init__(self):
+    return
+
+
+  def displacement(self, locs, nlocsO):
+    """
+    Compute displacement field at locations.
+    """
+    (nlocs, dim) = locs.shape
+
+    disp = numpy.zeros( (nlocs, 3), dtype=numpy.float64)
+    disp[:,1] = 2*exy*(locs[:,0]+max(abs(locs[:,0])))
+    return disp
+
+
+  def strain(self, locs):
+    """
+    Compute strain field at locations.
+    """
+    (npts, dim) = locs.shape
+    strain = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    strain[:,0] = exx
+    strain[:,1] = eyy
+    strain[:,2] = exy
+    return strain
+  
+
+  def stress(self, locs):
+    """
+    Compute stress field at locations.
+    """
+    (npts, dim) = locs.shape
+    stress = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    stress[:,0] = sxx
+    stress[:,1] = syy
+    stress[:,2] = sxy
+    return stress
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py	2010-04-14 04:14:17 UTC (rev 16551)
+++ short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py	2010-04-14 08:01:02 UTC (rev 16552)
@@ -50,6 +50,18 @@
   from TestFrictionOpening import TestFrictionOpening
   suite.addTest(unittest.makeSuite(TestFrictionOpening))
 
+  from TestSlipWeakeningCompression import TestSlipWeakeningCompression
+  suite.addTest(unittest.makeSuite(TestSlipWeakeningCompression))
+  
+  from TestSlipWeakeningShearStick import TestSlipWeakeningShearStick
+  suite.addTest(unittest.makeSuite(TestSlipWeakeningShearStick))
+
+  from TestSlipWeakeningShearSliding import TestSlipWeakeningShearSliding
+  suite.addTest(unittest.makeSuite(TestSlipWeakeningShearSliding))
+
+  from TestSlipWeakeningOpening import TestSlipWeakeningOpening
+  suite.addTest(unittest.makeSuite(TestSlipWeakeningOpening))
+
   return suite
 
 



More information about the CIG-COMMITS mailing list