|
[Sponsors] |
March 19, 2014, 10:49 |
FORTRAN NaN PROBLEM
|
#1 |
New Member
Rakuen
Join Date: Oct 2011
Posts: 6
Rep Power: 14 |
Hi,
When i am runnning my fortran code with deltax or deltay is about 1 micron, it writes NaN after a while. It starts smooth but then blows. Is it only about mesh or any other thing? Thank you. |
|
March 19, 2014, 11:01 |
|
#2 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71 |
Quote:
check the matrix bounds using the correct compiler options, use the debug and the the flow chart until discovering the error...some variable is accessing location of memory already declared |
||
March 19, 2014, 11:08 |
|
#3 | |
New Member
Rakuen
Join Date: Oct 2011
Posts: 6
Rep Power: 14 |
Quote:
What do you mean "correct compiler options" and "flow chart". Can you give me more specific information about that. |
||
March 19, 2014, 12:53 |
|
#4 | |
Senior Member
andy
Join Date: May 2009
Posts: 268
Rep Power: 17 |
Quote:
NaN is Not a Number and you get it when the computer is asked to perform an undefined operation like 0/0 plus a bunch of others. It is trivial to find with a debugger if you are able to recompile the code for debugging and then run it under a debugger? |
||
March 19, 2014, 13:31 |
|
#5 | |
New Member
Rakuen
Join Date: Oct 2011
Posts: 6
Rep Power: 14 |
Quote:
My problem is that why is it happening with SMALLER mesh? Thank you. |
||
March 19, 2014, 13:36 |
|
#6 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71 |
Quote:
yes, it could be also a numerical instability, but generally that appears after many iterations, not running for a while... |
||
March 19, 2014, 19:35 |
|
#7 | |
Senior Member
andy
Join Date: May 2009
Posts: 268
Rep Power: 17 |
Quote:
If you have additional source terms these can have stability limits. You are solving non-linear equations and so the linearisation can have stability issues. You have boundary conditions which can have all sorts of stability issues. Plus umpteen others. The most common problem with self written code is of course mistakes in the coding which can also show up as NaN. Is there a reason you haven't run the code under a debugger and found out why your code is failing? |
||
March 20, 2014, 07:00 |
|
#8 | |
New Member
Rakuen
Join Date: Oct 2011
Posts: 6
Rep Power: 14 |
Quote:
Diffusion number is what i didn't concern about before. Diffusion terms are solved with an algorithm in my code that i didn't write. I have never felt debugging necessary. Actually, i don't know how to debug my code. Can you tell me how i detect where my code is failing or giving NaN by running under a debugger? By the way, about 1 million time step is solved for giving NaN. But it is short as compared as my total time step. |
||
March 20, 2014, 08:40 |
|
#9 | |
Senior Member
andy
Join Date: May 2009
Posts: 268
Rep Power: 17 |
Quote:
The notion that you can write CFD code without needing to debug it seems absurd. As does trying to debug a program without knowing what it does. It looks like you may be wise to take some time out to learn the code and the tools required before proceeding with your task. If you have access to local supervision I would strongly advise that over posting to forums like this. |
||
March 23, 2014, 08:27 |
|
#10 |
Senior Member
Lefteris
Join Date: Oct 2011
Location: UK
Posts: 337
Rep Power: 15 |
Just a very wild guess:
you said that you're getting NaN when you make the Δx, Δy in the order of 10e-6. Can it be the case that the computer rounds this to 0? Are you using single or double precision?
__________________
Lefteris |
|
March 23, 2014, 09:14 |
|
#11 | |
New Member
Rakuen
Join Date: Oct 2011
Posts: 6
Rep Power: 14 |
Quote:
I an using double precision and if the computer rounds a variable to 0, it starts to write NaN at the beginning of the run. Now i am investigating my equation of state. My working fluid is water. There might be a problem under EOS. Thank you. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
user fortran 'USER_GETVAR' problem | D.ko | CFX | 0 | April 30, 2013 10:58 |
Problem with plasma test case: residuals are NAN | rafpepe | SU2 | 2 | January 20, 2013 09:37 |
Fortran compiler problem | Luke | Siemens | 2 | September 18, 2008 03:43 |
Problem with Fortran installation. | skarp | CFX | 0 | August 4, 2007 07:09 |
'C' or FORTRAN or 'C++' | Yogesh Talekar | Main CFD Forum | 20 | October 21, 1999 04:00 |