diff --git a/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.C b/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.C
index 6137986165792382e8a5871dca8258a7d6adda04..b69ffae4f4c7b4695a5ae797806ccd43d80205a9 100644
--- a/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.C
+++ b/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,6 +25,7 @@ License
 
 #include "patchIdentifier.H"
 #include "dictionary.H"
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -79,6 +80,12 @@ Foam::patchIdentifier::~patchIdentifier()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+bool Foam::patchIdentifier::inGroup(const word& name) const
+{
+    return findIndex(inGroups_, name) != -1;
+}
+
+
 void Foam::patchIdentifier::write(Ostream& os) const
 {
     if (physicalType_.size())
diff --git a/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H b/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H
index cb7d60b7b5b153ba230ccb1b3fe98645ec5d34bd..e54d27673302e5b298e30e7ac8429eded6f92eb6 100644
--- a/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H
+++ b/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -154,6 +154,8 @@ public:
             return inGroups_;
         }
 
+        //- Test if in group
+        bool inGroup(const word&) const;
 
         //- Write patchIdentifier as a dictionary
         void write(Ostream&) const;
diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
index a1935d03684133fe0b5e4d645224389f2f79d430..1e104b4602e43033b178fe6a57c12ef4d8e95c5c 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
@@ -486,6 +486,57 @@ Foam::polyBoundaryMesh::groupPatchIDs() const
 }
 
 
+void Foam::polyBoundaryMesh::setGroup
+(
+    const word& groupName,
+    const labelList& patchIDs
+)
+{
+    groupPatchIDsPtr_.clear();
+
+    polyPatchList& patches = *this;
+
+    boolList donePatch(patches.size(), false);
+
+    // Add to specified patches
+    forAll(patchIDs, i)
+    {
+        label patchI = patchIDs[i];
+        polyPatch& pp = patches[patchI];
+
+        if (!pp.inGroup(groupName))
+        {
+            pp.inGroups().append(groupName);
+        }
+        donePatch[patchI] = true;
+    }
+
+    // Remove from other patches
+    forAll(patches, patchI)
+    {
+        if (!donePatch[patchI])
+        {
+            polyPatch& pp = patches[patchI];
+
+            label newI = 0;
+            if (pp.inGroup(groupName))
+            {
+                wordList& groups = pp.inGroups();
+
+                forAll(groups, i)
+                {
+                    if (groups[i] != groupName)
+                    {
+                        groups[newI++] = groups[i];
+                    }
+                }
+                groups.setSize(newI);
+            }
+        }
+    }
+}
+
+
 Foam::wordList Foam::polyBoundaryMesh::names() const
 {
     const polyPatchList& patches = *this;
diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
index 3878c80b36629d47ca53419442460bdd6ad80c55..1906b422ac5587b14286da9693cfb868faad2f1c 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
@@ -186,6 +186,9 @@ public:
         //- Per patch group the patch indices
         const HashTable<labelList, word>& groupPatchIDs() const;
 
+        //- Set/add group with patches
+        void setGroup(const word& groupName, const labelList& patchIDs);
+
         //- Return the set of patch IDs corresponding to the given names
         //  By default warns if given names are not found. Optionally
         //  matches to patchGroups as well as patchNames