f206e5ffec
Conflicts: applications/solvers/compressible/steadyCompressibleFoam/pEqn.H
81 lines
1.7 KiB
C
81 lines
1.7 KiB
C
{
|
|
U = UEqn.H()/UEqn.A();
|
|
|
|
# include "limitU.H"
|
|
|
|
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
|
|
{
|
|
// Calculate phi for boundary conditions
|
|
phi = rhof*
|
|
(
|
|
(fvc::interpolate(U) & mesh.Sf())
|
|
- fvc::meshPhi(rho, U)
|
|
);
|
|
|
|
surfaceScalarField phid2 = rhoReff/rhof*phi;
|
|
|
|
surfaceScalarField phid("phid", psisf/rhof*phi);
|
|
|
|
// Store pressure for under-relaxation
|
|
p.storePrevIter();
|
|
|
|
volScalarField divPhid
|
|
(
|
|
"divPhid",
|
|
fvc::div(phid)
|
|
);
|
|
|
|
fvScalarMatrix pEqn
|
|
(
|
|
fvm::ddt(psis, p)
|
|
+ fvm::div(phid, p)
|
|
// Convective flux relaxation terms
|
|
+ fvm::SuSp(-divPhid, p)
|
|
+ divPhid*p
|
|
+ fvc::div(phid2)
|
|
- fvm::laplacian(rho*rUA, 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()));
|
|
}
|
|
|
|
// Calculate the flux
|
|
if (nonOrth == nNonOrthCorr)
|
|
{
|
|
phi = phid2 + 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"
|
|
}
|