[cig-commits] r16702 - in short/3D/PyLith/trunk: . libsrc/bc libsrc/feassemble libsrc/materials modulesrc/bc modulesrc/feassemble modulesrc/materials pylith/problems pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Thu May 13 23:08:15 PDT 2010
Author: brad
Date: 2010-05-13 23:08:15 -0700 (Thu, 13 May 2010)
New Revision: 16702
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/bc/DirichletBC.hh
short/3D/PyLith/trunk/libsrc/bc/DirichletBC.icc
short/3D/PyLith/trunk/libsrc/feassemble/Constraint.hh
short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc
short/3D/PyLith/trunk/libsrc/materials/DruckerPrager3D.cc
short/3D/PyLith/trunk/libsrc/materials/DruckerPrager3D.hh
short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc
short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.hh
short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.cc
short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.hh
short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.cc
short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.hh
short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.cc
short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.hh
short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.cc
short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.hh
short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.cc
short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.hh
short/3D/PyLith/trunk/libsrc/materials/Material.cc
short/3D/PyLith/trunk/libsrc/materials/Material.hh
short/3D/PyLith/trunk/libsrc/materials/Material.icc
short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.cc
short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.hh
short/3D/PyLith/trunk/libsrc/materials/MaxwellPlaneStrain.cc
short/3D/PyLith/trunk/libsrc/materials/MaxwellPlaneStrain.hh
short/3D/PyLith/trunk/libsrc/materials/PowerLaw3D.cc
short/3D/PyLith/trunk/libsrc/materials/PowerLaw3D.hh
short/3D/PyLith/trunk/modulesrc/bc/DirichletBC.i
short/3D/PyLith/trunk/modulesrc/feassemble/Constraint.i
short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i
short/3D/PyLith/trunk/modulesrc/materials/DruckerPrager3D.i
short/3D/PyLith/trunk/modulesrc/materials/ElasticIsotropic3D.i
short/3D/PyLith/trunk/modulesrc/materials/ElasticPlaneStrain.i
short/3D/PyLith/trunk/modulesrc/materials/ElasticPlaneStress.i
short/3D/PyLith/trunk/modulesrc/materials/ElasticStrain1D.i
short/3D/PyLith/trunk/modulesrc/materials/ElasticStress1D.i
short/3D/PyLith/trunk/modulesrc/materials/GenMaxwellIsotropic3D.i
short/3D/PyLith/trunk/modulesrc/materials/Material.i
short/3D/PyLith/trunk/modulesrc/materials/MaxwellIsotropic3D.i
short/3D/PyLith/trunk/modulesrc/materials/MaxwellPlaneStrain.i
short/3D/PyLith/trunk/modulesrc/materials/PowerLaw3D.i
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
short/3D/PyLith/trunk/pylith/topology/Jacobian.py
Log:
Hooked up tests for checking whether materials will generate symmetric Jacobian. Added check to see if constraints permit using matrix with block size equal to spatial dimension.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/TODO 2010-05-14 06:08:15 UTC (rev 16702)
@@ -6,9 +6,11 @@
MAIN PRIORITIES
+* unittests
+ isJacobianSymmetric() (materials)
+ numDimConstrained() (DirichletBC)
+
* Drucker-Prager elastoplastic
- Need to link isJacobianSymmetric() in Integrator with materials.
- Need to pass hint when creating Jacobian.
* Use node set names in MeshIOCubit.
ns_names for nodesets
@@ -309,11 +311,6 @@
RELEASE 1.5
----------------------------------------------------------------------
-1. Nondimensionalization
-
- Ask constraints if a block matrix is okay. If okay and matrix type
- is "unknown" (not set by user), then set block size. Do this in Python.
-
2. 2-D Plane strain Maxwell viscoelastic rheology [Charles]
3. 2-D Plane strain Generalized Maxwell viscoelastic rheology [Charles]
@@ -336,8 +333,6 @@
Modularize output? [Matt]
-Fault friction
-
Uniform refinement (debug, check, all cell types)
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBC.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBC.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBC.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -47,6 +47,12 @@
virtual
void deallocate(void);
+ /** Get number of constraints per location.
+ *
+ * @returns Number of constraints per location.
+ */
+ int numDimConstrained(void) const;
+
/** Initialize boundary condition.
*
* @param mesh PETSc mesh
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBC.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBC.icc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBC.icc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -24,5 +24,12 @@
return *_normalizer;
}
+// Get number of constraints per location.
+inline
+int
+pylith::bc::DirichletBC::numDimConstrained(void) const {
+ return _bcDOF.size();
+}
+
// End of file
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Constraint.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Constraint.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Constraint.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -53,6 +53,21 @@
*/
void normalizer(const spatialdata::units::Nondimensional& dim);
+ /** Set flag for setting constraints for total field solution or
+ * incremental field solution.
+ *
+ * @param flag True if using incremental solution, false otherwise.
+ */
+ virtual
+ void useSolnIncr(const bool flag);
+
+ /** Get number of constraints per location.
+ *
+ * @returns Number of constraints per location.
+ */
+ virtual
+ int numDimConstrained(void) const = 0;
+
/** Set number of degrees of freedom that are constrained at points in field.
*
* @param field Solution field
@@ -67,14 +82,6 @@
virtual
void setConstraints(const topology::Field<topology::Mesh>& field) = 0;
- /** Set flag for setting constraints for total field solution or
- * incremental field solution.
- *
- * @param flag True if using incremental solution, false otherwise.
- */
- virtual
- void useSolnIncr(const bool flag);
-
/** Set values in field.
*
* @param t Current time
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -108,11 +108,12 @@
virtual
bool needNewJacobian(void) const;
- /** Check whether integrator needs velocity.
- *
- * @returns True if integrator needs velocity for computation.
- */
- bool isJacobianSymmetric(void) const;
+ /** Check whether integrator generates a symmetric Jacobian.
+ *
+ * @returns True if integrator generates symmetric Jacobian.
+ */
+ virtual
+ bool isJacobianSymmetric(void) const;
/** Set flag for setting constraints for total field solution or
* incremental field solution.
Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -121,6 +121,7 @@
// Initialize material.
_material->initialize(mesh, _quadrature);
+ _isJacobianSymmetric = _material->isJacobianSymmetric();
// Allocate vectors and matrices for cell values.
_initCellVector();
Modified: short/3D/PyLith/trunk/libsrc/materials/DruckerPrager3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/DruckerPrager3D.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/DruckerPrager3D.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -181,7 +181,7 @@
void
pylith::materials::DruckerPrager3D::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
@@ -209,6 +209,9 @@
throw std::runtime_error(msg.str());
} // if
+ if (fabs(frictionAngle != dilatationAngle) > 1.0e-6)
+ _isJacobianSymmetric = false;
+
const double mu = density * vs*vs;
const double lambda = density * vp*vp - 2.0*mu;
const double denomFriction = sqrt(3.0) * (3.0 - sin(frictionAngle));
@@ -293,7 +296,7 @@
void
pylith::materials::DruckerPrager3D::_dbToStateVars(
double* const stateValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToStateVars
assert(0 != stateValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/DruckerPrager3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/DruckerPrager3D.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/DruckerPrager3D.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -71,7 +71,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -95,7 +95,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize state variables..
*
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -103,7 +103,7 @@
void
pylith::materials::ElasticIsotropic3D::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -69,7 +69,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -103,7 +103,7 @@
void
pylith::materials::ElasticPlaneStrain::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -69,7 +69,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -103,7 +103,7 @@
void
pylith::materials::ElasticPlaneStress::_dbToProperties(
double* propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -71,7 +71,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -103,7 +103,7 @@
void
pylith::materials::ElasticStrain1D::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -70,7 +70,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -103,7 +103,7 @@
void
pylith::materials::ElasticStress1D::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -71,7 +71,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -231,7 +231,7 @@
void
pylith::materials::GenMaxwellIsotropic3D::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
@@ -364,7 +364,7 @@
void
pylith::materials::GenMaxwellIsotropic3D::_dbToStateVars(
double* const stateValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToStateVars
assert(0 != stateValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/GenMaxwellIsotropic3D.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -81,7 +81,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -105,7 +105,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
// Note: We do not need to dimensionalize or nondimensionalize state
// variables because there are strains, which are dimensionless.
Modified: short/3D/PyLith/trunk/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -49,6 +49,7 @@
_dimension(dimension),
_tensorSize(tensorSize),
_needNewJacobian(false),
+ _isJacobianSymmetric(true),
_dbProperties(0),
_dbInitialState(0),
_id(0),
Modified: short/3D/PyLith/trunk/libsrc/materials/Material.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -150,6 +150,12 @@
*/
bool needNewJacobian(void) const;
+ /** Check whether material generates a symmetric Jacobian.
+ *
+ * @returns True if material generates symmetric Jacobian.
+ */
+ bool isJacobianSymmetric(void) const;
+
/// Reset flag indicating whether Jacobian matrix must be reformed for
/// current state.
void resetNeedNewJacobian(void);
@@ -202,7 +208,7 @@
*/
virtual
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const = 0;
+ const double_array& dbValues) = 0;
/** Nondimensionalize properties.
*
@@ -229,7 +235,7 @@
*/
virtual
void _dbToStateVars(double* const stateValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize state variables.
*
@@ -267,6 +273,7 @@
const int _dimension; ///< Spatial dimension associated with material.
const int _tensorSize; ///< Tensor size for material.
bool _needNewJacobian; ///< True if need to reform Jacobian, false otherwise.
+ bool _isJacobianSymmetric; ///< True if Jacobian is symmetric;
// PRIVATE METHODS ////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/materials/Material.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.icc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.icc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -100,11 +100,18 @@
_needNewJacobian = false;
} // resetNeedNewJacobian
+// Check whether material generates a symmetric Jacobian.
+inline
+bool
+pylith::materials::Material::isJacobianSymmetric(void) const {
+ return _isJacobianSymmetric;
+} // isJacobianSymmetric
+
// Compute initial state variables from values in spatial database.
inline
void
pylith::materials::Material::_dbToStateVars(double* const stateValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{}
// Nondimensionalize state variables.
Modified: short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -178,7 +178,7 @@
void
pylith::materials::MaxwellIsotropic3D::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
@@ -279,7 +279,7 @@
void
pylith::materials::MaxwellIsotropic3D::_dbToStateVars(
double* const stateValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToStateVars
assert(0 != stateValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -68,7 +68,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -92,7 +92,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
// Note: We do not need to dimensionalize or nondimensionalize state
// variables because there are strains, which are dimensionless.
Modified: short/3D/PyLith/trunk/libsrc/materials/MaxwellPlaneStrain.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/MaxwellPlaneStrain.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/MaxwellPlaneStrain.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -172,7 +172,7 @@
void
pylith::materials::MaxwellPlaneStrain::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
@@ -273,7 +273,7 @@
void
pylith::materials::MaxwellPlaneStrain::_dbToStateVars(
double* const stateValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToStateVars
assert(0 != stateValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/MaxwellPlaneStrain.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/MaxwellPlaneStrain.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/MaxwellPlaneStrain.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -70,7 +70,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -94,7 +94,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
// Note: We do not need to dimensionalize or nondimensionalize state
// variables because there are strains, which are dimensionless.
Modified: short/3D/PyLith/trunk/libsrc/materials/PowerLaw3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/PowerLaw3D.cc 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/PowerLaw3D.cc 2010-05-14 06:08:15 UTC (rev 16702)
@@ -198,7 +198,7 @@
void
pylith::materials::PowerLaw3D::_dbToProperties(
double* const propValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
@@ -312,7 +312,7 @@
void
pylith::materials::PowerLaw3D::_dbToStateVars(
double* const stateValues,
- const double_array& dbValues) const
+ const double_array& dbValues)
{ // _dbToStateVars
assert(0 != stateValues);
const int numDBValues = dbValues.size();
Modified: short/3D/PyLith/trunk/libsrc/materials/PowerLaw3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/PowerLaw3D.hh 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/libsrc/materials/PowerLaw3D.hh 2010-05-14 06:08:15 UTC (rev 16702)
@@ -96,7 +96,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -120,7 +120,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const double_array& dbValues) const;
+ const double_array& dbValues);
/** Nondimensionalize state variables..
*
Modified: short/3D/PyLith/trunk/modulesrc/bc/DirichletBC.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/DirichletBC.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/bc/DirichletBC.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -36,6 +36,12 @@
virtual
void deallocate(void);
+ /** Get number of constraints per location.
+ *
+ * @returns Number of constraints per location.
+ */
+ int numDimConstrained(void) const;
+
/** Initialize boundary condition.
*
* @param mesh PETSc mesh
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/Constraint.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/Constraint.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/Constraint.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -35,6 +35,21 @@
virtual
void deallocate(void);
+ /** Set flag for setting constraints for total field solution or
+ * incremental field solution.
+ *
+ * @param flag True if using incremental solution, false otherwise.
+ */
+ virtual
+ void useSolnIncr(const bool flag);
+
+ /** Get number of constraints per location.
+ *
+ * @returns Number of constraints per location.
+ */
+ virtual
+ int numDimConstrained(void) const = 0;
+
/** Set manager of scales used to nondimensionalize problem.
*
* @param dim Nondimensionalizer.
@@ -56,14 +71,6 @@
virtual
void setConstraints(const pylith::topology::Field<pylith::topology::Mesh>& field) = 0;
- /** Set flag for setting constraints for total field solution or
- * incremental field solution.
- *
- * @param flag True if using incremental solution, false otherwise.
- */
- virtual
- void useSolnIncr(const bool flag);
-
/** Set values in field.
*
* @param t Current time
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/Integrator.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -86,6 +86,13 @@
virtual
bool needNewJacobian(void) const;
+ /** Check whether integrator generates a symmetric Jacobian.
+ *
+ * @returns True if integrator generates symmetric Jacobian.
+ */
+ virtual
+ bool isJacobianSymmetric(void) const;
+
/** Set flag for setting constraints for total field solution or
* incremental field solution.
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/DruckerPrager3D.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/DruckerPrager3D.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/DruckerPrager3D.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -54,7 +54,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -78,7 +78,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize state variables..
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/ElasticIsotropic3D.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/ElasticIsotropic3D.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/ElasticIsotropic3D.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -52,7 +52,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/ElasticPlaneStrain.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/ElasticPlaneStrain.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/ElasticPlaneStrain.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -52,7 +52,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/ElasticPlaneStress.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/ElasticPlaneStress.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/ElasticPlaneStress.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -52,7 +52,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/ElasticStrain1D.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/ElasticStrain1D.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/ElasticStrain1D.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -52,7 +52,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/ElasticStress1D.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/ElasticStress1D.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/ElasticStress1D.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -52,7 +52,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/GenMaxwellIsotropic3D.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/GenMaxwellIsotropic3D.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/GenMaxwellIsotropic3D.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -54,7 +54,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -78,7 +78,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Compute density from properties.
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/Material.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/Material.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/Material.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -120,6 +120,12 @@
/// current state.
void resetNeedNewJacobian(void);
+ /** Check whether integrator generates a symmetric Jacobian.
+ *
+ * @returns True if integrator generates symmetric Jacobian.
+ */
+ bool isJacobianSymmetric(void) const;
+
/** Get physical property or state variable field. Data is returned
* via the argument.
*
@@ -151,7 +157,7 @@
*/
virtual
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const = 0;
+ const pylith::double_array& dbValues) = 0;
/** Nondimensionalize properties.
*
Modified: short/3D/PyLith/trunk/modulesrc/materials/MaxwellIsotropic3D.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/MaxwellIsotropic3D.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/MaxwellIsotropic3D.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -54,7 +54,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -78,7 +78,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
// Note: We do not need to dimensionalize or nondimensionalize state
// variables because there are strains, which are dimensionless.
Modified: short/3D/PyLith/trunk/modulesrc/materials/MaxwellPlaneStrain.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/MaxwellPlaneStrain.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/MaxwellPlaneStrain.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -54,7 +54,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -78,7 +78,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
// Note: We do not need to dimensionalize or nondimensionalize state
// variables because there are strains, which are dimensionless.
Modified: short/3D/PyLith/trunk/modulesrc/materials/PowerLaw3D.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/PowerLaw3D.i 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/modulesrc/materials/PowerLaw3D.i 2010-05-14 06:08:15 UTC (rev 16702)
@@ -54,7 +54,7 @@
* @param dbValues Array of database values.
*/
void _dbToProperties(double* const propValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize properties.
*
@@ -78,7 +78,7 @@
* @param dbValues Array of database values.
*/
void _dbToStateVars(double* const stateValues,
- const pylith::double_array& dbValues) const;
+ const pylith::double_array& dbValues);
/** Nondimensionalize state variables..
*
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2010-05-14 06:08:15 UTC (rev 16702)
@@ -92,8 +92,10 @@
logger.stagePop()
self._info.log("Creating Jacobian matrix.")
+ self._setJacobianMatrixType()
from pylith.topology.Jacobian import Jacobian
- self.jacobian = Jacobian(self.fields.solution(), self.matrixType)
+ self.jacobian = Jacobian(self.fields.solution(),
+ self.matrixType, self.blockMatrixOkay)
self.jacobian.zero() # TEMPORARY, to get correct memory usage
self._debug.log(resourceUsageString())
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2010-05-14 06:08:15 UTC (rev 16702)
@@ -292,6 +292,32 @@
return
+ def _setJacobianMatrixType(self):
+ """
+ Determine appropriate PETSc matrix type for Jacobian matrix.
+ """
+ # Mapping from symmetric matrix type to nonsymmetric matrix type
+ matrixMap = {'sbaij': 'baij',
+ 'seqsbaij': 'seqbaij',
+ 'mpisbaij': 'mpibaij',
+ 'unknown': 'aij'}
+ isJacobianSymmetric = True
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
+ if not integrator.isJacobianSymmetric():
+ isJacobianSymmetric = False
+ if not isJacobianSymmetric:
+ if self.matrixType in matrixMap.keys():
+ print "WARNING: Jacobian matrix will not be symmetric.\n" \
+ " Switching matrix type from '%s' to '%s'." % \
+ (self.matrixType, matrixMap[self.matrixType])
+ self.matrixType = matrixMap[self.matrixType]
+ self.blockMatrixOkay = True
+ for constraint in self.constraints:
+ numDimConstrained = constraint.numDimConstrained()
+ if numDimConstrained > 0 and self.mesh.dimension() != numDimConstrained:
+ self.blockMatrixOkay = False
+ return
+
def _setupMaterials(self, materials):
"""
Setup materials as integrators.
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2010-05-14 06:08:15 UTC (rev 16702)
@@ -132,8 +132,10 @@
# Allocates memory for nonzero pattern and Jacobian
self._info.log("Creating Jacobian matrix.")
+ self._setJacobianMatrixType()
from pylith.topology.Jacobian import Jacobian
- self.jacobian = Jacobian(self.fields.solution(), self.matrixType)
+ self.jacobian = Jacobian(self.fields.solution(),
+ self.matrixType, self.blockMatrixOkay)
self.jacobian.zero() # TEMPORARY, to get correct memory usage
self._debug.log(resourceUsageString())
Modified: short/3D/PyLith/trunk/pylith/topology/Jacobian.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Jacobian.py 2010-05-13 22:56:19 UTC (rev 16701)
+++ short/3D/PyLith/trunk/pylith/topology/Jacobian.py 2010-05-14 06:08:15 UTC (rev 16702)
@@ -25,7 +25,7 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
- def __init__(self, field, matrixType="unknown"):
+ def __init__(self, field, matrixType="unknown", blockOkay=False):
"""
Constructor.
@@ -35,7 +35,8 @@
if matrixType == "unknown":
matrixType = "sbaij"
- ModuleJacobian.__init__(self, field, matrixType)
+ #print "MATRIX TYPE: %s, BLOCKOKAY: %s" % (matrixType, blockOkay)
+ ModuleJacobian.__init__(self, field, matrixType, blockOkay)
return
More information about the CIG-COMMITS
mailing list