Exercise: Fix a broken case
Sooner or later, every OpenFOAM model stops with an error message. This is normal, even for experienced users. The error messages look scary at first, but they usually tell you quite precisely what is wrong and where. In this exercise, you practice reading them.
Getting the cases
Download broken_cases.zip, move it into the folder HydrothermalFoam_runs in your course folder, and unpack it in a terminal in the container:
cd $HOME/HydrothermalFoam_runs
python -m zipfile -e broken_cases.zip .
cd broken_cases
ls
There are four cases, broken1 to broken4. Each is the cavity case from this lecture with one error in it.
Your task
For each case:
Go into the case directory and run the mesh generator and the solver directly, so that you see the error message in the terminal:
cd broken1 blockMesh icoFoam
Find the block that starts with
--> FOAM FATAL ERRORor--> FOAM FATAL IO ERRORand read it carefully. Does it name a case file, a keyword, or a patch?Open the file in Visual Studio Code, find the error and fix it.
Run
icoFoamagain (andblockMesh, if you changed the mesh) until the case runs to the end. Then go to the next case withcd ../broken2.
For each case, write down what the error message said and what the actual error was. Did the message point directly to the problem?
Tip
The error is not always exactly where the message points. If OpenFOAM complains about a keyword that is clearly there, look at the line before it.
A case that runs without an error message is not necessarily correct. Always check the log, e.g. the Courant number, and look at the results.
If you are stuck, compare your case with the original tutorial.
diffshows all lines that differ:diff -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity .
Do not peek too early, though: reading the error messages is the point of this exercise!