On May 3, 2007, at 7:20 PM, Elizabeth Tseng wrote:
I have two questions:
(1) If I define a mesh Grid1D(nx=30, dx=5) and solve a CellVariable
using this mesh, the CellVariable.phi value would be an array of
30. Does phi.value[0] indicate the value at r = 0? or r = 5? If it
is r = 0, doesn't that make the last value in the array r = (nx-1)*dx?
phi[0] would be at r = 2.5 in this case. The mesh runs from r = 0 to
r = 150. The cell centers are located at r = 2.5, 7.5, 12.5, ...
I'm modeling this for a sphere but assuming uniform diffusion (so
it is a 1D-diffusion problem). Hopefully by declaring this I mean
that at r = 0 the core, the flux is 0. But at r = R which is the
surface of the sphere, the value of phi should be 100.
I noticed this problem because when I set my right boundary to some
value C, and then look at the solved variable, the last value in
the array is not C, but slightly lower than it.
Right. The boundary condition applies on faces, but FiPy solves your
equation at the center of cells bounded by faces. In the case above,
the boundary condition would be at r = 150, but the outermost cell
would be centered at r = 147.5.
--
Jonathan E. Guyer, PhD
Metallurgy Division
National Institute of Standards and Technology
<http://www.metallurgy.nist.gov/>