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