[cig-commits] r13443 - in short/3D/PyLith/trunk: examples/3d/hex8 libsrc/faults libsrc/meshio modulesrc/bc modulesrc/faults modulesrc/feassemble modulesrc/meshio pylith pylith/feassemble pylith/meshio pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Tue Dec 2 15:12:39 PST 2008
Author: brad
Date: 2008-12-02 15:12:38 -0800 (Tue, 02 Dec 2008)
New Revision: 13443
Modified:
short/3D/PyLith/trunk/examples/3d/hex8/pylithapp.cfg
short/3D/PyLith/trunk/libsrc/faults/ConstRateSlipFn.cc
short/3D/PyLith/trunk/libsrc/faults/LiuCosSlipFn.cc
short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc
short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
short/3D/PyLith/trunk/pylith/PyLithApp.py
short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
Log:
Turned on nondimensionalization (current default doesn't change any scales).
Modified: short/3D/PyLith/trunk/examples/3d/hex8/pylithapp.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/pylithapp.cfg 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/examples/3d/hex8/pylithapp.cfg 2008-12-02 23:12:38 UTC (rev 13443)
@@ -37,6 +37,9 @@
# ----------------------------------------------------------------------
# problem
# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+#normalizer = spatialdata.units.NondimElasticQuasistatic
+
[pylithapp.timedependent.formulation.time_step]
# Define the total time for the simulation and the default time step size.
total_time = 0.0*s ; total time of simulation
Modified: short/3D/PyLith/trunk/libsrc/faults/ConstRateSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/ConstRateSlipFn.cc 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/libsrc/faults/ConstRateSlipFn.cc 2008-12-02 23:12:38 UTC (rev 13443)
@@ -156,7 +156,7 @@
msg << ") using spatial database " << _dbSlipTime->label() << ".";
throw std::runtime_error(msg.str());
} // if
- normalizer.nondimensionalize(¶msVertex[indexSlipTime], spaceDim,
+ normalizer.nondimensionalize(¶msVertex[indexSlipTime], 1,
timeScale);
// add origin time to rupture time
paramsVertex[indexSlipTime] += originTime;
Modified: short/3D/PyLith/trunk/libsrc/faults/LiuCosSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/LiuCosSlipFn.cc 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/libsrc/faults/LiuCosSlipFn.cc 2008-12-02 23:12:38 UTC (rev 13443)
@@ -178,7 +178,7 @@
msg << ") using spatial database " << _dbSlipTime->label() << ".";
throw std::runtime_error(msg.str());
} // if
- normalizer.nondimensionalize(¶msVertex[indexSlipTime], spaceDim,
+ normalizer.nondimensionalize(¶msVertex[indexSlipTime], 1,
timeScale);
// add origin time to rupture time
paramsVertex[indexSlipTime] += originTime;
Modified: short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc 2008-12-02 23:12:38 UTC (rev 13443)
@@ -154,7 +154,7 @@
msg << ") using spatial database " << _dbSlipTime->label() << ".";
throw std::runtime_error(msg.str());
} // if
- normalizer.nondimensionalize(¶msVertex[indexSlipTime], spaceDim,
+ normalizer.nondimensionalize(¶msVertex[indexSlipTime], 1,
timeScale);
// add origin time to rupture time
paramsVertex[indexSlipTime] += originTime;
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2008-12-02 23:12:38 UTC (rev 13443)
@@ -65,6 +65,17 @@
} // read
// ----------------------------------------------------------------------
+// Set scales used to nondimensionalize mesh.
+void
+pylith::meshio::MeshIO::normalizer(const spatialdata::units::Nondimensional& dim)
+{ // normalizer
+ if (0 == _normalizer)
+ _normalizer = new spatialdata::units::Nondimensional(dim);
+ else
+ *_normalizer = dim;
+} // normalizer
+
+// ----------------------------------------------------------------------
// Write mesh to file.
void
pylith::meshio::MeshIO::write(ALE::Obj<Mesh>* mesh)
Modified: short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src 2008-12-02 23:12:38 UTC (rev 13443)
@@ -1065,6 +1065,37 @@
AbsorbingDampers_quadrature_set(self.thisptr, ptrFromHandle(q))
+ property normalizer:
+ def __set__(self, value):
+ """
+ Set nondimensionalizer.
+ """
+ # create shim for method 'normalizer'
+ #embed{ void AbsorbingDampers_normalizer_set(void* objVptr, void* dimVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != dimVptr);
+ spatialdata::units::Nondimensional* dim =
+ (spatialdata::units::Nondimensional*) dimVptr;
+ ((pylith::bc::AbsorbingDampers*) objVptr)->normalizer(*dim);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ if not value.name == "spatialdata_units_Nondimensional":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'spatialdata::units::Nondimensional'."
+ AbsorbingDampers_normalizer_set(self.thisptr, ptrFromHandle(value))
+
+
property timeStep:
def __set__(self, dt):
"""
@@ -1535,6 +1566,37 @@
Neumann_quadrature_set(self.thisptr, ptrFromHandle(q))
+ property normalizer:
+ def __set__(self, value):
+ """
+ Set nondimensionalizer.
+ """
+ # create shim for method 'normalizer'
+ #embed{ void Neumann_normalizer_set(void* objVptr, void* dimVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != dimVptr);
+ spatialdata::units::Nondimensional* dim =
+ (spatialdata::units::Nondimensional*) dimVptr;
+ ((pylith::bc::Neumann*) objVptr)->normalizer(*dim);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ if not value.name == "spatialdata_units_Nondimensional":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'spatialdata::units::Nondimensional'."
+ Neumann_normalizer_set(self.thisptr, ptrFromHandle(value))
+
+
property timeStep:
def __set__(self, dt):
"""
Modified: short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2008-12-02 23:12:38 UTC (rev 13443)
@@ -717,7 +717,7 @@
def eqsrcs(self, names, srcs):
"""
- Set quadrature.
+ Set earthquake sources.
"""
# create shim for method 'eqsrc'
#embed{ void FaultCohesiveKin_eqsrcs_set(void* objVptr, char** names, void** srcsVptr, int nsrcs)
@@ -796,6 +796,37 @@
FaultCohesiveKin_quadrature_set(self.thisptr, ptrFromHandle(q))
+ property normalizer:
+ def __set__(self, value):
+ """
+ Set nondimensionalizer.
+ """
+ # create shim for method 'normalizer'
+ #embed{ void FaultCohesiveKin_normalizer_set(void* objVptr, void* dimVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != dimVptr);
+ spatialdata::units::Nondimensional* dim =
+ (spatialdata::units::Nondimensional*) dimVptr;
+ ((pylith::faults::FaultCohesiveKin*) objVptr)->normalizer(*dim);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ if not value.name == "spatialdata_units_Nondimensional":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'spatialdata::units::Nondimensional'."
+ FaultCohesiveKin_normalizer_set(self.thisptr, ptrFromHandle(value))
+
+
property timeStep:
def __set__(self, dt):
"""
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2008-12-02 23:12:38 UTC (rev 13443)
@@ -1234,6 +1234,7 @@
#embed{ void Integrator_quadrature_set(void* objVptr, void* qVptr)
try {
assert(0 != objVptr);
+ assert(0 != qVptr);
pylith::feassemble::Quadrature* quadrature =
(pylith::feassemble::Quadrature*) qVptr;
((pylith::feassemble::Integrator*) objVptr)->quadrature(quadrature);
@@ -1254,6 +1255,37 @@
Integrator_quadrature_set(self.thisptr, ptrFromHandle(q))
+ property normalizer:
+ def __set__(self, value):
+ """
+ Set nondimensionalizer.
+ """
+ # create shim for method 'normalizer'
+ #embed{ void Integrator_normalizer_set(void* objVptr, void* dimVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != dimVptr);
+ spatialdata::units::Nondimensional* dim =
+ (spatialdata::units::Nondimensional*) dimVptr;
+ ((pylith::feassemble::Integrator*) objVptr)->normalizer(*dim);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ if not value.name == "spatialdata_units_Nondimensional":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'spatialdata::units::Nondimensional'."
+ Integrator_normalizer_set(self.thisptr, ptrFromHandle(value))
+
+
property gravityField:
def __set__(self, g):
"""
@@ -1679,6 +1711,37 @@
return
+ property normalizer:
+ def __set__(self, value):
+ """
+ Set nondimensionalizer.
+ """
+ # create shim for method 'normalizer'
+ #embed{ void Constraint_normalizer_set(void* objVptr, void* dimVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != dimVptr);
+ spatialdata::units::Nondimensional* dim =
+ (spatialdata::units::Nondimensional*) dimVptr;
+ ((pylith::feassemble::Constraint*) objVptr)->normalizer(*dim);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ if not value.name == "spatialdata_units_Nondimensional":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'spatialdata::units::Nondimensional'."
+ Constraint_normalizer_set(self.thisptr, ptrFromHandle(value))
+
+
property useSolnIncr:
def __set__(self, flag):
"""
Modified: short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2008-12-02 23:12:38 UTC (rev 13443)
@@ -138,6 +138,35 @@
return PyCObject_FromVoidPtr(self.thisptr, MeshIO_destructor)
+ property normalizer:
+ def __set__(self, value):
+ """Set normalizer."""
+ # create shim for method 'normalizer'
+ #embed{ void MeshIO_normalizer_set(void* objVptr, void* dimVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != dimVptr);
+ spatialdata::units::Nondimensional* dim =
+ (spatialdata::units::Nondimensional*) dimVptr;
+ ((pylith::meshio::MeshIO*) objVptr)->normalizer(*dim);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ if not value.name == "spatialdata_units_Nondimensional":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'spatialdata::units::Nondimensional'."
+ MeshIO_normalizer_set(self.thisptr, ptrFromHandle(value))
+
+
property interpolate:
def __set__(self, flag):
"""Set interpolate."""
Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py 2008-12-02 23:12:38 UTC (rev 13443)
@@ -88,7 +88,7 @@
interfaces = None
if "interfaces" in dir(self.problem):
interfaces = self.problem.interfaces.components()
- mesh = self.mesher.create(interfaces)
+ mesh = self.mesher.create(self.problem.normalizer, interfaces)
self._debug.log(resourceUsageString())
self._logger.stagePop()
Modified: short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Constraint.py 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/pylith/feassemble/Constraint.py 2008-12-02 23:12:38 UTC (rev 13443)
@@ -88,7 +88,7 @@
self._logger.eventBegin(logEvent)
assert(None != self.cppHandle)
- #self.cppHandle.normalizer = normalizer.cppHandle
+ self.cppHandle.normalizer = normalizer.cppHandle
self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2008-12-02 23:12:38 UTC (rev 13443)
@@ -94,7 +94,7 @@
self._logger.eventBegin(logEvent)
assert(None != self.cppHandle)
- #self.cppHandle.normalizer = normalizer.cppHandle
+ self.cppHandle.normalizer = normalizer.cppHandle
if None != self.gravityField:
self.cppHandle.gravityField = self.gravityField.cppHandle
Modified: short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2008-12-02 23:12:38 UTC (rev 13443)
@@ -36,7 +36,7 @@
return
- def read(self, debug, interpolate):
+ def read(self, normalizer, debug, interpolate):
"""
Read finite-element mesh and store in Sieve mesh object.
@@ -46,6 +46,7 @@
# Set flags
self._sync()
+ self.cppHandle.normalizer = normalizer.cppHandle
self.cppHandle.debug = debug
self.cppHandle.interpolate = interpolate
Modified: short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py 2008-12-02 23:12:38 UTC (rev 13443)
@@ -64,7 +64,7 @@
return
- def create(self, faults=None):
+ def create(self, normalizer, faults=None):
"""
Generate a Mesh.
"""
Modified: short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshImporter.py 2008-12-02 20:07:20 UTC (rev 13442)
+++ short/3D/PyLith/trunk/pylith/topology/MeshImporter.py 2008-12-02 23:12:38 UTC (rev 13443)
@@ -75,7 +75,7 @@
return
- def create(self, faults=None):
+ def create(self, normalizer, faults=None):
"""
Hook for creating mesh.
"""
@@ -84,8 +84,9 @@
self._setupLogging()
logEvent = "%screate" % self._loggingPrefix
self._logger.eventBegin(logEvent)
-
- mesh = self.importer.read(self.debug, self.interpolate)
+
+ normalizer.initialize()
+ mesh = self.importer.read(normalizer, self.debug, self.interpolate)
if self.debug:
mesh.view()
self._debug.log(resourceUsageString())
More information about the CIG-COMMITS
mailing list