[cig-commits] r20636 - in short/3D/PyLith/branches/v1.7-trunk: libsrc/pylith/feassemble modulesrc/feassemble unittests/libtests/feassemble unittests/libtests/feassemble/data
brad at geodynamics.org
brad at geodynamics.org
Mon Aug 27 16:16:43 PDT 2012
Author: brad
Date: 2012-08-27 16:16:43 -0700 (Mon, 27 Aug 2012)
New Revision: 20636
Modified:
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.hh
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.hh
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/GeometryTri2D.cc
short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicit.i
short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicitTet4.i
short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicitTri3.i
short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/TestElasticityExplicitTet4.cc
short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/TestElasticityExplicitTri3.cc
short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitData2DLinear.cc
short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitData2DQuadratic.cc
short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitGravData2DLinear.cc
short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitGravData2DQuadratic.cc
short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/Mesh2DLinear.py
short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/Mesh2DQuadratic.py
Log:
Added missing bindings for stableTimeStep for explicit time stepping. Updated minCellWidth for tri3 cells based on empirical tests of stable time step.
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -88,6 +88,15 @@
} // timeStep
// ----------------------------------------------------------------------
+// Get stable time step for advancing from time t to time t+dt.
+PylithScalar
+pylith::feassemble::ElasticityExplicitTet4::stableTimeStep(const topology::Mesh& mesh) const
+{ // stableTimeStep
+ assert(_material);
+ return _material->stableTimeStepExplicit(mesh, _quadrature);
+} // stableTimeStep
+
+// ----------------------------------------------------------------------
// Set normalized viscosity for numerical damping.
void
pylith::feassemble::ElasticityExplicitTet4::normViscosity(const PylithScalar viscosity)
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.hh 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.hh 2012-08-27 23:16:43 UTC (rev 20636)
@@ -90,6 +90,15 @@
*/
void timeStep(const PylithScalar dt);
+ /** Get stable time step for advancing from time t to time t+dt.
+ *
+ * Default is current time step.
+ *
+ * @param mesh Finite-element mesh.
+ * @returns Time step
+ */
+ PylithScalar stableTimeStep(const topology::Mesh& mesh) const;
+
/** Set normalized viscosity for numerical damping.
*
* @param viscosity Normalized viscosity (viscosity / elastic modulus).
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -88,6 +88,15 @@
} // timeStep
// ----------------------------------------------------------------------
+// Get stable time step for advancing from time t to time t+dt.
+PylithScalar
+pylith::feassemble::ElasticityExplicitTri3::stableTimeStep(const topology::Mesh& mesh) const
+{ // stableTimeStep
+ assert(_material);
+ return _material->stableTimeStepExplicit(mesh, _quadrature);
+} // stableTimeStep
+
+// ----------------------------------------------------------------------
// Set normalized viscosity for numerical damping.
void
pylith::feassemble::ElasticityExplicitTri3::normViscosity(const PylithScalar viscosity)
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.hh 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.hh 2012-08-27 23:16:43 UTC (rev 20636)
@@ -90,6 +90,15 @@
*/
void timeStep(const PylithScalar dt);
+ /** Get stable time step for advancing from time t to time t+dt.
+ *
+ * Default is current time step.
+ *
+ * @param mesh Finite-element mesh.
+ * @returns Time step
+ */
+ PylithScalar stableTimeStep(const topology::Mesh& mesh) const;
+
/** Set normalized viscosity for numerical damping.
*
* @param viscosity Normalized viscosity (viscosity / elastic modulus).
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/GeometryTri2D.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/GeometryTri2D.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/feassemble/GeometryTri2D.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -230,7 +230,10 @@
const PylithScalar k = 0.5 * (a + b + c);
const PylithScalar r = sqrt(k*(k-a)*(k-b)*(k-c)) / k;
- minWidth = r;
+ const PylithScalar rwidth = 3.0*r; // based on empirical tests
+ if (rwidth < minWidth) {
+ minWidth = rwidth;
+ } // if
PetscLogFlops(3*6 + 3 + 8);
Modified: short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicit.i
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicit.i 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicit.i 2012-08-27 23:16:43 UTC (rev 20636)
@@ -45,6 +45,15 @@
*/
void timeStep(const PylithScalar dt);
+ /** Get stable time step for advancing from time t to time t+dt.
+ *
+ * Default is current time step.
+ *
+ * @param mesh Finite-element mesh.
+ * @returns Time step
+ */
+ PylithScalar stableTimeStep(const pylith::topology::Mesh& mesh) const;
+
/** Set normalized viscosity for numerical damping.
*
* @param viscosity Nondimensional viscosity.
Modified: short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicitTet4.i
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicitTet4.i 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicitTet4.i 2012-08-27 23:16:43 UTC (rev 20636)
@@ -45,6 +45,15 @@
*/
void timeStep(const PylithScalar dt);
+ /** Get stable time step for advancing from time t to time t+dt.
+ *
+ * Default is current time step.
+ *
+ * @param mesh Finite-element mesh.
+ * @returns Time step
+ */
+ PylithScalar stableTimeStep(const pylith::topology::Mesh& mesh) const;
+
/** Set normalized viscosity for numerical damping.
*
* @param viscosity Nondimensional viscosity.
Modified: short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicitTri3.i
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicitTri3.i 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/modulesrc/feassemble/ElasticityExplicitTri3.i 2012-08-27 23:16:43 UTC (rev 20636)
@@ -45,6 +45,15 @@
*/
void timeStep(const PylithScalar dt);
+ /** Get stable time step for advancing from time t to time t+dt.
+ *
+ * Default is current time step.
+ *
+ * @param mesh Finite-element mesh.
+ * @returns Time step
+ */
+ PylithScalar stableTimeStep(const pylith::topology::Mesh& mesh) const;
+
/** Set normalized viscosity for numerical damping.
*
* @param viscosity Nondimensional viscosity.
Modified: short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/TestElasticityExplicitTet4.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/TestElasticityExplicitTet4.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/TestElasticityExplicitTet4.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -366,13 +366,16 @@
void
pylith::feassemble::TestElasticityExplicitTet4::testStableTimeStep(void)
{ // testStableTimeStep
+ CPPUNIT_ASSERT(_data);
+
topology::Mesh mesh;
ElasticityExplicitTet4 integrator;
topology::SolutionFields fields(mesh);
_initialize(&mesh, &integrator, &fields);
- const PylithScalar stableTimeStep = integrator.stableTimeStep(mesh);
- CPPUNIT_ASSERT_EQUAL(pylith::PYLITH_MAXSCALAR, stableTimeStep);
+ const PylithScalar dtStable = integrator.stableTimeStep(mesh);
+ const PylithScalar tolerance = 1.0e-6;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, dtStable/_data->dtStableExplicit, tolerance);
} // testStableTimeStep
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/TestElasticityExplicitTri3.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/TestElasticityExplicitTri3.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/TestElasticityExplicitTri3.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -366,13 +366,16 @@
void
pylith::feassemble::TestElasticityExplicitTri3::testStableTimeStep(void)
{ // testStableTimeStep
+ CPPUNIT_ASSERT(_data);
+
topology::Mesh mesh;
ElasticityExplicitTri3 integrator;
topology::SolutionFields fields(mesh);
_initialize(&mesh, &integrator, &fields);
- const PylithScalar stableTimeStep = integrator.stableTimeStep(mesh);
- CPPUNIT_ASSERT_EQUAL(pylith::PYLITH_MAXSCALAR, stableTimeStep);
+ const PylithScalar dtStable = integrator.stableTimeStep(mesh);
+ const PylithScalar tolerance = 1.0e-6;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, dtStable/_data->dtStableExplicit, tolerance);
} // testStableTimeStep
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitData2DLinear.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitData2DLinear.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitData2DLinear.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -43,7 +43,7 @@
const PylithScalar pylith::feassemble::ElasticityExplicitData2DLinear::_dt = 1.00000000e-02;
-const PylithScalar pylith::feassemble::ElasticityExplicitData2DLinear::_dtStableExplicit = 5.09461158e-05;
+const PylithScalar pylith::feassemble::ElasticityExplicitData2DLinear::_dtStableExplicit = 1.50923086e-04;
const PylithScalar pylith::feassemble::ElasticityExplicitData2DLinear::_gravityVec[] = {
0.00000000e+00, -1.00000000e+08,
Modified: short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitData2DQuadratic.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitData2DQuadratic.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitData2DQuadratic.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -43,7 +43,7 @@
const PylithScalar pylith::feassemble::ElasticityExplicitData2DQuadratic::_dt = 1.00000000e-02;
-const PylithScalar pylith::feassemble::ElasticityExplicitData2DQuadratic::_dtStableExplicit = 9.32914833e-05;
+const PylithScalar pylith::feassemble::ElasticityExplicitData2DQuadratic::_dtStableExplicit = 2.63523138e-04;
const PylithScalar pylith::feassemble::ElasticityExplicitData2DQuadratic::_gravityVec[] = {
0.00000000e+00, -1.00000000e+08,
Modified: short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitGravData2DLinear.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitGravData2DLinear.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitGravData2DLinear.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -43,7 +43,7 @@
const PylithScalar pylith::feassemble::ElasticityExplicitGravData2DLinear::_dt = 1.00000000e-02;
-const PylithScalar pylith::feassemble::ElasticityExplicitGravData2DLinear::_dtStableExplicit = 5.09461158e-05;
+const PylithScalar pylith::feassemble::ElasticityExplicitGravData2DLinear::_dtStableExplicit = 1.50923086e-04;
const PylithScalar pylith::feassemble::ElasticityExplicitGravData2DLinear::_gravityVec[] = {
0.00000000e+00, -1.00000000e+08,
Modified: short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitGravData2DQuadratic.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitGravData2DQuadratic.cc 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/ElasticityExplicitGravData2DQuadratic.cc 2012-08-27 23:16:43 UTC (rev 20636)
@@ -43,7 +43,7 @@
const PylithScalar pylith::feassemble::ElasticityExplicitGravData2DQuadratic::_dt = 1.00000000e-02;
-const PylithScalar pylith::feassemble::ElasticityExplicitGravData2DQuadratic::_dtStableExplicit = 9.32914833e-05;
+const PylithScalar pylith::feassemble::ElasticityExplicitGravData2DQuadratic::_dtStableExplicit = 2.63523138e-04;
const PylithScalar pylith::feassemble::ElasticityExplicitGravData2DQuadratic::_gravityVec[] = {
0.00000000e+00, -1.00000000e+08,
Modified: short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/Mesh2DLinear.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/Mesh2DLinear.py 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/Mesh2DLinear.py 2012-08-27 23:16:43 UTC (rev 20636)
@@ -63,7 +63,7 @@
c = (1.2**2 + 0.2**2)**0.5
k = 0.5 * (a + b + c)
r = (k*(k-a)*(k-b)*(k-c))**0.5 / k
- self.minCellWidth = r
+ self.minCellWidth = min(a, b, c, 3.0*r)
return
Modified: short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/Mesh2DQuadratic.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/Mesh2DQuadratic.py 2012-08-27 20:08:14 UTC (rev 20635)
+++ short/3D/PyLith/branches/v1.7-trunk/unittests/libtests/feassemble/data/Mesh2DQuadratic.py 2012-08-27 23:16:43 UTC (rev 20636)
@@ -70,7 +70,7 @@
c = (0.5**2 + 1.5**2)**0.5
k = 0.5 * (a + b + c)
r = (k*(k-a)*(k-b)*(k-c))**0.5 / k
- self.minCellWidth = r
+ self.minCellWidth = min(a, b, c, 3.0*r)
return
More information about the CIG-COMMITS
mailing list