e.g. (fvc::interpolate(HbyA) & mesh.Sf()) -> fvc::flux(HbyA) This removes the need to create an intermediate face-vector field when computing fluxes which is more efficient, reduces the peak storage and improved cache coherency in addition to providing a simpler and cleaner API.
45 lines
1 KiB
C
45 lines
1 KiB
C
{
|
|
volVectorField HbyA("HbyA", Uc);
|
|
HbyA = rAUc*UcEqn.H();
|
|
|
|
surfaceScalarField phiHbyA
|
|
(
|
|
"phiHbyA",
|
|
(
|
|
fvc::flux(HbyA)
|
|
+ alphacf*rAUcf*fvc::ddtCorr(Uc, phic)
|
|
+ phicForces
|
|
)
|
|
);
|
|
|
|
// Update the pressure BCs to ensure flux consistency
|
|
constrainPressure(p, Uc, phiHbyA, rAUcf);
|
|
|
|
// Non-orthogonal pressure corrector loop
|
|
while (pimple.correctNonOrthogonal())
|
|
{
|
|
fvScalarMatrix pEqn
|
|
(
|
|
fvm::laplacian(alphacf*rAUcf, p)
|
|
==
|
|
fvc::ddt(alphac) + fvc::div(alphacf*phiHbyA)
|
|
);
|
|
|
|
pEqn.setReference(pRefCell, pRefValue);
|
|
|
|
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
|
|
|
if (pimple.finalNonOrthogonalIter())
|
|
{
|
|
phic = phiHbyA - pEqn.flux()/alphacf;
|
|
|
|
p.relax();
|
|
|
|
Uc = HbyA
|
|
+ rAUc*fvc::reconstruct((phicForces - pEqn.flux()/alphacf)/rAUcf);
|
|
Uc.correctBoundaryConditions();
|
|
}
|
|
}
|
|
}
|
|
|
|
#include "continuityErrs.H"
|