[cig-commits] r17046 - in short/3D/PyLith/trunk: libsrc/faults libsrc/problems modulesrc/problems pylith/problems
brad at geodynamics.org
brad at geodynamics.org
Thu Jul 15 09:51:23 PDT 2010
Author: brad
Date: 2010-07-15 09:51:23 -0700 (Thu, 15 Jul 2010)
New Revision: 17046
Modified:
short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.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/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
short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
Log:
Merge from stable. Fixed setting scales of velocity and acceleration fields.
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc 2010-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveLagrange.cc 2010-07-15 16:51:23 UTC (rev 17046)
@@ -600,7 +600,7 @@
/** We have J = [A C^T]
* [C 0]
*
- * We want to approximate -( C A^(-1) C^T)^(-1)
+ * We want to approximate -( C A^(-1) C^T )
*
* Consider Lagrange vertex L that constrains the relative
* displacement between vertex N on the negative side of the fault
@@ -743,7 +743,7 @@
// Compute -[C] [Adiag]^(-1) [C]^T
// C_{ij} = orientationVertex[i*spaceDim+j]
// C^T_{ij} = orientationVertex[j*spaceDim+i]
- // Adiag^{-1}_{ii} = jacobianInvVertexN[i] + jacobianInvVertexP[i] (BRAD: Are you sure its not a minus sign here?)
+ // Adiag^{-1}_{ii} = jacobianInvVertexN[i] + jacobianInvVertexP[i]
// \sum_{j} C_{ij} Adiag^{-1}_{jj} C^T_{ji}
precondVertexL = 0.0;
for (int kDim=0; kDim < spaceDim; ++kDim) {
Modified: short/3D/PyLith/trunk/libsrc/problems/Explicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Explicit.cc 2010-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/libsrc/problems/Explicit.cc 2010-07-15 16:51:23 UTC (rev 17046)
@@ -114,31 +114,5 @@
PetscLogFlops(vertices->size() * 6*spaceDim);
} // 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-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/libsrc/problems/Explicit.hh 2010-07-15 16:51:23 UTC (rev 17046)
@@ -44,12 +44,6 @@
/// Compute rate fields (velocity and/or acceleration) at time t.
void calcRateFields(void);
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
- /// 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-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.cc 2010-07-15 16:51:23 UTC (rev 17046)
@@ -152,28 +152,6 @@
} // preconditioner
// ----------------------------------------------------------------------
-// Initialize formulation.
-void
-pylith::problems::Formulation::initialize(void)
-{ // initialize
-
- // Determine whether we need to compute velocity
- _isJacobianSymmetric = false;
- int numIntegrators = _meshIntegrators.size();
- for (int i=0; i < numIntegrators; ++i) {
- assert(0 != _meshIntegrators[i]);
- if (_meshIntegrators[i]->isJacobianSymmetric())
- _isJacobianSymmetric = true;
- } // fpr
- numIntegrators = _submeshIntegrators.size();
- for (int i=0; i < numIntegrators; ++i) {
- assert(0 != _submeshIntegrators[i]);
- if (_submeshIntegrators[i]->isJacobianSymmetric())
- _isJacobianSymmetric = true;
- } // for
-} // initialize
-
-// ----------------------------------------------------------------------
// Update handles and parameters for reforming the Jacobian and
// residual.
void
@@ -190,8 +168,6 @@
_fields = fields;
_t = t;
_dt = dt;
-
- _setupRateFields();
} // updateSettings
// ----------------------------------------------------------------------
@@ -211,8 +187,6 @@
_fields = fields;
_t = t;
_dt = dt;
-
- _setupRateFields();
} // updateSettings
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.hh 2010-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.hh 2010-07-15 16:51:23 UTC (rev 17046)
@@ -113,10 +113,6 @@
*/
void customPCMatrix(PetscMat& mat);
- /// Initialize formulation.
- virtual
- void initialize(void);
-
/** Update handles and parameters for reforming the Jacobian and
* residual.
*
@@ -187,13 +183,6 @@
// PROTECTED MEMBERS ////////////////////////////////////////////////////
protected :
- /// Setup rate fields.
- virtual
- void _setupRateFields(void) = 0;
-
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
double _t; ///< Current time (nondimensional).
double _dt; ///< Current time step (nondimensional).
topology::Jacobian* _jacobian; ///< Handle to Jacobian of system.
Modified: short/3D/PyLith/trunk/libsrc/problems/Implicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Implicit.cc 2010-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/libsrc/problems/Implicit.cc 2010-07-15 16:51:23 UTC (rev 17046)
@@ -82,21 +82,5 @@
} // 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-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/libsrc/problems/Implicit.hh 2010-07-15 16:51:23 UTC (rev 17046)
@@ -44,12 +44,6 @@
/// Compute rate fields (velocity and/or acceleration) at time t.
void calcRateFields(void);
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
- /// Setup rate fields.
- void _setupRateFields(void);
-
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/modulesrc/problems/Explicit.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/Explicit.i 2010-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/modulesrc/problems/Explicit.i 2010-07-15 16:51:23 UTC (rev 17046)
@@ -34,12 +34,6 @@
/// Compute rate fields (velocity and/or acceleration) at time t.
void calcRateFields(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-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/modulesrc/problems/Formulation.i 2010-07-15 16:51:23 UTC (rev 17046)
@@ -88,10 +88,6 @@
void submeshIntegrators(pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >** integrators,
const int numIntegrators);
- /// Initialize formulation.
- virtual
- void initialize(void);
-
/** Update handles and parameters for reforming the Jacobian and
* residual.
*
@@ -149,13 +145,6 @@
virtual
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-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/modulesrc/problems/Implicit.i 2010-07-15 16:51:23 UTC (rev 17046)
@@ -34,12 +34,6 @@
/// Compute rate fields (velocity and/or acceleration) at time t.
void calcRateFields(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-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2010-07-15 16:51:23 UTC (rev 17046)
@@ -77,6 +77,8 @@
# Allocate other fields, reusing layout from dispIncr
self._info.log("Creating other fields.")
self.fields.add("disp(t-dt)", "displacement")
+ self.fields.add("velocity(t)", "velocity")
+ self.fields.add("acceleration(t)", "acceleration")
self.fields.copyLayout("dispIncr(t->t+dt)")
self._debug.log(resourceUsageString())
@@ -88,6 +90,19 @@
residual = self.fields.get("residual")
residual.zero()
residual.createVector()
+
+ lengthScale = normalizer.lengthScale()
+ timeScale = normalizer.timeScale()
+ velocityScale = lengthScale / timeScale
+ velocityT = self.fields.get("velocity(t)")
+ velocityT.scale(velocityScale.value)
+ velocityT.zero()
+
+ accelerationScale = velocityScale / timeScale
+ accelerationT = self.fields.get("acceleration(t)")
+ accelerationT.scale(accelerationScale.value)
+ accelerationT.zero()
+
self._debug.log(resourceUsageString())
logger.stagePop()
Modified: short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py 2010-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/pylith/problems/ExplicitLumped.py 2010-07-15 16:51:23 UTC (rev 17046)
@@ -94,6 +94,8 @@
# Allocate other fields, reusing layout from dispIncr
self._info.log("Creating other fields.")
self.fields.add("disp(t-dt)", "displacement")
+ self.fields.add("velocity(t)", "velocity")
+ self.fields.add("acceleration(t)", "acceleration")
self.fields.copyLayout("dispIncr(t->t+dt)")
self._debug.log(resourceUsageString())
@@ -105,6 +107,19 @@
residual = self.fields.get("residual")
residual.zero()
residual.createVector()
+
+ lengthScale = normalizer.lengthScale()
+ timeScale = normalizer.timeScale()
+ velocityScale = lengthScale / timeScale
+ velocityT = self.fields.get("velocity(t)")
+ velocityT.scale(velocityScale.value)
+ velocityT.zero()
+
+ accelerationScale = velocityScale / timeScale
+ accelerationT = self.fields.get("acceleration(t)")
+ accelerationT.scale(accelerationScale.value)
+ accelerationT.zero()
+
self._debug.log(resourceUsageString())
logger.stagePop()
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2010-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2010-07-15 16:51:23 UTC (rev 17046)
@@ -440,7 +440,6 @@
integrator.initialize(totalTime, numTimeSteps, normalizer)
ModuleFormulation.meshIntegrators(self, self.integratorsMesh)
ModuleFormulation.submeshIntegrators(self, self.integratorsSubMesh)
- ModuleFormulation.initialize(self)
self._debug.log(resourceUsageString())
self._info.log("Initializing constraints.")
@@ -485,7 +484,7 @@
memoryLogger.stagePop()
- # This creates a global order
+ # This also creates a global order.
solution.createVector()
solution.createScatter()
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2010-07-15 16:48:41 UTC (rev 17045)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2010-07-15 16:51:23 UTC (rev 17046)
@@ -119,6 +119,7 @@
# Allocate other fields, reusing layout from dispIncr
self._info.log("Creating other fields.")
+ self.fields.add("velocity(t)", "velocity")
self.fields.copyLayout("dispIncr(t->t+dt)")
# Setup fields and set to zero
@@ -127,6 +128,14 @@
residual = self.fields.get("residual")
residual.zero()
residual.createVector()
+
+ lengthScale = normalizer.lengthScale()
+ timeScale = normalizer.timeScale()
+ velocityScale = lengthScale / timeScale
+ velocityT = self.fields.get("velocity(t)")
+ velocityT.scale(velocityScale.value)
+ velocityT.zero()
+
self._debug.log(resourceUsageString())
memoryLogger.stagePop()
More information about the CIG-COMMITS
mailing list