diff --git a/src/functionObjects/field/DMD/DMD.C b/src/functionObjects/field/DMD/DMD.C index d419543586..e67ba80d61 100644 --- a/src/functionObjects/field/DMD/DMD.C +++ b/src/functionObjects/field/DMD/DMD.C @@ -91,22 +91,21 @@ void Foam::functionObjects::DMD::initialise() { const label nComps = nComponents(fieldName_); - if (patch_.empty()) + if (patches_.empty()) { nSnap_ = nComps*mesh_.nCells(); } else { - const label patchi = mesh_.boundaryMesh().findPatchID(patch_); + const labelList patchis + ( + mesh_.boundaryMesh().patchSet(patches_).sortedToc() + ); - if (patchi < 0) + for (const label patchi : patchis) { - FatalErrorInFunction - << "Cannot find patch " << patch_ - << exit(FatalError); + nSnap_ += nComps*(mesh_.C().boundaryField()[patchi]).size(); } - - nSnap_ = nComps*(mesh_.C().boundaryField()[patchi]).size(); } const label nSnapTotal = returnReduce(nSnap_, sumOp