[cig-commits] r6448 - in short/3D/PyLith/trunk: examples/twotri3
modulesrc/feassemble modulesrc/materials pylith/feassemble
pylith/materials pylith/meshio pylith/problems pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Wed Mar 28 12:17:38 PDT 2007
Author: brad
Date: 2007-03-28 12:17:37 -0700 (Wed, 28 Mar 2007)
New Revision: 6448
Added:
short/3D/PyLith/trunk/examples/twotri3/matprops.spatialdb
Modified:
short/3D/PyLith/trunk/examples/twotri3/pylithapp.cfg
short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src
short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py
short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py
short/3D/PyLith/trunk/pylith/materials/Material.py
short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Problem.py
short/3D/PyLith/trunk/pylith/topology/Mesh.py
Log:
Worked on finishing up initialization of materials.
Added: short/3D/PyLith/trunk/examples/twotri3/matprops.spatialdb
===================================================================
--- short/3D/PyLith/trunk/examples/twotri3/matprops.spatialdb 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/examples/twotri3/matprops.spatialdb 2007-03-28 19:17:37 UTC (rev 6448)
@@ -0,0 +1,14 @@
+#SPATIAL.ascii 1
+SimpleDB {
+ num-values = 3
+ value-names = density vs vp
+ value-units = kg/m^3 m/s m/s
+ num-locs = 1
+ data-dim = 0
+ space-dim = 2
+ cs-data = cartesian {
+ to-meters = 1.0
+ space-dim = 2
+ }
+}
+0.0 0.0 2500.0 3000.0 6705.0
Modified: short/3D/PyLith/trunk/examples/twotri3/pylithapp.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/twotri3/pylithapp.cfg 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/examples/twotri3/pylithapp.cfg 2007-03-28 19:17:37 UTC (rev 6448)
@@ -1,3 +1,4 @@
+# -*- Python -*-
[pylithapp]
# ----------------------------------------------------------------------
@@ -3,12 +4,13 @@
# journal
# ----------------------------------------------------------------------
-journal.info.eqdeformation = 1
-journal.info.explicit = 1
-journal.info.petsc = 1
-journal.info.meshioascii = 1
-journal.info.homogeneous = 1
-journal.info.explicitelasticity = 1
-journal.info.quadrature2d = 1
-journal.info.fiatsimplex = 1
+[pylithapp.journal.info]
+eqdeformation = 1
+explicit = 1
+petsc = 1
+meshioascii = 1
+homogeneous = 1
+explicitelasticity = 1
+quadrature2d = 1
+fiatsimplex = 1
# ----------------------------------------------------------------------
@@ -20,12 +22,21 @@
# ----------------------------------------------------------------------
# mesh_generator
# ----------------------------------------------------------------------
-mesh_generator.importer.filename = twotri3.mesh
+[pylithapp.mesh_generator.importer]
+filename = twotri3.mesh
# ----------------------------------------------------------------------
# problem
# ----------------------------------------------------------------------
-eqdeformation.total_time = 1.0*s
-eqdeformation.default_dt = 1.0*s
-eqdeformation.homogeneous.material.quadrature = pylith.feassemble.quadrature.Quadrature2D
-eqdeformation.homogeneous.material.quadrature.cell.shape = triangle
+[pylithapp.eqdeformation]
+total_time = 1.0*s
+default_dt = 1.0*s
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+[pylithapp.eqdeformation.homogeneous.material]
+label = elastic material
+db.iohandler.filename = matprops.spatialdb
+quadrature = pylith.feassemble.quadrature.Quadrature2D
+quadrature.cell.shape = triangle
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2007-03-28 19:17:37 UTC (rev 6448)
@@ -442,36 +442,19 @@
return
- def integrateResidualLumped(residual, fieldInT, fieldInTmdt, coords):
+ def integrateConstant(fieldOut, fieldInT, fieldInTmdt, coords):
"""
Integrate residual term (b) for dynamic elasticity term for 3-D
- finite elemtnts.
+ finite elemnts.
"""
- print "WARNING: IntegratorExplicit::integrateResidualLumped not implemented."
+ print "WARNING: IntegratorExplicit::integrateConstant not implemented."
return
- def integrateResidual(residual, fieldInT, fieldInTmdt, coords):
+ def integrateJacobian(mat, fieldIn, coords):
"""
- Integrate residual term (b) for dynamic elasticity term for 3-D
- finite elemtnts.
- """
- print "WARNING: IntegratorExplicit::integrateResidual not implemented."
- return
-
-
- def integrateJacobianLumped(mat, fieldIn, coords):
- """
Compute matrix (A) associated with operator.
"""
- print "WARNING: IntegratorExplicit::integrateJacobianLumped not implemented."
- return
-
-
- def integrateJacobianField(fieldOut, fieldIn, coords):
- """
- Compute field (A) associated with operator.
- """
print "WARNING: IntegratorExplicit::integrateJacobian not implemented."
return
Modified: short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src 2007-03-28 19:17:37 UTC (rev 6448)
@@ -215,6 +215,7 @@
Constructor.
"""
Material.__init__(self)
+ self.name = "pylith_materials_ElasticMaterial"
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py 2007-03-28 19:17:37 UTC (rev 6448)
@@ -44,8 +44,8 @@
Initialize material properties.
"""
self._info.log("Initializing integrator for material '%s'." % \
- material.matname)
- material.initialize()
+ material.label)
+ material.initialize(mesh)
self.material = material
self.cppHandle.material = self.material.cppHandle
Modified: short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py 2007-03-28 19:17:37 UTC (rev 6448)
@@ -53,27 +53,19 @@
return self.cppHandle.getStableTimeStep()
- def integrateResidual(self,
- residual, fieldInT, fieldInTmdt, coords, lumpJacobian):
+ def integrateConstant(self, fieldOut, fieldInT, fieldInTmdt, coords):
"""
- Integrate residual term for dynamic terms for finite-elements.
+ Integrate constant term for dynamic terms for finite-elements.
"""
- if lumpJacobian:
- self.cppHandle.integrateResidualLumped(residual,
- fieldInT, fieldInTmdt, coords)
- else:
- self.cppHandle.integrateResidual(residual, fieldInT, fieldInTmdt, coords)
+ self.cppHandle.integrateConstant(fieldOut, fieldInT, fieldInTmdt, coords)
return
- def integrateJacobian(self, jacobian, fieldInT, coords, lumpJacobian):
+ def integrateJacobian(self, jacobian, fieldInT, coords):
"""
Integrate Jacobian term for dynamic terms for finite-elements.
"""
- if lumpJacobian:
- self.cppHandle.integrateJacobianLumped(jacobian, fieldInT, coords)
- else:
- self.cppHandle.integrateJacobian(jacobian, fieldInT, coords)
+ self.cppHandle.integrateJacobian(jacobian, fieldInT, coords)
return
Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py 2007-03-28 19:17:37 UTC (rev 6448)
@@ -64,8 +64,8 @@
label = pyre.inventory.str("label", default="")
label.meta['tip'] = "Name of material."
- from spatialdata.spatialdb.SpatialDB import SpatialDB
- db = pyre.inventory.facility("db", factory=SpatialDB,
+ from spatialdata.spatialdb.SimpleDB import SimpleDB
+ db = pyre.inventory.facility("db", factory=SimpleDB,
args=["db"])
db.meta['tip'] = "Database of material property parameters."
Modified: short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2007-03-28 19:17:37 UTC (rev 6448)
@@ -57,6 +57,7 @@
Component.__init__(self, name, facility="mesh_io")
self.cppHandle = None
self.interpolate = False
+ self.coordsys = None
return
@@ -70,6 +71,9 @@
self._sync()
from pylith.topology.Mesh import Mesh
mesh = Mesh()
+ if self.coordsys is None:
+ raise ValueError, "Coordinate system for mesh is unknown."
+ mesh.initialize(self.coordsys)
self.cppHandle.read(mesh.cppHandle)
return mesh
Modified: short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py 2007-03-28 19:17:37 UTC (rev 6448)
@@ -49,6 +49,11 @@
filename = pyre.inventory.str("filename", default="")
filename.meta['tip'] = "Name of mesh file"
+ from spatialdata.geocoords.CSCart import CSCart
+ coordsys = pyre.inventory.facility("coordsys", family="coordsys",
+ factory=CSCart)
+ coordsys.meta['tip'] = "Coordinate system associated with mesh."
+
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -70,6 +75,7 @@
"""
MeshIO._configure(self)
self.filename = self.inventory.filename
+ self.coordsys = self.inventory.coordsys
return
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-03-28 19:17:37 UTC (rev 6448)
@@ -44,19 +44,13 @@
## Python object for managing Explicit facilities and properties.
##
## \b Properties
- ## @li \b lump_jacobian Flag for indicating to use lumped
- ## formulation for Jacobian matrix
+ ## @li None
##
## \b Facilities
## @li None
import pyre.inventory
- lumpJacobian = pyre.inventory.bool("lump_jacobian", default=True)
- lumpJacobian.meta['tip'] = "Flag for indicating to use lumped " \
- "formulation for Jacobian matrix."
-
-
# PUBLIC METHODS /////////////////////////////////////////////////////
def __init__(self, name="explicit"):
@@ -78,7 +72,7 @@
for material in materialsBin.materials:
integrator = ExplicitElasticity()
integrator.initQuadrature(material.quadrature)
- #integrator.initMaterial(mesh, material)
+ integrator.initMaterial(mesh, material)
self.integrators.append(integrator)
return
@@ -124,15 +118,14 @@
Set members based using inventory.
"""
Formulation._configure(self)
- self.lumpJacobian = self.inventory.lumpJacobian
return
- def _calcResidual(self):
+ def _calcConstant(self):
"""
Compute residual, {b(t)}.
"""
- self._info.log("WARNING: Explicit::calcResidual() not implemented.")
+ self._info.log("WARNING: Explicit::calcConstant() not implemented.")
return
Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py 2007-03-28 19:17:37 UTC (rev 6448)
@@ -101,7 +101,6 @@
Component._configure(self)
self.materials = self.inventory.materials
#self.bc = self.inventory.bc
- self.formulation = self.inventory.formulation
return
Modified: short/3D/PyLith/trunk/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-03-28 18:23:26 UTC (rev 6447)
+++ short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-03-28 19:17:37 UTC (rev 6448)
@@ -24,29 +24,6 @@
Python Mesh for finite-element topology information.
"""
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(Component.Inventory):
- """
- Python object for managing Mesh facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing Mesh facilities and properties.
- ##
- ## \b Properties
- ## @li None
- ##
- ## \b Facilities
- ## @li \b coordsys Coordinate system associated with mesh
-
- import pyre.inventory
-
- from spatialdata.geocoords.CSCart import CSCart
- coordsys = pyre.inventory.facility("coordsys", family="coordsys",
- factory=CSCart)
- coordsys.meta['tip'] = "Coordinate system associated with mesh."
-
# PUBLIC METHODS /////////////////////////////////////////////////////
def __init__(self, name="mesh"):
@@ -56,9 +33,18 @@
Component.__init__(self, name, facility="finite_element_mesh")
import pylith.topology.topology as bindings
self.cppHandle = bindings.Mesh()
+ self.coordsys = None
return
+ def initialize(self, coordsys):
+ """
+ Initialize mesh.
+ """
+ self.coordsys = coordsys
+ return
+
+
def distribute(self):
"""
Distribute mesh across processors.
@@ -74,7 +60,6 @@
Set members based using inventory.
"""
Component._configure(self)
- self.coordsys = self.inventory.coordsys
return
More information about the cig-commits
mailing list