[cig-commits] r5927 - in short/3D/PyLith/trunk: applications pylith pylith/feassemble pylith/materials pylith/meshio pylith/problems pylith/topology

brad at geodynamics.org brad at geodynamics.org
Mon Jan 29 21:49:25 PST 2007


Author: brad
Date: 2007-01-29 21:49:24 -0800 (Mon, 29 Jan 2007)
New Revision: 5927

Added:
   short/3D/PyLith/trunk/pylith/problems/DynamicExplicit.py
Modified:
   short/3D/PyLith/trunk/applications/pylithic.py
   short/3D/PyLith/trunk/pylith/Makefile.am
   short/3D/PyLith/trunk/pylith/PyLithApp.py
   short/3D/PyLith/trunk/pylith/__init__.py
   short/3D/PyLith/trunk/pylith/feassemble/Field.py
   short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
   short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
   short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py
   short/3D/PyLith/trunk/pylith/problems/Dynamic.py
   short/3D/PyLith/trunk/pylith/problems/Problem.py
   short/3D/PyLith/trunk/pylith/problems/__init__.py
   short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
   short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
   short/3D/PyLith/trunk/pylith/topology/__init__.py
Log:
Worked on top-level Python. Still need to flush out how proble, solver, assembler, etc are related.

Modified: short/3D/PyLith/trunk/applications/pylithic.py
===================================================================
--- short/3D/PyLith/trunk/applications/pylithic.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/applications/pylithic.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -24,7 +24,4 @@
   app.run()
 
 
-# version
-__id__ = "$Id$"
-
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/Makefile.am	2007-01-30 05:49:24 UTC (rev 5927)
@@ -32,6 +32,7 @@
 	meshio/__init__.py \
 	problems/__init__.py \
 	problems/Dynamic.py \
+	problems/DynamicExplicit.py \
 	problems/Problem.py \
 	problems/QuasiStatic.py \
 	solver/__init__.py \

Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -17,12 +17,16 @@
 
 # PyLithApp class
 class PyLithApp(Script):
-  """Python PyLithApp application."""
+  """
+  Python PyLithApp application.
+  """
   
   # INVENTORY //////////////////////////////////////////////////////////
 
   class Inventory(Script.Inventory):
-    """Python object for managing PyLithApp facilities and properties."""
+    """
+    Python object for managing PyLithApp facilities and properties.
+    """
 
     ## @class Inventory
     ## Python object for managing PyLithApp facilities and properties.
@@ -45,14 +49,16 @@
     mesher = pyre.inventory.facility("mesh_generator", factory=MeshImporter)
     mesher.meta['tip'] = "Generates or imports the computational mesh."
 
-    from pylith.problems.QuasiStatic import QuasiStatic
-    problem = pyre.inventory.facility("problem", factory=QuasiStatic)
+    from pylith.problems.DynamicExplicit import DynamicExplicit
+    problem = pyre.inventory.facility("problem", factory=DynamicExplicit)
     problem.meta['tip'] = "Computational problem to solve."
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def main(self):
-    """Run the application."""
+    """
+    Run the application.
+    """
 
     mesh = self.mesher.create()
     self.problem.mesh = mesh.distribute()
@@ -70,7 +76,9 @@
   
 
   def __init__(self, name="pylithapp"):
-    """Constructor."""
+    """
+    Constructor.
+    """
     Script.__init__(self, name)
     self.totalTime = None
     self.mesher = None
@@ -81,7 +89,9 @@
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
-    """Setup members using inventory."""
+    """
+    Setup members using inventory.
+    """
     Script._configure(self)
     self.totalTime = self.inventory.totalTime
     self.mesher = self.inventory.mesher
@@ -89,7 +99,4 @@
     return
 
 
-# version
-__id__ = "$Id$"
-
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/__init__.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/__init__.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -11,11 +11,10 @@
 #
 
 ## @file pylith/__init__.py
+
 ## @brief Python top-level PyLith module initialization
 
 all = ['PyLithApp']
 
-# version
-__id__ = "$Id$"
 
 # End of file

Modified: short/3D/PyLith/trunk/pylith/feassemble/Field.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Field.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/feassemble/Field.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -14,6 +14,8 @@
 
 ## @brief Python PyLith field.
 
+from pyre.components.Component import Component
+
 # Field class
 class Field(Component):
   """
@@ -23,7 +25,9 @@
   # INVENTORY //////////////////////////////////////////////////////////
 
   class Inventory(Component.Inventory):
-    """Python object for managing Field facilities and properties."""
+    """
+    Python object for managing Field facilities and properties.
+    """
 
     ## @class Inventory
     ## Python object for managing Field facilities and properties.
@@ -45,7 +49,9 @@
 
 
   def __init__(self, name="field"):
-    """Constructor."""
+    """
+    Constructor.
+    """
     Component.__init__(self, name, facility="field")
     self.sieveField = None
     return

Modified: short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -87,7 +87,7 @@
   def _configure(self):
     """Set members using inventory."""
     self.useDB = self.inventory.useDB
-    self.density = density
+    self.density = self.inventory.density
     self.muLame = self.density * self.inventory.vs**2
     self.lambdaLame = self.density * self.inventory.vp**2 - 2*self.muLame
     return

Modified: short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIO.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIO.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -64,8 +64,8 @@
     """
     from pylith.topology.Mesh import Mesh
     mesh = Mesh()
-    self.cppHandle.interpolate = interpolate
-    mesh.cppHandle = self.cppHandle.read(self.interpolate)
+    self.cppHandle.interpolate = self.interpolate
+    mesh.cppHandle = self.cppHandle.read()
     return 
 
 
@@ -75,7 +75,7 @@
 
     @param mesh PETSc mesh object containing finite-element mesh
     """
-    self.cppHandle.interpolate = interpolate
+    self.cppHandle.interpolate = self.interpolate
     self.cppHandle.write(mesh.handle)
     return
 

Modified: short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -27,7 +27,9 @@
   # INVENTORY //////////////////////////////////////////////////////////
 
   class Inventory(MeshIO.Inventory):
-    """Python object for managing MeshIOAscii facilities and properties."""
+    """
+    Python object for managing MeshIOAscii facilities and properties.
+    """
 
     ## @class Inventory
     ## Python object for managing MeshIOAscii facilities and properties.
@@ -40,14 +42,16 @@
 
     import pyre.inventory
 
-    filename = pyre.inventory.str("filename", default=False)
+    filename = pyre.inventory.str("filename", default="")
     filename.meta['tip'] = "Name of mesh file"
 
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="meshioascii"):
-    """Constructor."""
+    """
+    Constructor.
+    """
     MeshIO.__init__(self, name)
     import pylith.meshio.meshio as bindings
     self.cppHandle = bindings.MeshIOAscii()
@@ -57,14 +61,13 @@
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
-    """Set members based using inventory."""
+    """
+    Set members based using inventory.
+    """
     MeshIO._configure(self)
     self.filename = self.inventory.filename
     self.cppHandle.filename = self.filename
     return
 
 
-# version
-__id__ = "$Id$"
-
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/problems/Dynamic.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Dynamic.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/problems/Dynamic.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -17,12 +17,16 @@
 
 # Dynamic class
 class Dynamic(Problem):
-  """Python Dynamic for dynamic crustal dynamics simulations."""
+  """
+  Python Dynamic for dynamic crustal dynamics simulations.
+  """
 
   # INVENTORY //////////////////////////////////////////////////////////
 
   class Inventory(Problem.Inventory):
-    """Python object for managing Dynamic facilities and properties."""
+    """
+    Python object for managing Dynamic facilities and properties.
+    """
 
     ## @class Inventory
     ## Python object for managing Dynamic facilities and properties.

Added: short/3D/PyLith/trunk/pylith/problems/DynamicExplicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/DynamicExplicit.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/problems/DynamicExplicit.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/problems/DynamicExplicit.py
+
+## @brief Python DynamicExplicit for dynamic simulations with explicit solver.
+
+from Problem import Problem
+
+# Dynamic class
+class DynamicExplicit(Problem):
+  """
+  Python DynamicExplicit for dynamic simulations with explicit solver.
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(Problem.Inventory):
+    """
+    Python object for managing Dynamic facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing Dynamic facilities and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li \b solver Algebraic solver.
+    ## @li \b disp_tpdt Displacement at time t+dt
+    ## @li \b disp_t Displacement at time t
+    ## @li \b disp_tmdt Displacement at time t-dt
+
+    import pyre.inventory
+
+    from pylith.solver.SolverTSE import SolverTSE
+    solver = pyre.inventory.facility("solver", factory=SolverTSE)
+    solver.meta['tip'] = "Algebraic solver."
+
+    from pylith.feassemble.Field import Field
+    disptpdt = pyre.inventory.facility("disp_tpdt", factory=Field,
+                                       args=["disptpdt"])
+    disptpdt.meta['tip'] = "Displacement at time t+dt."
+
+    dispt = pyre.inventory.facility("disp_t", factory=Field,
+                                       args=["dispt"])
+    dispt.meta['tip'] = "Displacement at time t."
+
+    disptmdt = pyre.inventory.facility("disp_tmdt", factory=Field,
+                                       args=["disptmdt"])
+    disptmdt.meta['tip'] = "Displacement at time t-dt."
+    
+  
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def initialize(self):
+    """
+    Create domain, bounday conditions, fields, and setup time loop.
+    """
+    Problem.initialize(self)
+    
+    #self.disptpdt.initialize()
+    #self.dispt.initialize()
+    #self.disptmdt.initialize()
+    return
+
+
+  def prestep(self):
+    """
+    User hook for doing stuff before advancing time step.
+    """
+    self._info.log("WARNING: DynamicExplicit::prestep not implemented.")
+    return
+
+
+  def step(self, dt):
+    """
+    Advance to next time step.
+    """
+    self._info.log("WARNING: DynamicExplicit::step not implemented.")
+    return
+
+
+  def poststep(self):
+    """
+    Update time and storage.
+    """
+    self._info.log("WARNING: DynamicExplicit::poststep not implemented.")
+    return
+
+
+  def stableTimestep(self):
+    """
+    Determine stable time step for problem.
+    """
+    self._info.log("WARNING: DynamicExplicit::stableTimestep not implemented.")
+    return
+
+
+  def checkpoint(self):
+    """
+    Save problem state for restart.
+    """
+    self._info.log("WARNING: DynamicExplicit::checkpoint not implemented.")
+    return
+  
+
+  def __init__(self, name="dynamic"):
+    """
+    Constructor.
+    """
+    Problem.__init__(self, name)
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based using inventory.
+    """
+    Problem._configure(self)
+    self.solver = self.inventory.solver
+    self.disptpdt = self.inventory.disptpdt
+    self.dispt = self.inventory.dispt
+    self.disptmdt = self.inventory.disptmdt
+    return
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -17,12 +17,16 @@
 
 # Problem class
 class Problem(Component):
-  """Python abstract base class for crustal dynamics problems."""
+  """
+  Python abstract base class for crustal dynamics problems.
+  """
   
   # INVENTORY //////////////////////////////////////////////////////////
 
   class Inventory(Component.Inventory):
-    """Python object for managing Problem facilities and properties."""
+    """
+    Python object for managing Problem facilities and properties.
+    """
 
     ## @class Inventory
     ## Python object for managing Problem facilities and properties.
@@ -33,9 +37,6 @@
     ## \b Facilities
     ## @li \b mesh Finite-element topology.
     ## @li \b assembler Finite-element assembler.
-    ## @li \b coordinates Field for coordinates of vertices associated
-    ##        with domain
-    ## @li \b equation_type Field defining different constitutive models
     ## @li \b materials Materials in problem.
 
     import pyre.inventory
@@ -44,20 +45,10 @@
     mesh = pyre.inventory.facility("mesh", factory=Mesh)
     mesh.meta['tip'] = "Finite-element topology."
 
-    from pylith.feassemble.Assembler import Assembler
-    assembler = pyre.inventory.facility("assembler", factory=Assembler)
-    assembler.meta['tip'] = "Finite-element assembler."
+    #from pylith.feassemble.Assembler import Assembler
+    #assembler = pyre.inventory.facility("assembler", factory=Assembler)
+    #assembler.meta['tip'] = "Finite-element assembler."
 
-    from pylith.feassemble.Field import Field
-    coordinates = pyre.inventory.facility("coordinates", factory=Field,
-                                          args=["coordinates"])
-    coordinates.meta['tip'] = "Field for coordinates of vertices associated" \
-                              "with domain"
-
-    eqntype = pyre.inventory.facility("equation_type", factory=Field,
-                                      args=["eqntype"])
-    eqntype.meta['tip'] = "Field defining different constitutive models."
-
     from pylith.materials.Homogeneous import Homogeneous
     materials = pyre.inventory.facility("materials", factory=Homogeneous)
     mesh.meta['tip'] = "Materials in problem."
@@ -65,41 +56,53 @@
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def initialize(self):
-    """Create domain, bounday conditions, fields, and setup time loop."""
-    self.coordinates.initialize()
-    self.eqntype.initialize()
+    """
+    Create domain, bounday conditions, fields, and setup time loop.
+    """
     return
 
 
   def prestep(self):
-    """User hook for doing stuff before advancing time step."""
+    """
+    User hook for doing stuff before advancing time step.
+    """
     return
 
 
   def step(self, dt):
-    """Advance to next time step."""
+    """
+    Advance to next time step.
+    """
     return
 
 
   def poststep(self):
-    """Update time and storage."""
+    """
+    Update time and storage.
+    """
     return
 
 
   def stableTimestep(self):
-    """Determine stable time step for problem."""
+    """
+    Determine stable time step for problem.
+    """
     raise NotImplementedError, "Problem::stableTimestep() not implemented."
     return
 
 
   def checkpoint(self):
-    """Save problem state for restart."""
+    """
+    Save problem state for restart.
+    """
     raise NotImplementedError, "Problem::checkpoint() not implemented."
     return
   
 
   def __init__(self, name="problem"):
-    """Constructor."""
+    """
+    Constructor.
+    """
     Component.__init__(self, name, facility="problem")
     return
 
@@ -107,14 +110,13 @@
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
-    """Set members based using inventory."""
+    """
+    Set members based using inventory.
+    """
     self.mesh = self.inventory.mesh
-    self.assembler = self.inventory.assembler
-    self.coordinates = self.inventory.coordinates
-    self.eqntype = self.inventory.eqntype
+    #self.assembler = self.inventory.assembler
+    self.material = self.inventory.materials
     return
 
-# version
-__id__ = "$Id$"
 
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/problems/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/__init__.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/problems/__init__.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -11,11 +11,13 @@
 #
 
 ## @file pylith/problems/__init__.py
+
 ## @brief Python PyLith crustal dynamics problems module initialization
 
-all = ['Dynamic', 'Problem', 'QuasiStatic']
+all = ['Dynamic',
+       'DynamicExplicit',
+       'Problem',
+       'QuasiStatic']
 
-# version
-__id__ = "$Id$"
 
 # End of file

Modified: short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -17,17 +17,24 @@
 
 # MeshGenerator class
 class MeshGenerator(Component):
-  """Python abstract base class for mesh generator."""
+  """
+  Python abstract base class for mesh generator.
+  """
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def create(self):
+    """
+    Hook for creating mesh.
+    """
     raise NotImplementedError, "MeshGenerator::create() not implemented."
     return
 
 
   def __init__(self, name="meshgenerator"):
-    """Constructor."""
+    """
+    Constructor.
+    """
     Component.__init__(self, name, facility="meshgenerator")
     return
 

Modified: short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -24,7 +24,9 @@
   # INVENTORY //////////////////////////////////////////////////////////
 
   class Inventory(MeshGenerator.Inventory):
-    """Python object for managing MeshImporter facilities and properties."""
+    """
+    Python object for managing MeshImporter facilities and properties.
+    """
 
     ## @class Inventory
     ## Python object for managing MeshImporter facilities and properties.
@@ -46,13 +48,15 @@
 
   def create(self):
     """
-    Create a mesh.
+    Hook for creating mesh.
     """
     return self.importer.read()
 
 
   def __init__(self, name="meshimporter"):
-    """Constructor."""
+    """
+    Constructor.
+    """
     MeshGenerator.__init__(self, name)
     return
 

Modified: short/3D/PyLith/trunk/pylith/topology/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/__init__.py	2007-01-30 03:26:50 UTC (rev 5926)
+++ short/3D/PyLith/trunk/pylith/topology/__init__.py	2007-01-30 05:49:24 UTC (rev 5927)
@@ -11,10 +11,12 @@
 #
 
 ## @file pylith/topology/__init__.py
+
 ## @brief Python PyLith finite-element topology module initialization
 
 all = ['Mesh',
        'MeshGenerator',
        'MeshImporter']
 
+
 # End of file



More information about the cig-commits mailing list