Backported rhoPimpleFoam, rhoPisoFoam and tutorials (vanilla OF 3.0.1)

This commit is contained in:
Vanja Skuric 2016-05-08 15:36:11 +02:00
parent bb0cb435e5
commit 04d8d1b849
15 changed files with 56 additions and 99 deletions

View file

@ -7,34 +7,20 @@ tmp<fvVectorMatrix> UEqn
+ turbulence->divDevRhoReff(U)
);
if (oCorr == nOuterCorr - 1)
{
if (mesh.solutionDict().relax("UFinal"))
{
UEqn().relax(mesh.solutionDict().relaxationFactor("UFinal"));
}
else
{
UEqn().relax(1);
}
}
else
{
UEqn().relax();
}
UEqn().relax
(
mesh.solutionDict().relaxationFactor(U.select(pimple.finalIter()))
);
volScalarField rUA = 1.0/UEqn().A();
if (momentumPredictor)
if (pimple.momentumPredictor())
{
if (oCorr == nOuterCorr-1)
{
solve(UEqn() == -fvc::grad(p), mesh.solutionDict().solver("UFinal"));
}
else
{
solve(UEqn() == -fvc::grad(p));
}
solve
(
UEqn() == -fvc::grad(p),
mesh.solutionDict().solver((U.select(pimple.finalIter())))
);
}
else
{

View file

@ -62,3 +62,5 @@
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
mesh.schemesDict().setFluxRequired(p.name());

View file

@ -8,16 +8,11 @@
DpDt
);
if (oCorr == nOuterCorr-1)
{
hEqn.relax();
hEqn.solve(mesh.solutionDict().solver("hFinal"));
}
else
{
hEqn.relax();
hEqn.solve();
}
hEqn.relax
(
mesh.solutionDict().relaxationFactor(h.select(pimple.finalIter()))
);
hEqn.solve(mesh.solutionDict().solver((h.select(pimple.finalIter()))));
thermo.correct();
}

View file

@ -3,12 +3,12 @@ rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A();
U = rUA*UEqn().H();
if (nCorr <= 1)
if (pimple.nCorrPISO() <= 1)
{
UEqn.clear();
}
if (transonic)
if (pimple.transonic())
{
surfaceScalarField phid
(
@ -20,7 +20,7 @@ if (transonic)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -29,21 +29,12 @@ if (transonic)
- fvm::laplacian(rho*rUA, p)
);
if
pEqn.solve
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solutionDict().solver("pFinal"));
}
else
{
pEqn.solve();
}
mesh.solutionDict().solver(p.select(pimple.finalInnerIter()))
);
if (nonOrth == nNonOrthCorr)
if (pimple.finalNonOrthogonalIter())
{
phi == pEqn.flux();
}
@ -58,7 +49,7 @@ else
//+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (pimple.correctNonOrthogonal())
{
// Pressure corrector
fvScalarMatrix pEqn
@ -68,21 +59,12 @@ else
- fvm::laplacian(rho*rUA, p)
);
if
pEqn.solve
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solutionDict().solver("pFinal"));
}
else
{
pEqn.solve();
}
mesh.solutionDict().solver(p.select(pimple.finalInnerIter()))
);
if (nonOrth == nNonOrthCorr)
if (pimple.finalNonOrthogonalIter())
{
phi += pEqn.flux();
}

View file

@ -37,6 +37,7 @@ Description
#include "basicPsiThermo.H"
#include "turbulenceModel.H"
#include "bound.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,6 +46,9 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
pimpleControl pimple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
#include "createTimeControls.H"
@ -56,7 +60,6 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPIMPLEControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
@ -64,7 +67,7 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
if (nOuterCorr != 1)
if (!pimple.firstIter())
{
p.storePrevIter();
rho.storePrevIter();
@ -73,13 +76,13 @@ int main(int argc, char *argv[])
#include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
while (pimple.loop())
{
#include "UEqn.H"
#include "hEqn.H"
// --- PISO loop
for (int corr = 0; corr < nCorr; corr++)
while (pimple.correct())
{
#include "pEqn.H"
}

View file

@ -5,7 +5,7 @@
+ turbulence->divDevRhoReff(U)
);
if (momentumPredictor)
if (piso.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
}

View file

@ -56,3 +56,5 @@
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
mesh.schemesDict().setFluxRequired(p.name());

View file

@ -3,7 +3,7 @@ rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
if (transonic)
if (piso.transonic())
{
surfaceScalarField phid
(
@ -15,7 +15,7 @@ if (transonic)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (piso.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -26,7 +26,7 @@ if (transonic)
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (piso.finalNonOrthogonalIter())
{
phi == pEqn.flux();
}
@ -41,7 +41,7 @@ else
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (piso.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -52,7 +52,7 @@ else
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (piso.finalNonOrthogonalIter())
{
phi += pEqn.flux();
}

View file

@ -32,6 +32,7 @@ Description
#include "fvCFD.H"
#include "basicPsiThermo.H"
#include "turbulenceModel.H"
#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -41,6 +42,9 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createMesh.H"
pisoControl piso(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
#include "createTimeControls.H"
@ -55,7 +59,6 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
@ -67,7 +70,7 @@ int main(int argc, char *argv[])
#include "UEqn.H"
// --- PISO loop
for (int corr = 1; corr <= nCorr; corr++)
while (piso.correct())
{
#include "hEqn.H"
#include "pEqn.H"

View file

@ -40,7 +40,7 @@ divSchemes
div((rho*R)) Gauss linear;
div(R) Gauss linear;
div(U) Gauss linear;
div((muEff*dev2(grad(U).T()))) Gauss linear;
div((muEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
@ -66,10 +66,4 @@ snGradSchemes
default corrected;
}
fluxRequired
{
default no;
p ;
}
// ************************************************************************* //

View file

@ -118,9 +118,11 @@ PIMPLE
relaxationFactors
{
U 0.7;
UFinal 1.0;
p 0.3;
rho 0.05;
h 0.7;
hFinal 1.0;
k 0.7;
omega 0.7;
}

View file

View file

@ -1,9 +1,9 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{

View file

@ -37,7 +37,7 @@ divSchemes
div(phi,B) Gauss limitedLinear 1;
div(phi,muTilda) Gauss limitedLinear 1;
div(B) Gauss linear;
div((muEff*dev2(grad(U).T()))) Gauss linear;
div((muEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
@ -62,10 +62,4 @@ snGradSchemes
default corrected;
}
fluxRequired
{
default no;
p ;
}
// ************************************************************************* //

View file

@ -40,7 +40,7 @@ divSchemes
div((rho*R)) Gauss linear;
div(R) Gauss linear;
div(U) Gauss linear;
div((muEff*dev2(grad(U).T()))) Gauss linear;
div((muEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
@ -66,10 +66,4 @@ snGradSchemes
default corrected;
}
fluxRequired
{
default no;
p ;
}
// ************************************************************************* //