Modified icoDyMEngineFoam, icoDyMIbFoam and icoIbFoam to use solutionControl (vanilla 3.0.1)

This commit is contained in:
Vanja Skuric 2016-04-12 11:31:20 +02:00
parent d870fbf964
commit aebf591aef
6 changed files with 36 additions and 34 deletions

View file

@ -28,7 +28,7 @@
mesh.schemesDict().setFluxRequired(pcorr.name()); mesh.schemesDict().setFluxRequired(pcorr.name());
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) while (piso.correctNonOrthogonal())
{ {
fvScalarMatrix pcorrEqn fvScalarMatrix pcorrEqn
( (
@ -38,7 +38,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();
} }

View file

@ -69,16 +69,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"

View file

@ -36,6 +36,7 @@ Author
#include "fvCFD.H" #include "fvCFD.H"
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "engineTime.H" #include "engineTime.H"
#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,6 +46,9 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createEngineTime.H" # include "createEngineTime.H"
# include "createDynamicFvMesh.H" # include "createDynamicFvMesh.H"
pisoControl piso(mesh);
# include "initContinuityErrs.H" # include "initContinuityErrs.H"
# include "createFields.H" # include "createFields.H"
@ -89,7 +93,7 @@ int main(int argc, char *argv[])
// --- PISO loop // --- PISO loop
for (int corr = 0; corr < nCorr; corr++) while (piso.correct())
{ {
rUA = 1.0/UEqn.A(); rUA = 1.0/UEqn.A();
@ -99,7 +103,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
( (
@ -108,7 +113,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"));
} }
@ -117,7 +122,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();
} }

View file

@ -1,8 +1,6 @@
# include "readTimeControls.H" # include "readTimeControls.H"
# include "readPISOControls.H"
bool checkMeshCourantNo = false; bool checkMeshCourantNo
if (piso.found("checkMeshCourantNo")) (
{ piso.dict().lookupOrDefault("checkMeshCourantNo", false)
checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo")); );
}

View file

@ -38,6 +38,7 @@ Author
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "immersedBoundaryFvPatch.H" #include "immersedBoundaryFvPatch.H"
#include "immersedBoundaryAdjustPhi.H" #include "immersedBoundaryAdjustPhi.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,6 +47,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"
pimpleControl pimple(mesh);
# include "createFields.H" # include "createFields.H"
# include "initContinuityErrs.H" # include "initContinuityErrs.H"
@ -68,12 +72,10 @@ int main(int argc, char *argv[])
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U); fvc::makeRelative(phi, U);
# include "readPIMPLEControls.H"
# include "CourantNo.H" # include "CourantNo.H"
// Pressure-velocity corrector // Pressure-velocity corrector
int oCorr = 0; while (pimple.loop())
do
{ {
fvVectorMatrix UEqn fvVectorMatrix UEqn
( (
@ -85,7 +87,7 @@ int main(int argc, char *argv[])
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p));
// --- PISO loop // --- PISO loop
for (int corr = 0; corr < nCorr; corr++) while (pimple.correct())
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rUA = 1.0/UEqn.A();
@ -99,7 +101,8 @@ int main(int argc, char *argv[])
immersedBoundaryAdjustPhi(phi, U); immersedBoundaryAdjustPhi(phi, U);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) // Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
@ -109,7 +112,7 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(); pEqn.solve();
if (nonOrth == nNonOrthCorr) if (pimple.finalNonOrthogonalIter())
{ {
phi -= pEqn.flux(); phi -= pEqn.flux();
} }
@ -123,7 +126,7 @@ int main(int argc, char *argv[])
U -= rUA*fvc::grad(p); U -= rUA*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} while (++oCorr < nOuterCorr); }
runTime.write(); runTime.write();

View file

@ -36,6 +36,7 @@ Author
#include "fvCFD.H" #include "fvCFD.H"
#include "immersedBoundaryFvPatch.H" #include "immersedBoundaryFvPatch.H"
#include "immersedBoundaryAdjustPhi.H" #include "immersedBoundaryAdjustPhi.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,6 +46,9 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
# include "createMesh.H" # include "createMesh.H"
pimpleControl pimple(mesh);
# include "createIbMasks.H" # include "createIbMasks.H"
# include "createFields.H" # include "createFields.H"
# include "initContinuityErrs.H" # include "initContinuityErrs.H"
@ -57,12 +61,10 @@ int main(int argc, char *argv[])
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readPIMPLEControls.H"
# include "CourantNo.H" # include "CourantNo.H"
// Pressure-velocity corrector // Pressure-velocity corrector
int oCorr = 0; while (pimple.loop())
do
{ {
fvVectorMatrix UEqn fvVectorMatrix UEqn
( (
@ -74,7 +76,7 @@ int main(int argc, char *argv[])
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p));
// --- PISO loop // --- PISO loop
for (int corr = 0; corr < nCorr; corr++) while (pimple.correct())
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rUA = 1.0/UEqn.A();
@ -88,7 +90,8 @@ int main(int argc, char *argv[])
immersedBoundaryAdjustPhi(phi, U); immersedBoundaryAdjustPhi(phi, U);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) // Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
@ -98,7 +101,7 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(); pEqn.solve();
if (nonOrth == nNonOrthCorr) if (pimple.finalNonOrthogonalIter())
{ {
phi -= pEqn.flux(); phi -= pEqn.flux();
} }
@ -109,7 +112,7 @@ int main(int argc, char *argv[])
U -= rUA*fvc::grad(p); U -= rUA*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} while (++oCorr < nOuterCorr); }
runTime.write(); runTime.write();