51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
|
|
||
|
if(mesh.moving())
|
||
|
{
|
||
|
// Make the fluxes relative
|
||
|
phi -= fvc::meshPhi(U);
|
||
|
}
|
||
|
|
||
|
# include "CourantNo.H"
|
||
|
|
||
|
fvVectorMatrix UEqn
|
||
|
(
|
||
|
fvm::ddt(U)
|
||
|
+ fvm::div(phi, U)
|
||
|
- fvm::laplacian(nu, U)
|
||
|
);
|
||
|
|
||
|
solve(UEqn == -fvc::grad(p));
|
||
|
|
||
|
// --- PISO loop
|
||
|
volScalarField rUA = 1.0/UEqn.A();
|
||
|
|
||
|
for (int corr=0; corr<nCorr; corr++)
|
||
|
{
|
||
|
U = rUA*UEqn.H();
|
||
|
phi = (fvc::interpolate(U) & mesh.Sf());
|
||
|
|
||
|
adjustPhi(phi, U, p);
|
||
|
|
||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||
|
{
|
||
|
fvScalarMatrix pEqn
|
||
|
(
|
||
|
fvm::laplacian(rUA, p)
|
||
|
== fvc::div(phi)
|
||
|
);
|
||
|
|
||
|
pEqn.setReference(pRefCell, pRefValue);
|
||
|
pEqn.solve();
|
||
|
|
||
|
if (nonOrth == nNonOrthCorr)
|
||
|
{
|
||
|
phi -= pEqn.flux();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# include "continuityErrs.H"
|
||
|
|
||
|
U -= rUA*fvc::grad(p);
|
||
|
U.correctBoundaryConditions();
|
||
|
}
|