[cig-commits] r16197 - in short/3D/PyLith/trunk: . examples/bar_shearwave/quad4 libsrc/bc libsrc/faults libsrc/feassemble libsrc/problems modulesrc/bc modulesrc/faults modulesrc/feassemble modulesrc/problems pylith/problems

brad at geodynamics.org brad at geodynamics.org
Fri Jan 29 14:38:02 PST 2010


Author: brad
Date: 2010-01-29 14:38:01 -0800 (Fri, 29 Jan 2010)
New Revision: 16197

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/examples/bar_shearwave/quad4/pylithapp.cfg
   short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc
   short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.hh
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicitLgDeform.cc
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicitLgDeform.hh
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc
   short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
   short/3D/PyLith/trunk/libsrc/problems/SolverLumped.cc
   short/3D/PyLith/trunk/modulesrc/bc/AbsorbingDampers.i
   short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveKin.i
   short/3D/PyLith/trunk/modulesrc/feassemble/ElasticityExplicit.i
   short/3D/PyLith/trunk/modulesrc/feassemble/ElasticityExplicitLgDeform.i
   short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i
   short/3D/PyLith/trunk/modulesrc/problems/Formulation.i
   short/3D/PyLith/trunk/modulesrc/problems/problems.i
   short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py
Log:
Fixed some bugs related to top-level lumped solver stuff. Interface to integrateJacobian*() was inconsistent. Added some consistency checks.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/TODO	2010-01-29 22:38:01 UTC (rev 16197)
@@ -22,6 +22,7 @@
 * Updates to manual
   + tutorial
   + governing equations
+  + Large deformation formulation
 
 * Cleanup
   + memory model
@@ -56,10 +57,6 @@
 LUMPED SOLVER
 ----------------------------------------------------------------------
 
-FaultCohesiveKin
-  adjustSolnLumped()
-    S (sensitivity matrix) - assume diagonal (check with assert)
-
 FaultCohesiveDynL (C++)
   integrateJacobian (lumped)
   adjustSolnLumped()

Modified: short/3D/PyLith/trunk/examples/bar_shearwave/quad4/pylithapp.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/bar_shearwave/quad4/pylithapp.cfg	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/examples/bar_shearwave/quad4/pylithapp.cfg	2010-01-29 22:38:01 UTC (rev 16197)
@@ -42,6 +42,7 @@
 
 # Change to an explicit time stepping formulation
 formulation = pylith.problems.Explicit
+#formulation = pylith.problems.ExplicitLumped
 
 # Nondimensionalize problem using wave propagation parameters.
 normalizer = spatialdata.units.NondimElasticDynamic
@@ -188,8 +189,8 @@
 ksp_max_it = 50
 ksp_gmres_restart = 10
 
-#ksp_monitor = true
-#ksp_view = true
+ksp_monitor = true
+ksp_view = true
 log_summary = true
 
 

Modified: short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc	2010-01-29 22:38:01 UTC (rev 16197)
@@ -483,12 +483,13 @@
 // Integrate contributions to Jacobian matrix (A) associated with
 void
 pylith::bc::AbsorbingDampers::integrateJacobian(
-			      const topology::Field<topology::Mesh>& jacobian,
+			      topology::Field<topology::Mesh>* jacobian,
 			      const double t,
 			      topology::SolutionFields* const fields)
 { // integrateJacobian
   assert(0 != _quadrature);
   assert(0 != _boundaryMesh);
+  assert(0 != jacobian);
   assert(0 != fields);
 
   // Get cell geometry information that doesn't depend on cell
@@ -526,7 +527,7 @@
   const ALE::Obj<RealSection>& solutionSection = solution.section();
   assert(!solutionSection.isNull());
 
-  const ALE::Obj<RealSection>& jacobianSection = jacobian.section();
+  const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
   assert(!jacobianSection.isNull());
   topology::Mesh::UpdateAddVisitor jacobianVisitor(*jacobianSection, 
 						   &_cellVector[0]);

Modified: short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.hh	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.hh	2010-01-29 22:38:01 UTC (rev 16197)
@@ -114,7 +114,7 @@
    * @param t Current time
    * @param fields Solution fields
    */
-  void integrateJacobian(const topology::Field<topology::Mesh>& jacobian,
+  void integrateJacobian(topology::Field<topology::Mesh>* jacobian,
 			 const double t,
 			 topology::SolutionFields* const fields);
 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2010-01-29 22:38:01 UTC (rev 16197)
@@ -631,10 +631,11 @@
 // require assembly across cells, vertices, or processors.
 void
 pylith::faults::FaultCohesiveKin::integrateJacobianAssembled(
-				    topology::Field<topology::Mesh>& jacobian,
+				    topology::Field<topology::Mesh>* jacobian,
 				    const double t,
 				    topology::SolutionFields* const fields)
 { // integrateJacobianAssembled
+  assert(0 != jacobian);
   assert(0 != fields);
   assert(0 != _fields);
 
@@ -666,7 +667,7 @@
   const int spaceDim = _quadrature->spaceDim();
   double_array jacobianVertex(spaceDim);
   jacobianVertex = 1.0;
-  const ALE::Obj<RealSection>& jacobianSection = jacobian.section();
+  const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
   assert(!jacobianSection.isNull());  
   for (SieveSubMesh::label_sequence::iterator v_iter=verticesBegin; 
        v_iter != verticesEnd;

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2010-01-29 22:38:01 UTC (rev 16197)
@@ -180,7 +180,7 @@
    * @param t Current time
    * @param fields Solution fields
    */
-  void integrateJacobianAssembled(topology::Field<topology::Mesh>& jacobian,
+  void integrateJacobianAssembled(topology::Field<topology::Mesh>* jacobian,
 				  const double t,
 				  topology::SolutionFields* const fields);
 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc	2010-01-29 22:38:01 UTC (rev 16197)
@@ -469,12 +469,13 @@
 // Compute matrix associated with operator.
 void
 pylith::feassemble::ElasticityExplicit::integrateJacobian(
-			    const topology::Field<topology::Mesh>& jacobian,
+			    topology::Field<topology::Mesh>* jacobian,
 			    const double t,
 			    topology::SolutionFields* fields)
 { // integrateJacobian
   assert(0 != _quadrature);
   assert(0 != _material);
+  assert(0 != jacobian);
   assert(0 != fields);
 
   const int setupEvent = _logger->eventId("ElIJ setup");
@@ -520,7 +521,7 @@
     fields->get("disp(t)").section();
   assert(!dispTSection.isNull());
 
-  const ALE::Obj<RealSection>& jacobianSection = jacobian.section();
+  const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
   assert(!jacobianSection.isNull());
   topology::Mesh::UpdateAddVisitor jacobianVisitor(*jacobianSection, 
 						   &_cellVector[0]);

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.hh	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.hh	2010-01-29 22:38:01 UTC (rev 16197)
@@ -119,7 +119,7 @@
    * @param t Current time
    * @param fields Solution fields
    */
-  void integrateJacobian(const topology::Field<topology::Mesh>& jacobian,
+  void integrateJacobian(topology::Field<topology::Mesh>* jacobian,
 			 const double t,
 			 topology::SolutionFields* const fields);
 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicitLgDeform.cc	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicitLgDeform.cc	2010-01-29 22:38:01 UTC (rev 16197)
@@ -471,12 +471,13 @@
 // Compute matrix associated with operator.
 void
 pylith::feassemble::ElasticityExplicitLgDeform::integrateJacobian(
-			    const topology::Field<topology::Mesh>& jacobian,
+			    topology::Field<topology::Mesh>* jacobian,
 			    const double t,
 			    topology::SolutionFields* fields)
 { // integrateJacobian
   assert(0 != _quadrature);
   assert(0 != _material);
+  assert(0 != jacobian);
   assert(0 != fields);
 
   const int setupEvent = _logger->eventId("ElIJ setup");
@@ -522,7 +523,7 @@
     fields->get("disp(t)").section();
   assert(!dispTSection.isNull());
 
-  const ALE::Obj<RealSection>& jacobianSection = jacobian.section();
+  const ALE::Obj<RealSection>& jacobianSection = jacobian->section();
   assert(!jacobianSection.isNull());
   topology::Mesh::UpdateAddVisitor jacobianVisitor(*jacobianSection, 
 						   &_cellVector[0]);

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicitLgDeform.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicitLgDeform.hh	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicitLgDeform.hh	2010-01-29 22:38:01 UTC (rev 16197)
@@ -121,7 +121,7 @@
    * @param t Current time
    * @param fields Solution fields
    */
-  void integrateJacobian(const topology::Field<topology::Mesh>& jacobian,
+  void integrateJacobian(topology::Field<topology::Mesh>* jacobian,
 			 const double t,
 			 topology::SolutionFields* const fields);
 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2010-01-29 22:38:01 UTC (rev 16197)
@@ -186,7 +186,7 @@
    * @param fields Solution fields
    */
   virtual
-  void integrateJacobian(const topology::Field<topology::Mesh>& jacobian,
+  void integrateJacobian(topology::Field<topology::Mesh>* jacobian,
 			 const double t,
 			 topology::SolutionFields* const fields);
 
@@ -199,7 +199,7 @@
    * @param fields Solution fields
    */
   virtual
-  void integrateJacobianAssembled(const topology::Field<topology::Mesh>&  jacobian,
+  void integrateJacobianAssembled(topology::Field<topology::Mesh>* jacobian,
 				  const double t,
 				  topology::SolutionFields* const fields);
 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc	2010-01-29 22:38:01 UTC (rev 16197)
@@ -104,7 +104,7 @@
 inline
 void
 pylith::feassemble::Integrator<quadrature_type>::integrateJacobian(
-				     const topology::Field<topology::Mesh>& jacobian,
+				     topology::Field<topology::Mesh>* jacobian,
 				     const double t,
 				     topology::SolutionFields* const fields) {
   _needNewJacobian = false;
@@ -117,7 +117,7 @@
 inline
 void
 pylith::feassemble::Integrator<quadrature_type>::integrateJacobianAssembled(
-			      const topology::Field<topology::Mesh>& jacobian,
+			      topology::Field<topology::Mesh>* jacobian,
 			      const double t,
 			      topology::SolutionFields* const fields) {
 } // integrateJacobianAssembled

Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.cc	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.cc	2010-01-29 22:38:01 UTC (rev 16197)
@@ -248,10 +248,10 @@
   // Add in contributions that require assembly.
   int numIntegrators = _meshIntegrators.size();
   for (int i=0; i < numIntegrators; ++i)
-    _meshIntegrators[i]->integrateJacobian(*_jacobianLumped, _t, _fields);
+    _meshIntegrators[i]->integrateJacobian(_jacobianLumped, _t, _fields);
   numIntegrators = _submeshIntegrators.size();
   for (int i=0; i < numIntegrators; ++i)
-    _submeshIntegrators[i]->integrateJacobian(*_jacobianLumped, _t, _fields);
+    _submeshIntegrators[i]->integrateJacobian(_jacobianLumped, _t, _fields);
   
   // Assemble jacbian.
   _jacobianLumped->complete();
@@ -259,11 +259,11 @@
   // Add in contributions that do not require assembly.
   numIntegrators = _meshIntegrators.size();
   for (int i=0; i < numIntegrators; ++i)
-    _meshIntegrators[i]->integrateJacobianAssembled(*_jacobianLumped, 
+    _meshIntegrators[i]->integrateJacobianAssembled(_jacobianLumped, 
 						    _t, _fields);
   numIntegrators = _submeshIntegrators.size();
   for (int i=0; i < numIntegrators; ++i)
-    _submeshIntegrators[i]->integrateJacobianAssembled(*_jacobianLumped,
+    _submeshIntegrators[i]->integrateJacobianAssembled(_jacobianLumped,
 						       _t, _fields);
 
 } // reformJacobian

Modified: short/3D/PyLith/trunk/libsrc/problems/SolverLumped.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/SolverLumped.cc	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/libsrc/problems/SolverLumped.cc	2010-01-29 22:38:01 UTC (rev 16197)
@@ -103,6 +103,12 @@
 				   jacobianVertex.size());
     residualSection->restrictPoint(*v_iter, &residualVertex[0],
 				   residualVertex.size());
+
+#if !defined(NDEBUG)
+    for (int i=0; i < spaceDim; ++i)
+      assert(jacobianVertex[i] != 0.0);
+#endif
+
     solutionVertex = residualVertex / jacobianVertex;
     
     assert(solutionSection->getFiberDimension(*v_iter) == spaceDim);
@@ -112,7 +118,7 @@
   // Adjust solution to match constraints
   _formulation->adjustSolnLumped();
 
-  PetscLogFlops(vertices->size());
+  PetscLogFlops(vertices->size() * spaceDim);
 } // solve
 
 

Modified: short/3D/PyLith/trunk/modulesrc/bc/AbsorbingDampers.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/AbsorbingDampers.i	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/modulesrc/bc/AbsorbingDampers.i	2010-01-29 22:38:01 UTC (rev 16197)
@@ -69,6 +69,17 @@
 			     const double t,
 			     pylith::topology::SolutionFields* const fields);
       
+      /** Integrate contributions to Jacobian matrix (A) associated with
+       * operator.
+       *
+       * @param jacobian Jacobian of system.
+       * @param t Current time
+       * @param fields Solution fields
+       */
+      void integrateJacobian(pylith::topology::Field<pylith::topology::Mesh>* jacobian,
+			     const double t,
+			     pylith::topology::SolutionFields* const fields);
+
       /** Verify configuration is acceptable.
        *
        * @param mesh Finite-element mesh

Modified: short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveKin.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveKin.i	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveKin.i	2010-01-29 22:38:01 UTC (rev 16197)
@@ -99,7 +99,7 @@
        * operator that do not require assembly across cells, vertices, or
        * processors.
        *
-       * @param mat Sparse matrix
+       * @param jacobian Sparse matrix
        * @param t Current time
        * @param fields Solution fields
        * @param mesh Finite-element mesh
@@ -108,6 +108,18 @@
 				      const double t,
 				      pylith::topology::SolutionFields* const fields);
       
+      /** Integrate contributions to Jacobian matrix (A) associated with
+       * operator that do not require assembly across cells, vertices, or
+       * processors.
+       *
+       * @param jacobian Diagonal Jacobian matrix as a field.
+       * @param t Current time
+       * @param fields Solution fields
+       */
+      void integrateJacobianAssembled(pylith::topology::Field<pylith::topology::Mesh>* jacobian,
+				      const double t,
+				      pylith::topology::SolutionFields* const fields);
+
       /** Update state variables as needed.
        *
        * @param t Current time

Modified: short/3D/PyLith/trunk/modulesrc/feassemble/ElasticityExplicit.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/ElasticityExplicit.i	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/ElasticityExplicit.i	2010-01-29 22:38:01 UTC (rev 16197)
@@ -67,6 +67,18 @@
 			     const double t,
 			     pylith::topology::SolutionFields* const fields);
 
+      /** Integrate contributions to Jacobian matrix (A) associated
+       * with operator that require assembly across cells, vertices,
+       * or processors.
+       *
+       * @param jacobian Diagonal Jacobian matrix as a field.
+       * @param t Current time
+       * @param fields Solution fields
+       */
+      void integrateJacobian(pylith::topology::Field<pylith::topology::Mesh>* jacobian,
+			     const double t,
+			     pylith::topology::SolutionFields* const fields);
+
     }; // ElasticityExplicit
 
   } // feassemble

Modified: short/3D/PyLith/trunk/modulesrc/feassemble/ElasticityExplicitLgDeform.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/ElasticityExplicitLgDeform.i	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/ElasticityExplicitLgDeform.i	2010-01-29 22:38:01 UTC (rev 16197)
@@ -67,14 +67,15 @@
 			     const double t,
 			     pylith::topology::SolutionFields* const fields);
 
-      /** Integrate contributions to Jacobian matrix (A) associated with
-       * operator.
+      /** Integrate contributions to Jacobian matrix (A) associated
+       * with operator that require assembly across cells, vertices,
+       * or processors.
        *
-       * @param jacobian Diagonal matrix (as field) for Jacobian of system.
+       * @param jacobian Diagonal Jacobian matrix as a field.
        * @param t Current time
        * @param fields Solution fields
        */
-      void integrateJacobian(const pylith::topology::Field<pylith::topology::Mesh>& jacobian,
+      void integrateJacobian(pylith::topology::Field<pylith::topology::Mesh>* jacobian,
 			     const double t,
 			     pylith::topology::SolutionFields* const fields);
 

Modified: short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i	2010-01-29 22:38:01 UTC (rev 16197)
@@ -119,6 +119,18 @@
 			     const double t,
 			     pylith::topology::SolutionFields* const fields);
 
+      /** Integrate contributions to residual term (r) for operator that
+       * do not require assembly over cells, vertices, or processors.
+       *
+       * @param residual Field containing values for residual
+       * @param t Current time
+       * @param fields Solution fields
+       */
+      virtual 
+      void integrateResidualAssembled(const pylith::topology::Field<pylith::topology::Mesh>& residual,
+				      const double t,
+				      pylith::topology::SolutionFields* const fields);
+
       /** Integrate contributions to Jacobian matrix (A) associated with
        * operator.
        *
@@ -131,28 +143,41 @@
 			     const double t,
 			     pylith::topology::SolutionFields* const fields);
 
-      /** Integrate contributions to residual term (r) for operator that
-       * do not require assembly over cells, vertices, or processors.
+      /** Integrate contributions to Jacobian matrix (A) associated with
+       * operator that do not require assembly over cells, vertices, or
+       * processors
        *
-       * @param residual Field containing values for residual
+       * @param jacobian Sparse matrix for Jacobian of system.
        * @param t Current time
        * @param fields Solution fields
        */
-      virtual 
-      void integrateResidualAssembled(const pylith::topology::Field<pylith::topology::Mesh>& residual,
+      virtual
+      void integrateJacobianAssembled(pylith::topology::Jacobian* jacobian,
 				      const double t,
 				      pylith::topology::SolutionFields* const fields);
 
       /** Integrate contributions to Jacobian matrix (A) associated with
+       * operator.
+       *
+       * @param jacobian Diagonal matrix (as field) for Jacobian of system.
+       * @param t Current time
+       * @param fields Solution fields
+       */
+      virtual
+      void integrateJacobian(pylith::topology::Field<pylith::topology::Mesh>* jacobian,
+			     const double t,
+			     pylith::topology::SolutionFields* const fields);
+      
+      /** Integrate contributions to Jacobian matrix (A) associated with
        * operator that do not require assembly over cells, vertices, or
        * processors
        *
-       * @param jacobian Sparse matrix for Jacobian of system.
+       * @param jacobian Diagonal matrix (as field) for Jacobian of system.
        * @param t Current time
        * @param fields Solution fields
        */
       virtual
-      void integrateJacobianAssembled(pylith::topology::Jacobian* jacobian,
+      void integrateJacobianAssembled(pylith::topology::Field<pylith::topology::Mesh>* jacobian,
 				      const double t,
 				      pylith::topology::SolutionFields* const fields);
 

Modified: short/3D/PyLith/trunk/modulesrc/problems/Formulation.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/Formulation.i	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/modulesrc/problems/Formulation.i	2010-01-29 22:38:01 UTC (rev 16197)
@@ -63,6 +63,20 @@
 			  const double t,
 			  const double dt);
       
+      /** Update handles and parameters for reforming the Jacobian and
+       *  residual.
+       *
+       * @param jacobian Handle to diagonal matrix (as Field) for
+       * system Jacobian.
+       * @param fields Handle to solution fields.
+       * @param t Current time (nondimensional).
+       * @param dt Time step (nondimension).
+       */
+      void updateSettings(pylith::topology::Field<pylith::topology::Mesh>* jacobian,
+			  pylith::topology::SolutionFields* fields,
+			  const double t,
+			  const double dt);
+
       /** Reform system residual.
        *
        * @param tmpResidualVec Temporary PETSc vector for residual.
@@ -77,6 +91,10 @@
        */
       void reformJacobian(const PetscVec* tmpSolveSolnVec =0);
       
+      /* Reform system Jacobian.
+       */
+      void reformJacobianLumped(void);
+
     }; // Formulation
 
   } // problems

Modified: short/3D/PyLith/trunk/modulesrc/problems/problems.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/problems.i	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/modulesrc/problems/problems.i	2010-01-29 22:38:01 UTC (rev 16197)
@@ -24,6 +24,7 @@
 #include "pylith/problems/Solver.hh"
 #include "pylith/problems/SolverLinear.hh"
 #include "pylith/problems/SolverNonlinear.hh"
+#include "pylith/problems/SolverLumped.hh"
 
 %}
 
@@ -44,6 +45,7 @@
 %include "Solver.i"
 %include "SolverLinear.i"
 %include "SolverNonlinear.i"
+%include "SolverLumped.i"
 
 
 // End of file

Modified: short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py	2010-01-29 19:46:51 UTC (rev 16196)
+++ short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py	2010-01-29 22:38:01 UTC (rev 16197)
@@ -116,10 +116,10 @@
     logger.stagePop()
 
     self._info.log("Creating lumped Jacobian matrix.")
-    from pylith.topology.topology.MeshField import MeshField
+    from pylith.topology.topology import MeshField
     jacobian = MeshField(self.mesh)
     jacobian.label("jacobian")
-    solution.vectorFieldType(solution.VECTOR)
+    jacobian.vectorFieldType(jacobian.VECTOR)
     jacobian.newSection(jacobian.VERTICES_FIELD, dimension)
     jacobian.allocate()
     self.jacobian = jacobian
@@ -223,7 +223,7 @@
     self._info.log("Integrating Jacobian operator.")
     self._eventLogger.stagePush("Reform Jacobian")
 
-    self.updateSettings(self.jacobian, fields, t, dt)
+    self.updateSettings(self.jacobian, self.fields, t, dt)
     self.reformJacobianLumped()
 
     self._eventLogger.stagePop()
@@ -235,6 +235,15 @@
     return
 
 
+  def _cleanup(self):
+    """
+    Deallocate PETSc and local data structures.
+    """
+    if not self.fields is None:
+      self.fields.cleanup()
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def pde_formulation():



More information about the CIG-COMMITS mailing list