Backported (solutionControl) channelFoam, nonNewtonianIcoFoam, pisoFoam, shallowWaterFoam solvers to OF 3.0.1 format
This commit is contained in:
parent
8b1a4ee57e
commit
651abe67f1
4 changed files with 59 additions and 48 deletions
|
@ -35,6 +35,7 @@ Description
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "Random.H"
|
#include "Random.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 "createMesh.H"
|
#include "createMesh.H"
|
||||||
|
|
||||||
|
pisoControl piso(mesh);
|
||||||
|
|
||||||
#include "readTransportProperties.H"
|
#include "readTransportProperties.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
@ -54,12 +58,12 @@ 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"
|
||||||
|
|
||||||
sgsModel->correct();
|
sgsModel->correct();
|
||||||
|
|
||||||
|
// Momentum predictor
|
||||||
|
|
||||||
fvVectorMatrix UEqn
|
fvVectorMatrix UEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(U)
|
fvm::ddt(U)
|
||||||
|
@ -69,7 +73,7 @@ int main(int argc, char *argv[])
|
||||||
flowDirection*gradP
|
flowDirection*gradP
|
||||||
);
|
);
|
||||||
|
|
||||||
if (momentumPredictor)
|
if (piso.momentumPredictor())
|
||||||
{
|
{
|
||||||
solve(UEqn == -fvc::grad(p));
|
solve(UEqn == -fvc::grad(p));
|
||||||
}
|
}
|
||||||
|
@ -79,7 +83,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
volScalarField rUA = 1.0/UEqn.A();
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
|
|
||||||
for (int corr = 0; corr < nCorr; corr++)
|
while (piso.correct())
|
||||||
{
|
{
|
||||||
U = rUA*UEqn.H();
|
U = rUA*UEqn.H();
|
||||||
phi = (fvc::interpolate(U) & mesh.Sf())
|
phi = (fvc::interpolate(U) & mesh.Sf())
|
||||||
|
@ -87,7 +91,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
|
||||||
(
|
(
|
||||||
|
@ -95,17 +100,12 @@ int main(int argc, char *argv[])
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
pEqn.solve
|
||||||
|
(
|
||||||
|
mesh.solutionDict().solver(p.select(piso.finalInnerIter()))
|
||||||
|
);
|
||||||
|
|
||||||
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
|
||||||
pEqn.solve(mesh.solutionDict().solver(p.name() + "Final"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pEqn.solve(mesh.solutionDict().solver(p.name()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ Description
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "singlePhaseTransportModel.H"
|
#include "singlePhaseTransportModel.H"
|
||||||
|
#include "pisoControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -40,6 +41,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createMeshNoClear.H"
|
# include "createMeshNoClear.H"
|
||||||
|
|
||||||
|
pisoControl piso(mesh);
|
||||||
|
|
||||||
# include "createFields.H"
|
# include "createFields.H"
|
||||||
# include "initContinuityErrs.H"
|
# include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
@ -51,11 +55,12 @@ 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"
|
||||||
|
|
||||||
fluid.correct();
|
fluid.correct();
|
||||||
|
|
||||||
|
// Momentum predictor
|
||||||
|
|
||||||
fvVectorMatrix UEqn
|
fvVectorMatrix UEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(U)
|
fvm::ddt(U)
|
||||||
|
@ -63,11 +68,13 @@ int main(int argc, char *argv[])
|
||||||
- fvm::laplacian(fluid.nu(), U)
|
- fvm::laplacian(fluid.nu(), U)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (piso.momentumPredictor())
|
||||||
|
{
|
||||||
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();
|
||||||
|
|
||||||
|
@ -77,17 +84,23 @@ 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())
|
||||||
{
|
{
|
||||||
|
// Pressure corrector
|
||||||
|
|
||||||
fvScalarMatrix pEqn
|
fvScalarMatrix pEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rUA, p) == fvc::div(phi)
|
fvm::laplacian(rUA, p) == fvc::div(phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
pEqn.solve();
|
pEqn.solve
|
||||||
|
(
|
||||||
|
mesh.solutionDict().solver(p.select(piso.finalInnerIter()))
|
||||||
|
);
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= pEqn.flux();
|
phi -= pEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,15 +100,13 @@ int main(int argc, char *argv[])
|
||||||
);
|
);
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
pEqn.solve
|
||||||
if (piso.finalInnerIter())
|
(
|
||||||
{
|
mesh.solutionDict().solver
|
||||||
pEqn.solve(mesh.solutionDict().solver("pFinal"));
|
(
|
||||||
}
|
p.select(piso.finalInnerIter())
|
||||||
else
|
)
|
||||||
{
|
);
|
||||||
pEqn.solve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (piso.finalNonOrthogonalIter())
|
if (piso.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ Description
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
|
#include "pimpleControl.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -41,6 +42,9 @@ int main(int argc, char *argv[])
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
|
|
||||||
|
pimpleControl pimple(mesh);
|
||||||
|
|
||||||
#include "readGravitationalAcceleration.H"
|
#include "readGravitationalAcceleration.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
|
|
||||||
|
@ -52,10 +56,10 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Info<< "\n Time = " << runTime.timeName() << nl << endl;
|
Info<< "\n Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "readPISOControls.H"
|
|
||||||
#include "CourantNo.H"
|
#include "CourantNo.H"
|
||||||
|
|
||||||
for (int ucorr=0; ucorr<nOuterCorr; ucorr++)
|
// --- Pressure-velocity PIMPLE corrector loop
|
||||||
|
while (pimple.loop())
|
||||||
{
|
{
|
||||||
surfaceScalarField phiv("phiv", phi/fvc::interpolate(h));
|
surfaceScalarField phiv("phiv", phi/fvc::interpolate(h));
|
||||||
|
|
||||||
|
@ -67,7 +71,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
hUEqn.relax();
|
hUEqn.relax();
|
||||||
|
|
||||||
if (momentumPredictor)
|
if (pimple.momentumPredictor())
|
||||||
{
|
{
|
||||||
if (rotating)
|
if (rotating)
|
||||||
{
|
{
|
||||||
|
@ -86,8 +90,8 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- PISO loop
|
// --- Pressure corrector loop
|
||||||
for (int corr = 0; corr < nCorr; corr++)
|
while (pimple.correct())
|
||||||
{
|
{
|
||||||
surfaceScalarField hf = fvc::interpolate(h);
|
surfaceScalarField hf = fvc::interpolate(h);
|
||||||
volScalarField rUA = 1.0/hUEqn.A();
|
volScalarField rUA = 1.0/hUEqn.A();
|
||||||
|
@ -108,7 +112,7 @@ int main(int argc, char *argv[])
|
||||||
+ fvc::ddtPhiCorr(rUA, h, hU, phi)
|
+ fvc::ddtPhiCorr(rUA, h, hU, phi)
|
||||||
- phih0;
|
- phih0;
|
||||||
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix hEqn
|
fvScalarMatrix hEqn
|
||||||
(
|
(
|
||||||
|
@ -117,19 +121,15 @@ int main(int argc, char *argv[])
|
||||||
- fvm::laplacian(ghrUAf, h)
|
- fvm::laplacian(ghrUAf, h)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ucorr < nOuterCorr - 1 || corr < nCorr - 1)
|
|
||||||
{
|
|
||||||
hEqn.solve();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hEqn.solve
|
hEqn.solve
|
||||||
(
|
(
|
||||||
mesh.solutionDict().solver(h.name() + "Final")
|
mesh.solutionDict().solver
|
||||||
|
(
|
||||||
|
h.select(pimple.finalInnerIter())
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi += hEqn.flux();
|
phi += hEqn.flux();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue