[cig-commits] r9151 - in short/3D/PyLith/trunk: examples/3d/hex8 examples/3d/tet4 examples/twocells/twohex8 examples/twocells/twoquad4 examples/twocells/twotet4 examples/twocells/twotri3 libsrc/faults modulesrc/faults pylith/bc pylith/faults pylith/feassemble pylith/meshio pylith/problems tests/2d/bar_quad4 unittests/pytests/bc unittests/pytests/faults unittests/pytests/feassemble
brad at geodynamics.org
brad at geodynamics.org
Mon Jan 28 13:18:34 PST 2008
Author: brad
Date: 2008-01-28 13:18:34 -0800 (Mon, 28 Jan 2008)
New Revision: 9151
Modified:
short/3D/PyLith/trunk/examples/3d/hex8/dislocation.cfg
short/3D/PyLith/trunk/examples/3d/tet4/dislocation.cfg
short/3D/PyLith/trunk/examples/twocells/twohex8/dislocation.cfg
short/3D/PyLith/trunk/examples/twocells/twoquad4/dislocation.cfg
short/3D/PyLith/trunk/examples/twocells/twotet4/dislocation.cfg
short/3D/PyLith/trunk/examples/twocells/twotri3/dislocation.cfg
short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
short/3D/PyLith/trunk/pylith/bc/Dirichlet.py
short/3D/PyLith/trunk/pylith/bc/Neumann.py
short/3D/PyLith/trunk/pylith/faults/Fault.py
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/tests/2d/bar_quad4/dislocation_dyn.cfg
short/3D/PyLith/trunk/unittests/pytests/bc/TestAbsorbingDampers.py
short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichlet.py
short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py
short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py
Log:
Implemented output of slip time histories for faults. Adjusted configuration files in examples to set root filename for fault output.
Modified: short/3D/PyLith/trunk/examples/3d/hex8/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/hex8/dislocation.cfg 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/examples/3d/hex8/dislocation.cfg 2008-01-28 21:18:34 UTC (rev 9151)
@@ -83,6 +83,9 @@
# output
# ----------------------------------------------------------------------
# Set the root name for output.
-
[pylithapp.problem.formulation.output.output.writer]
filename = dislocation.vtk
+
+# Give basename for vtk fault output.
+[pylithapp.timedependent.interfaces.fault.output.writer]
+filename = dislocation-fault.vtk
Modified: short/3D/PyLith/trunk/examples/3d/tet4/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/3d/tet4/dislocation.cfg 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/examples/3d/tet4/dislocation.cfg 2008-01-28 21:18:34 UTC (rev 9151)
@@ -77,6 +77,9 @@
# output
# ----------------------------------------------------------------------
# Set the root name for output.
-
[pylithapp.problem.formulation.output.output.writer]
filename = dislocation.vtk
+
+# Give basename for vtk fault output.
+[pylithapp.timedependent.interfaces.fault.output.writer]
+filename = dislocation-fault.vtk
Modified: short/3D/PyLith/trunk/examples/twocells/twohex8/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/twocells/twohex8/dislocation.cfg 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/examples/twocells/twohex8/dislocation.cfg 2008-01-28 21:18:34 UTC (rev 9151)
@@ -128,3 +128,9 @@
# ----------------------------------------------------------------------
[pylithapp.problem.formulation.output.output.writer]
filename = dislocation.vtk
+time_format = %010.1f
+
+# Give basename for vtk fault output.
+[pylithapp.timedependent.interfaces.fault.output.writer]
+filename = dislocation-fault.vtk
+time_format = %010.1f
Modified: short/3D/PyLith/trunk/examples/twocells/twoquad4/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/twocells/twoquad4/dislocation.cfg 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/examples/twocells/twoquad4/dislocation.cfg 2008-01-28 21:18:34 UTC (rev 9151)
@@ -124,6 +124,10 @@
# ----------------------------------------------------------------------
# output
# ----------------------------------------------------------------------
-# Give basename for vtk output.
+# Give basename for vtk domain output.
[pylithapp.problem.formulation.output.output.writer]
filename = dislocation.vtk
+
+# Give basename for vtk fault output.
+[pylithapp.timedependent.interfaces.fault.output.writer]
+filename = dislocation-fault.vtk
Modified: short/3D/PyLith/trunk/examples/twocells/twotet4/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/twocells/twotet4/dislocation.cfg 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/examples/twocells/twotet4/dislocation.cfg 2008-01-28 21:18:34 UTC (rev 9151)
@@ -105,3 +105,7 @@
# Give basename for vtk output.
[pylithapp.problem.formulation.output.output.writer]
filename = dislocation.vtk
+
+# Give basename for vtk fault output.
+[pylithapp.timedependent.interfaces.fault.output.writer]
+filename = dislocation-fault.vtk
Modified: short/3D/PyLith/trunk/examples/twocells/twotri3/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/twocells/twotri3/dislocation.cfg 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/examples/twocells/twotri3/dislocation.cfg 2008-01-28 21:18:34 UTC (rev 9151)
@@ -105,3 +105,7 @@
# Give basename for vtk output.
[pylithapp.problem.formulation.output.output.writer]
filename = dislocation.vtk
+
+# Give basename for vtk fault output.
+[pylithapp.timedependent.interfaces.fault.output.writer]
+filename = dislocation-fault.vtk
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc 2008-01-28 21:18:34 UTC (rev 9151)
@@ -402,17 +402,16 @@
const ALE::Obj<real_section_type>& solution = fields->getSolution();
assert(!solution.isNull());
- ALE::Obj<real_section_type> slip;
if (!_useSolnIncr) {
// Compute slip field at current time step
assert(0 != _eqsrc);
- slip = _eqsrc->slip(t, _constraintVert);
- assert(!slip.isNull());
+ _slip = _eqsrc->slip(t, _constraintVert);
+ assert(!_slip.isNull());
} else {
// Compute increment of slip field at current time step
assert(0 != _eqsrc);
- slip = _eqsrc->slipIncr(t-_dt, t, _constraintVert);
- assert(!slip.isNull());
+ _slip = _eqsrc->slipIncr(t-_dt, t, _constraintVert);
+ assert(!_slip.isNull());
} // else
for (Mesh::label_sequence::iterator c_iter=cellsCohesiveBegin;
@@ -433,7 +432,7 @@
cellStiffness.size());
// Get slip at cells vertices (only valid at constraint vertices)
- mesh->restrict(slip, *c_iter, &cellSlip[0], cellSlip.size());
+ mesh->restrict(_slip, *c_iter, &cellSlip[0], cellSlip.size());
// Get solution at cells vertices (valid at all cohesive vertices)
mesh->restrict(solution, *c_iter, &cellSoln[0], cellSoln.size());
@@ -675,51 +674,57 @@
const int cohesiveDim = _faultMesh->getDimension();
- if (cohesiveDim > 0 && 0 == strcasecmp("strike_dir", name)) {
- _allocateOutputVertexVector();
+ if (0 == strcasecmp("slip", name)) {
+ assert(!_slip.isNull());
+ _allocateBufferVertexVector();
+ _projectCohesiveVertexField(&_bufferVertexVector, _slip, mesh);
+ *fieldType = meshio::DataWriter::VECTOR_FIELD;
+ return _bufferVertexVector;
+ } else if (cohesiveDim > 0 && 0 == strcasecmp("strike_dir", name)) {
+ _allocateBufferVertexVector();
const ALE::Obj<real_section_type>& strikeDir =
_orientation->getFibration(0);
- _projectCohesiveVertexField(&_outputVertexVector, strikeDir, mesh);
+ _projectCohesiveVertexField(&_bufferVertexVector, strikeDir, mesh);
*fieldType = meshio::DataWriter::VECTOR_FIELD;
- return _outputVertexVector;
+ return _bufferVertexVector;
} else if (2 == cohesiveDim && 0 == strcasecmp("dip_dir", name)) {
- _allocateOutputVertexVector();
+ _allocateBufferVertexVector();
const ALE::Obj<real_section_type>& dipDir =
_orientation->getFibration(1);
- _projectCohesiveVertexField(&_outputVertexVector, dipDir, mesh);
+ _projectCohesiveVertexField(&_bufferVertexVector, dipDir, mesh);
*fieldType = meshio::DataWriter::VECTOR_FIELD;
- return _outputVertexVector;
+ return _bufferVertexVector;
} else if (0 == strcasecmp("normal_dir", name)) {
- _allocateOutputVertexVector();
+ _allocateBufferVertexVector();
const int space =
(0 == cohesiveDim) ? 0 : (1 == cohesiveDim) ? 1 : 2;
const ALE::Obj<real_section_type>& normalDir =
_orientation->getFibration(space);
- _projectCohesiveVertexField(&_outputVertexVector, normalDir, mesh);
+ _projectCohesiveVertexField(&_bufferVertexVector, normalDir, mesh);
*fieldType = meshio::DataWriter::VECTOR_FIELD;
- return _outputVertexVector;
+ return _bufferVertexVector;
} else if (0 == strcasecmp("final_slip", name)) {
- _allocateOutputVertexVector();
+ _allocateBufferVertexVector();
const ALE::Obj<real_section_type>& finalSlip = _eqsrc->finalSlip();
- _projectCohesiveVertexField(&_outputVertexVector, finalSlip, mesh);
+ _projectCohesiveVertexField(&_bufferVertexVector, finalSlip, mesh);
*fieldType = meshio::DataWriter::VECTOR_FIELD;
- return _outputVertexVector;
+ return _bufferVertexVector;
} else if (0 == strcasecmp("slip_time", name)) {
- _allocateOutputVertexScalar();
+ _allocateBufferVertexScalar();
const ALE::Obj<real_section_type>& slipTime = _eqsrc->slipTime();
- _projectCohesiveVertexField(&_outputVertexScalar, slipTime, mesh);
+ _projectCohesiveVertexField(&_bufferVertexScalar, slipTime, mesh);
*fieldType = meshio::DataWriter::SCALAR_FIELD;
- return _outputVertexScalar;
+ return _bufferVertexScalar;
} // if/else
// Should not reach this point if requested field was found
std::ostringstream msg;
msg << "Request for unknown vertex field '" << name
- << "' for fault '" << label() << ".";
+ << "' for fault '" << label() << "'.";
throw std::runtime_error(msg.str());
// Return generic section to satisfy member function definition.
- return _outputVertexScalar;
+ return _bufferVertexScalar;
} // vertexField
// ----------------------------------------------------------------------
@@ -730,50 +735,95 @@
const char* name,
const ALE::Obj<Mesh>& mesh)
{ // cellField
+ assert(!_faultMesh.isNull());
+ assert(!_orientation.isNull());
+ assert(0 != _eqsrc);
+
+ const int cohesiveDim = _faultMesh->getDimension();
+
+ if (0 == strcasecmp("traction_change", name)) {
+ _allocateBufferCellVector();
+ // ADD STUFF HERE
+ return _bufferCellVector;
+ } // if
+
// Should not reach this point if requested field was found
std::ostringstream msg;
msg << "Request for unknown vertex field '" << name
- << "' for fault '" << label() << ".";
+ << "' for fault '" << label() << "'.";
throw std::runtime_error(msg.str());
// Return generic section to satisfy member function definition.
- //return _outputCellVector;
+ return _bufferCellScalar;
} // cellField
// ----------------------------------------------------------------------
-// Allocate scalar field for output.
+// Allocate scalar field for output of vertex information.
void
-pylith::faults::FaultCohesiveKin::_allocateOutputVertexScalar(void)
-{ // _allocateOutputVertexScalar
+pylith::faults::FaultCohesiveKin::_allocateBufferVertexScalar(void)
+{ // _allocateBufferVertexScalar
const int fiberDim = 1;
- if (_outputVertexScalar.isNull()) {
- _outputVertexScalar = new real_section_type(_faultMesh->comm(),
+ if (_bufferVertexScalar.isNull()) {
+ _bufferVertexScalar = new real_section_type(_faultMesh->comm(),
_faultMesh->debug());
const ALE::Obj<Mesh::label_sequence>& vertices =
_faultMesh->depthStratum(0);
- _outputVertexScalar->setFiberDimension(vertices, fiberDim);
- _faultMesh->allocate(_outputVertexScalar);
+ _bufferVertexScalar->setFiberDimension(vertices, fiberDim);
+ _faultMesh->allocate(_bufferVertexScalar);
} // if
-} // _allocateOutputVertexScalar
+} // _allocateBufferVertexScalar
// ----------------------------------------------------------------------
-// Allocate vector field for output.
+// Allocate vector field for output of vertex information.
void
-pylith::faults::FaultCohesiveKin::_allocateOutputVertexVector(void)
-{ // _allocateOutputVertexVector
+pylith::faults::FaultCohesiveKin::_allocateBufferVertexVector(void)
+{ // _allocateBufferVertexVector
assert(0 != _quadrature);
const int fiberDim = _quadrature->spaceDim();
- if (_outputVertexVector.isNull()) {
- _outputVertexVector = new real_section_type(_faultMesh->comm(),
+ if (_bufferVertexVector.isNull()) {
+ _bufferVertexVector = new real_section_type(_faultMesh->comm(),
_faultMesh->debug());
const ALE::Obj<Mesh::label_sequence>& vertices =
_faultMesh->depthStratum(0);
- _outputVertexVector->setFiberDimension(vertices, fiberDim);
- _faultMesh->allocate(_outputVertexVector);
+ _bufferVertexVector->setFiberDimension(vertices, fiberDim);
+ _faultMesh->allocate(_bufferVertexVector);
} // if
-} // _allocateOutputVertexVector
+} // _allocateBufferVertexVector
// ----------------------------------------------------------------------
+// Allocate scalar field for output of cell information.
+void
+pylith::faults::FaultCohesiveKin::_allocateBufferCellScalar(void)
+{ // _allocateBufferCellScalar
+ const int fiberDim = 1;
+ if (_bufferCellScalar.isNull()) {
+ _bufferCellScalar = new real_section_type(_faultMesh->comm(),
+ _faultMesh->debug());
+ const ALE::Obj<Mesh::label_sequence>& cells =
+ _faultMesh->heightStratum(0);
+ _bufferCellScalar->setFiberDimension(cells, fiberDim);
+ _faultMesh->allocate(_bufferCellScalar);
+ } // if
+} // _allocateBufferCellScalar
+
+// ----------------------------------------------------------------------
+// Allocate vector field for output of cell information.
+void
+pylith::faults::FaultCohesiveKin::_allocateBufferCellVector(void)
+{ // _allocateBufferCellVector
+ assert(0 != _quadrature);
+ const int fiberDim = _quadrature->spaceDim();
+ if (_bufferCellVector.isNull()) {
+ _bufferCellVector = new real_section_type(_faultMesh->comm(),
+ _faultMesh->debug());
+ const ALE::Obj<Mesh::label_sequence>& cells =
+ _faultMesh->heightStratum(0);
+ _bufferCellVector->setFiberDimension(cells, fiberDim);
+ _faultMesh->allocate(_bufferCellVector);
+ } // if
+} // _allocateBufferCellVector
+
+// ----------------------------------------------------------------------
// Project field defined over cohesive cells to fault mesh.
void
pylith::faults::FaultCohesiveKin::_projectCohesiveVertexField(
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh 2008-01-28 21:18:34 UTC (rev 9151)
@@ -162,11 +162,17 @@
private :
/// Allocate scalar field for output of vertex information.
- void _allocateOutputVertexScalar(void);
+ void _allocateBufferVertexScalar(void);
/// Allocate vector field for output of vertex information.
- void _allocateOutputVertexVector(void);
+ void _allocateBufferVertexVector(void);
+ /// Allocate scalar field for output of cell information.
+ void _allocateBufferCellScalar(void);
+
+ /// Allocate vector field for output of cell information.
+ void _allocateBufferCellVector(void);
+
/** Project field defined over cohesive cells to fault mesh.
*
* @param fieldFault Field defined over fault mesh.
@@ -201,6 +207,9 @@
/// nonzero only at constraint vertices)
ALE::Obj<real_section_type> _orientation;
+ /// Vector field of current slip or slip increment.
+ ALE::Obj<real_section_type> _slip;
+
/// Fault vertices associated with constraints
std::set<Mesh::point_type> _constraintVert;
@@ -210,11 +219,17 @@
ALE::Obj<int_section_type> _constraintCell;
/// Scalar field for output of vertex information.
- ALE::Obj<real_section_type> _outputVertexScalar;
+ ALE::Obj<real_section_type> _bufferVertexScalar;
/// Vector field for output of vertex information.
- ALE::Obj<real_section_type> _outputVertexVector;
+ ALE::Obj<real_section_type> _bufferVertexVector;
+ /// Scalar field for output of cell information.
+ ALE::Obj<real_section_type> _bufferCellScalar;
+
+ /// Vector field for output of cell information.
+ ALE::Obj<real_section_type> _bufferCellVector;
+
}; // class FaultCohesiveKin
#include "FaultCohesiveKin.icc" // inline methods
Modified: short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2008-01-28 21:18:34 UTC (rev 9151)
@@ -233,6 +233,46 @@
return (PyCObject_FromVoidPtr(ptr, NULL), fieldType)
+ def cellField(self, name, mesh):
+ """
+ Get cell field.
+ """
+ # create shim for method 'cellField'
+ #embed{ void* Fault_cellField(void* objVptr, int* fieldPtr, char* name, void* meshVptr)
+ void* result = 0;
+ try {
+ assert(0 != objVptr);
+ assert(0 != fieldPtr);
+ assert(0 != name);
+ assert(0 != meshVptr);
+ pylith::faults::Fault* fault = (pylith::faults::Fault*) objVptr;
+ ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+ pylith::meshio::DataWriter::FieldEnum fieldType;
+ const ALE::Obj<pylith::real_section_type>& field =
+ fault->cellField(&fieldType, name, *mesh);
+ *fieldPtr = fieldType;
+ result = (void*) &field;
+ } 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
+ return result;
+ #}embed
+ if not mesh.name == "pylith_topology_Mesh":
+ raise TypeError, \
+ "Argument 'mesh' must be extension module type " \
+ "'pylith::topology::Mesh'."
+ cdef void* ptr
+ cdef int fieldType
+ ptr = Fault_cellField(self.thisptr, &fieldType, name, ptrFromHandle(mesh))
+ return (PyCObject_FromVoidPtr(ptr, NULL), fieldType)
+
def _createHandle(self):
"""
Modified: short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -74,15 +74,16 @@
return
- def initialize(self):
+ def initialize(self, totalTime, numTimeSteps):
"""
Initialize AbsorbingDampers boundary condition.
"""
logEvent = "%sinit" % self._loggingPrefix
-
self._logger.eventBegin(logEvent)
+
self.cppHandle.quadrature = self.quadrature.cppHandle
- BoundaryCondition.initialize(self)
+ BoundaryCondition.initialize(self, totalTime, numTimeSteps)
+
self._logger.eventEnd(logEvent)
return
@@ -123,18 +124,6 @@
return
- def _setupLogging(self):
- """
- Setup event logging.
- """
- Integrator._setupLogging(self)
-
- events = ["init"]
- for event in events:
- self._logger.registerEvent("%s%s" % (self._loggingPrefix, event))
- return
-
-
# FACTORIES ////////////////////////////////////////////////////////////
def boundary_condition():
Modified: short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -120,7 +120,7 @@
return
- def initialize(self):
+ def initialize(self, totalTime, numTimeSteps):
"""
Initialize boundary condition.
"""
Modified: short/3D/PyLith/trunk/pylith/bc/Dirichlet.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Dirichlet.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/bc/Dirichlet.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -92,14 +92,14 @@
return
- def initialize(self):
+ def initialize(self, totalTime, numTimeSteps):
"""
Initialize Dirichlet boundary condition.
"""
logEvent = "%sinit" % self._loggingPrefix
self._logger.eventBegin(logEvent)
- BoundaryCondition.initialize(self)
+ BoundaryCondition.initialize(self, totalTime, numTimeSteps)
self._logger.eventEnd(logEvent)
return
@@ -126,18 +126,6 @@
return
- def _setupLogging(self):
- """
- Setup event logging.
- """
- Constraint._setupLogging(self)
-
- events = ["init"]
- for event in events:
- self._logger.registerEvent("%s%s" % (self._loggingPrefix, event))
- return
-
-
# FACTORIES ////////////////////////////////////////////////////////////
def boundary_condition():
Modified: short/3D/PyLith/trunk/pylith/bc/Neumann.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Neumann.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/bc/Neumann.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -72,15 +72,16 @@
return
- def initialize(self):
+ def initialize(self, totalTime, numTimeSteps):
"""
Initialize Neumann boundary condition.
"""
logEvent = "%sinit" % self._loggingPrefix
-
self._logger.eventBegin(logEvent)
+
self.cppHandle.quadrature = self.quadrature.cppHandle
BoundaryCondition.initialize(self)
+
self._logger.eventEnd(logEvent)
return
@@ -121,18 +122,6 @@
return
- def _setupLogging(self):
- """
- Setup event logging.
- """
- Integrator._setupLogging(self)
-
- events = ["init"]
- for event in events:
- self._logger.registerEvent("%s%s" % (self._loggingPrefix, event))
- return
-
-
# FACTORIES ////////////////////////////////////////////////////////////
def boundary_condition():
Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -162,7 +162,7 @@
return
- def initialize(self):
+ def initialize(self, totalTime, numTimeSteps):
"""
Initialize fault.
"""
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -113,19 +113,19 @@
return
- def initialize(self):
+ def initialize(self, totalTime, numTimeSteps):
"""
Initialize cohesive elements.
"""
logEvent = "%sinit" % self._loggingPrefix
-
self._info.log("Initializing fault '%s'." % self.label)
self._logger.eventBegin(logEvent)
self.eqsrc.initialize()
- FaultCohesive.initialize(self)
+ FaultCohesive.initialize(self, totalTime, numTimeSteps)
self.output.initialize(self.quadrature.cppHandle)
self.output.writeInfo()
+ self.output.open(totalTime, numTimeSteps)
self._logger.eventEnd(logEvent)
return
@@ -139,7 +139,7 @@
self._logger.eventBegin(logEvent)
self._info.log("Writing fault data.")
- #self.output.writeData(t+dt)
+ self.output.writeData(t+dt)
self._logger.eventEnd(logEvent)
return
@@ -181,18 +181,6 @@
return
- def _setupLogging(self):
- """
- Setup event logging.
- """
- Integrator._setupLogging(self)
-
- events = ["init"]
- for event in events:
- self._logger.registerEvent("%s%s" % (self._loggingPrefix, event))
- return
-
-
# FACTORIES ////////////////////////////////////////////////////////////
def fault():
Modified: short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Constraint.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/feassemble/Constraint.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -22,18 +22,24 @@
Check whether object implements a constraint.
"""
result = True
- attrs = dir(obj)
- if not "timeStep" in attrs or \
- not "setConstraintSizes" in attrs or \
- not "setConstraints" in attrs or \
- not "useSolnIncr" in attrs or \
- not "setField" in attrs or \
- not "poststep" in attrs or \
- not "finalize" in attrs:
- result = False
+ available = dir(obj)
+ required = ["preinitialize",
+ "verifyConfiguration",
+ "initialize",
+ "timeStep",
+ "setConstraintSizes",
+ "setConstraints",
+ "useSolnIncr",
+ "setField",
+ "poststep",
+ "finalize"]
+ for attr in required:
+ if not attr in available:
+ result = False
return result
+
# Constraint class
class Constraint(object):
"""
@@ -67,10 +73,16 @@
"""
Verify compatibility of configuration.
"""
- logEvent = "%sverify" % self._loggingPrefix
return
+ def initialize(self, totalTime, numTimeSteps):
+ """
+ Do initialization.
+ """
+ return
+
+
def timeStep(self, dt):
"""
Set time step for advancing from time t to time t+dt.
@@ -120,10 +132,11 @@
Set constrained values in field at time t.
"""
logEvent = "%ssetField" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
assert(None != self.cppHandle)
- self._logger.eventBegin(logEvent)
self.cppHandle.setField(t.value, field, self.mesh.cppHandle)
+
self._logger.eventEnd(logEvent)
return
@@ -157,6 +170,7 @@
logger.initialize()
events = ["verify",
+ "init",
"setSizes",
"constraints",
"setField",
Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -22,17 +22,22 @@
Check whether object implements an integrator.
"""
result = True
- attrs = dir(obj)
- if not "timeStep" in attrs or \
- not "stableTimeStep" in attrs or \
- not "useSolnIncr" in attrs or \
- not "integrateResidual" in attrs or \
- not "integrateJacobian" in attrs or \
- not "updateState" in attrs or \
- not "verifyConfiguration" in attrs or \
- not "poststep" in attrs or \
- not "finalize" in attrs:
- result = False
+ available = dir(obj)
+ required = ["timeStep",
+ "stableTimeStep",
+ "useSolnIncr",
+ "integrateResidual",
+ "integrateJacobian",
+ "updateState",
+ "preinitialize",
+ "verifyConfiguration",
+ "initialize",
+ "poststep",
+ "finalize"]
+
+ for attr in required:
+ if not attr in available:
+ result = False
return result
@@ -78,6 +83,13 @@
return
+ def initialize(self, totalTime, numTimeSteps):
+ """
+ Do initialization.
+ """
+ return
+
+
def timeStep(self, dt):
"""
Set time step for advancing from time t to time t+dt.
@@ -196,6 +208,7 @@
logger.initialize()
events = ["verify",
+ "init",
"timestep",
"residual",
"newJacobian",
Modified: short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -57,33 +57,20 @@
return
- def initialize(self):
+ def initialize(self, totalTime, numTimeSteps):
"""
Initialize material properties.
"""
logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
self._info.log("Initializing integrator for material '%s'." % \
self.material.label)
- self._logger.eventBegin(logEvent)
self.material.initialize(self.mesh)
+
self._logger.eventEnd(logEvent)
return
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _setupLogging(self):
- """
- Setup event logging.
- """
- Integrator._setupLogging(self)
-
- events = ["init"]
- for event in events:
- self._logger.registerEvent("%s%s" % (self._loggingPrefix, event))
- return
-
-
# End of file
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputManager.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputManager.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -202,9 +202,7 @@
mesh.cppHandle, mesh.coordsys.cppHandle)
for name in self.vertexInfoFields:
- print "Getting field '%s'." % name
(field, fieldType) = self.dataProvider.getVertexField(name)
- print "Writing field '%s'." % name
self.cppHandle.appendVertexField(t.value, name, field, fieldType,
mesh.cppHandle)
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -190,23 +190,24 @@
logEvent = "%sinit" % self._loggingPrefix
self._logger.eventBegin(logEvent)
+ numTimeSteps = 1.0 + int(totalTime / dt)
+
from pylith.topology.FieldsManager import FieldsManager
self.fields = FieldsManager(self.mesh)
self._info.log("Initializing integrators.")
self._debug.log(resourceUsageString())
for integrator in self.integrators:
- integrator.initialize()
+ integrator.initialize(totalTime, numTimeSteps)
self._debug.log(resourceUsageString())
self._info.log("Initializing constraints.")
for constraint in self.constraints:
- constraint.initialize()
+ constraint.initialize(totalTime, numTimeSteps)
self._debug.log(resourceUsageString())
self._info.log("Setting up solution output.")
for output in self.output.bin:
- numTimeSteps = 1.0 + int(totalTime / dt)
output.initialize()
output.writeInfo()
output.open(totalTime, numTimeSteps)
Modified: short/3D/PyLith/trunk/tests/2d/bar_quad4/dislocation_dyn.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/2d/bar_quad4/dislocation_dyn.cfg 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/tests/2d/bar_quad4/dislocation_dyn.cfg 2008-01-28 21:18:34 UTC (rev 9151)
@@ -119,3 +119,8 @@
[pylithapp.problem.formulation.output.output.writer]
filename = output/dislocation_dyn.vtk
time_format = %05.3f
+
+# Give basename for vtk fault output.
+[pylithapp.timedependent.interfaces.fault.output.writer]
+filename = output/dislocation-fault.vtk
+time_format = %05.3f
Modified: short/3D/PyLith/trunk/unittests/pytests/bc/TestAbsorbingDampers.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/TestAbsorbingDampers.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/TestAbsorbingDampers.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -216,7 +216,7 @@
mesh = importer.read(debug=False, interpolate=False)
bc.preinitialize(mesh)
- bc.initialize()
+ bc.initialize(totalTime=0.0*second, numTimeSteps=1)
bc.timeStep(0.01*second)
# Setup fields
Modified: short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichlet.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichlet.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichlet.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -174,7 +174,8 @@
mesh = importer.read(debug=False, interpolate=False)
bc.preinitialize(mesh)
- bc.initialize()
+ from pyre.units.time import second
+ bc.initialize(totalTime=0.0*second, numTimeSteps=1)
return (mesh, bc)
Modified: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -289,7 +289,8 @@
fault.preinitialize(mesh)
fault.timeStep(dt)
fault.verifyConfiguration()
- fault.initialize()
+ from pyre.units.time import s
+ fault.initialize(totalTime=0.0*s, numTimeSteps=1)
# Setup fields
from pylith.topology.FieldsManager import FieldsManager
Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -247,7 +247,8 @@
# Setup integrator
integrator = ElasticityExplicit()
integrator.preinitialize(mesh, material)
- integrator.initialize()
+ from pyre.units.time import s
+ integrator.initialize(totalTime=0.0*s, numTimeSteps=1)
integrator.timeStep(dt)
# Setup fields
Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py 2008-01-28 21:06:00 UTC (rev 9150)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py 2008-01-28 21:18:34 UTC (rev 9151)
@@ -242,7 +242,8 @@
# Setup integrator
integrator = ElasticityImplicit()
integrator.preinitialize(mesh, material)
- integrator.initialize()
+ from pyre.units.time import s
+ integrator.initialize(totalTime=0.0*s, numTimeSteps=1)
integrator.timeStep(dt)
# Setup fields
More information about the cig-commits
mailing list