Dynamical memory allocation for multiblock?
Dear everyone:
I want to use memory dynamical allocation of Fortran90 for multiblock calculation in order to save memory, but I encounter a problem. As for coordinates of every block, if I use the below statement, real,allocatable::x(:,:,:,:) allocate(nblock,ni,nj,nk,stat=err) where nblock denotes number of blocks,ni,nj,nk are the dimension of a block. I must allocate same dimension ni,nj and nk for every block, which leads to redundant memory allocation especially when the differences of sizes of blocks are very remarkable. Does anyone have a better method to deal with this situation? All comments are appreciated! Thanks in advance. |
Re: Dynamical memory allocation for multiblock?
Hello !
I think that it is a common practise to allocate the variables as one-dimensional table(s). This way you do not need to waste memory space. I use 1-D tables in the whole code but it is possible to use 3-D tables in the subroutines even if the memory space is allocated as 1-D table(s) in the main program. Best regards Petri M |
Re: Dynamical memory allocation for multiblock?
Petri Majander, Thank you very much!
|
All times are GMT -4. The time now is 16:32. |