[cig-commits] r16213 - in short/3D/PyLith/trunk: libsrc/faults libsrc/friction unittests/libtests/friction unittests/libtests/friction/data

brad at geodynamics.org brad at geodynamics.org
Tue Feb 2 15:09:07 PST 2010


Author: brad
Date: 2010-02-02 15:09:07 -0800 (Tue, 02 Feb 2010)
New Revision: 16213

Modified:
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.cc
   short/3D/PyLith/trunk/libsrc/friction/FrictionModel.cc
   short/3D/PyLith/trunk/libsrc/friction/FrictionModel.hh
   short/3D/PyLith/trunk/unittests/libtests/friction/TestFrictionModel.cc
   short/3D/PyLith/trunk/unittests/libtests/friction/data/tri3.mesh
Log:
Fixed computing weighted average of parameters.

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.cc	2010-02-02 16:56:02 UTC (rev 16212)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.cc	2010-02-02 23:09:07 UTC (rev 16213)
@@ -136,7 +136,7 @@
 
   // Setup fault constitutive model.
   assert(0 != _friction);
-  _friction->initialize(*_faultMesh, _quadrature);
+  _friction->initialize(*_faultMesh, _quadrature, _fields->get("area"));
 
   // Create field for diagonal entries of Jacobian at conventional
   // vertices i and j associated with Lagrange vertex k

Modified: short/3D/PyLith/trunk/libsrc/friction/FrictionModel.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/FrictionModel.cc	2010-02-02 16:56:02 UTC (rev 16212)
+++ short/3D/PyLith/trunk/libsrc/friction/FrictionModel.cc	2010-02-02 23:09:07 UTC (rev 16213)
@@ -100,7 +100,8 @@
 void
 pylith::friction::FrictionModel::initialize(
 			const topology::SubMesh& faultMesh,
-			feassemble::Quadrature<topology::SubMesh>* quadrature)
+			feassemble::Quadrature<topology::SubMesh>* quadrature,
+			const topology::Field<topology::SubMesh>& area)
 { // initialize
   assert(0 != _dbProperties);
   assert(0 != quadrature);
@@ -226,19 +227,27 @@
   // Close properties database
   _dbProperties->close();
 
+  _properties->complete(); // Assemble contributions
+
   // Loop over vertices and divide by area to get weighted values and
   // nondimensionalize properties.
+  const ALE::Obj<RealSection>& areaSection = area.section();
+  assert(!areaSection.isNull());
+
   double_array propertiesVertex(_numPropsVertex);
+  double areaVertex = 0.0;
   for (SieveSubMesh::label_sequence::iterator v_iter=verticesBegin;
        v_iter != verticesEnd;
        ++v_iter) {
     propertiesSection->restrictPoint(*v_iter,
         &propertiesVertex[0], propertiesVertex.size());
     _nondimProperties(&propertiesVertex[0], _numPropsVertex);
+    areaSection->restrictPoint(*v_iter, &areaVertex, 1);
+    assert(areaVertex > 0.0);
+    propertiesVertex /= areaVertex;
     propertiesSection->updatePoint(*v_iter, &propertiesVertex[0]);
   } // for
 
-
   // Create field to hold state variables. We create the field even
   // if there is no initial state, because this we will use this field
   // to hold the state variables.
@@ -326,6 +335,8 @@
     // Close database
     _dbInitialState->close();
 
+    _stateVars->complete(); // Assemble contributions.
+
     // Loop over vertices and divide by area to get weighted values and
     // nondimensionalize properties.
     double_array stateVarsVertex(_numVarsVertex);
@@ -336,6 +347,9 @@
       stateVarsSection->restrictPoint(*v_iter,
           &stateVarsVertex[0], stateVarsVertex.size());
       _nondimStateVars(&stateVarsVertex[0], _numVarsVertex);
+      areaSection->restrictPoint(*v_iter, &areaVertex, 1);
+      assert(areaVertex > 0.0);
+      stateVarsVertex /= areaVertex;
       stateVarsSection->updatePoint(*v_iter, &stateVarsVertex[0]);
     } // for
   } // if

Modified: short/3D/PyLith/trunk/libsrc/friction/FrictionModel.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/friction/FrictionModel.hh	2010-02-02 16:56:02 UTC (rev 16212)
+++ short/3D/PyLith/trunk/libsrc/friction/FrictionModel.hh	2010-02-02 23:09:07 UTC (rev 16213)
@@ -108,12 +108,14 @@
    * @pre Must call Quadrature::computeGeometry() before calling
    * initialize().
    *
-   * @param mesh Finite-element mesh.
+   * @param mesh Finite-element mesh of subdomain.
    * @param quadrature Quadrature for finite-element integration
+   * @param area Area at vertices of subdomain.
    */
   virtual
   void initialize(const topology::SubMesh& mesh,
-		  feassemble::Quadrature<topology::SubMesh>* quadrature);
+		  feassemble::Quadrature<topology::SubMesh>* quadrature,
+		  const topology::Field<topology::SubMesh>& area);
   
   /** Check whether friction model has a field as a property.
    *

Modified: short/3D/PyLith/trunk/unittests/libtests/friction/TestFrictionModel.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/TestFrictionModel.cc	2010-02-02 16:56:02 UTC (rev 16212)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/TestFrictionModel.cc	2010-02-02 23:09:07 UTC (rev 16213)
@@ -682,23 +682,6 @@
   fault->adjustTopology(mesh, &firstFaultVertex, &firstLagrangeVertex,
       &firstFaultCell, flipFault);
 
-  const double upDir[] = { 0.0, 0.0, 1.0 };
-  const double normalDir[] = { 1.0, 0.0, 0.0 };
-  fault->initialize(*mesh, upDir, normalDir);
-
-  // Get cells associated with fault
-  const ALE::Obj<SieveSubMesh>& faultSieveMesh = fault->faultMesh().sieveMesh();
-  CPPUNIT_ASSERT(!faultSieveMesh.isNull());
-  const ALE::Obj<SieveSubMesh::label_sequence>& cells =
-    faultSieveMesh->heightStratum(0);
-  CPPUNIT_ASSERT(!cells.isNull());
-
-  // Compute geometry for cells
-  quadrature.initializeGeometry();
-#if defined(PRECOMPUTE_GEOMETRY)
-  quadrature.computeGeometry(fault->faultMesh(), cells);
-#endif
-
   spatialdata::spatialdb::SimpleDB db;
   spatialdata::spatialdb::SimpleIOAscii dbIO;
   dbIO.filename("data/friction_static.spatialdb");
@@ -708,8 +691,11 @@
   friction->dbProperties(&db);
   friction->label("my_friction");
   friction->normalizer(normalizer);
+  fault->frictionModel(friction);
   
-  friction->initialize(fault->faultMesh(), &quadrature);
+  const double upDir[] = { 0.0, 0.0, 1.0 };
+  const double normalDir[] = { 1.0, 0.0, 0.0 };
+  fault->initialize(*mesh, upDir, normalDir);
 } // _initialize
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/friction/data/tri3.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/friction/data/tri3.mesh	2010-02-02 16:56:02 UTC (rev 16212)
+++ short/3D/PyLith/trunk/unittests/libtests/friction/data/tri3.mesh	2010-02-02 23:09:07 UTC (rev 16213)
@@ -6,8 +6,8 @@
     count = 4
     coordinates = {
              0     -1.0  0.0
-             1      0.0  1.0
-             2      0.0 -1.0
+             1      0.0  2.0
+             2      0.0 -2.0
              3      1.0  0.0
     }
   }



More information about the CIG-COMMITS mailing list