[cig-commits] [commit] knepley/upgrade-petsc-interface: Update creating solution field in Formulation.py. (f1c4e75)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Tue Nov 12 13:56:44 PST 2013
Repository : ssh://geoshell/pylith
On branch : knepley/upgrade-petsc-interface
Link : https://github.com/geodynamics/pylith/compare/fd50ef895510b6352f372ba3b28e6b36059d957c...04bbef4ac1ec975b2a6c6ed2654a704c68181176
>---------------------------------------------------------------
commit f1c4e7575fc34b9df71ed79fcfc10d392bca12c6
Author: Brad Aagaard <baagaard at usgs.gov>
Date: Tue Nov 12 13:58:47 2013 -0800
Update creating solution field in Formulation.py.
Update to new interface for creating solution field (and subfields) in
Formulation.py. Add setupSolnDof() to integrator as empty virtual
method.
>---------------------------------------------------------------
f1c4e7575fc34b9df71ed79fcfc10d392bca12c6
libsrc/pylith/faults/FaultCohesiveLagrange.hh | 1 +
libsrc/pylith/feassemble/Integrator.hh | 7 +++++++
libsrc/pylith/feassemble/Integrator.icc | 6 ++++++
modulesrc/feassemble/Integrator.i | 7 +++++++
pylith/problems/Formulation.py | 12 ++++++------
5 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/libsrc/pylith/faults/FaultCohesiveLagrange.hh b/libsrc/pylith/faults/FaultCohesiveLagrange.hh
index 1a1217f..d79434a 100644
--- a/libsrc/pylith/faults/FaultCohesiveLagrange.hh
+++ b/libsrc/pylith/faults/FaultCohesiveLagrange.hh
@@ -116,6 +116,7 @@ public :
*
* @param field Solution field.
*/
+ virtual
void setupSolnDof(topology::Field* field);
/** Integrate contributions to residual term (r) for operator that
diff --git a/libsrc/pylith/feassemble/Integrator.hh b/libsrc/pylith/feassemble/Integrator.hh
index 4cb339e..d4c1bd1 100644
--- a/libsrc/pylith/feassemble/Integrator.hh
+++ b/libsrc/pylith/feassemble/Integrator.hh
@@ -128,6 +128,13 @@ public :
virtual
void initialize(const topology::Mesh& mesh);
+ /** Setup DOF on solution field.
+ *
+ * @param field Solution field.
+ */
+ virtual
+ void setupSolnDof(topology::Field* field);
+
/** Integrate contributions to residual term (r) for operator.
*
* @param residual Field containing values for residual
diff --git a/libsrc/pylith/feassemble/Integrator.icc b/libsrc/pylith/feassemble/Integrator.icc
index 6c3adf5..241da93 100644
--- a/libsrc/pylith/feassemble/Integrator.icc
+++ b/libsrc/pylith/feassemble/Integrator.icc
@@ -47,6 +47,12 @@ void
pylith::feassemble::Integrator::initialize(const topology::Mesh& mesh) {
} // initialize
+// Setup DOF on solution field.
+inline
+void
+pylith::feassemble::Integrator::setupSolnDof(topology::Field* field) {
+} // setupSolnDof
+
// Integrate contributions to residual term (r) for operator.
inline
void
diff --git a/modulesrc/feassemble/Integrator.i b/modulesrc/feassemble/Integrator.i
index 64bf2e8..b158120 100644
--- a/modulesrc/feassemble/Integrator.i
+++ b/modulesrc/feassemble/Integrator.i
@@ -105,6 +105,13 @@ namespace pylith {
virtual
void initialize(const pylith::topology::Mesh& mesh);
+ /** Setup DOF on solution field.
+ *
+ * @param field Solution field.
+ */
+ virtual
+ void setupSolnDof(pylith::topology::Field* field);
+
/** Integrate contributions to residual term (r) for operator.
*
* @param residual Field containing values for residual
diff --git a/pylith/problems/Formulation.py b/pylith/problems/Formulation.py
index e96efb9..801af3e 100644
--- a/pylith/problems/Formulation.py
+++ b/pylith/problems/Formulation.py
@@ -504,9 +504,11 @@ class Formulation(PetscComponent, ModuleFormulation):
if self.splitFields():
solution.subfieldAdd("lagrange multiplier", dimension)
solution.subfieldsSetup()
- solution.newSection(solution.VERTICES_FIELD, dimension)
- solution.subfieldSetDof("displacement", solution.VERTICES_FIELD, dimension)
-
+ solution.setupSolnChart()
+ solution.setupSolnDof(dimension)
+ # Loop over integrators to adjust DOF layout
+ for integrator in self.integrators:
+ integrator.setupSolnDof(solution)
solution.vectorFieldType(solution.VECTOR)
solution.scale(lengthScale.value)
else:
@@ -522,12 +524,10 @@ class Formulation(PetscComponent, ModuleFormulation):
solution.vectorFieldType("displacement", solution.VECTOR)
solution.scale("displacement", lengthScale.value)
- if self.splitFields():
- for integrator in self.integrators:
- integrator.splitField(solution)
for constraint in self.constraints:
constraint.setConstraintSizes(solution)
solution.allocate()
+ solution.zero()
for constraint in self.constraints:
constraint.setConstraints(solution)
for integrator in self.integrators:
More information about the CIG-COMMITS
mailing list