[cig-commits] r17011 - in short/3D/PyLith/trunk: examples/3d/tet4 libsrc/faults pylith/faults pylith/meshio

knepley at geodynamics.org knepley at geodynamics.org
Wed Jun 16 16:49:18 PDT 2010


Author: knepley
Date: 2010-06-16 16:49:17 -0700 (Wed, 16 Jun 2010)
New Revision: 17011

Modified:
   short/3D/PyLith/trunk/examples/3d/tet4/dislocation.cfg
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.hh
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/trunk/pylith/meshio/OutputFaultDyn.py
   short/3D/PyLith/trunk/pylith/meshio/OutputFaultKin.py
Log:
Added output of the fault distribution


Modified: short/3D/PyLith/trunk/examples/3d/tet4/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/tet4/dislocation.cfg	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/examples/3d/tet4/dislocation.cfg	2010-06-16 23:49:17 UTC (rev 17011)
@@ -87,8 +87,8 @@
 writer.filename = dislocation-groundsurf.vtk
 
 # Give basename for vtk fault output.
-[pylithapp.timedependent.interfaces.fault.output.writer]
-filename = dislocation-fault.vtk
+[pylithapp.timedependent.interfaces.fault.output]
+writer.filename = dislocation-fault.vtk
 
 # Give basename for VTK output of state variables.
 [pylithapp.timedependent.materials.elastic.output]

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.cc	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.cc	2010-06-16 23:49:17 UTC (rev 17011)
@@ -1088,24 +1088,6 @@
 } // vertexField
 
 // ----------------------------------------------------------------------
-// Get cell field associated with integrator.
-const pylith::topology::Field<pylith::topology::SubMesh>&
-pylith::faults::FaultCohesiveDyn::cellField(const char* name,
-                                             const topology::SolutionFields* fields) { // cellField
-  // Should not reach this point if requested field was found
-  std::ostringstream msg;
-  msg << "Request for unknown cell field '" << name << "' for fault '"
-      << label() << ".";
-  throw std::runtime_error(msg.str());
-
-  // Satisfy return values
-  assert(0 != _fields);
-  const topology::Field<topology::SubMesh>& buffer = _fields->get(
-    "buffer (vector)");
-  return buffer;
-} // cellField
-
-// ----------------------------------------------------------------------
 void
 pylith::faults::FaultCohesiveDyn::_setupInitialTractions(void)
 { // _setupInitialTractions

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.hh	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.hh	2010-06-16 23:49:17 UTC (rev 17011)
@@ -125,16 +125,6 @@
   vertexField(const char* name,
 	      const topology::SolutionFields* fields =0);
 
-  /** Get cell field associated with integrator.
-   *
-   * @param name Name of cell field.
-   * @param fields Solution fields.
-   * @returns Cell field.
-   */
-  const topology::Field<topology::SubMesh>&
-  cellField(const char* name,
-	    const topology::SolutionFields* fields =0);
-
   // PRIVATE METHODS ////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2010-06-16 23:49:17 UTC (rev 17011)
@@ -245,24 +245,4 @@
   return buffer;
 } // vertexField
 
-// ----------------------------------------------------------------------
-// Get cell field associated with integrator.
-const pylith::topology::Field<pylith::topology::SubMesh>&
-pylith::faults::FaultCohesiveKin::cellField(const char* name,
-                                            const topology::SolutionFields* fields)
-{ // cellField
-  // Should not reach this point if requested field was found
-  std::ostringstream msg;
-  msg << "Request for unknown cell field '" << name << "' for fault '"
-      << label() << ".";
-  throw std::runtime_error(msg.str());
-
-  // Satisfy return values
-  assert(0 != _fields);
-  const topology::Field<topology::SubMesh>& buffer = _fields->get(
-    "buffer (vector)");
-  return buffer;
-} // cellField
-
-
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2010-06-16 23:49:17 UTC (rev 17011)
@@ -90,16 +90,6 @@
   vertexField(const char* name,
 	      const topology::SolutionFields* fields =0);
 
-  /** Get cell field associated with integrator.
-   *
-   * @param name Name of cell field.
-   * @param fields Solution fields.
-   * @returns Cell field.
-   */
-  const topology::Field<topology::SubMesh>&
-  cellField(const char* name,
-	    const topology::SolutionFields* fields =0);
-
   // PRIVATE TYPEDEFS ///////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc	2010-06-16 23:49:17 UTC (rev 17011)
@@ -122,6 +122,19 @@
   _quadrature->computeGeometry(*_faultMesh, cells);
 #endif
 
+  _fields->add("distribution", "distribution", pylith::topology::FieldBase::CELLS_FIELD, 1);
+  topology::Field<topology::SubMesh>& dist = _fields->get("distribution");
+  dist.allocate();
+  const ALE::Obj<RealSection>& distSection = dist.section();
+  assert(!distSection.isNull());
+  const double rank = (double) distSection->commRank();
+
+  // Loop over cells in fault mesh, compute area
+  for (SieveSubMesh::label_sequence::iterator c_iter = cellsBegin; c_iter
+      != cellsEnd; ++c_iter) {
+    distSection->updatePoint(*c_iter, &rank);
+  }
+
   // Compute orientation at vertices in fault mesh.
   _calcOrientation(upDir);
 
@@ -2203,5 +2216,28 @@
   PetscLogFlops(72);
 } // _adjustSoln3D
 
+// ----------------------------------------------------------------------
+// Get cell field associated with integrator.
+const pylith::topology::Field<pylith::topology::SubMesh>&
+pylith::faults::FaultCohesiveLagrange::cellField(const char* name,
+                                                 const topology::SolutionFields* fields)
+{ // cellField
+  if (0 == strcasecmp("distribution", name)) {
+    const topology::Field<topology::SubMesh>& dist = _fields->get("distribution");
+    return dist;
+  }
+  // Should not reach this point if requested field was found
+  std::ostringstream msg;
+  msg << "Request for unknown cell field '" << name << "' for fault '"
+      << label() << ".";
+  throw std::runtime_error(msg.str());
 
+  // Satisfy return values
+  assert(0 != _fields);
+  const topology::Field<topology::SubMesh>& buffer = _fields->get(
+    "buffer (vector)");
+  return buffer;
+} // cellField
+
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.hh	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.hh	2010-06-16 23:49:17 UTC (rev 17011)
@@ -188,6 +188,16 @@
   virtual
   void checkConstraints(const topology::Field<topology::Mesh>& solution) const;
 
+  /** Get cell field associated with integrator.
+   *
+   * @param name Name of cell field.
+   * @param fields Solution fields.
+   * @returns Cell field.
+   */
+  const topology::Field<topology::SubMesh>&
+  cellField(const char* name,
+	    const topology::SolutionFields* fields =0);
+
   // PROTECTED STRUCTS //////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py	2010-06-16 23:49:17 UTC (rev 17011)
@@ -81,7 +81,7 @@
                      "slip_rate",
                      "traction"]},
          'cell': \
-           {'info': [],
+           {'info': ["distribution"],
             'data': []}}
     return
 

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2010-06-16 23:49:17 UTC (rev 17011)
@@ -87,7 +87,7 @@
             'data': ["slip",
                      "traction_change"]},
          'cell': \
-           {'info': [],
+           {'info': ["distribution"],
             'data': []}}
     return
 

Modified: short/3D/PyLith/trunk/pylith/meshio/OutputFaultDyn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputFaultDyn.py	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputFaultDyn.py	2010-06-16 23:49:17 UTC (rev 17011)
@@ -53,7 +53,11 @@
                                                   "traction"])
   vertexDataFields.meta['tip'] = "Names of vertex data fields to output."
 
+  cellInfoFields = pyre.inventory.list("cell_info_fields",
+                                       default=["distribution"])
+  cellInfoFields.meta['tip'] = "Names of cell info fields to output."
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="outputfaultdyn"):
@@ -73,6 +77,7 @@
     OutputManagerSubMesh._configure(self)
     self.vertexInfoFields = self.inventory.vertexInfoFields
     self.vertexDataFields = self.inventory.vertexDataFields
+    self.cellInfoFields   = self.inventory.cellInfoFields
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/meshio/OutputFaultKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputFaultKin.py	2010-06-15 03:46:38 UTC (rev 17010)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputFaultKin.py	2010-06-16 23:49:17 UTC (rev 17011)
@@ -55,7 +55,11 @@
                                                   "traction_change"])
   vertexDataFields.meta['tip'] = "Names of vertex data fields to output."
 
+  cellInfoFields = pyre.inventory.list("cell_info_fields",
+                                       default=["distribution"])
+  cellInfoFields.meta['tip'] = "Names of cell info fields to output."
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="outputfaultkin"):
@@ -75,6 +79,7 @@
     OutputManagerSubMesh._configure(self)
     self.vertexInfoFields = self.inventory.vertexInfoFields
     self.vertexDataFields = self.inventory.vertexDataFields
+    self.cellInfoFields   = self.inventory.cellInfoFields
     return
 
 



More information about the CIG-COMMITS mailing list