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:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "pisoControl.H"
|
||||
#include "nonOrthogonalSolutionControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -76,7 +76,7 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pisoControl potentialFlow(mesh, "potentialFlow");
|
||||
nonOrthogonalSolutionControl potentialFlow(mesh, "potentialFlow");
|
||||
|
||||
#include "createFields.H"
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
// Store momentum to set rhoUf for introduced faces.
|
||||
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"
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -9,5 +7,5 @@ CorrectPhi
|
||||
psi,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
divrhoU(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
@ -11,7 +11,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -105,7 +105,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
// Store momentum to set rhoUf for introduced faces.
|
||||
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"
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ if (!mesh.steady() && !pimple.simpleRho())
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ else
|
||||
turbulence.correct();
|
||||
}
|
||||
|
||||
if (!mesh.steady() && pimples.finalIter())
|
||||
if (!mesh.steady() && pimples.finalPimpleIter())
|
||||
{
|
||||
rho = thermo.rho();
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ if (pimple.consistent())
|
||||
HbyA -= (rAUrel - rAtUrel())*fvc::grad(p);
|
||||
}
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUrelEqn.clear();
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -26,7 +26,7 @@ if (pimple.consistent())
|
||||
HbyA -= (rAU - rAtU())*fvc::grad(p);
|
||||
}
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
Uc,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -7,7 +7,7 @@ volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
divU,
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -20,8 +20,6 @@ if (correctPhi)
|
||||
}
|
||||
else
|
||||
{
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -29,7 +27,7 @@ else
|
||||
p_rgh,
|
||||
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
divU,
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -22,8 +22,6 @@ if (correctPhi)
|
||||
}
|
||||
else
|
||||
{
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -31,7 +29,7 @@ else
|
||||
p_rgh,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p_rgh,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
nonOrthogonalSolutionControl pcorrControl(mesh, pimple.algorithmName());
|
||||
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
@ -7,7 +5,7 @@ CorrectPhi
|
||||
p_gh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU)),
|
||||
geometricZeroField(),
|
||||
pcorrControl
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -2,7 +2,7 @@ rAU = 1.0/UEqn.A();
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_gh));
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
if (pimple.nCorrPiso() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -99,7 +99,7 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
|
||||
@ -1233,7 +1233,7 @@ void Foam::diameterModels::populationBalanceModel::solve()
|
||||
bool solveOnFinalIterOnly =
|
||||
solutionControls.lookupOrDefault<bool>("solveOnFinalIterOnly", false);
|
||||
|
||||
if (!solveOnFinalIterOnly || pimple_.finalIter())
|
||||
if (!solveOnFinalIterOnly || pimple_.finalPimpleIter())
|
||||
{
|
||||
const label nCorr = this->nCorr();
|
||||
const scalar tolerance =
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
mesh.update();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,7 +37,7 @@ namespace Foam
|
||||
|
||||
Foam::pimpleControl::pimpleControl(fvMesh& mesh, const word& algorithmName)
|
||||
:
|
||||
pimpleNoLoopControl(mesh, algorithmName),
|
||||
pimpleNoLoopControl(mesh, algorithmName, *this),
|
||||
pimpleLoop(static_cast<solutionControl&>(*this))
|
||||
{
|
||||
read();
|
||||
@ -91,17 +91,14 @@ bool Foam::pimpleControl::loop()
|
||||
|
||||
if (!pimpleLoop::loop(*this))
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
updateFinal();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
storePrevIterFields();
|
||||
|
||||
if (finalIter())
|
||||
{
|
||||
mesh().data::add("finalIteration", true);
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,7 +27,7 @@ License
|
||||
|
||||
inline bool Foam::pimpleControl::turbCorr() const
|
||||
{
|
||||
return !turbOnFinalIterOnly() || finalIter();
|
||||
return !turbOnFinalIterOnly() || finalPimpleIter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -67,15 +67,13 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
|
||||
{
|
||||
read();
|
||||
|
||||
++ corrPimple_;
|
||||
|
||||
// Handle quit conditions first
|
||||
{
|
||||
// If converged on the last iteration then end the correction loop
|
||||
if (converged_)
|
||||
{
|
||||
Info<< control_.algorithmName() << ": Converged in "
|
||||
<< corrPimple_ - 1 << " iterations" << endl;
|
||||
Info<< control_.algorithmName() << ": Converged in " << corrPimple_
|
||||
<< " iterations" << endl;
|
||||
|
||||
corrPimple_ = 0;
|
||||
converged_ = false;
|
||||
@ -84,7 +82,7 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
|
||||
}
|
||||
|
||||
// If all corrections have been completed then end the correction loop
|
||||
if (corrPimple_ > nCorrPimple_)
|
||||
if (corrPimple_ >= nCorrPimple_)
|
||||
{
|
||||
if (convergence.hasCorrResidualControls() && nCorrPimple_ > 1)
|
||||
{
|
||||
@ -100,6 +98,9 @@ bool Foam::pimpleLoop::loop(correctorConvergenceControl& convergence)
|
||||
}
|
||||
|
||||
// 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
|
||||
// exits next time around
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -99,18 +99,15 @@ public:
|
||||
//- Maximum number of pimple correctors
|
||||
inline label nCorrPimple() const;
|
||||
|
||||
//- Flat to indicate any pimple iteration
|
||||
inline bool anyPimpleIter() const;
|
||||
|
||||
//- Flag to indicate the first pimple iteration
|
||||
inline bool firstPimpleIter() const;
|
||||
|
||||
//- Flag to indicate the last pimple iteration
|
||||
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
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
{
|
||||
return corrPimple_ == 1;
|
||||
@ -39,19 +45,7 @@ inline bool Foam::pimpleLoop::firstPimpleIter() const
|
||||
|
||||
inline bool Foam::pimpleLoop::finalPimpleIter() const
|
||||
{
|
||||
return corrPimple_ >= nCorrPimple_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pimpleLoop::firstIter() const
|
||||
{
|
||||
return firstPimpleIter();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pimpleLoop::finalIter() const
|
||||
{
|
||||
return converged_ || finalPimpleIter();
|
||||
return converged_ || corrPimple_ >= nCorrPimple_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -84,7 +84,7 @@ Foam::pimpleMultiRegionControl::pimpleMultiRegionControl
|
||||
{
|
||||
pimpleControls_.append
|
||||
(
|
||||
new pimpleNoLoopControl(pimpleMeshes[i], algorithmName)
|
||||
new pimpleNoLoopControl(pimpleMeshes[i], algorithmName, *this)
|
||||
);
|
||||
|
||||
allSteady = allSteady && pimpleMeshes[i].steady();
|
||||
@ -95,7 +95,7 @@ Foam::pimpleMultiRegionControl::pimpleMultiRegionControl
|
||||
{
|
||||
solidControls_.append
|
||||
(
|
||||
new solidNoLoopControl(solidMeshes[i], algorithmName)
|
||||
new solidNoLoopControl(solidMeshes[i], algorithmName, *this)
|
||||
);
|
||||
|
||||
allSteady = allSteady && solidMeshes[i].steady();
|
||||
@ -278,11 +278,11 @@ bool Foam::pimpleMultiRegionControl::loop()
|
||||
{
|
||||
forAll(pimpleControls_, i)
|
||||
{
|
||||
pimpleControls_[i].mesh().data::remove("finalIteration");
|
||||
pimpleControls_[i].updateFinal();
|
||||
}
|
||||
forAll(solidControls_, i)
|
||||
{
|
||||
solidControls_[i].mesh().data::remove("finalIteration");
|
||||
solidControls_[i].updateFinal();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -297,16 +297,13 @@ bool Foam::pimpleMultiRegionControl::loop()
|
||||
solidControls_[i].storePrevIterFields();
|
||||
}
|
||||
|
||||
if (finalIter())
|
||||
{
|
||||
forAll(pimpleControls_, i)
|
||||
{
|
||||
pimpleControls_[i].mesh().data::add("finalIteration", true);
|
||||
pimpleControls_[i].updateFinal();
|
||||
}
|
||||
forAll(solidControls_, i)
|
||||
{
|
||||
solidControls_[i].mesh().data::add("finalIteration", true);
|
||||
}
|
||||
solidControls_[i].updateFinal();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,7 +41,7 @@ Foam::pimpleMultiRegionControl::solid(const label i)
|
||||
|
||||
inline bool Foam::pimpleMultiRegionControl::pimpleTurbCorr(const label i) const
|
||||
{
|
||||
return !pimpleControls_[i].turbOnFinalIterOnly() || finalIter();
|
||||
return !pimpleControls_[i].turbOnFinalIterOnly() || finalPimpleIter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,8 @@ namespace Foam
|
||||
Foam::pimpleNoLoopControl::pimpleNoLoopControl
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& algorithmName
|
||||
const word& algorithmName,
|
||||
const pimpleLoop& loop
|
||||
)
|
||||
:
|
||||
pisoControl(mesh, algorithmName),
|
||||
@ -51,6 +52,7 @@ Foam::pimpleNoLoopControl::pimpleNoLoopControl
|
||||
static_cast<singleRegionSolutionControl&>(*this),
|
||||
"outerCorrector"
|
||||
),
|
||||
loop_(loop),
|
||||
simpleRho_(false),
|
||||
turbOnFinalIterOnly_(true)
|
||||
{
|
||||
@ -90,4 +92,12 @@ bool Foam::pimpleNoLoopControl::read()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::pimpleNoLoopControl::isFinal() const
|
||||
{
|
||||
return
|
||||
(!anyPisoIter() && loop_.finalPimpleIter())
|
||||
|| pisoControl::isFinal();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#ifndef pimpleNoLoopControl_H
|
||||
#define pimpleNoLoopControl_H
|
||||
|
||||
#include "pimpleLoop.H"
|
||||
#include "pisoControl.H"
|
||||
#include "singleRegionConvergenceControl.H"
|
||||
#include "singleRegionCorrectorConvergenceControl.H"
|
||||
@ -64,6 +65,9 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- The pimple loop
|
||||
const pimpleLoop& loop_;
|
||||
|
||||
//- Flag to indicate whether to update the density in SIMPLE mode rather
|
||||
// than PISO mode
|
||||
bool simpleRho_;
|
||||
@ -83,8 +87,14 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a mesh and the name of the algorithm
|
||||
pimpleNoLoopControl(fvMesh& mesh, const word& algorithmName);
|
||||
//- Construct from a mesh, the name of the algorithm, and a reference
|
||||
// to the pimple loop
|
||||
pimpleNoLoopControl
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& algorithmName,
|
||||
const pimpleLoop& loop
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -100,6 +110,9 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Flag to indicate whether in final state
|
||||
virtual bool isFinal() const;
|
||||
|
||||
//- Flag to indicate whether to update the density in simple mode
|
||||
inline bool simpleRho() const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,8 +38,8 @@ namespace Foam
|
||||
Foam::pisoControl::pisoControl(fvMesh& mesh, const word& algorithmName)
|
||||
:
|
||||
fluidSolutionControl(mesh, algorithmName),
|
||||
nCorrPISO_(-1),
|
||||
corrPISO_(0)
|
||||
nCorrPiso_(-1),
|
||||
corrPiso_(0)
|
||||
{
|
||||
read();
|
||||
}
|
||||
@ -62,57 +62,37 @@ bool Foam::pisoControl::read()
|
||||
|
||||
const dictionary& solutionDict = dict();
|
||||
|
||||
nCorrPISO_ = solutionDict.lookupOrDefault<label>("nCorrectors", 1);
|
||||
nCorrPiso_ = solutionDict.lookupOrDefault<label>("nCorrectors", 1);
|
||||
|
||||
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()
|
||||
{
|
||||
static bool finalIteration = false;
|
||||
|
||||
read();
|
||||
|
||||
if (corrPISO_ == 0)
|
||||
if (finalPisoIter())
|
||||
{
|
||||
finalIteration =
|
||||
mesh().data::lookupOrDefault<bool>("finalIteration", false);
|
||||
corrPiso_ = 0;
|
||||
|
||||
if (finalIteration)
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
if (finalPISOIter())
|
||||
{
|
||||
corrPISO_ = 0;
|
||||
|
||||
if
|
||||
(
|
||||
!finalIteration
|
||||
&& mesh().data::lookupOrDefault<bool>("finalIteration", false)
|
||||
)
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
corrPISO_++;
|
||||
++ corrPiso_;
|
||||
|
||||
if (finalPISOIter())
|
||||
{
|
||||
mesh().data::add("finalIteration", true);
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::pisoControl
|
||||
|
||||
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.
|
||||
|
||||
SourceFiles
|
||||
@ -58,11 +58,11 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Maximum number of PISO correctors
|
||||
label nCorrPISO_;
|
||||
//- Maximum number of piso correctors
|
||||
label nCorrPiso_;
|
||||
|
||||
//- Current PISO corrector
|
||||
label corrPISO_;
|
||||
//- Current piso corrector
|
||||
label corrPiso_;
|
||||
|
||||
|
||||
public:
|
||||
@ -93,26 +93,29 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Maximum number of PISO correctors
|
||||
inline label nCorrPISO() const;
|
||||
//- Maximum number of piso correctors
|
||||
inline label nCorrPiso() const;
|
||||
|
||||
//- Flag to indicate the first PISO iteration
|
||||
inline bool firstPISOIter() const;
|
||||
//- Flat to indicate any piso iteration
|
||||
inline bool anyPisoIter() const;
|
||||
|
||||
//- Flag to indicate the last PISO iteration
|
||||
inline bool finalPISOIter() const;
|
||||
//- Flag to indicate the first piso iteration
|
||||
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)
|
||||
inline bool finalInnerIter() const;
|
||||
|
||||
//- Return true as the non-orthogonality loop is subsidiary
|
||||
virtual bool nonOrthSubLoop() const;
|
||||
//- Flag to indicate whether in final state
|
||||
virtual bool isFinal() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- PISO loop
|
||||
//- Piso loop
|
||||
bool correct();
|
||||
|
||||
//- Time run loop
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
{
|
||||
return finalNonOrthogonalIter() && finalPISOIter();
|
||||
return finalNonOrthogonalIter() && finalPisoIter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -62,12 +62,6 @@ bool Foam::simpleControl::read()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::simpleControl::nonOrthSubLoop() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::simpleControl::run(Time& time)
|
||||
{
|
||||
read();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,12 +92,6 @@ public:
|
||||
virtual bool read();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return true as the non-orthogonality loop is subsidiary
|
||||
virtual bool nonOrthSubLoop() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Time run loop
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,8 @@ namespace Foam
|
||||
Foam::solidNoLoopControl::solidNoLoopControl
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& algorithmName
|
||||
const word& algorithmName,
|
||||
const pimpleLoop& loop
|
||||
)
|
||||
:
|
||||
nonOrthogonalSolutionControl(mesh, algorithmName),
|
||||
@ -50,7 +51,8 @@ Foam::solidNoLoopControl::solidNoLoopControl
|
||||
(
|
||||
static_cast<singleRegionSolutionControl&>(*this),
|
||||
"outerCorrector"
|
||||
)
|
||||
),
|
||||
loop_(loop)
|
||||
{
|
||||
read();
|
||||
}
|
||||
@ -73,4 +75,10 @@ bool Foam::solidNoLoopControl::read()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::solidNoLoopControl::isFinal() const
|
||||
{
|
||||
return loop_.finalPimpleIter() && finalNonOrthogonalIter();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#define solidNoLoopControl_H
|
||||
|
||||
#include "nonOrthogonalSolutionControl.H"
|
||||
#include "pimpleLoop.H"
|
||||
#include "singleRegionConvergenceControl.H"
|
||||
#include "singleRegionCorrectorConvergenceControl.H"
|
||||
|
||||
@ -56,6 +57,14 @@ class solidNoLoopControl
|
||||
public singleRegionConvergenceControl,
|
||||
public singleRegionCorrectorConvergenceControl
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- The pimple loop
|
||||
const pimpleLoop& loop_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
@ -66,8 +75,14 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a mesh and the name of the algorithm
|
||||
solidNoLoopControl(fvMesh& mesh, const word& algorithmName);
|
||||
//- Construct from a mesh, the name of the algorithm, and a reference
|
||||
// to the pimple loop
|
||||
solidNoLoopControl
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& algorithmName,
|
||||
const pimpleLoop& loop
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -80,6 +95,11 @@ public:
|
||||
|
||||
//- Read controls
|
||||
virtual bool read();
|
||||
|
||||
// Access
|
||||
|
||||
//- Flag to indicate whether in final state
|
||||
virtual bool isFinal() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,8 +42,8 @@ Foam::nonOrthogonalSolutionControl::nonOrthogonalSolutionControl
|
||||
)
|
||||
:
|
||||
singleRegionSolutionControl(mesh, algorithmName),
|
||||
nNonOrthCorr_(-1),
|
||||
nonOrthCorr_(0)
|
||||
nCorrNonOrth_(-1),
|
||||
corrNonOrth_(0)
|
||||
{
|
||||
read();
|
||||
}
|
||||
@ -66,58 +66,29 @@ bool Foam::nonOrthogonalSolutionControl::read()
|
||||
|
||||
const dictionary& solutionDict = dict();
|
||||
|
||||
nNonOrthCorr_ =
|
||||
nCorrNonOrth_ =
|
||||
solutionDict.lookupOrDefault<label>("nNonOrthogonalCorrectors", 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::nonOrthogonalSolutionControl::nonOrthSubLoop() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::nonOrthogonalSolutionControl::correctNonOrthogonal()
|
||||
{
|
||||
static bool finalIteration = false;
|
||||
|
||||
read();
|
||||
|
||||
if (nonOrthCorr_ == 0)
|
||||
{
|
||||
finalIteration =
|
||||
mesh().data::lookupOrDefault<bool>("finalIteration", false);
|
||||
|
||||
if (finalIteration)
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
}
|
||||
}
|
||||
|
||||
if (finalNonOrthogonalIter())
|
||||
{
|
||||
nonOrthCorr_ = 0;
|
||||
corrNonOrth_ = 0;
|
||||
|
||||
if
|
||||
(
|
||||
!finalIteration
|
||||
&& mesh().data::lookupOrDefault<bool>("finalIteration", false)
|
||||
)
|
||||
{
|
||||
mesh().data::remove("finalIteration");
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
nonOrthCorr_++;
|
||||
++ corrNonOrth_;
|
||||
|
||||
if (finalNonOrthogonalIter() && (finalIteration || !nonOrthSubLoop()))
|
||||
{
|
||||
mesh().data::add("finalIteration", true);
|
||||
}
|
||||
updateFinal();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,10 +57,10 @@ protected:
|
||||
// Protected data
|
||||
|
||||
//- Maximum number of non-orthogonal correctors
|
||||
label nNonOrthCorr_;
|
||||
label nCorrNonOrth_;
|
||||
|
||||
//- Current non-orthogonal corrector index
|
||||
label nonOrthCorr_;
|
||||
label corrNonOrth_;
|
||||
|
||||
|
||||
public:
|
||||
@ -92,7 +92,10 @@ public:
|
||||
// Access
|
||||
|
||||
//- 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
|
||||
inline bool firstNonOrthogonalIter() const;
|
||||
@ -103,10 +106,6 @@ public:
|
||||
|
||||
// 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
|
||||
bool correctNonOrthogonal();
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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
|
||||
{
|
||||
return nonOrthCorr_ == 1;
|
||||
return corrNonOrth_ == 1;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::nonOrthogonalSolutionControl::finalNonOrthogonalIter() const
|
||||
{
|
||||
return nonOrthCorr_ > nNonOrthCorr_;
|
||||
return corrNonOrth_ > nCorrNonOrth_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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()
|
||||
{
|
||||
storePrevIterTypeFields<scalar>();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -99,8 +99,15 @@ public:
|
||||
//- Return the solution dictionary
|
||||
virtual const dictionary& dict() const;
|
||||
|
||||
//- Flag to indicate whether in final state
|
||||
virtual bool isFinal() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Update the mesh data for the final state
|
||||
void updateFinal() const;
|
||||
|
||||
//- Store previous iteration for fields
|
||||
void storePrevIterFields();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user