Hello,
I'm new to this discussion group, so while I have read a lot of previous
corrospondence, I'm not sure whether these questions have come up before.
I'm writing a computational fluid dynamics code and use a lot of temporary
storage arrays. In general I use 3D arrays which are the same same size as
the computational grid, but in some subroutines involving tensor
quantities, I also need a fourth dimension.
In its present state, my code declares and then allocates and deallocates
these temporary storage arrays within subroutines as they are required. I
have done some profiling using the Lahey F90 compiler, and, contrary to my
expectations, array allocation is very quick in comparison to other array
operations.
So, my first question is whether this sounds like a reasonable way to
tackle the problem, or is there some other method which is recommended. I
have tried using pointers to reference chunks of a huge 4D storage array
allocated at the beginning of the program and found it fraught with
problems, and considerably slower.
Secondly, I would also like to check that declaring and allocating dynamic
arrays in subroutines is strictly legal. A colleague says he has had a
problem with the Lahey F95 compiler when he does this. I would have
thought, this would defeat the purpose of dynamic arrays?
Finally, for clarity, I sometimes use pointers to alias dynamic storage
arrays which are used sequentially for a number of different variables
within a given subroutine. From the profiling I have done using the Lahey
F90 compiler, this appears to > double the time taken for operations. Is
this likely to improve in the future, or with other compilers?
Alternatively I could deallocate and reallocate these arrays each time I
want to use it for a different variable as I have been doing between
sections of the code as I described above or possible use the dreaded
EQUIVALENCE statement?
To put all this in context, at present I do most of my development on a PC
but I intend for the final product to be run using Digital HPF on a small
farm of parallel computers.
Cheers
Michael
Michael Kirkpatrick
Department of Mechanical Engineering
The University of Sydney
Sydney, NSW, 2006
Australia
Tel: +61 2 9351 4064
Fax: +61 2 9351 7060
Email: [log in to unmask]
:)><
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|