mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
PIMPLE: Rationalised loop structure
Automated the caching of "finalIteration".
This commit is contained in:
@ -33,8 +33,8 @@ Description
|
|||||||
#include "hsCombustionThermo.H"
|
#include "hsCombustionThermo.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
#include "combustionModel.H"
|
#include "combustionModel.H"
|
||||||
|
|
||||||
#include "radiationModel.H"
|
#include "radiationModel.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
#include "readPISOControls.H"
|
#include "readPIMPLEControls.H"
|
||||||
#include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
#include "compressibleCourantNo.H"
|
#include "compressibleCourantNo.H"
|
||||||
#include "setDeltaT.H"
|
#include "setDeltaT.H"
|
||||||
@ -68,14 +68,13 @@ int main(int argc, char *argv[])
|
|||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
|
|
||||||
#include "ftEqn.H"
|
#include "ftEqn.H"
|
||||||
@ -86,11 +85,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|||||||
@ -33,7 +33,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
|||||||
p_rgh.select
|
p_rgh.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -45,9 +45,9 @@
|
|||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -89,9 +89,9 @@
|
|||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -36,6 +36,7 @@ Description
|
|||||||
#include "rhoChemistryModel.H"
|
#include "rhoChemistryModel.H"
|
||||||
#include "chemistrySolver.H"
|
#include "chemistrySolver.H"
|
||||||
#include "multivariateScheme.H"
|
#include "multivariateScheme.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -69,14 +70,14 @@ int main(int argc, char *argv[])
|
|||||||
#include "chemistry.H"
|
#include "chemistry.H"
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
for (label oCorr=1; oCorr <= nOuterCorr; oCorr++)
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "YEqn.H"
|
#include "YEqn.H"
|
||||||
#include "hsEqn.H"
|
#include "hsEqn.H"
|
||||||
@ -86,11 +87,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|||||||
@ -37,7 +37,7 @@ if (transonic)
|
|||||||
(
|
(
|
||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
@ -75,7 +75,7 @@ else
|
|||||||
(
|
(
|
||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -38,6 +38,7 @@ Description
|
|||||||
#include "basicPsiThermo.H"
|
#include "basicPsiThermo.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
#include "fvcSmooth.H"
|
#include "fvcSmooth.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
#include "bound.H"
|
#include "bound.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -70,20 +71,21 @@ int main(int argc, char *argv[])
|
|||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p.storePrevIter();
|
||||||
rho.storePrevIter();
|
rho.storePrevIter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "hEqn.H"
|
#include "hEqn.H"
|
||||||
|
|
||||||
@ -92,13 +94,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -37,6 +37,7 @@ Description
|
|||||||
#include "basicPsiThermo.H"
|
#include "basicPsiThermo.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
#include "bound.H"
|
#include "bound.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -64,14 +65,13 @@ int main(int argc, char *argv[])
|
|||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p.storePrevIter();
|
||||||
@ -88,11 +88,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -40,7 +40,7 @@ if (transonic)
|
|||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
@ -81,7 +81,7 @@ else
|
|||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -39,6 +39,7 @@ Description
|
|||||||
#include "bound.H"
|
#include "bound.H"
|
||||||
#include "MRFZones.H"
|
#include "MRFZones.H"
|
||||||
#include "porousZones.H"
|
#include "porousZones.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -69,14 +70,13 @@ int main(int argc, char *argv[])
|
|||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p.storePrevIter();
|
||||||
@ -93,11 +93,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
TEqn.relax();
|
TEqn.relax();
|
||||||
TEqn.solve(mesh.solver(T.select(finalIter)));
|
TEqn.solve();
|
||||||
|
|
||||||
rhok = 1.0 - beta*(T - TRef);
|
rhok = 1.0 - beta*(T - TRef);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
- ghf*fvc::snGrad(rhok)
|
- ghf*fvc::snGrad(rhok)
|
||||||
- fvc::snGrad(p_rgh)
|
- fvc::snGrad(p_rgh)
|
||||||
)*mesh.magSf()
|
)*mesh.magSf()
|
||||||
),
|
)
|
||||||
mesh.solver(U.select(finalIter))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,7 @@ Description
|
|||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "singlePhaseTransportModel.H"
|
#include "singlePhaseTransportModel.H"
|
||||||
#include "RASModel.H"
|
#include "RASModel.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -77,14 +78,13 @@ int main(int argc, char *argv[])
|
|||||||
#include "setDeltaT.H"
|
#include "setDeltaT.H"
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p_rgh.storePrevIter();
|
p_rgh.storePrevIter();
|
||||||
@ -100,11 +100,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
p_rgh.select
|
p_rgh.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
- ghf*fvc::snGrad(rho)
|
- ghf*fvc::snGrad(rho)
|
||||||
- fvc::snGrad(p_rgh)
|
- fvc::snGrad(p_rgh)
|
||||||
)*mesh.magSf()
|
)*mesh.magSf()
|
||||||
),
|
)
|
||||||
mesh.solver(U.select(finalIter))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ Description
|
|||||||
#include "basicRhoThermo.H"
|
#include "basicRhoThermo.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
#include "fixedGradientFvPatchFields.H"
|
#include "fixedGradientFvPatchFields.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -70,14 +71,13 @@ int main(int argc, char *argv[])
|
|||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p_rgh.storePrevIter();
|
p_rgh.storePrevIter();
|
||||||
@ -95,11 +95,6 @@ int main(int argc, char *argv[])
|
|||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
hEqn.relax();
|
hEqn.relax();
|
||||||
hEqn.solve(mesh.solver(h.select(finalIter)));
|
hEqn.solve();
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
p_rgh.select
|
p_rgh.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -27,7 +27,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
|||||||
(
|
(
|
||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
|||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -36,6 +36,7 @@ Description
|
|||||||
#include "singlePhaseTransportModel.H"
|
#include "singlePhaseTransportModel.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
#include "dynamicFvMesh.H"
|
#include "dynamicFvMesh.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -83,15 +84,14 @@ int main(int argc, char *argv[])
|
|||||||
#include "meshCourantNo.H"
|
#include "meshCourantNo.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- PIMPLE loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p.storePrevIter();
|
||||||
@ -106,11 +106,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -35,6 +35,7 @@ Description
|
|||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "singlePhaseTransportModel.H"
|
#include "singlePhaseTransportModel.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -60,14 +61,13 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
p.storePrevIter();
|
p.storePrevIter();
|
||||||
@ -82,11 +82,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -46,6 +46,7 @@ Description
|
|||||||
#include "timeActivatedExplicitSource.H"
|
#include "timeActivatedExplicitSource.H"
|
||||||
#include "SLGThermo.H"
|
#include "SLGThermo.H"
|
||||||
#include "fvcSmooth.H"
|
#include "fvcSmooth.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -87,12 +88,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- PIMPLE loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
#include "addFinalIter.H"
|
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
@ -104,8 +107,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "removeFinalIter.H"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runTime.write())
|
if (runTime.write())
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
(
|
(
|
||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -45,6 +45,7 @@ Description
|
|||||||
#include "timeActivatedExplicitSource.H"
|
#include "timeActivatedExplicitSource.H"
|
||||||
#include "radiationModel.H"
|
#include "radiationModel.H"
|
||||||
#include "SLGThermo.H"
|
#include "SLGThermo.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -89,15 +90,14 @@ int main(int argc, char *argv[])
|
|||||||
#include "chemistry.H"
|
#include "chemistry.H"
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- PIMPLE loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr - 1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "YEqn.H"
|
#include "YEqn.H"
|
||||||
#include "hsEqn.H"
|
#include "hsEqn.H"
|
||||||
@ -107,11 +107,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "pEqn.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|||||||
@ -32,7 +32,7 @@ if (transonic)
|
|||||||
(
|
(
|
||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
@ -71,7 +71,7 @@ else
|
|||||||
(
|
(
|
||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ if (transonic)
|
|||||||
(
|
(
|
||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
@ -71,7 +71,7 @@ else
|
|||||||
(
|
(
|
||||||
p.select
|
p.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -38,6 +38,7 @@ Description
|
|||||||
#include "chemistrySolver.H"
|
#include "chemistrySolver.H"
|
||||||
#include "radiationModel.H"
|
#include "radiationModel.H"
|
||||||
#include "SLGThermo.H"
|
#include "SLGThermo.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -77,15 +78,14 @@ int main(int argc, char *argv[])
|
|||||||
#include "chemistry.H"
|
#include "chemistry.H"
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
// --- PIMPLE loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
#include "YEqn.H"
|
#include "YEqn.H"
|
||||||
#include "hsEqn.H"
|
#include "hsEqn.H"
|
||||||
@ -99,11 +99,6 @@ int main(int argc, char *argv[])
|
|||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runTime.write())
|
if (runTime.write())
|
||||||
|
|||||||
@ -46,6 +46,7 @@ Description
|
|||||||
#include "interfaceProperties.H"
|
#include "interfaceProperties.H"
|
||||||
#include "phaseChangeTwoPhaseMixture.H"
|
#include "phaseChangeTwoPhaseMixture.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -83,10 +84,13 @@ int main(int argc, char *argv[])
|
|||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
|
|
||||||
#include "UEqn.H"
|
#include "UEqn.H"
|
||||||
|
|
||||||
// --- PISO loop
|
// --- PISO loop
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
(
|
(
|
||||||
p_rgh.select
|
p_rgh.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
(
|
(
|
||||||
p_rgh.select
|
p_rgh.select
|
||||||
(
|
(
|
||||||
finalIter
|
pimpleCorr.finalIter()
|
||||||
&& corr == nCorr-1
|
&& corr == nCorr-1
|
||||||
&& nonOrth == nNonOrthCorr
|
&& nonOrth == nNonOrthCorr
|
||||||
)
|
)
|
||||||
|
|||||||
@ -34,6 +34,7 @@ Description
|
|||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "twoPhaseMixture.H"
|
#include "twoPhaseMixture.H"
|
||||||
#include "turbulenceModel.H"
|
#include "turbulenceModel.H"
|
||||||
|
#include "pimpleLoop.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -66,14 +67,13 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
for
|
||||||
|
(
|
||||||
|
pimpleLoop pimpleCorr(mesh, nOuterCorr);
|
||||||
|
pimpleCorr.loop();
|
||||||
|
pimpleCorr++
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
twoPhaseProperties.correct();
|
twoPhaseProperties.correct();
|
||||||
|
|
||||||
#include "alphaEqn.H"
|
#include "alphaEqn.H"
|
||||||
@ -87,11 +87,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
128
src/finiteVolume/cfdTools/general/pimpleLoop/pimpleLoop.H
Normal file
128
src/finiteVolume/cfdTools/general/pimpleLoop/pimpleLoop.H
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::pimpleLoop
|
||||||
|
|
||||||
|
Description
|
||||||
|
PIMPLE loop class to formalise the iteration and automate the handling
|
||||||
|
of the "finalIteration" mesh data entry.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef pimpleLoop_H
|
||||||
|
#define pimpleLoop_H
|
||||||
|
|
||||||
|
#include "fvMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class pimpleLoop Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class pimpleLoop
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to the mesh
|
||||||
|
fvMesh& mesh_;
|
||||||
|
|
||||||
|
//- Number of PIMPLE correctors
|
||||||
|
const int nCorr_;
|
||||||
|
|
||||||
|
//- Current PIMPLE corrector
|
||||||
|
int corr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
pimpleLoop(const pimpleLoop&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const pimpleLoop&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
pimpleLoop(fvMesh& mesh, const int nCorr)
|
||||||
|
:
|
||||||
|
mesh_(mesh),
|
||||||
|
nCorr_(nCorr),
|
||||||
|
corr_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~pimpleLoop()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
bool loop()
|
||||||
|
{
|
||||||
|
if (finalIter())
|
||||||
|
{
|
||||||
|
mesh_.data::add("finalIteration", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return corr_ < nCorr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool finalIter() const
|
||||||
|
{
|
||||||
|
return corr_ == nCorr_-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
void operator++(int)
|
||||||
|
{
|
||||||
|
if (finalIter())
|
||||||
|
{
|
||||||
|
mesh_.data::remove("finalIteration");
|
||||||
|
}
|
||||||
|
|
||||||
|
corr_++;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user