On Aug 17, 2008, at 7:22 PM, Igor Telezhinsky wrote:
How many steps in space is it essential to use for the convection
problem?
Enough to get the accuracy you need.
In what way the number of steps in space changes the solution
precision?
I'm not aware of any simple formula to evaluate this (Daniel might
know). Some problems are very tolerant of coarse meshes. Some are not.
If the critical length scales of your problem are small, then you'll
need an appropriately fine mesh. In this case, one might well wonder
why you're even solving this problem on a domain of L=1000. Everything
interesting happens in 0 < x < 1.
I would like to have small steps in space at least near 0 (i.e. 0,
0.001, 0.002 ... ). This is needed for my further research.
I experimented a bit and found that fipy slows down dramatically
when number of steps in space increases (as N^2)! That's why I
thought of logarithmic scale so that all space dependent functions
would now depend on 10^x.
I met a problem, however: ARE THERE NEGATIVE NUMBERS ON THE MESH?
For example, I would like to have a range of x (-3,3)
>>> mesh = Grid1D(nx=7) + (-3.5,)
will give you a mesh with cell centers ranging from -3. to +3.
what would respond to the range (0.001,1000) with
One option might be to only have a fine grid at small x. You should be
able to do:
>>> mesh = Grid1D(nx=1000, dx=0.001) + (Grid1D(nx=999, dx=1.) + (1.,))
but this is both extremely slow (Tony Yu has provided us a patch that
should fix that) and it throws an error for some reason. Instead, you
can do:
>>> Grid1D(dx=[0.001] * 1000 + [1.] * 999)
Alternatively, to make a logarithmic grid:
>>> mesh=Grid1D(dx=10**numerix.arange(-3., 3., .1))
Note that you're specifying dx, so L ends up being almost 4000. If you
really, REALLY care about where your cell centers are and what your
total domain length is, you'll need to do a bit of arithmetic to
figure out the proper range of dx values.
1000000 steps if had to do this detalization in linear scale. This
number of steps is impossible for fipy ...
Not at all. We commonly solve 1000x1000 and 100x100x100 problems. FiPy
does need a lot of memory in order to do this, though.