A problem in FORTRAN programming
Hello friends. I have a problem in FORTRAN programming. I need to divide a larg zone into several parts but I can't define a matrix bigger than (4*1600*500) because the program fails and There is not any message to understand the reason of the error. I realy dont know what I have to do. PLEASE HELP ME. Thank you very much. By.
|
Re: A problem in FORTRAN programming
You are probably having a memory problem.
1)put the matrix into its own named common block 2)If that does not work, you might try building it as a 64bit code. |
Re: A problem in FORTRAN programming
Hello.
Thank you very much for your help but I didn't understand what exactly I have to do know. Please explain me more. As I asked my friends, It is a common problem in CFD programming but none of them could help me. Thank again. Best regards. Behafarid |
Re: A problem in FORTRAN programming
what is your compiler and platform and your physical memory size, i think it is not serious problem and resolved very easily.
|
Re: A problem in FORTRAN programming
First of all, let me do a simple calculation:
4*1600*500 = 3200000 coeficients assuming double precision (8 bytes per coeficient) -- and that you're not spending more memory in other parts of your program -- you'll need 3200000 * 8 = 25600000 Bytes or about 24.4 MBytes (if I'm not wrong in my calc) It doesn't seem to be hard allocate such array. Is this array inside a subroutine? You can be running into stack size problems. Have you tried to allocate this array statically or dynamically? Regards Renato. |
Re: A problem in FORTRAN programming
Your problem is almost certainly stack size related. If you delare a variable inside a function, it'll use stack memory unless forced to use heap. To make it use heap memory, make it static. (e.g. in a COMMON block, defined in a DATA statement).
|
Re: A problem in FORTRAN programming
Try the following examples (using Fortran 90 sintax)
program foo real*8, allocatable :: a(:) n = 4*1600*500 allocate(a(n)) call SomeRoutine(a,n) deallocate(a) end program subroutine SomeRoutine(a,n) ! You must avoid the use of the array size here. It always causes stack problems real*8 :: a(1) ... end subroutine ! --- END OF THE FIRST EXAMPLE --- The same thing could be done with modules module SomeData real*8, allocatable :: a(:) end module SomeData program foo use SomeData n = 4*1600*500 allocate(a(n)) call SomeRoutine deallocate(a) end program subroutine SomeRoutine use SomeData ... end subroutine ! --- END OF THE SECOND EXAMPLE --- Here the array "a" is made accessible through the use of the module Good lucky ;o) Renato. |
All times are GMT -4. The time now is 21:34. |