TSVViewer is not really a viewer in the usual sense. It's purpose is evidently
to write out files. (p 440 in the FiPy manual, release 3.0)
Here is a snippet of code from my main FiPy application. If rec = True, then
it writes out the solution variable (phi) every "skip" timesteps:
# generate output
tviewer = TSVViewer(vars=phi)
for step in range(steps):
print '%4.3f min' % (step*timeStepDuration*60)
eq.solve(var=phi,dt=timeStepDuration)
if rec:
fname = "%s%03d"%(fnme,step)
if (step%skip == 0): tviewer.plot(filename=fname)
if __name__ == '__main__':
viewer.plot()
-------------
Here is the python code (simplified) that I use to read the output files
generated by TSVViewer. Note: this is a time series of a 2D simulation:
import numpy as np
from matplotlib import pyplot as plt
nx = 200 # length
ny = 50 # depth
skip = 25
time = np.arange(0,1975,skip)
for i in time:
fname = "fast200_%03d" % i
print fname
x,y,z = np.loadtxt(fname,skiprows=2,unpack=True)
phi = np.reshape(z,(-1,nx))
# phi is a 2D array you can manipulate and plot.
--------------
Richard
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]