CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   Converting patch to wall (

julien.decharentenay November 4, 2010 07:16

Converting patch to wall

Using openFoam v1.7.0

I generate meshes for simpleFoam using Gmsh. The mesh is converted using gmshToFoam. Before running, I have to manually convert some of the boundary conditions from patch to wall in the polyMesh/boundary file.

As I have a number of cases to run, I would like to automate the process. Is there any existing utility that can be employed for that purpose?

Thanks in advance.

wyldckat November 4, 2010 19:45

Hi Julien,

Well, my hunch I told you about in todays email about changeDictionary was right. Based on the tutorial "incompressible/pisoFoam/les/pitzDailyDirectMapped", here is a modified file changeDictionaryDict in the folder system:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.7.1                                |
|  \\  /    A nd          | Web:                      |
|    \\/    M anipulation  |                                                |
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      changeDictionaryDict;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

            type            wall;

// ************************************************************************* //

Then simply run changeDictionary on the case folder and voilá, boundary changed :)
If you search for other changeDictionaryDict files, you'll find more examples.

And here is the online Doxygen help for changeDictionary.C.

Best regards,

Shawn_A October 20, 2011 14:58

I've tried to use the same method change my boundary types, but I'm getting the error:

cannot open file
file: ./rotor/system/fvSchemes at line 0

My directory structure is:


where rotor contains the system & constant directories. changeDictionaryDict is located in the rotor/system folder. While in the vawt directory, I execute:

changeDictionary -case rotor

The only difference between my changeDictionaryDict file and what is show here is the name of my boundary and the type (empty instead of wall). I don't understand why this command is attempting to access fvSchemes. fvSchemes is not included in the system directory.

If I add an fvSchemes file from one of the tutorials, Foam then looks for fvSolution. If I also copy fvSolution, the changeDictionary command is executed properly. Why is it looking for these files?


wyldckat October 20, 2011 16:27

Greetings Shawn,

That is an odd bug indeed. My guess is that the "fv*" files have improper permissions for usage. For example, if you run:

ls -l rotor/system/fvSolution
Do you get something like this:

-rw-r--r-- 1 user user 1774 2011-06-18 00:20 system/fvSolution
In bold are the permissions for User, Group and Others. For more about this see:

Best regards,

Shawn_A October 20, 2011 17:05

Hi Bruno,

The behaviour is a little different that what you're thinking, I probably did not describe it well enough. If I have no fv files and attempt to run
changeDictionary -case rotor

I get the error that fv files cannot be found. This is because I have no fv file to begin with. If I copy and paste ANY fvSchemes and fvSolution files into the system folder, the changeDictionary command runs fine.

What I don't understand is why changeDictionary looks for the fv files in the first place. I don't believe they are necessary for changeDictionary, or are they?


wyldckat October 20, 2011 17:29

Hi Shawn,

:eek: Oooooo... now I get it!

Well, this is OpenFOAM you are dealing with! As soon as an application is this well linked to the libOpenFOAM library, it will then have certain needs. Some of them is just that: the "fv*" files are key markers for an OpenFOAM case. If the case doesn't have such files, then it's not an OpenFOAM case :rolleyes:

Additionally, if you look at the tutorial "tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater", you will see that it is divided into several regions and each region has its own folder inside the "system" folder. And in that case, each region folder also needs its own set of "fv*" files!

Best regards,

Shawn_A October 21, 2011 11:47

Just to report back, changeDictionary requires fvSchemes and fvSolution in the system folder of the directory or region you're trying to perform changeDictionary on. The fvSolution file only requires the header, however, the fvSchemes file needs definitions for only:


Subject to change with(out) notice.


Horus September 5, 2012 05:33


sorry to hijack that old thread, but the topic seems to fit.

Can I also modify like fvSchemes, fvSolution or controlDict using changeDictionary? I try to using the file:

div(phi,U) Gauss linear;

(OF Headers removed). But changeDictionary gives the error:

cannot find file

file: /home/florian/OpenFOAM/cavity/0/fvSchemes at line 0.

Any way to also modify files in the system folder?

wyldckat September 5, 2012 07:35

Hi Florian,

I gave you the answer the other day to your previous question:

Originally Posted by wyldckat (Post 379669)
  • If you want to merge, in the sense of editing the dictionary, then you can use changeDictionary along with the option "-instance":

    changeDictionary -instance system
    This way it will look for the files in the "system" folder.
    For more ideas:

    changeDictionary -help
    find $FOAM_TUTORIALS $FOAM_UTILITIES -name changeDictionaryDict

Best regards,

All times are GMT -4. The time now is 17:08.