[cig-commits] r9229 - in short/3D/PyLith/trunk: . pylith pylith/faults pylith/feassemble pylith/materials pylith/meshio

brad at geodynamics.org brad at geodynamics.org
Mon Feb 4 22:19:40 PST 2008


Author: brad
Date: 2008-02-04 22:19:40 -0800 (Mon, 04 Feb 2008)
New Revision: 9229

Added:
   short/3D/PyLith/trunk/pylith/meshio/OutputMatElastic.py
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/pylith/Makefile.am
   short/3D/PyLith/trunk/pylith/faults/Fault.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
   short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
   short/3D/PyLith/trunk/pylith/materials/ElasticMaterial.py
   short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStrain.py
   short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStress.py
   short/3D/PyLith/trunk/pylith/materials/ElasticStrain1D.py
   short/3D/PyLith/trunk/pylith/materials/ElasticStress1D.py
   short/3D/PyLith/trunk/pylith/materials/Material.py
   short/3D/PyLith/trunk/pylith/meshio/__init__.py
Log:
Worked on output for material information.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/TODO	2008-02-05 06:19:40 UTC (rev 9229)
@@ -7,20 +7,20 @@
   1. Finish Neumann BC [CHARLES]
 
   2. Reimplement SolutionIO [BRAD & MATT]
-     a. Implement output of fault data.
-       Need to finish implementing output of traction_change.
      b. Implement output of material information.
         i. CellFilterAvg (average data over quadrature points)
      c. Implement output of Neumann information.
-        i. BoundaryCondition::writeInfo()?
      d. Implement output of Dirichlet information.
-        i. DirichletBoundary versus DirichletPoints
+        i. DirichletBoundary
+        ii.  DirichletPoints
      e. Implement output of solution subset (ground surface).
         i. OutputSubdomain
         ii. OutputPoints
      f. VertexFilterChangeCS
         i. OutputFilter for writing vertex coordinates in another 
            coordinate system.
+     a. Implement output of fault data.
+       Need to finish implementing output of traction_change.
      g. DataWriterHDF5
 
      Use Cases

Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/Makefile.am	2008-02-05 06:19:40 UTC (rev 9229)
@@ -87,6 +87,7 @@
 	meshio/OutputManager.py \
 	meshio/OutputSoln.py \
 	meshio/OutputFaultKin.py \
+	meshio/OutputMatElastic.py \
 	meshio/SingleOutput.py \
 	meshio/VertexFilter.py \
 	problems/__init__.py \

Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -116,6 +116,7 @@
     Component.__init__(self, name, facility="fault")
     self.cppHandle = None
     self.mesh = None
+    self.output = None
     return
 
 
@@ -144,6 +145,10 @@
     
     self.quadrature.preinitialize()    
     self.cppHandle.quadrature = self.quadrature.cppHandle
+
+    if None != self.output:
+      self.output.preinitialize(self)
+
     return
   
 
@@ -159,6 +164,10 @@
             (self.quadrature.cell.cellDim, faultDim)
 
     # :TODO: Make sure mesh has group of vertices with label.
+
+    if None != self.output:
+      self.output.verifyConfiguration()
+
     return
   
 
@@ -178,9 +187,24 @@
     self.faultMesh = Mesh()
     self.faultMesh.initialize(self.mesh.coordsys)
     self.cppHandle.faultMesh(self.faultMesh.cppHandle)
+
+    if None != self.output:
+      self.output.initialize(self.quadrature.cppHandle)
+      self.output.writeInfo()
+      self.output.open(totalTime, numTimeSteps)
+
     return
 
 
+  def poststep(self, t, dt, totalTime):
+    """
+    Hook for doing stuff after advancing time step.
+    """
+    self._info.log("Writing fault data.")
+    self.output.writeData(t+dt)
+    return
+
+
   def getDataMesh(self):
     """
     Get mesh associated with data fields.
@@ -188,6 +212,22 @@
     return (self.faultMesh, None, None)
 
 
+  def getVertexField(self, name):
+    """
+    Get vertex field.
+    """
+    raise NotImplementedError("Material.getVertexField() not implemented.")
+    return
+
+
+  def getCellField(self, name):
+    """
+    Get cell field.
+    """
+    raise NotImplementedError("Material.getCellField() not implemented.")
+    return
+
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -93,7 +93,6 @@
     assert(None != self.cppHandle)
     self.eqsrc.preinitialize()
     self.cppHandle.eqsrc = self.eqsrc.cppHandle
-    self.output.preinitialize(self)
 
     if mesh.dimension() == 2:
       self.availableFields['vertex']['info'] += ["strike_dir"]
@@ -109,7 +108,6 @@
     """
     FaultCohesive.verifyConfiguration(self)
     Integrator.verifyConfiguration(self)
-    self.output.verifyConfiguration()
     return
 
 
@@ -123,9 +121,6 @@
     self._logger.eventBegin(logEvent)
     self.eqsrc.initialize()
     FaultCohesive.initialize(self, totalTime, numTimeSteps)
-    self.output.initialize(self.quadrature.cppHandle)
-    self.output.writeInfo()
-    self.output.open(totalTime, numTimeSteps)
 
     self._logger.eventEnd(logEvent)
     return
@@ -138,8 +133,7 @@
     logEvent = "%spoststep" % self._loggingPrefix
     self._logger.eventBegin(logEvent)
 
-    self._info.log("Writing fault data.")
-    self.output.writeData(t+dt)
+    FaultCohesive.poststep(self, t, dt, totalTime)
 
     self._logger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -67,7 +67,7 @@
     self._info.log("Initializing integrator for material '%s'." % \
                    self.material.label)
 
-    self.material.initialize(self.mesh)
+    self.material.initialize(self.mesh, totalTime, numTimeSteps)
 
     self._logger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -33,6 +33,13 @@
     Constructor.
     """
     ElasticMaterial.__init__(self, name)
+    self.availableFields = \
+        {'vertex': \
+           {'info': [],
+            'data': []},
+         'cell': \
+           {'info': ["vp", "vs", "density"],
+            'data': []}}
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/materials/ElasticMaterial.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticMaterial.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticMaterial.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -28,6 +28,30 @@
   Factory: material
   """
 
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(Material.Inventory):
+    """
+    Python object for managing FaultCohesiveKin facilities and properties.
+    """
+    
+    ## @class Inventory
+    ## Python object for managing FaultCohesiveKin facilities and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li \b output Output manager associated with fault data.
+
+    import pyre.inventory
+
+    from pylith.meshio.OutputMatElastic import OutputMatElastic
+    output = pyre.inventory.facility("output", family="output_manager",
+                                     factory=OutputMatElastic)
+    output.meta['tip'] = "Output manager for elastic material information."
+
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="elasticmaterial"):
@@ -47,6 +71,13 @@
     return
 
 
+  def getCellField(self, name):
+    """
+    Get cell field.
+    """
+    return self.cppHandle.cellField(name, self.mesh.cppHandle)
+
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStrain.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStrain.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStrain.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -35,6 +35,13 @@
     Constructor.
     """
     ElasticMaterial.__init__(self, name)
+    self.availableFields = \
+        {'vertex': \
+           {'info': [],
+            'data': []},
+         'cell': \
+           {'info': ["vp", "density"],
+            'data': []}}
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStress.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStress.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStress.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -35,6 +35,13 @@
     Constructor.
     """
     ElasticMaterial.__init__(self, name)
+    self.availableFields = \
+        {'vertex': \
+           {'info': [],
+            'data': []},
+         'cell': \
+           {'info': ["vp", "vs", "density"],
+            'data': []}}
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/materials/ElasticStrain1D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticStrain1D.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticStrain1D.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -34,6 +34,13 @@
     Constructor.
     """
     ElasticMaterial.__init__(self, name)
+    self.availableFields = \
+        {'vertex': \
+           {'info': [],
+            'data': []},
+         'cell': \
+           {'info': ["vp", "density"],
+            'data': []}}
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/materials/ElasticStress1D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticStress1D.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticStress1D.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -34,6 +34,13 @@
     Constructor.
     """
     ElasticMaterial.__init__(self, name)
+    self.availableFields = \
+        {'vertex': \
+           {'info': [],
+            'data': []},
+         'cell': \
+           {'info': ["vp", "density"],
+            'data': []}}
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -83,6 +83,7 @@
     Component.__init__(self, name, facility="material")
     self.cppHandle = None
     self.dimension = None
+    self.output = None
     return
 
 
@@ -94,6 +95,8 @@
     self.cppHandle.id = self.id
     self.cppHandle.label = self.label
     self.quadrature.preinitialize()
+    if None != self.output:
+      self.output.preinitialize(self)
     return
 
 
@@ -111,22 +114,65 @@
     # :TODO: Make sure mesh contains material (need to account for the
     # fact that any given processor may only have a subset of the
     # materials)
+
+    if None != self.output:
+      self.output.verifyConfiguration()
+
     return
   
 
-  def initialize(self, mesh):
+  def initialize(self, mesh, totalTime, numTimeSteps):
     """
     Initialize material property manager.
     """
     self._info.log("Initializing material '%s'." % self.label)
+    self.mesh = mesh
     assert(None != self.cppHandle)
     self.db.initialize()
     self.cppHandle.db = self.db.cppHandle
     self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle,
                               self.quadrature.cppHandle)
+
+    if None != self.output:
+      self.output.initialize(self.quadrature.cppHandle)
+      self.output.writeInfo()
+      self.output.open(totalTime, numTimeSteps)
     return
 
 
+  def poststep(self, t, dt, totalTime):
+    """
+    Hook for doing stuff after advancing time step.
+    """
+    if None != self.output:
+      self._info.log("Writing material data.")
+      self.output.writeData(t+dt)
+    return
+
+
+  def getDataMesh(self):
+    """
+    Get mesh associated with data fields.
+    """
+    return (self.mesh, "material-id", self.label)
+
+
+  def getVertexField(self, name):
+    """
+    Get vertex field.
+    """
+    raise NotImplementedError("Material.getVertexField() not implemented.")
+    return
+
+
+  def getCellField(self, name):
+    """
+    Get cell field.
+    """
+    raise NotImplementedError("Material.getCellField() not implemented.")
+    return
+
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Added: short/3D/PyLith/trunk/pylith/meshio/OutputMatElastic.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputMatElastic.py	                        (rev 0)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputMatElastic.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pyre/meshio/OutputMatElastic.py
+##
+## @brief Python object for managing output of finite-element
+## information for faults with kinematic ruptures.
+##
+## Factory: output_manager
+
+from OutputManager import OutputManager
+
+# OutputMatElastic class
+class OutputMatElastic(OutputManager):
+  """
+  Python object for managing output of finite-element information for
+  faults with kinematic ruptures.
+
+  Factory: output_manager
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(OutputManager.Inventory):
+    """
+    Python object for managing OutputMatElastic facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing OutputMatElastic facilities and properties.
+    ##
+    ## \b Properties
+    ## @li \b vertex_info_fields Names of vertex info fields to output.
+    ## @li \b vertex_data_fields Names of vertex data fields to output.
+    ## @li \b cell_info_fields Names of cell info fields to output.
+    ## @li \b cell_data_fields Names of cell data fields to output.
+    ##
+    ## \b Facilities
+    ## @li None
+
+    import pyre.inventory
+
+    vertexInfoFields = pyre.inventory.list("vertex_info_fields",
+                                           default=[])
+    vertexInfoFields.meta['tip'] = "Names of vertex info fields to output."
+
+    vertexDataFields = pyre.inventory.list("vertex_data_fields", 
+                                           default=[])
+    vertexDataFields.meta['tip'] = "Names of vertex data fields to output."
+
+    cellInfoFields = pyre.inventory.list("cell_info_fields", default=[])
+    cellInfoFields.meta['tip'] = "Names of cell info fields to output."
+
+    cellDataFields = pyre.inventory.list("cell_data_fields", 
+                                         default=[])
+    cellDataFields.meta['tip'] = "Names of cell data fields to output."
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="outputmanager"):
+    """
+    Constructor.
+    """
+    OutputManager.__init__(self, name)
+    return
+
+    
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based using inventory.
+    """
+    OutputManager._configure(self)
+    self.vertexInfoFields = self.inventory.vertexInfoFields
+    self.vertexDataFields = self.inventory.vertexDataFields
+    self.cellInfoFields = self.inventory.cellInfoFields
+    self.cellDataFields = self.inventory.cellDataFields
+    return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def output_manager():
+  """
+  Factory associated with OutputMatElastic.
+  """
+  return OutputMatElastic()
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/pylith/meshio/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/__init__.py	2008-02-05 01:51:01 UTC (rev 9228)
+++ short/3D/PyLith/trunk/pylith/meshio/__init__.py	2008-02-05 06:19:40 UTC (rev 9229)
@@ -24,6 +24,7 @@
            'OutputManager',
            'OutputSoln',
            'OutputFaultKin',
+           'OutputMatElastic',
            'SingleOutput',
            'VertexFilter']
 



More information about the cig-commits mailing list