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/coupled/MRFPorousFoam/boundPU.H
2015-05-12 15:01:24 +01:00

32 lines
749 B
C

{
// Bound the pressure
dimensionedScalar p1 = min(p);
dimensionedScalar p2 = max(p);
if (p1 < pMin || p2 > pMax)
{
Info<< "p: " << p1.value() << " " << p2.value()
<< ". Bounding." << endl;
p.max(pMin);
p.min(pMax);
p.correctBoundaryConditions();
}
// Bound the velocity
volScalarField magU = mag(U);
dimensionedScalar U1 = max(magU);
if (U1 > UMax)
{
Info<< "U: " << U1.value() << ". Bounding." << endl;
volScalarField Ulimiter = pos(magU - UMax)*UMax/(magU + smallU)
+ neg(magU - UMax);
Ulimiter.max(scalar(0));
Ulimiter.min(scalar(1));
U *= Ulimiter;
U.correctBoundaryConditions();
}
}