diff --git a/applications/solvers/basic/laplacianFoam/laplacianFoam.C b/applications/solvers/basic/laplacianFoam/laplacianFoam.C index 830a266a4017c97186b9c35a81e00e38fe5cd8cc..5ed2849be9e7d26f363326669cd2bf8ee4d4288e 100644 --- a/applications/solvers/basic/laplacianFoam/laplacianFoam.C +++ b/applications/solvers/basic/laplacianFoam/laplacianFoam.C @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { solve ( diff --git a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C index 7dbbc97dac3f95d324f670b38b55b3a7b0b5f132..8eade6a545b2364cdad526c755470f23f734409c 100644 --- a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C +++ b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { solve ( diff --git a/applications/solvers/combustion/PDRFoam/PDRFoam.C b/applications/solvers/combustion/PDRFoam/PDRFoam.C index 40a48cfbdba140f5d935c5e97f97bed3706edf47..bf70e83c5d1266a44c507c01b5c43d0dcb597aa7 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoam.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoam.C @@ -114,12 +114,12 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "bEqn.H" #include "ftEqn.H" diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 557c8aa1fb79d3f7c50e5a20dd9307dc9800ab06..0c5082df0426d82e82642cc698e263b6591848c2 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -167,13 +167,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "bEqn.H" #include "ftEqn.H" diff --git a/applications/solvers/combustion/PDRFoam/pEqn.H b/applications/solvers/combustion/PDRFoam/pEqn.H index 3c6a6341f9dd55765189db50542f413ce38f6bee..e2a2a471e28e1935c990af0c7f1f1f2959dc5d41 100644 --- a/applications/solvers/combustion/PDRFoam/pEqn.H +++ b/applications/solvers/combustion/PDRFoam/pEqn.H @@ -15,7 +15,7 @@ if (pimple.transonic()) ) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -24,12 +24,9 @@ if (pimple.transonic()) - fvm::laplacian(rho*invA, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -44,7 +41,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -53,12 +50,9 @@ else - fvm::laplacian(rho*invA, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/XiFoam/XiFoam.C b/applications/solvers/combustion/XiFoam/XiFoam.C index 71b03064fad779d858c9f7ee7c9513ba630a1506..069e5b8caa09f77f494ad1737c443329f6c70bf1 100644 --- a/applications/solvers/combustion/XiFoam/XiFoam.C +++ b/applications/solvers/combustion/XiFoam/XiFoam.C @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" @@ -105,8 +105,8 @@ int main(int argc, char *argv[]) hu == h; } - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/combustion/XiFoam/pEqn.H b/applications/solvers/combustion/XiFoam/pEqn.H index bef433d388f709f892ba72b5248951353f7702fd..784e9ca6b71b90d114e13d880d7bf18b067c66f6 100644 --- a/applications/solvers/combustion/XiFoam/pEqn.H +++ b/applications/solvers/combustion/XiFoam/pEqn.H @@ -15,7 +15,7 @@ if (pimple.transonic()) ) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -24,12 +24,9 @@ if (pimple.transonic()) - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -44,7 +41,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -53,12 +50,9 @@ else - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C index 7a0f3acd09d7531904670942c412656885e985ac..6ef3a599c17b1d1d65d89f06a6c2b98de8fc0785 100644 --- a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C +++ b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C @@ -74,12 +74,12 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "hEqn.H" #include "pEqn.H" diff --git a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C index 6fd1981be9ca474a01102572e966895f6caad18a..3c60e9c9eace15d17b5a66f678ecf81a4a398b24 100644 --- a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C +++ b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C @@ -83,14 +83,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/combustion/dieselEngineFoam/pEqn.H b/applications/solvers/combustion/dieselEngineFoam/pEqn.H index 42228cc7b0e000192884340a7740b83b34f19522..0493a1ff6c60560c2dc1fab40c6f800216f78402 100644 --- a/applications/solvers/combustion/dieselEngineFoam/pEqn.H +++ b/applications/solvers/combustion/dieselEngineFoam/pEqn.H @@ -12,7 +12,7 @@ if (pimple.transonic()) *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -23,12 +23,9 @@ if (pimple.transonic()) Sevap ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -39,7 +36,7 @@ else phi = fvc::interpolate(rho) *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -50,12 +47,9 @@ else Sevap ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/dieselFoam/dieselFoam.C b/applications/solvers/combustion/dieselFoam/dieselFoam.C index 70808e8dbe3758da7e18f95f755ded62b754d45b..5bcb6b327353a3aab13bda4054cb4350742efe47 100644 --- a/applications/solvers/combustion/dieselFoam/dieselFoam.C +++ b/applications/solvers/combustion/dieselFoam/dieselFoam.C @@ -80,14 +80,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/combustion/dieselFoam/pEqn.H b/applications/solvers/combustion/dieselFoam/pEqn.H index 5c4bd5ddf632231744a976b76ba40a92b32f022c..8ef13cde9d20f04be8e1e897ddb78e28f496dc11 100644 --- a/applications/solvers/combustion/dieselFoam/pEqn.H +++ b/applications/solvers/combustion/dieselFoam/pEqn.H @@ -15,7 +15,7 @@ if (pimple.transonic()) ) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -26,12 +26,9 @@ if (pimple.transonic()) Sevap ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -46,7 +43,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -57,14 +54,11 @@ else Sevap ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { - phi += pEqn.flux(); + phi == pEqn.flux(); } } } diff --git a/applications/solvers/combustion/engineFoam/engineFoam.C b/applications/solvers/combustion/engineFoam/engineFoam.C index 5b2256ba45eb94233def5559545baa167270fad8..84472420c522d0f0fdd05398dd6982d488b57934 100644 --- a/applications/solvers/combustion/engineFoam/engineFoam.C +++ b/applications/solvers/combustion/engineFoam/engineFoam.C @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" @@ -111,8 +111,8 @@ int main(int argc, char *argv[]) hu == h; } - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/combustion/engineFoam/pEqn.H b/applications/solvers/combustion/engineFoam/pEqn.H index 1b75a933981097bd18a08945374f155caf667d2a..580be2da56ef087f2c63ed7b30470234e4e40eeb 100644 --- a/applications/solvers/combustion/engineFoam/pEqn.H +++ b/applications/solvers/combustion/engineFoam/pEqn.H @@ -12,7 +12,7 @@ if (pimple.transonic()) *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -21,12 +21,9 @@ if (pimple.transonic()) - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -37,7 +34,7 @@ else phi = fvc::interpolate(rho) *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -46,12 +43,9 @@ else - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index e95a4318c7857d1be1480dc48f6c2c3806600397..1d58470cbfd5436f1338c30785810440b7d06cdd 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -91,13 +91,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- PIMPLE loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YhsEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H index 5c7a4ae33e30c7b3dd4bf145e5687f500ce8857a..65259391daf83589f2c939ebcf829f1c9a50fda4 100644 --- a/applications/solvers/combustion/fireFoam/pEqn.H +++ b/applications/solvers/combustion/fireFoam/pEqn.H @@ -15,7 +15,7 @@ surfaceScalarField phiU phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf(); -for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) +while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -28,12 +28,9 @@ for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + surfaceFilm.Srho() ); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += p_rghEqn.flux(); } diff --git a/applications/solvers/combustion/reactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/pEqn.H index bef433d388f709f892ba72b5248951353f7702fd..784e9ca6b71b90d114e13d880d7bf18b067c66f6 100644 --- a/applications/solvers/combustion/reactingFoam/pEqn.H +++ b/applications/solvers/combustion/reactingFoam/pEqn.H @@ -15,7 +15,7 @@ if (pimple.transonic()) ) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -24,12 +24,9 @@ if (pimple.transonic()) - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -44,7 +41,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -53,12 +50,9 @@ else - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index 7f3347f780489c967392a73fa2841fa8bdb9cfe1..5344eea3beb07d9e52fe9a24dcad59a7f576c560 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -66,14 +66,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/combustion/rhoReactingFoam/pEqn.H b/applications/solvers/combustion/rhoReactingFoam/pEqn.H index 724f45e18941daefd039fe397d1dcffcd8ef05a3..b22fc890794a469f5fef975b198c8592fa3af963 100644 --- a/applications/solvers/combustion/rhoReactingFoam/pEqn.H +++ b/applications/solvers/combustion/rhoReactingFoam/pEqn.H @@ -30,7 +30,7 @@ + correction(fvm::ddt(psi, p) + fvm::div(phid, p)) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -38,12 +38,9 @@ - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } @@ -64,7 +61,7 @@ + fvc::div(phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -72,12 +69,9 @@ - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C index 73b252e5790723c154d37beb210f81350c0aa122..aa8f1a55015b510945dceb6b35f40c9cacb51f81 100644 --- a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C +++ b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C @@ -68,14 +68,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index eea0ea9bff880eb5cb957bd33afdd0587edb77a7..1361c6441f1ec240207f83fb1af6bc217583c992 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -5,7 +5,7 @@ rho.relax(); U = rAU*UEqn().H(); -if (pimple.nCorr() <= 1) +if (pimple.nCorrPIMPLE() <= 1) { UEqn.clear(); } @@ -22,7 +22,7 @@ if (pimple.transonic()) ) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -31,12 +31,9 @@ if (pimple.transonic()) - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -51,7 +48,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { // Pressure corrector fvScalarMatrix pEqn @@ -61,12 +58,9 @@ else - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index 0336ceb74d708531aa00f5a6520bb3bb2197f08e..26d11a14aa6694211f3c9dfba3e97825bd7a79e1 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -69,13 +69,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "hEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C index 66ffb082756651cc1eec5a0cac6cb89242e3b1ab..de32f1f5c633c48aae0434b92799818183829cf5 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C @@ -77,15 +77,15 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { turbulence->correct(); #include "UEqn.H" #include "hEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H index 5e54f970cd5db9d6c630524b1381359b9afaf8db..cd10ed78e2fb08b3658da8ec4d9a50143d00e761 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H @@ -6,7 +6,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); U = rAU*UEqn().H(); -if (pimple.nCorr() <= 1) +if (pimple.nCorrPIMPLE() <= 1) { UEqn.clear(); } @@ -24,7 +24,7 @@ if (pimple.transonic()) ); mrfZones.relativeFlux(fvc::interpolate(psi), phid); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -33,12 +33,9 @@ if (pimple.transonic()) - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -54,7 +51,7 @@ else ); mrfZones.relativeFlux(fvc::interpolate(rho), phi); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { // Pressure corrector fvScalarMatrix pEqn @@ -64,12 +61,9 @@ else - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index 8de8a412c350931914bad79d0434dcb051d63a43..068de89952e1f5b940ffac33f4af63c3c82b20ec 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -72,13 +72,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "hEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index df120f6dea2720316e6e0e49ae5b4c3b1c5add15..4d3f1ac76e2bf4a639e99dbe1ebfd88e819d8841 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -17,7 +17,7 @@ if (simple.transonic()) fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf()) ); - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -32,7 +32,7 @@ if (simple.transonic()) pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { 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<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -54,7 +54,7 @@ else pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H index 4fc258870b9a3b2225615659de250828a281f7fd..b1f83304cd7b039d24b0eecfba8dda9c040ba588 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H @@ -20,7 +20,7 @@ if (simple.transonic()) ); mrfZones.relativeFlux(fvc::interpolate(psi), phid); - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { tmp<fvScalarMatrix> tpEqn; @@ -37,7 +37,7 @@ if (simple.transonic()) tpEqn().solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi == tpEqn().flux(); } @@ -50,7 +50,7 @@ else closedVolume = adjustPhi(phi, U, p); - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { tmp<fvScalarMatrix> tpEqn; @@ -67,7 +67,7 @@ else tpEqn().solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi -= tpEqn().flux(); } diff --git a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H index 9eb783feca8c20db5ee1e61542dfc74b95a7e9ec..ccc7a1b21e1504c0cac43e35134d497dce1dc73a 100644 --- a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H @@ -14,7 +14,7 @@ bool closedVolume = false; if (simple.transonic()) { - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { surfaceScalarField phid ( @@ -44,17 +44,9 @@ if (simple.transonic()) pEqn.setReference(pRefCell, pRefValue); - // Retain the residual from the first iteration - if (nonOrth == 0) - { - pEqn.solve(); - } - else - { - pEqn.solve(); - } + pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi == phic + pEqn.flux(); } @@ -62,7 +54,7 @@ if (simple.transonic()) } else { - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { phi = fvc::interpolate(rho*U) & mesh.Sf(); closedVolume = adjustPhi(phi, U, p); @@ -77,18 +69,9 @@ else pEqn.setReference(pRefCell, pRefValue); - // Retain the residual from the first iteration - if (nonOrth == 0) - { - pEqn.solve(); - } - else - { - pEqn.solve(); - } - + pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C b/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C index c0311807d46d080d2ece7878daf39b8026749f54..37bea3c1761712fbfd719ba988bdd8ad37469ee8 100644 --- a/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C +++ b/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) runTime++; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { solve(fvm::laplacian(murf, psi) + fvc::div(murf*Mrf)); } diff --git a/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/pEqn.H index 17bf590f2958c9df5fb4aac55953e441a830d497..d2793d719261317317db265f4909c3594aa50fa4 100644 --- a/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/pEqn.H @@ -14,7 +14,7 @@ surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -24,7 +24,7 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C index c00c1fe8d8316900cafc17c8b8d596911defb882..461578e864ed5172d8a4f178a1b8672eefa78e84 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C @@ -79,13 +79,13 @@ int main(int argc, char *argv[]) #include "setDeltaT.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "TEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H index 8ac13dc93ee3e0673967f35c8e1ac9baeacc0fbd..14e87ea844ea30ac23f42843daa6ee3739fb48a8 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H @@ -10,7 +10,7 @@ surfaceScalarField buoyancyPhi(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -19,12 +19,9 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H index 5d643837ffcdc31b46d5fc4c299cd3a30a21dc63..5a9ec667077845828d890bf28f35645118615ba7 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H @@ -11,7 +11,7 @@ surfaceScalarField buoyancyPhi(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -22,7 +22,7 @@ p_rghEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index 42397711680cf6be2a8de3576bf937706d8a9fb5..3e6b46a4bc6c9f15a790409204012a18e6a36860 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -72,13 +72,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "hEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index b47d65b842ac3e85d2c9155920e4b577b8775ef4..5c60d78b35acfc20d7ef5e7372494db4d10d9d90 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -25,7 +25,7 @@ + fvc::div(phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -33,12 +33,9 @@ - fvm::laplacian(rhorAUf, p_rgh) ); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi += p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 17bf590f2958c9df5fb4aac55953e441a830d497..d2793d719261317317db265f4909c3594aa50fa4 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -14,7 +14,7 @@ surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -24,7 +24,7 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C index 1ba675c4bf9b3d27632e633c83e4cd1c0da012b0..bedc12b3ba213550a9cf4d59aadc4398e10ba46a 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) adjustPhi(phia, Ua, pa); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix paEqn ( @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) paEqn.setReference(paRefCell, paRefValue); paEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phia -= paEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C index 30725cd070240642494361b7fd14f6fe4fc75d52..ba222b5034a75b71caadea7d1184d5085e27836e 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C @@ -65,12 +65,12 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UrelEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H index e4f9190cc53f260b51cf3475e5e35f7ffef7a13a..a8ade8c1cab8684c3a5e02f178cb5dcddbb1c79b 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H @@ -1,7 +1,7 @@ volScalarField rAUrel(1.0/UrelEqn().A()); Urel = rAUrel*UrelEqn().H(); -if (pimple.nCorr() <= 1) +if (pimple.nCorrPIMPLE() <= 1) { UrelEqn.clear(); } @@ -12,7 +12,7 @@ phi = (fvc::interpolate(Urel) & mesh.Sf()) adjustPhi(phi, Urel, p); // Non-orthogonal pressure corrector loop -for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) +while (pimple.correctNonOrthogonal()) { // Pressure corrector fvScalarMatrix pEqn @@ -22,12 +22,9 @@ for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) pEqn.setReference(pRefCell, pRefValue); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index da9b7581bfcf914064c97469b3ac704b3bc191cc..2d6b37db6737acb05329b4d93c1dfc8f77829d8e 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -1,6 +1,6 @@ U = rAU*UEqn().H(); -if (pimple.nCorr() <= 1) +if (pimple.nCorrPIMPLE() <= 1) { UEqn.clear(); } @@ -11,7 +11,7 @@ phi = (fvc::interpolate(U) & mesh.Sf()) adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop -for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) +while (pimple.correctNonOrthogonal()) { // Pressure corrector fvScalarMatrix pEqn @@ -21,12 +21,9 @@ for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) pEqn.setReference(pRefCell, pRefValue); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H index e112db4621faf2bee4e4df3f9f7ba491747615dd..aed4884c4cb8437fcfea2fcccbb5e46630083fd5 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H @@ -50,7 +50,7 @@ pcorrTypes ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( @@ -60,7 +60,7 @@ pcorrEqn.setReference(pRefCell, pRefValue); pcorrEqn.solve(); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H index 3e8a587768f17e523c035889b5fbdfc929b60bc7..5986a92adf0b74ea25127b435915b18af0cc3fe2 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H @@ -1,6 +1,6 @@ U = rAU*UEqn().H(); -if (pimple.nCorr() <= 1) +if (pimple.nCorrPIMPLE() <= 1) { UEqn.clear(); } @@ -19,7 +19,7 @@ if (p.needReference()) fvc::makeAbsolute(phi, U); } -for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) +while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -28,12 +28,9 @@ for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) pEqn.setReference(pRefCell, pRefValue); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C index 55ee07dbc725857de871a4f647dbd0ffecae9dfc..b2b0c48c13db92e9573b007ecb23409cbfde0605 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C @@ -86,12 +86,12 @@ int main(int argc, char *argv[]) } // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index e8b58bbea5ecd9ed5956538f88ab69ba0eec1de8..da5e2974c9bbe06c343af015aafee1488cfde034 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -64,12 +64,12 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C b/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C index 9fbe918a9f2e4abd064feea5640b5d8dba4cfbf4..b49155264727f3fc35e85a17cb63589a6cf2c804 100644 --- a/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C +++ b/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) #include "CourantNo.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { surfaceScalarField phiv("phiv", phi/fvc::interpolate(h)); @@ -89,8 +89,8 @@ int main(int argc, char *argv[]) } } - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { volScalarField rAU(1.0/hUEqn.A()); surfaceScalarField ghrAUf(magg*fvc::interpolate(h*rAU)); @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) + fvc::ddtPhiCorr(rAU, h, hU, phi) - phih0; - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix hEqn ( @@ -119,15 +119,9 @@ int main(int argc, char *argv[]) - fvm::laplacian(ghrAUf, h) ); - hEqn.solve - ( - mesh.solver - ( - h.select(pimple.finalInnerIter(corr, nonOrth)) - ) - ); + hEqn.solve(mesh.solver(h.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += hEqn.flux(); } diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H index 81f5c20480053484bdea0d7111b65bfc55f8b318..2d2540d3038a8e28c966ab847fb5fe6d22798749 100644 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H @@ -10,7 +10,7 @@ adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -20,7 +20,7 @@ pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H index beb73bd3415cfa938f48d8cd9ef036c0a6394159..54eab9cba7b6c2aa9e110a534c9f6e00ee33ff41 100644 --- a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H @@ -9,7 +9,7 @@ adjustPhi(phi, Urel, p); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -20,7 +20,7 @@ pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index 699cdcb3cf6589cb6da67d14f2f1aa596824d027..966dedb61688d8c98d50cfd2b83163ce874903a4 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -9,7 +9,7 @@ adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -20,7 +20,7 @@ pEqn.solve(); - if (nonOrth == simple.nNonOrthCorr()) + if (simple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H index 5908396d18755d90cde9dbea6d94f3110868b807..fbe81daee55376cb8e073b8cd5e390b9ed0df2e9 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H @@ -11,7 +11,7 @@ UEqn.clear(); phi = fvc::interpolate(U) & mesh.Sf(); adjustPhi(phi, U, p); -for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) +while (simple.correctNonOrthogonal()) { tmp<fvScalarMatrix> tpEqn; @@ -25,17 +25,10 @@ for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) } tpEqn().setReference(pRefCell, pRefValue); - // retain the residual from the first iteration - if (nonOrth == 0) - { - tpEqn().solve(); - } - else - { - tpEqn().solve(); - } - if (nonOrth == simple.nNonOrthCorr()) + tpEqn().solve(); + + if (simple.finalNonOrthogonalIter()) { phi -= tpEqn().flux(); } diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C b/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C index dc642e7c7237d2bc93ea8cf7913d99b39e187463..23c9e0322930dbc65a00e3c3b65e3450e5d46476 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { turbulence->correct(); @@ -95,8 +95,8 @@ int main(int argc, char *argv[]) #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H index fcbfad3efb21d7d4e0c69296867ccc767fa45959..d3aaed21efe1fe9999b4c93fdc8640165f9be751 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H @@ -32,7 +32,7 @@ + massSource.SuTot() ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -40,12 +40,9 @@ - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 7b5c3e73c717ea38215689df66f27d3223e16289..897f43e3c3efb0cf4260c8d5f7e711b5ea20dcbe 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -88,14 +88,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H index de0c04577a06eaf583126e9e43dbe96d337751a4..73e56f07c5d9f2c606eebc75d39d33bf570ed5ed 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H @@ -15,7 +15,7 @@ if (pimple.transonic()) ) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -26,12 +26,9 @@ if (pimple.transonic()) coalParcels.Srho() ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -46,7 +43,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -57,12 +54,9 @@ else coalParcels.Srho() ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H index 63d746fe79fdf811e7e393b502803c50d140b377..b6e69acead325bf7adc337fab4099059a4134be2 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H @@ -32,7 +32,7 @@ + massSource.SuTot() ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -40,12 +40,9 @@ - fvm::laplacian(rho*rAU, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C index 283773f4f6fa692bd83ab7d12588fc0c6e295c90..19d7e96d13f4dab7bda58ae383696e7869504e1b 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C @@ -90,14 +90,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H index 5c7a4ae33e30c7b3dd4bf145e5687f500ce8857a..65259391daf83589f2c939ebcf829f1c9a50fda4 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H @@ -15,7 +15,7 @@ surfaceScalarField phiU phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf(); -for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) +while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -28,12 +28,9 @@ for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + surfaceFilm.Srho() ); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += p_rghEqn.flux(); } diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C index 8dd3e3c9e6aeb2dd5d89b77f3788898a00d722a4..06ef5ddac3b96bf372dd5a43cd93fa079d1b0cc8 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C @@ -83,14 +83,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- PIMPLE loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=1; corr<=pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index 3bf304ceccf4168d6214eb32d879f01c977542f0..8031af20d576e8ecbf8362316668f59adb649e86 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -15,7 +15,7 @@ if (pimple.transonic()) ) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -26,12 +26,9 @@ if (pimple.transonic()) parcels.Srho() ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -46,7 +43,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -57,12 +54,9 @@ else parcels.Srho() ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index 94e551ca7215f1b88c94a8b7d57cef0206e49f5d..a46cb30f80c8a529c10705bfc071d780af8895da 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -76,14 +76,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C index 96ad7dee5232fac8bb43f706369465a46b57096c..50e24a70dfd91f2ebd0f1b4e86fc64db778a372e 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C +++ b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C @@ -76,14 +76,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C index 0d095d36483844edf6e0ac2300ac285076652d76..4bbaf792af26405c7d45cb112d64a77baa96015c 100644 --- a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C +++ b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C @@ -68,14 +68,14 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "alphaEqn.H" #include "liftDragCoeffs.H" #include "UEqns.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" diff --git a/applications/solvers/multiphase/bubbleFoam/pEqn.H b/applications/solvers/multiphase/bubbleFoam/pEqn.H index 453575b19b76fb5d73673484e62b631ac1ecfc17..268c2b4f0d7740e43ab11444596768db2ae66702 100644 --- a/applications/solvers/multiphase/bubbleFoam/pEqn.H +++ b/applications/solvers/multiphase/bubbleFoam/pEqn.H @@ -42,7 +42,7 @@ alphaf*rUaAf/rhoa + betaf*rUbAf/rhob ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -51,12 +51,9 @@ pEqn.setReference(pRefCell, pRefValue); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { surfaceScalarField SfGradp(pEqn.flux()/Dp); diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C index 159eb0f0bd45d4719b3f78b7890195b35731b8db..256a58d95339b7bb657d697fcef46223a1d38acc 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C @@ -68,13 +68,15 @@ int main(int argc, char *argv[]) runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; - for (pimple.start(); pimple.loop(); pimple++) + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) { #include "rhoEqn.H" #include "gammaPsi.H" #include "UEqn.H" - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/cavitatingFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/pEqn.H index c604539cde376de10bb7d52c5a4efbd1658813fc..fb8893be2ccae6c6a205c61533f19bf76f8e94e1 100644 --- a/applications/solvers/multiphase/cavitatingFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/pEqn.H @@ -1,5 +1,5 @@ { - if (pimple.nOuterCorr() == 1) + if (pimple.nCorrPIMPLE() == 1) { p = ( @@ -26,7 +26,7 @@ #include "resetPhivPatches.H" - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -37,12 +37,9 @@ - fvm::laplacian(rAUf, p) ); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phiv += (phiGradp + pEqn.flux())/rhof; } diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H index 9161c8056314b4ca86f5507d3a1665faf08c5543..2d70a5bab5932cb23837cdd0138fad6e9e81d28f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H @@ -30,7 +30,8 @@ #include "alphaEqns.H" } - if (pimple.corr() == 0) + // correct interface on first PIMPLE corrector + if (pimple.corr() == 1) { interface.correct(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H index 532d2bcc05ea395e13f75406a23e391cf5d9f4b5..ade8af00817fe065a03aeeb70a6b32f1980a4a77 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H @@ -32,7 +32,8 @@ #include "alphaEqns.H" } - if (pimple.corr() == 0) + // correct interface on first PIMPLE corrector + if (pimple.corr() == 1) { interface.correct(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index 4b3b5127d4c707dad7980fc7e86bd27f4534c141..1ac1596c4dbd1702fb0a4cf976226b331c2d11d7 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -116,8 +116,8 @@ int main(int argc, char *argv[]) turbulence->correct(); - // --- Outer-corrector loop - for (pimple.start(); pimple.loop(); pimple++) + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) { #include "alphaEqnsSubCycle.H" @@ -125,8 +125,8 @@ int main(int argc, char *argv[]) #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H index c3b3726d12226076b01b95627ab82cce24ca2638..1d7b9ca624a4e0acb1d653890c23adda345b5627 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H @@ -42,7 +42,7 @@ adjustPhi(phi, U, pcorr); - for(int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( @@ -51,7 +51,7 @@ pcorrEqn.solve(); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H index cdc541f0cd9b572221ec54a5a3c6154a119ea695..26666c41203f40d6ce9081648103f69d228f2060 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H @@ -39,7 +39,7 @@ - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqnIncomp ( @@ -55,10 +55,10 @@ ) *p_rghEqnComp() + p_rghEqnIncomp, - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) + mesh.solver(p_rgh.select(pimple.finalInnerIter())) ); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { dgdt = (pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1)) diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H index 38bacbf4eaeaebd5e4efa0c7e2554a2b3bc85477..1a718434a81f998e90476ddc61d48fc6e24ae6c6 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H @@ -4,7 +4,7 @@ label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); - if (nAlphaSubCycles > 1 && pimple.nOuterCorr() != 1) + if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) { FatalErrorIn(args.executable()) << "Sub-cycling alpha is only allowed for PISO, " diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 02d6764ae2d0ba8f9e80779309586c534d515028..4ad1b3d01da6be39bcd818c33e989c9ec2986e23 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -74,8 +74,8 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - // --- Outer-corrector loop - for (pimple.start(); pimple.loop(); pimple++) + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) { #include "alphaEqnsSubCycle.H" @@ -83,8 +83,8 @@ int main(int argc, char *argv[]) #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index 28c42abe7928a3ea14d8272dbb474e72ac3c13f8..035e8e237da1b02591154623c3b5ec90c1ea14d2 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -39,7 +39,7 @@ - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqnIncomp ( @@ -55,10 +55,10 @@ ) *p_rghEqnComp() + p_rghEqnIncomp, - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) + mesh.solver(p_rgh.select(pimple.finalInnerIter())) ); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { dgdt = (pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1)) diff --git a/applications/solvers/multiphase/compressibleInterFoam/readControls.H b/applications/solvers/multiphase/compressibleInterFoam/readControls.H index 954fcb27f2da0f67bc0131113f86a99d807a7d09..87a055d641f44e76ee10348cc43fb17c5d558390 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/readControls.H @@ -1,19 +1,13 @@ - #include "readTimeControls.H" + #include "readTimeControls.H" - label nAlphaCorr - ( - readLabel(pimple.dict().lookup("nAlphaCorr")) - ); + label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - label nAlphaSubCycles - ( - readLabel(pimple.dict().lookup("nAlphaSubCycles")) - ); + label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); - if (nAlphaSubCycles > 1 && pimple.nOuterCorr() != 1) + if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) { FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO, " + << "Sub-cycling alpha is only allowed for PISO operation, " "i.e. when the number of outer-correctors = 1" << exit(FatalError); } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C index c764472cb77c8f4dff4c3d1712417fac87b4cbfc..d29da482bae16c4a88716b12191e84c82e087d65 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "alphaEqn.H" #include "kEpsilon.H" @@ -85,8 +85,8 @@ int main(int argc, char *argv[]) #include "TEqns.H" #include "UEqns.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H index ea3e825448c1f644eda5055c20fd57c510988e24..d6af50988faa90a997668c0563df9dbf3caba1e1 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H @@ -69,7 +69,7 @@ + alpha2f*rAlphaAU2f/fvc::interpolate(rho2)) ); - for(int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqnIncomp ( @@ -82,12 +82,11 @@ ( (alpha1/rho1)*pEqnComp1() + (alpha2/rho2)*pEqnComp2() - ) + - pEqnIncomp, - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + ) + + pEqnIncomp, + mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { surfaceScalarField mSfGradp = pEqnIncomp.flux()/Dp; phi1 += rAlphaAU1f*mSfGradp/fvc::interpolate(rho1); diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C index 938ccbcc02a1e24aba7e85e07828551ee57ad02b..06811c219195d9a5f4f8ea22eb3e25da9a35348b 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C @@ -81,12 +81,12 @@ int main(int argc, char *argv[]) turbulence->correct(); // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C index b4f87264b928e96c16e14055cc914b48a1f0baa5..042a17e1f3cf7c127dc7221006ca9d4caefccd7d 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C @@ -84,12 +84,12 @@ int main(int argc, char *argv[]) #include "zonePhaseVolumes.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/pEqn.H b/applications/solvers/multiphase/interFoam/MRFInterFoam/pEqn.H index d281e177c8e02dfe6a112f39a2acf44d13921678..6fc51c7ceee25475e2558ce7549960caf20ff54c 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/pEqn.H @@ -19,7 +19,7 @@ - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); - for(int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -28,12 +28,9 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= p_rghEqn.flux(); } diff --git a/applications/solvers/multiphase/interFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/correctPhi.H index cb3503e7b8d385f4cf6110cc4c2d57beb3c246f2..a2a61cef21dffc6dd15e0d2538817498c6ecdc54 100644 --- a/applications/solvers/multiphase/interFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/correctPhi.H @@ -34,7 +34,7 @@ adjustPhi(phi, U, pcorr); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( @@ -44,7 +44,7 @@ pcorrEqn.setReference(pRefCell, pRefValue); pcorrEqn.solve(); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index 1face6ddd57a9ad664f9a7811403fc8cc49d9a68..a0c4827633d50210fdd13e6d7ee5e6d56a4a7d34 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -116,12 +116,12 @@ int main(int argc, char *argv[]) #include "alphaEqnSubCycle.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H index 4b90d9949929bc3a5b7d761acc8294604c9d4b51..d94e075424aa1539099cf7e62c29612c0ee373fc 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H @@ -21,7 +21,7 @@ - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -30,12 +30,9 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= p_rghEqn.flux(); } diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index d3895c142c1f100179304fb55742652ce5f5912b..559916f2ce3e313f9c946b4d0e832d7a673fe5a5 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -84,12 +84,12 @@ int main(int argc, char *argv[]) #include "alphaEqnSubCycle.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/interFoam/pEqn.H b/applications/solvers/multiphase/interFoam/pEqn.H index d75a76766ab21c56a0c8a1e3fbc173a72054297f..a88b5627e2d8944bf97343eb8eca3f9b86a9f66b 100644 --- a/applications/solvers/multiphase/interFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/pEqn.H @@ -18,7 +18,7 @@ - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -27,12 +27,9 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= p_rghEqn.flux(); } diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C index 251a36c997b05b751810a26eae18ce42dcf3501a..891736c77fcc0f4872f92f76558b17b56f7bfe72 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C @@ -85,12 +85,12 @@ int main(int argc, char *argv[]) #include "alphaEqnSubCycle.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C index 73cbee3ae430ce641c9aac8e52ede4d3c328eb71..d4b1194ba11a52e523e1a1700723aeeb93ac4308 100644 --- a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C @@ -78,12 +78,12 @@ int main(int argc, char *argv[]) #define twoPhaseProperties threePhaseProperties // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H index b68160e62d44abdf268134e961e8648f547cc6d3..6e02524e26232e3495d4cab10796cc6091231650 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H @@ -7,7 +7,7 @@ surfaceScalarField rhoPhi mesh ), mesh, - dimensionedScalar("0", dimensionSet(1, 0, -1, 0, 0), 0) + dimensionedScalar("0", dimMass/dimTime, 0) ); { @@ -40,7 +40,7 @@ surfaceScalarField rhoPhi #include "alphaEqn.H" } - if (pimple.nOuterCorr() == 1) + if (pimple.nCorrPIMPLE() == 1) { interface.correct(); } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index 70fd424e6269f50bed4bc5b7855c00422b07506e..5ed807bbad45965dc8b018005214b76d07bb171d 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -85,12 +85,12 @@ int main(int argc, char *argv[]) turbulence->correct(); // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H index 6cfa59cc7c8e7c7b418cd5b0f9453dd7f423bb8c..c9b65eb9d5a575e3b05f4487685f2d477b41559e 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H @@ -13,8 +13,9 @@ adjustPhi(phiU, U, p_rgh); - phi = phiU + - ( + phi = + phiU + + ( fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); @@ -23,7 +24,7 @@ const volScalarField& vDotcP = vDotP[0](); const volScalarField& vDotvP = vDotP[1](); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -33,12 +34,9 @@ p_rghEqn.setReference(pRefCell, pRefValue); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi += p_rghEqn.flux(); } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H b/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H index 92c8676225e7b9f7789b726c4c64e686b34c6cff..78f93384b0a103389aafcb0ca22e44a571c17788 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/correctPhi.H @@ -34,7 +34,7 @@ adjustPhi(phi, U, pcorr); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( @@ -44,7 +44,7 @@ pcorrEqn.setReference(pRefCell, pRefValue); pcorrEqn.solve(); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C index 5f21d175efaeeb84d1b313897a274d7fc94f90d7..4ca01f1a3a89f3bc9e75697057a8fd42e0fd8920 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { sgsModel->correct(); fluid.solve(); @@ -86,8 +86,8 @@ int main(int argc, char *argv[]) //#include "TEqns.H" #include "UEqns.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H index 55bd1853aadcda70262b6215045be06c1051164f..98fa7b139e1bbf47d12866fe7794c5b5fe3c54c6 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H @@ -152,7 +152,7 @@ Dp = mag(Dp); adjustPhi(phi0, U, p); - for(int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqnIncomp ( @@ -167,10 +167,10 @@ // + (alpha2/rho2)*pEqnComp2() // ) + pEqnIncomp, - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + mesh.solver(p.select(pimple.finalInnerIter())) ); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { surfaceScalarField mSfGradp = pEqnIncomp.flux()/Dp; diff --git a/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C index 6769a4747494b3c9ce8865b2e11a6662b88ef68a..0179b98e68ca5a45d58f5b5a1701b994f3b4c2f1 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C @@ -76,12 +76,12 @@ int main(int argc, char *argv[]) #include "zonePhaseVolumes.H" // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/pEqn.H b/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/pEqn.H index 9975ebac832570c72c065923426208ac8106f330..efb181f3f2d31740bdd8ea6c41c2d734bd06c2b2 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/pEqn.H @@ -14,13 +14,14 @@ adjustPhi(phiU, U, p_rgh); - phi = phiU + - ( - mixture.surfaceTensionForce() - - ghf*fvc::snGrad(rho) - )*rAUf*mesh.magSf(); - - for(int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + phi = + phiU + + ( + mixture.surfaceTensionForce() + - ghf*fvc::snGrad(rho) + )*rAUf*mesh.magSf(); + + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -29,12 +30,9 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= p_rghEqn.flux(); } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C index 3575c25cda4acfaca4d4e53e7f662dd4d3bdb3d4..9f3fec616b3fcea27a13b06b7b45e2d695705aa4 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C @@ -73,12 +73,12 @@ int main(int argc, char *argv[]) rho = mixture.rho(); // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/pEqn.H b/applications/solvers/multiphase/multiphaseInterFoam/pEqn.H index 78bfc89bb471efbbc2709bb67ab3f3dd8a8b55e9..e7e5bc14cfc81ec2e1f4484f8ef39a6f1142fde3 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseInterFoam/pEqn.H @@ -19,7 +19,7 @@ - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -28,12 +28,9 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= p_rghEqn.flux(); } diff --git a/applications/solvers/multiphase/settlingFoam/pEqn.H b/applications/solvers/multiphase/settlingFoam/pEqn.H index 7b62411d2d17344bf88d1014cbc5e2a05b98803c..d89fd3ef4ed05a3ea20b812f4d76ebf70ee24dec 100644 --- a/applications/solvers/multiphase/settlingFoam/pEqn.H +++ b/applications/solvers/multiphase/settlingFoam/pEqn.H @@ -17,7 +17,7 @@ phi = surfaceScalarField phiU("phiU", phi); phi -= ghf*fvc::snGrad(rho)*rAUf*mesh.magSf(); -for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) +while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -25,9 +25,10 @@ for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) ); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); - p_rghEqn.solve(); - if (nonOrth == pimple.nNonOrthCorr()) + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) { phi -= p_rghEqn.flux(); } diff --git a/applications/solvers/multiphase/settlingFoam/settlingFoam.C b/applications/solvers/multiphase/settlingFoam/settlingFoam.C index 76f141bbea63421a41fe7098fe05609ff454b1f9..3d9fe516d80904e00e293e3e29d432586b7d954e 100644 --- a/applications/solvers/multiphase/settlingFoam/settlingFoam.C +++ b/applications/solvers/multiphase/settlingFoam/settlingFoam.C @@ -65,7 +65,8 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" - for (pimple.start(); pimple.loop(); pimple++) + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) { #include "calcVdj.H" @@ -75,8 +76,8 @@ int main(int argc, char *argv[]) #include "correctViscosity.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H b/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H index 01b6442e9dff45ec0938ccd2fd9d714aafa11d7d..ac7fc35f68b9c55fecb6b1c2f8f0653abf7f9b68 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H @@ -14,7 +14,7 @@ phi = phiU - ghf*fvc::snGrad(rho)*rAUf*mesh.magSf(); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -23,12 +23,9 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); - p_rghEqn.solve - ( - mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) - ); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { phi -= p_rghEqn.flux(); } diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C index 465020a70087f3620885c452b24305443c5648c2..8a2b20e153be50b07fd86ae745f5b4e7776503f4 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { twoPhaseProperties.correct(); @@ -75,8 +75,8 @@ int main(int argc, char *argv[]) #include "UEqn.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H index 53d11f9e0692520c75b9bc68d0e11ebe4215626a..1788dd2808fca503a1f6c62137aece6b780e3c78 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/pEqn.H @@ -58,7 +58,7 @@ alphaf*rUaAf/rhoa + betaf*rUbAf/rhob ); - for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -67,12 +67,9 @@ pEqn.setReference(pRefCell, pRefValue); - pEqn.solve - ( - mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) - ); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - if (nonOrth == pimple.nNonOrthCorr()) + if (pimple.finalNonOrthogonalIter()) { surfaceScalarField SfGradp(pEqn.flux()/Dp); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C index 43f353cd1c4d01cfc66bbbda172cffb867123f8f..19810a15f19c7db8839497c21dd12b054655af28 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C @@ -76,14 +76,14 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for (pimple.start(); pimple.loop(); pimple++) + while (pimple.loop()) { #include "alphaEqn.H" #include "liftDragCoeffs.H" #include "UEqns.H" - // --- PISO loop - for (int corr=0; corr<pimple.nCorr(); corr++) + // --- Pressure corrector loop + while (pimple.correct()) { #include "pEqn.H" diff --git a/applications/utilities/mesh/generation/cvMesh/cvMesh.C b/applications/utilities/mesh/generation/cvMesh/cvMesh.C index 9c65f5cd82ada3d6ec6f89043f24796601c426bc..fa95c852c11c5ccaa307ab80e7f63c4e2ff0bb19 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/cvMesh.C @@ -34,7 +34,7 @@ Description \*---------------------------------------------------------------------------*/ -#include "fvCFD.H" +#include "argList.H" #include "conformalVoronoiMesh.H" using namespace Foam; diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C index 1b1d317138a91e7c38ffb02224d695f86102e32f..2f56ee07dea1f13086c13c4c1c33c266c102b183 100644 --- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C +++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C @@ -44,7 +44,9 @@ int main(int argc, char *argv[]) argList::validArgs.append("FOAMThermodynamicsFile"); argList args(argc, argv); - chemkinReader cr(args[1], args[2]); + speciesTable species; + + chemkinReader cr(args[1], species, args[2]); OFstream reactionsFile(args[3]); reactionsFile diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C index 87c3f13090bf012ef6f41d39361664e04167ea2a..98a742e16bf12562525fc0da02f587defff2f0c6 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C @@ -42,8 +42,8 @@ void Foam::pimpleControl::read() // Read solution controls const dictionary& pimpleDict = dict(); - nOuterCorr_ = pimpleDict.lookupOrDefault<label>("nOuterCorrectors", 1); - nCorr_ = pimpleDict.lookupOrDefault<label>("nCorrectors", 1); + nCorrPIMPLE_ = pimpleDict.lookupOrDefault<label>("nOuterCorrectors", 1); + nCorrPISO_ = pimpleDict.lookupOrDefault<label>("nCorrectors", 1); turbOnFinalIterOnly_ = pimpleDict.lookupOrDefault<Switch>("turbOnFinalIterOnly", true); } @@ -51,12 +51,14 @@ void Foam::pimpleControl::read() bool Foam::pimpleControl::criteriaSatisfied() { - if ((corr_ == 0) || residualControl_.empty() || finalIter()) + // no checks on first iteration - nothing has been calculated yet + if ((corr_ == 1) || residualControl_.empty() || finalIter()) { return false; } - bool firstIter = corr_ == 1; + + bool storeIni = this->storeInitialResiduals(); bool achieved = true; bool checked = false; // safety that some checks were indeed performed @@ -73,7 +75,7 @@ bool Foam::pimpleControl::criteriaSatisfied() checked = true; - if (firstIter) + if (storeIni) { residualControl_[fieldI].initialResidual = sp.first().initialResidual(); @@ -83,7 +85,7 @@ bool Foam::pimpleControl::criteriaSatisfied() bool relCheck = false; scalar relative = 0.0; - if (!firstIter) + if (!storeIni) { const scalar iniRes = residualControl_[fieldI].initialResidual @@ -97,9 +99,10 @@ bool Foam::pimpleControl::criteriaSatisfied() if (debug) { - Info<< algorithmName_ << "loop statistics:" << endl; + Info<< algorithmName_ << " loop:" << endl; - Info<< " " << variableName << " iter " << corr_ + Info<< " " << variableName + << " PIMPLE iter " << corr_ << ": ini res = " << residualControl_[fieldI].initialResidual << ", abs tol = " << residual @@ -120,25 +123,25 @@ bool Foam::pimpleControl::criteriaSatisfied() Foam::pimpleControl::pimpleControl(fvMesh& mesh) : solutionControl(mesh, "PIMPLE"), - nOuterCorr_(0), - nCorr_(0), - corr_(0), + nCorrPIMPLE_(0), + nCorrPISO_(0), + corrPISO_(0), turbOnFinalIterOnly_(true) { read(); - if (nOuterCorr_ > 1) + if (nCorrPIMPLE_ > 1) { Info<< nl; if (residualControl_.empty()) { Info<< algorithmName_ << ": no residual control data found. " - << "Calculations will employ " << nOuterCorr_ + << "Calculations will employ " << nCorrPIMPLE_ << " corrector loops" << nl << endl; } else { - Info<< algorithmName_ << ": max iterations = " << nOuterCorr_ + Info<< algorithmName_ << ": max iterations = " << nCorrPIMPLE_ << endl; forAll(residualControl_, i) { @@ -164,4 +167,60 @@ Foam::pimpleControl::~pimpleControl() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::pimpleControl::loop() +{ + read(); + + corr_++; + + if (debug) + { + Info<< algorithmName_ << " loop: corr = " << corr_ << endl; + } + + if (corr_ == nCorrPIMPLE_ + 1) + { + if ((!residualControl_.empty()) && (nCorrPIMPLE_ != 1)) + { + Info<< algorithmName_ << ": not converged within " + << nCorrPIMPLE_ << " iterations" << endl; + } + + corr_ = 0; + mesh_.data::remove("finalIteration"); + return false; + } + + bool completed = false; + if (criteriaSatisfied()) + { + Info<< algorithmName_ << ": converged in " << corr_ << " iterations" + << endl; + completed = true; + } + else + { + if (finalIter()) + { + mesh_.data::add("finalIteration", true); + } + + if (corr_ <= nCorrPIMPLE_) + { + if (nCorrPIMPLE_ != 1) + { + Info<< algorithmName_ << ": iteration " << corr_ << endl; + storePrevIterFields(); + } + + completed = false; + } + } + + return !completed; +} + + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H index 3b891a5aa93097e3041aa042b97ee8482b3c17f6..9a5912e4fb703a655fbbb06dc0b8c9f6ecd60309 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H @@ -55,13 +55,13 @@ protected: // Solution controls //- Maximum number of PIMPLE correctors - label nOuterCorr_; + label nCorrPIMPLE_; //- Maximum number of PISO correctors - label nCorr_; + label nCorrPISO_; - //- Current PIMPLE corrector - label corr_; + //- Current PISO corrector + label corrPISO_; //- Flag to indicate whether to only solve turbulence on final iter bool turbOnFinalIterOnly_; @@ -105,41 +105,35 @@ public: // Access - //- Current corrector index - inline label corr() const; - //- Maximum number of PIMPLE correctors - inline label nOuterCorr() const; + inline label nCorrPIMPLE() const; //- Maximum number of PISO correctors - inline label nCorr() const; + inline label nCorrPISO() const; + + //- Current PISO corrector index + inline label corrPISO() const; // Solution control - //- Loop start - inline bool start(); + //- PIMPLE loop + virtual bool loop(); + + //- Pressure corrector loop + inline bool correct(); - //- Loop loop - inline bool loop(); + //- Helper function to identify when to store the intial residuals + inline bool storeInitialResiduals() const; //- Helper function to identify final PIMPLE (outer) iteration inline bool finalIter() const; //- Helper function to identify final inner iteration - inline bool finalInnerIter - ( - const label corr, - const label nonOrth - ) const; + inline bool finalInnerIter() const; //- Helper function to identify whether to solve for turbulence inline bool turbCorr() const; - - - // Member Operators - - void operator++(int); }; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H index 59e4e14204a754d61fa545b71a6afa65190dac9d..1fe609873175cd745d297b3ba2133b151348dcfc 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H @@ -25,106 +25,70 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline Foam::label Foam::pimpleControl::corr() const +inline Foam::label Foam::pimpleControl::nCorrPIMPLE() const { - return corr_; + return nCorrPIMPLE_; } -inline Foam::label Foam::pimpleControl::nOuterCorr() const +inline Foam::label Foam::pimpleControl::nCorrPISO() const { - return nOuterCorr_; + return nCorrPISO_; } -inline Foam::label Foam::pimpleControl::nCorr() const +inline Foam::label Foam::pimpleControl::corrPISO() const { - return nCorr_; + return corrPISO_; } -inline bool Foam::pimpleControl::start() +inline bool Foam::pimpleControl::correct() { - corr_ = 0; + corrPISO_++; - return true; -} - - -inline bool Foam::pimpleControl::loop() -{ - read(); + if (debug) + { + Info<< algorithmName_ << " correct: corrPISO = " << corrPISO_ << endl; + } - if (criteriaSatisfied()) + if (corrPISO_ <= nCorrPISO_) { - Info<< algorithmName_ << ": converged in " << corr_ << " iterations" - << endl; - return false; + return true; } else { - if (finalIter()) - { - mesh_.data::add("finalIteration", true); - } - - if (corr_ < nOuterCorr_) - { - if (nOuterCorr_ != 1) - { - Info<< algorithmName_ << ": iteration " << corr_ + 1 << endl; - storePrevIterFields(); - } - - return true; - } - else - { - if ((!residualControl_.empty()) && (nOuterCorr_ != 1)) - { - Info<< algorithmName_ << ": not converged within " - << nOuterCorr_ << " iterations" << endl; - } - - return false; - } + corrPISO_ = 0; + return false; } } -inline bool Foam::pimpleControl::finalIter() const +inline bool Foam::pimpleControl::storeInitialResiduals() const { - return corr_ == nOuterCorr_-1; + // start from second PIMPLE iteration + return (corr_ == 2) && (corrPISO_ == 0) && (corrNonOrtho_ == 0); } -inline bool Foam::pimpleControl::finalInnerIter -( - const label corr, - const label nonOrth -) const +inline bool Foam::pimpleControl::finalIter() const { - return - corr_ == nOuterCorr_-1 - && corr == nCorr_-1 - && nonOrth == nNonOrthCorr_; + return corr_ == nCorrPIMPLE_; } -inline bool Foam::pimpleControl::turbCorr() const +inline bool Foam::pimpleControl::finalInnerIter() const { - return !turbOnFinalIterOnly_ || finalIter(); + return + corr_ == nCorrPIMPLE_ + && corrPISO_ == nCorrPISO_ + && corrNonOrtho_ == nNonOrthCorr_ + 1; } -inline void Foam::pimpleControl::operator++(int) +inline bool Foam::pimpleControl::turbCorr() const { - if (finalIter()) - { - mesh_.data::remove("finalIteration"); - } - - corr_++; + return !turbOnFinalIterOnly_ || finalIter(); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C index d2b603a5e01961e43e2ef3fa3c4344de0a3497ce..b944f38b8f4a17eff3705a96389462a8f71e0e4d 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C @@ -119,4 +119,38 @@ Foam::simpleControl::~simpleControl() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::simpleControl::loop() +{ + read(); + + Time& time = const_cast<Time&>(mesh_.time()); + + if (initialised_) + { + if (criteriaSatisfied()) + { + Info<< nl << algorithmName_ << " solution converged in " + << time.timeName() << " iterations" << nl << endl; + + // Set to finalise calculation + time.writeAndEnd(); + } + else + { + storePrevIterFields(); + } + } + else + { + initialised_ = true; + storePrevIterFields(); + } + + + return time.loop(); +} + + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.H b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.H index ee718ce424b884e6c894e2c1acdb12e5888397ca..71f8d0e04c70d32089e5d2b4a37f6747587abba8 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.H @@ -96,7 +96,7 @@ public: // Solution control //- Loop loop - inline bool loop(); + virtual bool loop(); }; @@ -106,10 +106,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "simpleControlI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControlI.H b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControlI.H deleted file mode 100644 index 9080c9b24523aebb4470ec5f770f9c321e7e4544..0000000000000000000000000000000000000000 --- a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControlI.H +++ /dev/null @@ -1,62 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "Time.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline bool Foam::simpleControl::loop() -{ - read(); - - Time& time = const_cast<Time&>(mesh_.time()); - - if (initialised_) - { - if (criteriaSatisfied()) - { - Info<< nl << algorithmName_ << " solution converged in " - << time.timeName() << " iterations" << nl << endl; - - // Set to finalise calculation - time.writeAndEnd(); - } - else - { - storePrevIterFields(); - } - } - else - { - initialised_ = true; - storePrevIterFields(); - } - - - return time.loop(); -} - - -// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C index a238d94e0af4e650bb24c1abdd88dd934d705b11..3de1587e7e9eb3a2e790c9dcb1875797fcc62901 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C @@ -170,7 +170,9 @@ Foam::solutionControl::solutionControl(fvMesh& mesh, const word& algorithmName) algorithmName_(algorithmName), nNonOrthCorr_(0), momentumPredictor_(true), - transonic_(false) + transonic_(false), + corr_(0), + corrNonOrtho_(0) {} diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H index 94a8b41305271ffbce0d6b3b5c25b3b1089e783f..45970fc325baa23c97549951a7bb463908fb7064 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H @@ -82,6 +82,15 @@ protected: bool transonic_; + // Evolution + + //- Current corrector loop index + label corr_; + + //- Current non-orthogonal corrector loop index + label corrNonOrtho_; + + // Protected Member Functions //- Read controls from fvSolution dictionary @@ -137,17 +146,35 @@ public: //- Return the solution dictionary inline const dictionary& dict() const; + //- Current corrector loop index + inline label corr() const; + + //- Current non-orthogonal corrector index + inline label corrNonOrtho() const; + // Solution control //- Maximum number of non-orthogonal correctors inline label nNonOrthCorr() const; + //- Helper function to identify final non-orthogonal iteration + inline bool finalNonOrthogonalIter() const; + //- Flag to indicate to solve for momentum inline bool momentumPredictor() const; //- Flag to indicate to solve using transonic algorithm inline bool transonic() const; + + + // Evolution + + //- Main control loop + virtual bool loop() = 0; + + //- Non-orthogonal corrector loop + inline bool correctNonOrthogonal(); }; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H index 438c8569d3eea055e49362d0686648bf0ecde9ae..b9d975cfba2079d805bfee913354075ac8d7e028 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H @@ -31,12 +31,30 @@ inline const Foam::dictionary& Foam::solutionControl::dict() const } +inline Foam::label Foam::solutionControl::corr() const +{ + return corr_; +} + + +inline Foam::label Foam::solutionControl::corrNonOrtho() const +{ + return corrNonOrtho_; +} + + inline Foam::label Foam::solutionControl::nNonOrthCorr() const { return nNonOrthCorr_; } +inline bool Foam::solutionControl::finalNonOrthogonalIter() const +{ + return corrNonOrtho_ == nNonOrthCorr_ + 1; +} + + inline bool Foam::solutionControl::momentumPredictor() const { return momentumPredictor_; @@ -49,4 +67,26 @@ inline bool Foam::solutionControl::transonic() const } +inline bool Foam::solutionControl::correctNonOrthogonal() +{ + corrNonOrtho_++; + + if (debug) + { + Info<< algorithmName_ << " correctNonOrthogonal: corrNonOrtho = " + << corrNonOrtho_ << endl; + } + + if (corrNonOrtho_ <= nNonOrthCorr_ + 1) + { + return true; + } + else + { + corrNonOrtho_ = 0; + return false; + } +} + + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C index 855db45c88a6d679342811c4f66dbd3c37d8562a..dfef9f4835e4e5fe82104216139940aade8b9b33 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "VoidFraction.H" -# + // * * * * * * * * * * * * * Protectd Member Functions * * * * * * * * * * * // template<class CloudType> diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.C index d6dd42a0451801e5b66b1953e8fa669d95858819..75a21a16903e01a205ea3a6c793a6a93c51a7b4e 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.C @@ -31,7 +31,8 @@ template<class ThermoType> Foam::autoPtr<Foam::chemistryReader<ThermoType> > Foam::chemistryReader<ThermoType>::New ( - const dictionary& thermoDict + const dictionary& thermoDict, + speciesTable& species ) { // Let the chemistry reader type default to CHEMKIN @@ -50,7 +51,7 @@ Foam::chemistryReader<ThermoType>::New { FatalErrorIn ( - "chemistryReader::New(const dictionary& thermoDict)" + "chemistryReader::New(const dictionary&, speciesTable&)" ) << "Unknown chemistryReader type " << chemistryReaderTypeName << nl << nl << "Valid chemistryReader types are:" << nl @@ -58,7 +59,10 @@ Foam::chemistryReader<ThermoType>::New << exit(FatalError); } - return autoPtr<chemistryReader<ThermoType> >(cstrIter()(thermoDict)); + return autoPtr<chemistryReader<ThermoType> > + ( + cstrIter()(thermoDict, species) + ); } diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H index 839100b7a34f4037babd34db64496ee8a4ff66ac..13313b9772c9d5788f7b895e0ff2a60ed5288789 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H @@ -85,16 +85,21 @@ public: chemistryReader, dictionary, ( - const dictionary& thermoDict + const dictionary& thermoDict, + speciesTable& species ), - (thermoDict) + (thermoDict, species) ); // Selectors //- Select constructed from dictionary - static autoPtr<chemistryReader> New(const dictionary& thermoDict); + static autoPtr<chemistryReader> New + ( + const dictionary& thermoDict, + speciesTable& species + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C index a95f9439c980f59b06f4e8b2f59a1509022e9616..26fb1b14789489335652705d91f9116cb7e34bc2 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C @@ -854,29 +854,31 @@ void Foam::chemkinReader::read Foam::chemkinReader::chemkinReader ( const fileName& CHEMKINFileName, + speciesTable& species, const fileName& thermoFileName ) : lineNo_(1), specieNames_(10), - speciesTable_(), + speciesTable_(species), reactions_(speciesTable_, speciesThermo_) { read(CHEMKINFileName, thermoFileName); } -Foam::chemkinReader::chemkinReader(const dictionary& thermoDict) +Foam::chemkinReader::chemkinReader +( + const dictionary& thermoDict, + speciesTable& species +) : lineNo_(1), specieNames_(10), - speciesTable_(), + speciesTable_(species), reactions_(speciesTable_, speciesThermo_) { - fileName chemkinFile - ( - fileName(thermoDict.lookup("CHEMKINFile")).expand() - ); + fileName chemkinFile(fileName(thermoDict.lookup("CHEMKINFile")).expand()); fileName thermoFile = fileName::null; diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H index f00889d0564e4b7994844fdae88ab5afd252d371..6e0d4dc5c1af7eec497eb6d7c0ece31f71be1c39 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H @@ -193,7 +193,7 @@ private: HashTable<label> specieIndices_; //- Table of species - speciesTable speciesTable_; + speciesTable& speciesTable_; //- Specie phase HashTable<phase> speciePhase_; @@ -318,11 +318,12 @@ public: chemkinReader ( const fileName& chemkinFile, + speciesTable& species, const fileName& thermoFileName = fileName::null ); //- Construct by getting the CHEMKIN III file name from dictionary - chemkinReader(const dictionary& thermoDict); + chemkinReader(const dictionary& thermoDict, speciesTable& species); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.C index 3024473270f94d87ad8d1a99792b29cf4ed5055c..0efe8e2b8a5ec839bd63619bce637c3cd9d7475c 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.C @@ -27,12 +27,28 @@ License #include "IFstream.H" #include "addToRunTimeSelectionTable.H" +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class ThermoType> +Foam::speciesTable& Foam::foamChemistryReader<ThermoType>::setSpecies +( + const dictionary& dict, + speciesTable& species +) +{ + wordList s(dict.lookup("species")); + species.transfer(s); + return species; +} + + // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // template<class ThermoType> Foam::foamChemistryReader<ThermoType>::foamChemistryReader ( const fileName& reactionsFileName, + speciesTable& species, const fileName& thermoFileName ) : @@ -51,8 +67,8 @@ Foam::foamChemistryReader<ThermoType>::foamChemistryReader fileName(thermoFileName).expand() )() ), + speciesTable_(setSpecies(chemDict_, species)), speciesThermo_(thermoDict_), - speciesTable_(chemDict_.lookup("species")), reactions_(speciesTable_, speciesThermo_, chemDict_) {} @@ -60,7 +76,8 @@ Foam::foamChemistryReader<ThermoType>::foamChemistryReader template<class ThermoType> Foam::foamChemistryReader<ThermoType>::foamChemistryReader ( - const dictionary& thermoDict + const dictionary& thermoDict, + speciesTable& species ) : chemistryReader<ThermoType>(), @@ -79,7 +96,7 @@ Foam::foamChemistryReader<ThermoType>::foamChemistryReader )() ), speciesThermo_(thermoDict_), - speciesTable_(chemDict_.lookup("species")), + speciesTable_(setSpecies(chemDict_, species)), reactions_(speciesTable_, speciesThermo_, chemDict_) {} diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H index 84f18d22210307c97a46afe5949a2f1d49792082..925692dc7aa4d90018647610f4e5f7165604635c 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H @@ -67,7 +67,7 @@ class foamChemistryReader HashPtrTable<ThermoType> speciesThermo_; //- Table of species - speciesTable speciesTable_; + speciesTable& speciesTable_; //- List of the reactions ReactionList<ThermoType> reactions_; @@ -75,6 +75,9 @@ class foamChemistryReader // Private Member Functions + //- Set the species list + speciesTable& setSpecies(const dictionary& dict, speciesTable& species); + //- Disallow default bitwise copy construct foamChemistryReader(const foamChemistryReader&); @@ -94,12 +97,17 @@ public: foamChemistryReader ( const fileName& reactionsFileName, + speciesTable& species, const fileName& thermoFileName ); //- Construct by getting the foamChemistry and thermodynamics file names // from dictionary - foamChemistryReader(const dictionary& thermoDict); + foamChemistryReader + ( + const dictionary& thermoDict, + speciesTable& species + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C index d5707fe8fd5fba5deea7d145356688aa18b60f55..3d78443860ff996c24d313f7da22119ce14b7064 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C @@ -49,7 +49,7 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::constructSpeciesData template<class ThermoType> void Foam::multiComponentMixture<ThermoType>::correctMassFractions() { - // It changes Yt patches to "calculated" + // It changes Yt patches to "calculated" volScalarField Yt("Yt", 1.0*Y_[0]); for (label n=1; n<Y_.size(); n++) diff --git a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.C index 4303a0e7fb2c8f28e1fcdfbb93928dc9bb129d56..6c8cd1f50acacabae381cb4682d627605afe5b29 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.C @@ -35,14 +35,15 @@ Foam::reactingMixture<ThermoType>::reactingMixture const fvMesh& mesh ) : + speciesTable(), autoPtr<chemistryReader<ThermoType> > ( - chemistryReader<ThermoType>::New(thermoDict) + chemistryReader<ThermoType>::New(thermoDict, *this) ), multiComponentMixture<ThermoType> ( thermoDict, - autoPtr<chemistryReader<ThermoType> >::operator()().species(), + *this, autoPtr<chemistryReader<ThermoType> >::operator()().speciesThermo(), mesh ), diff --git a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H index 5c004eefebb77568bc1acb38c002cb9012ddffc3..b29c0758ad6589663e4c3feab8a631a9b64128d0 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H @@ -35,6 +35,7 @@ SourceFiles #ifndef reactingMixture_H #define reactingMixture_H +#include "speciesTable.H" #include "chemistryReader.H" #include "multiComponentMixture.H" @@ -50,6 +51,7 @@ namespace Foam template<class ThermoType> class reactingMixture : + public speciesTable, public autoPtr<chemistryReader<ThermoType> >, public multiComponentMixture<ThermoType>, public PtrList<Reaction<ThermoType> > @@ -84,6 +86,16 @@ public: //- Read dictionary void read(const dictionary&); + + label size() const + { + return PtrList<Reaction<ThermoType> >::size(); + } + + Reaction<ThermoType>& operator [] (const label i) + { + return PtrList<Reaction<ThermoType> >::operator[](i); + } }; diff --git a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C index c4a66e715940baec3274dc7194af3683f3804285..6c90e7c0823e4e690c89babcb3b30a54ec197a63 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C @@ -68,8 +68,8 @@ NonEquilibriumReversibleReaction ) : Reaction<ReactionThermo>(species, thermoDatabase, dict), - fk_(species, dict), - rk_(species, dict) + fk_(species, dict.subDict("forward")), + rk_(species, dict.subDict("reverse")) {} @@ -136,8 +136,20 @@ void Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::write ) const { Reaction<ReactionThermo>::write(os); + + os << indent << "forward" << nl; + os << indent << token::BEGIN_BLOCK << nl; + os << incrIndent; fk_.write(os); + os << decrIndent; + os << indent << token::END_BLOCK << nl; + + os << indent << "reverse" << nl; + os << indent << token::BEGIN_BLOCK << nl; + os << incrIndent; rk_.write(os); + os << decrIndent; + os << indent << token::END_BLOCK << nl; } diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H index 7a477bcd4b5cf39a6807da693d8ef7e85a79bac1..8a1c8e7e4d977d359b75f42097db0b0ad2c12f8f 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H @@ -67,10 +67,10 @@ FallOffReactionRate const dictionary& dict ) : - k0_(species, dict), - kInf_(species, dict), - F_(dict), - thirdBodyEfficiencies_(species, dict) + k0_(species, dict.subDict("k0")), + kInf_(species, dict.subDict("kInf")), + F_(dict.subDict("F")), + thirdBodyEfficiencies_(species, dict.subDict("thirdBodyEfficiencies")) {} @@ -100,10 +100,33 @@ inline void Foam::FallOffReactionRate<ReactionRate, FallOffFunction>::write Ostream& os ) const { + os << indent << "k0" << nl; + os << indent << token::BEGIN_BLOCK << nl; + os << incrIndent; k0_.write(os); + os << decrIndent; + os << indent << token::END_BLOCK << nl; + + os << indent << "kInf" << nl; + os << indent << token::BEGIN_BLOCK << nl; + os << incrIndent; kInf_.write(os); + os << decrIndent; + os << indent << token::END_BLOCK << nl; + + os << indent << "F" << nl; + os << indent << token::BEGIN_BLOCK << nl; + os << incrIndent; F_.write(os); + os << decrIndent; + os << indent << token::END_BLOCK << nl; + + os << indent << "thirdBodyEfficiencies" << nl; + os << indent << token::BEGIN_BLOCK << nl; + os << incrIndent; thirdBodyEfficiencies_.write(os); + os << decrIndent; + os << indent << token::END_BLOCK << nl; } diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index f18b124e06ccb21f20f0de1c3027a0db3f4baf0e..e28a68590391b8cbd750611ab51f601a04872179 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -16,6 +16,7 @@ LienCubicKELowRe/LienCubicKELowRe.C NonlinearKEShih/NonlinearKEShih.C LienLeschzinerLowRe/LienLeschzinerLowRe.C LamBremhorstKE/LamBremhorstKE.C +kkLOmega/kkLOmega.C /* Wall functions */ wallFunctions = derivedFvPatchFields/wallFunctions diff --git a/src/turbulenceModels/incompressible/RAS/kkLOmega/kkLOmega.C b/src/turbulenceModels/incompressible/RAS/kkLOmega/kkLOmega.C new file mode 100644 index 0000000000000000000000000000000000000000..ad864bb3c7e39c07729b033dc7b2a9f304177844 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/kkLOmega/kkLOmega.C @@ -0,0 +1,779 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "kkLOmega.H" +#include "addToRunTimeSelectionTable.H" + +#include "backwardsCompatibilityWallFunctions.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(kkLOmega, 0); +addToRunTimeSelectionTable(RASModel, kkLOmega, dictionary); + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +tmp<volScalarField> kkLOmega::fv(const volScalarField& Ret) const +{ + return(1.0 - exp(-sqrt(Ret)/Av_)); +} + + +tmp<volScalarField> kkLOmega::fINT() const +{ + return + ( + min + ( + kl_/(Cint_*(kl_ + kt_ + kMin_)), + dimensionedScalar("1.0", dimless, 1.0) + ) + ); +} + + +tmp<volScalarField> kkLOmega::fSS(const volScalarField& omega) const +{ + return(exp(-sqr(Css_*nu()*omega/(kt_ + kMin_)))); +} + + +tmp<volScalarField> kkLOmega::Cmu(const volScalarField& S) const +{ + return(1.0/(A0_ + As_*(S/(omega_ + omegaMin_)))); +} + + +tmp<volScalarField> kkLOmega::BetaTS(const volScalarField& Rew) const +{ + return(scalar(1.0) - exp(-sqr(max(Rew - CtsCrit_, 0.0))/Ats_)); +} + + +tmp<volScalarField> kkLOmega::fTaul +( + const volScalarField& lambdaEff, + const volScalarField& ktL +) const +{ + return + ( + scalar(1.0) + - exp + ( + -CtauL_*ktL + / + ( + sqr + ( + lambdaEff*omega_ + + dimensionedScalar + ( + "ROTVSMALL", + dimLength*inv(dimTime), + ROOTVSMALL + ) + ) + ) + ) + ); +} + + +tmp<volScalarField> kkLOmega::alphaT +( + const volScalarField& lambdaEff, + const volScalarField& fv, + const volScalarField& ktS +) const +{ + return(fv*CmuStd_*sqrt(ktS)*lambdaEff); +} + + +tmp<volScalarField> kkLOmega::fOmega +( + const volScalarField& lambdaEff, + const volScalarField& lambdaT +) const +{ + return + ( + scalar(1.0) + - exp + ( + -0.41 + * pow4 + ( + lambdaEff + / ( + lambdaT + + dimensionedScalar + ( + "ROTVSMALL", + lambdaT.dimensions(), + ROOTVSMALL + ) + ) + ) + ) + ); +} + + +tmp<volScalarField> kkLOmega::gammaBP(const volScalarField& omega) const +{ + return + ( + max + ( + kt_/nu() + / + ( + omega + + dimensionedScalar("ROTVSMALL", omega.dimensions(), ROOTVSMALL) + ) + - + CbpCrit_ + , + 0.0 + ) + ); +} + + +tmp<volScalarField> kkLOmega::gammaNAT +( + const volScalarField& ReOmega, + const volScalarField& fNatCrit +) const +{ + return + ( + max + ( + ReOmega + - CnatCrit_ + / ( + fNatCrit + dimensionedScalar("ROTVSMALL", dimless, ROOTVSMALL) + ) + , + 0.0 + ) + ); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +kkLOmega::kkLOmega +( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& transport, + const word& turbulenceModelName, + const word& modelName +) +: + RASModel(modelName, U, phi, transport, turbulenceModelName), + + A0_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "A0", + coeffDict_, + 4.04 + ) + ), + As_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "As", + coeffDict_, + 2.12 + ) + ), + Av_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Av", + coeffDict_, + 6.75 + ) + ), + Abp_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Abp", + coeffDict_, + 0.6 + ) + ), + Anat_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Anat", + coeffDict_, + 200 + ) + ), + Ats_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Ats", + coeffDict_, + 200 + ) + ), + CbpCrit_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CbpCrit", + coeffDict_, + 1.2 + ) + ), + Cnc_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Cnc", + coeffDict_, + 0.1 + ) + ), + CnatCrit_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CnatCrit", + coeffDict_, + 1250 + ) + ), + Cint_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Cint", + coeffDict_, + 0.75 + ) + ), + CtsCrit_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CtsCrit", + coeffDict_, + 1000 + ) + ), + CrNat_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CrNat", + coeffDict_, + 0.02 + ) + ), + C11_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "C11", + coeffDict_, + 3.4e-6 + ) + ), + C12_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "C12", + coeffDict_, + 1.0e-10 + ) + ), + CR_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CR", + coeffDict_, + 0.12 + ) + ), + CalphaTheta_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CalphaTheta", + coeffDict_, + 0.035 + ) + ), + Css_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Css", + coeffDict_, + 1.5 + ) + ), + CtauL_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CtauL", + coeffDict_, + 4360 + ) + ), + Cw1_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Cw1", + coeffDict_, + 0.44 + ) + ), + Cw2_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Cw2", + coeffDict_, + 0.92 + ) + ), + Cw3_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Cw3", + coeffDict_, + 0.3 + ) + ), + CwR_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CwR", + coeffDict_, + 1.5 + ) + ), + Clambda_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Clambda", + coeffDict_, + 2.495 + ) + ), + CmuStd_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CmuStd", + coeffDict_, + 0.09 + ) + ), + Prtheta_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Prtheta", + coeffDict_, + 0.85 + ) + ), + Sigmak_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Sigmak", + coeffDict_, + 1 + ) + ), + Sigmaw_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Sigmaw", + coeffDict_, + 1.17 + ) + ), + kt_ + ( + IOobject + ( + "kt", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + autoCreateK("kt", mesh_) + ), + omega_ + ( + IOobject + ( + "omega", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + autoCreateOmega("omega", mesh_) + ), + kl_ + ( + IOobject + ( + "kl", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + autoCreateK("kl", mesh_) + ), + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + autoCreateNut("nut", mesh_) + ), + y_(mesh_) +{ + bound(kt_, kMin_); + bound(kl_, kMin_); + bound(omega_, omegaMin_); + + nut_ = kt_/(omega_ + omegaMin_); + nut_.correctBoundaryConditions(); + + printCoeffs(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp<volSymmTensorField> kkLOmega::R() const +{ + return tmp<volSymmTensorField> + ( + new volSymmTensorField + ( + IOobject + ( + "R", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + ((2.0/3.0)*I)*(kt_) - nut_*twoSymm(fvc::grad(U_)), + kt_.boundaryField().types() + ) + ); +} + + +tmp<volSymmTensorField> kkLOmega::devReff() const +{ + return tmp<volSymmTensorField> + ( + new volSymmTensorField + ( + IOobject + ( + "devRhoReff", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -nuEff()*dev(twoSymm(fvc::grad(U_))) + ) + ); +} + + +tmp<fvVectorMatrix> kkLOmega::divDevReff(volVectorField& U) const +{ + return + ( + - fvm::laplacian(nuEff(), U) + - fvc::div(nuEff()*dev(T(fvc::grad(U)))) + ); +} + + +bool kkLOmega::read() +{ + if (RASModel::read()) + { + A0_.readIfPresent(coeffDict()); + As_.readIfPresent(coeffDict()); + Av_.readIfPresent(coeffDict()); + Abp_.readIfPresent(coeffDict()); + Anat_.readIfPresent(coeffDict()); + Abp_.readIfPresent(coeffDict()); + Ats_.readIfPresent(coeffDict()); + CbpCrit_.readIfPresent(coeffDict()); + Cnc_.readIfPresent(coeffDict()); + CnatCrit_.readIfPresent(coeffDict()); + Cint_.readIfPresent(coeffDict()); + CtsCrit_.readIfPresent(coeffDict()); + CrNat_.readIfPresent(coeffDict()); + C11_.readIfPresent(coeffDict()); + C12_.readIfPresent(coeffDict()); + CR_.readIfPresent(coeffDict()); + CalphaTheta_.readIfPresent(coeffDict()); + Css_.readIfPresent(coeffDict()); + CtauL_.readIfPresent(coeffDict()); + Cw1_.readIfPresent(coeffDict()); + Cw2_.readIfPresent(coeffDict()); + Cw3_.readIfPresent(coeffDict()); + CwR_.readIfPresent(coeffDict()); + Clambda_.readIfPresent(coeffDict()); + CmuStd_.readIfPresent(coeffDict()); + Prtheta_.readIfPresent(coeffDict()); + Sigmak_.readIfPresent(coeffDict()); + Sigmaw_.readIfPresent(coeffDict()); + + return true; + } + else + { + return false; + } +} + + +void kkLOmega::correct() +{ + RASModel::correct(); + + if (!turbulence_) + { + return; + } + + if (mesh_.changing()) + { + y_.correct(); + y_.boundaryField() = max(y_.boundaryField(), VSMALL); + } + + + const volScalarField kT(kt_ + kl_); + + const volScalarField lambdaT(sqrt(kT)/(omega_ + omegaMin_)); + + const volScalarField lambdaEff(min(Clambda_*y_, lambdaT)); + + const volScalarField fw + ( + lambdaEff/(lambdaT + dimensionedScalar("SMALL", dimLength, ROOTVSMALL)) + ); + + const volTensorField gradU(fvc::grad(U_)); + + const volScalarField omega(sqrt(2.0)*mag(skew(gradU))); + + const volScalarField S2(2.0*magSqr(symm(gradU))); + + const volScalarField ktS(fSS(omega)*fw*kt_); + + const volScalarField nuts + ( + fv(sqr(fw)*kt_/nu()/(omega_ + omegaMin_)) + *fINT() + *Cmu(sqrt(S2))*sqrt(ktS)*lambdaEff + ); + const volScalarField Pkt(nuts*S2); + + const volScalarField ktL(kt_ - ktS); + const volScalarField ReOmega(sqr(y_)*omega/nu()); + const volScalarField nutl + ( + min + ( + C11_*fTaul(lambdaEff, ktL)*omega*sqr(lambdaEff) + * sqrt(ktL)*lambdaEff/nu() + + C12_*BetaTS(ReOmega)*ReOmega*sqr(y_)*omega + , + 0.5*(kl_ + ktL)/sqrt(S2) + ) + ); + + const volScalarField Pkl(nutl*S2); + + const volScalarField alphaTEff + ( + alphaT(lambdaEff, fv(sqr(fw)*kt_/nu()/(omega_ + omegaMin_)), ktS) + ); + + // By pass s0urce term divided by kl_ + + const dimensionedScalar fwMin("SMALL", dimless, ROOTVSMALL); + + const volScalarField Rbp + ( + CR_*(1.0 - exp(-gammaBP(omega)()/Abp_))*omega_ + / (fw + fwMin) + ); + + const volScalarField fNatCrit(1.0 - exp(-Cnc_*sqrt(kl_)*y_/nu())); + // Natural source term divided by kl_ + const volScalarField Rnat + ( + CrNat_*(1.0 - exp(-gammaNAT(ReOmega, fNatCrit)/Anat_))*omega + ); + + const volScalarField Dt(nu()*magSqr(fvc::grad(sqrt(kt_)))); + + // Turbulent kinetic energy equation + tmp<fvScalarMatrix> ktEqn + ( + fvm::ddt(kt_) + + fvm::div(phi_, kt_) + - fvm::Sp(fvc::div(phi_), kt_) + - fvm::laplacian(DkEff(alphaTEff), kt_, "laplacian(alphaTEff,kt)") + == + Pkt + + (Rbp + Rnat)*kl_ + - Dt + - fvm::Sp(omega_, kt_) + ); + + ktEqn().relax(); + ktEqn().boundaryManipulate(kt_.boundaryField()); + + solve(ktEqn); + bound(kt_, kMin_); + + + const volScalarField Dl(nu()*magSqr(fvc::grad(sqrt(kl_)))); + + // Laminar kinetic energy equation + tmp<fvScalarMatrix> klEqn + ( + fvm::ddt(kl_) + + fvm::div(phi_, kl_) + - fvm::Sp(fvc::div(phi_), kl_) + - fvm::laplacian(nu(), kl_, "laplacian(nu,kl)") + == + Pkl + - fvm::Sp(Rbp, kl_) + - fvm::Sp(Rnat, kl_) + - Dl + ); + + klEqn().relax(); + klEqn().boundaryManipulate(kl_.boundaryField()); + + solve(klEqn); + bound(kl_, kMin_); + + + omega_.boundaryField().updateCoeffs(); + // Turbulence specific dissipation rate equation + tmp<fvScalarMatrix> omegaEqn + ( + fvm::ddt(omega_) + + fvm::div(phi_, omega_) + - fvm::Sp(fvc::div(phi_), omega_) + - fvm::laplacian + ( + DomegaEff(alphaTEff), + omega_, + "laplacian(alphaTEff,omega)" + ) + == + Cw1_*Pkt*omega_/(kt_ + kMin_) + + fvm::SuSp + ( + (CwR_/(fw + fwMin) - 1.0)*kl_*(Rbp + Rnat)/(kt_ + kMin_) + , omega_ + ) + - fvm::Sp(Cw2_*omega_, omega_) + + Cw3_*fOmega(lambdaEff, lambdaT)*alphaTEff*sqr(fw)*sqrt(kt_)/pow3(y_) + ); + + + omegaEqn().relax(); + omegaEqn().boundaryManipulate(omega_.boundaryField()); + + solve(omegaEqn); + bound(omega_, omegaMin_); + + // Re-calculate viscosity + nut_ = nuts + nutl; + nut_.correctBoundaryConditions(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/kkLOmega/kkLOmega.H b/src/turbulenceModels/incompressible/RAS/kkLOmega/kkLOmega.H new file mode 100644 index 0000000000000000000000000000000000000000..b7d451b315a1e31606092fc0ccc304b50609e98c --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/kkLOmega/kkLOmega.H @@ -0,0 +1,296 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::incompressible::RASModels::kkLOmega + +Description + Low Reynolds-number k-kl-omega turbulence model for + incompressible flows. + + Turbulence model described in: + \verbatim + D. Keith Walters, Davor Cokljat + "A Three-Equation Eddy-Viscosity Model for Reynold-Averaged + Navier-Stokes Simulations of Transitional Flow" + \endverbatim + + The default model coefficients correspond to the following: + \verbatim + kkLOmegaCoeffs + { + A0 4.04 + As 2.12 + Av 6.75 + Abp 0.6 + Anat 200 + Ats 200 + CbpCrit 1.2 + Cnc 0.1 + CnatCrit 1250 + Cint 0.75 + CtsCrit 1000 + CrNat 0.02 + C11 3.4e-6 + C12 1.0e-10 + CR 0.12 + CalphaTheta 0.035 + Css 1.5 + CtauL 4360 + Cw1 0.44 + Cw2 0.92 + Cw3 0.3 + CwR 1.5 + Clambda 2.495 + CmuStd 0.09 + Prtheta 0.85 + Sigmak 1 + Sigmaw 1.17 + } + \endverbatim + +SourceFiles + kkLOmega.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kkLOmega_H +#define kkLOmega_H + +#include "RASModel.H" +#include "wallDist.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class kkLOmega Declaration +\*---------------------------------------------------------------------------*/ + +class kkLOmega +: + public RASModel +{ + // Private memmber functions + + tmp<volScalarField> fv(const volScalarField& Ret) const; + + tmp<volScalarField> fINT() const; + + tmp<volScalarField> fSS(const volScalarField& omega) const; + + tmp<volScalarField> Cmu(const volScalarField& S) const; + + tmp<volScalarField> BetaTS(const volScalarField& Rew) const; + + tmp<volScalarField> fTaul + ( + const volScalarField& lambdaEff, + const volScalarField& ktL + ) const; + + tmp<volScalarField> alphaT + ( + const volScalarField& lambdaEff, + const volScalarField& fv, + const volScalarField& ktS + ) const; + + tmp<volScalarField> fOmega + ( + const volScalarField& lambdaEff, + const volScalarField& lambdaT + ) const; + + tmp<volScalarField> gammaBP(const volScalarField& omega) const; + + tmp<volScalarField> gammaNAT + ( + const volScalarField& ReOmega, + const volScalarField& fNatCrit + ) const; + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar A0_; + dimensionedScalar As_; + dimensionedScalar Av_; + dimensionedScalar Abp_; + dimensionedScalar Anat_; + dimensionedScalar Ats_; + dimensionedScalar CbpCrit_; + dimensionedScalar Cnc_; + dimensionedScalar CnatCrit_; + dimensionedScalar Cint_; + dimensionedScalar CtsCrit_; + dimensionedScalar CrNat_; + dimensionedScalar C11_; + dimensionedScalar C12_; + dimensionedScalar CR_; + dimensionedScalar CalphaTheta_; + dimensionedScalar Css_; + dimensionedScalar CtauL_; + dimensionedScalar Cw1_; + dimensionedScalar Cw2_; + dimensionedScalar Cw3_; + dimensionedScalar CwR_; + dimensionedScalar Clambda_; + dimensionedScalar CmuStd_; + dimensionedScalar Prtheta_; + dimensionedScalar Sigmak_; + dimensionedScalar Sigmaw_; + + + // Fields + + volScalarField kt_; + volScalarField omega_; + volScalarField kl_; + volScalarField nut_; + wallDist y_; + + +public: + + //- Runtime type information + TypeName("kkLOmega"); + + // Constructors + + //- Construct from components + kkLOmega + ( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& transport, + const word& turbulenceModelName = turbulenceModel::typeName, + const word& modelName = typeName + ); + + + //- Destructor + virtual ~kkLOmega() + {} + + + // Member Functions + + //- Return the turbulence viscosity + virtual tmp<volScalarField> nut() const + { + return nut_; + } + + //- Return the effective diffusivity for k + tmp<volScalarField> DkEff(const volScalarField& alphaT) const + { + return tmp<volScalarField> + ( + new volScalarField("DkEff", alphaT/Sigmak_ + nu()) + ); + } + + //- Return the effective diffusivity for omega + tmp<volScalarField> DomegaEff(const volScalarField& alphaT) const + { + return tmp<volScalarField> + ( + new volScalarField("DomegaEff", alphaT/Sigmaw_ + nu()) + ); + } + + //- Return the laminar kinetic energy + virtual tmp<volScalarField> kl() const + { + return kl_; + } + + //- Return the turbulence kinetic energy + virtual tmp<volScalarField> k() const + { + return kt_; + } + + //- Return the turbulence specific dissipation rate + virtual tmp<volScalarField> omega() const + { + return omega_; + } + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp<volScalarField> epsilon() const + { + return tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "epsilon", + mesh_.time().timeName(), + mesh_ + ), + kt_*omega_, + omega_.boundaryField().types() + ) + ); + } + + //- Return the Reynolds stress tensor + virtual tmp<volSymmTensorField> R() const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp<volSymmTensorField> devReff() const; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const; + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct(); + + //- Read RASProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //