Modified icoFoam, icoDyMFoam and icoDyMSimpleFoam to use solutionControl (vanilla 3.0.1)
This commit is contained in:
parent
0927054bd9
commit
c02b6c1750
9 changed files with 57 additions and 60 deletions
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
mesh.setFluxRequired(pcorr.name());
|
mesh.setFluxRequired(pcorr.name());
|
||||||
|
|
||||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
while (piso.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pcorrEqn
|
fvScalarMatrix pcorrEqn
|
||||||
(
|
(
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
pcorrEqn.setReference(pRefCell, pRefValue);
|
pcorrEqn.setReference(pRefCell, pRefValue);
|
||||||
pcorrEqn.solve();
|
pcorrEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pcorrEqn.flux();
|
phi -= pcorrEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,16 +71,9 @@
|
||||||
zeroGradientFvPatchScalarField::typeName
|
zeroGradientFvPatchScalarField::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool momentumPredictor = piso.momentumPredictor();
|
||||||
|
|
||||||
{
|
{
|
||||||
const dictionary& piso = mesh.solutionDict().subDict("PISO");
|
|
||||||
|
|
||||||
bool momentumPredictor = true;
|
|
||||||
if (piso.found("momentumPredictor"))
|
|
||||||
{
|
|
||||||
momentumPredictor = Switch(piso.lookup("momentumPredictor"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool momentumPredictorSave = momentumPredictor;
|
bool momentumPredictorSave = momentumPredictor;
|
||||||
momentumPredictor = false;
|
momentumPredictor = false;
|
||||||
# include "UEqn.H"
|
# include "UEqn.H"
|
||||||
|
|
|
@ -35,6 +35,7 @@ Author
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "dynamicFvMesh.H"
|
#include "dynamicFvMesh.H"
|
||||||
|
#include "pisoControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -43,6 +44,9 @@ int main(int argc, char *argv[])
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createDynamicFvMesh.H"
|
# include "createDynamicFvMesh.H"
|
||||||
|
|
||||||
|
pisoControl piso(mesh);
|
||||||
|
|
||||||
# include "initContinuityErrs.H"
|
# include "initContinuityErrs.H"
|
||||||
# include "initTotalVolume.H"
|
# include "initTotalVolume.H"
|
||||||
# include "createFields.H"
|
# include "createFields.H"
|
||||||
|
@ -90,7 +94,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// --- PISO loop
|
// --- PISO loop
|
||||||
|
|
||||||
for (int corr = 0; corr < nCorr; corr++)
|
while (piso.correct())
|
||||||
{
|
{
|
||||||
rAU = 1.0/UEqn.A();
|
rAU = 1.0/UEqn.A();
|
||||||
|
|
||||||
|
@ -100,7 +104,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
adjustPhi(phi, U, p);
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
// Non-orthogonal pressure corrector loop
|
||||||
|
while (piso.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
|
@ -109,7 +114,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
if (corr == nCorr - 1 && nonOrth == nNonOrthCorr)
|
if (piso.finalInnerIter())
|
||||||
{
|
{
|
||||||
pEqn.solve(mesh.solutionDict().solver(p.name() + "Final"));
|
pEqn.solve(mesh.solutionDict().solver(p.name() + "Final"));
|
||||||
}
|
}
|
||||||
|
@ -118,7 +123,7 @@ int main(int argc, char *argv[])
|
||||||
pEqn.solve(mesh.solutionDict().solver(p.name()));
|
pEqn.solve(mesh.solutionDict().solver(p.name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
# include "readTimeControls.H"
|
# include "readTimeControls.H"
|
||||||
# include "readPISOControls.H"
|
|
||||||
|
|
||||||
bool correctPhi = false;
|
bool correctPhi
|
||||||
if (piso.found("correctPhi"))
|
(
|
||||||
{
|
piso.dict().lookupOrDefault("correctPhi", false)
|
||||||
correctPhi = Switch(piso.lookup("correctPhi"));
|
);
|
||||||
}
|
|
||||||
|
|
||||||
bool checkMeshCourantNo = false;
|
bool checkMeshCourantNo
|
||||||
if (piso.found("checkMeshCourantNo"))
|
(
|
||||||
{
|
piso.dict().lookupOrDefault("checkMeshCourantNo", false)
|
||||||
checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo"));
|
);
|
||||||
}
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
mesh.setFluxRequired(pcorr.name());
|
mesh.setFluxRequired(pcorr.name());
|
||||||
|
|
||||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
while (piso.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pcorrEqn
|
fvScalarMatrix pcorrEqn
|
||||||
(
|
(
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
pcorrEqn.setReference(pRefCell, pRefValue);
|
pcorrEqn.setReference(pRefCell, pRefValue);
|
||||||
pcorrEqn.solve();
|
pcorrEqn.solve();
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pcorrEqn.flux();
|
phi -= pcorrEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,16 +71,9 @@
|
||||||
zeroGradientFvPatchScalarField::typeName
|
zeroGradientFvPatchScalarField::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool momentumPredictor = piso.momentumPredictor();
|
||||||
|
|
||||||
{
|
{
|
||||||
const dictionary& piso = mesh.solutionDict().subDict("PISO");
|
|
||||||
|
|
||||||
bool momentumPredictor = true;
|
|
||||||
if (piso.found("momentumPredictor"))
|
|
||||||
{
|
|
||||||
momentumPredictor = Switch(piso.lookup("momentumPredictor"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool momentumPredictorSave = momentumPredictor;
|
bool momentumPredictorSave = momentumPredictor;
|
||||||
momentumPredictor = false;
|
momentumPredictor = false;
|
||||||
# include "UEqn.H"
|
# include "UEqn.H"
|
||||||
|
|
|
@ -36,6 +36,7 @@ Author
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "dynamicFvMesh.H"
|
#include "dynamicFvMesh.H"
|
||||||
|
#include "pisoControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -44,6 +45,9 @@ int main(int argc, char *argv[])
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createDynamicFvMesh.H"
|
# include "createDynamicFvMesh.H"
|
||||||
|
|
||||||
|
pisoControl piso(mesh);
|
||||||
|
|
||||||
# include "initContinuityErrs.H"
|
# include "initContinuityErrs.H"
|
||||||
# include "initTotalVolume.H"
|
# include "initTotalVolume.H"
|
||||||
# include "createFields.H"
|
# include "createFields.H"
|
||||||
|
@ -89,7 +93,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// --- SIMPLE loop
|
// --- SIMPLE loop
|
||||||
|
|
||||||
for (int ocorr = 0; ocorr < nOuterCorr; ocorr++)
|
while (piso.correct())
|
||||||
{
|
{
|
||||||
# include "CourantNo.H"
|
# include "CourantNo.H"
|
||||||
|
|
||||||
|
@ -105,7 +109,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
p.storePrevIter();
|
p.storePrevIter();
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
// Non-orthogonal pressure corrector loop
|
||||||
|
while (piso.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
|
@ -114,11 +119,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
if
|
if(piso.finalInnerIter())
|
||||||
(
|
|
||||||
ocorr == nOuterCorr - 1
|
|
||||||
&& nonOrth == nNonOrthCorr
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
pEqn.solve(mesh.solutionDict().solver(p.name() + "Final"));
|
pEqn.solve(mesh.solutionDict().solver(p.name() + "Final"));
|
||||||
}
|
}
|
||||||
|
@ -127,7 +128,7 @@ int main(int argc, char *argv[])
|
||||||
pEqn.solve(mesh.solutionDict().solver(p.name()));
|
pEqn.solve(mesh.solutionDict().solver(p.name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
# include "readTimeControls.H"
|
# include "readTimeControls.H"
|
||||||
# include "readPISOControls.H"
|
|
||||||
|
|
||||||
bool correctPhi = false;
|
bool correctPhi
|
||||||
if (piso.found("correctPhi"))
|
(
|
||||||
{
|
piso.dict().lookupOrDefault("correctPhi", false)
|
||||||
correctPhi = Switch(piso.lookup("correctPhi"));
|
);
|
||||||
}
|
|
||||||
|
|
||||||
bool checkMeshCourantNo = false;
|
bool checkMeshCourantNo
|
||||||
if (piso.found("checkMeshCourantNo"))
|
(
|
||||||
{
|
piso.dict().lookupOrDefault("checkMeshCourantNo", false)
|
||||||
checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo"));
|
);
|
||||||
}
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
|
#include "pisoControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -39,6 +40,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
|
|
||||||
|
pisoControl piso(mesh);
|
||||||
|
|
||||||
# include "createFields.H"
|
# include "createFields.H"
|
||||||
# include "initContinuityErrs.H"
|
# include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
@ -50,7 +54,6 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
|
||||||
# include "CourantNo.H"
|
# include "CourantNo.H"
|
||||||
|
|
||||||
fvVectorMatrix UEqn
|
fvVectorMatrix UEqn
|
||||||
|
@ -63,8 +66,7 @@ int main(int argc, char *argv[])
|
||||||
solve(UEqn == -fvc::grad(p));
|
solve(UEqn == -fvc::grad(p));
|
||||||
|
|
||||||
// --- PISO loop
|
// --- PISO loop
|
||||||
|
while (piso.correct())
|
||||||
for (int corr = 0; corr < nCorr; corr++)
|
|
||||||
{
|
{
|
||||||
volScalarField rUA = 1.0/UEqn.A();
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
|
|
||||||
|
@ -74,7 +76,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
adjustPhi(phi, U, p);
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
// Non-orthogonal pressure corrector loop
|
||||||
|
while (piso.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
|
@ -82,9 +85,17 @@ int main(int argc, char *argv[])
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
pEqn.solve();
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (piso.finalInnerIter())
|
||||||
|
{
|
||||||
|
pEqn.solve(mesh.solutionDict().solver("pFinal"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pEqn.solve();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue