Backported interIbFoam, porousSimpleIbFoam and simpleIbFoam (setFluxRequired, solutionControls) to vanilla 3.0.1 format

This commit is contained in:
Vanja Skuric 2016-05-07 10:31:37 +02:00
parent 685dad16cb
commit b99c3261a7
18 changed files with 41 additions and 102 deletions

View file

@ -16,7 +16,7 @@
UEqn.relax();
if (momentumPredictor)
if (pimple.momentumPredictor())
{
solve
(

View file

@ -38,7 +38,7 @@
mesh.schemesDict().setFluxRequired(pcorr.name());
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while(pimple.correctNonOrthogonal())
{
fvScalarMatrix pcorrEqn
(
@ -48,7 +48,7 @@
pcorrEqn.setReference(pdRefCell, pdRefValue);
pcorrEqn.solve();
if (nonOrth == nNonOrthCorr)
if (pimple.finalNonOrthogonalIter())
{
phi -= pcorrEqn.flux();
}

View file

@ -128,6 +128,8 @@
);
}
mesh.schemesDict().setFluxRequired(pd.name());
// Construct interface from alpha1 distribution
interfaceProperties interface(alpha1, U, twoPhaseProperties);

View file

@ -45,6 +45,7 @@ Author
#include "interfaceProperties.H"
#include "twoPhaseMixture.H"
#include "turbulenceModel.H"
#include "pimpleControl.H"
#include "immersedBoundaryFvPatch.H"
#include "immersedBoundaryAdjustPhi.H"
@ -56,8 +57,10 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
pimpleControl pimple(mesh);
# include "readGravitationalAcceleration.H"
# include "readPIMPLEControls.H"
# include "initContinuityErrs.H"
# include "createFields.H"
# include "createIbMasks.H"
@ -72,7 +75,6 @@ int main(int argc, char *argv[])
while (runTime.run())
{
# include "readPIMPLEControls.H"
# include "readTimeControls.H"
# include "immersedBoundaryCourantNo.H"
# include "setDeltaT.H"
@ -82,8 +84,7 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
// Pressure-velocity corrector
int oCorr = 0;
do
while (pimple.loop())
{
twoPhaseProperties.correct();
@ -92,7 +93,7 @@ int main(int argc, char *argv[])
# include "UEqn.H"
// --- PISO loop
for (int corr = 0; corr < nCorr; corr++)
while (pimple.correct())
{
# include "pEqn.H"
}
@ -117,7 +118,7 @@ int main(int argc, char *argv[])
}
turbulence->correct();
} while (++oCorr < nOuterCorr);
}
runTime.write();

View file

@ -1,5 +1,6 @@
{
scalar limitMagU = readScalar(pimple.lookup("limitMagU"));
scalar limitMagU =
readScalar(mesh.solutionDict().subDict("PIMPLE").lookup("limitMagU"));
volScalarField magU(mag(U));

View file

@ -1,5 +1,5 @@
{
if (nOuterCorr != 1)
if (!pimple.firstIter())
{
pd.storePrevIter();
}
@ -29,7 +29,7 @@
)*rUAf*mesh.magSf();
for(int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pdEqn
(
@ -38,23 +38,20 @@
pdEqn.setReference(pdRefCell, pdRefValue);
if (corr == nCorr - 1 && nonOrth == nNonOrthCorr)
{
pdEqn.solve(mesh.solutionDict().solver(pd.name() + "Final"));
}
else
{
pdEqn.solve(mesh.solutionDict().solver(pd.name()));
}
pdEqn.solve
(
mesh.solutionDict().solver(pd.select(pimple.finalInnerIter()))
);
if (nonOrth == nNonOrthCorr)
if (pimple.finalNonOrthogonalIter())
{
phi -= pdEqn.flux();
}
}
// Explicitly relax pressure except for last corrector
if (oCorr != nOuterCorr - 1)
if (!pimple.finalIter())
{
pd.relax();
}

View file

@ -9,9 +9,4 @@
pZones.addResistance(UEqn());
eqnResidual = solve
(
UEqn() == -fvc::grad(p)
).initialResidual();
maxResidual = max(eqnResidual, maxResidual);
solve(UEqn() == -fvc::grad(p));

View file

@ -1,9 +0,0 @@
// check convergence
if (maxResidual < convergenceCriterion)
{
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

View file

@ -32,7 +32,7 @@
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
mesh.schemesDict().setFluxRequired(p.name());
singlePhaseTransportModel laminarTransport(U, phi);

View file

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View file

@ -14,7 +14,7 @@
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -23,18 +23,9 @@
pEqn.setReference(pRefCell, pRefValue);
// Retain the residual from the first iteration
if (nonOrth == 0)
{
eqnResidual = pEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);
}
else
{
pEqn.solve();
}
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}

View file

@ -37,6 +37,7 @@ Author
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "porousZones.H"
#include "simpleControl.H"
#include "immersedBoundaryFvPatch.H"
#include "immersedBoundaryAdjustPhi.H"
@ -48,6 +49,9 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
simpleControl simple(mesh);
# include "createIbMasks.H"
# include "createFields.H"
# include "initContinuityErrs.H"
@ -60,9 +64,6 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H"
# include "initConvergenceCheck.H"
p.storePrevIter();
// Pressure-velocity SIMPLE corrector
@ -78,8 +79,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
# include "convergenceCheck.H"
}
Info<< "End\n" << endl;

View file

@ -7,9 +7,4 @@
UEqn().relax();
eqnResidual = solve
(
UEqn() == -fvc::grad(p)
).initialResidual();
maxResidual = max(eqnResidual, maxResidual);
solve(UEqn() == -fvc::grad(p));

View file

@ -1,9 +0,0 @@
// check convergence
if (maxResidual < convergenceCriterion)
{
Info<< "reached convergence criterion: " << convergenceCriterion << endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

View file

@ -32,7 +32,7 @@
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
mesh.schemesDict().setFluxRequired(p.name());
singlePhaseTransportModel laminarTransport(U, phi);

View file

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View file

@ -14,7 +14,7 @@
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -23,18 +23,9 @@
pEqn.setReference(pRefCell, pRefValue);
// Retain the residual from the first iteration
if (nonOrth == 0)
{
eqnResidual = pEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);
}
else
{
pEqn.solve();
}
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}

View file

@ -36,6 +36,7 @@ Author
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "simpleControl.H"
#include "immersedBoundaryFvPatch.H"
#include "immersedBoundaryAdjustPhi.H"
@ -47,6 +48,9 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
simpleControl simple(mesh);
# include "createIbMasks.H"
# include "createFields.H"
# include "initContinuityErrs.H"
@ -59,9 +63,6 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H"
# include "initConvergenceCheck.H"
p.storePrevIter();
// Pressure-velocity SIMPLE corrector
@ -77,8 +78,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
# include "convergenceCheck.H"
}
Info<< "End\n" << endl;