[cig-commits] r8156 - in short/3D/PyLith/trunk: doc/userguide/boundaryconditions libsrc/bc unittests/libtests/bc unittests/libtests/bc/data

brad at geodynamics.org brad at geodynamics.org
Fri Oct 19 10:50:33 PDT 2007


Author: brad
Date: 2007-10-19 10:50:33 -0700 (Fri, 19 Oct 2007)
New Revision: 8156

Modified:
   short/3D/PyLith/trunk/doc/userguide/boundaryconditions/boundaryconditions.lyx
   short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataLine2.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/data/elasticstrain1d.spatialdb
Log:
Finished implementation of AbsorbingDampers. Unit tests now work for boundary in 1-D mesh. Fixed typo in absorbing dampers documentation.

Modified: short/3D/PyLith/trunk/doc/userguide/boundaryconditions/boundaryconditions.lyx
===================================================================
--- short/3D/PyLith/trunk/doc/userguide/boundaryconditions/boundaryconditions.lyx	2007-10-19 16:03:53 UTC (rev 8155)
+++ short/3D/PyLith/trunk/doc/userguide/boundaryconditions/boundaryconditions.lyx	2007-10-19 17:50:33 UTC (rev 8156)
@@ -876,7 +876,7 @@
 
 , we have
 \begin_inset Formula \begin{equation}
-\sum_{cells}(\int_{S_{t}^{e}}T_{i}\phi_{i}\, dS)=\sum_{cells}(\int_{S_{t}^{e}}-\rho c_{i}\sum_{p}N^{p}\dot{u}_{i}^{o}N^{q}\, dS).\end{equation}
+\sum_{cells}(\int_{S_{t}^{e}}T_{i}\phi_{i}\, dS)=\sum_{cells}(\int_{S_{t}^{e}}-\rho c_{i}\sum_{p}N^{p}\dot{u}_{i}N^{q}\, dS).\end{equation}
 
 \end_inset
 

Modified: short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc	2007-10-19 16:03:53 UTC (rev 8155)
+++ short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc	2007-10-19 17:50:33 UTC (rev 8156)
@@ -242,7 +242,6 @@
   const int cellVecSize = numBasis*spaceDim;
   double_array dispTpdtCell(cellVecSize);
   double_array dispTmdtCell(cellVecSize);
-  double_array dampingConstsCell(numQuadPts*spaceDim);
 
   for (Mesh::label_sequence::iterator c_iter=cells->begin();
        c_iter != cellsEnd;
@@ -283,7 +282,7 @@
     PetscLogFlopsNoCheck(numQuadPts*(3+numBasis*(1+numBasis*(5*spaceDim))));
 
     // Assemble cell contribution into field
-    mesh->updateAdd(residual, *c_iter, _cellVector);
+    _boundaryMesh->updateAdd(residual, *c_iter, _cellVector);
   } // for
 } // integrateResidual
 
@@ -332,7 +331,6 @@
   // Allocate vectors for cell values.
   _initCellVector();
   const int cellVecSize = numBasis*spaceDim;
-  double_array dampingConstsCell(numQuadPts*spaceDim);
 
   // Allocate vector for cell values (if necessary)
   _initCellMatrix();
@@ -350,6 +348,11 @@
     const double_array& basis = _quadrature->basis();
     const double_array& jacobianDet = _quadrature->jacobianDet();
 
+    // Restrict input fields to cell
+    assert(numQuadPts*spaceDim == _dampingConsts->getFiberDimension(*c_iter));
+    const real_section_type::value_type* dampingConstsCell = 
+      _dampingConsts->restrictPoint(*c_iter);
+
     // Compute Jacobian for absorbing bc terms
     for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
       const double wt = 
@@ -373,8 +376,7 @@
     const ALE::Obj<Mesh::order_type>& globalOrder = 
       mesh->getFactory()->getGlobalOrder(mesh, "default", dispT);
     assert(!globalOrder.isNull());
-
-    err = updateOperator(*jacobian, mesh, dispT, globalOrder,
+    err = updateOperator(*jacobian, _boundaryMesh, dispT, globalOrder,
 			 *c_iter, _cellMatrix, ADD_VALUES);
     if (err)
       throw std::runtime_error("Update to PETSc Mat failed.");

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc	2007-10-19 16:03:53 UTC (rev 8155)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc	2007-10-19 17:50:33 UTC (rev 8156)
@@ -133,8 +133,6 @@
   const double t = 1.0;
   bc.integrateResidual(residual, t, &fields, mesh);
 
-  residual->view("RESIDUAL");
-
   const double* valsE = _data->valsResidual;
   const int totalNumVertices = mesh->depthStratum(0)->size();
   const int sizeE = _data->spaceDim * totalNumVertices;
@@ -252,6 +250,7 @@
     spatialdata::spatialdb::SimpleIOAscii dbIO;
     dbIO.filename(_data->spatialDBFilename);
     db.ioHandler(&dbIO);
+    db.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
 
     const double upDirVals[] = { 0.0, 0.0, 1.0 };
     double_array upDir(upDirVals, 3);
@@ -280,7 +279,8 @@
     residual->zero();
     fields->copyLayout("residual");
     
-    const int fieldSize = _data->spaceDim * _data->numVertices;
+    const int totalNumVertices = (*mesh)->depthStratum(0)->size();
+    const int fieldSize = _data->spaceDim * totalNumVertices;
     const ALE::Obj<real_section_type>& dispTpdt = fields->getReal("dispTpdt");
     const ALE::Obj<real_section_type>& dispT = fields->getReal("dispT");
     const ALE::Obj<real_section_type>& dispTmdt = fields->getReal("dispTmdt");
@@ -288,7 +288,7 @@
     CPPUNIT_ASSERT(!dispT.isNull());
     CPPUNIT_ASSERT(!dispTmdt.isNull());
     const int offset = _data->numCells;
-    for (int iVertex=0; iVertex < _data->numVertices; ++iVertex) {
+    for (int iVertex=0; iVertex < totalNumVertices; ++iVertex) {
       dispTpdt->updatePoint(iVertex+offset, 
 			    &_data->fieldTpdt[iVertex*_data->spaceDim]);
       dispT->updatePoint(iVertex+offset, 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataLine2.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataLine2.cc	2007-10-19 16:03:53 UTC (rev 8155)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataLine2.cc	2007-10-19 17:50:33 UTC (rev 8156)
@@ -34,21 +34,21 @@
 const int pylith::bc::AbsorbingDampersDataLine2::_id = 2;
 const char* pylith::bc::AbsorbingDampersDataLine2::_label = "bc0";
 
-const double pylith::bc::AbsorbingDampersDataLine2::_dt =   1.00000000e-02;
+const double pylith::bc::AbsorbingDampersDataLine2::_dt =   0.25;
 const double pylith::bc::AbsorbingDampersDataLine2::_fieldTpdt[] = {
-  1.20000000e+00,
-  1.20000000e+00,
-  1.70000000e+00,
+  1.0,
+  1.1,
+  1.2,
 };
 const double pylith::bc::AbsorbingDampersDataLine2::_fieldT[] = {
-  1.10000000e+00,
-  1.10000000e+00,
-  1.50000000e+00,
+  1.1,
+  1.3,
+  1.5,
 };
 const double pylith::bc::AbsorbingDampersDataLine2::_fieldTmdt[] = {
-  1.00000000e+00,
-  1.00000000e+00,
-  1.30000000e+00,
+  1.2,
+  1.5,
+  1.8,
 };
 
 const int pylith::bc::AbsorbingDampersDataLine2::_spaceDim = 1;
@@ -63,18 +63,18 @@
 
 
 const double pylith::bc::AbsorbingDampersDataLine2::_dampingConsts[] = {
-  2500.0*6000.0,
-  2500.0*6000.0,
+  12.5e+6,
+  17.5e+6,
 };
 const double pylith::bc::AbsorbingDampersDataLine2::_valsResidual[] = {
+  12.5e+6*0.2/0.5,
   0.0,
-  0.0,
-  0.0,
+  17.5e+6*0.6/0.5,
 };
 const double pylith::bc::AbsorbingDampersDataLine2::_valsJacobian[] = {
+  12.5e+6/0.5, 0.0, 0.0,
   0.0, 0.0, 0.0,
-  0.0, 0.0, 0.0,
-  0.0, 0.0, 0.0,
+  0.0, 0.0, 17.5e+6/0.5,
 };
 
 pylith::bc::AbsorbingDampersDataLine2::AbsorbingDampersDataLine2(void)

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/elasticstrain1d.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/elasticstrain1d.spatialdb	2007-10-19 16:03:53 UTC (rev 8155)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/elasticstrain1d.spatialdb	2007-10-19 17:50:33 UTC (rev 8156)
@@ -3,12 +3,13 @@
   num-values = 3
   value-names =  density vs vp
   value-units =  kg/m^3  m/s  m/s
-  num-locs = 1
-  data-dim = 0
+  num-locs = 2
+  data-dim = 1
   space-dim = 1
   cs-data = cartesian {
     to-meters = 1.0
     space-dim = 1
   }
 }
-0.0  2500.0  3464.1016151377544 6000.0
+-1.0  2500.0  3000.0  5000.0
++1.0  2500.0  4000.0  7000.0



More information about the cig-commits mailing list