[cig-commits] r20940 - short/3D/PyLith/trunk/tests_auto/1d/line2

brad at geodynamics.org brad at geodynamics.org
Fri Oct 26 09:47:30 PDT 2012


Author: brad
Date: 2012-10-26 09:47:30 -0700 (Fri, 26 Oct 2012)
New Revision: 20940

Added:
   short/3D/PyLith/trunk/tests_auto/1d/line2/TestExtensionDispParallel.py
   short/3D/PyLith/trunk/tests_auto/1d/line2/extensiondisp_np2.cfg
Modified:
   short/3D/PyLith/trunk/tests_auto/1d/line2/Makefile.am
   short/3D/PyLith/trunk/tests_auto/1d/line2/extensiondisp.cfg
   short/3D/PyLith/trunk/tests_auto/1d/line2/testpylith.py
Log:
Added parallel full-scale automated test.

Modified: short/3D/PyLith/trunk/tests_auto/1d/line2/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/tests_auto/1d/line2/Makefile.am	2012-10-26 12:01:58 UTC (rev 20939)
+++ short/3D/PyLith/trunk/tests_auto/1d/line2/Makefile.am	2012-10-26 16:47:30 UTC (rev 20940)
@@ -23,6 +23,7 @@
 dist_noinst_PYTHON = \
 	TestLine2.py \
 	TestExtensionDisp.py \
+	TestExtensionDispParallel.py \
 	TestExtensionForce.py \
 	TestDislocation.py \
 	testpylith.py
@@ -31,6 +32,7 @@
 	bar.mesh \
 	matprops.spatialdb \
 	extensiondisp.cfg \
+	extensiondisp_np2.cfg \
 	extensiondisp_disp.spatialdb \
 	extensionforce.cfg \
 	extensionforce_force.spatialdb \
@@ -43,6 +45,9 @@
 	extensiondisp_t0000000.vtk \
 	extensiondisp-elastic_info.vtk \
 	extensiondisp-elastic_t0000000.vtk \
+	extensiondisp_np2_t0000000.vtk \
+	extensiondisp_np2-elastic_info.vtk \
+	extensiondisp_np2-elastic_t0000000.vtk \
 	extensionforce_t0000000.vtk \
 	extensionforce-elastic_info.vtk \
 	extensionforce-elastic_t0000000.vtk \

Added: short/3D/PyLith/trunk/tests_auto/1d/line2/TestExtensionDispParallel.py
===================================================================
--- short/3D/PyLith/trunk/tests_auto/1d/line2/TestExtensionDispParallel.py	                        (rev 0)
+++ short/3D/PyLith/trunk/tests_auto/1d/line2/TestExtensionDispParallel.py	2012-10-26 16:47:30 UTC (rev 20940)
@@ -0,0 +1,96 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2012 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/1d/line2/TestExtensionDispParallel.py
+##
+## @brief Test suite for testing pylith with 1-D axial extension.
+
+import numpy
+
+from TestLine2 import TestLine2
+
+
+# Local version of PyLithApp
+from pylith.apps.PyLithApp import PyLithApp
+class AxialApp(PyLithApp):
+  def __init__(self):
+    PyLithApp.__init__(self, name="extensiondisp_np2")
+    return
+
+
+# Helper function to run PyLith
+def run_pylith():
+  """
+  Run pylith.
+  """
+  if not "done" in dir(run_pylith):
+    app = AxialApp()
+    app.run()
+    run_pylith.done = True
+  return
+
+
+class TestExtensionDispParallel(TestLine2):
+  """
+  Test suite for testing pylith with 1-D axial extension.
+  """
+
+  def setUp(self):
+    """
+    Setup for test.
+    """
+    TestLine2.setUp(self)
+    run_pylith()
+    self.outputRoot = "extensiondisp_np2"
+    return
+
+
+  def calcDisplacements(self, vertices):
+    """
+    Calculate displacement field given coordinates of vertices.
+    """
+    nvertices = self.mesh['nvertices']
+    spaceDim = self.mesh['spaceDim']    
+    disp = numpy.zeros( (1,nvertices,spaceDim), dtype=numpy.float64)
+    disp[0,:,0] = -0.2 + 0.1 * vertices[:,0]
+
+    return disp
+
+
+  def calcStateVar(self, name, vertices, cells):
+    """
+    Calculate state variable.
+    """
+    exx = 0.1
+
+    ncells = self.mesh['ncells']
+    tensorSize = self.mesh['tensorSize']
+
+    if name == "total_strain":
+      stateVar = exx*numpy.ones( (1, ncells, tensorSize), dtype=numpy.float64)
+    
+    elif name == "stress":
+      lp2m = self.density*self.vp**2
+      stateVar = lp2m*exx * numpy.ones( (1, ncells, tensorSize), dtype=numpy.float64)
+    else:
+      raise ValueError("Unknown state variable '%s'." % name)
+
+    return stateVar
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/tests_auto/1d/line2/extensiondisp.cfg
===================================================================
--- short/3D/PyLith/trunk/tests_auto/1d/line2/extensiondisp.cfg	2012-10-26 12:01:58 UTC (rev 20939)
+++ short/3D/PyLith/trunk/tests_auto/1d/line2/extensiondisp.cfg	2012-10-26 16:47:30 UTC (rev 20940)
@@ -1,4 +1,5 @@
 [extensiondisp]
+nodes = 1
 
 [extensiondisp.launcher] # WARNING: THIS IS NOT PORTABLE
 command = mpirun -np ${nodes}

Added: short/3D/PyLith/trunk/tests_auto/1d/line2/extensiondisp_np2.cfg
===================================================================
--- short/3D/PyLith/trunk/tests_auto/1d/line2/extensiondisp_np2.cfg	                        (rev 0)
+++ short/3D/PyLith/trunk/tests_auto/1d/line2/extensiondisp_np2.cfg	2012-10-26 16:47:30 UTC (rev 20940)
@@ -0,0 +1,96 @@
+[extensiondisp_np2]
+nodes = 2
+
+[extensiondisp_np2.launcher] # WARNING: THIS IS NOT PORTABLE
+command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+[extensiondisp_np2.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solverlinear = 1
+#meshioascii = 1
+#implicitelasticity = 1
+#quadrature = 1
+#fiatsimplex = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+[extensiondisp_np2.mesh_generator]
+#debug = 1
+
+[extensiondisp_np2.mesh_generator.reader]
+filename = bar.mesh
+coordsys.space_dim = 1
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+[extensiondisp_np2.timedependent]
+dimension = 1
+bc = [bc]
+
+#formulation.solver = pylith.problems.SolverNonlinear
+
+[extensiondisp_np2.timedependent.formulation.time_step]
+total_time = 0.0*s
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+[extensiondisp_np2.timedependent]
+materials = [elastic]
+materials.elastic = pylith.materials.ElasticStrain1D
+
+[extensiondisp_np2.timedependent.materials.elastic]
+label = Elastic material
+id = 1
+db_properties.label = Elastic properties
+db_properties.iohandler.filename = matprops.spatialdb
+quadrature.cell.dimension = 1
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+[extensiondisp_np2.timedependent.bc.bc]
+bc_dof = [0]
+label = end points
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC
+db_initial.iohandler.filename = extensiondisp_disp.spatialdb
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[extensiondisp_np2.petsc]
+ksp_rtol = 1.0e-8
+pc_type = asm
+
+# Change the preconditioner settings.
+sub_pc_factor_shift_type = none
+
+ksp_max_it = 100
+ksp_gmres_restart = 50
+
+#ksp_monitor = true
+#ksp_view = true
+#snes_monitor = true
+#snes_view = true
+#log_summary = true
+#start_in_debugger = true
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+[extensiondisp_np2.problem.formulation.output.output]
+writer = pylith.meshio.DataWriterHDF5Mesh
+writer.filename = extensiondisp_np2.h5
+
+[extensiondisp_np2.timedependent.materials.elastic.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer = pylith.meshio.DataWriterHDF5Mesh
+writer.filename = extensiondisp_np2-elastic.h5

Modified: short/3D/PyLith/trunk/tests_auto/1d/line2/testpylith.py
===================================================================
--- short/3D/PyLith/trunk/tests_auto/1d/line2/testpylith.py	2012-10-26 12:01:58 UTC (rev 20939)
+++ short/3D/PyLith/trunk/tests_auto/1d/line2/testpylith.py	2012-10-26 16:47:30 UTC (rev 20940)
@@ -29,6 +29,9 @@
   from TestExtensionDisp import TestExtensionDisp
   suite.addTest(unittest.makeSuite(TestExtensionDisp))
 
+  from TestExtensionDispParallel import TestExtensionDispParallel
+  suite.addTest(unittest.makeSuite(TestExtensionDispParallel))
+
   from TestExtensionForce import TestExtensionForce
   suite.addTest(unittest.makeSuite(TestExtensionForce))
 



More information about the CIG-COMMITS mailing list