Commit 12a1e428 authored by Henry Weller's avatar Henry Weller
Browse files

patchInjection: Check for 0-patches

parent cceebf06
...@@ -82,6 +82,13 @@ patchInjection::patchInjection ...@@ -82,6 +82,13 @@ patchInjection::patchInjection
patchInjectedMasses_.setSize(pbm.size(), 0); patchInjectedMasses_.setSize(pbm.size(), 0);
} }
if (!patchIDs_.size())
{
FatalErrorIn("patchInjection::patchInjection")
<< "No patches selected"
<< exit(FatalError);
}
} }
...@@ -100,6 +107,9 @@ void patchInjection::correct ...@@ -100,6 +107,9 @@ void patchInjection::correct
scalarField& diameterToInject scalarField& diameterToInject
) )
{ {
// Do not correct if no patches selected
if (!patchIDs_.size()) return;
const scalarField& delta = owner().delta(); const scalarField& delta = owner().delta();
const scalarField& rho = owner().rho(); const scalarField& rho = owner().rho();
const scalarField& magSf = owner().magSf(); const scalarField& magSf = owner().magSf();
...@@ -160,6 +170,9 @@ void patchInjection::correct ...@@ -160,6 +170,9 @@ void patchInjection::correct
void patchInjection::patchInjectedMassTotals(scalarField& patchMasses) const void patchInjection::patchInjectedMassTotals(scalarField& patchMasses) const
{ {
// Do not correct if no patches selected
if (!patchIDs_.size()) return;
scalarField patchInjectedMasses scalarField patchInjectedMasses
( (
getModelProperty<scalarField> getModelProperty<scalarField>
...@@ -170,7 +183,6 @@ void patchInjection::patchInjectedMassTotals(scalarField& patchMasses) const ...@@ -170,7 +183,6 @@ void patchInjection::patchInjectedMassTotals(scalarField& patchMasses) const
); );
scalarField patchInjectedMassTotals(patchInjectedMasses_); scalarField patchInjectedMassTotals(patchInjectedMasses_);
//combineReduce(patchInjectedMassTotals, plusEqOp<scalarField>());
Pstream::listCombineGather(patchInjectedMassTotals, plusEqOp<scalar>()); Pstream::listCombineGather(patchInjectedMassTotals, plusEqOp<scalar>());
forAll(patchIDs_, pidi) forAll(patchIDs_, pidi)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment