[cig-commits] r6841 - in short/3D/PyLith/trunk/pylith: . problems
brad at geodynamics.org
brad at geodynamics.org
Thu May 10 12:24:58 PDT 2007
Author: brad
Date: 2007-05-10 12:24:58 -0700 (Thu, 10 May 2007)
New Revision: 6841
Modified:
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/pylith/problems/Problem.py
short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
short/3D/PyLith/trunk/pylith/problems/__init__.py
Log:
Worked on adding boundary conditions to problems. Moved setup of materials and boundary conditions to Formulation (was in Explicit).
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2007-05-10 19:00:15 UTC (rev 6840)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2007-05-10 19:24:58 UTC (rev 6841)
@@ -13,6 +13,10 @@
nobase_pkgpyexec_PYTHON = \
PyLithApp.py \
__init__.py \
+ bc/__init__.py \
+ bc/BCIntegrator.py \
+ bc/BoundaryCondition.py \
+ bc/Dirichlet.py \
faults/__init__.py \
faults/BruneSlipFn.py \
faults/EqKinSrc.py \
@@ -52,6 +56,9 @@
meshio/MeshIOLagrit.py \
meshio/__init__.py \
problems/__init__.py \
+ problems/BCPrism.py \
+ problems/BCQuadrilateral.py \
+ problems/BoundaryConditions.py \
problems/EqDeformation.py \
problems/Explicit.py \
problems/Formulation.py \
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-05-10 19:00:15 UTC (rev 6840)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-05-10 19:24:58 UTC (rev 6841)
@@ -67,36 +67,34 @@
return
- def initialize(self, mesh, materialsBin, spaceDim, dt):
+ def elasticityIntegrator(self):
"""
- Create explicit integrators for each element family.
+ Get integrator for elastic material.
"""
from pylith.feassemble.ExplicitElasticity import ExplicitElasticity
-
- self._info.log("Initializing integrators.")
+ return ExplicitElasticity()
+
+
+ def initialize(self, mesh, materials, boundaryConditions, dimension, dt):
+ """
+ Initialize problem for explicit time integration.
+ """
self.integrators = []
- for material in materialsBin.materials:
- if material.quadrature.spaceDim != spaceDim:
- raise ValueError, \
- "Spatial dimension of problem is '%d' but quadrature " \
- "for material '%s' is for spatial dimension '%d'." % \
- (spaceDim, material.label, material.quadrature.spaceDim)
- integrator = ExplicitElasticity()
- integrator.setMesh(mesh)
- integrator.initQuadrature(material.quadrature)
- integrator.initMaterial(mesh, material)
- integrator.timeStep(dt)
- self.integrators.append(integrator)
+ Formulation.initialize(self, mesh, materials, boundaryConditions,
+ dimension, dt)
+ self._info.log("Initializing integrators.")
+
self._info.log("Creating fields and matrices.")
- self.dispT = mesh.cppHandle.createRealSection("dispT", spaceDim)
- self.dispTmdt = mesh.cppHandle.createRealSection("dispTmdt", spaceDim)
- self.dispTpdt = mesh.cppHandle.createRealSection("dispTpdt", spaceDim)
- self.constant = mesh.cppHandle.createRealSection("constant", spaceDim)
+ self.dispT = mesh.cppHandle.createRealSection("dispT", dimension)
+ self.dispTmdt = mesh.cppHandle.createRealSection("dispTmdt", dimension)
+ self.dispTpdt = mesh.cppHandle.createRealSection("dispTpdt", dimension)
+ self.constant = mesh.cppHandle.createRealSection("constant", dimension)
self.jacobian = mesh.cppHandle.createMatrix(self.constant)
self._info.log("Integrating Jacobian of operator.")
for integrator in self.integrators:
+ integrator.timeStep(dt)
integrator.integrateJacobian(self.jacobian, self.dispT)
import pylith.utils.petsc as petsc
petsc.mat_assemble(self.jacobian)
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2007-05-10 19:00:15 UTC (rev 6840)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2007-05-10 19:24:58 UTC (rev 6841)
@@ -64,11 +64,29 @@
return
- def initialize(self, mesh, materials, dimension, dt):
+ def initialize(self, mesh, materials, boundaryConditions, dimension, dt):
"""
Create integrators for each element family.
"""
- raise NotImplementedError, "initialize() not implemented."
+ self._info.log("Initializing integrators.")
+ self.integrators = []
+
+ for material in materials.materials:
+ if material.quadrature.spaceDim != dimension:
+ raise ValueError, \
+ "Spatial dimension of problem is '%d' but quadrature " \
+ "for material '%s' is for spatial dimension '%d'." % \
+ (dimension, material.label, material.quadrature.spaceDim)
+ integrator = self.elasticityIntegrator()
+ integrator.setMesh(mesh)
+ integrator.initQuadrature(material.quadrature)
+ integrator.initMaterial(mesh, material)
+ self.integrators.append(integrator)
+
+ for bc in boundaryConditions.bc:
+ integrator = bc
+ integrator.initialize(mesh)
+ self.integrators.append(integrator)
return
Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py 2007-05-10 19:00:15 UTC (rev 6840)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py 2007-05-10 19:24:58 UTC (rev 6841)
@@ -50,10 +50,10 @@
factory=Homogeneous)
materials.meta['tip'] = "Materials in problem."
- #from BoundaryConditions import BoundaryConditions
- #bc = pyre.inventory.facility("bc", familty="bc",
- # factory=BoundaryConditions)
- #bc.meta['tip'] = "Boundary conditions."
+ from BoundaryConditions import BoundaryConditions
+ bc = pyre.inventory.facility("bc", family="bc",
+ factory=BoundaryConditions)
+ bc.meta['tip'] = "Boundary conditions."
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -100,7 +100,7 @@
"""
Component._configure(self)
self.materials = self.inventory.materials
- #self.bc = self.inventory.bc
+ self.bc = self.inventory.bc
return
Modified: short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/TimeDependent.py 2007-05-10 19:00:15 UTC (rev 6840)
+++ short/3D/PyLith/trunk/pylith/problems/TimeDependent.py 2007-05-10 19:24:58 UTC (rev 6841)
@@ -91,7 +91,8 @@
"""
self._info.log("Initializing problem.")
self.mesh = mesh
- self.formulation.initialize(mesh, self.materials, self.dimension, self.dt)
+ self.formulation.initialize(mesh, self.materials, self.bc,
+ self.dimension, self.dt)
return
Modified: short/3D/PyLith/trunk/pylith/problems/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/__init__.py 2007-05-10 19:00:15 UTC (rev 6840)
+++ short/3D/PyLith/trunk/pylith/problems/__init__.py 2007-05-10 19:24:58 UTC (rev 6841)
@@ -14,7 +14,10 @@
##
## @brief Python PyLith crustal dynamics problems module initialization
-__all__ = ['EqDeformation',
+__all__ = ['BCPrism',
+ 'BCQuadrilateral',
+ 'BoundaryConditions',
+ 'EqDeformation',
'Explicit',
'Problem',
'TimeDependent']
More information about the cig-commits
mailing list