[cig-commits] r16613 - in short/3D/PyLith/trunk: . libsrc/faults libsrc/problems modulesrc/problems pylith/problems
brad at geodynamics.org
brad at geodynamics.org
Mon May 3 17:58:32 PDT 2010
Author: brad
Date: 2010-05-03 17:58:32 -0700 (Mon, 03 May 2010)
New Revision: 16613
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.cc
short/3D/PyLith/trunk/libsrc/problems/Explicit.cc
short/3D/PyLith/trunk/libsrc/problems/Explicit.hh
short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
short/3D/PyLith/trunk/libsrc/problems/Formulation.hh
short/3D/PyLith/trunk/libsrc/problems/Implicit.cc
short/3D/PyLith/trunk/libsrc/problems/Implicit.hh
short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc
short/3D/PyLith/trunk/libsrc/problems/SolverLumped.cc
short/3D/PyLith/trunk/libsrc/problems/SolverNonlinear.cc
short/3D/PyLith/trunk/modulesrc/problems/Explicit.i
short/3D/PyLith/trunk/modulesrc/problems/Formulation.i
short/3D/PyLith/trunk/modulesrc/problems/Implicit.i
short/3D/PyLith/trunk/pylith/problems/Explicit.py
Log:
Fixed consistency of updating velocity and acceleration fields. Must be consistent with solution when reforming residual and consistent with solution after solve.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/TODO 2010-05-04 00:58:32 UTC (rev 16613)
@@ -6,9 +6,6 @@
MAIN PRIORITIES
-* Mesh reordering
- + MATT needs to include vertices in reordering.
-
* Better preconditioning
+ Need settings for Schur complement
@@ -26,17 +23,19 @@
+ Add stuff to manual
* Optimization
- + Reorder vertices/cells using reverse Cuthill-McKee
+ Specialized elasticity integrator objects for Tri3, Quad4, Tet4, Hex8
+ inline methods (what isn't getting inlined) -Winline
* Lumped solver
+ Need to finish unit tests
+ + Remove redundant call to calcRateFields in SolverLumped.
+ Update velocity and slip rate fields in adjustSolnLumped().
* Updates to manual
+ tutorial
+ governing equations
+ Large deformation formulation
+ + mesh reordering
+ Lumped solver
+ Cleanup bulk constitutive models (consistent w/governing eqns)
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.cc 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDyn.cc 2010-05-04 00:58:32 UTC (rev 16613)
@@ -1469,7 +1469,8 @@
velocityVertexP[kDim] * +orientationVertex[iDim*spaceDim+kDim];
// Update slip rate field.
- assert(slipRateVertex.size() == slipRateSection->getFiberDimension(v_fault));
+ assert(slipRateVertex.size() ==
+ slipRateSection->getFiberDimension(v_fault));
slipRateSection->updatePoint(v_fault, &slipRateVertex[0]);
} // for
Modified: short/3D/PyLith/trunk/libsrc/problems/Explicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Explicit.cc 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/Explicit.cc 2010-05-04 00:58:32 UTC (rev 16613)
@@ -36,8 +36,8 @@
// ----------------------------------------------------------------------
// Compute velocity and acceleration at time t.
void
-pylith::problems::Explicit::_calcRateFields(void)
-{ // _calcRateFields
+pylith::problems::Explicit::calcRateFields(void)
+{ // calcRateFields
assert(0 != _fields);
// vel(t) = (disp(t+dt) - disp(t-dt)) / (2*dt)
@@ -55,17 +55,6 @@
assert(0 != cs);
const int spaceDim = cs->spaceDim();
- if (!_fields->hasField("velocity(t)")) {
- _fields->add("velocity(t)", "velocity");
- topology::Field<topology::Mesh>& velocity = _fields->get("velocity(t)");
- velocity.cloneSection(dispIncr);
-
- _fields->add("acceleration(t)", "acceleration");
- topology::Field<topology::Mesh>& acceleration =
- _fields->get("acceleration(t)");
- acceleration.cloneSection(dispIncr);
- } // if
-
// Get sections.
double_array dispIncrVertex(spaceDim);
const ALE::Obj<RealSection>& dispIncrSection = dispIncr.section();
@@ -120,8 +109,33 @@
} // for
PetscLogFlops(vertices->size() * 6*spaceDim);
-} // _calcRateFields
+} // calcRateFields
+// ----------------------------------------------------------------------
+// Setup rate fields.
+void
+pylith::problems::Explicit::_setupRateFields(void)
+{ // _setupRateFields
+ assert(0 != _fields);
+
+ topology::Field<topology::Mesh>& dispIncr = _fields->get("dispIncr(t->t+dt)");
+ if (!_fields->hasField("velocity(t)")) {
+ _fields->add("velocity(t)", "velocity");
+ topology::Field<topology::Mesh>& velocity = _fields->get("velocity(t)");
+ velocity.cloneSection(dispIncr);
+ velocity.zero();
+ } // if
+ if (!_fields->hasField("acceleration(t)")) {
+ _fields->add("acceleration(t)", "acceleration");
+ topology::Field<topology::Mesh>& acceleration =
+ _fields->get("acceleration(t)");
+ acceleration.cloneSection(dispIncr);
+ acceleration.zero();
+ } // if
+} // _setupRateFields
+
+
+
// End of file
Modified: short/3D/PyLith/trunk/libsrc/problems/Explicit.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Explicit.hh 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/Explicit.hh 2010-05-04 00:58:32 UTC (rev 16613)
@@ -41,11 +41,14 @@
/// Destructor
~Explicit(void);
-// PROTECTED METHODS ////////////////////////////////////////////////////
+ /// Compute rate fields (velocity and/or acceleration) at time t.
+ void calcRateFields(void);
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
protected :
- /// Compute velocity and acceleration at time t.
- void _calcRateFields(void);
+ /// Setup rate fields.
+ void _setupRateFields(void);
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.cc 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.cc 2010-05-04 00:58:32 UTC (rev 16613)
@@ -134,6 +134,8 @@
_fields = fields;
_t = t;
_dt = dt;
+
+ _setupRateFields();
} // updateSettings
// ----------------------------------------------------------------------
@@ -153,6 +155,8 @@
_fields = fields;
_t = t;
_dt = dt;
+
+ _setupRateFields();
} // updateSettings
// ----------------------------------------------------------------------
@@ -169,8 +173,8 @@
solution.scatterVectorToSection(*tmpSolutionVec);
} // if
- // Compute rate fields.
- _calcRateFields();
+ // Update rate fields (must be consistent with current solution).
+ calcRateFields();
// Set residual to zero.
topology::Field<topology::Mesh>& residual = _fields->get("residual");
@@ -225,8 +229,8 @@
solution.scatterVectorToSection(*tmpSolutionVec);
} // if
- // Compute rate fields.
- _calcRateFields();
+ // Update rate fields (must be consistent with current solution).
+ calcRateFields();
// Set residual to zero.
topology::Field<topology::Mesh>& residual = _fields->get("residual");
Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.hh 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.hh 2010-05-04 00:58:32 UTC (rev 16613)
@@ -150,12 +150,16 @@
*/
void adjustSolnLumped(void);
-// PROTECTED METHODS ////////////////////////////////////////////////////
+ /// Compute rate fields (velocity and/or acceleration) at time t.
+ virtual
+ void calcRateFields(void) = 0;
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
protected :
- /// Compute velocity at time t.
+ /// Setup rate fields.
virtual
- void _calcRateFields(void) = 0;
+ void _setupRateFields(void) = 0;
// PROTECTED MEMBERS ////////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/libsrc/problems/Implicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Implicit.cc 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/Implicit.cc 2010-05-04 00:58:32 UTC (rev 16613)
@@ -36,8 +36,8 @@
// ----------------------------------------------------------------------
// Compute velocity at time t.
void
-pylith::problems::Implicit::_calcRateFields(void)
-{ // _calcRateFields
+pylith::problems::Implicit::calcRateFields(void)
+{ // calcRateFields
assert(0 != _fields);
// vel(t) = (disp(t+dt) - disp(t)) / dt
@@ -49,12 +49,6 @@
assert(0 != cs);
const int spaceDim = cs->spaceDim();
- if (!_fields->hasField("velocity(t)")) {
- _fields->add("velocity(t)", "velocity");
- topology::Field<topology::Mesh>& velocity = _fields->get("velocity(t)");
- velocity.cloneSection(dispIncr);
- } // if
-
// Get sections.
double_array dispIncrVertex(spaceDim);
const ALE::Obj<RealSection>& dispIncrSection = dispIncr.section();
@@ -86,7 +80,23 @@
} // for
PetscLogFlops(vertices->size() * spaceDim);
-} // _calcRateFields
+} // calcRateFields
+// ----------------------------------------------------------------------
+// Setup rate fields.
+void
+pylith::problems::Implicit::_setupRateFields(void)
+{ // _setupRateFields
+ assert(0 != _fields);
+
+ topology::Field<topology::Mesh>& dispIncr = _fields->get("dispIncr(t->t+dt)");
+ if (!_fields->hasField("velocity(t)")) {
+ _fields->add("velocity(t)", "velocity");
+ topology::Field<topology::Mesh>& velocity = _fields->get("velocity(t)");
+ velocity.cloneSection(dispIncr);
+ velocity.zero();
+ } // if
+} // _setupRateFields
+
// End of file
Modified: short/3D/PyLith/trunk/libsrc/problems/Implicit.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Implicit.hh 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/Implicit.hh 2010-05-04 00:58:32 UTC (rev 16613)
@@ -41,11 +41,14 @@
/// Destructor
~Implicit(void);
-// PROTECTED METHODS ////////////////////////////////////////////////////
+ /// Compute rate fields (velocity and/or acceleration) at time t.
+ void calcRateFields(void);
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
protected :
- /// Compute velocity at time t.
- void _calcRateFields(void);
+ /// Setup rate fields.
+ void _setupRateFields(void);
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc 2010-05-04 00:58:32 UTC (rev 16613)
@@ -105,6 +105,7 @@
{ // solve
assert(0 != solution);
assert(0 != jacobian);
+ assert(0 != _formulation);
const int setupEvent = _logger->eventId("SoLi setup");
const int solveEvent = _logger->eventId("SoLi solve");
@@ -143,6 +144,9 @@
solution->scatterVectorToSection();
_logger->eventEnd(scatterEvent);
+
+ // Update rate fields to be consistent with current solution.
+ _formulation->calcRateFields();
} // solve
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/problems/SolverLumped.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/SolverLumped.cc 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/SolverLumped.cc 2010-05-04 00:58:32 UTC (rev 16613)
@@ -130,10 +130,16 @@
_logger->eventEnd(solveEvent);
_logger->eventBegin(adjustEvent);
+ // Update rate fields to be consistent with current solution.
+ _formulation->calcRateFields();
+
// Adjust solution to match constraints
_formulation->adjustSolnLumped();
_logger->eventEnd(adjustEvent);
+
+ // Update rate fields to be consistent with current solution.
+ _formulation->calcRateFields(); // :KLUDGE: Update only those changed in FaultCohesiveDyn
} // solve
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/SolverNonlinear.cc 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/libsrc/problems/SolverNonlinear.cc 2010-05-04 00:58:32 UTC (rev 16613)
@@ -119,6 +119,9 @@
solution->scatterVectorToSection();
_logger->eventEnd(scatterEvent);
+
+ // Update rate fields to be consistent with current solution.
+ _formulation->calcRateFields();
} // solve
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/modulesrc/problems/Explicit.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/Explicit.i 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/modulesrc/problems/Explicit.i 2010-05-04 00:58:32 UTC (rev 16613)
@@ -31,12 +31,15 @@
/// Destructor
~Explicit(void);
- // PROTECTED METHODS ////////////////////////////////////////////////
- protected :
+ /// Compute rate fields (velocity and/or acceleration) at time t.
+ void calcRateFields(void);
- /// Compute velocity at time t.
- void _calcVelocity(void);
+ // PROTECTED MEMBERS //////////////////////////////////////////////
+ protected :
+ /// Setup rate fields.
+ void _setupRateFields(void);
+
}; // Explicit
} // problems
Modified: short/3D/PyLith/trunk/modulesrc/problems/Formulation.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/Formulation.i 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/modulesrc/problems/Formulation.i 2010-05-04 00:58:32 UTC (rev 16613)
@@ -119,13 +119,17 @@
*/
void reformJacobianLumped(void);
- // PROTECTED METHODS ////////////////////////////////////////////////
- protected :
-
- /// Compute velocity at time t.
+ /// Compute rate fields (velocity and/or acceleration) at time t.
virtual
- void _calcVelocity(void) = 0;
+ void calcRateFields(void) = 0;
+ // PROTECTED MEMBERS //////////////////////////////////////////////
+ protected :
+
+ /// Setup rate fields.
+ virtual
+ void _setupRateFields(void) = 0;
+
}; // Formulation
} // problems
Modified: short/3D/PyLith/trunk/modulesrc/problems/Implicit.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/Implicit.i 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/modulesrc/problems/Implicit.i 2010-05-04 00:58:32 UTC (rev 16613)
@@ -31,12 +31,15 @@
/// Destructor
~Implicit(void);
- // PROTECTED METHODS ////////////////////////////////////////////////
- protected :
+ /// Compute rate fields (velocity and/or acceleration) at time t.
+ void calcRateFields(void);
- /// Compute velocity at time t.
- void _calcVelocity(void);
+ // PROTECTED MEMBERS //////////////////////////////////////////////
+ protected :
+ /// Setup rate fields.
+ void _setupRateFields(void);
+
}; // Implicit
} // problems
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2010-05-04 00:55:01 UTC (rev 16612)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2010-05-04 00:58:32 UTC (rev 16613)
@@ -162,6 +162,14 @@
logEvent = "%spoststep" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
+ # Note that Formulation.poststep is primarily output, and since
+ # the velocity and acceleration at time t depends on the
+ # displacement at time t+dt, we want to output BEFORE updating the
+ # displacement fields so that the displacement, velocity, and
+ # acceleration files are all at time t.
+ Formulation.poststep(self, t, dt)
+
+ # Update displacement field from time t to time t+dt.
dispIncr = self.fields.get("dispIncr(t->t+dt)")
dispT = self.fields.get("disp(t)")
dispTmdt = self.fields.get("disp(t-dt)")
@@ -170,8 +178,6 @@
dispT += dispIncr
dispIncr.zero()
- Formulation.poststep(self, t, dt)
-
self._eventLogger.eventEnd(logEvent)
return
More information about the CIG-COMMITS
mailing list