Commit 656bbf53 authored by andy's avatar andy
Browse files

ENH: Updated solvers to use simpleControl and pimpleControl

parent a1577b8a
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,6 +30,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -41,17 +42,17 @@ int main(int argc, char *argv[])
#include "createMesh.H"
#include "createFields.H"
simpleControl simple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nCalculating temperature distribution\n" << endl;
while (runTime.loop())
while (simple.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H"
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
{
solve
(
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,32 +30,30 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
# include "setRootCase.H"
simpleControl simple(mesh);
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nCalculating scalar transport\n" << endl;
# include "CourantNo.H"
#include "CourantNo.H"
while (runTime.loop())
while (simple.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H"
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
{
solve
(
......
......@@ -59,11 +59,9 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readPIMPLEControls.H"
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
pimple.read();
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
......@@ -79,7 +77,7 @@ int main(int argc, char *argv[])
#include "fuhsEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
for (int corr=0; corr<pimple.nCorr(); corr++)
{
#include "pEqn.H"
}
......
......@@ -15,7 +15,7 @@ surfaceScalarField phiU
phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
{
surfaceScalarField rhorAUf(fvc::interpolate(rho*rAU));
......@@ -28,18 +28,10 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
p_rghEqn.solve
(
mesh.solver
(
p_rgh.select
(
pimple.finalIter()
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth)))
);
if (nonOrth == nNonOrthCorr)
if (nonOrth == pimple.nNonOrthCorr())
{
phi += p_rghEqn.flux();
}
......
......@@ -9,7 +9,7 @@
UEqn.relax();
if (momentumPredictor)
if (pimple.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
}
......@@ -8,7 +8,7 @@
volScalarField rAU(1.0/UEqn.A());
U = rAU*UEqn.H();
if (transonic)
if (pimple.transonic())
{
surfaceScalarField phiv
(
......@@ -30,7 +30,7 @@
+ correction(fvm::ddt(psi, p) + fvm::div(phid, p))
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
{
fvScalarMatrix pEqn
(
......@@ -40,18 +40,10 @@
pEqn.solve
(
mesh.solver
(
p.select
(
pimple.finalIter()
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth)))
);
if (nonOrth == nNonOrthCorr)
if (nonOrth == pimple.nNonOrthCorr())
{
phi += pEqn.flux();
}
......@@ -72,7 +64,7 @@
+ fvc::div(phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
{
fvScalarMatrix pEqn
(
......@@ -82,18 +74,10 @@
pEqn.solve
(
mesh.solver
(
p.select
(
pimple.finalIter()
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth)))
);
if (nonOrth == nNonOrthCorr)
if (nonOrth == pimple.nNonOrthCorr())
{
phi += pEqn.flux();
}
......
......@@ -62,10 +62,8 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPIMPLEControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
pimple.read();
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
......@@ -81,7 +79,7 @@ int main(int argc, char *argv[])
#include "hsEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
for (int corr=1; corr<=pimple.nCorr(); corr++)
{
#include "pEqn.H"
}
......
......@@ -11,7 +11,7 @@ UEqn().relax();
volScalarField rAU(1.0/UEqn().A());
if (momentumPredictor)
if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p));
}
......
......@@ -5,12 +5,12 @@ rho.relax();
U = rAU*UEqn().H();
if (nCorr <= 1)
if (pimple.nCorr() <= 1)
{
UEqn.clear();
}
if (transonic)
if (pimple.transonic())
{
surfaceScalarField phid
(
......@@ -22,7 +22,7 @@ if (transonic)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
{
fvScalarMatrix pEqn
(
......@@ -33,18 +33,10 @@ if (transonic)
pEqn.solve
(
mesh.solver
(
p.select
(
pimple.finalIter()
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth)))
);
if (nonOrth == nNonOrthCorr)
if (nonOrth == pimple.nNonOrthCorr())
{
phi == pEqn.flux();
}
......@@ -59,7 +51,7 @@ else
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
{
// Pressure corrector
fvScalarMatrix pEqn
......@@ -71,18 +63,10 @@ else
pEqn.solve
(
mesh.solver
(
p.select
(
pimple.finalIter()
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth)))
);
if (nonOrth == nNonOrthCorr)
if (nonOrth == pimple.nNonOrthCorr())
{
phi += pEqn.flux();
}
......
......@@ -56,10 +56,8 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPIMPLEControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
pimple.read();
runTime++;
......@@ -70,7 +68,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop
for (pimple.start(); pimple.loop(); pimple++)
{
if (nOuterCorr != 1)
if (pimple.nOuterCorr() != 1)
{
p.storePrevIter();
rho.storePrevIter();
......@@ -80,7 +78,7 @@ int main(int argc, char *argv[])
#include "hEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
for (int corr=0; corr<pimple.nCorr(); corr++)
{
#include "pEqn.H"
}
......
......@@ -50,14 +50,14 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readPIMPLEControls.H"
pimpleControl pimple(mesh);
#include "setInitialrDeltaT.H"
#include "createFields.H"
#include "createZones.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
......@@ -65,10 +65,8 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPIMPLEControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
pimple.read();
runTime++;
......@@ -81,7 +79,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop
for (pimple.start(); pimple.loop(); pimple++)
{
if (nOuterCorr != 1)
if (pimple.nOuterCorr() != 1)
{
p.storePrevIter();
rho.storePrevIter();
......@@ -93,7 +91,7 @@ int main(int argc, char *argv[])
#include "hEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
for (int corr=0; corr<pimple.nCorr(); corr++)
{
#include "pEqn.H"
}
......
scalar maxDeltaT
(
pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)
pimple.dict().lookupOrDefault<scalar>("maxDeltaT", GREAT)
);
volScalarField rDeltaT
......
{
const dictionary& pimpleDict = pimple.dict();
scalar maxCo
(
pimpleDict.lookupOrDefault<scalar>("maxCo", 0.8)
......@@ -29,7 +31,7 @@
/((2*maxCo)*mesh.V()*rho.dimensionedInternalField())
);
if (transonic)
if (pimple.transonic())
{
surfaceScalarField phid
(
......
......@@ -15,7 +15,7 @@ pZones.addResistance(UEqn());
volScalarField rAU(1.0/UEqn().A());
if (momentumPredictor)
if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p));
}
......
......@@ -6,12 +6,12 @@ rho.relax();
volScalarField rAU(1.0/UEqn().A());
U = rAU*UEqn().H();
if (nCorr <= 1)
if (pimple.nCorr() <= 1)
{
UEqn.clear();
}
if (transonic)
if (pimple.transonic())
{
surfaceScalarField phid
(
......@@ -24,7 +24,7 @@ if (transonic)
);
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
{
fvScalarMatrix pEqn
(
......@@ -35,18 +35,10 @@ if (transonic)
pEqn.solve
(
mesh.solver
(
p.select
(
pimple.finalIter()
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth)))
);
if (nonOrth == nNonOrthCorr)
if (nonOrth == pimple.nNonOrthCorr())
{
phi == pEqn.flux();
}
......@@ -62,7 +54,7 @@ else
);
mrfZones.relativeFlux(fvc::interpolate(rho), phi);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
{
// Pressure corrector
fvScalarMatrix pEqn
......@@ -74,18 +66,10 @@ else
pEqn.solve
(
mesh.solver
(
p.select
(
pimple.finalIter()
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth)))
);
if (nonOrth == nNonOrthCorr)
if (nonOrth == pimple.nNonOrthCorr())
{
phi += pEqn.flux();
}
......
......@@ -61,10 +61,8 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPIMPLEControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
pimple.read();
runTime++;
......@@ -75,7 +73,7 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop
for (pimple.start(); pimple.loop(); pimple++)
{
if (nOuterCorr != 1)
if (pimple.nOuterCorr() != 1)
{
p.storePrevIter();
rho.storePrevIter();
......@@ -85,7 +83,7 @@ int main(int argc, char *argv[])
#include "hEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
for (int corr=0; corr<pimple.nCorr(); corr++)
{
#include "pEqn.H"
}
......
......@@ -9,7 +9,7 @@ UEqn.clear();
bool closedVolume = false;
if (transonic)
if (simple.transonic())
{
surfaceScalarField phid
(
......@@ -17,7 +17,7 @@ if (transonic)
fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
{
fvScalarMatrix pEqn
(
......@@ -32,7 +32,7 @@ if (transonic)
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (nonOrth == simple.nNonOrthCorr())
{
phi == pEqn.flux();
}
......@@ -43,7 +43,7 @@ else
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
closedVolume = adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
{
fvScalarMatrix pEqn
(
......@@ -54,7 +54,7 @@ else
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (nonOrth == simple.nNonOrthCorr())
{
phi -= pEqn.flux();
}
......
......@@ -11,7 +11,7 @@ UEqn.clear();
bool closedVolume = false;
if (transonic)
if (simple.transonic())
{
surfaceScalarField phid
(
......@@ -20,7 +20,7 @@ if (transonic)
);
mrfZones.relativeFlux(fvc::interpolate(psi), phid);