42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
{
|
|
volScalarField rUA("rUA", 1.0/UEqn().A());
|
|
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
|
|
|
|
U = rUA*UEqn().H();
|
|
UEqn.clear();
|
|
|
|
phi = fvc::interpolate(U) & mesh.Sf();
|
|
adjustPhi(phi, U, p);
|
|
|
|
surfaceScalarField buoyancyPhi =
|
|
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
|
|
phi += buoyancyPhi;
|
|
|
|
while (simple.correctNonOrthogonal())
|
|
{
|
|
fvScalarMatrix pEqn
|
|
(
|
|
fvm::laplacian(rUAf, p) == fvc::div(phi)
|
|
);
|
|
|
|
pEqn.setReference(pRefCell, pRefValue);
|
|
|
|
pEqn.solve();
|
|
|
|
if (simple.finalNonOrthogonalIter())
|
|
{
|
|
// Calculate the conservative fluxes
|
|
phi -= pEqn.flux();
|
|
|
|
// Explicitly relax pressure for momentum corrector
|
|
p.relax();
|
|
|
|
// Correct the momentum source with the pressure gradient flux
|
|
// calculated from the relaxed pressure
|
|
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf);
|
|
U.correctBoundaryConditions();
|
|
}
|
|
}
|
|
|
|
#include "continuityErrs.H"
|
|
}
|