[cig-commits] r19136 - short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d
brad at geodynamics.org
brad at geodynamics.org
Mon Oct 31 11:21:21 PDT 2011
Author: brad
Date: 2011-10-31 11:21:21 -0700 (Mon, 31 Oct 2011)
New Revision: 19136
Modified:
short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/pylithapp.cfg
short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/tabulate_offfaultdata.py
short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/tabulate_onfaultdata.py
Log:
Reduced numerical damping parameter. Updated tabulation of off fault data to use HDF5 output.
Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/pylithapp.cfg
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/pylithapp.cfg 2011-10-31 17:08:17 UTC (rev 19135)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/pylithapp.cfg 2011-10-31 18:21:21 UTC (rev 19136)
@@ -42,7 +42,7 @@
dimension = 2
formulation = pylith.problems.ExplicitLumped
-formulation.norm_viscosity = 0.2
+formulation.norm_viscosity = 0.1
normalizer = spatialdata.units.NondimElasticDynamic
[pylithapp.timedependent.formulation.time_step]
Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/tabulate_offfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/tabulate_offfaultdata.py 2011-10-31 17:08:17 UTC (rev 19135)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/tabulate_offfaultdata.py 2011-10-31 18:21:21 UTC (rev 19136)
@@ -10,67 +10,57 @@
# ----------------------------------------------------------------------
#
-cell = "tri3"
+cell = "quad4"
dx = 200
-dt = 0.05
-outputRoot = "output/%s_%3dm_%s" % (cell,dx,"refine")
-outdir = "scecfiles/%s_%3dm_%s/" % (cell,dx,"refine")
+inputRoot = "output/%s_%03dm_%s" % (cell,dx,"gradient")
+outdir = "scecfiles/%s_%03dm_%s/" % (cell,dx,"gradient")
# ----------------------------------------------------------------------
-
+import tables
import numpy
import time
-from pylith.utils.VTKDataReader import VTKDataReader
-
# ----------------------------------------------------------------------
-timestamps = numpy.arange(50,12001,50)
targets = numpy.array([[3000.0, -12000.0, 0.0],
[3000.0, +12000.0, 0.0]])
-reader = VTKDataReader()
tolerance = 1.0e-6
-# Get vertices and find indices of target locations
-filename = "%s_t%05d.vtk" % (outputRoot,timestamps[0])
-data = reader.read(filename)
-
-vertices = numpy.array(data['vertices'])
+h5 = tables.openFile("%s.h5" % inputRoot, 'r')
+vertices = h5.root.geometry.vertices[:]
ntargets = targets.shape[0]
indices = []
for target in targets:
dist = ( (vertices[:,0]-target[0])**2 +
- (vertices[:,1]-target[1])**2 +
- (vertices[:,2]-target[2])**2 )**0.5
+ (vertices[:,1]-target[1])**2 )**0.5
min = numpy.min(dist)
- indices.append(numpy.where(dist <= min+tolerance)[0])
+ indices.append(numpy.where(dist <= min+tolerance)[0][0])
-print "Indices", indices
-print "Coordinates of selected points:",vertices[indices,:]
+print "Indices: ", indices
+print "Coordinates of selected points:\n",vertices[indices,:]
-# Extract values
-nsteps = timestamps.shape[0]
-disp = numpy.zeros((nsteps,2,3)) # 3-D array (time, targets, components)
-vel = numpy.zeros((nsteps,2,3))
-itime = 0
-for timestamp in timestamps:
- filename = "%s_t%05d.vtk" % (outputRoot,timestamp)
- data = reader.read(filename)
- fields = data['vertex_fields']
- disp[itime,0:ntargets,:] = fields['displacement'][indices,:].squeeze()
- vel[itime,0:ntargets,:] = fields['velocity'][indices,:].squeeze()
- itime += 1
+# Get datasets
+disp = h5.root.vertex_fields.displacement[:]
+vel = h5.root.vertex_fields.velocity[:]
+timeStamps = h5.root.time[:].ravel()
+nsteps = timeStamps.shape[0]
+dt = timeStamps[1] - timeStamps[0]
+h5.close()
+# Extract locations
+disp = disp[:,indices,:]
+vel = vel[:,indices,:]
+
# Write data
headerA = \
- "# problem = TPV205\n" + \
- "# author = Surendra N. Somala\n" + \
+ "# problem = TPV205-2D\n" + \
+ "# author = Brad Aagaard\n" + \
"# date = %s\n" % (time.asctime()) + \
"# code = PyLith\n" + \
- "# code_version = 1.5.0\n" + \
+ "# code_version = 1.6.2\n" + \
"# element_size = %s\n" % dx
headerB = \
"# Time series in 7 columns of E14.6:\n" + \
@@ -91,11 +81,9 @@
locName = "%+04dst%+04ddp%03d"
lengthScale = 1000.0
-timeScale = 1000.0
dip = 7.5
body = targets[:,0] / lengthScale
strike = targets[:,1] / lengthScale
-time = timestamps / timeScale
for iloc in xrange(ntargets):
pt = locName % (round(10*body[iloc]),
@@ -110,11 +98,11 @@
strike[iloc],
dip))
fout.write(headerB)
- data = numpy.transpose((time,
+ data = numpy.transpose((timeStamps,
-disp[:,iloc,1],
-vel[:,iloc,1],
- +disp[:,iloc,2],
- +vel[:,iloc,2],
+ +disp[:,iloc,1]*0.0,
+ +vel[:,iloc,1]*0.0,
-disp[:,iloc,0],
-vel[:,iloc,0]))
numpy.savetxt(fout, data, fmt='%14.6e')
Modified: short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/tabulate_onfaultdata.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/tabulate_onfaultdata.py 2011-10-31 17:08:17 UTC (rev 19135)
+++ short/3D/PyLith/benchmarks/trunk/dynamic/scecdynrup/tpv205-2d/tabulate_onfaultdata.py 2011-10-31 18:21:21 UTC (rev 19136)
@@ -10,11 +10,11 @@
# ----------------------------------------------------------------------
#
-cell = "tri3"
-dx = 200
+cell = "quad4"
+dx = 50
-inputRoot = "output/%s_%3dm_%s-fault" % (cell,dx,"gradient")
-outdir = "scecfiles/%s_%3dm_%s/" % (cell,dx,"gradient")
+inputRoot = "output/%s_%03dm_%s-fault" % (cell,dx,"gradient")
+outdir = "scecfiles/%s_%03dm_%s/" % (cell,dx,"gradient")
# ----------------------------------------------------------------------
import tables
More information about the CIG-COMMITS
mailing list