[cig-commits] r6973 - in short/3D/PyLith/trunk: . examples/twotri3
libsrc/feassemble pylith/bc pylith/feassemble pylith/problems
brad at geodynamics.org
brad at geodynamics.org
Fri May 25 16:31:50 PDT 2007
Author: brad
Date: 2007-05-25 16:31:49 -0700 (Fri, 25 May 2007)
New Revision: 6973
Added:
short/3D/PyLith/trunk/examples/twotri3/bcsingle.odb
short/3D/PyLith/trunk/examples/twotri3/dispbc.spatialdb
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/examples/twotri3/implicit.cfg
short/3D/PyLith/trunk/examples/twotri3/twotri3.mesh
short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
short/3D/PyLith/trunk/pylith/bc/Dirichlet.py
short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
Log:
Added Dirichlet boundary condition to twotri3 example. Fixed bugs in setting up boundary condition.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/TODO 2007-05-25 23:31:49 UTC (rev 6973)
@@ -2,22 +2,25 @@
MAIN PRIORITIES (Brad)
======================================================================
+0. Create binding for zeroing PETSc matrix (use in Explicit.py and
+ Implicit.py before integrating Jacobian)
+
1. Unit tests for Integrator stuff.
- b. Integrator
- iii. C++ unit tests
- iv. Python unit tests
+ a. Add in use of useElasticBehavior()
+ Would like to use boost::shared_ptr to prevent copies and
+ cloning of materials.
- e. ElasticityExplicit
+ b. Add unit test for IntegratorElasticity::calcTotalStrain
+
+ c. ElasticityExplicit
+ i. C++ unit tests
ii. Python unit tests
- f. ElasticityImplicit
+ d. ElasticityImplicit
+ i. C++ unit tests
ii. Python unit tests
- g. Add unit test for IntegratorElasticity::calcTotalStrain
-
- i. Add in use of useElasticBehavior()
-
2. Add dualBasis to Quadrature.
a. Python
ReferenceCell
Added: short/3D/PyLith/trunk/examples/twotri3/bcsingle.odb
===================================================================
--- short/3D/PyLith/trunk/examples/twotri3/bcsingle.odb 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/examples/twotri3/bcsingle.odb 2007-05-25 23:31:49 UTC (rev 6973)
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+from pylith.problems.BoundaryConditions import BoundaryConditions
+
+# BCSingle class
+class BCSingle(BoundaryConditions):
+ """
+ Python boundary conditions container for a single boundary condition.
+
+ Factory: boundary_conditions
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(BoundaryConditions.Inventory):
+ """
+ Python object for managing BCSingle facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing BCSingle facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li \b bc Boundary condition.
+
+ import pyre.inventory
+
+ from pylith.bc.Dirichlet import Dirichlet
+
+ bc = pyre.inventory.facility("bc", family="boundary_condition",
+ factory=Dirichlet)
+ bc.meta['tip'] = "Boundary condition."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="bcsingle"):
+ """
+ Constructor.
+ """
+ BoundaryConditions.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set attributes from inventory.
+ """
+ BoundaryConditions._configure(self)
+ self.bc = [self.inventory.bc]
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def boundary_conditions():
+ """
+ Factory associated with BCSingle.
+ """
+ return BCSingle()
+
+
+# End of file
Added: short/3D/PyLith/trunk/examples/twotri3/dispbc.spatialdb
===================================================================
--- short/3D/PyLith/trunk/examples/twotri3/dispbc.spatialdb 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/examples/twotri3/dispbc.spatialdb 2007-05-25 23:31:49 UTC (rev 6973)
@@ -0,0 +1,15 @@
+#SPATIAL.ascii 1
+SimpleDB {
+ num-values = 2
+ value-names = dof-0 dof-1
+ value-units = m m
+ num-locs = 2
+ data-dim = 1
+ space-dim = 2
+ cs-data = cartesian {
+ to-meters = 1.0
+ space-dim = 2
+ }
+}
+-1.0 0.0 -0.1 0.0
+ 1.0 0.0 0.1 0.0
Modified: short/3D/PyLith/trunk/examples/twotri3/implicit.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/twotri3/implicit.cfg 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/examples/twotri3/implicit.cfg 2007-05-25 23:31:49 UTC (rev 6973)
@@ -6,3 +6,14 @@
# ----------------------------------------------------------------------
[pylithapp.timedependent]
formulation = pylith.problems.Implicit
+bc = bcsingle
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.bc.bc]
+fixed_dof = [0, 1]
+id = 10
+label = end points
+db.label = Dirichlet BC
+db.iohandler.filename = dispbc.spatialdb
Modified: short/3D/PyLith/trunk/examples/twotri3/twotri3.mesh
===================================================================
--- short/3D/PyLith/trunk/examples/twotri3/twotri3.mesh 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/examples/twotri3/twotri3.mesh 2007-05-25 23:31:49 UTC (rev 6973)
@@ -31,4 +31,13 @@
2
}
}
+ group = {
+ type = vertices
+ name = end points
+ count = 2
+ indices = {
+ 0
+ 3
+ }
+ }
}
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc 2007-05-25 23:31:49 UTC (rev 6973)
@@ -368,8 +368,8 @@
// Update state variables as needed.
void
pylith::feassemble::ElasticityExplicit::updateState(
- const ALE::Obj<real_section_type>& disp,
- const ALE::Obj<Mesh>& mesh)
+ const ALE::Obj<real_section_type>& disp,
+ const ALE::Obj<Mesh>& mesh)
{ // updateState
assert(0 != _material);
assert(!disp.isNull());
Modified: short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2007-05-25 23:31:49 UTC (rev 6973)
@@ -82,6 +82,7 @@
Initialize boundary condition.
"""
assert(None != self.cppHandle)
+ self.db.initialize()
self.cppHandle.id = self.id
self.cppHandle.label = self.label
self.cppHandle.db = self.db.cppHandle
Modified: short/3D/PyLith/trunk/pylith/bc/Dirichlet.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Dirichlet.py 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/pylith/bc/Dirichlet.py 2007-05-25 23:31:49 UTC (rev 6973)
@@ -26,7 +26,7 @@
"""
try:
size = len(value)
- num = map(float, value)
+ num = map(int, value)
for v in num:
if v < 0:
raise ValueError
@@ -34,7 +34,7 @@
raise ValueError, \
"'fixed_dof' must be a zero based list of indices of fixed " \
"degrees of freedom."
- return value
+ return num
# Dirichlet class
Modified: short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Constraint.py 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/pylith/feassemble/Constraint.py 2007-05-25 23:31:49 UTC (rev 6973)
@@ -82,7 +82,7 @@
Set constrained values in field at time t.
"""
assert(None != self.cppHandle)
- self.cppHandle.setField(t, field, self.mesh.cppHandle)
+ self.cppHandle.setField(t.value, field, self.mesh.cppHandle)
return
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-05-25 23:31:49 UTC (rev 6973)
@@ -107,7 +107,7 @@
"""
dispTpdt = self.fields.getReal("dispTpdt")
for constraint in self.constraints:
- constraint.setField(dispTpdt, t+dt, dt)
+ constraint.setField(t+dt, dispTpdt)
needNewJacobian = False
for integrator in self.integrators:
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2007-05-25 22:09:01 UTC (rev 6972)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2007-05-25 23:31:49 UTC (rev 6973)
@@ -95,14 +95,15 @@
self.fields.createHistory(["dispTBctpdt", "dispT"])
self.fields.setFiberDimension("dispT", dimension)
for constraint in self.constraints:
- constraint.setConstraintSizes(self.fields.getReal("dispT"), mesh)
+ constraint.setConstraintSizes(self.fields.getReal("dispT"))
self.fields.allocate("dispT")
for constraint in self.constraints:
- constraint.setConstraints(self.fields.getReal("dispT"), mesh)
+ constraint.setConstraints(self.fields.getReal("dispT"))
self.fields.copyLayout("dispT")
self.jacobian = mesh.createMatrix(self.fields.getReal("dispT"))
- self._solveElastic(mesh, t=0.0, dt=dt)
+ from pyre.units.time import s
+ self._solveElastic(mesh, t=0.0*s, dt=dt)
self.solver.initialize(mesh, self.fields.getReal("dispIncr"))
return
@@ -126,7 +127,7 @@
# unaffected and will be equal to their values at time t.
dispTBctpdt = self.fields.getReal("dispTBctpdt")
for constraint in self.constraints:
- constraint.setField(dispTBctpdt, t+dt, dt)
+ constraint.setField(t+dt, dispTBctpdt)
needNewJacobian = False
for integrator in self.integrators:
@@ -201,7 +202,7 @@
self._info.log("Setting constraints.")
dispT = self.fields.getReal("dispT")
for constraint in self.constraints:
- constraint.setField(dispT, t, dt)
+ constraint.setField(t, dispT)
self._info.log("Integrating Jacobian and residual of operator.")
for integrator in self.integrators:
More information about the cig-commits
mailing list