[cig-commits] r12056 - in short/3D/PyLith/trunk/unittests/libtests: bc faults feassemble

willic3 at geodynamics.org willic3 at geodynamics.org
Thu May 29 12:49:14 PDT 2008


Author: willic3
Date: 2008-05-29 12:49:13 -0700 (Thu, 29 May 2008)
New Revision: 12056

Modified:
   short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit1DLinear.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit1DQuadratic.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit2DLinear.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit2DQuadratic.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit3DLinear.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit3DQuadratic.cc
Log:
Added GravityField and made associated changes.
Gravity should now be included in integrateResidual for implicit elasticity
problems.  Also, coordinate system is now passed along with mesh object for
anything that uses integrateResidual.
Body forces have not yet been tested, but they do not appear to break any
of the unit tests.  New unit tests and examples will need to be added.




Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -134,10 +134,14 @@
   topology::FieldsManager fields(mesh);
   _initialize(&mesh, &bc, &fields);
 
+  spatialdata::geocoords::CSCart cs;
+  cs.setSpaceDim((mesh)->getDimension());
+  cs.initialize();
+
   const ALE::Obj<real_section_type>& residual = fields.getReal("residual");
   CPPUNIT_ASSERT(!residual.isNull());
   const double t = 1.0;
-  bc.integrateResidual(residual, t, &fields, mesh);
+  bc.integrateResidual(residual, t, &fields, mesh, &cs);
 
   const double* valsE = _data->valsResidual;
   const int totalNumVertices = mesh->depthStratum(0)->size();

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.hh	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.hh	2008-05-29 19:49:13 UTC (rev 12056)
@@ -86,6 +86,7 @@
    *
    * @param mesh PETSc mesh to initialize
    * @param bc AbsorbingDampers boundary condition to initialize.
+   * @param cs Mesh coordinate system.
    * @param fields Solution fields.
    */
   void _initialize(ALE::Obj<Mesh>* mesh,

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -168,13 +168,17 @@
   topology::FieldsManager fields(mesh);
   _initialize(&mesh, &bc, &fields);
 
+  spatialdata::geocoords::CSCart cs;
+  cs.setSpaceDim(mesh->getDimension());
+  cs.initialize();
+
   const ALE::Obj<real_section_type>& residual = fields.getReal("residual");
   CPPUNIT_ASSERT(!residual.isNull());
 
   const int spaceDim = _data->spaceDim;
 
   const double t = 0.0;
-  bc.integrateResidual(residual, t, &fields, mesh);
+  bc.integrateResidual(residual, t, &fields, mesh, &cs);
 
   const double* valsE = _data->valsResidual;
   const int totalNumVertices = mesh->depthStratum(0)->size();

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -204,6 +204,10 @@
   FaultCohesiveKin fault;
   _initialize(&mesh, &fault);
 
+  spatialdata::geocoords::CSCart cs;
+  cs.setSpaceDim((mesh)->getDimension());
+  cs.initialize();
+
   // Setup fields
   topology::FieldsManager fields(mesh);
   fields.addReal("residual");
@@ -238,7 +242,7 @@
   fault.timeStep(dt);
   { // Integrate residual with solution (as opposed to solution increment).
     fault.useSolnIncr(false);
-    fault.integrateResidual(residual, t, &fields, mesh);
+    fault.integrateResidual(residual, t, &fields, mesh, &cs);
 
     //residual->view("RESIDUAL"); // DEBUGGING
 
@@ -273,7 +277,7 @@
   residual->zero();
   { // Integrate residual with solution increment.
     fault.useSolnIncr(true);
-    fault.integrateResidual(residual, t, &fields, mesh);
+    fault.integrateResidual(residual, t, &fields, mesh, &cs);
 
     //residual->view("RESIDUAL"); // DEBUGGING
 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -24,6 +24,7 @@
 #include "spatialdata/geocoords/CSCart.hh" // USES CSCart
 #include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
 #include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii
+#include "spatialdata/spatialdb/GravityField.hh" // USES GravityField
 
 #include <math.h> // USES fabs()
 
@@ -40,6 +41,7 @@
   _data = 0;
   _quadrature = 0;
   _material = 0;
+  _gravityField = 0;
 } // setUp
 
 // ----------------------------------------------------------------------
@@ -50,6 +52,7 @@
   delete _data; _data = 0;
   delete _quadrature; _quadrature = 0;
   delete _material; _material = 0;
+  delete _gravityField; _gravityField = 0;
 } // tearDown
 
 // ----------------------------------------------------------------------
@@ -175,10 +178,14 @@
   topology::FieldsManager fields(mesh);
   _initialize(&mesh, &integrator, &fields);
 
+  spatialdata::geocoords::CSCart cs;
+  cs.setSpaceDim((mesh)->getDimension());
+  cs.initialize();
+
   const ALE::Obj<real_section_type>& residual = fields.getReal("residual");
   CPPUNIT_ASSERT(!residual.isNull());
   const double t = 1.0;
-  integrator.integrateResidual(residual, t, &fields, mesh);
+  integrator.integrateResidual(residual, t, &fields, mesh, &cs);
 
   const double* valsE = _data->valsResidual;
   const int sizeE = _data->spaceDim * _data->numVertices;
@@ -311,6 +318,9 @@
 			  _data->quadWts, _data->cellDim, _data->numBasis,
 			  _data->numQuadPts, _data->spaceDim);
 
+  // Setup gravityField
+  _gravityField = 0;
+
   // Setup material
   spatialdata::spatialdb::SimpleIOAscii iohandler;
   iohandler.filename(_data->matDBFilename);
@@ -323,6 +333,7 @@
   _material->initialize(*mesh, &cs, _quadrature);
 
   integrator->quadrature(_quadrature);
+  integrator->gravityField(_gravityField);
   integrator->timeStep(_data->dt);
   integrator->material(_material);
 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.hh	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.hh	2008-05-29 19:49:13 UTC (rev 12056)
@@ -25,6 +25,8 @@
 
 #include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
 
+#include "spatialdata/spatialdb/GravityField.hh" // USES GravityField
+
 /// Namespace for pylith package
 namespace pylith {
   namespace feassemble {
@@ -44,6 +46,12 @@
   } // topology
 } // pylith
 
+namespace spatialdata {
+  namespace spatialdb {
+    class GravityField; // HOLDSA GravityField
+  } // spatialdb
+} // spatialdata
+
 /// C++ unit testing for ElasticityExplicit
 class pylith::feassemble::TestElasticityExplicit : public CppUnit::TestFixture
 { // class TestElasticityExplicit
@@ -102,6 +110,7 @@
   IntegratorData* _data; ///< Data for testing.
   materials::ElasticMaterial* _material; ///< Elastic material.
   Quadrature* _quadrature; ///< Quadrature information.
+  spatialdata::spatialdb::GravityField* _gravityField; ///< Gravity field.
 
   // PRIVATE METHODS ////////////////////////////////////////////////////
 private :

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -24,6 +24,7 @@
 #include "spatialdata/geocoords/CSCart.hh" // USES CSCart
 #include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
 #include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii
+#include "spatialdata/spatialdb/GravityField.hh" // USES GravityField
 
 #include <math.h> // USES fabs()
 
@@ -38,6 +39,7 @@
   _data = 0;
   _quadrature = 0;
   _material = 0;
+  _gravityField = 0;
 } // setUp
 
 // ----------------------------------------------------------------------
@@ -48,6 +50,7 @@
   delete _data; _data = 0;
   delete _quadrature; _quadrature = 0;
   delete _material; _material = 0;
+  delete _gravityField; _gravityField = 0;
 } // tearDown
 
 // ----------------------------------------------------------------------
@@ -166,10 +169,14 @@
   topology::FieldsManager fields(mesh);
   _initialize(&mesh, &integrator, &fields);
 
+  spatialdata::geocoords::CSCart cs;
+  cs.setSpaceDim((mesh)->getDimension());
+  cs.initialize();
+
   const ALE::Obj<real_section_type>& residual = fields.getReal("residual");
   CPPUNIT_ASSERT(!residual.isNull());
   const double t = 1.0;
-  integrator.integrateResidual(residual, t, &fields, mesh);
+  integrator.integrateResidual(residual, t, &fields, mesh, &cs);
 
   const double* valsE = _data->valsResidual;
   const int sizeE = _data->spaceDim * _data->numVertices;
@@ -304,6 +311,8 @@
   _quadrature->initialize(_data->basis, _data->basisDerivRef, _data->quadPts,
 			  _data->quadWts, _data->cellDim, _data->numBasis,
 			  _data->numQuadPts, _data->spaceDim);
+  // Setup gravityField
+  _gravityField = 0;
 
   // Setup material
   spatialdata::spatialdb::SimpleIOAscii iohandler;
@@ -317,6 +326,7 @@
   _material->initialize(*mesh, &cs, _quadrature);
 
   integrator->quadrature(_quadrature);
+  integrator->gravityField(_gravityField);
   integrator->timeStep(_data->dt);
   integrator->material(_material);
 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.hh	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.hh	2008-05-29 19:49:13 UTC (rev 12056)
@@ -25,6 +25,8 @@
 
 #include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
 
+#include "spatialdata/spatialdb/GravityField.hh" // USES GravityField
+
 /// Namespace for pylith package
 namespace pylith {
   namespace feassemble {
@@ -44,6 +46,12 @@
   } // topology
 } // pylith
 
+namespace spatialdata {
+  namespace spatialdb {
+    class GravityField; // HOLDSA GravityField
+  } // spatialdb
+} // spatialdata
+
 /// C++ unit testing for ElasticityImplicit
 class pylith::feassemble::TestElasticityImplicit : public CppUnit::TestFixture
 { // class TestElasticityImplicit
@@ -102,6 +110,7 @@
   IntegratorData* _data; ///< Data for testing.
   materials::ElasticMaterial* _material; ///< Elastic material.
   Quadrature* _quadrature; ///< Quadrature information.
+  spatialdata::spatialdb::GravityField* _gravityField; ///< Gravity field.
 
   // PRIVATE METHODS ////////////////////////////////////////////////////
 private :

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit1DLinear.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit1DLinear.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit1DLinear.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -30,6 +30,7 @@
 { // setUp
   _data = new ElasticityImplicitData1DLinear();
   _quadrature = new Quadrature1D();
+  _gravityField = 0;
   GeometryLine1D geometry;
   CPPUNIT_ASSERT(0 != _quadrature);
   _quadrature->refGeometry(&geometry);

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit1DQuadratic.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit1DQuadratic.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit1DQuadratic.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -30,6 +30,7 @@
 { // setUp
   _data = new ElasticityImplicitData1DQuadratic();
   _quadrature = new Quadrature1D();
+  _gravityField = 0;
   GeometryLine1D geometry;
   CPPUNIT_ASSERT(0 != _quadrature);
   _quadrature->refGeometry(&geometry);

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit2DLinear.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit2DLinear.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit2DLinear.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -30,6 +30,7 @@
 { // setUp
   _data = new ElasticityImplicitData2DLinear();
   _quadrature = new Quadrature2D();
+  _gravityField = 0;
   CPPUNIT_ASSERT(0 != _quadrature);
   GeometryTri2D geometry;
   _quadrature->refGeometry(&geometry);

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit2DQuadratic.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit2DQuadratic.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit2DQuadratic.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -30,6 +30,7 @@
 { // setUp
   _data = new ElasticityImplicitData2DQuadratic();
   _quadrature = new Quadrature2D();
+  _gravityField = 0;
   CPPUNIT_ASSERT(0 != _quadrature);
   GeometryTri2D geometry;
   _quadrature->refGeometry(&geometry);

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit3DLinear.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit3DLinear.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit3DLinear.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -30,6 +30,7 @@
 { // setUp
   _data = new ElasticityImplicitData3DLinear();
   _quadrature = new Quadrature3D();
+  _gravityField = 0;
   CPPUNIT_ASSERT(0 != _quadrature);
   GeometryTet3D geometry;
   _quadrature->refGeometry(&geometry);

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit3DQuadratic.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit3DQuadratic.cc	2008-05-29 19:46:22 UTC (rev 12055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit3DQuadratic.cc	2008-05-29 19:49:13 UTC (rev 12056)
@@ -30,6 +30,7 @@
 { // setUp
   _data = new ElasticityImplicitData3DQuadratic();
   _quadrature = new Quadrature3D();
+  _gravityField = 0;
   CPPUNIT_ASSERT(0 != _quadrature);
   GeometryTet3D geometry;
   _quadrature->refGeometry(&geometry);



More information about the cig-commits mailing list