Skip to content

Instantly share code, notes, and snippets.

@robinknowles
Created April 28, 2023 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinknowles/bc289e9f089de9e09ab990aa277500e8 to your computer and use it in GitHub Desktop.
Save robinknowles/bc289e9f089de9e09ab990aa277500e8 to your computer and use it in GitHub Desktop.
How to rename a patch in OpenFOAM using createPatch

How to rename a patch in OpenFOAM using createPatch

Accompanies OnCFD Newsletter #144: How to change a patch name

Outline

Need to rename a patch in a meshed & decomposed case? Do the following...

  • Copy the dictionary below & save it as /system/createPatchDict
  • Edit the name & patches entries to the required names
  • Run createPatch -overwrite in parallel to make the change

See the accompanying article for more info 👋

/system/createPatchDict

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2212                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

pointSync false;

patches
(
    // Example of "renaming" a patch
    // i.e moving faces from an exising patch to a new one
    // repeat this section if you want to "rename" more patches
    {

        // name of our new patch
        name    my_new_patch;

        // build our new patch from an existing one
        constructFrom patches;

        // name of our old patch
        patches (my_old_patch);

        // set basic patch info
        patchInfo
        {
            // patch type for our new patch
            type wall;

            // what groups should our new patch be in (optional)
            inGroups (Group01 Group02);
        }
    }

);

// ************************************************************************* //
@manuelffonseca
Copy link

Thanks Robin, i have installed 2 OF version 2.3 and the last blueCFD version, and i was looking for some like this, avoiding change the patch name manually, I'll try on both version.

@robinknowles
Copy link
Author

robinknowles commented Apr 29, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment