[cig-commits] r7176 - in short/3D/PyLith/trunk: . libsrc/feassemble
modulesrc/faults pylith pylith/faults pylith/problems
pylith/topology tests/1d/line2
brad at geodynamics.org
brad at geodynamics.org
Tue Jun 12 16:31:56 PDT 2007
Author: brad
Date: 2007-06-12 16:31:56 -0700 (Tue, 12 Jun 2007)
New Revision: 7176
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
short/3D/PyLith/trunk/pylith/PyLithApp.py
short/3D/PyLith/trunk/pylith/faults/Fault.py
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
short/3D/PyLith/trunk/tests/1d/line2/dislocation.cfg
Log:
Fixed Python top-level stuff associated with creating cohesive cells and having proper code layout for FaultCohesiveKin.py.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/TODO 2007-06-12 23:31:56 UTC (rev 7176)
@@ -2,6 +2,11 @@
MAIN PRIORITIES (Brad)
======================================================================
+Python unit tests for FaultCohesiveKin
+ setConstraintSizes()
+ setConstraints()
+ setField()
+
tests/1d/line2
dislocation.cfg
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc 2007-06-12 23:31:56 UTC (rev 7176)
@@ -313,7 +313,7 @@
// Assemble cell contribution into field
mesh->updateAdd(residual, *c_iter, _cellVector);
- residual->view("AFTER updateAdd"); // TEMPORARY
+ residual->view("residual AFTER updateAdd"); // TEMPORARY
} // for
} // integrateResidual
Modified: short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2007-06-12 23:31:56 UTC (rev 7176)
@@ -386,6 +386,98 @@
return
+ def setConstraintSizes(self, field, mesh):
+ """
+ Set number of degrees of freedom that are constrained at points in field.
+ """
+ # create shim for method 'setConstraintSizes'
+ #embed{ void FaultCohesiveKin_setConstraintSizes(void* objVptr, void* fieldVptr, void* meshVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != fieldVptr);
+ assert(0 != meshVptr);
+ ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+ ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+ ((pylith::faults::FaultCohesiveKin*) objVptr)->setConstraintSizes(*field, *mesh);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+
+ if not mesh.name == "pylith_topology_Mesh":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'pylith::topology::Mesh'."
+ FaultCohesiveKin_setConstraintSizes(self.thisptr, PyCObject_AsVoidPtr(field),
+ ptrFromHandle(mesh))
+ return
+
+
+ def setConstraints(self, field, mesh):
+ """
+ Set which degrees of freedom that are constrained at points in field.
+ """
+ # create shim for method 'setConstraints'
+ #embed{ void FaultCohesiveKin_setConstraints(void* objVptr, void* fieldVptr, void* meshVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != fieldVptr);
+ assert(0 != meshVptr);
+ ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+ ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+ ((pylith::faults::FaultCohesiveKin*) objVptr)->setConstraints(*field, *mesh);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+
+ if not mesh.name == "pylith_topology_Mesh":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'pylith::topology::Mesh'."
+ FaultCohesiveKin_setConstraints(self.thisptr, PyCObject_AsVoidPtr(field), ptrFromHandle(mesh))
+ return
+
+
+ def setField(self, t, field, mesh):
+ """
+ Set values in field.
+ """
+ # create shim for method 'setField'
+ #embed{ void FaultCohesiveKin_setField(void* objVptr, double t, void* fieldVptr, void* meshVptr)
+ try {
+ assert(0 != objVptr);
+ assert(0 != fieldVptr);
+ assert(0 != meshVptr);
+ ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+ ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+ ((pylith::faults::FaultCohesiveKin*) objVptr)->setField(t, *field, *mesh);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+
+ if not mesh.name == "pylith_topology_Mesh":
+ raise TypeError, \
+ "Argument must be extension module type " \
+ "'pylith::topology::Mesh'."
+ FaultCohesiveKin_setField(self.thisptr, t, PyCObject_AsVoidPtr(field),
+ ptrFromHandle(mesh))
+ return
+
+
property quadrature:
def __set__(self, q):
"""
Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py 2007-06-12 23:31:56 UTC (rev 7176)
@@ -75,11 +75,11 @@
"""
self.petsc.initialize()
- # Create mesh (adjust to account for faults if necessary)
- faults = None
- if faults in dir(self.problem):
- faults = self.problem.faults
- mesh = self.mesher.create(faults)
+ # Create mesh (adjust to account for interfaces (faults) if necessary)
+ interfaces = None
+ if "interfaces" in dir(self.problem):
+ interfaces = self.problem.interfaces.bin
+ mesh = self.mesher.create(interfaces)
# Initialize problem and then run
self.problem.initialize(mesh)
Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py 2007-06-12 23:31:56 UTC (rev 7176)
@@ -135,96 +135,6 @@
return
- def timeStep(self, dt):
- """
- Set time step for advancing from time t to time t+dt.
- """
- assert(None != self.cppHandle)
- self.cppHandle.timeStep = dt.value
- return
-
-
- def stableTimeStep(self):
- """
- Get stable time step for advancing from time t to time t+dt.
- """
- assert(None != self.cppHandle)
- from pyre.units.time import second
- return self.cppHandle.stableTimeStep*second
-
-
- def integrateResidual(self, residual, fields):
- """
- Integrate contributions to residual term at time t.
- """
- assert(None != self.cppHandle)
- self.cppHandle.integrateResidual(residual, fields.cppHandle,
- self.mesh.cppHandle)
- return
-
-
- def needNewJacobian(self):
- """
- Returns true if we need to recompute Jacobian matrix for operator,
- false otherwise.
- """
- assert(None != self.cppHandle)
- return self.cppHandle.needNewJacobian
-
-
- def integrateJacobian(self, jacobian, fields):
- """
- Integrate contributions to Jacobian term at time t.
- """
- assert(None != self.cppHandle)
- self.cppHandle.integrateJacobian(jacobian, fields.cppHandle,
- self.mesh.cppHandle)
- return
-
-
- def updateState(self, field):
- """
- Update state variables as needed.
- """
- assert(None != self.cppHandle)
- self.cppHandle.updateState(field, self.mesh.cppHandle)
- return
-
-
- def setConstraintSizes(self, field):
- """
- Set constraint sizes in field.
- """
- assert(None != self.cppHandle)
- self.cppHandle.setConstraintSizes(field, self.mesh.cppHandle)
- return
-
-
- def setConstraints(self, field):
- """
- Set constraints for field.
- """
- assert(None != self.cppHandle)
- self.cppHandle.setConstraints(field, self.mesh.cppHandle)
- return
-
-
- def setField(self, t, field):
- """
- Set constrained values in field at time t.
- """
- assert(None != self.cppHandle)
- self.cppHandle.setField(t.value, field, self.mesh.cppHandle)
- return
-
-
- def finalize(self):
- """
- Cleanup after time stepping.
- """
- return
-
-
# PRIVATE METHODS ////////////////////////////////////////////////////
def _configure(self):
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2007-06-12 23:31:56 UTC (rev 7176)
@@ -69,6 +69,7 @@
"""
Initialize cohesive elements.
"""
+ self._info.log("Initializing fault '%s'." % self.label)
self.mesh = mesh
assert(None != self.cppHandle)
self.eqsrc.initialize()
@@ -99,6 +100,7 @@
"""
Integrate contributions to residual term at time t.
"""
+ self._info.log("Integrating residual for fault '%s'." % self.label)
assert(None != self.cppHandle)
self.cppHandle.integrateResidual(residual, fields.cppHandle,
self.mesh.cppHandle)
@@ -118,6 +120,7 @@
"""
Integrate contributions to Jacobian term at time t.
"""
+ self._info.log("Integrating Jacobian for fault '%s'." % self.label)
assert(None != self.cppHandle)
self.cppHandle.integrateJacobian(jacobian, fields.cppHandle,
self.mesh.cppHandle)
@@ -128,11 +131,39 @@
"""
Update state variables as needed.
"""
+ self._info.log("Updating state for fault '%s'." % self.label)
assert(None != self.cppHandle)
self.cppHandle.updateState(field, self.mesh.cppHandle)
return
+ def setConstraintSizes(self, field):
+ """
+ Set constraint sizes in field.
+ """
+ assert(None != self.cppHandle)
+ self.cppHandle.setConstraintSizes(field, self.mesh.cppHandle)
+ return
+
+
+ def setConstraints(self, field):
+ """
+ Set constraints for field.
+ """
+ assert(None != self.cppHandle)
+ self.cppHandle.setConstraints(field, self.mesh.cppHandle)
+ return
+
+
+ def setField(self, t, field):
+ """
+ Set constrained values in field at time t.
+ """
+ assert(None != self.cppHandle)
+ self.cppHandle.setField(t.value, field, self.mesh.cppHandle)
+ return
+
+
def finalize(self):
"""
Cleanup after time stepping.
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2007-06-12 23:31:56 UTC (rev 7176)
@@ -101,14 +101,20 @@
integrator.initQuadrature(material.quadrature)
integrator.initMaterial(mesh, material)
self.integrators.append(integrator)
+ self._info.log("Added elasticity integrator for material '%s'." % \
+ material.label)
self._info.log("Initializing boundary conditions.")
for bc in boundaryConditions.bin:
bc.initialize(mesh)
if implementsIntegrator(bc):
self.integrators.append(bc)
- elif implementsConstraint(bc):
+ self._info.log("Added boundary condition '%s' as an integrator." % \
+ bc.label)
+ if implementsConstraint(bc):
self.constraints.append(bc)
+ self._info.log("Added boundary condition '%s' as a constraint." % \
+ bc.label)
else:
raise TypeError, \
"Could not determine whether boundary condition '%s' is an " \
@@ -119,8 +125,12 @@
ic.initialize(mesh)
if implementsIntegrator(ic):
self.integrators.append(ic)
- elif implementsConstraint(ic):
+ self._info.log("Added interface condition '%s' as an integrator." % \
+ ic.label)
+ if implementsConstraint(ic):
self.constraints.append(ic)
+ self._info.log("Added interface condition '%s' as a constraint." % \
+ ic.label)
else:
raise TypeError, \
"Could not determine whether interface condition '%s' is an " \
Modified: short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py 2007-06-12 23:31:56 UTC (rev 7176)
@@ -84,13 +84,13 @@
return
- def _adjustTopology(self, mesh, faults):
+ def _adjustTopology(self, mesh, interfaces):
"""
- Adjust topology for fault implementation.
+ Adjust topology for interface implementation.
"""
- if not faults is None:
- for fault in faults:
- mesh.adjustTopology(fault)
+ if not interfaces is None:
+ for interface in interfaces:
+ interface.adjustTopology(mesh)
return
Modified: short/3D/PyLith/trunk/tests/1d/line2/dislocation.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line2/dislocation.cfg 2007-06-12 22:36:44 UTC (rev 7175)
+++ short/3D/PyLith/trunk/tests/1d/line2/dislocation.cfg 2007-06-12 23:31:56 UTC (rev 7176)
@@ -15,6 +15,7 @@
implicitelasticity = 1
quadrature1d = 1
fiatsimplex = 1
+faultcohesivekin = 1
# ----------------------------------------------------------------------
# mesh_generator
More information about the cig-commits
mailing list