[cig-commits] r17075 - short/3D/PyLith/trunk/examples/greensfns/hex8

willic3 at geodynamics.org willic3 at geodynamics.org
Tue Aug 10 00:06:34 PDT 2010


Author: willic3
Date: 2010-08-10 00:06:34 -0700 (Tue, 10 Aug 2010)
New Revision: 17075

Added:
   short/3D/PyLith/trunk/examples/greensfns/hex8/finalslip.spatialdb
   short/3D/PyLith/trunk/examples/greensfns/hex8/gfgen.cfg
   short/3D/PyLith/trunk/examples/greensfns/hex8/gfoutput.cfg
   short/3D/PyLith/trunk/examples/greensfns/hex8/initial-run.cfg
Removed:
   short/3D/PyLith/trunk/examples/greensfns/hex8/gftest.cfg
Modified:
   short/3D/PyLith/trunk/examples/greensfns/hex8/Makefile.am
   short/3D/PyLith/trunk/examples/greensfns/hex8/README
   short/3D/PyLith/trunk/examples/greensfns/hex8/box_hex8_1000m.exo
   short/3D/PyLith/trunk/examples/greensfns/hex8/gfgen.py
   short/3D/PyLith/trunk/examples/greensfns/hex8/mesh_hex8_1000m.jou
   short/3D/PyLith/trunk/examples/greensfns/hex8/pylithapp.cfg
Log:
Completely reworked Green's function examples to include usage of new
gfgen.py application, which now generates the spatialdb and .cfg files
needed to create the Green's functions.



Modified: short/3D/PyLith/trunk/examples/greensfns/hex8/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/Makefile.am	2010-08-10 03:09:40 UTC (rev 17074)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/Makefile.am	2010-08-10 07:06:34 UTC (rev 17075)
@@ -15,29 +15,20 @@
 	geometry.jou \
 	mesh_hex8_1000m.jou \
 	box_hex8_1000m.exo \
+	finalslip.spatialdb \
+	gfgen.cfg \
+	gfgen.py \
+	gfoutput.cfg \
 	pylithapp.cfg \
-	gftest.cfg \
+	initial-run.cfg \
 	mat_elastic.spatialdb \
-	sliptime.spatialdb \
-	gfspatialdb/gfimpulse00.spatialdb \
-	gfspatialdb/gfimpulse01.spatialdb \
-	gfspatialdb/gfimpulse02.spatialdb \
-	gfspatialdb/gfimpulse03.spatialdb \
-	gfspatialdb/gfimpulse04.spatialdb \
-	gfspatialdb/gfimpulse05.spatialdb \
-	gfspatialdb/gfimpulse06.spatialdb \
-	gfspatialdb/gfimpulse07.spatialdb \
-	gfspatialdb/gfimpulse08.spatialdb \
-	gfspatialdb/gfimpulse09.spatialdb \
-	gfspatialdb/gfimpulse10.spatialdb \
-	gfspatialdb/gfimpulse11.spatialdb \
-	gfspatialdb/gfimpulse12.spatialdb \
-	gfspatialdb/gfimpulse13.spatialdb
+	sliptime.spatialdb
 
 
 SUBDIRS = \
 	gfimpulses \
-	gfresponses
+	gfresponses \
+	gfspatialdb
 
 
 # End of file 

Modified: short/3D/PyLith/trunk/examples/greensfns/hex8/README
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/README	2010-08-10 03:09:40 UTC (rev 17074)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/README	2010-08-10 07:06:34 UTC (rev 17075)
@@ -1,21 +1,38 @@
-In this directory are files that allow a somewhat kludgy method of
-generating Green's functions using PyLith. The impulses are unit amounts of
+In this directory are files that allow a primitive method of generating
+Green's functions using PyLith.  The impulses are specified amounts of
 strike-slip applied on the vertices of a fault, and the responses are
 displacements at the vertices on the ground surface. The method used is as
 follows:
 
 The entire problem is treated as a time-dependent elastic problem with
-time-varying slip. At each time step, a unit slip is applied for the
+time-varying slip. At each time step, a specified slip is applied for the
 desired impulse. For time step zero, this is all that needs to be done.
 For subsequent time steps, it is necessary to remove the applied impulse
 from the previous step. This is done by applying a unit negative impulse.
 It is necessary to generate a sequence of spatial databases to specify the
-slip at each time step. These are contained in the directory gfspatialdb.
+slip at each time step. A Python application has been provided that
+generates these spatial databases, as well as a .cfg file to be used by
+PyLith and a file describing the impulses (metadata).
 
-To run the problem, simpyly type:
+Before the impulses can be generated, we first require a .vtk file
+containing fault information.  There are thus three steps required to
+generate the Green's functions:
 
-pylith gftest.cfg
+1.  Run PyLith once to generate the fault information file
+(gftest-initial-fault_info.vtk).  This may be done as follows:
+pylith initial-run.cfg
 
+2.  Edit the gfgen.cfg file as needed to provide the parameters for
+gfgen.py, then simply run gfgen.py:
+./gfgen.py
+
+3.  Finally, run PyLith again using the generated gftest.cfg file along
+with the spatial databases in gfspatialdb:
+pylith gftest.cfg gfoutput.cfg
+
+The gfoutput.cfg file simply contains output information, so that the
+impulse and response files end up in gfimpulses and gfresponses.
+
 When it has finished running, you will have a number of VTK files in the
 gfimpulses directory that show what the applied fault slip was for each
 time step. In the gfresponses directory you will have all of the resulting

Modified: short/3D/PyLith/trunk/examples/greensfns/hex8/box_hex8_1000m.exo
===================================================================
(Binary files differ)

Added: short/3D/PyLith/trunk/examples/greensfns/hex8/finalslip.spatialdb
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/finalslip.spatialdb	                        (rev 0)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/finalslip.spatialdb	2010-08-10 07:06:34 UTC (rev 17075)
@@ -0,0 +1,31 @@
+// -*- C++ -*- (tell Emacs to use C++ mode for syntax highlighting)
+//
+// This spatial database specifies the distribution of slip on the
+// fault surface. In this case we prescribe a piecewise linear, depth
+// dependent distribution of slip. The slip is 2.0 m left-lateral
+// with 0.25 m of reverse slip at the surface with a linear taper from
+// 2.0 m to 0.0 m from -2 km to -4 km.
+//
+#SPATIAL.ascii 1
+SimpleDB {
+  num-values = 3
+  value-names =  left-lateral-slip  reverse-slip  fault-opening
+  value-units =  m  m  m
+  num-locs = 3
+  data-dim = 1 // Locations of data points form a line.
+  space-dim = 3
+  cs-data = cartesian {
+    to-meters = 1.0e+3 // Specify coordinates in km for convenience.
+    space-dim = 3
+  } // cs-data
+} // SimpleDB
+// Columns are
+// (1) x coordinate (km)
+// (2) y coordinate (km)
+// (3) z coordinate (km)
+// (4) left-lateral-slip (m) (right-lateral is negative)
+// (5) reverse-slip (m)
+// (6) fault-opening (m)
+0.0  0.0  0.0     2.00  0.25  0.00
+0.0  0.0 -2.0     2.00  0.00  0.00
+0.0  0.0 -4.0     0.00  0.00  0.00

Added: short/3D/PyLith/trunk/examples/greensfns/hex8/gfgen.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/gfgen.cfg	                        (rev 0)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/gfgen.cfg	2010-08-10 07:06:34 UTC (rev 17075)
@@ -0,0 +1,15 @@
+# -*- Python -*-
+[gfgen]
+
+# Configuration file for gfgen.py application.
+# The application sets up impulses for generating Green's functions using
+# PyLith.
+
+fault_info_file = gftest-initial-fault_info.vtk
+spatialdb_output_root = gfspatialdb/gfimpulse
+slip_time_spatialdb = sliptime.spatialdb
+metadata_output_file = gftest-metadata.txt
+config_output_file = gftest.cfg
+impulse_type = left-lateral-slip
+impulse_value = 1.0*cm
+impulse_number_width = 4

Modified: short/3D/PyLith/trunk/examples/greensfns/hex8/gfgen.py
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/gfgen.py	2010-08-10 03:09:40 UTC (rev 17074)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/gfgen.py	2010-08-10 07:06:34 UTC (rev 17075)
@@ -23,7 +23,10 @@
 import re
 import glob
 from pyre.units.time import s
+from pyre.units.length import m
 
+from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
+from spatialdata.geocoords.CSCart import CSCart
 from pyre.applications.Script import Script as Application
 
 class GfGen(Application):
@@ -45,15 +48,15 @@
     ## \b Properties
     ## @li \b fault_info_file  Name of VTK file containing fault info.
     ## @li \b spatialdb_output_root Root name for output spatialdb files.
+    ## @li \b slip_time_spatialdb Name of spatialdb file containing slip times.
     ## @li \b metadata_output_file Name of output file containing metadata.
-    ## @li \b response_output_root Root name for files containing responses.
+    ## @li \b config_output_file Name of .cfg output file.
     ## @li \b impulse_type Type of impulse to be applied.
     ## @li \b impulse_value Amount of impulse to apply.
-    ## @li \b timestamp_width Width of timestamp field.
+    ## @li \b impulse_number_width Width of impulse number field.
     ##
     ## \b Facilities
     ## @li \b geometry  Geometry for output database.
-    ## @li \b iohandler  Object for writing database.
 
     import pyre.inventory
 
@@ -65,13 +68,17 @@
                                              default="impulse.spatialdb")
     spatialdbOutputRoot.meta['tip'] = "Root name for output spatialdb files."
 
+    slipTimeSpatialdb = pyre.inventory.str("slip_time_spatialdb",
+                                             default="sliptime.spatialdb")
+    slipTimeSpatialdb.meta['tip'] = "Name of spatialdb file containing slip times."
+
     metadataOutputFile = pyre.inventory.str("metadata_output_file",
                                        default="impulse_description.txt")
     metadataOutputFile.meta['tip'] = "Name of output file containing metadata."
 
-    responseOutputRoot = pyre.inventory.str("response_output_root",
-                                            default="response.vtk")
-    responseOutputRoot.meta['tip'] = "Root name for files containing responses."
+    configOutputFile = pyre.inventory.str("config_output_file",
+                                          default="greenfn.cfg")
+    configOutputFile.meta['tip'] = "Name of .cfg output file."
 
     impulseType = pyre.inventory.str("impulse_type",
                                      default="left-lateral-slip",
@@ -82,19 +89,14 @@
     impulseValue = pyre.inventory.dimensional("impulse_value", default=1.0*m)
     impulseValue.meta['tip'] = "Impulse value."
 
-    timestampWidth = pyre.inventory.int("timestamp_width", default=4)
-    timestampWidth.meta['tip'] = "Width of timestamp field in spatialdb files."
+    impulseNumberWidth = pyre.inventory.int("impulse_number_width", default=4)
+    impulseNumberWidth.meta['tip'] = "Width of impulse number field."
 
     from spatialdata.spatialdb.generator.Geometry import Geometry
     geometry = pyre.inventory.facility("geometry", family="geometry",
                                        factory=Geometry)
     geometry.meta['tip'] = "Geometry for output database."
 
-    from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
-    iohandler = pyre.inventory.facility("iohandler", family="simpledb_io",
-                                        factory=SimplIOAscii)
-    iohandler.meta['tip'] = "Object for writing database."
-    
   
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
@@ -107,8 +109,9 @@
     self.cellType = ""
 
     self.faultCoords = None
-    self.faultNormals = None
-    self.integratedSlip = None
+    self.normalDir = None
+    self.strikeDir = None
+    self.dipDir = None
 
     return
 
@@ -136,17 +139,17 @@
     # File info.
     self.faultInfoFile = self.inventory.faultInfoFile
     self.spatialdbOutputRoot = self.inventory.spatialdbOutputRoot
+    self.slipTimeSpatialdb = self.inventory.slipTimeSpatialdb
     self.metadataOutputFile = self.inventory.metadataOutputFile
-    self.responseOutputRoot = self.inventory.responseOutputRoot
+    self.configOutputFile = self.inventory.configOutputFile
 
     # Impulse information
     self.impulseType = self.inventory.impulseType
     self.impulseValue = self.inventory.impulseValue.value
-    self.timestampWidth = self.inventory.timestampWidth
+    self.impulseNumberWidth = self.inventory.impulseNumberWidth
 
     # Spatialdb output facilities
     self.geometry = self.inventory.geometry
-    self.iohandler = self.inventory.iohandler
 
     return
       
@@ -176,8 +179,11 @@
     for vertDataArray in range(numVertDataArrays):
       arrayName = vertData.get_array_name(vertDataArray)
       if (arrayName == "normal_dir"):
-        self.faultNormals = vertData.get_array(vertDataArray).to_array()
-        break
+        self.normalDir = vertData.get_array(vertDataArray).to_array()
+      elif (arrayName == "strike_dir"):
+        self.strikeDir = vertData.get_array(vertDataArray).to_array()
+      elif (arrayName == "dip_dir"):
+        self.dipDir = vertData.get_array(vertDataArray).to_array()
 
     return
 
@@ -219,19 +225,25 @@
 
     # Create root output filename.
     suffIndex = self.spatialdbOutputRoot.rfind(".spatialdb")
-    if (suffIndex == -1):
-      outputRoot = self.spatialdbOutputRoot
-    else:
+    outputRoot = self.spatialdbOutputRoot
+    if (suffIndex != -1):
       outputRoot = self.spatialdbOutputRoot[:suffIndex - 1]
+
+    # Set up coordinate system.
+    # cs = self.geometry.coordsys()
+    # cs.initialize()
+    dataDim = self.spaceDim - 1
     
     # Loop over impulses to generate and modify the appropriate entries.
     for impulse in range(self.numFaultVertices):
 
       # Set filename
       impulseNum = int(impulse)
-      impulseString = repr(impulseNum).rjust(self.timestampWidth, '0')
+      impulseString = repr(impulseNum).rjust(self.impulseNumberWidth, '0')
       filename = outputRoot + "_i" + impulseString + ".spatialdb"
-      self.iohandler.filename = filename
+      writer = SimpleIOAscii()
+      writer.inventory.filename = filename
+      writer._configure()
 
       # Modify database values.
       array1[impulse] = self.impulseValue
@@ -246,106 +258,118 @@
       if (self.spaceDim == 2):
         data = {'points': self.faultVertices,
                 'coordsys': self.geometry.coordsys,
-                'data_dim': self.geometry.dataDim,
+                'data_dim': dataDim,
                 'values': [info1, info2]}
       else:
         data = {'points': self.faultVertices,
                 'coordsys': self.geometry.coordsys,
-                'data_dim': self.geometry.dataDim,
+                'data_dim': dataDim,
                 'values': [info1, info2, info3]}
 
-      self.iohandler.write(data)
+      writer.write(data)
 
     return
 
     
-  def _getGfGen(self):
+  def _makeConfig(self):
     """
-    Function to loop over integration points and compute principal axes for
-    each point.
+    Function to create .cfg file for creating Green's functions.
     """
-    # Create empty arrays for each principal axis and eigenvalue.
-    self.minPrincAxis = numpy.empty((self.numTensorPoints, self.spaceDim),
-                                    dtype=numpy.float64)
-    self.intPrincAxis = numpy.empty((self.numTensorPoints, self.spaceDim),
-                                    dtype=numpy.float64)
-    self.maxPrincAxis = numpy.empty((self.numTensorPoints, self.spaceDim),
-                                    dtype=numpy.float64)
-    self.minEigenValue = numpy.empty(self.numTensorPoints, dtype=numpy.float64)
-    self.intEigenValue = numpy.empty(self.numTensorPoints, dtype=numpy.float64)
-    self.maxEigenValue = numpy.empty(self.numTensorPoints, dtype=numpy.float64)
-    # Loop over integration points.
-    for point in xrange(self.numTensorPoints):
-      tensor = self.tensorSorted[point, :]
-      tensorOrdered, eigenValuesOrdered = self._compGfGen(tensor)
-      self.minPrincAxis[point,:] = tensorOrdered[0]
-      self.intPrincAxis[point,:] = tensorOrdered[1]
-      self.maxPrincAxis[point,:] = tensorOrdered[2]
-      self.minEigenValue[point] = eigenValuesOrdered[0]
-      self.intEigenValue[point] = eigenValuesOrdered[1]
-      self.maxEigenValue[point] = eigenValuesOrdered[2]
+    f = open(self.configOutputFile, 'w')
+    newLine = "\n"
 
+    # Write top-level header
+    topHeader = "# -*- Python -*-" + newLine + "[pylithapp]" + newLine + newLine
+    f.write(topHeader)
+    
+    # Write time step information
+    totalTime = "total_time = " + repr(float(self.numFaultVertices - 1)) + \
+                "*year" + newLine
+    dt  = "dt = 1.0*year" + newLine
+    divider = "# ----------------------------------------------------------" + \
+              newLine
+    problem = divider + "# problem" + newLine + divider + \
+              "[pylithapp.timedependent.implicit.time_step]" + newLine + \
+              totalTime + dt
+    f.write(problem)
+    faults = divider + "# faults" + newLine + divider + \
+             "[pylithapp.timedependent.interfaces.fault]" + newLine
+    f.write(newLine)
+    f.write(faults)
+    eqSrcs = "eq_srcs = ["
+    f.write(eqSrcs)
+    comma = ","
+
+    # Write eq_srcs list.
+    for impulse in range(self.numFaultVertices):
+      srcName = repr(impulse).rjust(self.impulseNumberWidth, '0')
+      f.write(srcName)
+      if (impulse != self.numFaultVertices - 1):
+        f.write(comma)
+
+    srcEnd = "]" + newLine
+    f.write(srcEnd)
+
+    # Base strings for eq_src info.
+    baseHeader = "[pylithapp.timedependent.interfaces.fault.eq_srcs."
+    baseOrigin = "origin_time = "
+    suffIndex = self.spatialdbOutputRoot.rfind(".spatialdb")
+    slipRoot = self.spatialdbOutputRoot
+    if (suffIndex != -1):
+      slipRoot = self.spatialdbOutputRoot[:suffIndex - 1]
+    baseSlip = "slip_function.slip.iohandler.filename = " + slipRoot + "_i"
+    slipTime = "slip_function.slip_time.iohandler.filename = " + \
+               self.slipTimeSpatialdb + newLine
+
+    # Write info for each eq_src.
+    for impulse in range(self.numFaultVertices):
+      f.write(newLine)
+      srcName = repr(impulse).rjust(self.impulseNumberWidth, '0')
+      originTime = float(impulse)
+      originString = str(originTime) + "*year\n"
+      f.write(baseHeader + srcName + "]\n")
+      f.write(baseOrigin + originString)
+      f.write(baseSlip + srcName + ".spatialdb\n")
+      f.write(slipTime)
+
+    f.close()
+    
     return
   
 
-  def _compGfGen(self, tensor):
+  def _makeMetadata(self):
     """
-    Function to compute 3D principal axes, sort them, and multiply by
-    corresponding eigenvalue.
+    Function to write out metadata file containing information for each
+    impulse.
     """
-    tensorMat = numpy.array([(tensor[0], tensor[3], tensor[5]),
-                             (tensor[3], tensor[1], tensor[4]),
-                             (tensor[5], tensor[4], tensor[2])],
-                            dtype=numpy.float64)
-    (eigenValue, princAxes) = numpy.linalg.eigh(tensorMat)
-    idx = eigenValue.argsort()
-    eigenValuesOrdered = eigenValue[idx]
-    princAxesOrdered = princAxes[:,idx]
-    tensorOrdered = numpy.empty_like(princAxesOrdered)
-    tensorOrdered[0,:] = eigenValuesOrdered[0] * princAxesOrdered[0,:]
-    tensorOrdered[1,:] = eigenValuesOrdered[1] * princAxesOrdered[1,:]
-    tensorOrdered[2,:] = eigenValuesOrdered[2] * princAxesOrdered[2,:]
-    return tensorOrdered, eigenValuesOrdered
-  
+    f = open(self.metadataOutputFile, 'w')
+    tab = "\t"
+    newLine = "\n"
+    header = "Impulse #" + tab + "X-Coord" + tab + "Y-Coord" + tab + \
+             "Z-Coord" + tab + "Normal-X" + tab + "Normal-Y" + tab + \
+             "Normal-Z" + tab + "Strike-X" + tab + "Strike-Y" + tab + \
+             "Strike-Z" + tab + "Dip-X" + tab + "Dip-Y" + tab + "Dip-Z" \
+             + newLine
+    f.write(header)
+    for impulse in range(self.numFaultVertices):
+      x = str(self.faultVertices[impulse, 0]) + tab
+      y = str(self.faultVertices[impulse, 1]) + tab
+      z = str(self.faultVertices[impulse, 2]) + tab
+      xNorm = str(self.normalDir[impulse, 0]) + tab
+      yNorm = str(self.normalDir[impulse, 1]) + tab
+      zNorm = str(self.normalDir[impulse, 2]) + tab
+      xStrike = str(self.strikeDir[impulse, 0]) + tab
+      yStrike = str(self.strikeDir[impulse, 1]) + tab
+      zStrike = str(self.strikeDir[impulse, 2]) + tab
+      xDip = str(self.dipDir[impulse, 0]) + tab
+      yDip = str(self.dipDir[impulse, 1]) + tab
+      zDip = str(self.dipDir[impulse, 2]) + newLine
+      outLine = str(impulse) + tab + x + y + z + xNorm + yNorm + zNorm + \
+                xStrike + yStrike + zStrike + xDip + yDip + zDip
+      f.write(outLine)
 
-  def _writeVtkFile(self):
-    """
-    Function to write out vertex and cell info along with principal axes
-    computed as vectors.
-    """
-    from enthought.tvtk.api import tvtk
+    f.close()
 
-    # Set up mesh info for VTK file.
-    mesh = tvtk.UnstructuredGrid(points=self.vertArray)
-    mesh.set_cells(self.cellType, self.cells)
-
-    # Add scalar fields.
-    minEigenName = "min_eigenvalue"
-    intEigenName = "int_eigenvalue"
-    maxEigenName = "max_eigenvalue"
-    mesh.cell_data.scalars = self.minEigenValue
-    mesh.cell_data.scalars.name = minEigenName
-    s2 = mesh.cell_data.add_array(self.intEigenValue)
-    mesh.cell_data.get_array(s2).name = intEigenName
-    s3 = mesh.cell_data.add_array(self.maxEigenValue)
-    mesh.cell_data.get_array(s3).name = maxEigenName
-    mesh.update()
-
-    # Add vector fields and write VTK file
-    minAxisName = "min_principal_axis"
-    intAxisName = "int_principal_axis"
-    maxAxisName = "max_principal_axis"
-    mesh.cell_data.vectors = self.minPrincAxis
-    mesh.cell_data.vectors.name = minAxisName
-    v2 = mesh.cell_data.add_array(self.intPrincAxis)
-    mesh.cell_data.get_array(v2).name = intAxisName
-    v3 = mesh.cell_data.add_array(self.maxPrincAxis)
-    mesh.cell_data.get_array(v3).name = maxAxisName
-    mesh.update()
-    w = tvtk.UnstructuredGridWriter(file_name=self.vtkOutputFile,
-		    input=mesh)
-    w.write()
-
     return
   
 

Added: short/3D/PyLith/trunk/examples/greensfns/hex8/gfoutput.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/gfoutput.cfg	                        (rev 0)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/gfoutput.cfg	2010-08-10 07:06:34 UTC (rev 17075)
@@ -0,0 +1,52 @@
+# -*- Python -*-
+[pylithapp]
+
+# This is not a self-contained simulation configuration file. This
+# file only specifies output information for Green's function impulses
+# and responses. Additional information is contained in pylithapp.cfg,
+# which is read by default, and in gftest.cfg, which is created by the
+# gfgen.py application.
+#
+# To generate Green's functions:
+# pylith gftest.cfg gfoutput.cfg
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+# Give basename for VTK domain output of solution over domain.
+[pylithapp.problem.formulation.output.domain]
+skip = 2000
+writer.filename = gftest.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year
+
+# Give basename for VTK domain output of solution over ground surface.
+[pylithapp.problem.formulation.output.subdomain]
+label = face_zpos ; nodeset for subdomain
+skip = 0
+writer.filename = gfresponses/gfresponse.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year
+
+# Give basename for vtk fault rupture output.
+[pylithapp.timedependent.interfaces.fault.output]
+vertex_info_fields = [final_slip,slip_time]
+skip = 0
+writer.filename = gfimpulses/gfimpulse.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year
+
+# Give basename for VTK output of state variables.
+[pylithapp.timedependent.materials.elastic_upper.output]
+skip = 2000
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = gftest-elastic_upper.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year
+
+[pylithapp.timedependent.materials.elastic_lower.output]
+skip = 2000
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = gftest-elastic_lower.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year

Deleted: short/3D/PyLith/trunk/examples/greensfns/hex8/gftest.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/gftest.cfg	2010-08-10 03:09:40 UTC (rev 17074)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/gftest.cfg	2010-08-10 07:06:34 UTC (rev 17075)
@@ -1,191 +0,0 @@
-# -*- Python -*-
-[pylithapp]
-
-# This is not a self-contained simulation configuration file. This
-# file only specifies parameters specific to the boundary and
-# interface conditions. The general parameters are specificed in the
-# pylithapp.cfg file which PyLith reads by default.
-#
-# To run the simulation:
-# pylith gftest.cfg
-
-# ----------------------------------------------------------------------
-# problem
-# ----------------------------------------------------------------------
-[pylithapp.timedependent]
-# Set bc to an array of 3 boundary conditions: 'x_pos','x_neg', and 'z_neg'.
-bc = [x_pos,x_neg,z_neg]
-
-# Set interfaces to an array of 1 fault: 'fault'.
-interfaces = [fault]
-
-[pylithapp.timedependent.implicit.time_step]
-# Define the total time for the simulation and the time step size.
-# Overwrite values in pylithapp.cfg
-total_time = 13.0*year ; total time of simulation
-dt = 1.0*year ; time step
-
-[pylithapp.timedependent.implicit]
-# Set the output to an array of 2 output managers.
-# We will output the solution over the domain and the ground surface.
-output = [domain,subdomain]
-
-# Set subdomain component to OutputSolnSubset (subset of domain).
-output.subdomain = pylith.meshio.OutputSolnSubset
-
-# ----------------------------------------------------------------------
-# boundary conditions
-# ----------------------------------------------------------------------
-
-# We change spatial database for the rate of change from ZeroDispDB
-# (which has zero velocity) to UniformDB (which allows nonzero
-# velocities).
-
-# Set the parameters for the desired boundary conditions.
-#
-# The label corresponds to the nodeset ID in CUBIT.
-
-[pylithapp.timedependent.bc.x_pos]
-bc_dof = [0, 1]
-label = 11
-db_initial.label = Dirichlet BC on +x
-
-[pylithapp.timedependent.bc.x_neg]
-bc_dof = [0, 1]
-label = 12
-db_initial.label = Dirichlet BC on -x
-
-[pylithapp.timedependent.bc.z_neg]
-bc_dof = [2]
-label = 15
-db_initial.label = Dirichlet BC on -z
-
-# ----------------------------------------------------------------------
-# faults
-# ----------------------------------------------------------------------
-[pylithapp.timedependent.interfaces]
-
-# Set the parameters for the fault interface conditions.
-
-[pylithapp.timedependent.interfaces.fault]
-label = 10
-quadrature.cell = pylith.feassemble.FIATLagrange
-quadrature.cell.dimension = 2
-
-output.vertex_info_fields = [normal_dir,strike_dir,dip_dir,final_slip_00,final_slip_01,final_slip_02,final_slip_03,final_slip_04,final_slip_05,final_slip_06,final_slip_07,final_slip_08,final_slip_09,final_slip_10,final_slip_11,final_slip_12,final_slip_13,slip_time_00,slip_time_01,slip_time_02,slip_time_03,slip_time_04,slip_time_05,slip_time_06,slip_time_07,slip_time_08,slip_time_09,slip_time_10,slip_time_11,slip_time_12,slip_time_13]
-
-# Set earthquake ruptures
-eq_srcs = [00,01,02,03,04,05,06,07,08,09,10,11,12,13]
-eq_srcs.00.origin_time = 0.0*year
-eq_srcs.01.origin_time = 1.0*year
-eq_srcs.02.origin_time = 2.0*year
-eq_srcs.03.origin_time = 3.0*year
-eq_srcs.04.origin_time = 4.0*year
-eq_srcs.05.origin_time = 5.0*year
-eq_srcs.06.origin_time = 6.0*year
-eq_srcs.07.origin_time = 7.0*year
-eq_srcs.08.origin_time = 8.0*year
-eq_srcs.09.origin_time = 9.0*year
-eq_srcs.10.origin_time = 10.0*year
-eq_srcs.11.origin_time = 11.0*year
-eq_srcs.12.origin_time = 12.0*year
-eq_srcs.13.origin_time = 13.0*year
-
-# 00
-[pylithapp.timedependent.interfaces.fault.eq_srcs.00.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse00.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-
-# 01
-[pylithapp.timedependent.interfaces.fault.eq_srcs.01.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse01.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-
-# 02
-[pylithapp.timedependent.interfaces.fault.eq_srcs.02.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse02.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-
-# 03
-[pylithapp.timedependent.interfaces.fault.eq_srcs.03.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse03.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 04
-[pylithapp.timedependent.interfaces.fault.eq_srcs.04.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse04.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 05
-[pylithapp.timedependent.interfaces.fault.eq_srcs.05.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse05.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 06
-[pylithapp.timedependent.interfaces.fault.eq_srcs.06.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse06.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 07
-[pylithapp.timedependent.interfaces.fault.eq_srcs.07.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse07.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 08
-[pylithapp.timedependent.interfaces.fault.eq_srcs.08.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse08.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 09
-[pylithapp.timedependent.interfaces.fault.eq_srcs.09.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse09.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 10
-[pylithapp.timedependent.interfaces.fault.eq_srcs.10.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse10.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 11
-[pylithapp.timedependent.interfaces.fault.eq_srcs.11.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse11.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 12
-[pylithapp.timedependent.interfaces.fault.eq_srcs.12.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse12.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# 13
-[pylithapp.timedependent.interfaces.fault.eq_srcs.13.slip_function]
-slip.iohandler.filename = gfspatialdb/gfimpulse13.spatialdb
-slip_time.iohandler.filename = sliptime.spatialdb
-# ----------------------------------------------------------------------
-# output
-# ----------------------------------------------------------------------
-# Give basename for VTK domain output of solution over domain.
-[pylithapp.problem.formulation.output.domain]
-skip = 9
-writer.filename = gftest.vtk
-writer.time_format = %04.0f
-writer.time_constant = 1.0*year
-
-# Give basename for VTK domain output of solution over ground surface.
-[pylithapp.problem.formulation.output.subdomain]
-label = 17 ; nodeset for subdomain
-skip = 0
-writer.filename = gfresponses/gfresponse.vtk
-writer.time_format = %04.0f
-writer.time_constant = 1.0*year
-
-# Give basename for vtk fault rupture output.
-[pylithapp.timedependent.interfaces.fault.output]
-skip = 0
-writer.filename = gfimpulses/gfimpulse.vtk
-writer.time_format = %04.0f
-writer.time_constant = 1.0*year
-
-# Give basename for VTK output of state variables.
-[pylithapp.timedependent.materials.elastic_upper.output]
-skip = 9
-cell_filter = pylith.meshio.CellFilterAvgMesh
-writer.filename = gftest-elastic_upper.vtk
-writer.time_format = %04.0f
-writer.time_constant = 1.0*year
-
-[pylithapp.timedependent.materials.elastic_lower.output]
-skip = 9
-cell_filter = pylith.meshio.CellFilterAvgMesh
-writer.filename = gftest-elastic_lower.vtk
-writer.time_format = %04.0f
-writer.time_constant = 1.0*year

Added: short/3D/PyLith/trunk/examples/greensfns/hex8/initial-run.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/initial-run.cfg	                        (rev 0)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/initial-run.cfg	2010-08-10 07:06:34 UTC (rev 17075)
@@ -0,0 +1,65 @@
+# -*- Python -*-
+[pylithapp]
+
+# This is not a self-contained simulation configuration file. This
+# file only specifies parameters specific to the fault slip and
+# output information for running an initial simulation.
+# The other parameters are specificed in the
+# pylithapp.cfg file which PyLith reads by default.
+#
+# To run the simulation:
+# pylith initial-run.cfg
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.implicit.time_step]
+# Define the total time for the simulation and the time step size.
+# Overwrite values in pylithapp.cfg
+total_time = 0.0*year ; total time of simulation
+
+# ----------------------------------------------------------------------
+# faults
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.interfaces.fault]
+output.vertex_info_fields = [normal_dir,strike_dir,dip_dir]
+
+# The slip time and final slip are defined in spatial databases.
+[pylithapp.timedependent.interfaces.fault.eq_srcs.rupture.slip_function]
+slip.iohandler.filename = finalslip.spatialdb
+slip_time.iohandler.filename = sliptime.spatialdb
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+# Give basename for VTK domain output of solution over domain.
+[pylithapp.problem.formulation.output.domain]
+writer.filename = gftest-initial.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year
+
+# Give basename for VTK domain output of solution over ground surface.
+[pylithapp.problem.formulation.output.subdomain]
+label = face_zpos ; nodeset for subdomain
+writer.filename = gftest-initial.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year
+
+# Give basename for vtk fault rupture output.
+[pylithapp.timedependent.interfaces.fault.output]
+writer.filename = gftest-initial-fault.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year
+
+# Give basename for VTK output of state variables.
+[pylithapp.timedependent.materials.elastic_upper.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = gftest-initial-elastic_upper.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year
+
+[pylithapp.timedependent.materials.elastic_lower.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = gftest-initial-elastic_lower.vtk
+writer.time_format = %04.0f
+writer.time_constant = 1.0*year

Modified: short/3D/PyLith/trunk/examples/greensfns/hex8/mesh_hex8_1000m.jou
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/mesh_hex8_1000m.jou	2010-08-10 03:09:40 UTC (rev 17074)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/mesh_hex8_1000m.jou	2010-08-10 07:06:34 UTC (rev 17075)
@@ -43,7 +43,7 @@
 group "face_xpos" add node in surface 20
 group "face_xpos" add node in surface 28
 nodeset 11 group face_xpos
-nodeset 11 name "face xpos"
+nodeset 11 name "face_xpos"
 
 # ----------------------------------------------------------------------
 # Create nodeset for -x face
@@ -51,7 +51,7 @@
 group "face_xneg" add node in surface 30
 group "face_xneg" add node in surface 38
 nodeset 12 group face_xneg
-nodeset 12 name "face xneg"
+nodeset 12 name "face_xneg"
 
 # ----------------------------------------------------------------------
 # Create nodeset for +y face
@@ -61,7 +61,7 @@
 group "face_ypos" add node in surface 33
 group "face_ypos" add node in surface 35
 nodeset 13 group face_ypos
-nodeset 13 name "face ypos"
+nodeset 13 name "face_ypos"
 
 # ----------------------------------------------------------------------
 # Create nodeset for -y face
@@ -71,7 +71,7 @@
 group "face_yneg" add node in surface 31
 group "face_yneg" add node in surface 37
 nodeset 14 group face_yneg
-nodeset 14 name "face yneg"
+nodeset 14 name "face_yneg"
 
 # ----------------------------------------------------------------------
 # Create nodeset for -z face
@@ -79,7 +79,7 @@
 group "face_zneg" add node in surface 12
 group "face_zneg" add node in surface 16
 nodeset 15 group face_zneg
-nodeset 15 name "face zneg"
+nodeset 15 name "face_zneg"
 
 # ----------------------------------------------------------------------
 # Create nodeset for -z face w/o fault
@@ -87,7 +87,7 @@
 group "face_zneg_nofault" add node in face_zneg
 group "face_zneg_nofault" remove node in fault
 nodeset 16 group face_zneg_nofault
-nodeset 16 name "face zneg nofault"
+nodeset 16 name "face_zneg_nofault"
 
 # ----------------------------------------------------------------------
 # Create nodeset for +z face
@@ -95,7 +95,7 @@
 group "face_zpos" add node in surface 10
 group "face_zpos" add node in surface 17
 nodeset 17 group face_zpos
-nodeset 17 name "face zpos"
+nodeset 17 name "face_zpos"
 
 # ----------------------------------------------------------------------
 # Export exodus file

Modified: short/3D/PyLith/trunk/examples/greensfns/hex8/pylithapp.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/pylithapp.cfg	2010-08-10 03:09:40 UTC (rev 17074)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/pylithapp.cfg	2010-08-10 07:06:34 UTC (rev 17075)
@@ -33,19 +33,51 @@
 [pylithapp.mesh_generator.reader]
 # Set filename of mesh to import.
 filename = box_hex8_1000m.exo
-use_nodeset_names = False
+use_nodeset_names = True
 
 # ----------------------------------------------------------------------
 # problem
 # ----------------------------------------------------------------------
 [pylithapp.timedependent]
 #normalizer = spatialdata.units.NondimElasticQuasistatic
+# Set bc to an array of 3 boundary conditions: 'x_pos','x_neg', and 'z_neg'.
+bc = [x_pos,x_neg,z_neg]
 
+# Set interfaces to an array of 1 fault: 'fault'.
+interfaces = [fault]
+
+[pylithapp.timedependent.implicit]
+# Set the output to an array of 2 output managers.
+# We will output the solution over the domain and the ground surface.
+output = [domain,subdomain]
+
+# Set subdomain component to OutputSolnSubset (subset of domain).
+output.subdomain = pylith.meshio.OutputSolnSubset
+
 [pylithapp.timedependent.formulation.time_step]
 # Define the total time for the simulation and the default time step size.
 total_time = 0.0*s ; total time of simulation
 
 # ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+# We use the default ZeroDispDB for all faces
+[pylithapp.timedependent.bc.x_pos]
+bc_dof = [0, 1]
+label = face_xpos
+db_initial.label = Dirichlet BC on +x
+
+[pylithapp.timedependent.bc.x_neg]
+bc_dof = [0, 1]
+label = face_xneg
+db_initial.label = Dirichlet BC on -x
+
+[pylithapp.timedependent.bc.z_neg]
+bc_dof = [2]
+label = face_zneg_nofault
+db_initial.label = Dirichlet BC on -z
+
+# ----------------------------------------------------------------------
 # materials
 # ----------------------------------------------------------------------
 [pylithapp.timedependent]
@@ -69,22 +101,38 @@
 quadrature.cell.dimension = 3
 
 # ----------------------------------------------------------------------
+# faults
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.interfaces]
+fault = pylith.faults.FaultCohesiveKin
+
+# Set the parameters for the fault interface conditions.
+[pylithapp.timedependent.interfaces.fault]
+label = fault
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 2
+
+# ----------------------------------------------------------------------
 # PETSc
 # ----------------------------------------------------------------------
 # Set the solver options.
 
 [pylithapp.petsc]
-ksp_rtol = 1.0e-8
+# Preconditioner settings.
 pc_type = asm
+sub_pc_factor_shift_type = nonzero
 
-# Change the preconditioner settings.
-sub_pc_factor_shift_type = none
-
+# Convergence parameters.
+ksp_rtol = 1.0e-8
+ksp_atol = 1.0e-12
 ksp_max_it = 100
 ksp_gmres_restart = 50
 
+# Linear solver monitoring options.
 ksp_monitor = true
 ksp_view = true
+ksp_converged_reason = true
 
+# PETSc log summary.
 log_summary = true
 # start_in_debugger = true



More information about the CIG-COMMITS mailing list