[cig-commits] r16503 - in short/3D/PyLith/trunk: libsrc/faults libsrc/feassemble modulesrc/faults modulesrc/feassemble pylith/problems

brad at geodynamics.org brad at geodynamics.org
Wed Apr 7 17:08:09 PDT 2010


Author: brad
Date: 2010-04-07 17:08:09 -0700 (Wed, 07 Apr 2010)
New Revision: 16503

Modified:
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.hh
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc
   short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveLagrange.i
   short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
Log:
Added check to make sure fault vertices are not constrained.

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc	2010-04-07 16:15:26 UTC (rev 16502)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc	2010-04-08 00:08:09 UTC (rev 16503)
@@ -735,6 +735,7 @@
     throw std::runtime_error(msg.str());
   } // if
 
+  // Check quadrature against mesh
   const int numCorners = _quadrature->refGeometry().numCorners();
   const ALE::Obj<SieveMesh::label_sequence>& cells =
       sieveMesh->getLabelStratum("material-id", id());
@@ -756,6 +757,46 @@
 } // verifyConfiguration
 
 // ----------------------------------------------------------------------
+// Verify constraints are acceptable.
+void
+pylith::faults::FaultCohesiveLagrange::checkConstraints(const topology::Field<topology::Mesh>& solution) const
+{ // checkConstraints Check to make sure no vertices connected to the
+  // fault are constrained.
+
+  const ALE::Obj<RealSection>& section = solution.section();
+  assert(!section.isNull());
+
+  const int spaceDim = solution.mesh().dimension();
+
+  const int numVertices = _cohesiveVertices.size();
+  for (int iVertex=0; iVertex < numVertices; ++iVertex) {
+    const int v_negative = _cohesiveVertices[iVertex].negative;    
+    const int fiberDimN = section->getFiberDimension(v_negative);
+    assert(spaceDim == fiberDimN);
+    const int numConstraintsN = section->getConstraintDimension(v_negative);
+    if (fiberDimN > numConstraintsN) {
+      std::ostringstream msg;
+      msg << "Vertex with label '" << v_negative << "' on negative side "
+	  << "of fault '" << label() << "' is constrained.\n"
+	  << "Fault vertices cannot be constrained.";
+      throw std::runtime_error(msg.str());
+    } // if
+    
+    const int v_positive = _cohesiveVertices[iVertex].positive;
+    const int fiberDimP = section->getFiberDimension(v_positive);
+    assert(spaceDim == fiberDimP);
+    const int numConstraintsP = section->getConstraintDimension(v_positive);
+    if (fiberDimP > numConstraintsP) {
+      std::ostringstream msg;
+      msg << "Vertex with label '" << v_positive << "' on positive side "
+	  << "of fault '" << label() << "' is constrained.\n"
+	  << "Fault vertices cannot be constrained.";
+      throw std::runtime_error(msg.str());
+    } // if
+  } // for
+} // checkConstraints
+
+// ----------------------------------------------------------------------
 // Initialize auxiliary cohesive cell information.
 void pylith::faults::FaultCohesiveLagrange::_initializeCohesiveInfo(const topology::Mesh& mesh)
 { // _initializeCohesiveInfo

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.hh	2010-04-07 16:15:26 UTC (rev 16502)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.hh	2010-04-08 00:08:09 UTC (rev 16503)
@@ -171,6 +171,13 @@
   virtual
   void verifyConfiguration(const topology::Mesh& mesh) const;
 
+  /** Verify constraints are acceptable.
+   *
+   * @param field Solution field.
+   */
+  virtual
+  void checkConstraints(const topology::Field<topology::Mesh>& solution) const;
+
   // PROTECTED STRUCTS //////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2010-04-07 16:15:26 UTC (rev 16502)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2010-04-08 00:08:09 UTC (rev 16503)
@@ -270,6 +270,13 @@
   virtual
   void verifyConfiguration(const topology::Mesh& mesh) const = 0;
 
+  /** Verify constraints are acceptable.
+   *
+   * @param field Solution field.
+   */
+  virtual
+  void checkConstraints(const topology::Field<topology::Mesh>& solution) const;
+
 // PROTECTED METHODS ////////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc	2010-04-07 16:15:26 UTC (rev 16502)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc	2010-04-08 00:08:09 UTC (rev 16503)
@@ -181,8 +181,15 @@
 			const topology::Field<topology::Mesh>& jacobian) {
 } // adjustSolnLumped
 
+// Verify constraints are acceptable.
+template<typename quadrature_type>
+inline
+void
+pylith::feassemble::Integrator<quadrature_type>::checkConstraints(const topology::Field<topology::Mesh>& solution) const {
+} // checkConstraints
 
 
+
 #endif
 
 // End of file

Modified: short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveLagrange.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveLagrange.i	2010-04-07 16:15:26 UTC (rev 16502)
+++ short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveLagrange.i	2010-04-08 00:08:09 UTC (rev 16503)
@@ -110,6 +110,13 @@
        */
       void verifyConfiguration(const pylith::topology::Mesh& mesh) const;
       
+      /** Verify constraints are acceptable.
+       *
+       * @param field Solution field.
+       */
+      virtual
+      void checkConstraints(const pylith::topology::Field<pylith::topology::Mesh>& solution) const;
+      
     }; // class FaultCohesiveLagrange
 
   } // faults

Modified: short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i	2010-04-07 16:15:26 UTC (rev 16502)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i	2010-04-08 00:08:09 UTC (rev 16503)
@@ -198,7 +198,14 @@
       virtual
       void verifyConfiguration(const pylith::topology::Mesh& mesh) const = 0;
 
+      /** Verify constraints are acceptable.
+       *
+       * @param field Solution field.
+       */
+      virtual
+      void checkConstraints(const pylith::topology::Field<pylith::topology::Mesh>& solution) const;
 
+
     }; // Integrator
 
   } // feassemble

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2010-04-07 16:15:26 UTC (rev 16502)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2010-04-08 00:08:09 UTC (rev 16503)
@@ -237,6 +237,9 @@
     solution.allocate()
     for constraint in self.constraints:
       constraint.setConstraints(solution)
+    for integrator in self.integratorsMesh + self.integratorsSubMesh:
+      integrator.checkConstraints(solution)
+
     memoryLogger.stagePop()
 
     # This creates a global order



More information about the CIG-COMMITS mailing list