[cig-commits] r6498 - in short/3D/PyLith/trunk: . libsrc/feassemble modulesrc pylith pylith/problems pylith/solver

brad at geodynamics.org brad at geodynamics.org
Sat Mar 31 17:49:55 PDT 2007


Author: brad
Date: 2007-03-31 17:49:54 -0700 (Sat, 31 Mar 2007)
New Revision: 6498

Added:
   short/3D/PyLith/trunk/pylith/solver/SolverLinear.py
Removed:
   short/3D/PyLith/trunk/pylith/solver/SolverTSE.py
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/configure.ac
   short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc
   short/3D/PyLith/trunk/modulesrc/Makefile.am
   short/3D/PyLith/trunk/pylith/Makefile.am
   short/3D/PyLith/trunk/pylith/problems/Explicit.py
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
   short/3D/PyLith/trunk/pylith/solver/Solver.py
   short/3D/PyLith/trunk/pylith/solver/__init__.py
Log:
Started implementing linear solver, including stubs for module.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/TODO	2007-04-01 00:49:54 UTC (rev 6498)
@@ -4,6 +4,11 @@
 
 Error checking
 
+  Fix when Mesh debug is turned on. Make sure set upon creation (pass
+  to topology Mesh constructor).
+
+  Move interpolate to same location as Mesh debug (not in importer).
+
   add isNull() assertions before using ALE::Obj.
 
   add check to material::initialize material dimension must match cell dimension

Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/configure.ac	2007-04-01 00:49:54 UTC (rev 6498)
@@ -153,6 +153,7 @@
                 modulesrc/feassemble/Makefile
                 modulesrc/materials/Makefile
                 modulesrc/meshio/Makefile
+                modulesrc/solver/Makefile
 		modulesrc/topology/Makefile
 		modulesrc/utils/Makefile
 		applications/Makefile

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc	2007-04-01 00:49:54 UTC (rev 6498)
@@ -83,6 +83,7 @@
   // Get parameters used in integration.
   const double dt = _dt;
   const double dt2 = dt*dt;
+  assert(dt > 0);
 
   // Get cell geometry information that doesn't depend on cell
   const int numQuadPts = _quadrature->numQuadPts();

Modified: short/3D/PyLith/trunk/modulesrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/Makefile.am	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/modulesrc/Makefile.am	2007-04-01 00:49:54 UTC (rev 6498)
@@ -14,6 +14,7 @@
 	feassemble \
 	materials \
 	meshio \
+	solver \
 	topology \
 	utils
 

Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/pylith/Makefile.am	2007-04-01 00:49:54 UTC (rev 6498)
@@ -47,6 +47,7 @@
 	problems/TimeDependent.py \
 	solver/__init__.py \
 	solver/Solver.py \
+	solver/SolverLinear.py \
 	topology/__init__.py \
 	topology/Mesh.py \
 	topology/MeshGenerator.py \

Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py	2007-04-01 00:49:54 UTC (rev 6498)
@@ -56,6 +56,7 @@
 
     import pyre.inventory
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="explicit"):
@@ -99,6 +100,8 @@
       integrator.integrateJacobian(self.jacobian, self.dispT)
     import pylith.utils.petsc as petsc
     petsc.mat_assemble(self.jacobian)
+
+    self.solver.initialize(mesh, self.dispTpdt)
     return
 
 
@@ -132,7 +135,7 @@
       integrator.integrateConstant(self.constant, self.dispT, self.dispTmdt)
 
     self._info.log("Solving equations.")
-    # solve
+    self.solver.solve(self.dispTpdt, self.jacobian, self.constant)
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2007-04-01 00:49:54 UTC (rev 6498)
@@ -47,9 +47,10 @@
 
     import pyre.inventory
 
-    #from pylith.solver.SolverTSE import SolverTSE
-    #solver = pyre.inventory.facility("solver", factory=SolverTSE)
-    #solver.meta['tip'] = "Algebraic solver."
+    from pylith.solver.SolverLinear import SolverLinear
+    solver = pyre.inventory.facility("solver", family="solver",
+                                     factory=SolverLinear)
+    solver.meta['tip'] = "Algebraic solver."
     
   
   # PUBLIC METHODS /////////////////////////////////////////////////////
@@ -78,7 +79,7 @@
     Set members based using inventory.
     """
     Component._configure(self)
-    #self.solver = self.inventory.solver
+    self.solver = self.inventory.solver
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/solver/Solver.py
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/Solver.py	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/pylith/solver/Solver.py	2007-04-01 00:49:54 UTC (rev 6498)
@@ -51,6 +51,7 @@
     Constructor.
     """
     Component.__init__(self, name, facility="solver")
+    self.cppHandle = None
     return
 
 

Copied: short/3D/PyLith/trunk/pylith/solver/SolverLinear.py (from rev 6496, short/3D/PyLith/trunk/pylith/solver/SolverTSE.py)
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/SolverTSE.py	2007-03-31 23:54:27 UTC (rev 6496)
+++ short/3D/PyLith/trunk/pylith/solver/SolverLinear.py	2007-04-01 00:49:54 UTC (rev 6498)
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/solver/SolverLinear.py
+
+## @brief Python PyLith linear algebraic solver.
+
+from Solver import Solver
+
+# SolverLinear class
+class SolverLinear(Solver):
+  """
+  Python PyLith linear algebraic solver.
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(Solver.Inventory):
+    """
+    Python object for managing SolverLinear facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing SolverLinear facilities and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li None
+
+    import pyre.inventory
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="solverlinear"):
+    """
+    Constructor.
+    """
+    Solver.__init__(self, name)
+    import pylith.solver.solver as bindings
+    self.cppHandle = bindings.SolverLinear()
+    return
+
+
+  def initialize(self, mesh, field):
+    """
+    Initialize solver.
+    """
+    self.cppHandle.initialize(mesh.cppHandle, field)
+    return
+
+
+  def solve(self, fieldOut, jacobian, fieldIn):
+    """
+    Solve linear system.
+    """
+    self.cppHandle.solve(fieldOut, jacobian, fieldIn)
+    return
+  
+
+  # PRIVATE METHODS /////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based using inventory.
+    """
+    Solver._configure(self)
+    return
+
+
+# End of file 

Deleted: short/3D/PyLith/trunk/pylith/solver/SolverTSE.py
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/SolverTSE.py	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/pylith/solver/SolverTSE.py	2007-04-01 00:49:54 UTC (rev 6498)
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/solver/SolverTSE.py
-## @brief Python PyLith explicit time stepping solver.
-
-from Solver import Solver
-
-# SolverTSE class
-class SolverTSE(Solver):
-  """Python PyLith explicit time stepping solver."""
-
-  # INVENTORY //////////////////////////////////////////////////////////
-
-  class Inventory(Solver.Inventory):
-    """Python object for managing SolverTSE facilities and properties."""
-
-    ## @class Inventory
-    ## Python object for managing SolverTSE facilities and properties.
-    ##
-    ## \b Properties
-    ## @li None
-    ##
-    ## \b Facilities
-    ## @li None
-
-    import pyre.inventory
-
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def __init__(self, name="solvertse"):
-    """Constructor."""
-    Solver.__init__(self, name)
-    return
-
-
-  # PRIVATE METHODS /////////////////////////////////////////////////////
-
-  def _configure(self):
-    """Set members based using inventory."""
-    Solver._configure(self)
-    return
-
-
-# version
-__id__ = "$Id$"
-
-# End of file 

Modified: short/3D/PyLith/trunk/pylith/solver/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/__init__.py	2007-03-31 23:57:42 UTC (rev 6497)
+++ short/3D/PyLith/trunk/pylith/solver/__init__.py	2007-04-01 00:49:54 UTC (rev 6498)
@@ -14,7 +14,8 @@
 ##
 ## @brief Python Pylith solver module initialization
 
-__all__ = ['Solver']
+__all__ = ['Solver',
+           'SolverLinear']
 
 
 # End of file



More information about the cig-commits mailing list