Search code examples
ubuntu-20.04openfoam

"could not find mandatory..." error when trying to run tutorial case in OpenFOAM version 8


I'm trying to learn about OpenFOAM Computational Fluid Dynamics software in order to use it for my undergraduate thesis. I am currently following Joszef Nagy's tutorial to run your first simulation. Everything up to about the 18:30 mark has worked completely fine. Editing initial conditions, timestep, savestep, total run time, and so on have all worked without a hitch. I have navigated to the correct directory, which in his video is /OpenFOAM/OpenFOAM-2.3.0/tutorials/incompressible/icoFoam/elbow_tri but on my installation my path goes /opt/openfoam8/tutorials... and the rest. I first tried to run the command as it was given in the video, which is

fluentMeshToFoam elbow.msh

And the command worked just fine, up until the point it needed to write the changes to constant/polymesh, at which point it gave the error

FOAM FATAL ERROR: 
The parent directory does not allow write permission to the process,
or one of the directories in "/opt/openfoam8/tutorials/incompressible/icoFoam/elbow_tri/constant/polyMesh" did not allow search (execute) permission.

    From function bool Foam::mkDir(const Foam::fileName&, mode_t)
    in file POSIX.C at line 346.

So what i understand happened is it succeeded in creating the mesh, but didn't have the proper permissions to write the mesh file to the constant/polyMesh folder.

With this in mind, I instead tried the command

sudo fluentMeshToFoam elbow.msh

But this time i was given the much shorter error

FOAM FATAL ERROR :
    Could not find mandatory etc entry (mode=ugo)
    'controlDict'

But, this time, it didn't even go through the mesh creation process. I was given this error right out of the gate. Can someone who is familiar with OpenFOAM explain why this is happening? I have had a LOT of problems even trying to get this software installed on my computer, so I'm getting very frustrated at this point and can hardly think straight.

Thanks so much.

NB: I am running Ubuntu version 20.04 LTS and OpenFOAM version 8.


Solution

  • This, and several other problems, can be resolved by running OpenFOAM from the correct folder. After you have installed OpenFOAM, be sure to make a folder in your home directory called OpenFOAM with a sub folder called run, as detailed on their website. To run a tutorial case, copy it from the tutorials folder in your installation and move it to this run folder and run it from there.

    RUNNING OPENFOAM CASES DIRECTLY FROM THE INSTALLATION FOLDER IS A RECIPE FOR DISASTER. DO NOT DO IT.