From 6d84054b111775fabe0861885650d8804661da2f Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 5 Jul 2021 15:46:26 +0100 Subject: [PATCH] Warn if no IB patches found --- .../writeIbMasks/writeIbMasks.C | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/applications/utilities/immersedBoundary/writeIbMasks/writeIbMasks.C b/applications/utilities/immersedBoundary/writeIbMasks/writeIbMasks.C index 1ae1cb938..a724ee205 100644 --- a/applications/utilities/immersedBoundary/writeIbMasks/writeIbMasks.C +++ b/applications/utilities/immersedBoundary/writeIbMasks/writeIbMasks.C @@ -39,6 +39,24 @@ Description void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { + bool foundImmersedBoundaryPatch = false; + + forAll (mesh.boundary(), patchI) + { + if (isA(mesh.boundary()[patchI])) + { + foundImmersedBoundaryPatch = true; + } + } + + if (!foundImmersedBoundaryPatch) + { + InfoInFunction + << "Cannot find immersed boundary patch. Exiting" << endl; + + return; + } + Info<< nl << "Calculating gamma" << endl; volScalarField gamma ( @@ -62,7 +80,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) // Collect dead cells labelHashSet deadCellsHash; - + forAll (mesh.boundary(), patchI) { if (isA(mesh.boundary()[patchI])) @@ -133,6 +151,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) // Create dead cells set + if (!deadCellsHash.empty()) { cellSet ( @@ -141,7 +160,12 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) deadCellsHash ).write(); } - + else + { + InfoInFunction + << "Dead cells not found" << endl; + } + // Check consistency of face area vectors Info<< nl << "Calculating divSf" << endl;