Further rationalisation of the handling of "Final" solver settings

The selection of the "Final" solver settings is now handled automatically within
the "<equation>.solve()" call and there is no longer any need no provide a bool
argument for specific cases.  This simplifies the solution algorithm loop
structures and ensures consistency in behaviour across all solvers.

All tutorials have been updated to correspond to the now consistent rules.
This commit is contained in:
Henry Weller
2018-11-20 11:28:02 +00:00
parent ee443e201f
commit bcf4e68901
63 changed files with 197 additions and 206 deletions

View File

@ -101,7 +101,7 @@ int main(int argc, char *argv[])
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA) fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
); );
pEqn.solve(piso.finalInnerIter()); pEqn.solve();
phi = phiHbyA - pEqn.flux(); phi = phiHbyA - pEqn.flux();

View File

@ -27,7 +27,7 @@ if (pimple.transonic())
betav*fvOptions(psi, p, rho.name()) betav*fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -57,7 +57,7 @@ else
betav*fvOptions(psi, p, rho.name()) betav*fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -35,7 +35,7 @@ if (pimple.transonic())
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -71,7 +71,7 @@ else
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -29,7 +29,7 @@ if (pimple.transonic())
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -64,7 +64,7 @@ else
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -36,7 +36,7 @@ while (pimple.correctNonOrthogonal())
+ fvOptions(psi, p_rgh, rho.name()) + fvOptions(psi, p_rgh, rho.name())
); );
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -37,7 +37,7 @@ if (pimple.transonic())
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -72,7 +72,7 @@ else
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -49,7 +49,7 @@ if (pimple.transonic())
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -89,7 +89,7 @@ else
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -41,7 +41,7 @@ while (pimple.correctNonOrthogonal())
- fvm::laplacian(rhorAUf, p_rgh) - fvm::laplacian(rhorAUf, p_rgh)
); );
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -1,3 +1,5 @@
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -7,5 +9,5 @@ CorrectPhi
psi, psi,
dimensionedScalar("rAUf", dimTime, 1), dimensionedScalar("rAUf", dimTime, 1),
divrhoU(), divrhoU(),
pimple pcorrControl
); );

View File

@ -54,7 +54,7 @@ if (pimple.transonic())
// Relax the pressure equation to ensure diagonal-dominance // Relax the pressure equation to ensure diagonal-dominance
pEqn.relax(); pEqn.relax();
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -76,7 +76,7 @@ else
{ {
fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAUf, p)); fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAUf, p));
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -65,7 +65,7 @@ if (pimple.transonic())
// Relax the pressure equation to ensure diagonal-dominance // Relax the pressure equation to ensure diagonal-dominance
pEqn.relax(); pEqn.relax();
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -90,7 +90,7 @@ else
{ {
fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAtU, p)); fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAtU, p));
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -114,7 +114,7 @@ int main(int argc, char *argv[])
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(piso.finalInnerIter()); pEqn.solve();
if (piso.finalNonOrthogonalIter()) if (piso.finalNonOrthogonalIter())
{ {
@ -154,7 +154,7 @@ int main(int argc, char *argv[])
fvm::laplacian(rABf, pB) == fvc::div(phiB) fvm::laplacian(rABf, pB) == fvc::div(phiB)
); );
pBEqn.solve(bpiso.finalInnerIter()); pBEqn.solve();
if (bpiso.finalNonOrthogonalIter()) if (bpiso.finalNonOrthogonalIter())
{ {

View File

@ -27,7 +27,7 @@
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -46,7 +46,7 @@ while (pimple.correctNonOrthogonal())
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
} }
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -69,7 +69,7 @@ constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);
pressureControl.refValue() pressureControl.refValue()
); );
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -17,7 +17,7 @@
fvOptions.constrain(hEqn); fvOptions.constrain(hEqn);
hEqn.solve(pimples.finalIter()); hEqn.solve();
fvOptions.correct(h); fvOptions.correct(h);
} }

View File

@ -98,7 +98,7 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(piso.finalInnerIter()); pEqn.solve();
if (piso.finalNonOrthogonalIter()) if (piso.finalNonOrthogonalIter())
{ {

View File

@ -102,7 +102,7 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(piso.finalInnerIter()); pEqn.solve();
if (piso.finalNonOrthogonalIter()) if (piso.finalNonOrthogonalIter())
{ {

View File

@ -40,7 +40,7 @@ while (pimple.correctNonOrthogonal())
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -1,3 +1,5 @@
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -5,7 +7,7 @@ CorrectPhi
p, p,
dimensionedScalar("rAUf", dimTime, 1), dimensionedScalar("rAUf", dimTime, 1),
geometricZeroField(), geometricZeroField(),
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -44,7 +44,7 @@ while (pimple.correctNonOrthogonal())
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -26,7 +26,7 @@ while (piso.correctNonOrthogonal())
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(piso.finalInnerIter()); pEqn.solve();
if (piso.finalNonOrthogonalIter()) if (piso.finalNonOrthogonalIter())
{ {

View File

@ -124,7 +124,7 @@ int main(int argc, char *argv[])
- fvm::laplacian(ghrAUf, h) - fvm::laplacian(ghrAUf, h)
); );
hEqn.solve(pimple.finalInnerIter()); hEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -1,3 +1,5 @@
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
Uc, Uc,
@ -5,7 +7,7 @@ CorrectPhi
p, p,
dimensionedScalar("rAUf", dimTime, 1), dimensionedScalar("rAUf", dimTime, 1),
geometricZeroField(), geometricZeroField(),
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -34,7 +34,7 @@
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -33,7 +33,7 @@ if (pimple.transonic())
+ fvOptions(psi, p, rho.name()) + fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -69,7 +69,7 @@ else
+ fvOptions(psi, p, rho.name()) + fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -46,7 +46,7 @@ while (pimple.correctNonOrthogonal())
- fvm::laplacian(rhorAUf, p_rgh) - fvm::laplacian(rhorAUf, p_rgh)
); );
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -42,7 +42,7 @@ if (pimple.transonic())
+ fvOptions(psi, p, rho.name()) + fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
@ -77,7 +77,7 @@ else
+ fvOptions(psi, p, rho.name()) + fvOptions(psi, p, rho.name())
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -35,7 +35,7 @@
- fvm::laplacian(rhorAUf, p) - fvm::laplacian(rhorAUf, p)
); );
pEqn.solve(pimple.finalInnerIter()); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -107,8 +107,7 @@
solve solve
( (
p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp, p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp
pimple.finalInnerIter()
); );
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())

View File

@ -1,3 +1,5 @@
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -5,7 +7,7 @@ CorrectPhi
p, p,
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
divU, divU,
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -121,8 +121,7 @@
solve solve
( (
p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp, p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp
pimple.finalInnerIter()
); );
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())

View File

@ -86,12 +86,7 @@
phasei++; phasei++;
} }
solve solve(p_rghEqnComp + p_rghEqnIncomp);
(
p_rghEqnComp
+ p_rghEqnIncomp,
pimple.finalInnerIter()
);
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -32,7 +32,7 @@
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -1,3 +1,5 @@
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -5,7 +7,7 @@ CorrectPhi
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(), geometricZeroField(),
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -20,6 +20,8 @@ if (correctPhi)
} }
else else
{ {
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -27,7 +29,7 @@ else
p_rgh, p_rgh,
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
geometricZeroField(), geometricZeroField(),
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -47,7 +47,7 @@
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -1,3 +1,5 @@
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -5,7 +7,7 @@ CorrectPhi
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
divU, divU,
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -22,6 +22,8 @@ if (correctPhi)
} }
else else
{ {
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -29,7 +31,7 @@ else
p_rgh, p_rgh,
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
geometricZeroField(), geometricZeroField(),
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -52,7 +52,7 @@
p_rghEqn.setReference(pRefCell, pRefValue); p_rghEqn.setReference(pRefCell, pRefValue);
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -1,3 +1,5 @@
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -5,7 +7,7 @@ CorrectPhi
p_rgh, p_rgh,
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
geometricZeroField(), geometricZeroField(),
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -229,8 +229,7 @@
// (alpha1/rho1)*pEqnComp1() // (alpha1/rho1)*pEqnComp1()
// + (alpha2/rho2)*pEqnComp2() // + (alpha2/rho2)*pEqnComp2()
// ) + // ) +
pEqnIncomp, pEqnIncomp
pimple.finalInnerIter()
); );
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())

View File

@ -1,3 +1,5 @@
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
CorrectPhi CorrectPhi
( (
U, U,
@ -5,7 +7,7 @@ CorrectPhi
p_gh, p_gh,
surfaceScalarField("rAUf", fvc::interpolate(rAU)), surfaceScalarField("rAUf", fvc::interpolate(rAU)),
geometricZeroField(), geometricZeroField(),
pimple pcorrControl
); );
#include "continuityErrs.H" #include "continuityErrs.H"

View File

@ -36,7 +36,7 @@ while (pimple.correctNonOrthogonal())
p_ghEqn.setReference(p_ghRefCell, p_ghRefValue); p_ghEqn.setReference(p_ghRefCell, p_ghRefValue);
p_ghEqn.solve(pimple.finalInnerIter()); p_ghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -370,11 +370,7 @@ while (pimple.correct())
} }
} }
solve pEqn.solve();
(
pEqn,
pimple.finalInnerIter()
);
} }
// Correct fluxes and velocities on last non-orthogonal iteration // Correct fluxes and velocities on last non-orthogonal iteration

View File

@ -358,11 +358,7 @@ while (pimple.correct())
} }
} }
solve pEqn.solve();
(
pEqn,
pimple.finalInnerIter()
);
} }
// Correct fluxes and velocities on last non-orthogonal iteration // Correct fluxes and velocities on last non-orthogonal iteration

View File

@ -326,11 +326,7 @@ while (pimple.correct())
pEqn += pEqnComp2(); pEqn += pEqnComp2();
} }
solve pEqn.solve();
(
pEqn,
pimple.finalInnerIter()
);
} }
// Correct fluxes and velocities on last non-orthogonal iteration // Correct fluxes and velocities on last non-orthogonal iteration

View File

@ -336,11 +336,7 @@ while (pimple.correct())
pEqn += pEqnComp2(); pEqn += pEqnComp2();
} }
solve pEqn.solve();
(
pEqn,
pimple.finalInnerIter()
);
} }
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())

View File

@ -29,7 +29,7 @@
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(pimple.finalInnerIter()); p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {

View File

@ -311,8 +311,7 @@ while (pimple.correct())
solve solve
( (
pEqnComp1() + pEqnComp2() + pEqnIncomp, pEqnComp1() + pEqnComp2() + pEqnIncomp
pimple.finalInnerIter()
); );
// Correct fluxes and velocities on last non-orthogonal iteration // Correct fluxes and velocities on last non-orthogonal iteration

View File

@ -290,8 +290,7 @@ while (pimple.correct())
solve solve
( (
pEqnComp1() + pEqnComp2() + pEqnIncomp, pEqnComp1() + pEqnComp2() + pEqnIncomp
pimple.finalInnerIter()
); );
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())

View File

@ -34,7 +34,7 @@ License
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "adjustPhi.H" #include "adjustPhi.H"
#include "fvcMeshPhi.H" #include "fvcMeshPhi.H"
#include "pimpleControl.H" #include "nonOrthogonalSolutionControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,7 +46,7 @@ void Foam::CorrectPhi
const volScalarField& p, const volScalarField& p,
const RAUfType& rAUf, const RAUfType& rAUf,
const DivUType& divU, const DivUType& divU,
pimpleControl& pimple nonOrthogonalSolutionControl& pcorrControl
) )
{ {
const fvMesh& mesh = U.mesh(); const fvMesh& mesh = U.mesh();
@ -92,7 +92,7 @@ void Foam::CorrectPhi
mesh.setFluxRequired(pcorr.name()); mesh.setFluxRequired(pcorr.name());
while (pimple.correctNonOrthogonal()) while (pcorrControl.correctNonOrthogonal())
{ {
// Solve for pcorr such that the divergence of the corrected flux // Solve for pcorr such that the divergence of the corrected flux
// matches the divU provided (from previous iteration, time-step...) // matches the divU provided (from previous iteration, time-step...)
@ -103,9 +103,9 @@ void Foam::CorrectPhi
pcorrEqn.setReference(0, 0); pcorrEqn.setReference(0, 0);
pcorrEqn.solve(pimple.finalNonOrthogonalIter()); pcorrEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pcorrControl.finalNonOrthogonalIter())
{ {
phi -= pcorrEqn.flux(); phi -= pcorrEqn.flux();
} }
@ -123,7 +123,7 @@ void Foam::CorrectPhi
const volScalarField& psi, const volScalarField& psi,
const RAUfType& rAUf, const RAUfType& rAUf,
const DivRhoUType& divRhoU, const DivRhoUType& divRhoU,
pimpleControl& pimple nonOrthogonalSolutionControl& pcorrControl
) )
{ {
const fvMesh& mesh = U.mesh(); const fvMesh& mesh = U.mesh();
@ -162,7 +162,7 @@ void Foam::CorrectPhi
mesh.setFluxRequired(pcorr.name()); mesh.setFluxRequired(pcorr.name());
while (pimple.correctNonOrthogonal()) while (pcorrControl.correctNonOrthogonal())
{ {
// Solve for pcorr such that the divergence of the corrected flux // Solve for pcorr such that the divergence of the corrected flux
// matches the divRhoU provided (from previous iteration, time-step...) // matches the divRhoU provided (from previous iteration, time-step...)
@ -175,9 +175,9 @@ void Foam::CorrectPhi
divRhoU divRhoU
); );
pcorrEqn.solve(pimple.finalNonOrthogonalIter()); pcorrEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pcorrControl.finalNonOrthogonalIter())
{ {
phi += pcorrEqn.flux(); phi += pcorrEqn.flux();
} }

View File

@ -48,7 +48,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class pimpleControl; class nonOrthogonalSolutionControl;
//- If the mesh is moving correct the velocity BCs on the moving walls to //- If the mesh is moving correct the velocity BCs on the moving walls to
// ensure the corrected fluxes and velocity are consistent // ensure the corrected fluxes and velocity are consistent
@ -75,7 +75,7 @@ namespace Foam
const volScalarField& p, const volScalarField& p,
const RAUfType& rAUf, const RAUfType& rAUf,
const DivUType& divU, const DivUType& divU,
pimpleControl& pimple nonOrthogonalSolutionControl& pcorrControl
); );
template<class RAUfType, class DivRhoUType> template<class RAUfType, class DivRhoUType>
@ -88,7 +88,7 @@ namespace Foam
const volScalarField& psi, const volScalarField& psi,
const RAUfType& rAUf, const RAUfType& rAUf,
const DivRhoUType& divRhoU, const DivRhoUType& divRhoU,
pimpleControl& pimple nonOrthogonalSolutionControl& pcorrControl
); );
} }

View File

@ -68,17 +68,51 @@ bool Foam::pisoControl::read()
} }
bool Foam::pisoControl::nonOrthSubLoop() const
{
return true;
}
bool Foam::pisoControl::correct() bool Foam::pisoControl::correct()
{ {
static bool finalIteration = false;
read(); read();
if (corrPISO_ == 0)
{
finalIteration =
mesh().data::lookupOrDefault<bool>("finalIteration", false);
if (finalIteration)
{
mesh().data::remove("finalIteration");
}
}
if (finalPISOIter()) if (finalPISOIter())
{ {
corrPISO_ = 0; corrPISO_ = 0;
if
(
!finalIteration
&& mesh().data::lookupOrDefault<bool>("finalIteration", false)
)
{
mesh().data::remove("finalIteration");
}
return false; return false;
} }
++ corrPISO_; corrPISO_++;
if (finalPISOIter())
{
mesh().data::add("finalIteration", true);
}
return true; return true;
} }

View File

@ -90,6 +90,7 @@ public:
//- Read controls //- Read controls
virtual bool read(); virtual bool read();
// Access // Access
//- Maximum number of PISO correctors //- Maximum number of PISO correctors
@ -105,6 +106,9 @@ public:
// non-orthogonal) // non-orthogonal)
inline bool finalInnerIter() const; inline bool finalInnerIter() const;
//- Return true as the non-orthogonality loop is subsidiary
virtual bool nonOrthSubLoop() const;
// Evolution // Evolution

View File

@ -62,6 +62,12 @@ bool Foam::simpleControl::read()
} }
bool Foam::simpleControl::nonOrthSubLoop() const
{
return true;
}
bool Foam::simpleControl::run(Time& time) bool Foam::simpleControl::run(Time& time)
{ {
read(); read();

View File

@ -91,6 +91,13 @@ public:
//- Read controls //- Read controls
virtual bool read(); virtual bool read();
// Access
//- Return true as the non-orthogonality loop is subsidiary
virtual bool nonOrthSubLoop() const;
// Evolution // Evolution
//- Time run loop //- Time run loop

View File

@ -73,17 +73,51 @@ bool Foam::nonOrthogonalSolutionControl::read()
} }
bool Foam::nonOrthogonalSolutionControl::nonOrthSubLoop() const
{
return false;
}
bool Foam::nonOrthogonalSolutionControl::correctNonOrthogonal() bool Foam::nonOrthogonalSolutionControl::correctNonOrthogonal()
{ {
static bool finalIteration = false;
read(); read();
if (nonOrthCorr_ == 0)
{
finalIteration =
mesh().data::lookupOrDefault<bool>("finalIteration", false);
if (finalIteration)
{
mesh().data::remove("finalIteration");
}
}
if (finalNonOrthogonalIter()) if (finalNonOrthogonalIter())
{ {
nonOrthCorr_ = 0; nonOrthCorr_ = 0;
if
(
!finalIteration
&& mesh().data::lookupOrDefault<bool>("finalIteration", false)
)
{
mesh().data::remove("finalIteration");
}
return false; return false;
} }
++ nonOrthCorr_; nonOrthCorr_++;
if (finalNonOrthogonalIter() && (finalIteration || !nonOrthSubLoop()))
{
mesh().data::add("finalIteration", true);
}
return true; return true;
} }

View File

@ -88,6 +88,7 @@ public:
//- Read controls //- Read controls
virtual bool read(); virtual bool read();
// Access // Access
//- Maximum number of non-orthogonal correctors //- Maximum number of non-orthogonal correctors
@ -99,8 +100,13 @@ public:
//- Flag to indicate the last non-orthogonal iteration //- Flag to indicate the last non-orthogonal iteration
inline bool finalNonOrthogonalIter() const; inline bool finalNonOrthogonalIter() const;
// Evolution // Evolution
//- Return true if the non-orthogonality loop is a subsidiary
// i.e. a sub-loop of the PISO or PIMPLE algorithms
virtual bool nonOrthSubLoop() const;
//- Non-orthogonal corrector loop //- Non-orthogonal corrector loop
bool correctNonOrthogonal(); bool correctNonOrthogonal();
}; };

View File

@ -406,15 +406,6 @@ public:
// Solver controls read from fvSolution // Solver controls read from fvSolution
SolverPerformance<Type> solve(const word& name); SolverPerformance<Type> solve(const word& name);
//- Solve segregated or coupled returning the solution statistics.
// Solver controls read from fvSolution
// Required to avoid ambiguity from char* -> bool conversion
SolverPerformance<Type> solve(const char* name);
//- Solve returning the solution statistics.
// Solver controls read from fvSolution
SolverPerformance<Type> solve(const bool final);
//- Solve returning the solution statistics. //- Solve returning the solution statistics.
// Solver controls read from fvSolution // Solver controls read from fvSolution
SolverPerformance<Type> solve(); SolverPerformance<Type> solve();
@ -567,12 +558,6 @@ void checkMethod
template<class Type> template<class Type>
SolverPerformance<Type> solve(fvMatrix<Type>&, const word&); SolverPerformance<Type> solve(fvMatrix<Type>&, const word&);
//- Solve returning the solution statistics given convergence tolerance
// Use the given solver controls
// Required to avoid ambiguity from char* -> bool conversion
template<class Type>
SolverPerformance<Type> solve(fvMatrix<Type>&, const char*);
//- Solve returning the solution statistics given convergence tolerance, //- Solve returning the solution statistics given convergence tolerance,
// deleting temporary matrix after solution. // deleting temporary matrix after solution.
// Use the given solver controls // Use the given solver controls
@ -583,28 +568,6 @@ SolverPerformance<Type> solve
const word& const word&
); );
//- Solve returning the solution statistics given convergence tolerance,
// deleting temporary matrix after solution.
// Use the given solver controls
// Required to avoid ambiguity from char* -> bool conversion
template<class Type>
SolverPerformance<Type> solve
(
const tmp<fvMatrix<Type>>&,
const char*
);
//- Solve returning the solution statistics given convergence tolerance
// Solver controls read fvSolution
template<class Type>
SolverPerformance<Type> solve(fvMatrix<Type>&, const bool final);
//- Solve returning the solution statistics given convergence tolerance,
// deleting temporary matrix after solution.
// Solver controls read fvSolution
template<class Type>
SolverPerformance<Type> solve(const tmp<fvMatrix<Type>>&, const bool final);
//- Solve returning the solution statistics given convergence tolerance //- Solve returning the solution statistics given convergence tolerance
// Solver controls read fvSolution // Solver controls read fvSolution
template<class Type> template<class Type>

View File

@ -326,30 +326,22 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve(const word& name)
} }
template<class Type>
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve(const char* name)
{
return solve(word(name));
}
template<class Type>
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve(const bool final)
{
return solve(psi_.mesh().solverDict(psi_.select(final)));
}
template<class Type> template<class Type>
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve() Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve()
{ {
return solve return solve
(
psi_.mesh().solverDict
(
psi_.select
( (
psi_.mesh().data::template lookupOrDefault<bool> psi_.mesh().data::template lookupOrDefault<bool>
( (
"finalIteration", "finalIteration",
false false
) )
)
)
); );
} }
@ -406,17 +398,6 @@ Foam::SolverPerformance<Type> Foam::solve
} }
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
fvMatrix<Type>& fvm,
const char* name
)
{
return fvm.solve(name);
}
template<class Type> template<class Type>
Foam::SolverPerformance<Type> Foam::solve Foam::SolverPerformance<Type> Foam::solve
( (
@ -433,44 +414,6 @@ Foam::SolverPerformance<Type> Foam::solve
} }
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
const tmp<fvMatrix<Type>>& tfvm,
const char* name
)
{
SolverPerformance<Type> solverPerf =
const_cast<fvMatrix<Type>&>(tfvm()).solve(name);
tfvm.clear();
return solverPerf;
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve(fvMatrix<Type>& fvm, const bool final)
{
return fvm.solve(final);
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
const tmp<fvMatrix<Type>>& tfvm,
const bool final
)
{
SolverPerformance<Type> solverPerf =
const_cast<fvMatrix<Type>&>(tfvm()).solve(final);
tfvm.clear();
return solverPerf;
}
template<class Type> template<class Type>
Foam::SolverPerformance<Type> Foam::solve(fvMatrix<Type>& fvm) Foam::SolverPerformance<Type> Foam::solve(fvMatrix<Type>& fvm)
{ {

View File

@ -17,7 +17,7 @@ FoamFile
solvers solvers
{ {
p "p.*"
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;

View File

@ -44,7 +44,7 @@ solvers
relTol 0; relTol 0;
} }
"(U|B)" "(U|B).*"
{ {
solver smoothSolver; solver smoothSolver;
smoother symGaussSeidel; smoother symGaussSeidel;