CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Help with OpenFoam (

Eli_Brazil April 8, 2014 10:42

Help with OpenFoam
Hello everyone!
I need some help... I'm a beginner with OpenFoam and I'm trying to do a laminar flow simulation past a cylinder, but I've got a lot of problems. I'll try to explain what I'm doing to see if somebody can help me.

1 - I created a geometry in Salome and created groups by faces, Inlet, Outlet and Wall... My geometry is a cylinder, radius 17,5 mm and height 480mm. Saved.

2 - I created a mesh, using algorithm netgen 1D-2D-3D, Hypotesis netgen 3D parameters... Compute and created a group from geometry, Inlet, Outlet and Wall...

3 - I exported the mesh like .unv archive to tutorial folder... I'm using incompressible and icoFoam... Ok, here begin the problems... When I'm into the folder created to my file in caelinux terminal, I execute ideasUnvToFoam Cylinder1.unv for ex. I get error... I have to copy and paste a "system" folder from the other same case... When I execute again, everything looks fine, but when I checked the folder, I saw that the others necessary files and folders doesn't was created. I tryed copy and edit files of another cases but I always have a problem...

I realy dont know what can i do... Sorry about my "Brazilian" english, I realy hope that you understood me!!!

If somebody help me I'll thank for ever!



blacksquirrel April 8, 2014 10:50

Hi Eli,

So I hope I understood correctly: You have a mesh in *.uns format and are stuck at translating this mesh to the OpenFOAm standard?

So let's try this step by step:
1. you have a working folder ("test") in your run directory, where your cylinder.uns is saved

2. inside this folder you need the subfolders system (copy from e.g. tutorial), constant/polyMesh and 0 (the last two can be empty, I think)

3. execute ideasUnvToFoam

4. when no error messages occur, check the mesh in paraFoam

Eli_Brazil April 8, 2014 11:54

Yes, you understood correctly, but my mesh is *.unv...

I followed the step by step and execute ideasUnvToFoam and no error occured in the caelinux terminal...
I have one doubt, have I to execute blocKmesh and icoFoam before the paraFoam?
Because when I was check the mesh on Paraview occured one error and closed the paraview...
That is the error:

patch type 'patch' not constraint type 'empty'
for patch Wall of field p in file "/home/caelinux/OpenFOAM/caelinux-2.1.0/run/tutorials/incompressible/icoFoam/cylinder1/0/p"

file: /home/caelinux/OpenFOAM/caelinux-2.1.0/run/tutorials/incompressible/icoFoam/cylinder1/0/p::boundaryField::Wall from line 35 to line 35.

From function emptyFvPatchField<Type>::emptyFvPatchField
const fvPatch& p,
const Field<Type>& field,
const dictionary& dict

in file fields/fvPatchFields/constraint/empty/emptyFvPatchField.C at line 100.

FOAM exiting

The problem is in the "p" file in the "0" folder... But I dont know how to edit that file... I think thet openfoam have to generate all the files... Is that correct? The folders are uncompleted...

And thanks for the quick answer!

blacksquirrel April 9, 2014 03:16

Hi Eli,

No you don't need to do blockMesh or icoFoam before paraFoam.
blockMesh is the meshing utility of OpenFoam, so it's a program on its own if you want to build a mesh. But you already have a mesh and just translate it into the correct format for OpenFoam with the "ideasUnvToFoam" utility.

1. to check your mesh you don't need to read the Volume Fields in paraFoam.
So first open paraFoam.
On the left side you see the properties window, where you can choose the mesh parts and the volume fields. uncheck all the volume fields, press the apply button and have a look at your mesh first.

2. Now we can look at the boundary conditions (which is giving you the error message for the 0/p file)
- have a look at constant/polyMesh/boundary
here you see all the boundary patches of your mesh, where you need to define boundary conditions. There are different type of patches (,
inlet and outlets should have the type "patch", walls the type "wall".
OpenFoam can handle only 3D meshes, so if you have a 2D mesh you have "empty" patches (look at the icoFoam/cavity tutorial for this)
- now open the files in your 0 directory. You need to specify boundary conditions for each patch of your mesh. Make sure to use exactly the same names, as in the polyMesh/boundary file.
Take a look at the icoFoam/cavity tutorial as well. Here you see how to set boundary conditions.
For some patch types, you can set only specific boundary conditions (like wall functions only for walls, symmetry conditions only for symmetry-planes etc.)
But you will probably need only fixedValue and zeroGradient for your first try.
(You can switch to more fancy boundary conditions, when you are more familiar with the OpenFoam structure.)

3. Before starting icoFoam, please consult the cavity/tutorial on how to set the controlDict (startTime, endTime, writeControl etc.). Then you can start icoFoam and hopefully everything runs.

blacksquirrel April 9, 2014 09:00

Oh, and I forgot: After converting of your mesh, you should execute "checkMesh". If it says 'Mesh OK.' you can continue with boundary conditions.

All times are GMT -4. The time now is 12:37.