solutionControl: Renaming and improved final logic

The sub-loops of the solution control are now named more consistently,
with ambiguously named methods such as finalIter replaced with ones
like finalPimpleIter, so that it is clear which loop they represent.

In addition, the final logic has been improved so that it restores state
after a sub-iteration, and so that sub-iterations can be used on their
own without an outer iteration in effect. Previously, if the
non-orthogonal loop were used outside of a pimple/piso iteration, the
final iteration would not execute with final settings.
This commit is contained in:
Will Bainbridge
2019-02-11 17:10:38 +00:00
parent 7b1840c7d3
commit 111cdf3a65
54 changed files with 248 additions and 254 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,7 +35,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "pisoControl.H" #include "nonOrthogonalSolutionControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,7 +76,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
pisoControl potentialFlow(mesh, "potentialFlow"); nonOrthogonalSolutionControl potentialFlow(mesh, "potentialFlow");
#include "createFields.H" #include "createFields.H"

View File

@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
} }

View File

@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A());
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
// Store momentum to set rhoUf for introduced faces. // Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU; autoPtr<volVectorField> rhoU;
@ -139,7 +139,7 @@ int main(int argc, char *argv[])
} }
} }
if (pimple.firstIter() && !pimple.simpleRho()) if (pimple.firstPimpleIter() && !pimple.simpleRho())
{ {
#include "rhoEqn.H" #include "rhoEqn.H"
} }

View File

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

View File

@ -11,7 +11,7 @@ volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
} }

View File

@ -11,7 +11,7 @@ volScalarField rAU(1.0/UEqn.A());
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -105,7 +105,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
// Store momentum to set rhoUf for introduced faces. // Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU; autoPtr<volVectorField> rhoU;
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
} }
} }
if (pimple.firstIter() && !pimple.simpleRho()) if (pimple.firstPimpleIter() && !pimple.simpleRho())
{ {
#include "rhoEqn.H" #include "rhoEqn.H"
} }

View File

@ -6,7 +6,7 @@ if (!mesh.steady() && !pimple.simpleRho())
volScalarField rAU("rAU", 1.0/UEqn.A()); volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
} }

View File

@ -24,7 +24,7 @@ else
turbulence.correct(); turbulence.correct();
} }
if (!mesh.steady() && pimples.finalIter()) if (!mesh.steady() && pimples.finalPimpleIter())
{ {
rho = thermo.rho(); rho = thermo.rho();
} }

View File

@ -21,7 +21,7 @@ if (pimple.consistent())
HbyA -= (rAUrel - rAtUrel())*fvc::grad(p); HbyA -= (rAUrel - rAtUrel())*fvc::grad(p);
} }
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUrelEqn.clear(); tUrelEqn.clear();
} }

View File

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

View File

@ -26,7 +26,7 @@ if (pimple.consistent())
HbyA -= (rAU - rAtU())*fvc::grad(p); HbyA -= (rAU - rAtU())*fvc::grad(p);
} }
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
mesh.update(); mesh.update();

View File

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

View File

@ -7,7 +7,7 @@ volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
mesh.update(); mesh.update();

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
mesh.update(); mesh.update();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
mesh.update(); mesh.update();

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
mesh.update(); mesh.update();

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();

View File

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

View File

@ -2,7 +2,7 @@ rAU = 1.0/UEqn.A();
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_gh)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_gh));
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPiso() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -99,7 +99,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();

View File

@ -1233,7 +1233,7 @@ void Foam::diameterModels::populationBalanceModel::solve()
bool solveOnFinalIterOnly = bool solveOnFinalIterOnly =
solutionControls.lookupOrDefault<bool>("solveOnFinalIterOnly", false); solutionControls.lookupOrDefault<bool>("solveOnFinalIterOnly", false);
if (!solveOnFinalIterOnly || pimple_.finalIter()) if (!solveOnFinalIterOnly || pimple_.finalPimpleIter())
{ {
const label nCorr = this->nCorr(); const label nCorr = this->nCorr();
const scalar tolerance = const scalar tolerance =

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
while (pimple.loop()) while (pimple.loop())
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{ {
mesh.update(); mesh.update();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,7 +37,7 @@ namespace Foam
Foam::pimpleControl::pimpleControl(fvMesh& mesh, const word& algorithmName) Foam::pimpleControl::pimpleControl(fvMesh& mesh, const word& algorithmName)
: :
pimpleNoLoopControl(mesh, algorithmName), pimpleNoLoopControl(mesh, algorithmName, *this),
pimpleLoop(static_cast<solutionControl&>(*this)) pimpleLoop(static_cast<solutionControl&>(*this))
{ {
read(); read();
@ -91,17 +91,14 @@ bool Foam::pimpleControl::loop()
if (!pimpleLoop::loop(*this)) if (!pimpleLoop::loop(*this))
{ {
mesh().data::remove("finalIteration"); updateFinal();
return false; return false;
} }
storePrevIterFields(); storePrevIterFields();
if (finalIter()) updateFinal();
{
mesh().data::add("finalIteration", true);
}
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,7 +27,7 @@ License
inline bool Foam::pimpleControl::turbCorr() const inline bool Foam::pimpleControl::turbCorr() const
{ {
return !turbOnFinalIterOnly() || finalIter(); return !turbOnFinalIterOnly() || finalPimpleIter();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,15 +67,13 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
{ {
read(); read();
++ corrPimple_;
// Handle quit conditions first // Handle quit conditions first
{ {
// If converged on the last iteration then end the correction loop // If converged on the last iteration then end the correction loop
if (converged_) if (converged_)
{ {
Info<< control_.algorithmName() << ": Converged in " Info<< control_.algorithmName() << ": Converged in " << corrPimple_
<< corrPimple_ - 1 << " iterations" << endl; << " iterations" << endl;
corrPimple_ = 0; corrPimple_ = 0;
converged_ = false; converged_ = false;
@ -84,7 +82,7 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
} }
// If all corrections have been completed then end the correction loop // If all corrections have been completed then end the correction loop
if (corrPimple_ > nCorrPimple_) if (corrPimple_ >= nCorrPimple_)
{ {
if (convergence.hasCorrResidualControls() && nCorrPimple_ > 1) if (convergence.hasCorrResidualControls() && nCorrPimple_ > 1)
{ {
@ -100,6 +98,9 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
} }
// If we reached here, we are doing another loop // If we reached here, we are doing another loop
++ corrPimple_;
// Set up the next loop
{ {
// If convergence has been reached then set the flag so that the loop // If convergence has been reached then set the flag so that the loop
// exits next time around // exits next time around

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -99,18 +99,15 @@ public:
//- Maximum number of pimple correctors //- Maximum number of pimple correctors
inline label nCorrPimple() const; inline label nCorrPimple() const;
//- Flat to indicate any pimple iteration
inline bool anyPimpleIter() const;
//- Flag to indicate the first pimple iteration //- Flag to indicate the first pimple iteration
inline bool firstPimpleIter() const; inline bool firstPimpleIter() const;
//- Flag to indicate the last pimple iteration //- Flag to indicate the last pimple iteration
inline bool finalPimpleIter() const; inline bool finalPimpleIter() const;
//- Flag to indicate the first iteration
inline bool firstIter() const;
//- Flag to indicate the last iteration
inline bool finalIter() const;
// Evolution // Evolution

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,6 +31,12 @@ inline Foam::label Foam::pimpleLoop::nCorrPimple() const
} }
inline bool Foam::pimpleLoop::anyPimpleIter() const
{
return corrPimple_ != 0;
}
inline bool Foam::pimpleLoop::firstPimpleIter() const inline bool Foam::pimpleLoop::firstPimpleIter() const
{ {
return corrPimple_ == 1; return corrPimple_ == 1;
@ -39,19 +45,7 @@ inline bool Foam::pimpleLoop::firstPimpleIter() const
inline bool Foam::pimpleLoop::finalPimpleIter() const inline bool Foam::pimpleLoop::finalPimpleIter() const
{ {
return corrPimple_ >= nCorrPimple_; return converged_ || corrPimple_ >= nCorrPimple_;
}
inline bool Foam::pimpleLoop::firstIter() const
{
return firstPimpleIter();
}
inline bool Foam::pimpleLoop::finalIter() const
{
return converged_ || finalPimpleIter();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,7 @@ Foam::pimpleMultiRegionControl::pimpleMultiRegionControl
{ {
pimpleControls_.append pimpleControls_.append
( (
new pimpleNoLoopControl(pimpleMeshes[i], algorithmName) new pimpleNoLoopControl(pimpleMeshes[i], algorithmName, *this)
); );
allSteady = allSteady && pimpleMeshes[i].steady(); allSteady = allSteady && pimpleMeshes[i].steady();
@ -95,7 +95,7 @@ Foam::pimpleMultiRegionControl::pimpleMultiRegionControl
{ {
solidControls_.append solidControls_.append
( (
new solidNoLoopControl(solidMeshes[i], algorithmName) new solidNoLoopControl(solidMeshes[i], algorithmName, *this)
); );
allSteady = allSteady && solidMeshes[i].steady(); allSteady = allSteady && solidMeshes[i].steady();
@ -278,11 +278,11 @@ bool Foam::pimpleMultiRegionControl::loop()
{ {
forAll(pimpleControls_, i) forAll(pimpleControls_, i)
{ {
pimpleControls_[i].mesh().data::remove("finalIteration"); pimpleControls_[i].updateFinal();
} }
forAll(solidControls_, i) forAll(solidControls_, i)
{ {
solidControls_[i].mesh().data::remove("finalIteration"); solidControls_[i].updateFinal();
} }
return false; return false;
@ -297,16 +297,13 @@ bool Foam::pimpleMultiRegionControl::loop()
solidControls_[i].storePrevIterFields(); solidControls_[i].storePrevIterFields();
} }
if (finalIter())
{
forAll(pimpleControls_, i) forAll(pimpleControls_, i)
{ {
pimpleControls_[i].mesh().data::add("finalIteration", true); pimpleControls_[i].updateFinal();
} }
forAll(solidControls_, i) forAll(solidControls_, i)
{ {
solidControls_[i].mesh().data::add("finalIteration", true); solidControls_[i].updateFinal();
}
} }
return true; return true;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,7 +41,7 @@ Foam::pimpleMultiRegionControl::solid(const label i)
inline bool Foam::pimpleMultiRegionControl::pimpleTurbCorr(const label i) const inline bool Foam::pimpleMultiRegionControl::pimpleTurbCorr(const label i) const
{ {
return !pimpleControls_[i].turbOnFinalIterOnly() || finalIter(); return !pimpleControls_[i].turbOnFinalIterOnly() || finalPimpleIter();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,8 @@ namespace Foam
Foam::pimpleNoLoopControl::pimpleNoLoopControl Foam::pimpleNoLoopControl::pimpleNoLoopControl
( (
fvMesh& mesh, fvMesh& mesh,
const word& algorithmName const word& algorithmName,
const pimpleLoop& loop
) )
: :
pisoControl(mesh, algorithmName), pisoControl(mesh, algorithmName),
@ -51,6 +52,7 @@ Foam::pimpleNoLoopControl::pimpleNoLoopControl
static_cast<singleRegionSolutionControl&>(*this), static_cast<singleRegionSolutionControl&>(*this),
"outerCorrector" "outerCorrector"
), ),
loop_(loop),
simpleRho_(false), simpleRho_(false),
turbOnFinalIterOnly_(true) turbOnFinalIterOnly_(true)
{ {
@ -90,4 +92,12 @@ bool Foam::pimpleNoLoopControl::read()
} }
bool Foam::pimpleNoLoopControl::isFinal() const
{
return
(!anyPisoIter() && loop_.finalPimpleIter())
|| pisoControl::isFinal();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,6 +38,7 @@ SourceFiles
#ifndef pimpleNoLoopControl_H #ifndef pimpleNoLoopControl_H
#define pimpleNoLoopControl_H #define pimpleNoLoopControl_H
#include "pimpleLoop.H"
#include "pisoControl.H" #include "pisoControl.H"
#include "singleRegionConvergenceControl.H" #include "singleRegionConvergenceControl.H"
#include "singleRegionCorrectorConvergenceControl.H" #include "singleRegionCorrectorConvergenceControl.H"
@ -64,6 +65,9 @@ protected:
// Protected data // Protected data
//- The pimple loop
const pimpleLoop& loop_;
//- Flag to indicate whether to update the density in SIMPLE mode rather //- Flag to indicate whether to update the density in SIMPLE mode rather
// than PISO mode // than PISO mode
bool simpleRho_; bool simpleRho_;
@ -83,8 +87,14 @@ public:
// Constructors // Constructors
//- Construct from a mesh and the name of the algorithm //- Construct from a mesh, the name of the algorithm, and a reference
pimpleNoLoopControl(fvMesh& mesh, const word& algorithmName); // to the pimple loop
pimpleNoLoopControl
(
fvMesh& mesh,
const word& algorithmName,
const pimpleLoop& loop
);
//- Destructor //- Destructor
@ -100,6 +110,9 @@ public:
// Access // Access
//- Flag to indicate whether in final state
virtual bool isFinal() const;
//- Flag to indicate whether to update the density in simple mode //- Flag to indicate whether to update the density in simple mode
inline bool simpleRho() const; inline bool simpleRho() const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,8 +38,8 @@ namespace Foam
Foam::pisoControl::pisoControl(fvMesh& mesh, const word& algorithmName) Foam::pisoControl::pisoControl(fvMesh& mesh, const word& algorithmName)
: :
fluidSolutionControl(mesh, algorithmName), fluidSolutionControl(mesh, algorithmName),
nCorrPISO_(-1), nCorrPiso_(-1),
corrPISO_(0) corrPiso_(0)
{ {
read(); read();
} }
@ -62,57 +62,37 @@ bool Foam::pisoControl::read()
const dictionary& solutionDict = dict(); const dictionary& solutionDict = dict();
nCorrPISO_ = solutionDict.lookupOrDefault<label>("nCorrectors", 1); nCorrPiso_ = solutionDict.lookupOrDefault<label>("nCorrectors", 1);
return true; return true;
} }
bool Foam::pisoControl::nonOrthSubLoop() const bool Foam::pisoControl::isFinal() const
{ {
return true; return
(!anyNonOrthogonalIter() && finalPisoIter())
|| (finalNonOrthogonalIter() && finalPisoIter())
|| (finalNonOrthogonalIter() && !anyPisoIter());
} }
bool Foam::pisoControl::correct() bool Foam::pisoControl::correct()
{ {
static bool finalIteration = false;
read(); read();
if (corrPISO_ == 0) if (finalPisoIter())
{ {
finalIteration = corrPiso_ = 0;
mesh().data::lookupOrDefault<bool>("finalIteration", false);
if (finalIteration) updateFinal();
{
mesh().data::remove("finalIteration");
}
}
if (finalPISOIter())
{
corrPISO_ = 0;
if
(
!finalIteration
&& mesh().data::lookupOrDefault<bool>("finalIteration", false)
)
{
mesh().data::remove("finalIteration");
}
return false; return false;
} }
corrPISO_++; ++ corrPiso_;
if (finalPISOIter()) updateFinal();
{
mesh().data::add("finalIteration", true);
}
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Class
Foam::pisoControl Foam::pisoControl
Description Description
PISO control class. Provides time-loop and PISO-loop control methods. No Piso control class. Provides time-loop and piso-loop control methods. No
convergence checking is done. convergence checking is done.
SourceFiles SourceFiles
@ -58,11 +58,11 @@ protected:
// Protected data // Protected data
//- Maximum number of PISO correctors //- Maximum number of piso correctors
label nCorrPISO_; label nCorrPiso_;
//- Current PISO corrector //- Current piso corrector
label corrPISO_; label corrPiso_;
public: public:
@ -93,26 +93,29 @@ public:
// Access // Access
//- Maximum number of PISO correctors //- Maximum number of piso correctors
inline label nCorrPISO() const; inline label nCorrPiso() const;
//- Flag to indicate the first PISO iteration //- Flat to indicate any piso iteration
inline bool firstPISOIter() const; inline bool anyPisoIter() const;
//- Flag to indicate the last PISO iteration //- Flag to indicate the first piso iteration
inline bool finalPISOIter() const; inline bool firstPisoIter() const;
//- Flag to indicate the last inner iteration (last PISO and last //- Flag to indicate the last piso iteration
inline bool finalPisoIter() const;
//- Flag to indicate the last inner iteration (last piso and last
// non-orthogonal) // non-orthogonal)
inline bool finalInnerIter() const; inline bool finalInnerIter() const;
//- Return true as the non-orthogonality loop is subsidiary //- Flag to indicate whether in final state
virtual bool nonOrthSubLoop() const; virtual bool isFinal() const;
// Evolution // Evolution
//- PISO loop //- Piso loop
bool correct(); bool correct();
//- Time run loop //- Time run loop

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,27 +25,33 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::label Foam::pisoControl::nCorrPISO() const inline Foam::label Foam::pisoControl::nCorrPiso() const
{ {
return nCorrPISO_; return nCorrPiso_;
} }
inline bool Foam::pisoControl::firstPISOIter() const inline bool Foam::pisoControl::anyPisoIter() const
{ {
return corrPISO_ == 1; return corrPiso_ != 0;
} }
inline bool Foam::pisoControl::finalPISOIter() const inline bool Foam::pisoControl::firstPisoIter() const
{ {
return corrPISO_ >= nCorrPISO_; return corrPiso_ == 1;
}
inline bool Foam::pisoControl::finalPisoIter() const
{
return corrPiso_ >= nCorrPiso_;
} }
inline bool Foam::pisoControl::finalInnerIter() const inline bool Foam::pisoControl::finalInnerIter() const
{ {
return finalNonOrthogonalIter() && finalPISOIter(); return finalNonOrthogonalIter() && finalPisoIter();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,12 +62,6 @@ 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

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -92,12 +92,6 @@ public:
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

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,8 @@ namespace Foam
Foam::solidNoLoopControl::solidNoLoopControl Foam::solidNoLoopControl::solidNoLoopControl
( (
fvMesh& mesh, fvMesh& mesh,
const word& algorithmName const word& algorithmName,
const pimpleLoop& loop
) )
: :
nonOrthogonalSolutionControl(mesh, algorithmName), nonOrthogonalSolutionControl(mesh, algorithmName),
@ -50,7 +51,8 @@ Foam::solidNoLoopControl::solidNoLoopControl
( (
static_cast<singleRegionSolutionControl&>(*this), static_cast<singleRegionSolutionControl&>(*this),
"outerCorrector" "outerCorrector"
) ),
loop_(loop)
{ {
read(); read();
} }
@ -73,4 +75,10 @@ bool Foam::solidNoLoopControl::read()
} }
bool Foam::solidNoLoopControl::isFinal() const
{
return loop_.finalPimpleIter() && finalNonOrthogonalIter();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,6 +38,7 @@ SourceFiles
#define solidNoLoopControl_H #define solidNoLoopControl_H
#include "nonOrthogonalSolutionControl.H" #include "nonOrthogonalSolutionControl.H"
#include "pimpleLoop.H"
#include "singleRegionConvergenceControl.H" #include "singleRegionConvergenceControl.H"
#include "singleRegionCorrectorConvergenceControl.H" #include "singleRegionCorrectorConvergenceControl.H"
@ -56,6 +57,14 @@ class solidNoLoopControl
public singleRegionConvergenceControl, public singleRegionConvergenceControl,
public singleRegionCorrectorConvergenceControl public singleRegionCorrectorConvergenceControl
{ {
protected:
// Protected data
//- The pimple loop
const pimpleLoop& loop_;
public: public:
// Static data members // Static data members
@ -66,8 +75,14 @@ public:
// Constructors // Constructors
//- Construct from a mesh and the name of the algorithm //- Construct from a mesh, the name of the algorithm, and a reference
solidNoLoopControl(fvMesh& mesh, const word& algorithmName); // to the pimple loop
solidNoLoopControl
(
fvMesh& mesh,
const word& algorithmName,
const pimpleLoop& loop
);
//- Destructor //- Destructor
@ -80,6 +95,11 @@ public:
//- Read controls //- Read controls
virtual bool read(); virtual bool read();
// Access
//- Flag to indicate whether in final state
virtual bool isFinal() const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,8 +42,8 @@ Foam::nonOrthogonalSolutionControl::nonOrthogonalSolutionControl
) )
: :
singleRegionSolutionControl(mesh, algorithmName), singleRegionSolutionControl(mesh, algorithmName),
nNonOrthCorr_(-1), nCorrNonOrth_(-1),
nonOrthCorr_(0) corrNonOrth_(0)
{ {
read(); read();
} }
@ -66,58 +66,29 @@ bool Foam::nonOrthogonalSolutionControl::read()
const dictionary& solutionDict = dict(); const dictionary& solutionDict = dict();
nNonOrthCorr_ = nCorrNonOrth_ =
solutionDict.lookupOrDefault<label>("nNonOrthogonalCorrectors", 0); solutionDict.lookupOrDefault<label>("nNonOrthogonalCorrectors", 0);
return true; return true;
} }
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; corrNonOrth_ = 0;
if updateFinal();
(
!finalIteration
&& mesh().data::lookupOrDefault<bool>("finalIteration", false)
)
{
mesh().data::remove("finalIteration");
}
return false; return false;
} }
nonOrthCorr_++; ++ corrNonOrth_;
if (finalNonOrthogonalIter() && (finalIteration || !nonOrthSubLoop())) updateFinal();
{
mesh().data::add("finalIteration", true);
}
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,10 +57,10 @@ protected:
// Protected data // Protected data
//- Maximum number of non-orthogonal correctors //- Maximum number of non-orthogonal correctors
label nNonOrthCorr_; label nCorrNonOrth_;
//- Current non-orthogonal corrector index //- Current non-orthogonal corrector index
label nonOrthCorr_; label corrNonOrth_;
public: public:
@ -92,7 +92,10 @@ public:
// Access // Access
//- Maximum number of non-orthogonal correctors //- Maximum number of non-orthogonal correctors
inline label nNonOrthCorr() const; inline label nCorrNonOrth() const;
//- Flat to indicate any non-orthogonal iteration
inline bool anyNonOrthogonalIter() const;
//- Flag to indicate the first non-orthogonal iteration //- Flag to indicate the first non-orthogonal iteration
inline bool firstNonOrthogonalIter() const; inline bool firstNonOrthogonalIter() const;
@ -103,10 +106,6 @@ public:
// 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

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,21 +25,27 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::label Foam::nonOrthogonalSolutionControl::nNonOrthCorr() const inline Foam::label Foam::nonOrthogonalSolutionControl::nCorrNonOrth() const
{ {
return nNonOrthCorr_; return nCorrNonOrth_;
}
inline bool Foam::nonOrthogonalSolutionControl::anyNonOrthogonalIter() const
{
return corrNonOrth_ != 0;
} }
inline bool Foam::nonOrthogonalSolutionControl::firstNonOrthogonalIter() const inline bool Foam::nonOrthogonalSolutionControl::firstNonOrthogonalIter() const
{ {
return nonOrthCorr_ == 1; return corrNonOrth_ == 1;
} }
inline bool Foam::nonOrthogonalSolutionControl::finalNonOrthogonalIter() const inline bool Foam::nonOrthogonalSolutionControl::finalNonOrthogonalIter() const
{ {
return nonOrthCorr_ > nNonOrthCorr_; return corrNonOrth_ > nCorrNonOrth_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -61,6 +61,23 @@ const Foam::dictionary& Foam::singleRegionSolutionControl::dict() const
} }
bool Foam::singleRegionSolutionControl::isFinal() const
{
return false;
}
void Foam::singleRegionSolutionControl::updateFinal() const
{
mesh_.data::remove("finalIteration");
if (isFinal())
{
mesh_.data::add("finalIteration", true);
}
}
void Foam::singleRegionSolutionControl::storePrevIterFields() void Foam::singleRegionSolutionControl::storePrevIterFields()
{ {
storePrevIterTypeFields<scalar>(); storePrevIterTypeFields<scalar>();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -99,8 +99,15 @@ public:
//- Return the solution dictionary //- Return the solution dictionary
virtual const dictionary& dict() const; virtual const dictionary& dict() const;
//- Flag to indicate whether in final state
virtual bool isFinal() const;
// Evolution // Evolution
//- Update the mesh data for the final state
void updateFinal() const;
//- Store previous iteration for fields //- Store previous iteration for fields
void storePrevIterFields(); void storePrevIterFields();
}; };