This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/surfaceTracking/include/setRefCell.H
2013-07-18 10:15:54 +02:00

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("PISO").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("PISO").lookup("pRefValue"));
}