[cig-commits] r20231 - short/3D/PyLith/branches/v1.7-trunk/examples/2d/subduction
brad at geodynamics.org
brad at geodynamics.org
Wed May 30 12:52:48 PDT 2012
Author: brad
Date: 2012-05-30 12:52:47 -0700 (Wed, 30 May 2012)
New Revision: 20231
Modified:
short/3D/PyLith/branches/v1.7-trunk/examples/2d/subduction/afterslip_tractions.py
Log:
Cleanup.
Modified: short/3D/PyLith/branches/v1.7-trunk/examples/2d/subduction/afterslip_tractions.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/examples/2d/subduction/afterslip_tractions.py 2012-05-30 19:45:45 UTC (rev 20230)
+++ short/3D/PyLith/branches/v1.7-trunk/examples/2d/subduction/afterslip_tractions.py 2012-05-30 19:52:47 UTC (rev 20231)
@@ -1,3 +1,13 @@
+# This python script extracts the changes in fault tractions from
+# step01 and combines them with background depth-dependent fault
+# tractions to create initial fault tractions to drive frictional
+# afterslip.
+#
+# PREREQUISITES: numpy, h5py, output from step01
+#
+# Run the script:
+# python afterslip_tractions.py
+
import numpy
import h5py
@@ -2,5 +12,3 @@
# Load in change in tractions from coseismic simulation
-filename = "output/step01-fault.h5"
-
-h5 = h5py.File(filename, 'r', driver="sec2")
+h5 = h5py.File("output/step01-fault.h5", 'r', driver="sec2")
vertices = h5['geometry/vertices'][:]
@@ -15,29 +23,28 @@
gacc = 9.80665
coef_friction = 0.6
-# Background normal tractions are compressive (less than zero because
-# y is negative)
+# Background normal tractions are overburden and compressive
+# (negative, y is negative)
tractions_bg_normal = density*gacc*(vertices[:,1])
-# Background shear tractions are reverse ("right-lateral" is negative)
+# Background shear tractions are reverse (in 2-D right-lateral is negative)
# because the normal tractions are negative.
tractions_bg_shear = coef_friction*tractions_bg_normal
+# Combine traction changes and background tractions
tractions_shear = tractions_bg_shear + tractions_change[:,0]
tractions_normal = tractions_bg_normal + tractions_change[:,1]
-filename = "afterslip_tractions.spatialdb"
-
-# Create coordinate system for output
+# Create coordinate system for spatial database
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(2)
-# Create writer for spatialdata base file
+# Create writer for spatial database file
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
writer = SimpleIOAscii()
-writer.inventory.filename = filename
+writer.inventory.filename = "afterslip_tractions.spatialdb"
writer._configure()
writer.write({'points': vertices,
'coordsys': cs,
@@ -48,3 +55,5 @@
{'name': "traction-normal",
'units': "Pa",
'data': tractions_normal}]})
+
+# End of file
More information about the CIG-COMMITS
mailing list