[cig-commits] r7053 - in short/3D/PyLith/trunk: pylith/feassemble tests/2d/quad4

brad at geodynamics.org brad at geodynamics.org
Sat Jun 2 20:02:02 PDT 2007


Author: brad
Date: 2007-06-02 20:02:01 -0700 (Sat, 02 Jun 2007)
New Revision: 7053

Added:
   short/3D/PyLith/trunk/tests/2d/quad4/README
   short/3D/PyLith/trunk/tests/2d/quad4/TestAxialPlaneStrain.py
   short/3D/PyLith/trunk/tests/2d/quad4/axialplanestrain.cfg
   short/3D/PyLith/trunk/tests/2d/quad4/bcbox.odb
   short/3D/PyLith/trunk/tests/2d/quad4/box.cub
   short/3D/PyLith/trunk/tests/2d/quad4/box.exo
   short/3D/PyLith/trunk/tests/2d/quad4/dispx.spatialdb
   short/3D/PyLith/trunk/tests/2d/quad4/dispy.spatialdb
   short/3D/PyLith/trunk/tests/2d/quad4/matprops.spatialdb
   short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py
Modified:
   short/3D/PyLith/trunk/pylith/feassemble/FIATLagrange.py
   short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am
Log:
Fixed bugs in FIATLagrange.validateDimension(). Worked on setting up 2-D axial compression test with quad4 cells.

Modified: short/3D/PyLith/trunk/pylith/feassemble/FIATLagrange.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/FIATLagrange.py	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/pylith/feassemble/FIATLagrange.py	2007-06-03 03:02:01 UTC (rev 7053)
@@ -24,10 +24,10 @@
 
 import numpy
 
-def validateDimension(self, dim):
+def validateDimension(dim):
   if dim < 1 or dim > 3:
     raise ValueError("Dimension of Lagrange element must be 1, 2, or 3.")
-  return
+  return dim
 
 # FIATLagrange class
 class FIATLagrange(ReferenceCell):

Modified: short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am	2007-06-03 03:02:01 UTC (rev 7053)
@@ -15,13 +15,33 @@
 check_SCRIPTS = testpylith.py
 
 noinst_PYTHON = \
-	TestAxial.py
+	TestAxialPlaneStrain.py
 
+noinst_DATA = \
+	box.exo \
+	axialplanestrain.cfg \
+	bcbox.odb \
+	dispx.spatialdb \
+	dispy.spatialdb \
+	matprops.spatialdb
 
-CLEANFILES = \
-	output.vtk
+noinst_TMP = \
+	axialplanestrain.vtk
 
+
 TESTS_ENVIRONMENT = $(PYTHON)
 
 
+# 'export' the input files by performing a mock install
+export_datadir = $(top_builddir)/tests/2d/quad4
+export-data: $(noinst_DATA)
+	for f in $(noinst_DATA); do $(install_sh_DATA) $(srcdir)/$$f $(export_datadir); done
+
+BUILT_SOURCES = export-data
+
+CLEANFILES = \
+	$(export_datadir)/$(noinst_DATA) \
+	$(export_datadir)/$(noinst_TMP)
+
+
 # End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/README
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/README	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/README	2007-06-03 03:02:01 UTC (rev 7053)
@@ -0,0 +1,23 @@
+2-D axial compression test with linear quadrilateral cells.
+
+-250 <= x <= +250
+-250 <= y <= +250
+
+
+         -1.0 m
+       ----------
+       |        |
+ 0.0 m |        |
+       |        |
+       |        |
+       ----------
+         +1.0 m
+
+Dirichlet boundary conditions
+  Ux(0,y) = 0.0
+  Uy(x,-250) = +1.0 m
+  Uy(x,+250) = -1.0 m
+
+Analytical solution
+  Ux(x,y) = 0
+  Uy(x,y) = -0.004 * y

Added: short/3D/PyLith/trunk/tests/2d/quad4/TestAxialPlaneStrain.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/TestAxialPlaneStrain.py	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/TestAxialPlaneStrain.py	2007-06-03 03:02:01 UTC (rev 7053)
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/TestAxialPlaneStrain.py
+##
+## @brief Test suite for testing pylith with axial extension in
+## y-direction for 2-D box.
+
+import unittest
+import numpy
+import tables
+
+def run_pylith():
+  """
+  Run pylith.
+  """
+  if not "done" in dir(run_pylith):
+    from pylith.PyLithApp import PyLithApp
+    app = PyLithApp("axialplanestrain")
+    app.run()
+    run_pylith.done = True
+  return
+
+
+class TestAxialPlaneStrain(unittest.TestCase):
+  """
+  Test suite for testing pylith with axial extension in y-direction
+  for 2-D box.
+  """
+
+  def setUp(self):
+    """
+    Setup for test.
+    """
+    run_pylith()
+    return
+
+
+  def test_disp(self):
+    """
+    Check displacement field.
+    """
+    return
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/axialplanestrain.cfg
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/axialplanestrain.cfg	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/axialplanestrain.cfg	2007-06-03 03:02:01 UTC (rev 7053)
@@ -0,0 +1,95 @@
+# -*- Python -*-
+[pylithapp]
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+[pylithapp.journal.info]
+timedependent = 1
+explicit = 1
+implicit = 1
+petsc = 1
+solverlinear = 1
+meshioascii = 1
+homogeneous = 1
+explicitelasticity = 1
+quadrature2d = 1
+fiatlagrange = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+[pylithapp.mesh_generator]
+debug = 1
+importer = pylith.meshio.MeshIOCubit
+
+[pylithapp.mesh_generator.importer]
+filename = box.exo
+coordsys.space_dim = 2
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+total_time = 0.0*s
+default_dt = 1.0*s
+dimension = 2
+formulation = pylith.problems.Implicit
+bc = bcbox
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.materials]
+material = pylith.materials.ElasticPlaneStrain
+
+[pylithapp.timedependent.materials.material]
+label = elastic material
+id = 1
+db.iohandler.filename = matprops.spatialdb
+quadrature = pylith.feassemble.quadrature.Quadrature2D
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 2
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.bc.x_minus]
+fixed_dof = [0]
+id = 10
+label = 10
+db.label = Dirichlet BC -x edge
+db.iohandler.filename = dispx.spatialdb
+
+[pylithapp.timedependent.bc.x_plus]
+fixed_dof = [0]
+id = 11
+label = 11
+db.label = Dirichlet BC +x edge
+db.iohandler.filename = dispx.spatialdb
+
+[pylithapp.timedependent.bc.y_minus]
+fixed_dof = [1]
+id = 13
+label = 13
+db.label = Dirichlet BC -y edge
+db.iohandler.filename = dispy.spatialdb
+
+[pylithapp.timedependent.bc.y_plus]
+fixed_dof = [1]
+id = 12
+label = 12
+db.label = Dirichlet BC +y edge
+db.iohandler.filename = dispy.spatialdb
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[pylithapp.petsc]
+pc_type = jacobi
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+[pylithapp.problem.formulation.output.output]
+filename = axialplanestrain.vtk

Added: short/3D/PyLith/trunk/tests/2d/quad4/bcbox.odb
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/bcbox.odb	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/bcbox.odb	2007-06-03 03:02:01 UTC (rev 7053)
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+from pylith.problems.BoundaryConditions import BoundaryConditions
+
+# BCBox class
+class BCBox(BoundaryConditions):
+  """
+  Python boundary conditions container for box with four boundary conditions.
+
+  Factory: boundary_conditions
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(BoundaryConditions.Inventory):
+    """
+    Python object for managing BCBox facilities and properties.
+    """
+    
+    ## @class Inventory
+    ## Python object for managing BCBox facilities and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li \b bc Boundary condition.
+
+    import pyre.inventory
+    
+    from pylith.bc.Dirichlet import Dirichlet
+
+    xm = pyre.inventory.facility("x_minus", family="boundary_condition",
+                                 factory=Dirichlet)
+    xm.meta['tip'] = "Boundary condition on -x edge."
+
+    xp = pyre.inventory.facility("x_plus", family="boundary_condition",
+                                 factory=Dirichlet)
+    xp.meta['tip'] = "Boundary condition on +x edge."
+
+    ym = pyre.inventory.facility("y_minus", family="boundary_condition",
+                                 factory=Dirichlet)
+    ym.meta['tip'] = "Boundary condition on -y edge."
+
+    yp = pyre.inventory.facility("y_plus", family="boundary_condition",
+                                 factory=Dirichlet)
+    yp.meta['tip'] = "Boundary condition on +y edge."
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="bcbox"):
+    """
+    Constructor.
+    """
+    BoundaryConditions.__init__(self, name)
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set attributes from inventory.
+    """
+    BoundaryConditions._configure(self)
+    self.bc = [self.inventory.xm,
+               self.inventory.xp,
+               self.inventory.ym,
+               self.inventory.yp]
+    return
+
+  
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def boundary_conditions():
+  """
+  Factory associated with BCBox.
+  """
+  return BCBox()
+
+
+# End of file 

Added: short/3D/PyLith/trunk/tests/2d/quad4/box.cub
===================================================================
(Binary files differ)


Property changes on: short/3D/PyLith/trunk/tests/2d/quad4/box.cub
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: short/3D/PyLith/trunk/tests/2d/quad4/box.exo
===================================================================
(Binary files differ)


Property changes on: short/3D/PyLith/trunk/tests/2d/quad4/box.exo
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: short/3D/PyLith/trunk/tests/2d/quad4/dispx.spatialdb
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/dispx.spatialdb	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/dispx.spatialdb	2007-06-03 03:02:01 UTC (rev 7053)
@@ -0,0 +1,15 @@
+#SPATIAL.ascii 1
+SimpleDB {
+  num-values = 1
+  value-names =  dof-0
+  value-units =  m
+  num-locs = 2
+  data-dim = 1
+  space-dim = 2
+  cs-data = cartesian {
+    to-meters = 1.0
+    space-dim = 2
+  }
+}
+-250.0  0.0    0.0
++250.0  0.0    0.0

Added: short/3D/PyLith/trunk/tests/2d/quad4/dispy.spatialdb
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/dispy.spatialdb	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/dispy.spatialdb	2007-06-03 03:02:01 UTC (rev 7053)
@@ -0,0 +1,15 @@
+#SPATIAL.ascii 1
+SimpleDB {
+  num-values = 1
+  value-names =  dof-1
+  value-units =  m
+  num-locs = 2
+  data-dim = 1
+  space-dim = 2
+  cs-data = cartesian {
+    to-meters = 1.0
+    space-dim = 2
+  }
+}
+0.0  -250.0   +1.0
+0.0  +250.0   -1.0

Added: short/3D/PyLith/trunk/tests/2d/quad4/matprops.spatialdb
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/matprops.spatialdb	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/matprops.spatialdb	2007-06-03 03:02:01 UTC (rev 7053)
@@ -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  5291.502622129181

Added: short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py	2007-06-03 02:12:49 UTC (rev 7052)
+++ short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py	2007-06-03 03:02:01 UTC (rev 7053)
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+__requires__ = "PyLith"
+
+import unittest
+
+def suite():
+  """
+  Create test suite.
+  """
+  suite = unittest.TestSuite()
+
+  from TestAxialPlaneStrain import TestAxialPlaneStrain
+  suite.addTest(unittest.makeSuite(TestAxialPlaneStrain))
+
+  return suite
+
+
+def main():
+  """
+  Run test suite.
+  """
+  unittest.TextTestRunner(verbosity=2).run(suite())
+  return
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+  main()
+
+  
+# End of file 


Property changes on: short/3D/PyLith/trunk/tests/2d/quad4/testpylith.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the cig-commits mailing list