[cig-commits] r5096 - in short/3D/PyLith/branches/pylith-0.8/pylith3d: examples/lintet examples/lintet/bctest module pylith3d

brad at geodynamics.org brad at geodynamics.org
Thu Oct 26 11:47:23 PDT 2006


Author: brad
Date: 2006-10-26 11:47:22 -0700 (Thu, 26 Oct 2006)
New Revision: 5096

Added:
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.bc
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.connect
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.coord
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.fuldat
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.prop
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.split
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.statevar
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.time
   short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/runtest.py
Modified:
   short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc
   short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/Pylith3d_scan.py
Log:
Partial fix to bug where PyLith can't handle cases where processors don't have BCs. BC file is now empty when there are no BCs as opposed to creating BC file with header. Still dies later on for this case. Created bctest which exposes remaining problems with this case.

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.bc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.bc	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.bc	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,7 @@
+# Boundary conditions for split cube problem.
+#
+displacement_units = m
+velocity_units = m/s
+force_units = newton
+#
+12   1   1   1   0.00000000e+00  0.00000000e+00  0.00000000e+00

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.connect
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.connect	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.connect	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,41 @@
+      1   5   1   0     19     22      8     18
+      2   5   1   0     17     22     19     18
+      3   5   1   0     18     19     24      2
+      4   5   1   0     18      2     24     21
+      5   5   1   0     13     21     17     24
+      6   5   1   0     23     14     17     15
+      7   5   1   0     23     15     17     18
+      8   5   1   0     18     21     24     17
+      9   5   1   0     23     17     21     18
+     10   5   1   0     21     13     17     23
+     11   5   2   0     17     24     25     10
+     12   5   1   0     11     22     17     14
+     13   5   1   0     21     13     23     20
+     14   5   1   0     17     22     15     14
+     15   5   1   0     18     22      8     15
+     16   5   1   0      2      1     19     24
+     17   5   2   0      7     24     25     19
+     18   5   1   0     15     16      8     18
+     19   5   1   0     18     17     24     19
+     20   5   2   0     17      4     10     25
+     21   5   1   0     15     22     17     18
+     22   5   2   0      6     22      4      5
+     23   5   2   0     22     19     25     17
+     24   5   2   0      6     25     22     19
+     25   5   2   0     17     11      4     22
+     26   5   2   0      4     17     10     12
+     27   5   2   0     17     22      4     25
+     28   5   2   0     12     17     10      9
+     29   5   2   0      7     19     25      6
+     30   5   2   0      8     22     19      6
+     31   5   2   0     25      6      4     10
+     32   5   2   0      8     22      6      5
+     33   5   2   0     25      6     22      4
+     34   5   2   0      7      6     25     10
+     35   5   2   0     24      1     19      7
+     36   5   2   0     17     12      4     11
+     37   5   2   0     17     13     10      9
+     38   5   2   0     10     13     17     24
+     39   5   2   0     12      3      4     11
+     40   5   2   0      7     10     25     24
+     41   5   2   0     17     19     25     24

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.coord
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.coord	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.coord	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,26 @@
+coord_units = m
+      1   5.00000000E+02   0.00000000E+00   0.00000000E+00
+      2   1.00000000E+03   0.00000000E+00   0.00000000E+00
+      3   0.00000000E+00   1.00000000E+03   1.00000000E+03
+      4   0.00000000E+00   4.91304000E+02   1.00000000E+03
+      5   0.00000000E+00   0.00000000E+00   1.00000000E+03
+      6   0.00000000E+00   0.00000000E+00   5.27048000E+02
+      7   0.00000000E+00   0.00000000E+00   0.00000000E+00
+      8   5.00000000E+02   0.00000000E+00   1.00000000E+03
+      9   0.00000000E+00   1.00000000E+03   0.00000000E+00
+     10   0.00000000E+00   5.10836000E+02   0.00000000E+00
+     11   5.00000000E+02   1.00000000E+03   1.00000000E+03
+     12   0.00000000E+00   1.00000000E+03   5.08696000E+02
+     13   5.00000000E+02   1.00000000E+03   0.00000000E+00
+     14   1.00000000E+03   1.00000000E+03   1.00000000E+03
+     15   1.00000000E+03   4.64850000E+02   1.00000000E+03
+     16   1.00000000E+03   0.00000000E+00   1.00000000E+03
+     17   5.00000000E+02   1.00000000E+03   5.01602000E+02
+     18   1.00000000E+03   0.00000000E+00   5.02291000E+02
+     19   5.00000000E+02   0.00000000E+00   5.01602000E+02
+     20   1.00000000E+03   1.00000000E+03   0.00000000E+00
+     21   1.00000000E+03   4.91304000E+02   0.00000000E+00
+     22   5.00000000E+02   4.65848000E+02   1.00000000E+03
+     23   1.00000000E+03   1.00000000E+03   4.72127000E+02
+     24   5.00000000E+02   4.65848000E+02   0.00000000E+00
+     25   2.50275000E+02   3.73858000E+02   4.12501000E+02

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.fuldat
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.fuldat	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.fuldat	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,9 @@
+# File containing time steps at which full output is desired.
+#
+# Comment lines begin with '#'
+#
+# Note: Time step 0 (elastic solution) is always included in the
+# output.
+#
+# List the time steps, one per line.
+#

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.prop
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.prop	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.prop	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,36 @@
+# File containing material properties.
+#
+# Comment lines begin with '#'
+#
+# The material type and material property values are specified using a
+# "keyword = value" syntax. The keywords for the different material
+# types are given below. The units for values with dimensions should
+# follow the value as shown in the examples below.
+#
+# Materials and keywords:
+#   Isotropic linear elastic
+#     materialType ='IsotropicLinearElastic'
+#     density
+#     youngsModulus
+#     poissonsRatio
+#     endMaterial ='True' (flag indicating end of material)
+#   Isotropic linear maxwell viscoelastic
+#     materialType ='IsotropicLinearMaxwellViscoelastic'
+#     density
+#     youngsModulus
+#     poissonsRatio
+#     viscosity
+#     endMaterial ='True' (flag indicating end of material)
+#
+# Material number 1
+materialType 	= 'IsotropicLinearElastic'
+density         = 3000.0*kg/m**3		#  Density
+youngsModulus   = 7.5e10*Pa			#  Young's modulus
+poissonsRatio   = 0.25				#  Poisson's ratio
+endMaterial	= True
+# Material number 2
+materialType 	= 'IsotropicLinearElastic'
+density         = 3000.0*kg/m**3		#  Density
+youngsModulus   = 7.5e10*Pa			#  Young's modulus
+poissonsRatio   = 0.25				#  Poisson's ratio
+endMaterial	= True

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.split
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.split	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.split	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,2 @@
+     16      1   0   0.00000000E+00   5.00000000E-01   0.00000000E+00
+     35      1   0   0.00000000E+00  -5.00000000E-01   0.00000000E+00

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.statevar
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.statevar	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.statevar	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,23 @@
+# File specifying which state variables to output.
+#
+# Comment lines begin with '#'
+#
+# State variables occur in groups of 6, corresponding to the number of
+# stress/strain components. The present groups are:
+#   1-6: Cauchy stress
+#   7-12: Total strain
+#   13-18: Viscous strain
+#   18-24: Plastic strain
+#
+# Lines:
+#   (1) Total accumulated values for the current time step
+#   (2) Incremental values (previous to current)
+#   (3) Rate values (previous to current)
+#
+# Columns (per line):
+#   (1) Number of state variables to output (0 ≤ value ≤ 24)
+#   (2)+ State variable number to output (1 ≤ value ≤ 24)
+#
+    12   1   2   3   4   5   6   7   8   9  10  11  12
+    12   1   2   3   4   5   6   7   8   9  10  11  12
+    0

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.time
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.time	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/bctest.time	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,40 @@
+# File containing time stepping parameters.
+#
+# Comment lines begin with '#'
+#
+# First, specify units used in values with dimensions of time.
+#
+time_units = year
+#
+#
+# Time stepping parameters are given in groups. The elastic solution
+# corresponds to group 0 and must always be defined. Although some of
+# the parameters do not have any meaning for the elastic solution,
+# they must be present anyway.
+#
+# Columns:
+#   (1) Time step group number (=0 for elastic solution).
+#   (2) The number of time steps in the group (=1 for elastic solution).
+#   (3) Time step size (given in units of time_units).
+#   (4) Amount of implicitness. Real dimensionless parameter that
+#       ranges from 0.0 (fully explicit) to 1.0 (fully implicit). The
+#       value is generally set to 0.5.
+#   (5) Maximum number of equilibrium iterations before stiffness
+#       matrix is reformed.
+#   (6) Number of time steps between initial reformation of stiffness
+#       matrix.
+#       <0 Indicates that reformation should occur only for the first
+#          step in each time step group.
+#       =0 Indicates that reformation should never occur.
+#   (7) Large deformation solution flag
+#       =0 Linear strain 
+#       =1 Large strain but use only linear contribution to the
+#          stiffness matrix (sometimes results in better convergence)
+#       =2 Large strain and use nonlinear contribution to the
+#          stiffness matrix
+#   (8) Convergece tolerance for displacements (dimensionless value)
+#   (9) Convergece tolerance for forces (dimensionless value)
+#   (10) Convergece tolerance for energy (dimensionless value)
+#   (11) Maximum number of equilibrium iterations
+#
+  0   1   0.e+0  5.e-1 1001   4      0  1.0e+00  1.0e+0  1.0e+00 1

Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/runtest.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/runtest.py	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/runtest.py	2006-10-26 18:47:22 UTC (rev 5096)
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+root="bctest"
+
+# ----------------------------------------------------------------------
+def setupInput(nprocs):
+  dupext = [".fuldat", ".prop", ".statevar", ".time"]
+  sinext = [".coord", ".connect", ".bc", ".split"]
+
+  print "Setting up symbolic links with prefix '%s_%d':" % (root, nprocs)
+  import os
+
+  dirFiles = os.listdir(os.getcwd())
+  for ext in sinext:
+    src = "%s%s" % (root, ext)
+    dest = "%s_%s%s" % (root, nprocs, ext)
+    if not dest in dirFiles:
+      print "  %s -> %s... created" % (dest, src)
+      os.symlink(src, dest)
+    else:
+      print "  %s -> %s... already exists" % (dest, src)
+
+  for ext in dupext:
+    src = "%s%s" % (root, ext)
+    for iproc in range(nprocs):
+      dest = "%s_%s.%d%s" % (root, nprocs, iproc, ext)
+      if not dest in dirFiles:
+        print "  %s -> %s... created" % (dest, src)
+        os.symlink(src, dest)
+      else:
+        print "  %s -> %s... already exists" % (dest, src)
+  return
+
+
+# ----------------------------------------------------------------------
+def run(nprocs):
+  print "Running PyLith..."
+
+  # TODO: Replace the use of launching via 'system' with use
+  # of Leif's architecture independent utility.
+
+  cmd = "mpirun -np %d `which pylith3dapp.py` " \
+        "--typos=relaxed " \
+        "--scanner.fileRoot=%s_%d " \
+        "--scanner.asciiOutput=full " \
+        "--scanner.ucdOutput=ascii " \
+        "-log_summary -pc_type bjacobi -sub_pc_type ilu " \
+        "-ksp_monitor -ksp_view -ksp_rtol 1e-09" % (nprocs, root, nprocs)
+  import os
+  print cmd
+  os.system(cmd)
+  return
+
+
+# ----------------------------------------------------------------------
+if __name__ == "__main__":
+  from optparse import OptionParser
+
+  parser = OptionParser()
+  parser.add_option("-n", "--numprocs", dest="nprocs",
+                    type="int", metavar="NPROCS",
+                    help="Set number of processors.")
+  (options, args) = parser.parse_args()
+  if len(args) != 0:
+    parser.error("Incorrent number of arguments.")
+
+  nprocs = 1
+  if not options.nprocs is None:
+    nprocs = options.nprocs
+
+  setupInput(nprocs)
+  run(nprocs)
+
+
+# End of file


Property changes on: short/3D/PyLith/branches/pylith-0.8/pylith3d/examples/lintet/bctest/runtest.py
___________________________________________________________________
Name: svn:executable
   + *

Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc	2006-10-26 18:47:22 UTC (rev 5096)
@@ -146,17 +146,32 @@
   }
   ierr = PetscStrcpy(bcFilename, baseFilename);
   ierr = PetscStrcat(bcFilename, ".bc");
-  f = fopen(bcFilename, "w");CHKERRQ(ierr);
-  fprintf(f, "displacement_units = m\n");
-  fprintf(f, "velocity_units = m/s\n");
-  fprintf(f, "force_units = newton\n");
-  fprintf(f, "#\n");
-  fprintf(f, "# The last row for each node applies\n");
-  fprintf(f, "#\n");
-  fprintf(f, "#  Node X BC Y BC Z BC   X Value          Y Value          Z Value\n");
-  fprintf(f, "#\n");
+
+  // Determine if we have bc stuff
   const ALE::Obj<ALE::Mesh::topology_type::label_sequence>& vertices = boundaries->getTopology()->depthStratum(patch, 0);
+  bool haveBC = false;
+  for(ALE::Mesh::topology_type::label_sequence::iterator v_iter = vertices->begin(); v_iter != vertices->end(); ++v_iter)
+    if (boundaries->getFiberDimension(patch, *v_iter) > 0) {
+      haveBC = true;
+      break;
+    } // if
 
+  f = fopen(bcFilename, "w");CHKERRQ(ierr);
+  if (haveBC) {
+    // Only write header if bc file contains information
+    // If header is written and rest of file is empty,
+    // then we have a problem and reading will fail with
+    // error message.
+    fprintf(f, "displacement_units = m\n");
+    fprintf(f, "velocity_units = m/s\n");
+    fprintf(f, "force_units = newton\n");
+    fprintf(f, "#\n");
+    fprintf(f, "# The last row for each node applies\n");
+    fprintf(f, "#\n");
+    fprintf(f, "#  Node X BC Y BC Z BC   X Value          Y Value          Z Value\n");
+    fprintf(f, "#\n");
+  } // if
+
   for(ALE::Mesh::topology_type::label_sequence::iterator v_iter = vertices->begin(); v_iter != vertices->end(); ++v_iter) {
     int    constraints[3] = {0, 0, 0};
     double values[3] = {0.0, 0.0, 0.0};

Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/Pylith3d_scan.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/Pylith3d_scan.py	2006-10-26 17:39:50 UTC (rev 5095)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/Pylith3d_scan.py	2006-10-26 18:47:22 UTC (rev 5096)
@@ -412,15 +412,16 @@
             self._forceUnits,
             self._bcInputFile)
 
-        self._displacementScaleString = \
-                                      uparser.parse(string.strip(self._displacementUnits))
-        self._displacementScaleFactor = self._displacementScaleString.value
-        self._velocityScaleString = \
-                                  uparser.parse(string.strip(self._velocityUnits))
-        self._velocityScaleFactor = self._velocityScaleString.value
-        self._forceScaleString = \
-                               uparser.parse(string.strip(self._forceUnits))
-        self._forceScaleFactor = self._forceScaleString.value
+        if self._numberBcEntries > 0:
+            self._displacementScaleString = \
+                                          uparser.parse(string.strip(self._displacementUnits))
+            self._displacementScaleFactor = self._displacementScaleString.value
+            self._velocityScaleString = \
+                                      uparser.parse(string.strip(self._velocityUnits))
+            self._velocityScaleFactor = self._velocityScaleString.value
+            self._forceScaleString = \
+                                   uparser.parse(string.strip(self._forceUnits))
+            self._forceScaleFactor = self._forceScaleString.value
 
         self._winklerInfo = pylith3d.scan_wink(
             f77FileInput,



More information about the cig-commits mailing list