69 lines
1.3 KiB
C
69 lines
1.3 KiB
C
{
|
|
U = UEqn.H()/UEqn.A();
|
|
|
|
# include "limitU.H"
|
|
|
|
surfaceScalarField phid
|
|
(
|
|
"phid",
|
|
fvc::interpolate(psi)*
|
|
(
|
|
(fvc::interpolate(U) & mesh.Sf())
|
|
- fvc::meshPhi(rho, U)
|
|
)
|
|
);
|
|
|
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
|
{
|
|
// Store pressure for under-relaxation
|
|
p.storePrevIter();
|
|
|
|
fvScalarMatrix pEqn
|
|
(
|
|
fvm::ddt(psi, p)
|
|
+ fvm::div(phid, p)
|
|
- fvm::laplacian(rho/UEqn.A(), p)
|
|
);
|
|
|
|
if
|
|
(
|
|
// oCorr == nOuterCorr - 1
|
|
corr == nCorr - 1
|
|
&& nonOrth == nNonOrthCorr
|
|
)
|
|
{
|
|
pEqn.solve
|
|
(
|
|
mesh.solutionDict().solver(p.name() + "Final")
|
|
);
|
|
}
|
|
else
|
|
{
|
|
pEqn.solve(mesh.solutionDict().solver(p.name()));
|
|
}
|
|
|
|
if (nonOrth == nNonOrthCorr)
|
|
{
|
|
phi = pEqn.flux();
|
|
}
|
|
|
|
|
|
// Bound the pressure
|
|
if (min(p) < pMin || max(p) > pMax)
|
|
{
|
|
p.max(pMin);
|
|
p.min(pMax);
|
|
p.correctBoundaryConditions();
|
|
}
|
|
|
|
// Relax the pressure
|
|
p.relax();
|
|
}
|
|
|
|
# include "compressibleContinuityErrs.H"
|
|
|
|
U -= fvc::grad(p)/UEqn.A();
|
|
U.correctBoundaryConditions();
|
|
|
|
# include "limitU.H"
|
|
}
|