55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
label pRefCell = 0;
|
|
scalar pRefValue = 0.0;
|
|
bool pNeedRef = false;
|
|
bool procHasRef = false;
|
|
|
|
if (interface.twoFluids())
|
|
{
|
|
pNeedRef = true;
|
|
}
|
|
|
|
forAll (p.boundaryField(), patchI)
|
|
{
|
|
// Check only fluid B
|
|
if (fluidIndicator.boundaryField()[patchI].size())
|
|
{
|
|
if (min(fluidIndicator.boundaryField()[patchI]) < SMALL)
|
|
{
|
|
if (p.boundaryField()[patchI].fixesValue())
|
|
{
|
|
pNeedRef = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
pNeedRef = returnReduce<bool>(pNeedRef, andOp<bool>());
|
|
|
|
// Find reference cell
|
|
if (pNeedRef)
|
|
{
|
|
point refPointi(mesh.solutionDict().subDict("PIMPLE").lookup("pRefPoint"));
|
|
label refCelli = mesh.findCell(refPointi);
|
|
label hasRef = (refCelli >= 0 ? 1 : 0);
|
|
label sumHasRef = returnReduce<label>(hasRef, sumOp<label>());
|
|
|
|
if (sumHasRef != 1)
|
|
{
|
|
FatalErrorIn(args.executable())
|
|
<< "Unable to set reference cell for field "
|
|
<< p.name()
|
|
<< nl << " Reference point pRefPoint"
|
|
<< " found on " << sumHasRef << " domains (should be one)"
|
|
<< nl << exit(FatalError);
|
|
}
|
|
|
|
if (hasRef)
|
|
{
|
|
pRefCell = refCelli;
|
|
procHasRef = true;
|
|
}
|
|
|
|
pRefValue =
|
|
readScalar(mesh.solutionDict().subDict("PIMPLE").lookup("pRefValue"));
|
|
}
|
|
|