mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated solvers to use simpleControl and pimpleControl
This commit is contained in:
@ -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"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
scalar maxDeltaT
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)
|
||||
pimple.dict().lookupOrDefault<scalar>("maxDeltaT", GREAT)
|
||||
);
|
||||
|
||||
volScalarField rDeltaT
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
{
|
||||
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);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
||||
{
|
||||
tmp<fvScalarMatrix> tpEqn;
|
||||
|
||||
@ -37,7 +37,7 @@ if (transonic)
|
||||
|
||||
tpEqn().solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
if (nonOrth == simple.nNonOrthCorr())
|
||||
{
|
||||
phi == tpEqn().flux();
|
||||
}
|
||||
@ -50,7 +50,7 @@ else
|
||||
|
||||
closedVolume = adjustPhi(phi, U, p);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
||||
{
|
||||
tmp<fvScalarMatrix> tpEqn;
|
||||
|
||||
@ -67,7 +67,7 @@ else
|
||||
|
||||
tpEqn().solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
if (nonOrth == simple.nNonOrthCorr())
|
||||
{
|
||||
phi -= tpEqn().flux();
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ Description
|
||||
#include "RASModel.H"
|
||||
#include "MRFZones.H"
|
||||
#include "thermalPorousZones.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -48,16 +49,16 @@ int main(int argc, char *argv[])
|
||||
#include "createZones.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.loop())
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readSIMPLEControls.H"
|
||||
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
|
||||
|
||||
@ -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
|
||||
@ -33,6 +33,7 @@ Description
|
||||
#include "fvCFD.H"
|
||||
#include "basicPsiThermo.H"
|
||||
#include "RASModel.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,16 +45,16 @@ int main(int argc, char *argv[])
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.loop())
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readSIMPLEControls.H"
|
||||
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
|
||||
|
||||
@ -12,9 +12,9 @@ UEqn.clear();
|
||||
|
||||
bool closedVolume = false;
|
||||
|
||||
if (transonic)
|
||||
if (simple.transonic())
|
||||
{
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
||||
{
|
||||
surfaceScalarField phid
|
||||
(
|
||||
@ -54,7 +54,7 @@ if (transonic)
|
||||
pEqn.solve();
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
if (nonOrth == simple.nNonOrthCorr())
|
||||
{
|
||||
phi == phic + pEqn.flux();
|
||||
}
|
||||
@ -62,7 +62,7 @@ if (transonic)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
||||
{
|
||||
phi = fvc::interpolate(rho*U) & mesh.Sf();
|
||||
closedVolume = adjustPhi(phi, U, p);
|
||||
@ -88,7 +88,7 @@ else
|
||||
}
|
||||
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
if (nonOrth == simple.nNonOrthCorr())
|
||||
{
|
||||
phi += pEqn.flux();
|
||||
}
|
||||
@ -119,7 +119,7 @@ rho = thermo.rho();
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
|
||||
if (!transonic)
|
||||
if (!simple.transonic())
|
||||
{
|
||||
rho.relax();
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ Description
|
||||
#include "RASModel.H"
|
||||
#include "mixedFvPatchFields.H"
|
||||
#include "bound.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -46,20 +47,20 @@ int main(int argc, char *argv[])
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.loop())
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readSIMPLEControls.H"
|
||||
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
|
||||
if (!transonic)
|
||||
if (!simple.transonic())
|
||||
{
|
||||
rho.storePrevIter();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user