[cig-commits] r14141 - in short/3D/PyLith/branches/pylith-swig: libsrc/materials unittests/libtests/materials unittests/libtests/materials/data
brad at geodynamics.org
brad at geodynamics.org
Tue Feb 24 18:00:25 PST 2009
Author: brad
Date: 2009-02-24 18:00:24 -0800 (Tue, 24 Feb 2009)
New Revision: 14141
Modified:
short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticIsotropic3D.cc
short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticPlaneStrain.cc
short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticPlaneStress.cc
short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticStrain1D.cc
short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticStress1D.cc
short/3D/PyLith/branches/pylith-swig/libsrc/materials/GenMaxwellIsotropic3D.hh
short/3D/PyLith/branches/pylith-swig/libsrc/materials/MaxwellIsotropic3D.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/TestMaxwellIsotropic3D.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticIsotropic3D.py
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticIsotropic3DData.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStrain.py
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStrainData.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStress.py
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStressData.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStrain1D.py
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStrain1DData.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStress1D.py
short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStress1DData.cc
Log:
Fixed use of initial strain, stress - stress0 = D (strain - strain0).
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticIsotropic3D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticIsotropic3D.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticIsotropic3D.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -240,12 +240,12 @@
const double mu2 = 2.0*mu;
- const double e11 = totalStrain[0] + initialStrain[0];
- const double e22 = totalStrain[1] + initialStrain[1];
- const double e33 = totalStrain[2] + initialStrain[2];
- const double e12 = totalStrain[3] + initialStrain[3];
- const double e23 = totalStrain[4] + initialStrain[4];
- const double e13 = totalStrain[5] + initialStrain[5];
+ const double e11 = totalStrain[0] - initialStrain[0];
+ const double e22 = totalStrain[1] - initialStrain[1];
+ const double e33 = totalStrain[2] - initialStrain[2];
+ const double e12 = totalStrain[3] - initialStrain[3];
+ const double e23 = totalStrain[4] - initialStrain[4];
+ const double e13 = totalStrain[5] - initialStrain[5];
const double s123 = lambda * (e11 + e22 + e33);
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticPlaneStrain.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticPlaneStrain.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticPlaneStrain.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -240,9 +240,9 @@
const double mu2 = 2.0*mu;
- const double e11 = totalStrain[0] + initialStrain[0];
- const double e22 = totalStrain[1] + initialStrain[1];
- const double e12 = totalStrain[2] + initialStrain[2];
+ const double e11 = totalStrain[0] - initialStrain[0];
+ const double e22 = totalStrain[1] - initialStrain[1];
+ const double e12 = totalStrain[2] - initialStrain[2];
const double s12 = lambda * (e11 + e22);
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticPlaneStress.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticPlaneStress.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticPlaneStress.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -242,9 +242,9 @@
const double lambda2mu = lambda + mu2;
const double lambdamu = lambda + mu;
- const double e11 = totalStrain[0] + initialStrain[0];
- const double e22 = totalStrain[1] + initialStrain[1];
- const double e12 = totalStrain[2] + initialStrain[2];
+ const double e11 = totalStrain[0] - initialStrain[0];
+ const double e22 = totalStrain[1] - initialStrain[1];
+ const double e12 = totalStrain[2] - initialStrain[2];
stress[0] =
(2.0*mu2*lambdamu * e11 + mu2*lambda * e22) / lambda2mu + initialStress[0];
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticStrain1D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticStrain1D.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticStrain1D.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -238,7 +238,7 @@
const double mu = properties[p_mu];
const double lambda = properties[p_lambda];
- const double e11 = totalStrain[0] + initialStrain[0];
+ const double e11 = totalStrain[0] - initialStrain[0];
stress[0] = (lambda + 2.0*mu) * e11 + initialStress[0];
PetscLogFlops(5);
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticStress1D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticStress1D.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/ElasticStress1D.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -238,7 +238,7 @@
const double mu = properties[p_mu];
const double lambda = properties[p_lambda];
- const double e11 = totalStrain[0] + initialStrain[0];
+ const double e11 = totalStrain[0] - initialStrain[0];
stress[0] = mu * (3.0*lambda+2.0*mu) / (lambda + mu) * e11 + initialStress[0];
PetscLogFlops(9);
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/GenMaxwellIsotropic3D.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/GenMaxwellIsotropic3D.hh 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/GenMaxwellIsotropic3D.hh 2009-02-25 02:00:24 UTC (rev 14141)
@@ -32,6 +32,10 @@
* model.
*/
+// :TODO: Rewrite as template over the number of Maxwell models?
+// We could instatiate for 2 and 3 models and provide example for how to
+// instantiate over other numbers of Maxwell models.
+
#if !defined(pylith_materials_genmaxwellisotropic3d_hh)
#define pylith_materials_genmaxwellisotropic3d_hh
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/MaxwellIsotropic3D.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/MaxwellIsotropic3D.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/MaxwellIsotropic3D.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -28,9 +28,6 @@
#include <sstream> // USES std::ostringstream
#include <stdexcept> // USES std::runtime_error
-// :QUESTION: Do we ignore initialStrain and only use initialStress
-// and state variables totalStrain and viscousStrain?
-
// ----------------------------------------------------------------------
namespace pylith {
namespace materials {
@@ -519,8 +516,6 @@
for (int iComp=0; iComp < tensorSize; ++iComp) {
devStressTpdt = mu2 * _viscousStrain[iComp];
- // :QUESTION: ASK CHARLES ABOUT COMMENT ON NEXT LINE
- // Later I will want to put in initial stresses.
stress[iComp] = diag[iComp] * meanStressTpdt + devStressTpdt +
initialStress[iComp];
} // for
@@ -693,6 +688,8 @@
const double diag[] = { 1.0, 1.0, 1.0, 0.0, 0.0, 0.0 };
+ // :TODO: Need to account for initial values for state variables
+ // and the initial strain??
for (int iComp=0; iComp < tensorSize; ++iComp) {
stateVars[s_totalStrain+iComp] = totalStrain[iComp];
stateVars[s_viscousStrain+iComp] =
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/TestMaxwellIsotropic3D.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/TestMaxwellIsotropic3D.hh 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/TestMaxwellIsotropic3D.hh 2009-02-25 02:00:24 UTC (rev 14141)
@@ -26,7 +26,6 @@
/// Namespace for pylith package
namespace pylith {
namespace materials {
- class MaxwellIsotropic3D;
class TestMaxwellIsotropic3D;
class MaxwellIsotropic3DElasticData;
class MaxwellIsotropic3DTimeDepData;
@@ -41,21 +40,27 @@
CPPUNIT_TEST_SUITE( TestMaxwellIsotropic3D );
CPPUNIT_TEST( testDBToProperties );
- CPPUNIT_TEST( testDBValues );
- CPPUNIT_TEST( testProperties );
+ CPPUNIT_TEST( testNonDimProperties );
+ CPPUNIT_TEST( testDimProperties );
+ CPPUNIT_TEST( testDBToStateVars );
+ CPPUNIT_TEST( testNonDimStateVars );
+ CPPUNIT_TEST( testDimStateVars );
+
CPPUNIT_TEST( test_calcDensity );
- CPPUNIT_TEST( testTimeStep );
- CPPUNIT_TEST( testUseElasticBehavior );
CPPUNIT_TEST( testCalcStressElastic );
CPPUNIT_TEST( testCalcStressTimeDep );
CPPUNIT_TEST( testCalcElasticConstsElastic );
CPPUNIT_TEST( testCalcElasticConstsTimeDep );
- CPPUNIT_TEST( testUsesUpdateProperties );
CPPUNIT_TEST( testUpdatePropertiesElastic );
CPPUNIT_TEST( testUpdatePropertiesTimeDep );
CPPUNIT_TEST( test_stableTimeStepImplicit );
+ CPPUNIT_TEST( testTimeStep );
+ CPPUNIT_TEST( testUseElasticBehavior );
+ CPPUNIT_TEST( testHasStateVars );
+
+
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticIsotropic3D.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticIsotropic3D.py 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticIsotropic3D.py 2009-02-25 02:00:24 UTC (rev 14141)
@@ -158,7 +158,7 @@
[C1123, C2223, C3323, C1223, C2323, C2313],
[C1113, C2213, C3313, C1213, C2313, C1313] ],
dtype=numpy.float64)
- stress = initialStress + numpy.dot(elastic, initialStrain + strain)
+ stress = numpy.dot(elastic,strain-initialStrain) + initialStress
return (elasticConsts, numpy.ravel(stress))
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticIsotropic3DData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticIsotropic3DData.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticIsotropic3DData.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -111,18 +111,18 @@
};
const double pylith::materials::ElasticIsotropic3DData::_stress[] = {
- 4.86210000e+07,
- 4.95220000e+07,
- 5.04230000e+07,
- 2.16240000e+07,
- 6.93250000e+06,
- 2.34260000e+07,
- 1.49118000e+07,
- 1.50280000e+07,
- 1.51442000e+07,
- 6.27480000e+06,
- 2.68444000e+06,
- 6.50720000e+06,
+ -2.24790000e+07,
+ -2.24780000e+07,
+ -2.24770000e+07,
+ -8.97600000e+06,
+ 6.61750000e+06,
+ -8.97400000e+06,
+ -2.82900000e+06,
+ -2.82800000e+06,
+ -2.82700000e+06,
+ -1.09800000e+06,
+ 2.60956000e+06,
+ -1.09600000e+06,
};
const double pylith::materials::ElasticIsotropic3DData::_elasticConsts[] = {
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStrain.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStrain.py 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStrain.py 2009-02-25 02:00:24 UTC (rev 14141)
@@ -137,7 +137,7 @@
dtype=numpy.float64)
initialStress = numpy.reshape(initialStressV, (tensorSize,1))
initialStrain = numpy.reshape(initialStrainV, (tensorSize,1))
- stress = numpy.dot(elastic, strain+initialStrain) + initialStress
+ stress = numpy.dot(elastic,strain-initialStrain) + initialStress
return (elasticConsts, numpy.ravel(stress))
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStrainData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStrainData.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStrainData.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -105,12 +105,12 @@
};
const double pylith::materials::ElasticPlaneStrainData::_stress[] = {
- 3.82710000e+07,
- 3.91720000e+07,
- 2.07230000e+07,
- 1.18590000e+07,
- 1.19752000e+07,
- 6.15860000e+06,
+ -1.79790000e+07,
+ -1.79780000e+07,
+ -8.97700000e+06,
+ -2.25300000e+06,
+ -2.25200000e+06,
+ -1.09900000e+06,
};
const double pylith::materials::ElasticPlaneStrainData::_elasticConsts[] = {
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStress.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStress.py 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStress.py 2009-02-25 02:00:24 UTC (rev 14141)
@@ -137,7 +137,7 @@
[C1122, C2222, C2212],
[C1112, C2212, C1212] ],
dtype=numpy.float64)
- stress = numpy.dot(elastic, strain+initialStrain) + initialStress
+ stress = numpy.dot(elastic,strain-initialStrain) + initialStress
return (elasticConsts, numpy.ravel(stress))
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStressData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStressData.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticPlaneStressData.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -105,12 +105,12 @@
};
const double pylith::materials::ElasticPlaneStressData::_stress[] = {
- 3.18210000e+07,
- 3.27220000e+07,
- 2.07230000e+07,
- 9.88140000e+06,
- 9.99760000e+06,
- 6.15860000e+06,
+ -1.49790000e+07,
+ -1.49780000e+07,
+ -8.97700000e+06,
+ -1.86900000e+06,
+ -1.86800000e+06,
+ -1.09900000e+06,
};
const double pylith::materials::ElasticPlaneStressData::_elasticConsts[] = {
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStrain1D.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStrain1D.py 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStrain1D.py 2009-02-25 02:00:24 UTC (rev 14141)
@@ -128,7 +128,7 @@
initialStrain = numpy.reshape(initialStrainV, (1,1))
elastic = numpy.array([ [C1111] ],
dtype=numpy.float64)
- stress = numpy.dot(elastic, strain+initialStrain) + initialStress
+ stress = numpy.dot(elastic,strain-initialStrain) + initialStress
return (elasticConsts, numpy.ravel(stress))
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStrain1DData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStrain1DData.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStrain1DData.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -101,8 +101,8 @@
};
const double pylith::materials::ElasticStrain1DData::_stress[] = {
- 2.83710000e+07,
- 8.86380000e+06,
+ -1.34790000e+07,
+ -1.67700000e+06,
};
const double pylith::materials::ElasticStrain1DData::_elasticConsts[] = {
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStress1D.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStress1D.py 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStress1D.py 2009-02-25 02:00:24 UTC (rev 14141)
@@ -128,7 +128,7 @@
initialStrain = numpy.reshape(initialStrainV, (1,1))
elastic = numpy.array([ [C1111] ],
dtype=numpy.float64)
- stress = initialStress + numpy.dot(elastic, initialStrain+strain)
+ stress = numpy.dot(elastic,strain-initialStrain) + initialStress
return (elasticConsts, numpy.ravel(stress))
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStress1DData.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStress1DData.cc 2009-02-25 00:23:19 UTC (rev 14140)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/data/ElasticStress1DData.cc 2009-02-25 02:00:24 UTC (rev 14141)
@@ -101,8 +101,8 @@
};
const double pylith::materials::ElasticStress1DData::_stress[] = {
- 2.36460000e+07,
- 7.39500000e+06,
+ -1.12290000e+07,
+ -1.38900000e+06,
};
const double pylith::materials::ElasticStress1DData::_elasticConsts[] = {
More information about the CIG-COMMITS
mailing list