[cig-commits] r14016 - short/3D/PyLith/trunk/playpen/savpres_ss
willic3 at geodynamics.org
willic3 at geodynamics.org
Tue Feb 3 17:47:39 PST 2009
Author: willic3
Date: 2009-02-03 17:47:39 -0800 (Tue, 03 Feb 2009)
New Revision: 14016
Modified:
short/3D/PyLith/trunk/playpen/savpres_ss/savpres_ss.cfg
short/3D/PyLith/trunk/playpen/savpres_ss/savpres_ss.py
Log:
Added options to control timestamp information in output files.
Modified: short/3D/PyLith/trunk/playpen/savpres_ss/savpres_ss.cfg
===================================================================
--- short/3D/PyLith/trunk/playpen/savpres_ss/savpres_ss.cfg 2009-02-04 01:23:29 UTC (rev 14015)
+++ short/3D/PyLith/trunk/playpen/savpres_ss/savpres_ss.cfg 2009-02-04 01:47:39 UTC (rev 14016)
@@ -14,6 +14,8 @@
number_points = 100
delta_x = 5.0*km
x_epsilon = 0.01*m
-vtk_basename = test2.vtk
-csv_filename = test2.csv
-title = Test model with D/H = 0.5 and tau0 = 1.0.
+vtk_basename = savageprescott.vtk
+csv_filename = savageprescott.csv
+time_units = 1.0*year
+time_stamp_width = 4
+title = Test model with D = 20 km, H = 40 km, and tau0 = 1.0.
Modified: short/3D/PyLith/trunk/playpen/savpres_ss/savpres_ss.py
===================================================================
--- short/3D/PyLith/trunk/playpen/savpres_ss/savpres_ss.py 2009-02-04 01:23:29 UTC (rev 14015)
+++ short/3D/PyLith/trunk/playpen/savpres_ss/savpres_ss.py 2009-02-04 01:47:39 UTC (rev 14016)
@@ -42,7 +42,7 @@
## @li \b recurrence_time Earthquake recurrence time.
## @li \b viscosity Viscosity of viscoelastic half-space.
## @li \b shear_modulus Shear modulus of layer and half-space.
- ## @li \b plate_velocity Relative plate velocity across fault.
+ ## @li \b plate_velocity Relative plate velocity (left-lateral) across fault.
## @li \b number_cycles Number of earthquake cycles to compute.
## @li \b number_steps Number of time steps to compute for each cycle.
## @li \b number_terms Number of terms to compute for series solution.
@@ -51,6 +51,8 @@
## @li \b x_epsilon Offset for computation point closest to the fault.
## @li \b vtk_basename Base name for VTK output files.
## @li \b csv_filename Filename for CSV output.
+ ## @li \b time_units Time units to use for output filenames.
+ ## @li \b time_stamp_width Width of time stamp in output filenames.
## @li \b title Title to appear at the top of VTK files.
import pyre.inventory
@@ -81,7 +83,7 @@
plateVelocity = pyre.inventory.dimensional("plate_velocity",
default=2.0*cm/year)
- plateVelocity.meta['tip'] = "Relative velocity across the fault."
+ plateVelocity.meta['tip'] = "Relative velocity (left-lateral) across the fault."
numberCycles = pyre.inventory.int("number_cycles", default=10)
numberCycles.meta['tip'] = "Number of earthquake cycles."
@@ -107,6 +109,12 @@
CSVFileName = pyre.inventory.str("csv_filename", default="savpres_ss.csv")
CSVFileName.meta['tip'] = "Filename for CSV output."
+ timeUnits = pyre.inventory.dimensional("time_units", default=1.0*year)
+ timeUnits.meta['tip'] = "Time units to use for output filenames."
+
+ timeStampWidth = pyre.inventory.int("time_stamp_width", default=4)
+ timeStampWidth.meta['tip'] = "Number digits in output filename time stamp."
+
title = pyre.inventory.str("title",
default="Savage & Prescott strike-slip solution")
title.meta['tip'] = "Title to appear at the top of VTK files."
@@ -149,6 +157,8 @@
self.xEpsilon = self.inventory.xEpsilon.value
self.VTKBaseName = self.inventory.VTKBaseName
self.CSVFileName = self.inventory.CSVFileName
+ self.timeUnits = self.inventory.timeUnits.value
+ self.timeStampWidth = self.inventory.timeStampWidth
self.title = self.inventory.title
self.deltaT = self.recurrenceTime/self.numberSteps
@@ -307,7 +317,9 @@
time = 0.0
for step in range(self.numberSteps + 1):
- VTKFile = fileBaseCycle + str(time) + ".vtk"
+ timeStampInt = int(time/self.timeUnits)
+ timeStampString = repr(timeStampInt).rjust(self.timeStampWidth, '0')
+ VTKFile = fileBaseCycle + timeStampString + ".vtk"
f = open(VTKFile, 'w')
self._writeVTK(f, cycle, step)
f.close()
@@ -355,7 +367,9 @@
time = 0.0
for step in range(self.numberSteps + 1):
- head += "," + cycleHead + str(time)
+ timeStampInt = int(time/self.timeUnits)
+ timeStampString = repr(timeStampInt).rjust(self.timeStampWidth, '0')
+ head += "," + cycleHead + timeStampString
time += self.deltaT
f.write('%s\n' % head)
More information about the CIG-COMMITS
mailing list