CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   FORTRAN-90 problem (https://www.cfd-online.com/Forums/main/9158-fortran-90-problem.html)

Arnie May 12, 2005 04:54

FORTRAN-90 problem
 
I seem to have got a silly problem. I have written a program in FORTRAN-90 with most of the quantities assigned type "real" and a few of them "double precision". The program gives reasonably good (physically possible) answers but when I convert all the "real" to "double precision", answers deviate a lot and represent unphysical situations. Though in both cases, answers after 1st itrn. are matching. If anyone has an experience with working in FORTRAN or knows about such problems, please let me know the way out. Thanks.

Guillaume May 12, 2005 08:59

Re: FORTRAN-90 problem
 
Try to see if you have simple precision strong typing for some of your variables like REAL*(4)

unknown2010 May 12, 2005 14:53

Re: FORTRAN-90 problem
 
Which compiler & OS do you see this. Also does it show up with both debug and optimized code.

Márcio Ricardo May 12, 2005 15:08

Re: FORTRAN-90 problem
 
Have you declared all the variables as double precision and run a few iterations to test the code accuracy? Maybe the single precision is just "smoothing" some numerical noise that would be too small in the beginning of your simulation.

Arnie May 16, 2005 04:37

Re: FORTRAN-90 problem
 
hi, I have used COMPAQ visual fortran compiler version 6.5 and my system is windows 2000. Arnie

Arnie May 16, 2005 04:49

Re: FORTRAN-90 problem
 
Dear Marcio Actually, when I compile my programme with all the variables declared real (Let me call this program P1), I am getting answers which are physically realisable. But when I do the same with all variables declared as double precision(I call this P2), I am getting unphysical value at a specific node, though for other nodes P1 & P2 give reasonably nearby answers. My one itrn means solving once for the whole flow field. As I enter into next itrn. the newly calculated value at that specific node seems OK though its not matching with P1 results. What I mean to say is that oscillations are in one specific node. Please suggest something. Arnie

Márcio Ricardo May 16, 2005 08:28

Re: FORTRAN-90 problem
 
I would suggest you to change the domain size and see if this happens again. Where is this node located? If it is the last node in the array, it could be caused by an index error, or a vector smaller than it should be.

Arnie May 17, 2005 04:47

Re: FORTRAN-90 problem
 
the node is located in the beginning of the flow.

Frank Muldoon May 18, 2005 15:47

Re: FORTRAN-90 problem
 
If you have not done so then I strongly suggest compiling the code using a check bounds option (usally -C) and any other checking (such as unassigned variables, passing an array of size x to a routine expecting size x+1 etc.) Also many compilers have a quad precision option, which may be useful if there are actually no errors in the code.


All times are GMT -4. The time now is 04:35.