Thanks for all the replies, I'll check the links provided.
Just to give a summary of the reasons.... As John Gibson pointed out 
Fourier expansions would be one example.

When solving PDE's we use "ghost cells" to provide boundary conditions. A 
physical variable, let's say density, could be represented in space by a 3D 
array,
with each spatial index (ix,iy,iz) taking on values like ix=1..nx, 
iy=1..ny, iz=1..nz etc. If the boundary is, say, reflective, then you need 
to set the value of the density in
the part of space you can't "see", e.g. in the regions ix=-2..0 and 
ix=nx+1..nx+3

Obviously this can be handled by offsetting each array index by some 
amount. The problem is mainly that what we have written down on paper, in 
books and papers on
numerical analysis etc are numerical equations which naturally count from 1 
to n along some dimension. Couple that to the fact that many codes rely on 
arrays that
consist of mixtures of real space (3D say) and special function expansions, 
with Fourier expansion being one example.
I for example use a 7-dimensional array to describe some problems (3 
dimensions for real space, and 3 dimensions for velocity space). Real space 
is not expanded,
so it counts from 1..n naturally, while velocity space has 2 dimensions 
expanded with one type of series (counting from 0..n) and the other 
dimension expanded in
a different series (counting from -n..n). The final seventh dimension 
naturally has only 2 indices 0 and 1 (which accounts nicely for the real 
and imaginary parts of the function).

Within each array loop, it is nice to be able to use if statements that 
correspond to what you have written down on paper, e.g.:

if(in>0) then blah
if(im<1) then something else

or something like:

do i=0,1
do im=-mmax,mmax
do in=max(im,0),nmax
do ir=1,nr
do ix=1,nx
do iy=1,ny
do iz=2,nz-1

blah

enddo
enddo
enddo
enddo
enddo
enddo
enddo

(incidentally, imagine how many tabs would be required to write the above 
in python!).

Within a code, there may be many such loops and structures with different 
looping conditions.

When you have a code with 20000-40000 lines that you want to update to a 
new language, having to change all of these to account for offsetting is 
too much work for anyone to seriously consider.
Not to mention the fact you can no longer easily code up the difference 
equations you have written on paper (and possible spent months creating). 
That in a nutshell is why nobody is switching from 
Fortran (even the young guys are writing new codes in Fortran). There are 
other nice things about Fortran arrays, such as the ability to quickly set 
all elements of an array to zero with:

a=0.0

I hope that sort of makes it clear the type of problems we deal with?!

Cheers

Reply via email to