[cig-commits] r14969 - in short/3D/PyLith/trunk: . libsrc/topology modulesrc/topology pylith/problems pylith/topology unittests/libtests/topology unittests/pytests/topology
brad at geodynamics.org
brad at geodynamics.org
Sun May 10 15:56:20 PDT 2009
Author: brad
Date: 2009-05-10 15:56:19 -0700 (Sun, 10 May 2009)
New Revision: 14969
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/topology/Jacobian.cc
short/3D/PyLith/trunk/libsrc/topology/Jacobian.hh
short/3D/PyLith/trunk/modulesrc/topology/Jacobian.i
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
short/3D/PyLith/trunk/pylith/topology/Jacobian.py
short/3D/PyLith/trunk/unittests/libtests/topology/TestJacobian.cc
short/3D/PyLith/trunk/unittests/pytests/topology/TestJacobian.py
Log:
Added ability to set PETSc sparse matrix type.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/TODO 2009-05-10 22:56:19 UTC (rev 14969)
@@ -6,25 +6,28 @@
1. SNES
- Reformulate implicit time stepping to use displacement increment.
- Solution fields should be disp(t) and dispIncr(t).
- If solnIncr is true, Dirichlet BC set increment values in dispIncr(t).
-
- add setFieldIncr to Constraint
- reformulate explicit and implicit time stepping
-
Power-law rheology
2. Nondimensionalization
+ Add Quadrature::computeGeometry(cell, coordinatesCell)
+ do computation on 1 cell
+ much less memory than holding all info in Fields
+ keep computeGeometruy(mesh, cell) and retrieveGeometry(cell)
+
DataWriteVTK needs dimensionalizer
- Done coordinates in output (nondimensional instead of dimensioned) create dimensionalized copy (NAME_dimensioned)
- solution in output (nondimensional instead of dimensioned)
- const slip rate in output (slip rate not slip)
+ Done coordinates in output (nondimensional instead of dimensioned)
+ create dimensionalized copy (NAME_dimensioned) solution in output
+ (nondimensional instead of dimensioned) const slip rate in output
+ (slip rate not slip)
- Add ability to use symmetric matrix, set block size (default is 1)
+ Add ability to use symmetric matrix.
+ Ask constraints if a block matrix is okay. If okay and matrix type
+ is "unknown" (not set by user), then use "baij" rather than
+ "aij". Do this in Python.
+
3. Full-scale tests (few 1-D, 2-D, and 3-D)
1-D
@@ -130,10 +133,6 @@
Use Fields object to hold Field
- Add Quadrature::computeGeometry(cell, coordinatesCell)
- do computation on 1 cell
- much less memory than holding all info in Fields
-
Eliminate use of Inventory class.
Switch Components to PetscComponents.
Modified: short/3D/PyLith/trunk/libsrc/topology/Jacobian.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Jacobian.cc 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/libsrc/topology/Jacobian.cc 2009-05-10 22:56:19 UTC (rev 14969)
@@ -22,7 +22,8 @@
// ----------------------------------------------------------------------
// Default constructor.
-pylith::topology::Jacobian::Jacobian(const SolutionFields& fields) :
+pylith::topology::Jacobian::Jacobian(const SolutionFields& fields,
+ const char* matrixType) :
_fields(fields),
_matrix(0)
{ // constructor
@@ -30,7 +31,7 @@
const ALE::Obj<Mesh::RealSection>& solnSection = fields.solution().section();
PetscErrorCode err = MeshCreateMatrix(sieveMesh, solnSection,
- MATAIJ, &_matrix);
+ matrixType, &_matrix);
CHECK_PETSC_ERROR_MSG(err, "Could not create PETSc sparse matrix "
"associated with system Jacobian.");
} // constructor
Modified: short/3D/PyLith/trunk/libsrc/topology/Jacobian.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Jacobian.hh 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/libsrc/topology/Jacobian.hh 2009-05-10 22:56:19 UTC (rev 14969)
@@ -35,8 +35,10 @@
/** Default constructor.
*
* @param fields Fields associated with mesh and solution of the problem.
+ * @param matrixType Type of PETSc sparse matrix.
*/
- Jacobian(const SolutionFields& fields);
+ Jacobian(const SolutionFields& fields,
+ const char* matrixType ="aij");
/// Destructor.
~Jacobian(void);
Modified: short/3D/PyLith/trunk/modulesrc/topology/Jacobian.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/Jacobian.i 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/modulesrc/topology/Jacobian.i 2009-05-10 22:56:19 UTC (rev 14969)
@@ -28,8 +28,10 @@
/** Default constructor.
*
* @param fields Fields associated with mesh and solution of the problem.
+ * @param matrixType Type of PETSc sparse matrix.
*/
- Jacobian(const SolutionFields& fields);
+ Jacobian(const SolutionFields& fields,
+ const char* matrixType ="aij");
/// Destructor.
~Jacobian(void);
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2009-05-10 22:56:19 UTC (rev 14969)
@@ -56,6 +56,7 @@
## Python object for managing Formulation facilities and properties.
##
## \b Properties
+ ## @li \b matrix_type Type of PETSc sparse matrix.
## @li \b view_jacobian Flag to output Jacobian matrix when it is reformed.
##
## \b Facilities
@@ -66,6 +67,9 @@
import pyre.inventory
+ matrixType = pyre.inventory.property("matrix_type", default="unknown")
+ matrixType.meta['tip'] = "Type of PETSc sparse matrix."
+
viewJacobian = pyre.inventory.bool("view_jacobian", default=False)
viewJacobian.meta['tip'] = "Write Jacobian matrix to binary file."
@@ -324,6 +328,7 @@
Set members based using inventory.
"""
PetscComponent._configure(self)
+ self.matrixType = self.inventory.matrixType
self.timeStep = self.inventory.timeStep
self.solver = self.inventory.solver
self.output = self.inventory.output
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2009-05-10 22:56:19 UTC (rev 14969)
@@ -110,7 +110,7 @@
self._info.log("Creating Jacobian matrix.")
from pylith.topology.Jacobian import Jacobian
- self.jacobian = Jacobian(self.fields)
+ self.jacobian = Jacobian(self.fields, self.matrixType)
self.jacobian.zero() # TEMPORARY, to get correct memory usage
self._debug.log(resourceUsageString())
Modified: short/3D/PyLith/trunk/pylith/topology/Jacobian.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Jacobian.py 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/pylith/topology/Jacobian.py 2009-05-10 22:56:19 UTC (rev 14969)
@@ -25,13 +25,17 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
- def __init__(self, fields):
+ def __init__(self, fields, matrixType="unknown"):
"""
Constructor.
@param fields Solution fields.
"""
- ModuleJacobian.__init__(self, fields)
+ # If matrix type has not been set, then set it to a value that will work.
+ if matrixType == "unknown":
+ matrixType = "aij"
+
+ ModuleJacobian.__init__(self, fields, matrixType)
return
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestJacobian.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestJacobian.cc 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestJacobian.cc 2009-05-10 22:56:19 UTC (rev 14969)
@@ -34,6 +34,8 @@
SolutionFields fields(mesh);
_initialize(&mesh, &fields);
Jacobian jacobian(fields);
+
+ Jacobian jacobianB(fields, "baij");
} // testConstructor
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/unittests/pytests/topology/TestJacobian.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/TestJacobian.py 2009-05-10 21:55:09 UTC (rev 14968)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/TestJacobian.py 2009-05-10 22:56:19 UTC (rev 14969)
@@ -63,6 +63,9 @@
"""
Test constructor.
"""
+ # setUp() tests constructor with default type
+ jacobianA = Jacobian(self.fields, "aij")
+ jacobianB = Jacobian(self.fields, "baij")
return
More information about the CIG-COMMITS
mailing list