I am new to fipy, so I apologise if this is a stupid question (and this doesn't seem to help me). But is there a way to store fipy objects in human-readable (or python-readable) form, other than suggested in the question above? This is only applicable to the cell variable. If I want to do some more fancy/customized plotting than what is in the default fipy viewer, how can I do it?
Take for example a simple 1D diffusion:
from fipy import *
# USER-DEFINED PARAMETERS
nx = 100
dx = 0.1
D = 1.0
bound1 = 30
bound2 = 70
# PREPARED FOR SOLUTION
mesh = Grid1D(nx=nx, dx=dx)
print "mesh", mesh
# define some parameters specific to this solution
T0 = bound2
Tinf = bound1
hour = 3600
day = hour*24
ndays = 1
duration = ndays*day
T = CellVariable(name="Temperature", mesh=mesh, value=bound1)
# Constant temperature boundary condition
T.constrain(T0, mesh.facesLeft)
T.constrain(Tinf, mesh.facesRight)
# SOLUTION
eq = (TransientTerm() == DiffusionTerm(coeff=D))
timeStepDuration = 0.5*hour
steps = int(duration/timeStepDuration)
for step in range(steps):
eqCirc.solve(var=T,dt=timeStepDuration)
But could I, for example, store the mesh as an array? Or could I store the value of the DiffusionTerm
instead of the CellVariable
in each step?
In my case, I would like to plot the thermal gradient (so extract it from the diffusion term) with distance for each time step. Can I do it? How?