FORTRAN NaN PROBLEM
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. |
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 |
Quote:
What do you mean "correct compiler options" and "flow chart". Can you give me more specific information about that. |
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? |
Quote:
My problem is that why is it happening with SMALLER mesh? Thank you. |
Quote:
yes, it could be also a numerical instability, but generally that appears after many iterations, not running for a while... |
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? |
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. |
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. |
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? |
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. |
All times are GMT -4. The time now is 12:43. |