[cig-commits] r14471 - in short/3D/PyLith/branches/pylith-swig: . libsrc/problems modulesrc/problems pylith/apps pylith/problems tests/1d/line2 unittests/pytests/topology
brad at geodynamics.org
brad at geodynamics.org
Thu Mar 26 14:00:07 PDT 2009
Author: brad
Date: 2009-03-26 14:00:06 -0700 (Thu, 26 Mar 2009)
New Revision: 14471
Modified:
short/3D/PyLith/branches/pylith-swig/TODO
short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc
short/3D/PyLith/branches/pylith-swig/modulesrc/problems/problems.i
short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py
short/3D/PyLith/branches/pylith-swig/pylith/problems/Explicit.py
short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py
short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py
short/3D/PyLith/branches/pylith-swig/tests/1d/line2/TestAxial.py
short/3D/PyLith/branches/pylith-swig/tests/1d/line2/axialextension.cfg
short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMesh.py
Log:
Fixed setting integrators in C++ Formulation and SWIG interface. Added some missing unit tests.
Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/TODO 2009-03-26 21:00:06 UTC (rev 14471)
@@ -12,9 +12,6 @@
FaultCohesiveKin
DataWriterVTK
- TestMesh.test_view()
- TestMesh.test_checkMaterialIds()
-
libsrc/materials
Maxwell materials
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/Formulation.cc 2009-03-26 21:00:06 UTC (rev 14471)
@@ -100,6 +100,7 @@
// Add in contributions that require assembly.
int numIntegrators = _meshIntegrators.size();
+ assert(numIntegrators > 0); // must have at least 1 bulk integrator
for (int i=0; i < numIntegrators; ++i) {
_meshIntegrators[i]->timeStep(_dt);
_meshIntegrators[i]->integrateResidual(residual, _t, _fields);
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/problems/problems.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/problems/problems.i 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/problems/problems.i 2009-03-26 21:00:06 UTC (rev 14471)
@@ -36,6 +36,8 @@
} // try/catch
} // exception
+%include "typemaps.i"
+%include "../include/integratorarray.i"
// Interfaces
%include "Formulation.i"
Modified: short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py 2009-03-26 21:00:06 UTC (rev 14471)
@@ -89,6 +89,7 @@
if "interfaces" in dir(self.problem):
interfaces = self.problem.interfaces.components()
mesh = self.mesher.create(self.problem.normalizer, interfaces)
+ del self.mesher
self._debug.log(resourceUsageString())
self._logger.stagePop()
@@ -114,9 +115,15 @@
self._logger.stagePush("Finalize")
self.problem.finalize()
self._logger.stagePop()
-
+
+ del mesh
+ del self.problem
+ import gc
+ print gc.collect()
+
self._logger.eventEnd("PyLith main")
- self.petsc.finalize()
+ print "TEMPORARY PetscFinalized() commented out in PyLithApp.py"
+ #self.petsc.finalize()
return
Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Explicit.py 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Explicit.py 2009-03-26 21:00:06 UTC (rev 14471)
@@ -95,7 +95,7 @@
# Solve for total displacement field
for constraint in self.constraints:
constraint.useSolnIncr(False)
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.useSolnIncr(False)
self._logger.eventEnd(logEvent)
@@ -114,7 +114,7 @@
constraint.setField(t+dt, dispTpdt)
needNewJacobian = False
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.timeStep(dt)
if integrator.needNewJacobian():
needNewJacobian = True
Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py 2009-03-26 21:00:06 UTC (rev 14471)
@@ -99,7 +99,8 @@
"""
Component.__init__(self, name, facility="pde_formulation")
ModuleFormulation.__init__(self)
- self.integrators = None
+ self.integratorsMesh = None
+ self.integratorsSubMesh = None
self.constraints = None
self.fields = None
self.solnName = None
@@ -118,7 +119,8 @@
self.timeStep.preinitialize()
self.mesh = mesh
- self.integrators = []
+ self.integratorsMesh = []
+ self.integratorsSubMesh = []
self.constraints = []
self.gravityField = gravityField
@@ -143,7 +145,7 @@
self.timeStep.verifyConfiguration()
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.verifyConfiguration()
for constraint in self.constraints:
constraint.verifyConfiguration()
@@ -175,9 +177,11 @@
self.gravityField.initialize()
self._info.log("Initializing integrators.")
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.gravityField = self.gravityField
integrator.initialize(totalTime, numTimeSteps, normalizer)
+ ModuleFormulation.meshIntegrators(self, self.integratorsMesh)
+ ModuleFormulation.submeshIntegrators(self, self.integratorsSubMesh)
self._debug.log(resourceUsageString())
self._info.log("Initializing constraints.")
@@ -231,7 +235,7 @@
logEvent = "%stimestep" % self._loggingPrefix
self._logger.eventBegin(logEvent)
- dt = self.timeStep.timeStep(self.integrators)
+ dt = self.timeStep.timeStep(self.integratorsMesh + self.integratorsSubMesh)
self._logger.eventEnd(logEvent)
return dt
@@ -271,7 +275,7 @@
self._info.log("Writing solution fields.")
#for output in self.output.components():
# output.writeData(t+dt, self.fields)
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.poststep(t, dt, totalTime, self.fields)
for constraint in self.constraints:
constraint.poststep(t, dt, totalTime, self.fields)
@@ -289,7 +293,7 @@
self._info.log("Formulation finalize.")
self._debug.log(resourceUsageString())
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.finalize()
for constraint in self.constraints:
constraint.finalize()
@@ -334,7 +338,7 @@
"Could not use '%s' as an integrator for material '%s'. " \
"Functionality missing." % (integrator.name, material.label)
integrator.preinitialize(self.mesh, material)
- self.integrators.append(integrator)
+ self.integratorsMesh.append(integrator)
self._debug.log(resourceUsageString())
self._info.log("Added elasticity integrator for material '%s'." % \
@@ -356,7 +360,7 @@
foundType = False
if implementsIntegrator(bc):
foundType = True
- self.integrators.append(bc)
+ self.integratorsSubMesh.append(bc)
self._info.log("Added boundary condition '%s' as an integrator." % \
bc.label)
if implementsConstraint(bc):
@@ -385,7 +389,7 @@
foundType = False
if implementsIntegrator(ic):
foundType = True
- self.integrators.append(ic)
+ self.integratorsSubMesh.append(ic)
self._info.log("Added interface condition '%s' as an integrator." % \
ic.label)
if implementsConstraint(ic):
@@ -406,6 +410,7 @@
Reform Jacobian matrix for operator.
"""
self._debug.log(resourceUsageString())
+ self._info.log("Integrating Jacobian operator.")
self._logger.stagePush("Reform Jacobian")
self.updateSettings(self.jacobian, self.fields, t, dt)
Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py 2009-03-26 21:00:06 UTC (rev 14471)
@@ -119,7 +119,7 @@
self._stepCount = 0
for constraint in self.constraints:
constraint.useSolnIncr(False)
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.useSolnIncr(False)
self._logger.eventEnd(logEvent)
@@ -155,13 +155,13 @@
"field solution.")
for constraint in self.constraints:
constraint.useSolnIncr(True)
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.useSolnIncr(True)
self._reformJacobian(t, dt)
### NONLINEAR: Might want to move logic into IntegrateJacobian() and set a flag instead
needNewJacobian = False
- for integrator in self.integrators:
+ for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.timeStep(dt)
if integrator.needNewJacobian():
needNewJacobian = True
@@ -189,6 +189,8 @@
self._info.log("Solving equations.")
residual = self.fields.get("residual")
self._logger.stagePush("Solve")
+ residual.view("RESIDUAL BEFORE SOLVE")
+ self.jacobian.view()
self.solver.solve(dispIncr, self.jacobian, residual)
self._logger.stagePop()
Modified: short/3D/PyLith/branches/pylith-swig/tests/1d/line2/TestAxial.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/tests/1d/line2/TestAxial.py 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/tests/1d/line2/TestAxial.py 2009-03-26 21:00:06 UTC (rev 14471)
@@ -168,11 +168,11 @@
return
- def test_elastic_statevars(self):
- """
- Check elastic state variables.
- """
- return
+ #def test_elastic_statevars(self):
+ # """
+ # Check elastic state variables.
+ # """
+ # return
# End of file
Modified: short/3D/PyLith/branches/pylith-swig/tests/1d/line2/axialextension.cfg
===================================================================
--- short/3D/PyLith/branches/pylith-swig/tests/1d/line2/axialextension.cfg 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/tests/1d/line2/axialextension.cfg 2009-03-26 21:00:06 UTC (rev 14471)
@@ -5,14 +5,14 @@
# journal
# ----------------------------------------------------------------------
[axialextension.journal.info]
-#timedependent = 1
-#implicit = 1
-#petsc = 1
-#solverlinear = 1
-#meshiocubit = 1
-#implicitelasticity = 1
-#quadrature2d = 1
-#fiatsimplex = 1
+timedependent = 1
+implicit = 1
+petsc = 1
+solverlinear = 1
+meshiocubit = 1
+implicitelasticity = 1
+quadrature = 1
+fiatsimplex = 1
# ----------------------------------------------------------------------
# mesh_generator
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMesh.py 2009-03-26 19:55:19 UTC (rev 14470)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMesh.py 2009-03-26 21:00:06 UTC (rev 14471)
@@ -135,6 +135,25 @@
return
+ def test_view(self):
+ """
+ Test view().
+ """
+ mesh = self._getMesh()
+
+ mesh.view("Testing view")
+ return
+
+
+ def test_checkMaterialIds(self):
+ """
+ Test checkMaterialIds().
+ """
+ mesh = self._getMesh()
+ mesh.checkMaterialIds([3, 4])
+ return
+
+
# PRIVATE METHODS ////////////////////////////////////////////////////
def _getMesh(self):
More information about the CIG-COMMITS
mailing list