[cig-commits] r9017 - in short/3D/PyLith/trunk: libsrc libsrc/materials modulesrc/materials pylith pylith/materials

willic3 at geodynamics.org willic3 at geodynamics.org
Mon Jan 14 13:05:22 PST 2008


Author: willic3
Date: 2008-01-14 13:05:22 -0800 (Mon, 14 Jan 2008)
New Revision: 9017

Added:
   short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.cc
   short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.hh
   short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.icc
   short/3D/PyLith/trunk/pylith/materials/GenMaxwellIsotropic3D.py
Modified:
   short/3D/PyLith/trunk/libsrc/Makefile.am
   short/3D/PyLith/trunk/libsrc/materials/Makefile.am
   short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src
   short/3D/PyLith/trunk/pylith/Makefile.am
   short/3D/PyLith/trunk/pylith/materials/__init__.py
Log:
Added Generalized Maxwell model.
Code compiles but has not been tested yet.



Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am	2008-01-14 21:05:22 UTC (rev 9017)
@@ -68,6 +68,7 @@
 	materials/ElasticPlaneStrain.cc \
 	materials/ElasticPlaneStress.cc \
 	materials/MaxwellIsotropic3D.cc \
+	materials/GenMaxwellIsotropic3D.cc \
 	materials/ViscoelasticMaxwell.cc \
 	meshio/BinaryIO.cc \
 	meshio/CellFilter.cc \

Added: short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.cc	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.cc	2008-01-14 21:05:22 UTC (rev 9017)
@@ -0,0 +1,624 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "GenMaxwellIsotropic3D.hh" // implementation of object methods
+
+#include "ViscoelasticMaxwell.hh" // USES computeVisStrain
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include "petsc.h" // USES PetscLogFlopsNoCheck
+
+#include <assert.h> // USES assert()
+#include <sstream> // USES std::ostringstream
+#include <stdexcept> // USES std::runtime_error
+
+// ----------------------------------------------------------------------
+namespace pylith {
+  namespace materials {
+    namespace _GenMaxwellIsotropic3D{
+
+      /// Number of entries in stress/strain tensors.
+      const int tensorSize = 6;
+
+      /// Number of entries in derivative of elasticity matrix.
+      const int numElasticConsts = 21;
+
+      /// Number of Maxwell models in parallel.
+      const int numMaxwellModels = 3;
+
+      /// Values expected in spatial database
+      const int numDBValues = 3 + 2*numMaxwellModels;
+      /// NOTE:  I haven't generalized the database names to the number
+      /// of Maxwell models like I have for everything else.
+      const char* namesDBValues[] = {"density", "vs", "vp" ,
+				     "shear_ratio_1",
+				     "shear_ratio_2",
+				     "shear_ratio_3",
+				     "viscosity_1",
+				     "viscosity_2",
+				     "viscosity_3"};
+
+      /// Indices (order) of database values
+      const int didDensity = 0;
+      const int didVs = 1;
+      const int didVp = 2;
+      const int didShearRatio1 = 3;
+      const int didShearRatio2 = 4;
+      const int didShearRatio3 = 5;
+      const int didViscosity1 = 6;
+      const int didViscosity2 = 7;
+      const int didViscosity3 = 8;
+
+      /// Parameters
+      const int numParameters = 7;
+      const int numParamValues[] = { 1, 
+				     1, 
+				     1,
+				     numMaxwellModels,
+				     numMaxwellModels,
+				     tensorSize,
+				     tensorSize * numMaxwellModels};
+
+      /// Indices (order) of parameters
+      const int pidDensity = 0;
+      const int pidMuTot = pidDensity + 1;
+      const int pidLambdaTot = pidMuTot + 1;
+      const int pidShearRatio = pidLambdaTot + 1;
+      const int pidMaxwellTime = pidShearRatio + numMaxwellModels;
+      const int pidStrainT = pidMaxwellTime + numMaxwellModels;
+      const int pidVisStrain = pidStrainT + tensorSize;
+    } // _GenMaxwellIsotropic3D
+  } // materials
+} // pylith
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::materials::GenMaxwellIsotropic3D::GenMaxwellIsotropic3D(void) :
+  ElasticMaterial(_GenMaxwellIsotropic3D::numParamValues,
+		  _GenMaxwellIsotropic3D::numParameters),
+  _calcElasticConstsFn(&pylith::materials::GenMaxwellIsotropic3D::_calcElasticConstsElastic),
+  _calcStressFn(&pylith::materials::GenMaxwellIsotropic3D::_calcStressElastic),
+  _updateStateFn(&pylith::materials::GenMaxwellIsotropic3D::_updateStateElastic)
+{ // constructor
+  _dimension = 3;
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+pylith::materials::GenMaxwellIsotropic3D::~GenMaxwellIsotropic3D(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Get names of values expected to be in database of parameters for
+const char**
+pylith::materials::GenMaxwellIsotropic3D::_dbValues(void) const
+{ // _dbValues
+  return _GenMaxwellIsotropic3D::namesDBValues;
+} // _dbValues
+
+// ----------------------------------------------------------------------
+// Get number of values expected to be in database of parameters for
+int
+pylith::materials::GenMaxwellIsotropic3D::_numDBValues(void) const
+{ // _numDBValues
+  return _GenMaxwellIsotropic3D::numDBValues;
+} // _numDBValues
+
+// ----------------------------------------------------------------------
+// Compute parameters from values in spatial database.
+void
+pylith::materials::GenMaxwellIsotropic3D::_dbToParameters(
+					    double* const paramVals,
+					    const int numParams,
+					    const double_array& dbValues) const
+{ // _dbToParameters
+  assert(0 != paramVals);
+  assert(_numParamsQuadPt == numParams);
+  const int numDBValues = dbValues.size();
+  assert(_GenMaxwellIsotropic3D::numDBValues == numDBValues);
+
+  const double density = dbValues[_GenMaxwellIsotropic3D::didDensity];
+  const double vs = dbValues[_GenMaxwellIsotropic3D::didVs];
+  const double vp = dbValues[_GenMaxwellIsotropic3D::didVp];
+  const int numMaxwellModels = _GenMaxwellIsotropic3D::numMaxwellModels;
+ 
+  const double mu = density * vs*vs;
+  const double lambda = density * vp*vp - 2.0*mu;
+  if (lambda < 0.0) {
+    std::ostringstream msg;
+    msg << "Attempted to set Lame's constant lambda to negative value.\n"
+	<< "density: " << density << "\n"
+	<< "vp: " << vp << "\n"
+	<< "vs: " << vs << "\n";
+    throw std::runtime_error(msg.str());
+  } // if
+
+  assert(mu > 0);
+
+  paramVals[_GenMaxwellIsotropic3D::pidDensity] = density;
+  paramVals[_GenMaxwellIsotropic3D::pidMuTot] = mu;
+  paramVals[_GenMaxwellIsotropic3D::pidLambdaTot] = lambda;
+
+  // Loop over number of Maxwell models.
+  for (int iTerm =0;
+       iTerm < numMaxwellModels; ++iTerm) {
+    double muRatio = dbValues[_GenMaxwellIsotropic3D::didShearRatio1 + iTerm];
+    double viscosity = dbValues[_GenMaxwellIsotropic3D::didViscosity1 + iTerm];
+    double mu = muRatio*mu;
+    double maxwellTime = 0.0;
+    if (mu > 0.0) maxwellTime = viscosity / mu;
+    paramVals[_GenMaxwellIsotropic3D::pidShearRatio + iTerm] = muRatio;
+    paramVals[_GenMaxwellIsotropic3D::pidMaxwellTime + iTerm] = maxwellTime;
+  } // for
+
+  PetscLogFlopsNoCheck(6+2*numMaxwellModels);
+} // _dbToParameters
+
+// ----------------------------------------------------------------------
+// Get number of entries in stress tensor.
+int
+pylith::materials::GenMaxwellIsotropic3D::_tensorSize(void) const
+{ // _tensorSize
+  return _GenMaxwellIsotropic3D::tensorSize;
+} // _tensorSize
+
+// ----------------------------------------------------------------------
+// Get number of entries in elasticity matrix for material.
+int
+pylith::materials::GenMaxwellIsotropic3D::_numElasticConsts(void) const
+{ // numElasticConsts
+  return _GenMaxwellIsotropic3D::numElasticConsts;
+} // numElasticConsts
+
+// ----------------------------------------------------------------------
+// Compute density at location from parameters.
+void
+pylith::materials::GenMaxwellIsotropic3D::_calcDensity(double* const density,
+						       const double* parameters,
+						       const int numParams)
+{ // _calcDensity
+  assert(0 != density);
+  assert(0 != parameters);
+  assert(_numParamsQuadPt == numParams);
+  
+  density[0] = parameters[_GenMaxwellIsotropic3D::pidDensity];
+} // _calcDensity
+
+// ----------------------------------------------------------------------
+// Compute stress tensor at location from parameters as an elastic
+// material.
+void
+pylith::materials::GenMaxwellIsotropic3D::_calcStressElastic(
+							     double* const stress,
+							     const int stressSize,
+							     const double* parameters,
+							     const int numParams,
+							     const double* totalStrain,
+							     const int strainSize)
+{ // _calcStressElastic
+  assert(0 != stress);
+  assert(_GenMaxwellIsotropic3D::tensorSize == stressSize);
+  assert(0 != parameters);
+  assert(_numParamsQuadPt == numParams);
+  assert(0 != totalStrain);
+  assert(_GenMaxwellIsotropic3D::tensorSize == strainSize);
+
+  const double density = parameters[_GenMaxwellIsotropic3D::pidDensity];
+  const double mu = parameters[_GenMaxwellIsotropic3D::pidMuTot];
+  const double lambda = parameters[_GenMaxwellIsotropic3D::pidLambdaTot];
+
+  const double mu2 = 2.0 * mu;
+
+  const double e11 = totalStrain[0];
+  const double e22 = totalStrain[1];
+  const double e33 = totalStrain[2];
+  const double e12 = totalStrain[3];
+  const double e23 = totalStrain[4];
+  const double e13 = totalStrain[5];
+  
+  const double traceStrainTpdt = e11 + e22 + e33;
+  const double s123 = lambda * traceStrainTpdt;
+
+  stress[0] = s123 + mu2*e11;
+  stress[1] = s123 + mu2*e22;
+  stress[2] = s123 + mu2*e33;
+  stress[3] = mu2 * e12;
+  stress[4] = mu2 * e23;
+  stress[5] = mu2 * e13;
+  // std::cout << " _calcStressElastic: " << std::endl;
+  // std::cout << " totalStrain: " << std::endl;
+  // for (int iComp=0; iComp < _GenMaxwellIsotropic3D::tensorSize; ++iComp)
+    // std::cout << "  " << totalStrain[iComp];
+  // std::cout << std::endl << " stress: " << std::endl;
+  // for (int iComp=0; iComp < _GenMaxwellIsotropic3D::tensorSize; ++iComp)
+    // std::cout << "  " << (*stress)[iComp];
+  // std::cout << std::endl;
+
+  PetscLogFlopsNoCheck(13);
+} // _calcStressElastic
+
+// ----------------------------------------------------------------------
+// Compute stress tensor at location from parameters as a viscoelastic
+// material.
+void
+pylith::materials::GenMaxwellIsotropic3D::_calcStressViscoelastic(
+								  double* const stress,
+								  const int stressSize,
+								  const double* parameters,
+								  const int numParams,
+								  const double* totalStrain,
+								  const int strainSize)
+{ // _calcStressElastic
+  assert(0 != stress);
+  assert(_GenMaxwellIsotropic3D::tensorSize == stressSize);
+  assert(0 != parameters);
+  assert(_numParamsQuadPt == numParams);
+  assert(0 != totalStrain);
+  assert(_GenMaxwellIsotropic3D::tensorSize == strainSize);
+
+  const double density = parameters[_GenMaxwellIsotropic3D::pidDensity];
+  const double mu = parameters[_GenMaxwellIsotropic3D::pidMuTot];
+  const double lambda = parameters[_GenMaxwellIsotropic3D::pidLambdaTot];
+  const double muRatio[] = {
+    parameters[_GenMaxwellIsotropic3D::pidShearRatio],
+    parameters[_GenMaxwellIsotropic3D::pidShearRatio+1],
+    parameters[_GenMaxwellIsotropic3D::pidShearRatio+2]};
+  const double maxwellTime[] = {
+    parameters[_GenMaxwellIsotropic3D::pidMaxwellTime],
+    parameters[_GenMaxwellIsotropic3D::pidMaxwellTime+1],
+    parameters[_GenMaxwellIsotropic3D::pidMaxwellTime+2]};
+  const int numMaxwellModels = _GenMaxwellIsotropic3D::numMaxwellModels;
+
+  const double mu2 = 2.0 * mu;
+  const double bulkmodulus = lambda + mu2/3.0;
+
+  const double e11 = totalStrain[0];
+  const double e22 = totalStrain[1];
+  const double e33 = totalStrain[2];
+  const double e12 = totalStrain[3];
+  const double e23 = totalStrain[4];
+  const double e13 = totalStrain[5];
+  
+  const double traceStrainTpdt = e11 + e22 + e33;
+  const double meanStrainTpdt = traceStrainTpdt/3.0;
+  const double s123 = lambda * traceStrainTpdt;
+
+  const double diag[] = { 1.0, 1.0, 1.0, 0.0, 0.0, 0.0 };
+  const double meanStressTpdt = bulkmodulus * traceStrainTpdt;
+
+  const double meanStrainT = 
+    (parameters[_GenMaxwellIsotropic3D::pidStrainT+0] +
+     parameters[_GenMaxwellIsotropic3D::pidStrainT+1] +
+     parameters[_GenMaxwellIsotropic3D::pidStrainT+2])/3.0;
+  
+  double visFrac = 0.0;
+  for (int iTerm = 0; iTerm < numMaxwellModels; ++iTerm) 
+    visFrac += muRatio[iTerm];
+
+  if (visFrac > 1.0) {
+    std::ostringstream msg;
+    msg << "Shear modulus ratios sum to a value greater than 1.0 for\n"
+	<< "Generalized Maxwell model.\n"
+	<< "Ratio 1: " << muRatio[0] << "\n"
+	<< "Ratio 2: " << muRatio[1] << "\n"
+	<< "Ratio 3: " << muRatio[2] << "\n"
+	<< "Total:   " << visFrac << "\n";
+    throw std::runtime_error(msg.str());
+  } // if
+  double elasFrac = 1.0 - visFrac;
+
+  PetscLogFlopsNoCheck(12+numMaxwellModels);
+
+  // Compute Prony series terms
+  double dq[] = { 0.0, 0.0, 0.0};
+  for (int iTerm=0; iTerm < numMaxwellModels; ++iTerm) {
+    if (muRatio[iTerm] != 0.0)
+      dq[iTerm] =
+	ViscoelasticMaxwell::computeVisStrain(_dt, maxwellTime[iTerm]);
+  } // for
+
+  // Compute new stresses
+  double devStrainTpdt = 0.0;
+  double devStrainT = 0.0;
+  double deltaStrain = 0.0;
+  double devStressTpdt = 0.0;
+  double visStrain = 0.0;
+  // std::cout << " _calcStressViscoelastic: " << std::endl;
+  // std::cout << " stress  totalStrain  visStrain: " << std::endl;
+  for (int iComp=0; iComp < _GenMaxwellIsotropic3D::tensorSize; ++iComp) {
+    devStrainTpdt = totalStrain[iComp] - diag[iComp]*meanStrainTpdt;
+    devStrainT = parameters[_GenMaxwellIsotropic3D::pidStrainT+iComp] -
+      diag[iComp]*meanStrainT;
+    deltaStrain = devStrainTpdt - devStrainT;
+    devStressTpdt = elasFrac*devStrainTpdt;
+    for (int iTerm=0; iTerm < numMaxwellModels; ++iTerm) {
+      if (muRatio[iTerm] != 0.0) {
+	visStrain = exp(-_dt/maxwellTime[iTerm])*
+	  parameters[_GenMaxwellIsotropic3D::pidVisStrain+
+		     iComp+iTerm*_GenMaxwellIsotropic3D::tensorSize]
+	  + dq[iTerm]*deltaStrain;
+	devStressTpdt += muRatio[iTerm] * visStrain;
+      } // if
+    } // for
+
+    devStressTpdt = mu2*devStressTpdt;
+    // Later I will want to put in initial stresses.
+    stress[iComp] =diag[iComp]*meanStressTpdt+devStressTpdt;
+
+    // Temporary to get stresses and strains.
+    // std::cout << "  " << stress[iComp] << "  " << totalStrain[iComp] << "  " << visStrain << std:: endl;
+  } // for
+
+  PetscLogFlopsNoCheck((8 + 8*numMaxwellModels) *
+		       _GenMaxwellIsotropic3D::tensorSize);
+} // _calcStress
+
+// ----------------------------------------------------------------------
+// Compute derivative of elasticity matrix at location from parameters.
+void
+pylith::materials::GenMaxwellIsotropic3D::_calcElasticConstsElastic(
+						  double* const elasticConsts,
+						  const int numElasticConsts,
+						  const double* parameters,
+						  const int numParams,
+						  const double* totalStrain,
+						  const int strainSize)
+{ // _calcElasticConstsElastic
+  assert(0 != elasticConsts);
+  assert(_GenMaxwellIsotropic3D::numElasticConsts == numElasticConsts);
+  assert(0 != parameters);
+  assert(_numParamsQuadPt == numParams);
+  assert(0 != totalStrain);
+  assert(_GenMaxwellIsotropic3D::tensorSize == strainSize);
+ 
+  const double density = parameters[_GenMaxwellIsotropic3D::pidDensity];
+  const double mu = parameters[_GenMaxwellIsotropic3D::pidMuTot];
+  const double lambda = parameters[_GenMaxwellIsotropic3D::pidLambdaTot];
+
+  const double mu2 = 2.0 * mu;
+  const double lambda2mu = lambda + mu2;
+  const double bulkmodulus = lambda + mu2 / 3.0;
+
+  elasticConsts[ 0] = lambda2mu; // C1111
+  elasticConsts[ 1] = lambda; // C1122
+  elasticConsts[ 2] = lambda; // C1133
+  elasticConsts[ 3] = 0; // C1112
+  elasticConsts[ 4] = 0; // C1123
+  elasticConsts[ 5] = 0; // C1113
+  elasticConsts[ 6] = lambda2mu; // C2222
+  elasticConsts[ 7] = lambda; // C2233
+  elasticConsts[ 8] = 0; // C2212
+  elasticConsts[ 9] = 0; // C2223
+  elasticConsts[10] = 0; // C2213
+  elasticConsts[11] = lambda2mu; // C3333
+  elasticConsts[12] = 0; // C3312
+  elasticConsts[13] = 0; // C3323
+  elasticConsts[14] = 0; // C3313
+  elasticConsts[15] = mu2; // C1212
+  elasticConsts[16] = 0; // C1223
+  elasticConsts[17] = 0; // C1213
+  elasticConsts[18] = mu2; // C2323
+  elasticConsts[19] = 0; // C2313
+  elasticConsts[20] = mu2; // C1313
+
+  PetscLogFlopsNoCheck(4);
+} // _calcElasticConstsElastic
+
+// ----------------------------------------------------------------------
+// Compute derivative of elasticity matrix at location from parameters
+// as an elastic material.
+void
+pylith::materials::GenMaxwellIsotropic3D::_calcElasticConstsViscoelastic(
+						  double* const elasticConsts,
+						  const int numElasticConsts,
+						  const double* parameters,
+						  const int numParams,
+						  const double* totalStrain,
+						  const int strainSize)
+{ // _calcElasticConstsViscoelastic
+  assert(0 != elasticConsts);
+  assert(_GenMaxwellIsotropic3D::numElasticConsts == numElasticConsts);
+  assert(0 != parameters);
+  assert(_numParamsQuadPt == numParams);
+  assert(0 != totalStrain);
+  assert(_GenMaxwellIsotropic3D::tensorSize == strainSize);
+ 
+  const double density = parameters[_GenMaxwellIsotropic3D::pidDensity];
+  const double mu = parameters[_GenMaxwellIsotropic3D::pidMuTot];
+  const double lambda = parameters[_GenMaxwellIsotropic3D::pidLambdaTot];
+  const int numMaxwellModels = _GenMaxwellIsotropic3D::numMaxwellModels;
+
+  const double mu2 = 2.0 * mu;
+  const double bulkmodulus = lambda + mu2/3.0;
+
+  // Compute viscous contribution.
+  double visFac = 0.0;
+  double shearRatio = 0.0;
+  double maxwellTime = 0.0;
+  for (int iTerm = 0; iTerm < numMaxwellModels; ++iTerm) {
+    shearRatio = parameters[_GenMaxwellIsotropic3D::pidShearRatio + iTerm];
+    if (shearRatio != 0.0) {
+      maxwellTime = parameters[_GenMaxwellIsotropic3D::pidMaxwellTime + iTerm];
+      visFac +=
+	shearRatio*ViscoelasticMaxwell::computeVisStrain(_dt, maxwellTime);
+    } // if
+  } // for
+  visFac = mu*visFac/3.0;
+
+  elasticConsts[ 0] = bulkmodulus + 4.0*visFac; // C1111
+  elasticConsts[ 1] = bulkmodulus - 2.0*visFac; // C1122
+  elasticConsts[ 2] = elasticConsts[1]; // C1133
+  elasticConsts[ 3] = 0; // C1112
+  elasticConsts[ 4] = 0; // C1123
+  elasticConsts[ 5] = 0; // C1113
+  elasticConsts[ 6] = elasticConsts[0]; // C2222
+  elasticConsts[ 7] = elasticConsts[1]; // C2233
+  elasticConsts[ 8] = 0; // C2212
+  elasticConsts[ 9] = 0; // C2223
+  elasticConsts[10] = 0; // C2213
+  elasticConsts[11] = elasticConsts[0]; // C3333
+  elasticConsts[12] = 0; // C3312
+  elasticConsts[13] = 0; // C3323
+  elasticConsts[14] = 0; // C3313
+  elasticConsts[15] = 6.0 * visFac; // C1212
+  elasticConsts[16] = 0; // C1223
+  elasticConsts[17] = 0; // C1213
+  elasticConsts[18] = elasticConsts[15]; // C2323
+  elasticConsts[19] = 0; // C2313
+  elasticConsts[20] = elasticConsts[15]; // C1313
+
+  PetscLogFlopsNoCheck(8 + 2*numMaxwellModels);
+} // _calcElasticConstsViscoelastic
+
+// ----------------------------------------------------------------------
+// Update state variables.
+void
+pylith::materials::GenMaxwellIsotropic3D::_updateStateElastic(
+						 double* const parameters,
+						 const int numParams,
+						 const double* totalStrain,
+						 const int strainSize)
+{ // _updateStateElastic
+  assert(0 != parameters);
+  assert(_numParamsQuadPt == numParams);
+  assert(0 != totalStrain);
+  assert(_GenMaxwellIsotropic3D::tensorSize == strainSize);
+
+  const int numMaxwellModels = _GenMaxwellIsotropic3D::numMaxwellModels;
+
+  const double e11 = totalStrain[0];
+  const double e22 = totalStrain[1];
+  const double e33 = totalStrain[2];
+
+  const double traceStrainTpdt = e11 + e22 + e33;
+  const double meanStrainTpdt = traceStrainTpdt/3.0;
+
+  const double diag[] = { 1.0, 1.0, 1.0, 0.0, 0.0, 0.0 };
+
+  // Temporary to get stresses.
+  // double_array stress(6);
+  // _calcStressElastic(&stress, (*parameters), totalStrain);
+
+  // Initialize all viscous strains to deviatoric elastic strains.
+  double devStrain = 0.0;
+  for (int iComp=0; iComp < _GenMaxwellIsotropic3D::tensorSize; ++iComp) {
+    parameters[_GenMaxwellIsotropic3D::pidStrainT+iComp] = totalStrain[iComp];
+    devStrain = totalStrain[iComp] - diag[iComp]*meanStrainTpdt;
+    for (int iTerm = 0; iTerm < numMaxwellModels; ++iTerm) {
+      parameters[_GenMaxwellIsotropic3D::pidVisStrain+
+		 iComp+iTerm*_GenMaxwellIsotropic3D::tensorSize] =
+	devStrain;
+    } // for
+  } // for
+  PetscLogFlopsNoCheck(3+2*_GenMaxwellIsotropic3D::tensorSize);
+//   std::cout << std::endl;
+//   std::cout << " updateStateElastic: "<< std::endl;
+//   std::cout << " StrainT  VisStrain  Stress: " << std::endl;
+//   for (int iComp=0; iComp < _GenMaxwellIsotropic3D::tensorSize; ++iComp)
+//     std::cout << "  " << parameters[_GenMaxwellIsotropic3D::pidStrainT+iComp]
+// 	    << "   " << parameters[_GenMaxwellIsotropic3D::pidVisStrain+iComp]
+// 	    << "   " << stress[iComp]
+// 	    << std::endl;
+
+  _needNewJacobian = true;
+} // _updateStateElastic
+
+// ----------------------------------------------------------------------
+// Update state variables.
+void
+pylith::materials::GenMaxwellIsotropic3D::_updateStateViscoelastic(
+						 double* const parameters,
+						 const int numParams,
+						 const double* totalStrain,
+						 const int strainSize)
+{ // _updateStateViscoelastic
+  assert(0 != parameters);
+  assert(_numParamsQuadPt == numParams);
+  assert(0 != totalStrain);
+  assert(_GenMaxwellIsotropic3D::tensorSize == strainSize);
+
+  const int numMaxwellModels = _GenMaxwellIsotropic3D::numMaxwellModels;
+  const int tensorSize = _GenMaxwellIsotropic3D::tensorSize;
+
+  const double e11 = totalStrain[0];
+  const double e22 = totalStrain[1];
+  const double e33 = totalStrain[2];
+
+  const double meanStrainTpdt = (e11 + e22 + e33) / 3.0;
+
+  const double diag[] = { 1.0, 1.0, 1.0, 0.0, 0.0, 0.0 };
+
+  // Temporary to get stresses.
+  // double stress[6];
+  // const int stressSize = 6;
+  // _calcStressViscoelastic(stress, stressSize, 
+			  // parameters, numParams,
+			  // totalStrain, strainSize);
+
+  const double meanStrainT = 
+    (parameters[_GenMaxwellIsotropic3D::pidStrainT+0] +
+     parameters[_GenMaxwellIsotropic3D::pidStrainT+1] +
+     parameters[_GenMaxwellIsotropic3D::pidStrainT+2]) / 3.0;
+  
+  PetscLogFlopsNoCheck(6);
+
+  // Compute Prony series terms.
+  double dq[] = {0.0, 0.0, 0.0};
+  for (int iTerm = 0; iTerm < numMaxwellModels; ++iTerm) {
+    if(parameters[_GenMaxwellIsotropic3D::pidShearRatio + iTerm] != 0.0) {
+      const double maxwellTime =
+	parameters[_GenMaxwellIsotropic3D::pidMaxwellTime + iTerm];
+      dq[iTerm] = ViscoelasticMaxwell::computeVisStrain(_dt, maxwellTime);
+    } // if
+  } // for
+      
+  double devStrainTpdt = 0.0;
+  double devStrainT = 0.0;
+  double deltaStrain = 0.0;
+  double visStrain = 0.0;
+  for (int iComp=0; iComp < tensorSize; ++iComp) {
+    devStrainTpdt = totalStrain[iComp] - diag[iComp]*meanStrainTpdt;
+    devStrainT = parameters[_GenMaxwellIsotropic3D::pidStrainT+iComp] -
+      diag[iComp] * meanStrainT;
+    deltaStrain = devStrainTpdt - devStrainT;
+    parameters[_GenMaxwellIsotropic3D::pidStrainT+iComp] = totalStrain[iComp];
+    for (int iTerm = 0; iTerm < numMaxwellModels; ++iTerm) {
+      const double maxwellTime =
+	parameters[_GenMaxwellIsotropic3D::pidMaxwellTime + iTerm];
+      visStrain = 
+	exp(-_dt/maxwellTime) * 
+	parameters[_GenMaxwellIsotropic3D::pidVisStrain+iComp] +
+	dq[iTerm] * deltaStrain;
+      parameters[_GenMaxwellIsotropic3D::pidVisStrain +
+		 iComp + iTerm * tensorSize] = visStrain;
+    } // for
+  } // for
+  PetscLogFlopsNoCheck((5 + (6 * numMaxwellModels)) * tensorSize);
+
+  _needNewJacobian = false;
+
+//   std::cout << std::endl;
+//   std::cout << " updateStateViscoelastic: "<< std::endl;
+//   std::cout << " StrainT  VisStrain  Stress: " << std::endl;
+//   for (int iComp=0; iComp < _GenMaxwellIsotropic3D::tensorSize; ++iComp)
+//     std::cout << "  " << parameters[_GenMaxwellIsotropic3D::pidStrainT+iComp]
+// 	    << "   " << parameters[_GenMaxwellIsotropic3D::pidVisStrain+iComp]
+// 	    << "   " << stress[iComp]
+// 	    << std::endl;
+} // _updateStateViscoelastic
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.hh	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.hh	2008-01-14 21:05:22 UTC (rev 9017)
@@ -0,0 +1,332 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file libsrc/materials/GenMaxwellIsotropic3D.h
+ *
+ * @brief C++ GenMaxwellIsotropic3D object
+ *
+ * 3-D, isotropic, generalized linear Maxwell viscoelastic material.
+ * This consists of several Maxwell models in parallel. At present,
+ * the number of models is fixed at 3, but this will be changed in the
+ * future. The physical properties are specified using density,
+ * shear-wave speed, and compressional-wave speed. A viscosity and a shear ratio
+ * are also given for each Maxwell model. The shear ratio specifies how much of
+ * the total shear modulus is associated with that model. The shear ratios must
+ * sum to a value less than one. If the value is less than one, the remainder of
+ * the total shear modulus is associated with a spring in parallel with the
+ * Maxwell models.
+ * The physical properties are stored internally using density, lambdaTot,
+ * muTot, which are directly related to the elasticity constants used in the
+ * finite-element integration. The viscosity for each model is stored using
+ * Maxwell Time (viscosity/mu), and the shear ratio is also stored for each
+ * Maxwell model.
+ */
+
+#if !defined(pylith_materials_genmaxwellisotropic3d_hh)
+#define pylith_materials_genmaxwellisotropic3d_hh
+
+#include "ElasticMaterial.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace materials {
+    class GenMaxwellIsotropic3D;
+    class TestGenMaxwellIsotropic3D; // unit testing
+  } // materials
+} // pylith
+
+/// 3-D, isotropic, generalized linear Maxwell viscoelastic material.
+class pylith::materials::GenMaxwellIsotropic3D : public ElasticMaterial
+{ // class GenMaxwellIsotropic3D
+  friend class TestGenMaxwellIsotropic3D; // unit testing
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Default constructor
+  GenMaxwellIsotropic3D(void);
+
+  /// Destructor
+  ~GenMaxwellIsotropic3D(void);
+
+  /** Set current time step.
+   *
+   * @param dt Current time step.
+   */
+  void timeStep(const double dt);
+
+  /** Set whether elastic or inelastic constitutive relations are used.
+   *
+   * @param flag True to use elastic, false to use inelastic.
+   */
+  void useElasticBehavior(const bool flag);
+
+  /** Get flag indicating whether material implements an empty
+   * _updateState() method.
+   *
+   * @returns False if _updateState() is empty, true otherwise.
+   */
+  bool usesUpdateState(void) const;
+
+  // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+  /** Get names of values expected to be in database of parameters for
+   *  physical properties.
+   *
+   * @returns Names of values
+   */
+  const char** _dbValues(void) const;
+
+  /** Get number of values expected to be in database of parameters for
+   *  physical properties.
+   *
+   * @returns Number of values
+   */
+  int _numDBValues(void) const;
+
+  /** Compute parameters from values in spatial database.
+   *
+   * Order of values in arrays matches order used in dbValues() and
+   * parameterNames().
+   *
+   * @param paramVals Array of parameters
+   * @param dbValues Array of database values
+   */
+  void _dbToParameters(double* const paramVals,
+		       const int numParams,
+		       const double_array& dbValues) const;
+
+  /** Get number of entries in stress/strain tensors.
+   *
+   * 1-D = 1
+   * 2-D = 3
+   * 3-D = 6
+   *
+   * @returns Number of entries in stress/strain tensors.
+   */
+  int _tensorSize(void) const;
+
+  /** Get number of entries in derivative of elasticity matrix.
+   *
+   * 1-D = 1
+   * 2-D = 6
+   * 3-D = 21
+   *
+   * @returns Number of entries in derivative of elasticity matrix.
+   */
+  int _numElasticConsts(void) const;
+
+  /** Compute density from parameters.
+   *
+   * @param density Array for density.
+   * @param parameters Parameters at location.
+   * @param numParams Number of parameters.
+   */
+  void _calcDensity(double* const density,
+		    const double* parameters,
+		    const int numParams);
+
+  /** Compute stress tensor from parameters.
+   *
+   * @param stress Array for stress tensor.
+   * @param stressSize Size of stress tensor.
+   * @param parameters Parameters at location.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at location.
+   * @param strainSize Size of strain tensor.
+   */
+  void _calcStress(double* const stress,
+		   const int stressSize,
+		   const double* parameters,
+		   const int numParams,
+		   const double* totalStrain,
+		   const int strainSize);
+
+  /** Compute derivatives of elasticity matrix from parameters.
+   *
+   * @param elasticConsts Array for elastic constants.
+   * @param numElasticConsts Number of elastic constants.
+   * @param parameters Parameters at location.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at location.
+   * @param strainSize Size of strain tensor.
+   */
+  void _calcElasticConsts(double* const elasticConsts,
+			  const int numElasticConsts,
+			  const double* parameters,
+			  const int numParams,
+			  const double* totalStrain,
+			  const int strainSize);
+
+  /** Update parameters (for next time step).
+   *
+   * @param parameters Parameters at location.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at location.
+   * @param strainSize Size of strain tensor.
+   */
+  void _updateState(double* const parameters,
+		    const int numParams,
+		    const double* totalStrain,
+		    const int strainSize);
+
+  // PRIVATE TYPEDEFS ///////////////////////////////////////////////////
+private :
+
+  /// Member prototype for _calcStress()
+  typedef void (pylith::materials::GenMaxwellIsotropic3D::*calcStress_fn_type)
+    (double* const,
+     const int,
+     const double*,
+     const int,
+     const double*,
+     const int);
+
+  /// Member prototype for _calcElasticConsts()
+  typedef void (pylith::materials::GenMaxwellIsotropic3D::*calcElasticConsts_fn_type)
+    (double* const,
+     const int,
+     const double*,
+     const int,
+     const double*,
+     const int);
+
+  /// Member prototype for _updateState()
+  typedef void (pylith::materials::GenMaxwellIsotropic3D::*updateState_fn_type)
+    (double* const,
+     const int,
+     const double*,
+     const int);
+
+  // PRIVATE METHODS ////////////////////////////////////////////////////
+private :
+
+  /** Compute stress tensor from parameters as an elastic material.
+   *
+   * @param stress Array for stress tensor.
+   * @param stressSize Size of stress tensor.
+   * @param parameters Parameters at locations.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at locations.
+   * @param strainSize Size of strain tensor.
+   */
+  void _calcStressElastic(double* const stress,
+			  const int stressSize,
+			  const double* parameters,
+			  const int numParams,
+			  const double* totalStrain,
+			  const int strainSize);
+
+  /** Compute stress tensor from parameters as an viscoelastic material.
+   *
+   * @param stress Array for stress tensor.
+   * @param stressSize Size of stress tensor.
+   * @param parameters Parameters at locations.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at locations.
+   * @param strainSize Size of strain tensor.
+   */
+  void _calcStressViscoelastic(double* const stress,
+			  const int stressSize,
+			  const double* parameters,
+			  const int numParams,
+			  const double* totalStrain,
+			  const int strainSize);
+
+  /** Compute derivatives of elasticity matrix from parameters as an
+   * elastic material.
+   *
+   * @param elasticConsts Array for elastic constants.
+   * @param numElasticConsts Number of elastic constants.
+   * @param parameters Parameters at location.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at location.
+   * @param strainSize Size of strain tensor.
+   */
+  void _calcElasticConstsElastic(double* const elasticConsts,
+				 const int numElasticConsts,
+				 const double* parameters,
+				 const int numParams,
+				 const double* totalStrain,
+				 const int strainSize);
+
+  /** Compute derivatives of elasticity matrix from parameters as a
+   * viscoelastic material.
+   *
+   * @param elasticConsts Array for elastic constants.
+   * @param numElasticConsts Number of elastic constants.
+   * @param parameters Parameters at location.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at location.
+   * @param strainSize Size of strain tensor.
+   */
+  void _calcElasticConstsViscoelastic(double* const elasticConsts,
+				      const int numElasticConsts,
+				      const double* parameters,
+				      const int numParams,
+				      const double* totalStrain,
+				      const int strainSize);
+
+  /** Update state variables after solve as an elastic material.
+   *
+   * @param parameters Parameters at location.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at location.
+   * @param strainSize Size of strain tensor.
+   */
+  void _updateStateElastic(double* const parameters,
+			   const int numParams,
+			   const double* totalStrain,
+			   const int strainSize);
+
+  /** Update state variables after solve as a viscoelastic material.
+   *
+   * @param parameters Parameters at location.
+   * @param numParams Number of parameters.
+   * @param totalStrain Total strain at location.
+   * @param strainSize Size of strain tensor.
+   */
+  void _updateStateViscoelastic(double* const parameters,
+				const int numParams,
+				const double* totalStrain,
+				const int strainSize);
+
+  // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+  /// Not implemented
+  GenMaxwellIsotropic3D(const GenMaxwellIsotropic3D& m);
+
+  /// Not implemented
+  const GenMaxwellIsotropic3D& operator=(const GenMaxwellIsotropic3D& m);
+
+  // PRIVATE MEMBERS ////////////////////////////////////////////////////
+private :
+
+  /// Method to use for _calcElasticConsts().
+  calcElasticConsts_fn_type _calcElasticConstsFn;
+
+  /// Method to use for _calcStress().
+  calcStress_fn_type _calcStressFn;
+
+  /// Method to use for _updateState().
+  updateState_fn_type _updateStateFn;
+
+}; // class GenMaxwellIsotropic3D
+
+#include "GenMaxwellIsotropic3D.icc" // inline methods
+
+#endif // pylith_materials_genmaxwellisotropic3d_hh
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.icc	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.icc	2008-01-14 21:05:22 UTC (rev 9017)
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(pylith_materials_genmaxwellisotropic3d_hh)
+#error "GenMaxwellIsotropic3D.icc can only be included from GenMaxwellIsotropic3D.hh"
+#endif
+
+#include <assert.h> // USES assert()
+#include "pylith/utils/macrodefs.h" // USES CALL_MEMBER_FN
+
+// Set current time step.
+inline
+void
+pylith::materials::GenMaxwellIsotropic3D::timeStep(const double dt) {
+  // Jacobian needs to be reformed if the time step size changes.
+  if (_dt > 0.0 && dt != _dt)
+    _needNewJacobian = true;
+  _dt = dt;
+} // timeStep
+
+// Set whether elastic or inelastic constitutive relations are used.
+inline
+void
+pylith::materials::GenMaxwellIsotropic3D::useElasticBehavior(const bool flag) {
+  if (flag) {
+    _calcStressFn = 
+      &pylith::materials::GenMaxwellIsotropic3D::_calcStressElastic;
+    _calcElasticConstsFn = 
+      &pylith::materials::GenMaxwellIsotropic3D::_calcElasticConstsElastic;
+    _updateStateFn = 
+      &pylith::materials::GenMaxwellIsotropic3D::_updateStateElastic;
+  } else {
+    _calcStressFn = 
+      &pylith::materials::GenMaxwellIsotropic3D::_calcStressViscoelastic;
+    _calcElasticConstsFn = 
+      &pylith::materials::GenMaxwellIsotropic3D::_calcElasticConstsViscoelastic;
+    _updateStateFn = 
+      &pylith::materials::GenMaxwellIsotropic3D::_updateStateViscoelastic;
+  } // if/else
+} // useElasticBehavior
+
+// Get flag indicating whether material implements an empty
+inline
+bool
+pylith::materials::GenMaxwellIsotropic3D::usesUpdateState(void) const {
+  return true;
+} // usesUpdateState
+
+// Compute stress tensor from parameters.
+inline
+void
+pylith::materials::GenMaxwellIsotropic3D::_calcStress(double* const stress,
+						   const int stressSize,
+						   const double* parameters,
+						   const int numParams,
+						   const double* totalStrain,
+						   const int strainSize) {
+  assert(0 != _calcStressFn);
+  CALL_MEMBER_FN(*this, _calcStressFn)(stress, stressSize, 
+				       parameters, numParams,
+				       totalStrain, strainSize);
+} // _calcStress
+
+// Compute derivatives of elasticity matrix from parameters.
+inline
+void
+pylith::materials::GenMaxwellIsotropic3D::_calcElasticConsts(
+						 double* const elasticConsts,
+						 const int numElasticConsts,
+						 const double* parameters,
+						 const int numParams,
+						 const double* totalStrain,
+						 const int strainSize) {
+  assert(0 != _calcElasticConstsFn);
+  CALL_MEMBER_FN(*this, _calcElasticConstsFn)(elasticConsts, numElasticConsts,
+					      parameters, numParams,
+					      totalStrain, strainSize);
+} // _calcElasticConsts
+
+// Update state variables after solve.
+inline
+void
+pylith::materials::GenMaxwellIsotropic3D::_updateState(double* const parameters,
+						    const int numParams,
+						    const double* totalStrain,
+						    const int strainSize) {
+  assert(0 != _updateStateFn);
+  CALL_MEMBER_FN(*this, _updateStateFn)(parameters, numParams,
+					totalStrain, strainSize);
+} // _updateState
+
+// End of file 

Modified: short/3D/PyLith/trunk/libsrc/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Makefile.am	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/libsrc/materials/Makefile.am	2008-01-14 21:05:22 UTC (rev 9017)
@@ -21,6 +21,8 @@
 	ElasticMaterial.icc \
 	ElasticPlaneStrain.hh \
 	ElasticPlaneStress.hh \
+	GenMaxwellIsotropic3D.hh \
+	GenMaxwellIsotropic3D.icc \
 	MaxwellIsotropic3D.hh \
 	MaxwellIsotropic3D.icc \
 	Material.hh \

Modified: short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src	2008-01-14 21:05:22 UTC (rev 9017)
@@ -19,6 +19,7 @@
 #include "pylith/materials/ElasticPlaneStrain.hh"
 #include "pylith/materials/ElasticPlaneStress.hh"
 #include "pylith/materials/MaxwellIsotropic3D.hh"
+#include "pylith/materials/GenMaxwellIsotropic3D.hh"
 
 #include <assert.h>
 #include <stdexcept>
@@ -450,6 +451,38 @@
 
 
 # ----------------------------------------------------------------------
+cdef class GenMaxwellIsotropic3D(ElasticMaterial):
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    # create shim for constructor
+    #embed{ void* GenMaxwellIsotropic3D_constructor()
+    void* result = 0;
+    try {
+      result = (void*)(new pylith::materials::GenMaxwellIsotropic3D);
+      assert(0 != result);
+    } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (const ALE::Exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.msg().c_str()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch
+    return result;
+    #}embed
+
+    ElasticMaterial.__init__(self)
+    self.thisptr = GenMaxwellIsotropic3D_constructor()
+    self.handle = self._createHandle()
+    return
+
+
+# ----------------------------------------------------------------------
 cdef class MaxwellIsotropic3D(ElasticMaterial):
 
   def __init__(self):

Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/pylith/Makefile.am	2008-01-14 21:05:22 UTC (rev 9017)
@@ -71,6 +71,7 @@
 	materials/ElasticPlaneStress.py \
 	materials/ElasticStrain1D.py \
 	materials/ElasticStress1D.py \
+	materials/GenMaxwellIsotropic3D.py \
 	materials/Homogeneous.py \
 	materials/Material.py \
 	materials/MaxwellIsotropic3D.py \

Added: short/3D/PyLith/trunk/pylith/materials/GenMaxwellIsotropic3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/GenMaxwellIsotropic3D.py	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/pylith/materials/GenMaxwellIsotropic3D.py	2008-01-14 21:05:22 UTC (rev 9017)
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/materials/GenMaxwellIsotropic3D.py
+##
+## @brief Python object implementing 3-D generalized isotropic linear Maxwell viscoelastic material.
+##
+## Factory: material.
+
+from ElasticMaterial import ElasticMaterial
+
+# GenMaxwellIsotropic3D class
+class GenMaxwellIsotropic3D(ElasticMaterial):
+  """
+  Python object implementing 3-D generalized isotropic linear Maxwell viscoelastic material.
+
+  Factory: material.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="genmaxwellisotropic3d"):
+    """
+    Constructor.
+    """
+    ElasticMaterial.__init__(self, name)
+    return
+
+
+  def _createCppHandle(self):
+    """
+    Create handle to corresponding C++ object.
+    """
+    if None == self.cppHandle:
+      import pylith.materials.materials as bindings
+      self.cppHandle = bindings.GenMaxwellIsotropic3D()
+      self.dimension = self.cppHandle.dimension
+    return
+  
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def material():
+  """
+  Factory associated with GenMaxwellIsotropic3D.
+  """
+  return GenMaxwellIsotropic3D()
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/pylith/materials/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/__init__.py	2008-01-14 21:03:07 UTC (rev 9016)
+++ short/3D/PyLith/trunk/pylith/materials/__init__.py	2008-01-14 21:05:22 UTC (rev 9017)
@@ -23,7 +23,8 @@
            'ElasticStress1D',
            'Homogeneous',
            'Material',
-           'MaxwellIsotropic3D']
+           'MaxwellIsotropic3D',
+           'GenMaxwellIsotropic3D']
 
 
 # End of file



More information about the cig-commits mailing list