FAQ/Troubleshooting

From OpenFOAMWiki
< FAQ


1 FAQ Section 8: Troubleshooting

Figuring out what went wrong

1.1 An application ends with a segmentation fault. What is wrong?

A segmentation fault usually occurs when a program tries to access memory outside its bounds (see Segmentation Fault on Wikipedia). In OpenFOAM this usually occurs when a List<> or similar is accessed with an index outside of the allocated domain. To find out where this occurs see make a separate copy of the OF-sources, recompile them with the switch WM_COMPILE_OPTION set to Debug (just uncomment the right lines in the bashrc/cshrc files). This makes OF run slower, but accesses to List<> etc are checked for ranges and the program aborts if you access outside of a range (plus you get a stack trace). This won't solve your problem, but it will help you find out where it occurs.

See also General debugging tips. For recompiling OpenFOAM look at Installation (specially page Installation/Working_with_the_Shell) or the older page Howto_compile_OpenFOAM.

1.2 My program stops with an output that starts with #0 Foam::error::printStack(Foam::Ostream&)

You encountered a program error. Upon hitting that error OpenFOAM produced a stack trace (a list of the functions that were called) which is very useful to find the location at which the problem occured. It is possible to get that stack-trace with the source files and the line numbers of the functions which might help to find out what the problem is. To do so you have to compile a debug version of OpenFOAM. (see also the segmentation fault-question above)

1.3 I'm unable to reproduce a crash. What's going on?

If you run the same exact simulation twice or more times, but there is an occasional crash in different places, then there are a few possibilities:

  • There could be a numerical instability in the calculations. This could be due to the compiler options used (such as --fast-math).
  • There could be some randomness introduced somewhere by a pseudo-random number generator. This is common in the particle/chemical type solvers in OpenFOAM.
  • There could be a hardware problem. In this case, check this page: How to Check if RAM and CPU are OK

1.4 Cannot open script file?

Symptom
The common error messages for this scenario are:
./Allwmake: 7: .: Can't open /wmake/scripts/AllwmakeParseArguments
./Allrun: 5: .: Can't open /bin/tools/RunFunctions
Reason and solution
The OpenFOAM environment is not properly activated. For more details, read Installation/Working_with_the_Shell.

1.5 Cannot use the -fields option in foamToVTK?

Symptom
Using the following command:
foamToVTK -fields p
gives the following (somewhat) cryptic error message:
--> FOAM FATAL IO ERROR:
incorrect first token, expected <int> or '(', found on line 0 the word 'p'
Solution
As listed in foamToVTK, the help message states: the following:
-fields <wordList>
                   only convert the specified fields - eg '(p T U)'
this means that the complete list structure needs to be used, including quotes and parenthesis:
foamToVTK -fields '(p)'
because the parenthesis are needed for the list that OpenFOAM was complaining that it wasn't finding and the quotes are needed for the shell to not think that this was a sub-shell request.


Facts about "FAQ/Troubleshooting"RDF feed
FaqdescriptionFiguring out what went wrong +
FaqnameTroubleshooting +
Faqnumber8 +