|
[Sponsors] |
August 15, 2006, 01:05 |
A problem in FORTRAN programming
|
#1 |
Guest
Posts: n/a
|
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.
|
|
August 15, 2006, 07:27 |
Re: A problem in FORTRAN programming
|
#2 |
Guest
Posts: n/a
|
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. |
|
August 16, 2006, 05:52 |
Re: A problem in FORTRAN programming
|
#3 |
Guest
Posts: n/a
|
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 |
|
August 16, 2006, 07:39 |
Re: A problem in FORTRAN programming
|
#4 |
Guest
Posts: n/a
|
what is your compiler and platform and your physical memory size, i think it is not serious problem and resolved very easily.
|
|
August 16, 2006, 11:11 |
Re: A problem in FORTRAN programming
|
#5 |
Guest
Posts: n/a
|
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. |
|
August 16, 2006, 12:09 |
Re: A problem in FORTRAN programming
|
#6 |
Guest
Posts: n/a
|
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).
|
|
August 16, 2006, 13:16 |
Re: A problem in FORTRAN programming
|
#7 |
Guest
Posts: n/a
|
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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
flow driven problem - fortran | Matjaz | CFX | 4 | April 11, 2011 14:52 |
fortran code problem | ztdep | Main CFD Forum | 5 | September 8, 2009 05:22 |
Fortran problem | MM | Main CFD Forum | 8 | June 12, 2007 10:27 |
C++ fortran mixed programming: allocatable array | vito | Main CFD Forum | 1 | April 19, 2005 12:11 |
'C' or FORTRAN or 'C++' | Yogesh Talekar | Main CFD Forum | 20 | October 21, 1999 05:00 |