[cig-commits] r14714 - in short/3D/PyLith/branches/pylith-swig: libsrc/problems libsrc/topology modulesrc/problems pylith/problems
brad at geodynamics.org
brad at geodynamics.org
Wed Apr 15 09:25:17 PDT 2009
Author: brad
Date: 2009-04-15 09:25:17 -0700 (Wed, 15 Apr 2009)
New Revision: 14714
Modified:
short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc
short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.hh
short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
short/3D/PyLith/branches/pylith-swig/modulesrc/problems/Formulation.i
short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py
Log:
Removed changes Matt introduced in attempting to fix nonlinear solve. Still need to fix use of solution (which is the real issue).
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc 2009-04-15 16:12:52 UTC (rev 14713)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc 2009-04-15 16:25:17 UTC (rev 14714)
@@ -87,22 +87,16 @@
_dt = dt;
} // updateSettings
-
// ----------------------------------------------------------------------
// Reform system residual.
void
-pylith::problems::Formulation::reformResidual(Vec solutionVec, Vec residualVec)
+pylith::problems::Formulation::reformResidual(void)
{ // reformResidual
assert(0 != _fields);
- // Need to pass these Vecs for updating
-
// Update section view of field.
topology::Field<topology::Mesh>& solution = _fields->solution();
- std::cout << "solutionVec: " << solutionVec
- << ", solution.vector: " << solution.vector()
- << std::endl;
- solution.scatterVectorToSection(solutionVec);
+ solution.scatterVectorToSection();
// Set residual to zero.
topology::Field<topology::Mesh>& residual = _fields->get("residual");
@@ -133,10 +127,10 @@
_submeshIntegrators[i]->integrateResidual(residual, _t, _fields);
// Update PETSc view of residual
- residual.scatterSectionToVector(residualVec);
+ residual.scatterSectionToVector();
// TODO: Move this to SolverLinear
- VecScale(residualVec, -1.0);
+ VecScale(residual.vector(), -1.0);
} // reformResidual
// ----------------------------------------------------------------------
@@ -144,21 +138,12 @@
void
pylith::problems::Formulation::reformJacobian(void)
{ // reformJacobian
- reformJacobian(NULL);
-} // reformJacobian
-void
-pylith::problems::Formulation::reformJacobian(Vec solutionVec)
-{ // reformJacobian
assert(0 != _jacobian);
assert(0 != _fields);
- // Need to pass these Vecs for updating
-
// Update section view of field.
- if (solutionVec != NULL) {
- topology::Field<topology::Mesh>& solution = _fields->solution();
- solution.scatterVectorToSection(solutionVec);
- }
+ topology::Field<topology::Mesh>& solution = _fields->solution();
+ solution.scatterVectorToSection();
// Set residual to zero.
_jacobian->zero();
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.hh 2009-04-15 16:12:52 UTC (rev 14713)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.hh 2009-04-15 16:25:17 UTC (rev 14714)
@@ -81,11 +81,10 @@
const double dt);
/// Reform system residual.
- void reformResidual(PetscVec solutionVec, PetscVec residualVec);
+ void reformResidual(void);
/// Reform system Jacobian.
void reformJacobian(void);
- void reformJacobian(PetscVec solutionVec);
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
@@ -94,7 +93,6 @@
double _dt; ///< Current time step (nondimensional).
topology::Jacobian* _jacobian; ///< Handle to Jacobian of system.
topology::SolutionFields* _fields; ///< Handle to solution fields for system.
- topology::Field<topology::Mesh>* _solution;
/// Integrators over subdomains of the mesh.
std::vector<IntegratorMesh*> _meshIntegrators;
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc 2009-04-15 16:12:52 UTC (rev 14713)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc 2009-04-15 16:25:17 UTC (rev 14714)
@@ -115,7 +115,7 @@
assert(0 != formulation);
// Reform residual
- formulation->reformResidual(solutionVec, residualVec);
+ formulation->reformResidual();
VecView(residualVec, PETSC_VIEWER_STDOUT_WORLD);
return 0;
@@ -136,7 +136,7 @@
Formulation* formulation = (Formulation*) context;
assert(0 != formulation);
- formulation->reformJacobian(solutionVec);
+ formulation->reformJacobian();
return 0;
} // reformJacobian
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc 2009-04-15 16:12:52 UTC (rev 14713)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc 2009-04-15 16:25:17 UTC (rev 14714)
@@ -476,26 +476,18 @@
void
pylith::topology::Field<mesh_type>::scatterSectionToVector(void) const
{ // scatterSectionToVector
- assert(0 != _vector);
- scatterSectionToVector(_vector);
-} // scatterSectionToVector
-
-template<typename mesh_type>
-void
-pylith::topology::Field<mesh_type>::scatterSectionToVector(Vec vector) const
-{ // scatterSectionToVector
assert(!_section.isNull());
assert(0 != _scatter);
- assert(0 != vector);
+ assert(0 != _vector);
PetscErrorCode err = 0;
PetscVec localVec = 0;
err = VecCreateSeqWithArray(PETSC_COMM_SELF,
_section->sizeWithBC(), _section->restrictSpace(),
&localVec); CHECK_PETSC_ERROR(err);
- err = VecScatterBegin(_scatter, localVec, vector,
+ err = VecScatterBegin(_scatter, localVec, _vector,
INSERT_VALUES, SCATTER_FORWARD); CHECK_PETSC_ERROR(err);
- err = VecScatterEnd(_scatter, localVec, vector,
+ err = VecScatterEnd(_scatter, localVec, _vector,
INSERT_VALUES, SCATTER_FORWARD); CHECK_PETSC_ERROR(err);
err = VecDestroy(localVec); CHECK_PETSC_ERROR(err);
} // scatterSectionToVector
@@ -507,25 +499,18 @@
void
pylith::topology::Field<mesh_type>::scatterVectorToSection(void) const
{ // scatterVectorToSection
- assert(0 != _vector);
- scatterVectorToSection(_vector);
-} // scatterVectorToSection
-template<typename mesh_type>
-void
-pylith::topology::Field<mesh_type>::scatterVectorToSection(Vec vector) const
-{ // scatterVectorToSection
assert(!_section.isNull());
assert(0 != _scatter);
- assert(0 != vector);
+ assert(0 != _vector);
PetscErrorCode err = 0;
PetscVec localVec = 0;
err = VecCreateSeqWithArray(PETSC_COMM_SELF,
_section->sizeWithBC(), _section->restrictSpace(),
&localVec); CHECK_PETSC_ERROR(err);
- err = VecScatterBegin(_scatter, vector, localVec,
+ err = VecScatterBegin(_scatter, _vector, localVec,
INSERT_VALUES, SCATTER_REVERSE); CHECK_PETSC_ERROR(err);
- err = VecScatterEnd(_scatter, vector, localVec,
+ err = VecScatterEnd(_scatter, _vector, localVec,
INSERT_VALUES, SCATTER_REVERSE); CHECK_PETSC_ERROR(err);
err = VecDestroy(localVec); CHECK_PETSC_ERROR(err);
} // scatterVectorToSection
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh 2009-04-15 16:12:52 UTC (rev 14713)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh 2009-04-15 16:25:17 UTC (rev 14714)
@@ -229,12 +229,10 @@
/// Scatter section information across processors to update the
/// PETSc vector view of the field.
void scatterSectionToVector(void) const;
- void scatterSectionToVector(Vec vector) const;
/// Scatter PETSc vector information across processors to update the
/// Sieve section view of the field.
void scatterVectorToSection(void) const;
- void scatterVectorToSection(Vec vector) const;
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/problems/Formulation.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/problems/Formulation.i 2009-04-15 16:12:52 UTC (rev 14713)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/problems/Formulation.i 2009-04-15 16:25:17 UTC (rev 14714)
@@ -61,7 +61,7 @@
const double dt);
/// Reform system residual.
- void reformResidual(PetscVec solutionVec, PetscVec residualVec);
+ void reformResidual(void);
/// Reform system Jacobian.
void reformJacobian(void);
Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py 2009-04-15 16:12:52 UTC (rev 14713)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py 2009-04-15 16:25:17 UTC (rev 14714)
@@ -184,7 +184,7 @@
### NONLINEAR: This moves under SNES control as IntegrateResidual()
### NONLINEAR: Also move updateState() from Integrator.poststep() to this function
- ### self._reformResidual(t+dt, dt)
+ self._reformResidual(t+dt, dt)
self._info.log("Solving equations.")
residual = self.fields.get("residual")
More information about the CIG-COMMITS
mailing list