Dan,
I'm making pretty good progress with my thermal problem now.
The next improvement that I want to try is to use a non-uniform 1D
spatial grid. I would like the nodes to be placed at
(x1,x2,x3,........,xn), where the successive intervals (x[i+1]-x[i]) will
differ from one another in general. Is there some elegant, or even
workable, way to do this?
This should just work. What exactly is the error message when you try?
I tried this pair of lines, but I am getting an error about the use of
a non-int(eger?) scaling.
dx =
(1.e6,1.e6,1.e6,1.e6,.5e6,.3e6,.1e6,.05e6,.05e6,3.,3.,3.,3.,3.,3.,3.,20.,60.,200.,500.,3000.,1.e4,3.e4,1.e5,3.e5,1.e6,1.e6,1.e6,1.e6,1.e6)
dx = dx / 1.e9
Tuples and lists are no really useful for maths, the operators have non-mathematical definitions. "+" means append for example. Numeric arrays
serve our purpose for array calculations. The following should work:
>>> from fipy.tools import numerix
>>> dx = numerix.array((1.e6,1.e6,1.e6,1.e6, .05e6,.05e6,3.,3.,3.,3.,3.,3.,3.,20.,60.,200.,500.,3000.,1.e4,3.e4,1.e5, 3.e5,1.e6,1.e6,1.e6,1.e6,1.e6))
>>> dx = dx / 1e9
>>> from fipy.meshes.grid1D import Grid1D
>>> mesh = Grid1D(dx=dx)
>>> print mesh.getCellCenters()
[[ 0.0005 ,]
[ 0.0015 ,]
[ 0.0025 ,]
[ 0.0035 ,]
[ 0.004025 ,]
[ 0.004075 ,]
...
[ 0.0041938 ,]
[ 0.0043938 ,]
[ 0.0050438 ,]
[ 0.0060438 ,]
[ 0.0070438 ,]
[ 0.0080438 ,]
[ 0.0090438 ,]]
You'll notice that I need to span a rather large "dynamic range" on my
intervals to describe the desired geometry. (The intervals vary by >> an
order of magnitude.)
As long as the ranges are within numerical tolerance then the solver should not have problems.
I also got into some errors about tuple handling with a division of
one string by another: (1., 2., 3.) / (4., 5., 6.) . The language
reference didn't seem to help me much with this. I think I need some tips
on doing arithmetic on lists or tuples.
Thanks.
Terry McDaniel
Seagate Research (209) 295-6735