2010-08-26 14:22:03 +00:00
|
|
|
rho = thermo.rho();
|
|
|
|
rho = max(rho, rhoMin);
|
|
|
|
rho = min(rho, rhoMax);
|
|
|
|
rho.relax();
|
|
|
|
|
|
|
|
volScalarField rUA = 1.0/UEqn().A();
|
|
|
|
U = rUA*UEqn().H();
|
2010-05-12 13:27:55 +00:00
|
|
|
UEqn.clear();
|
|
|
|
|
2010-08-26 14:22:03 +00:00
|
|
|
bool closedVolume = false;
|
|
|
|
|
2016-05-26 07:42:51 +00:00
|
|
|
if (simple.transonic())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-08-26 14:22:03 +00:00
|
|
|
surfaceScalarField phid
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
2010-08-26 14:22:03 +00:00
|
|
|
"phid",
|
|
|
|
fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
|
2016-05-26 07:42:51 +00:00
|
|
|
while (simple.correctNonOrthogonal())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-08-26 14:22:03 +00:00
|
|
|
fvScalarMatrix pEqn
|
|
|
|
(
|
|
|
|
fvm::div(phid, p)
|
|
|
|
- fvm::laplacian(rho*rUA, p)
|
|
|
|
);
|
|
|
|
|
|
|
|
// Relax the pressure equation to ensure diagonal-dominance
|
2016-05-26 07:42:51 +00:00
|
|
|
pEqn.relax();
|
2010-08-26 14:22:03 +00:00
|
|
|
|
|
|
|
pEqn.setReference(pRefCell, pRefValue);
|
|
|
|
|
2016-05-26 07:42:51 +00:00
|
|
|
pEqn.solve();
|
2010-08-26 14:22:03 +00:00
|
|
|
|
2016-05-26 07:42:51 +00:00
|
|
|
if (simple.finalNonOrthogonalIter())
|
2010-08-26 14:22:03 +00:00
|
|
|
{
|
|
|
|
phi == pEqn.flux();
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
2010-08-26 14:22:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
|
|
|
closedVolume = adjustPhi(phi, U, p);
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2016-05-26 07:42:51 +00:00
|
|
|
while (simple.correctNonOrthogonal())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-08-26 14:22:03 +00:00
|
|
|
fvScalarMatrix pEqn
|
|
|
|
(
|
|
|
|
fvm::laplacian(rho*rUA, p) == fvc::div(phi)
|
|
|
|
);
|
|
|
|
|
|
|
|
pEqn.setReference(pRefCell, pRefValue);
|
|
|
|
|
2016-05-26 07:42:51 +00:00
|
|
|
pEqn.solve();
|
2010-08-26 14:22:03 +00:00
|
|
|
|
2016-05-26 07:42:51 +00:00
|
|
|
if (simple.finalNonOrthogonalIter())
|
2010-08-26 14:22:03 +00:00
|
|
|
{
|
|
|
|
phi -= pEqn.flux();
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-26 14:22:03 +00:00
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
#include "incompressible/continuityErrs.H"
|
|
|
|
|
|
|
|
// Explicitly relax pressure for momentum corrector
|
|
|
|
p.relax();
|
|
|
|
|
2010-08-26 14:22:03 +00:00
|
|
|
U -= rUA*fvc::grad(p);
|
2010-05-12 13:27:55 +00:00
|
|
|
U.correctBoundaryConditions();
|
|
|
|
|
|
|
|
// For closed-volume cases adjust the pressure and density levels
|
|
|
|
// to obey overall mass continuity
|
|
|
|
if (closedVolume)
|
|
|
|
{
|
2010-08-26 14:22:03 +00:00
|
|
|
p += (initialMass - fvc::domainIntegrate(psi*p))
|
|
|
|
/fvc::domainIntegrate(psi);
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-08-26 14:22:03 +00:00
|
|
|
rho = thermo.rho();
|
|
|
|
rho = max(rho, rhoMin);
|
|
|
|
rho = min(rho, rhoMax);
|
2010-05-12 13:27:55 +00:00
|
|
|
rho.relax();
|
|
|
|
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;
|