From e08fde6215d25ff25f60df69847f880c8994c4a0 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Thu, 26 May 2016 09:42:51 +0200 Subject: [PATCH 01/26] Backported rhoPorousMRFPimpleFoam, rhoPorousSimpleFoam, rhoSimpleFoam, rhoSonicFoam, rhopSonicFoam and tutorials (vanilla OF 3.0.1) --- .../rhoPorousMRFPimpleFoam/UEqn.H | 34 +- .../rhoPorousMRFPimpleFoam/createFields.H | 2 + .../rhoPorousMRFPimpleFoam/pEqn.H | 42 +- .../rhoPorousMRFPimpleFoam.C | 11 +- .../compressible/rhoPorousSimpleFoam/UEqn.H | 7 +- .../rhoPorousSimpleFoam/convergenceCheck.H | 9 - .../rhoPorousSimpleFoam/createFields.H | 1 + .../compressible/rhoPorousSimpleFoam/hEqn.H | 3 +- .../initConvergenceCheck.H | 7 - .../compressible/rhoPorousSimpleFoam/pEqn.H | 16 +- .../rhoPorousSimpleFoam/rhoPorousSimpleFoam.C | 9 +- .../solvers/compressible/rhoSimpleFoam/UEqn.H | 7 +- .../rhoSimpleFoam/convergenceCheck.H | 9 - .../compressible/rhoSimpleFoam/createFields.H | 1 + .../solvers/compressible/rhoSimpleFoam/hEqn.H | 3 +- .../rhoSimpleFoam/initConvergenceCheck.H | 7 - .../solvers/compressible/rhoSimpleFoam/pEqn.H | 34 +- .../rhoSimpleFoam/rhoSimpleFoam.C | 9 +- .../compressible/rhoSonicFoam/createFields.H | 2 + .../compressible/rhopSonicFoam/createFields.H | 1 + .../rhopSonicFoam/rhopSonicFoam.C | 15 +- .../constant/polyMesh/blockMeshDict | 453 ++++++++++++++---- .../mixerVessel2D/constant/polyMesh/boundary | 4 +- .../mixerVessel2D/system/fvSchemes | 8 +- .../mixerVessel2D/system/fvSolution | 2 + .../angledDuctExplicit/system/fvSchemes | 8 +- .../angledDuctImplicit/system/fvSchemes | 8 +- .../rhoPorousSimpleFoam/beaverJoseph/0/T | 12 +- .../rhoPorousSimpleFoam/beaverJoseph/0/U | 4 + .../rhoPorousSimpleFoam/beaverJoseph/0/p | 6 +- .../beaverJoseph/system/fvSchemes | 8 +- .../rhoPorousSimpleFoam/porousPlug/0/T | 4 + .../rhoPorousSimpleFoam/porousPlug/0/U | 4 + .../rhoPorousSimpleFoam/porousPlug/0/p | 4 + .../porousPlug/system/fvSchemes | 8 +- .../rhoSonicFoam/forwardStep/system/fvSchemes | 6 - .../compressible/rhoSonicFoam/shockTube/0/T | 7 +- .../compressible/rhoSonicFoam/shockTube/0/U | 5 +- .../compressible/rhoSonicFoam/shockTube/0/p | 7 +- .../rhoSonicFoam/shockTube/system/fvSchemes | 6 - .../compressible/rhopSonicFoam/shockTube/0/T | 113 ++++- .../compressible/rhopSonicFoam/shockTube/0/U | 7 +- .../compressible/rhopSonicFoam/shockTube/0/p | 113 ++++- .../shockTube/constant/polyMesh/boundary | 4 +- .../rhopSonicFoam/shockTube/system/fvSchemes | 6 - .../rhopSonicFoam/shockTube/system/fvSolution | 2 +- .../wedge15Ma5/constant/polyMesh/boundary | 4 +- .../rhopSonicFoam/wedge15Ma5/system/fvSchemes | 6 - .../wedge15Ma5/system/fvSolution | 2 +- 49 files changed, 705 insertions(+), 345 deletions(-) delete mode 100644 applications/solvers/compressible/rhoPorousSimpleFoam/convergenceCheck.H delete mode 100644 applications/solvers/compressible/rhoPorousSimpleFoam/initConvergenceCheck.H delete mode 100644 applications/solvers/compressible/rhoSimpleFoam/convergenceCheck.H delete mode 100644 applications/solvers/compressible/rhoSimpleFoam/initConvergenceCheck.H diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H index ea80c2e7d..3e1b83048 100644 --- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H @@ -7,37 +7,23 @@ tmp UEqn + turbulence->divDevRhoReff(U) ); -if (oCorr == nOuterCorr-1) -{ - if (mesh.solutionDict().relax("UFinal")) - { - UEqn().relax(mesh.solutionDict().relaxationFactor("UFinal")); - } - else - { - UEqn().relax(1); - } -} -else -{ - UEqn().relax(); -} +UEqn().relax +( + mesh.solutionDict().relaxationFactor(U.select(pimple.finalIter())) +); mrfZones.addCoriolis(rho, UEqn()); pZones.addResistance(UEqn()); volScalarField rUA = 1.0/UEqn().A(); -if (momentumPredictor) +if (pimple.momentumPredictor()) { - if (oCorr == nOuterCorr-1) - { - solve(UEqn() == -fvc::grad(p), mesh.solutionDict().solver("UFinal")); - } - else - { - solve(UEqn() == -fvc::grad(p)); - } + solve + ( + UEqn() == -fvc::grad(p), + mesh.solutionDict().solver((U.select(pimple.finalIter()))) + ); } else { diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/createFields.H index b9a86ef99..ee3beea43 100644 --- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/createFields.H @@ -68,3 +68,5 @@ porousZones pZones(mesh); Switch pressureImplicitPorosity(false); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H index b714af2df..920ba0e5d 100644 --- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H @@ -3,12 +3,12 @@ rho = thermo.rho(); volScalarField rUA = 1.0/UEqn().A(); U = rUA*UEqn().H(); -if (nCorr <= 1) +if (pimple.nCorrPISO() <= 1) { UEqn.clear(); } -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -21,7 +21,7 @@ if (transonic) ); mrfZones.relativeFlux(fvc::interpolate(psi), phid); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -30,21 +30,12 @@ if (transonic) - fvm::laplacian(rho*rUA, p) ); - if + pEqn.solve ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve(mesh.solutionDict().solver("pFinal")); - } - else - { - pEqn.solve(); - } + mesh.solutionDict().solver(p.select(pimple.finalInnerIter())) + ); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -60,7 +51,7 @@ else ); mrfZones.relativeFlux(fvc::interpolate(rho), phi); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { // Pressure corrector fvScalarMatrix pEqn @@ -70,21 +61,12 @@ else - fvm::laplacian(rho*rUA, p) ); - if + pEqn.solve ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve(mesh.solutionDict().solver("pFinal")); - } - else - { - pEqn.solve(); - } + mesh.solutionDict().solver(p.select(pimple.finalInnerIter())) + ); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index a097479ae..94c3c077c 100644 --- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -39,6 +39,7 @@ Description #include "bound.H" #include "MRFZones.H" #include "porousZones.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,6 +48,9 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" + + pimpleControl pimple(mesh); + #include "createFields.H" #include "initContinuityErrs.H" #include "createTimeControls.H" @@ -58,7 +62,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPIMPLEControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -66,7 +69,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - if (nOuterCorr != 1) + if (!pimple.firstIter()) { p.storePrevIter(); rho.storePrevIter(); @@ -75,13 +78,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for (int oCorr=0; oCorr tpEqn; @@ -26,18 +26,10 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) } tpEqn().setReference(pRefCell, pRefValue); - // retain the residual from the first iteration - if (nonOrth == 0) - { - eqnResidual = tpEqn().solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); - } - else - { - tpEqn().solve(); - } - if (nonOrth == nNonOrthCorr) + tpEqn().solve(); + + if (simple.finalNonOrthogonalIter()) { phi -= tpEqn().flux(); } diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C index b72e7efd2..817c33ad8 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C @@ -34,6 +34,7 @@ Description #include "basicPsiThermo.H" #include "RASModel.H" #include "porousZones.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,6 +43,9 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" + + simpleControl simple(mesh); + #include "createFields.H" #include "initContinuityErrs.H" @@ -53,9 +57,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" - p.storePrevIter(); rho.storePrevIter(); @@ -72,8 +73,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/compressible/rhoSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoSimpleFoam/UEqn.H index 401e1203d..21ec2646b 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/UEqn.H @@ -8,9 +8,4 @@ UEqn().relax(); - eqnResidual = solve - ( - UEqn() == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn() == -fvc::grad(p)); diff --git a/applications/solvers/compressible/rhoSimpleFoam/convergenceCheck.H b/applications/solvers/compressible/rhoSimpleFoam/convergenceCheck.H deleted file mode 100644 index 895806319..000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index 122280cfa..38aaa9e5c 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -43,6 +43,7 @@ label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue); + mesh.schemesDict().setFluxRequired(p.name()); dimensionedScalar rhoMax ( diff --git a/applications/solvers/compressible/rhoSimpleFoam/hEqn.H b/applications/solvers/compressible/rhoSimpleFoam/hEqn.H index 57395e977..e6c74938e 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/hEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/hEqn.H @@ -11,8 +11,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/initConvergenceCheck.H b/applications/solvers/compressible/rhoSimpleFoam/initConvergenceCheck.H deleted file mode 100644 index b56197f22..000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index 04af6df75..3865aeb9f 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -9,7 +9,7 @@ UEqn.clear(); bool closedVolume = false; -if (transonic) +if (simple.transonic()) { surfaceScalarField phid ( @@ -17,7 +17,7 @@ if (transonic) fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf()) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -26,22 +26,13 @@ if (transonic) ); // Relax the pressure equation to ensure diagonal-dominance - pEqn.relax(mesh.solutionDict().relaxationFactor("pEqn")); + pEqn.relax(); pEqn.setReference(pRefCell, pRefValue); - // retain the residual from the first iteration - if (nonOrth == 0) - { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); - } - else - { - pEqn.solve(); - } + pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (simple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -52,7 +43,7 @@ else phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); closedVolume = adjustPhi(phi, U, p); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -61,18 +52,9 @@ else pEqn.setReference(pRefCell, pRefValue); - // Retain the residual from the first iteration - if (nonOrth == 0) - { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); - } - else - { - pEqn.solve(); - } + pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (simple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C index 6c63d09c0..189bd4db2 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C @@ -33,6 +33,7 @@ Description #include "fvCFD.H" #include "basicPsiThermo.H" #include "RASModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -41,6 +42,9 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" + + simpleControl simple(mesh); + #include "createFields.H" #include "initContinuityErrs.H" @@ -52,9 +56,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readSIMPLEControls.H" -# include "initConvergenceCheck.H" - p.storePrevIter(); rho.storePrevIter(); @@ -72,8 +73,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/compressible/rhoSonicFoam/createFields.H b/applications/solvers/compressible/rhoSonicFoam/createFields.H index f0c0e4a22..aa121b96e 100644 --- a/applications/solvers/compressible/rhoSonicFoam/createFields.H +++ b/applications/solvers/compressible/rhoSonicFoam/createFields.H @@ -94,3 +94,5 @@ rho*Cv*T + 0.5*rho*magSqr(rhoU/rho), T.boundaryField().types() ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/rhopSonicFoam/createFields.H b/applications/solvers/compressible/rhopSonicFoam/createFields.H index fed843271..c8e478e88 100644 --- a/applications/solvers/compressible/rhopSonicFoam/createFields.H +++ b/applications/solvers/compressible/rhopSonicFoam/createFields.H @@ -127,3 +127,4 @@ fields.add(magRhoU); fields.add(H); + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C b/applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C index 5d1e32170..58d362fec 100644 --- a/applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C +++ b/applications/solvers/compressible/rhopSonicFoam/rhopSonicFoam.C @@ -36,6 +36,7 @@ Description #include "MUSCL.H" #include "LimitedScheme.H" #include "boundaryTypes.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,6 +46,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "readThermodynamicProperties.H" # include "createFields.H" # include "createTimeControls.H" @@ -57,8 +61,11 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.value() << nl << endl; -# include "readPISOControls.H" - scalar HbyAblend = readScalar(piso.lookup("HbyAblend")); + scalar HbyAblend = + readScalar + ( + mesh.solutionDict().subDict("PIMPLE").lookup("HbyAblend") + ); # include "readTimeControls.H" @@ -72,7 +79,7 @@ int main(int argc, char *argv[]) # include "setDeltaT.H" - for (int outerCorr = 0; outerCorr < nOuterCorr; outerCorr++) + while (pimple.loop()) { magRhoU = mag(rhoU); H = (rhoE + p)/rho; @@ -118,7 +125,7 @@ int main(int argc, char *argv[]) psi = 1.0/(R*T); p = rho/psi; - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { volScalarField rrhoUA = 1.0/rhoUEqn.A(); surfaceScalarField rrhoUAf("rrhoUAf", fvc::interpolate(rrhoUA)); diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict index afb2d3392..9664dc64d 100644 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict @@ -15,148 +15,409 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // General macros to create 2D/extruded-2D meshes + + + + + + + + + + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // convertToMeters 0.1; // Hub radius + // Impeller-tip radius + // Baffle-tip radius + // Tank radius + // MRF region radius + // Thickness of 2D slab + // Base z + // Top z + // Number of cells radially between hub and impeller tip + // Number of cells radially in each of the two regions between // impeller and baffle tips + // Number of cells radially between baffle tip and tank + // Number of cells azimuthally in each of the 8 blocks + // Number of cells in the thickness of the slab + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // vertices ( - (0.2 0 0) // Vertex r0b = 0 - (0.2 0 0) // Vertex r0sb = 1 - (0.141421356364228 -0.141421356110391 0) // Vertex r1b = 2 - (3.58979347393082e-10 -0.2 0) // Vertex r2b = 3 - (3.58979347393082e-10 -0.2 0) // Vertex r2sb = 4 - (-0.141421355856554 -0.141421356618065 0) // Vertex r3b = 5 - (-0.2 7.17958694786164e-10 0) // Vertex r4b = 6 - (-0.2 7.17958694786164e-10 0) // Vertex r4sb = 7 - (-0.141421355856554 0.141421356618065 0) // Vertex r5b = 8 - (3.58979347393082e-10 0.2 0) // Vertex r6b = 9 - (3.58979347393082e-10 0.2 0) // Vertex r6sb = 10 - (0.141421356364228 0.141421356110391 0) // Vertex r7b = 11 + (0.2 0 0) // Vertex r0b = 0 + (0.2 0 0) // Vertex r0sb = 1 + (0.141421356364228 -0.141421356110391 0) // Vertex r1b = 2 + (3.58979347393082e-10 -0.2 0) // Vertex r2b = 3 + (3.58979347393082e-10 -0.2 0) // Vertex r2sb = 4 + (-0.141421355856554 -0.141421356618065 0) // Vertex r3b = 5 + (-0.2 7.17958694786164e-10 0) // Vertex r4b = 6 + (-0.2 7.17958694786164e-10 0) // Vertex r4sb = 7 + (-0.141421355856554 0.141421356618065 0) // Vertex r5b = 8 + (3.58979347393082e-10 0.2 0) // Vertex r6b = 9 + (3.58979347393082e-10 0.2 0) // Vertex r6sb = 10 + (0.141421356364228 0.141421356110391 0) // Vertex r7b = 11 - (0.5 0 0) // Vertex rb0b = 12 - (0.353553390910569 -0.353553390275978 0) // Vertex rb1b = 13 - (8.97448368482705e-10 -0.5 0) // Vertex rb2b = 14 - (-0.353553389641386 -0.353553391545162 0) // Vertex rb3b = 15 - (-0.5 1.79489673696541e-09 0) // Vertex rb4b = 16 - (-0.353553389641386 0.353553391545162 0) // Vertex rb5b = 17 - (8.97448368482705e-10 0.5 0) // Vertex rb6b = 18 - (0.353553390910569 0.353553390275978 0) // Vertex rb7b = 19 + (0.5 0 0) // Vertex rb0b = 12 + (0.353553390910569 -0.353553390275978 0) // Vertex rb1b = 13 + (8.97448368482705e-10 -0.5 0) // Vertex rb2b = 14 + (-0.353553389641386 -0.353553391545162 0) // Vertex rb3b = 15 + (-0.5 1.79489673696541e-09 0) // Vertex rb4b = 16 + (-0.353553389641386 0.353553391545162 0) // Vertex rb5b = 17 + (8.97448368482705e-10 0.5 0) // Vertex rb6b = 18 + (0.353553390910569 0.353553390275978 0) // Vertex rb7b = 19 - (0.6 0 0) // Vertex ri0b = 20 - (0.424264069092683 -0.424264068331174 0) // Vertex ri1b = 21 - (1.07693804217925e-09 -0.6 0) // Vertex ri2b = 22 - (-0.424264067569663 -0.424264069854194 0) // Vertex ri3b = 23 - (-0.6 2.15387608435849e-09 0) // Vertex ri4b = 24 - (-0.424264067569663 0.424264069854194 0) // Vertex ri5b = 25 - (1.07693804217925e-09 0.6 0) // Vertex ri6b = 26 - (0.424264069092683 0.424264068331174 0) // Vertex ri7b = 27 + (0.6 0 0) // Vertex ri0b = 20 + (0.424264069092683 -0.424264068331174 0) // Vertex ri1b = 21 + (1.07693804217925e-09 -0.6 0) // Vertex ri2b = 22 + (-0.424264067569663 -0.424264069854194 0) // Vertex ri3b = 23 + (-0.6 2.15387608435849e-09 0) // Vertex ri4b = 24 + (-0.424264067569663 0.424264069854194 0) // Vertex ri5b = 25 + (1.07693804217925e-09 0.6 0) // Vertex ri6b = 26 + (0.424264069092683 0.424264068331174 0) // Vertex ri7b = 27 - (0.7 0 0) // Vertex Rb0b = 28 - (0.494974747274797 -0.494974746386369 0) // Vertex Rb1b = 29 - (1.25642771587579e-09 -0.7 0) // Vertex Rb2b = 30 - (-0.49497474549794 -0.494974748163226 0) // Vertex Rb3b = 31 - (-0.7 2.51285543175157e-09 0) // Vertex Rb4b = 32 - (-0.49497474549794 0.494974748163226 0) // Vertex Rb5b = 33 - (1.25642771587579e-09 0.7 0) // Vertex Rb6b = 34 - (0.494974747274797 0.494974746386369 0) // Vertex Rb7b = 35 + (0.7 0 0) // Vertex Rb0b = 28 + (0.494974747274797 -0.494974746386369 0) // Vertex Rb1b = 29 + (1.25642771587579e-09 -0.7 0) // Vertex Rb2b = 30 + (-0.49497474549794 -0.494974748163226 0) // Vertex Rb3b = 31 + (-0.7 2.51285543175157e-09 0) // Vertex Rb4b = 32 + (-0.49497474549794 0.494974748163226 0) // Vertex Rb5b = 33 + (1.25642771587579e-09 0.7 0) // Vertex Rb6b = 34 + (0.494974747274797 0.494974746386369 0) // Vertex Rb7b = 35 - (1 0 0) // Vertex R0b = 36 - (0.707106781821139 -0.707106780551956 0) // Vertex R1b = 37 - (0.707106781821139 -0.707106780551956 0) // Vertex R1sb = 38 - (1.79489673696541e-09 -1 0) // Vertex R2b = 39 - (-0.707106779282772 -0.707106783090323 0) // Vertex R3b = 40 - (-0.707106779282772 -0.707106783090323 0) // Vertex R3sb = 41 - (-1 3.58979347393082e-09 0) // Vertex R4b = 42 - (-0.707106779282772 0.707106783090323 0) // Vertex R5b = 43 - (-0.707106779282772 0.707106783090323 0) // Vertex R5sb = 44 - (1.79489673696541e-09 1 0) // Vertex R6b = 45 - (0.707106781821139 0.707106780551956 0) // Vertex R7b = 46 - (0.707106781821139 0.707106780551956 0) // Vertex R7sb = 47 + (1 0 0) // Vertex R0b = 36 + (0.707106781821139 -0.707106780551956 0) // Vertex R1b = 37 + (0.707106781821139 -0.707106780551956 0) // Vertex R1sb = 38 + (1.79489673696541e-09 -1 0) // Vertex R2b = 39 + (-0.707106779282772 -0.707106783090323 0) // Vertex R3b = 40 + (-0.707106779282772 -0.707106783090323 0) // Vertex R3sb = 41 + (-1 3.58979347393082e-09 0) // Vertex R4b = 42 + (-0.707106779282772 0.707106783090323 0) // Vertex R5b = 43 + (-0.707106779282772 0.707106783090323 0) // Vertex R5sb = 44 + (1.79489673696541e-09 1 0) // Vertex R6b = 45 + (0.707106781821139 0.707106780551956 0) // Vertex R7b = 46 + (0.707106781821139 0.707106780551956 0) // Vertex R7sb = 47 - (0.2 0 0.1) // Vertex r0t = 48 - (0.2 0 0.1) // Vertex r0st = 49 - (0.141421356364228 -0.141421356110391 0.1) // Vertex r1t = 50 - (3.58979347393082e-10 -0.2 0.1) // Vertex r2t = 51 - (3.58979347393082e-10 -0.2 0.1) // Vertex r2st = 52 - (-0.141421355856554 -0.141421356618065 0.1) // Vertex r3t = 53 - (-0.2 7.17958694786164e-10 0.1) // Vertex r4t = 54 - (-0.2 7.17958694786164e-10 0.1) // Vertex r4st = 55 - (-0.141421355856554 0.141421356618065 0.1) // Vertex r5t = 56 - (3.58979347393082e-10 0.2 0.1) // Vertex r6t = 57 - (3.58979347393082e-10 0.2 0.1) // Vertex r6st = 58 - (0.141421356364228 0.141421356110391 0.1) // Vertex r7t = 59 + (0.2 0 0.1) // Vertex r0t = 48 + (0.2 0 0.1) // Vertex r0st = 49 + (0.141421356364228 -0.141421356110391 0.1) // Vertex r1t = 50 + (3.58979347393082e-10 -0.2 0.1) // Vertex r2t = 51 + (3.58979347393082e-10 -0.2 0.1) // Vertex r2st = 52 + (-0.141421355856554 -0.141421356618065 0.1) // Vertex r3t = 53 + (-0.2 7.17958694786164e-10 0.1) // Vertex r4t = 54 + (-0.2 7.17958694786164e-10 0.1) // Vertex r4st = 55 + (-0.141421355856554 0.141421356618065 0.1) // Vertex r5t = 56 + (3.58979347393082e-10 0.2 0.1) // Vertex r6t = 57 + (3.58979347393082e-10 0.2 0.1) // Vertex r6st = 58 + (0.141421356364228 0.141421356110391 0.1) // Vertex r7t = 59 - (0.5 0 0.1) // Vertex rb0t = 60 - (0.353553390910569 -0.353553390275978 0.1) // Vertex rb1t = 61 - (8.97448368482705e-10 -0.5 0.1) // Vertex rb2t = 62 - (-0.353553389641386 -0.353553391545162 0.1) // Vertex rb3t = 63 - (-0.5 1.79489673696541e-09 0.1) // Vertex rb4t = 64 - (-0.353553389641386 0.353553391545162 0.1) // Vertex rb5t = 65 - (8.97448368482705e-10 0.5 0.1) // Vertex rb6t = 66 - (0.353553390910569 0.353553390275978 0.1) // Vertex rb7t = 67 + (0.5 0 0.1) // Vertex rb0t = 60 + (0.353553390910569 -0.353553390275978 0.1) // Vertex rb1t = 61 + (8.97448368482705e-10 -0.5 0.1) // Vertex rb2t = 62 + (-0.353553389641386 -0.353553391545162 0.1) // Vertex rb3t = 63 + (-0.5 1.79489673696541e-09 0.1) // Vertex rb4t = 64 + (-0.353553389641386 0.353553391545162 0.1) // Vertex rb5t = 65 + (8.97448368482705e-10 0.5 0.1) // Vertex rb6t = 66 + (0.353553390910569 0.353553390275978 0.1) // Vertex rb7t = 67 - (0.6 0 0.1) // Vertex ri0t = 68 - (0.424264069092683 -0.424264068331174 0.1) // Vertex ri1t = 69 - (1.07693804217925e-09 -0.6 0.1) // Vertex ri2t = 70 - (-0.424264067569663 -0.424264069854194 0.1) // Vertex ri3t = 71 - (-0.6 2.15387608435849e-09 0.1) // Vertex ri4t = 72 - (-0.424264067569663 0.424264069854194 0.1) // Vertex ri5t = 73 - (1.07693804217925e-09 0.6 0.1) // Vertex ri6t = 74 - (0.424264069092683 0.424264068331174 0.1) // Vertex ri7t = 75 + (0.6 0 0.1) // Vertex ri0t = 68 + (0.424264069092683 -0.424264068331174 0.1) // Vertex ri1t = 69 + (1.07693804217925e-09 -0.6 0.1) // Vertex ri2t = 70 + (-0.424264067569663 -0.424264069854194 0.1) // Vertex ri3t = 71 + (-0.6 2.15387608435849e-09 0.1) // Vertex ri4t = 72 + (-0.424264067569663 0.424264069854194 0.1) // Vertex ri5t = 73 + (1.07693804217925e-09 0.6 0.1) // Vertex ri6t = 74 + (0.424264069092683 0.424264068331174 0.1) // Vertex ri7t = 75 - (0.7 0 0.1) // Vertex Rb0t = 76 - (0.494974747274797 -0.494974746386369 0.1) // Vertex Rb1t = 77 - (1.25642771587579e-09 -0.7 0.1) // Vertex Rb2t = 78 - (-0.49497474549794 -0.494974748163226 0.1) // Vertex Rb3t = 79 - (-0.7 2.51285543175157e-09 0.1) // Vertex Rb4t = 80 - (-0.49497474549794 0.494974748163226 0.1) // Vertex Rb5t = 81 - (1.25642771587579e-09 0.7 0.1) // Vertex Rb6t = 82 - (0.494974747274797 0.494974746386369 0.1) // Vertex Rb7t = 83 + (0.7 0 0.1) // Vertex Rb0t = 76 + (0.494974747274797 -0.494974746386369 0.1) // Vertex Rb1t = 77 + (1.25642771587579e-09 -0.7 0.1) // Vertex Rb2t = 78 + (-0.49497474549794 -0.494974748163226 0.1) // Vertex Rb3t = 79 + (-0.7 2.51285543175157e-09 0.1) // Vertex Rb4t = 80 + (-0.49497474549794 0.494974748163226 0.1) // Vertex Rb5t = 81 + (1.25642771587579e-09 0.7 0.1) // Vertex Rb6t = 82 + (0.494974747274797 0.494974746386369 0.1) // Vertex Rb7t = 83 - (1 0 0.1) // Vertex R0t = 84 - (0.707106781821139 -0.707106780551956 0.1) // Vertex R1t = 85 - (0.707106781821139 -0.707106780551956 0.1) // Vertex R1st = 86 - (1.79489673696541e-09 -1 0.1) // Vertex R2t = 87 - (-0.707106779282772 -0.707106783090323 0.1) // Vertex R3t = 88 - (-0.707106779282772 -0.707106783090323 0.1) // Vertex R3st = 89 - (-1 3.58979347393082e-09 0.1) // Vertex R4t = 90 - (-0.707106779282772 0.707106783090323 0.1) // Vertex R5t = 91 - (-0.707106779282772 0.707106783090323 0.1) // Vertex R5st = 92 - (1.79489673696541e-09 1 0.1) // Vertex R6t = 93 - (0.707106781821139 0.707106780551956 0.1) // Vertex R7t = 94 - (0.707106781821139 0.707106780551956 0.1) // Vertex R7st = 95 + (1 0 0.1) // Vertex R0t = 84 + (0.707106781821139 -0.707106780551956 0.1) // Vertex R1t = 85 + (0.707106781821139 -0.707106780551956 0.1) // Vertex R1st = 86 + (1.79489673696541e-09 -1 0.1) // Vertex R2t = 87 + (-0.707106779282772 -0.707106783090323 0.1) // Vertex R3t = 88 + (-0.707106779282772 -0.707106783090323 0.1) // Vertex R3st = 89 + (-1 3.58979347393082e-09 0.1) // Vertex R4t = 90 + (-0.707106779282772 0.707106783090323 0.1) // Vertex R5t = 91 + (-0.707106779282772 0.707106783090323 0.1) // Vertex R5st = 92 + (1.79489673696541e-09 1 0.1) // Vertex R6t = 93 + (0.707106781821139 0.707106780551956 0.1) // Vertex R7t = 94 + (0.707106781821139 0.707106780551956 0.1) // Vertex R7st = 95 ); blocks diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary index 02383fd43..c42c32d0c 100644 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes index a8cc61ad4..427aa072d 100644 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,h) Gauss limitedLinear 1; div(phi,k) Gauss limitedLinear 1; div(phi,epsilon) Gauss limitedLinear 1; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(phiU,p) Gauss linear; } @@ -57,10 +57,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution index a62d3ed4d..6d60a61a0 100644 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution @@ -112,7 +112,9 @@ PIMPLE relaxationFactors { U 1; + UFinal 1; h 1; + hFinal 1; k 1; epsilon 1; } diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSchemes b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSchemes index ec261c3ee..2981c1b64 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSchemes +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSchemes @@ -30,7 +30,7 @@ gradSchemes divSchemes { div(phi,U) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(phi,h) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,k) Gauss upwind; @@ -59,10 +59,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSchemes b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSchemes index 985fae22f..97d7e575a 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSchemes +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSchemes @@ -30,7 +30,7 @@ gradSchemes divSchemes { div(phi,U) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(phi,h) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,k) Gauss upwind; @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/T b/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/T index a68c56a13..3bd0d273c 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/T +++ b/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/T @@ -27,16 +27,20 @@ boundaryField } outlet { - type inletOutlet; - inletValue $internalField; + type inletOutlet; + inletValue $internalField; } lowerWall { - type zeroGradient; + type zeroGradient; } upperWall { - type zeroGradient; + type zeroGradient; + } + frontAndBack + { + type empty; } } diff --git a/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/U b/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/U index a02bcd0b3..4e7644bbe 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/U +++ b/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/U @@ -45,6 +45,10 @@ boundaryField type fixedValue; value uniform (0 0 0); } + frontAndBack + { + type empty; + } } // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/p b/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/p index 9fb308d2b..2983e7faa 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/p +++ b/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/0/p @@ -35,7 +35,11 @@ boundaryField outlet { type fixedValue; - value $internalField; + value $internalField; + } + frontAndBack + { + type empty; } } diff --git a/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/system/fvSchemes b/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/system/fvSchemes index 985fae22f..97d7e575a 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/system/fvSchemes +++ b/tutorials/compressible/rhoPorousSimpleFoam/beaverJoseph/system/fvSchemes @@ -30,7 +30,7 @@ gradSchemes divSchemes { div(phi,U) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(phi,h) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,k) Gauss upwind; @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/T b/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/T index a68c56a13..4f2711da2 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/T +++ b/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/T @@ -38,6 +38,10 @@ boundaryField { type zeroGradient; } + defaultFaces + { + type empty; + } } // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/U b/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/U index df82aea72..60530c711 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/U +++ b/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/U @@ -43,6 +43,10 @@ boundaryField type fixedValue; value uniform (0 0 0); } + defaultFaces + { + type empty; + } } // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/p b/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/p index 9fb308d2b..e152e8bc0 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/p +++ b/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/0/p @@ -37,6 +37,10 @@ boundaryField type fixedValue; value $internalField; } + defaultFaces + { + type empty; + } } // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/system/fvSchemes b/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/system/fvSchemes index 985fae22f..97d7e575a 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/system/fvSchemes +++ b/tutorials/compressible/rhoPorousSimpleFoam/porousPlug/system/fvSchemes @@ -30,7 +30,7 @@ gradSchemes divSchemes { div(phi,U) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(phi,h) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,k) Gauss upwind; @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhoSonicFoam/forwardStep/system/fvSchemes b/tutorials/compressible/rhoSonicFoam/forwardStep/system/fvSchemes index bbbf51c95..181d65a72 100644 --- a/tutorials/compressible/rhoSonicFoam/forwardStep/system/fvSchemes +++ b/tutorials/compressible/rhoSonicFoam/forwardStep/system/fvSchemes @@ -51,10 +51,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhoSonicFoam/shockTube/0/T b/tutorials/compressible/rhoSonicFoam/shockTube/0/T index 88a96c6a3..c73accee3 100644 --- a/tutorials/compressible/rhoSonicFoam/shockTube/0/T +++ b/tutorials/compressible/rhoSonicFoam/shockTube/0/T @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -17,7 +17,7 @@ FoamFile dimensions [0 0 0 1 0 0 0]; -internalField nonuniform List +internalField nonuniform List 1000 ( 348.432 @@ -1035,4 +1035,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/compressible/rhoSonicFoam/shockTube/0/U b/tutorials/compressible/rhoSonicFoam/shockTube/0/U index dfd6a3b28..0aef90a6e 100644 --- a/tutorials/compressible/rhoSonicFoam/shockTube/0/U +++ b/tutorials/compressible/rhoSonicFoam/shockTube/0/U @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -31,4 +31,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/compressible/rhoSonicFoam/shockTube/0/p b/tutorials/compressible/rhoSonicFoam/shockTube/0/p index ccc492aa0..0b19ee1b3 100644 --- a/tutorials/compressible/rhoSonicFoam/shockTube/0/p +++ b/tutorials/compressible/rhoSonicFoam/shockTube/0/p @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -17,7 +17,7 @@ FoamFile dimensions [1 -1 -2 0 0 0 0]; -internalField nonuniform List +internalField nonuniform List 1000 ( 100000 @@ -1035,4 +1035,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/compressible/rhoSonicFoam/shockTube/system/fvSchemes b/tutorials/compressible/rhoSonicFoam/shockTube/system/fvSchemes index bbbf51c95..181d65a72 100644 --- a/tutorials/compressible/rhoSonicFoam/shockTube/system/fvSchemes +++ b/tutorials/compressible/rhoSonicFoam/shockTube/system/fvSchemes @@ -51,10 +51,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhopSonicFoam/shockTube/0/T b/tutorials/compressible/rhopSonicFoam/shockTube/0/T index bdd6097ef..f3385c002 100644 --- a/tutorials/compressible/rhopSonicFoam/shockTube/0/T +++ b/tutorials/compressible/rhopSonicFoam/shockTube/0/T @@ -1,22 +1,127 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; + location "0"; object T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 1 0 0 0]; -internalField uniform 1; +internalField nonuniform List +100 +( +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +348.432 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +278.746 +) +; boundaryField { @@ -24,11 +129,11 @@ boundaryField { type zeroGradient; } - empty { type empty; } } + // ************************************************************************* // diff --git a/tutorials/compressible/rhopSonicFoam/shockTube/0/U b/tutorials/compressible/rhopSonicFoam/shockTube/0/U index 12c79ed59..0aef90a6e 100644 --- a/tutorials/compressible/rhopSonicFoam/shockTube/0/U +++ b/tutorials/compressible/rhopSonicFoam/shockTube/0/U @@ -1,15 +1,16 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; + location "0"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -24,11 +25,11 @@ boundaryField { type zeroGradient; } - empty { type empty; } } + // ************************************************************************* // diff --git a/tutorials/compressible/rhopSonicFoam/shockTube/0/p b/tutorials/compressible/rhopSonicFoam/shockTube/0/p index 96d0f410e..438517d73 100644 --- a/tutorials/compressible/rhopSonicFoam/shockTube/0/p +++ b/tutorials/compressible/rhopSonicFoam/shockTube/0/p @@ -1,22 +1,127 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; + location "0"; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; -internalField uniform 0; +internalField nonuniform List +100 +( +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +100000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +10000 +) +; boundaryField { @@ -24,11 +129,11 @@ boundaryField { type zeroGradient; } - empty { type empty; } } + // ************************************************************************* // diff --git a/tutorials/compressible/rhopSonicFoam/shockTube/constant/polyMesh/boundary b/tutorials/compressible/rhopSonicFoam/shockTube/constant/polyMesh/boundary index c81fa42aa..53a52f02b 100644 --- a/tutorials/compressible/rhopSonicFoam/shockTube/constant/polyMesh/boundary +++ b/tutorials/compressible/rhopSonicFoam/shockTube/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/compressible/rhopSonicFoam/shockTube/system/fvSchemes b/tutorials/compressible/rhopSonicFoam/shockTube/system/fvSchemes index c7dee39fb..902ca1719 100644 --- a/tutorials/compressible/rhopSonicFoam/shockTube/system/fvSchemes +++ b/tutorials/compressible/rhopSonicFoam/shockTube/system/fvSchemes @@ -46,10 +46,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhopSonicFoam/shockTube/system/fvSolution b/tutorials/compressible/rhopSonicFoam/shockTube/system/fvSolution index 3bb92efb1..6a581ece1 100644 --- a/tutorials/compressible/rhopSonicFoam/shockTube/system/fvSolution +++ b/tutorials/compressible/rhopSonicFoam/shockTube/system/fvSolution @@ -58,7 +58,7 @@ solvers } } -PISO +PIMPLE { nOuterCorrectors 3; nCorrectors 1; diff --git a/tutorials/compressible/rhopSonicFoam/wedge15Ma5/constant/polyMesh/boundary b/tutorials/compressible/rhopSonicFoam/wedge15Ma5/constant/polyMesh/boundary index b7d6204fe..bec7824fb 100644 --- a/tutorials/compressible/rhopSonicFoam/wedge15Ma5/constant/polyMesh/boundary +++ b/tutorials/compressible/rhopSonicFoam/wedge15Ma5/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/compressible/rhopSonicFoam/wedge15Ma5/system/fvSchemes b/tutorials/compressible/rhopSonicFoam/wedge15Ma5/system/fvSchemes index c92521cc5..902ca1719 100644 --- a/tutorials/compressible/rhopSonicFoam/wedge15Ma5/system/fvSchemes +++ b/tutorials/compressible/rhopSonicFoam/wedge15Ma5/system/fvSchemes @@ -46,10 +46,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default yes; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/rhopSonicFoam/wedge15Ma5/system/fvSolution b/tutorials/compressible/rhopSonicFoam/wedge15Ma5/system/fvSolution index f7cc03d3a..dc452d140 100644 --- a/tutorials/compressible/rhopSonicFoam/wedge15Ma5/system/fvSolution +++ b/tutorials/compressible/rhopSonicFoam/wedge15Ma5/system/fvSolution @@ -58,7 +58,7 @@ solvers } } -PISO +PIMPLE { nOuterCorrectors 2; nCorrectors 2; From 5b31dad987fd6376c9c32e67b0c09097cfc57311 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Thu, 26 May 2016 10:43:27 +0200 Subject: [PATCH 02/26] Fixed missing convergence criteria: runTime.loop() changed to simple.loop() --- .../compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C | 2 +- applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C | 2 +- .../immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C | 2 +- .../solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C | 2 +- .../solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C | 2 +- applications/solvers/incompressible/simpleFoam/simpleFoam.C | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C index 817c33ad8..a1208acf2 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C index 189bd4db2..aa5748817 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; diff --git a/applications/solvers/immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C b/applications/solvers/immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C index 6c873025b..36e139a80 100644 --- a/applications/solvers/immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C +++ b/applications/solvers/immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; diff --git a/applications/solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C b/applications/solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C index 69c09be88..6c911d4b0 100644 --- a/applications/solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C +++ b/applications/solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; diff --git a/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C b/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C index c54de64ff..1610ad4be 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C +++ b/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; diff --git a/applications/solvers/incompressible/simpleFoam/simpleFoam.C b/applications/solvers/incompressible/simpleFoam/simpleFoam.C index 5a2c7f87f..2d286c65d 100644 --- a/applications/solvers/incompressible/simpleFoam/simpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/simpleFoam.C @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; From 23765c920fb7ecd3aa7784c4c725d4ba9ffb1b4f Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Thu, 26 May 2016 22:16:12 +0200 Subject: [PATCH 03/26] Fixed solverPerformance residual backport --- .../solutionControl/solutionControl.C | 3 +- .../fvMatrices/fvMatrix/fvMatrixSolve.C | 2 + .../fvScalarMatrix/fvScalarMatrix.C | 2 + .../lduMatrix/lduMatrix/SolverPerformance.C | 240 -------------- .../lduMatrix/lduMatrix/SolverPerformance.H | 301 ------------------ .../matrices/lduMatrix/lduMatrix/lduMatrix.H | 32 +- .../lduMatrix/lduMatrix/lduMatrixTests.C | 58 ++++ .../lduMatrix/lduMatrix/solverPerformance.C | 47 --- .../lduMatrix/lduMatrix/solverPerformance.H | 56 ---- src/foam/meshes/data/data.C | 37 +++ src/foam/meshes/data/data.H | 14 +- src/foam/meshes/data/dataTemplates.C | 71 ----- 12 files changed, 135 insertions(+), 728 deletions(-) delete mode 100644 src/foam/matrices/lduMatrix/lduMatrix/SolverPerformance.C delete mode 100644 src/foam/matrices/lduMatrix/lduMatrix/SolverPerformance.H delete mode 100644 src/foam/matrices/lduMatrix/lduMatrix/solverPerformance.C delete mode 100644 src/foam/matrices/lduMatrix/lduMatrix/solverPerformance.H delete mode 100644 src/foam/meshes/data/dataTemplates.C diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C index b0d36cc3f..149d5b54e 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "solutionControl.H" +#include "lduMatrix.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -191,7 +192,7 @@ void Foam::solutionControl::maxTypeResidual if (mesh_.foundObject(fieldName)) { - const List > sp(data); + const List sp(data); firstRes = cmptMax(sp.first().initialResidual()); lastRes = cmptMax(sp.last().initialResidual()); } diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index 003d85fd8..a88a74c2e 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -166,6 +166,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve psi_.correctBoundaryConditions(); + psi_.mesh().setSolverPerformance(psi_.name(), solverPerfVec); + return solverPerfVec; } diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index fc75343b1..89bee0738 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -100,6 +100,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve psi_.correctBoundaryConditions(); + psi_.mesh().setSolverPerformance(psi_.name(), solverPerf); + return solverPerf; } diff --git a/src/foam/matrices/lduMatrix/lduMatrix/SolverPerformance.C b/src/foam/matrices/lduMatrix/lduMatrix/SolverPerformance.C deleted file mode 100644 index 90136bed7..000000000 --- a/src/foam/matrices/lduMatrix/lduMatrix/SolverPerformance.C +++ /dev/null @@ -1,240 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 3.2 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend 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. - - foam-extend 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 foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "SolverPerformance.H" -#include "IOstreams.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -bool Foam::SolverPerformance::checkSingularity -( - const Type& wApA -) -{ - for(direction cmpt=0; cmpt::nComponents; cmpt++) - { - singular_[cmpt] = - component(wApA, cmpt) < vsmall_; - } - - return singular(); -} - - -template -bool Foam::SolverPerformance::singular() const -{ - for(direction cmpt=0; cmpt::nComponents; cmpt++) - { - if (!singular_[cmpt]) return false; - } - - return true; -} - - -template -bool Foam::SolverPerformance::checkConvergence -( - const Type& Tolerance, - const Type& RelTolerance -) -{ - if (debug >= 2) - { - Info<< solverName_ - << ": Iteration " << noIterations_ - << " residual = " << finalResidual_ - << endl; - } - - if - ( - finalResidual_ < Tolerance - || ( - RelTolerance - > small_*pTraits::one - && finalResidual_ < cmptMultiply(RelTolerance, initialResidual_) - ) - ) - { - converged_ = true; - } - else - { - converged_ = false; - } - - return converged_; -} - - -template -void Foam::SolverPerformance::print -( - Ostream& os -) const -{ - for(direction cmpt=0; cmpt::nComponents; cmpt++) - { - if (pTraits::nComponents == 1) - { - os << solverName_ << ": Solving for " << fieldName_; - - } - else - { - os << solverName_ << ": Solving for " - << word(fieldName_ + pTraits::componentNames[cmpt]); - } - - if (singular_[cmpt]) - { - os << ": solution singularity" << endl; - } - else - { - os << ", Initial residual = " << component(initialResidual_, cmpt) - << ", Final residual = " << component(finalResidual_, cmpt) - << ", No Iterations " << noIterations_ - << endl; - } - } -} - - -template -void Foam::SolverPerformance::replace -( - const Foam::label cmpt, - const Foam::SolverPerformance::cmptType>& sp -) -{ - initialResidual_.replace(cmpt, sp.initialResidual()); - finalResidual_.replace(cmpt, sp.finalResidual()); - singular_[cmpt] = sp.singular(); -} - - -template -Foam::SolverPerformance::cmptType> -Foam::SolverPerformance::max() -{ - return SolverPerformance::cmptType> - ( - solverName_, - fieldName_, - cmptMax(initialResidual_), - cmptMax(finalResidual_), - noIterations_, - converged_, - singular() - ); -} - - -template -bool Foam::SolverPerformance::operator!= -( - const SolverPerformance& sp -) const -{ - return - ( - solverName() != sp.solverName() - || fieldName() != sp.fieldName() - || initialResidual() != sp.initialResidual() - || finalResidual() != sp.finalResidual() - || nIterations() != sp.nIterations() - || converged() != sp.converged() - || singular() != sp.singular() - ); -} - - -template -typename Foam::SolverPerformance Foam::max -( - const typename Foam::SolverPerformance& sp1, - const typename Foam::SolverPerformance& sp2 -) -{ - return SolverPerformance - ( - sp1.solverName(), - sp1.fieldName_, - max(sp1.initialResidual(), sp2.initialResidual()), - max(sp1.finalResidual(), sp2.finalResidual()), - max(sp1.nIterations(), sp2.nIterations()), - sp1.converged() && sp2.converged(), - sp1.singular() || sp2.singular() - ); -} - - -template -Foam::Istream& Foam::operator>> -( - Istream& is, - typename Foam::SolverPerformance& sp -) -{ - is.readBeginList("SolverPerformance"); - is >> sp.solverName_ - >> sp.fieldName_ - >> sp.initialResidual_ - >> sp.finalResidual_ - >> sp.noIterations_ - >> sp.converged_ - >> sp.singular_; - is.readEndList("SolverPerformance"); - - return is; -} - - -template -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const typename Foam::SolverPerformance& sp -) -{ - os << token::BEGIN_LIST - << sp.solverName_ << token::SPACE - << sp.fieldName_ << token::SPACE - << sp.initialResidual_ << token::SPACE - << sp.finalResidual_ << token::SPACE - << sp.noIterations_ << token::SPACE - << sp.converged_ << token::SPACE - << sp.singular_ << token::SPACE - << token::END_LIST; - - return os; -} - - -// ************************************************************************* // diff --git a/src/foam/matrices/lduMatrix/lduMatrix/SolverPerformance.H b/src/foam/matrices/lduMatrix/lduMatrix/SolverPerformance.H deleted file mode 100644 index 7190834ac..000000000 --- a/src/foam/matrices/lduMatrix/lduMatrix/SolverPerformance.H +++ /dev/null @@ -1,301 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 3.2 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend 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. - - foam-extend 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 foam-extend. If not, see . - -Class - Foam::SolverPerformance - -Description - SolverPerformance is the class returned by the LduMatrix solver - containing performance statistics. - -SourceFiles - SolverPerformance.C - -\*---------------------------------------------------------------------------*/ - -#ifndef SolverPerformance_H -#define SolverPerformance_H - -#include "word.H" -#include "FixedList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of friend functions and operators - -template -class SolverPerformance; - -template -SolverPerformance max -( - const SolverPerformance&, - const SolverPerformance& -); - -template -Istream& operator>> -( - Istream&, - SolverPerformance& -); - -template -Ostream& operator<< -( - Ostream&, - const SolverPerformance& -); - - -/*---------------------------------------------------------------------------*\ - Class SolverPerformance Declaration -\*---------------------------------------------------------------------------*/ - -template -class SolverPerformance -{ - // Private data - - word solverName_; - word fieldName_; - Type initialResidual_; - Type finalResidual_; - label noIterations_; - bool converged_; - FixedList::nComponents> singular_; - - -public: - - // Static data - - // Declare name of the class and its debug switch - ClassName("SolverPerformance"); - - //- Large Type for the use in solvers - static const scalar great_; - - //- Small Type for the use in solvers - static const scalar small_; - - //- Very small Type for the use in solvers - static const scalar vsmall_; - - - // Constructors - - SolverPerformance() - : - initialResidual_(pTraits::zero), - finalResidual_(pTraits::zero), - noIterations_(0), - converged_(false), - singular_(false) - {} - - - SolverPerformance - ( - const word& solverName, - const word& fieldName, - const Type& iRes = pTraits::zero, - const Type& fRes = pTraits::zero, - const label nIter = 0, - const bool converged = false, - const bool singular = false - ) - : - solverName_(solverName), - fieldName_(fieldName), - initialResidual_(iRes), - finalResidual_(fRes), - noIterations_(nIter), - converged_(converged), - singular_(singular) - {} - - - // Member functions - - //- Return solver name - const word& solverName() const - { - return solverName_; - } - - //- Return solver name - word& solverName() - { - return solverName_; - } - - - //- Return field name - const word& fieldName() const - { - return fieldName_; - } - - - //- Return initial residual - const Type& initialResidual() const - { - return initialResidual_; - } - - //- Return initial residual - Type& initialResidual() - { - return initialResidual_; - } - - - //- Return final residual - const Type& finalResidual() const - { - return finalResidual_; - } - - //- Return final residual - Type& finalResidual() - { - return finalResidual_; - } - - - //- Return number of iterations - label nIterations() const - { - return noIterations_; - } - - //- Return number of iterations - label& nIterations() - { - return noIterations_; - } - - - //- Has the solver converged? - bool converged() const - { - return converged_; - } - - //- Is the matrix singular? - bool singular() const; - - //- Check, store and return convergence - bool checkConvergence - ( - const Type& tolerance, - const Type& relTolerance - ); - - //- Singularity test - bool checkSingularity(const Type& residual); - - //- Print summary of solver performance to the given stream - void print(Ostream& os) const; - - //- Replace component based on the minimal SolverPerformance - void replace - ( - const label cmpt, - const SolverPerformance::cmptType>& sp - ); - - //- Return the summary maximum of SolverPerformance - // Effectively it will mostly return solverPerformanceScalar - SolverPerformance::cmptType> max(); - - - // Member Operators - - bool operator!=(const SolverPerformance&) const; - - - // Friend functions - - //- Return the element-wise maximum of two SolverPerformances - friend SolverPerformance Foam::max - ( - const SolverPerformance&, - const SolverPerformance& - ); - - - // Ostream Operator - - friend Istream& operator>> - ( - Istream&, - SolverPerformance& - ); - - friend Ostream& operator<< - ( - Ostream&, - const SolverPerformance& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define makeSolverPerformance(Type) \ - \ -typedef Foam::SolverPerformance \ - solverPerformance##Type; \ - \ -defineNamedTemplateTypeNameAndDebug(solverPerformance##Type, 0); \ - \ -template<> \ -const scalar solverPerformance##Type::great_(1e20); \ - \ -template<> \ -const scalar solverPerformance##Type::small_(1e-20); \ - \ -template<> \ -const scalar solverPerformance##Type::vsmall_(VSMALL); \ - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "SolverPerformance.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrix.H index e20fb81a7..cab85f082 100644 --- a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -56,7 +56,6 @@ SourceFiles #include "primitiveFieldsFwd.H" #include "FieldField.H" #include "lduInterfaceFieldPtrsList.H" -#include "SolverPerformance.H" #include "typeInfo.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" @@ -172,6 +171,18 @@ public: return solverName_; } + //- Return field name + const word& fieldName() const + { + return fieldName_; + } + + //- Return access to field name + word& fieldName() + { + return fieldName_; + } + //- Return initial residual scalar initialResidual() const { @@ -235,6 +246,25 @@ public: //- Print summary of solver performance void print() const; + + // Member Operators + + bool operator!=(const solverPerformance&) const; + + // Ostream Operator + + friend Istream& operator>> + ( + Istream&, + solverPerformance& + ); + + friend Ostream& operator<< + ( + Ostream&, + const solverPerformance& + ); + }; diff --git a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixTests.C b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixTests.C index e4121db6d..9fce146da 100644 --- a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixTests.C +++ b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixTests.C @@ -104,4 +104,62 @@ void Foam::lduMatrix::solverPerformance::print() const } +bool Foam::lduSolverPerformance::operator!= +( + const lduSolverPerformance& sp +) const +{ + return + ( + solverName() != sp.solverName() + || fieldName() != sp.fieldName() + || initialResidual() != sp.initialResidual() + || finalResidual() != sp.finalResidual() + || nIterations() != sp.nIterations() + || converged() != sp.converged() + || singular() != sp.singular() + ); +} + + +Foam::Istream& Foam::operator>> +( + Istream& is, + typename Foam::lduSolverPerformance& sp +) +{ + is.readBeginList("SolverPerformance"); + is >> sp.solverName_ + >> sp.fieldName_ + >> sp.initialResidual_ + >> sp.finalResidual_ + >> sp.noIterations_ + >> sp.converged_ + >> sp.singular_; + is.readEndList("SolverPerformance"); + + return is; +} + + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const typename Foam::lduSolverPerformance& sp +) +{ + os << token::BEGIN_LIST + << sp.solverName_ << token::SPACE + << sp.fieldName_ << token::SPACE + << sp.initialResidual_ << token::SPACE + << sp.finalResidual_ << token::SPACE + << sp.noIterations_ << token::SPACE + << sp.converged_ << token::SPACE + << sp.singular_ << token::SPACE + << token::END_LIST; + + return os; +} + + // ************************************************************************* // diff --git a/src/foam/matrices/lduMatrix/lduMatrix/solverPerformance.C b/src/foam/matrices/lduMatrix/lduMatrix/solverPerformance.C deleted file mode 100644 index 49e125d11..000000000 --- a/src/foam/matrices/lduMatrix/lduMatrix/solverPerformance.C +++ /dev/null @@ -1,47 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 3.2 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend 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. - - foam-extend 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 foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "solverPerformance.H" -#include "fieldTypes.H" - -namespace Foam -{ - makeSolverPerformance(scalar); - makeSolverPerformance(vector); - makeSolverPerformance(sphericalTensor); - makeSolverPerformance(symmTensor); - makeSolverPerformance(tensor); -}; - - -template<> -Foam::SolverPerformance -Foam::SolverPerformance::max() -{ - return *this; -} - - -// ************************************************************************* // diff --git a/src/foam/matrices/lduMatrix/lduMatrix/solverPerformance.H b/src/foam/matrices/lduMatrix/lduMatrix/solverPerformance.H deleted file mode 100644 index 3bb5256a1..000000000 --- a/src/foam/matrices/lduMatrix/lduMatrix/solverPerformance.H +++ /dev/null @@ -1,56 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 3.2 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend 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. - - foam-extend 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 foam-extend. If not, see . - -Typedef - Foam::solverPerformance - -Description - SolverPerformance instantiated for a scalar - -SourceFiles - solverPerformance.C - -\*---------------------------------------------------------------------------*/ - -#ifndef solverPerformance_H -#define solverPerformance_H - -#include "SolverPerformance.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef SolverPerformance solverPerformance; - - // Specialization of the max function for scalar object - template<> - SolverPerformance SolverPerformance::max(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/foam/meshes/data/data.C b/src/foam/meshes/data/data.C index 97613d3d2..37365a516 100644 --- a/src/foam/meshes/data/data.C +++ b/src/foam/meshes/data/data.C @@ -59,4 +59,41 @@ const Foam::dictionary& Foam::data::solverPerformanceDict() const } +void Foam::data::setSolverPerformance +( + const word& name, + const lduSolverPerformance& sp +) const +{ + dictionary& dict = const_cast(solverPerformanceDict()); + + List perfs; + + if (prevTimeIndex_ != this->time().timeIndex()) + { + // Reset solver performance between iterations + prevTimeIndex_ = this->time().timeIndex(); + dict.clear(); + } + else + { + dict.readIfPresent(name, perfs); + } + + // Append to list + perfs.setSize(perfs.size()+1, sp); + + dict.set(name, perfs); +} + + +void Foam::data::setSolverPerformance +( + const lduSolverPerformance& sp +) const +{ + setSolverPerformance(sp.fieldName(), sp); +} + + // ************************************************************************* // diff --git a/src/foam/meshes/data/data.H b/src/foam/meshes/data/data.H index 1489935c5..a6cb98b99 100644 --- a/src/foam/meshes/data/data.H +++ b/src/foam/meshes/data/data.H @@ -39,7 +39,7 @@ SourceFiles #define data_H #include "IOdictionary.H" -#include "solverPerformance.H" +#include "lduMatrix.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -91,18 +91,16 @@ public: const dictionary& solverPerformanceDict() const; //- Add/set the solverPerformance entry for the named field - template void setSolverPerformance ( const word& name, - const SolverPerformance& + const lduSolverPerformance& ) const; //- Add/set the solverPerformance entry, using its fieldName - template void setSolverPerformance ( - const SolverPerformance& + const lduSolverPerformance& ) const; }; @@ -113,12 +111,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "dataTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/foam/meshes/data/dataTemplates.C b/src/foam/meshes/data/dataTemplates.C deleted file mode 100644 index 19da28227..000000000 --- a/src/foam/meshes/data/dataTemplates.C +++ /dev/null @@ -1,71 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 3.2 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend 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. - - foam-extend 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 foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "data.H" -#include "foamTime.H" -#include "solverPerformance.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::data::setSolverPerformance -( - const word& name, - const SolverPerformance& sp -) const -{ - dictionary& dict = const_cast(solverPerformanceDict()); - - List > perfs; - - if (prevTimeIndex_ != this->time().timeIndex()) - { - // Reset solver performance between iterations - prevTimeIndex_ = this->time().timeIndex(); - dict.clear(); - } - else - { - dict.readIfPresent(name, perfs); - } - - // Append to list - perfs.setSize(perfs.size()+1, sp); - - dict.set(name, perfs); -} - - -template -void Foam::data::setSolverPerformance -( - const SolverPerformance& sp -) const -{ - setSolverPerformance(sp.fieldName(), sp); -} - - -// ************************************************************************* // From c4c31e738e90497edb84b8920f44b39f0b0063be Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Thu, 26 May 2016 23:06:01 +0200 Subject: [PATCH 04/26] Removed storePrevIter (not needed with simple/pimple/piso.loop()); changed runTime.loop() to simple.loop() in SIMPLE solvers --- .../solvers/basic/laplacianFoam/laplacianFoam.C | 2 +- .../basic/potentialDyMFoam/potentialDyMFoam.C | 2 -- .../scalarTransportFoam/scalarTransportFoam.C | 2 +- .../solvers/immersedBoundary/interIbFoam/pEqn.H | 5 ----- .../porousSimpleIbFoam/porousSimpleIbFoam.C | 2 -- .../immersedBoundary/simpleIbFoam/simpleIbFoam.C | 2 -- .../incompressible/MRFSimpleFoam/MRFSimpleFoam.C | 4 +--- .../incompressible/icoDyMSimpleFoam/correctPhi.H | 4 ++-- .../icoDyMSimpleFoam/createControls.H | 4 ++-- .../incompressible/icoDyMSimpleFoam/createFields.H | 2 +- .../icoDyMSimpleFoam/icoDyMSimpleFoam.C | 14 ++++++-------- .../incompressible/icoDyMSimpleFoam/readControls.H | 4 ++-- .../incompressible/pimpleDyMFoam/pimpleDyMFoam.C | 5 ----- .../solvers/incompressible/pimpleFoam/pimpleFoam.C | 5 ----- .../porousSimpleFoam/porousSimpleFoam.C | 2 -- .../solvers/incompressible/simpleFoam/simpleFoam.C | 2 -- .../incompressible/simpleSRFFoam/simpleSRFFoam.C | 4 +--- 17 files changed, 17 insertions(+), 48 deletions(-) diff --git a/applications/solvers/basic/laplacianFoam/laplacianFoam.C b/applications/solvers/basic/laplacianFoam/laplacianFoam.C index d025f6bb4..6c78e8f7e 100644 --- a/applications/solvers/basic/laplacianFoam/laplacianFoam.C +++ b/applications/solvers/basic/laplacianFoam/laplacianFoam.C @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) Info<< "\nCalculating temperature distribution\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; diff --git a/applications/solvers/basic/potentialDyMFoam/potentialDyMFoam.C b/applications/solvers/basic/potentialDyMFoam/potentialDyMFoam.C index 763ebf180..af3bcdcda 100644 --- a/applications/solvers/basic/potentialDyMFoam/potentialDyMFoam.C +++ b/applications/solvers/basic/potentialDyMFoam/potentialDyMFoam.C @@ -80,8 +80,6 @@ int main(int argc, char *argv[]) while (piso.correctNonOrthogonal()) { - p.storePrevIter(); - fvScalarMatrix pEqn ( fvm::laplacian diff --git a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C index 3a72a378a..56145a53f 100644 --- a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C +++ b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) # include "CourantNo.H" - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; diff --git a/applications/solvers/immersedBoundary/interIbFoam/pEqn.H b/applications/solvers/immersedBoundary/interIbFoam/pEqn.H index a765455fc..56980d7da 100644 --- a/applications/solvers/immersedBoundary/interIbFoam/pEqn.H +++ b/applications/solvers/immersedBoundary/interIbFoam/pEqn.H @@ -1,9 +1,4 @@ { - if (!pimple.firstIter()) - { - pd.storePrevIter(); - } - volScalarField rUA = 1.0/UEqn.A(); surfaceScalarField rUAf = fvc::interpolate(rUA); diff --git a/applications/solvers/immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C b/applications/solvers/immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C index 36e139a80..d2e97067b 100644 --- a/applications/solvers/immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C +++ b/applications/solvers/immersedBoundary/porousSimpleIbFoam/porousSimpleIbFoam.C @@ -64,8 +64,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - p.storePrevIter(); - // Pressure-velocity SIMPLE corrector { # include "UEqn.H" diff --git a/applications/solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C b/applications/solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C index 6c911d4b0..9b6decb00 100644 --- a/applications/solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C +++ b/applications/solvers/immersedBoundary/simpleIbFoam/simpleIbFoam.C @@ -63,8 +63,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - p.storePrevIter(); - // Pressure-velocity SIMPLE corrector { # include "UEqn.H" diff --git a/applications/solvers/incompressible/MRFSimpleFoam/MRFSimpleFoam.C b/applications/solvers/incompressible/MRFSimpleFoam/MRFSimpleFoam.C index 7bb094647..cabc3add3 100644 --- a/applications/solvers/incompressible/MRFSimpleFoam/MRFSimpleFoam.C +++ b/applications/solvers/incompressible/MRFSimpleFoam/MRFSimpleFoam.C @@ -55,12 +55,10 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - for (runTime++; !runTime.end(); runTime++) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - p.storePrevIter(); - // Pressure-velocity SIMPLE corrector { // Momentum predictor diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H b/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H index d8c715068..5efe354c3 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H @@ -26,7 +26,7 @@ mesh.schemesDict().setFluxRequired(pcorr.name()); - while (piso.correctNonOrthogonal()) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( @@ -36,7 +36,7 @@ pcorrEqn.setReference(pRefCell, pRefValue); pcorrEqn.solve(); - if (piso.finalNonOrthogonalIter()) + if (pimple.finalNonOrthogonalIter()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/createControls.H b/applications/solvers/incompressible/icoDyMSimpleFoam/createControls.H index 63d39deef..ca5e25906 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/createControls.H +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/createControls.H @@ -2,10 +2,10 @@ bool correctPhi ( - piso.dict().lookupOrDefault("correctPhi", false) + pimple.dict().lookupOrDefault("correctPhi", false) ); bool checkMeshCourantNo ( - piso.dict().lookupOrDefault("checkMeshCourantNo", false) + pimple.dict().lookupOrDefault("checkMeshCourantNo", false) ); diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H b/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H index 4b37f06a1..f9157e4da 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H @@ -72,7 +72,7 @@ zeroGradientFvPatchScalarField::typeName ); - bool momentumPredictor = piso.momentumPredictor(); + bool momentumPredictor = pimple.momentumPredictor(); { bool momentumPredictorSave = momentumPredictor; diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/icoDyMSimpleFoam.C b/applications/solvers/incompressible/icoDyMSimpleFoam/icoDyMSimpleFoam.C index f6beebb7d..6f0803a36 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/icoDyMSimpleFoam.C +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/icoDyMSimpleFoam.C @@ -36,7 +36,7 @@ Author #include "fvCFD.H" #include "dynamicFvMesh.H" -#include "pisoControl.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createDynamicFvMesh.H" - pisoControl piso(mesh); + pimpleControl pimple(mesh); # include "initContinuityErrs.H" # include "initTotalVolume.H" @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) // --- SIMPLE loop - while (piso.correct()) + while (pimple.correct()) { # include "CourantNo.H" @@ -108,10 +108,8 @@ int main(int argc, char *argv[]) adjustPhi(phi, U, p); - p.storePrevIter(); - // Non-orthogonal pressure corrector loop - while (piso.correctNonOrthogonal()) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -121,10 +119,10 @@ int main(int argc, char *argv[]) pEqn.setReference(pRefCell, pRefValue); pEqn.solve ( - mesh.solutionDict().solver(p.select(piso.finalInnerIter())) + mesh.solutionDict().solver(p.select(pimple.finalInnerIter())) ); - if (piso.finalNonOrthogonalIter()) + if (pimple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/readControls.H b/applications/solvers/incompressible/icoDyMSimpleFoam/readControls.H index 7cc9b3071..9f982e260 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/readControls.H +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/readControls.H @@ -1,5 +1,5 @@ #include "readTimeControls.H" -correctPhi = piso.dict().lookupOrDefault("correctPhi", false); +correctPhi = pimple.dict().lookupOrDefault("correctPhi", false); -checkMeshCourantNo = piso.dict().lookupOrDefault("checkMeshCourantNo", false); +checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C index 1ae34775d..92ff938e3 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C @@ -98,11 +98,6 @@ int main(int argc, char *argv[]) // --- PIMPLE loop while (pimple.loop()) { - if (!pimple.firstIter()) - { - p.storePrevIter(); - } - # include "UEqn.H" // --- PISO loop diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index 33836621f..9d70da7c0 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -66,11 +66,6 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { - if (!pimple.firstIter()) - { - p.storePrevIter(); - } - # include "UEqn.H" // --- PISO loop diff --git a/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C b/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C index 1610ad4be..83bd923c9 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C +++ b/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C @@ -57,8 +57,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - p.storePrevIter(); - // Pressure-velocity SIMPLE corrector { #include "UEqn.H" diff --git a/applications/solvers/incompressible/simpleFoam/simpleFoam.C b/applications/solvers/incompressible/simpleFoam/simpleFoam.C index 2d286c65d..63c036252 100644 --- a/applications/solvers/incompressible/simpleFoam/simpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/simpleFoam.C @@ -55,8 +55,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - p.storePrevIter(); - // Pressure-velocity SIMPLE corrector { # include "UEqn.H" diff --git a/applications/solvers/incompressible/simpleSRFFoam/simpleSRFFoam.C b/applications/solvers/incompressible/simpleSRFFoam/simpleSRFFoam.C index bd213c98a..a9c823b10 100644 --- a/applications/solvers/incompressible/simpleSRFFoam/simpleSRFFoam.C +++ b/applications/solvers/incompressible/simpleSRFFoam/simpleSRFFoam.C @@ -57,12 +57,10 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - for (runTime++; !runTime.end(); runTime++) + while(simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - p.storePrevIter(); - // Pressure-velocity SIMPLE corrector { // Momentum predictor From 83a55f8b82e01aa8b442f9052ea071c16e5a800f Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Thu, 26 May 2016 23:22:36 +0200 Subject: [PATCH 05/26] Changed convergence to residualControl in fvSolution cases with specified convergence (incompressible, compressible, basic, IB) --- .../pitzDailyBodyFitted/system/fvSolution | 7 ++++++- .../simpleFoam/mixingPlaneDomADomB/system/fvSolution | 8 +++++++- .../simpleFoam/pitzDaily/system/controlDict | 2 +- .../incompressible/simpleFoam/pitzDaily/system/fvSolution | 7 ++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tutorials/immersedBoundary/pitzDailyBodyFitted/system/fvSolution b/tutorials/immersedBoundary/pitzDailyBodyFitted/system/fvSolution index 44e6ccee5..60b04d2a3 100644 --- a/tutorials/immersedBoundary/pitzDailyBodyFitted/system/fvSolution +++ b/tutorials/immersedBoundary/pitzDailyBodyFitted/system/fvSolution @@ -50,7 +50,12 @@ SIMPLE { nNonOrthogonalCorrectors 0; - convergence 1e-4; + residualControl + { + p 1e-4; + U 1e-4; + "(k|epsilon)" 1e-4; + } } relaxationFactors diff --git a/tutorials/incompressible/simpleFoam/mixingPlaneDomADomB/system/fvSolution b/tutorials/incompressible/simpleFoam/mixingPlaneDomADomB/system/fvSolution index ccc5f6da6..e0ea102fc 100644 --- a/tutorials/incompressible/simpleFoam/mixingPlaneDomADomB/system/fvSolution +++ b/tutorials/incompressible/simpleFoam/mixingPlaneDomADomB/system/fvSolution @@ -66,7 +66,13 @@ SIMPLE nNonOrthogonalCorrectors 1; pRefCell 0; pRefValue 0; - convergence 1e-5; + + residualControl + { + p 1e-5; + U 1e-5; + "(k|epsilon)" 1e-5; + } } relaxationFactors diff --git a/tutorials/incompressible/simpleFoam/pitzDaily/system/controlDict b/tutorials/incompressible/simpleFoam/pitzDaily/system/controlDict index c16b483e1..5526c2144 100644 --- a/tutorials/incompressible/simpleFoam/pitzDaily/system/controlDict +++ b/tutorials/incompressible/simpleFoam/pitzDaily/system/controlDict @@ -22,7 +22,7 @@ startTime 0; stopAt endTime; -endTime 1000; +endTime 2000; deltaT 1; diff --git a/tutorials/incompressible/simpleFoam/pitzDaily/system/fvSolution b/tutorials/incompressible/simpleFoam/pitzDaily/system/fvSolution index b125baf11..94616d261 100644 --- a/tutorials/incompressible/simpleFoam/pitzDaily/system/fvSolution +++ b/tutorials/incompressible/simpleFoam/pitzDaily/system/fvSolution @@ -64,7 +64,12 @@ SIMPLE { nNonOrthogonalCorrectors 0; - convergence 1e-4; + residualControl + { + p 1e-4; + U 1e-4; + "(k|epsilon)" 1e-4; + } } relaxationFactors From 1296dcd3ad4aa49416b5f180db786dbac56c9b94 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Thu, 26 May 2016 23:46:09 +0200 Subject: [PATCH 06/26] Removed storePrevIter() - not needed anymore --- .../solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C | 6 ------ .../rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C | 6 ------ .../compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C | 3 --- .../solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C | 3 --- 4 files changed, 18 deletions(-) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index 836ce67aa..c2c0570c0 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -67,12 +67,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - if (!pimple.firstIter()) - { - p.storePrevIter(); - rho.storePrevIter(); - } - #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index 94c3c077c..fb2f0f6f2 100644 --- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -69,12 +69,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - if (!pimple.firstIter()) - { - p.storePrevIter(); - rho.storePrevIter(); - } - #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C index a1208acf2..ad7422b1a 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C @@ -57,9 +57,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - p.storePrevIter(); - rho.storePrevIter(); - // Pressure-velocity SIMPLE corrector { #include "UEqn.H" diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C index aa5748817..afa315bed 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C @@ -56,9 +56,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; - p.storePrevIter(); - rho.storePrevIter(); - // Pressure-velocity SIMPLE corrector { # include "UEqn.H" From 620e1ce085babbc985c60fd01fdbd55ce49f37a0 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Fri, 27 May 2016 00:17:32 +0200 Subject: [PATCH 07/26] Backported sonicFoam, sonicDyMFoam, sonicLiquidFoam and tutorials (vanilla OF 3.0.1) --- .../solvers/compressible/sonicDyMFoam/UEqn.H | 19 ++++------------ .../sonicDyMFoam/createControls.H | 19 +++++++--------- .../compressible/sonicDyMFoam/createFields.H | 2 ++ .../solvers/compressible/sonicDyMFoam/eEqn.H | 19 ++++------------ .../solvers/compressible/sonicDyMFoam/pEqn.H | 22 +++++-------------- .../compressible/sonicDyMFoam/readControls.H | 15 +++---------- .../compressible/sonicDyMFoam/sonicDyMFoam.C | 11 ++++++---- .../solvers/compressible/sonicFoam/UEqn.H | 19 ++++------------ .../compressible/sonicFoam/createFields.H | 2 ++ .../solvers/compressible/sonicFoam/eEqn.H | 19 ++++------------ .../solvers/compressible/sonicFoam/pEqn.H | 4 ++-- .../compressible/sonicFoam/sonicFoam.C | 12 +++++----- .../sonicLiquidFoam/createFields.H | 2 ++ .../sonicLiquidFoam/sonicLiquidFoam.C | 12 +++++----- .../forwardStep/constant/polyMesh/boundary | 2 +- .../laminar/forwardStep/system/fvSchemes | 8 +------ .../laminar/forwardStep/system/fvSolution | 8 +++++++ .../laminar/shockTube/system/fvSchemes | 8 +------ .../laminar/shockTube/system/fvSolution | 8 +++++++ .../nacaAirfoil/constant/polyMesh/boundary | 2 +- .../ras/nacaAirfoil/system/fvSchemes | 8 +------ .../ras/nacaAirfoil/system/fvSolution | 8 ++++--- .../ras/prism/constant/polyMesh/boundary | 2 +- .../sonicFoam/ras/prism/system/fvSchemes | 8 +------ .../sonicFoam/ras/prism/system/fvSolution | 8 +++++++ .../decompressionTank/system/fvSchemes | 6 ----- 26 files changed, 97 insertions(+), 156 deletions(-) diff --git a/applications/solvers/compressible/sonicDyMFoam/UEqn.H b/applications/solvers/compressible/sonicDyMFoam/UEqn.H index 377aa0a13..bdcc54f6e 100644 --- a/applications/solvers/compressible/sonicDyMFoam/UEqn.H +++ b/applications/solvers/compressible/sonicDyMFoam/UEqn.H @@ -5,20 +5,9 @@ + turbulence->divDevRhoReff(U) ); - if (oCorr == nOuterCorr - 1) - { - if (mesh.solutionDict().relax("UFinal")) - { - UEqn.relax(mesh.solutionDict().relaxationFactor("UFinal")); - } - else - { - UEqn.relax(1); - } - } - else - { - UEqn.relax(); - } + UEqn.relax + ( + mesh.solutionDict().relaxationFactor(U.select(pimple.finalIter())) + ); solve(UEqn == -fvc::grad(p)); diff --git a/applications/solvers/compressible/sonicDyMFoam/createControls.H b/applications/solvers/compressible/sonicDyMFoam/createControls.H index 45a18790e..a9c1b9b0a 100644 --- a/applications/solvers/compressible/sonicDyMFoam/createControls.H +++ b/applications/solvers/compressible/sonicDyMFoam/createControls.H @@ -1,14 +1,11 @@ # include "createTimeControls.H" -# include "readPIMPLEControls.H" - bool correctPhi = false; - if (pimple.found("correctPhi")) - { - correctPhi = Switch(pimple.lookup("correctPhi")); - } +bool correctPhi +( + pimple.dict().lookupOrDefault("correctPhi", false) +); - bool checkMeshCourantNo = false; - if (pimple.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo")); - } +bool checkMeshCourantNo +( + pimple.dict().lookupOrDefault("checkMeshCourantNo", false) +); diff --git a/applications/solvers/compressible/sonicDyMFoam/createFields.H b/applications/solvers/compressible/sonicDyMFoam/createFields.H index a17764ce4..0bec8c245 100644 --- a/applications/solvers/compressible/sonicDyMFoam/createFields.H +++ b/applications/solvers/compressible/sonicDyMFoam/createFields.H @@ -51,3 +51,5 @@ thermo ) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/sonicDyMFoam/eEqn.H b/applications/solvers/compressible/sonicDyMFoam/eEqn.H index 7b11958a7..63c1a729e 100644 --- a/applications/solvers/compressible/sonicDyMFoam/eEqn.H +++ b/applications/solvers/compressible/sonicDyMFoam/eEqn.H @@ -17,21 +17,10 @@ // viscous heating? ); - if (oCorr == nOuterCorr - 1) - { - if (mesh.solutionDict().relax("eFinal")) - { - eEqn.relax(mesh.solutionDict().relaxationFactor("eFinal")); - } - else - { - eEqn.relax(1); - } - } - else - { - eEqn.relax(); - } + eEqn.relax + ( + mesh.solutionDict().relaxationFactor(e.select(pimple.finalIter())) + ); eEqn.solve(); diff --git a/applications/solvers/compressible/sonicDyMFoam/pEqn.H b/applications/solvers/compressible/sonicDyMFoam/pEqn.H index 1be1b12b2..20cb4ea4c 100644 --- a/applications/solvers/compressible/sonicDyMFoam/pEqn.H +++ b/applications/solvers/compressible/sonicDyMFoam/pEqn.H @@ -3,7 +3,7 @@ # include "limitU.H" - for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { // Calculate phi for boundary conditions phi = rhof* @@ -36,25 +36,13 @@ - fvm::laplacian(rho*rUA, p) ); - if + pEqn.solve ( -// oCorr == nOuterCorr - 1 - corr == nCorr - 1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve - ( - mesh.solutionDict().solver(p.name() + "Final") - ); - } - else - { - pEqn.solve(mesh.solutionDict().solver(p.name())); - } + mesh.solutionDict().solver(p.select(pimple.finalInnerIter())) + ); // Calculate the flux - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi = phid2 + pEqn.flux(); } diff --git a/applications/solvers/compressible/sonicDyMFoam/readControls.H b/applications/solvers/compressible/sonicDyMFoam/readControls.H index 2db7f5142..9f982e260 100644 --- a/applications/solvers/compressible/sonicDyMFoam/readControls.H +++ b/applications/solvers/compressible/sonicDyMFoam/readControls.H @@ -1,14 +1,5 @@ -# include "readTimeControls.H" -# include "readPIMPLEControls.H" +#include "readTimeControls.H" - correctPhi = false; - if (pimple.found("correctPhi")) - { - correctPhi = Switch(pimple.lookup("correctPhi")); - } +correctPhi = pimple.dict().lookupOrDefault("correctPhi", false); - checkMeshCourantNo = false; - if (pimple.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo")); - } +checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/compressible/sonicDyMFoam/sonicDyMFoam.C b/applications/solvers/compressible/sonicDyMFoam/sonicDyMFoam.C index 0920a9542..d8e9c123f 100644 --- a/applications/solvers/compressible/sonicDyMFoam/sonicDyMFoam.C +++ b/applications/solvers/compressible/sonicDyMFoam/sonicDyMFoam.C @@ -47,6 +47,7 @@ Author #include "specie.H" #include "basicPsiThermo.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,6 +57,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createDynamicFvMesh.H" + + pimpleControl pimple(mesh); + # include "createFields.H" # include "initContinuityErrs.H" # include "createControls.H" @@ -106,8 +110,7 @@ int main(int argc, char *argv[]) } // --- PIMPLE loop - label oCorr = 0; - do + while (pimple.loop()) { # include "rhoEqn.H" # include "eEqn.H" @@ -123,13 +126,13 @@ int main(int argc, char *argv[]) // but psi and rho are not surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p); - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { # include "pEqn.H" } turbulence->correct(); - } while (++oCorr < nOuterCorr); + } runTime.write(); diff --git a/applications/solvers/compressible/sonicFoam/UEqn.H b/applications/solvers/compressible/sonicFoam/UEqn.H index 377aa0a13..bdcc54f6e 100644 --- a/applications/solvers/compressible/sonicFoam/UEqn.H +++ b/applications/solvers/compressible/sonicFoam/UEqn.H @@ -5,20 +5,9 @@ + turbulence->divDevRhoReff(U) ); - if (oCorr == nOuterCorr - 1) - { - if (mesh.solutionDict().relax("UFinal")) - { - UEqn.relax(mesh.solutionDict().relaxationFactor("UFinal")); - } - else - { - UEqn.relax(1); - } - } - else - { - UEqn.relax(); - } + UEqn.relax + ( + mesh.solutionDict().relaxationFactor(U.select(pimple.finalIter())) + ); solve(UEqn == -fvc::grad(p)); diff --git a/applications/solvers/compressible/sonicFoam/createFields.H b/applications/solvers/compressible/sonicFoam/createFields.H index 8e03212c2..e88da74d3 100644 --- a/applications/solvers/compressible/sonicFoam/createFields.H +++ b/applications/solvers/compressible/sonicFoam/createFields.H @@ -50,3 +50,5 @@ thermo ) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/sonicFoam/eEqn.H b/applications/solvers/compressible/sonicFoam/eEqn.H index 2b54224ac..774f2a059 100644 --- a/applications/solvers/compressible/sonicFoam/eEqn.H +++ b/applications/solvers/compressible/sonicFoam/eEqn.H @@ -14,21 +14,10 @@ // viscous heating? ); - if (oCorr == nOuterCorr - 1) - { - if (mesh.solutionDict().relax("eFinal")) - { - eEqn.relax(mesh.solutionDict().relaxationFactor("eFinal")); - } - else - { - eEqn.relax(1); - } - } - else - { - eEqn.relax(); - } + eEqn.relax + ( + mesh.solutionDict().relaxationFactor(e.select(pimple.finalIter())) + ); eEqn.solve(); diff --git a/applications/solvers/compressible/sonicFoam/pEqn.H b/applications/solvers/compressible/sonicFoam/pEqn.H index 2a53cc3ec..686acebaa 100644 --- a/applications/solvers/compressible/sonicFoam/pEqn.H +++ b/applications/solvers/compressible/sonicFoam/pEqn.H @@ -1,7 +1,7 @@ { U = UEqn.H()/UEqn.A(); - for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { // Calculate phi for boundary conditions phi = rhof* @@ -36,7 +36,7 @@ pEqn.solve(); // Calculate the flux - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi = phid2 + pEqn.flux(); } diff --git a/applications/solvers/compressible/sonicFoam/sonicFoam.C b/applications/solvers/compressible/sonicFoam/sonicFoam.C index fb11a64bc..9085439ee 100644 --- a/applications/solvers/compressible/sonicFoam/sonicFoam.C +++ b/applications/solvers/compressible/sonicFoam/sonicFoam.C @@ -42,6 +42,7 @@ Author #include "fvCFD.H" #include "basicPsiThermo.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,6 +51,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "createFields.H" # include "initContinuityErrs.H" # include "createTimeControls.H" @@ -61,7 +65,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { # include "readTimeControls.H" -# include "readPIMPLEControls.H" # include "compressibleCourantNo.H" # include "setDeltaT.H" @@ -70,8 +73,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- PIMPLE loop - label oCorr = 0; - do + while (pimple.loop()) { # include "rhoEqn.H" # include "eEqn.H" @@ -87,13 +89,13 @@ int main(int argc, char *argv[]) // but psi and rho are not surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p); - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { # include "pEqn.H" } turbulence->correct(); - } while (++oCorr < nOuterCorr); + } runTime.write(); diff --git a/applications/solvers/compressible/sonicLiquidFoam/createFields.H b/applications/solvers/compressible/sonicLiquidFoam/createFields.H index f419234c7..cf3dce8f8 100644 --- a/applications/solvers/compressible/sonicLiquidFoam/createFields.H +++ b/applications/solvers/compressible/sonicLiquidFoam/createFields.H @@ -42,3 +42,5 @@ # include "compressibleCreatePhi.H" + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/sonicLiquidFoam/sonicLiquidFoam.C b/applications/solvers/compressible/sonicLiquidFoam/sonicLiquidFoam.C index 66df9e7df..259dc677a 100644 --- a/applications/solvers/compressible/sonicLiquidFoam/sonicLiquidFoam.C +++ b/applications/solvers/compressible/sonicLiquidFoam/sonicLiquidFoam.C @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,6 +40,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "readThermodynamicProperties.H" # include "readTransportProperties.H" # include "createFields.H" @@ -52,14 +56,12 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPIMPLEControls.H" # include "compressibleCourantNo.H" # include "rhoEqn.H" // --- PIMPLE loop - label oCorr = 0; - do + while (pimple.loop()) { fvVectorMatrix UEqn ( @@ -71,7 +73,7 @@ int main(int argc, char *argv[]) solve(UEqn == -fvc::grad(p)); // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rhorAUf @@ -113,7 +115,7 @@ int main(int argc, char *argv[]) U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); } - } while (++oCorr < nOuterCorr); + } // Correct density diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/polyMesh/boundary b/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/polyMesh/boundary index 43bfa8da3..635db6d90 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/polyMesh/boundary +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSchemes b/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSchemes index 5824630ad..d07e66a82 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSchemes @@ -31,7 +31,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phi,e) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -49,10 +49,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSolution b/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSolution index 36bf9d4df..3e4690cea 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSolution +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSolution @@ -52,4 +52,12 @@ PIMPLE nNonOrthogonalCorrectors 0; } +relaxationFactors +{ + U 1; + UFinal 1; + e 1; + eFinal 1; +} + // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSchemes b/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSchemes index f3e8c3c32..f5f356a7e 100644 --- a/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phid,p) Gauss vanLeer; div(phi,e) Gauss vanLeer; div(phiU,p) Gauss vanLeer; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(interpolate(rho),U) Gauss linear; } @@ -52,10 +52,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSolution b/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSolution index 400a06424..f0bcb2a0c 100644 --- a/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSolution +++ b/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSolution @@ -57,4 +57,12 @@ PIMPLE nNonOrthogonalCorrectors 0; } +relaxationFactors +{ + U 1; + UFinal 1; + e 1; + eFinal 1; +} + // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/polyMesh/boundary b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/polyMesh/boundary index a2be7031a..8e1412724 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/polyMesh/boundary +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes index ec9ee2895..0688f277c 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phid,p) Gauss limitedLinear 1; div(phiU,p) Gauss limitedLinear 1; div(phi,e) Gauss limitedLinear 1; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -54,10 +54,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution index 251e35535..b98c34c9e 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution @@ -85,9 +85,11 @@ PIMPLE relaxationFactors { - U 0.8; - p 0.8; - e 0.8; + U 0.8; + UFinal 1; + p 0.8; + e 0.8; + eFinal 1; } // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/ras/prism/constant/polyMesh/boundary b/tutorials/compressible/sonicFoam/ras/prism/constant/polyMesh/boundary index f612fade1..b611ba5de 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/constant/polyMesh/boundary +++ b/tutorials/compressible/sonicFoam/ras/prism/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/compressible/sonicFoam/ras/prism/system/fvSchemes b/tutorials/compressible/sonicFoam/ras/prism/system/fvSchemes index 7a72514a7..015b13fcb 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/ras/prism/system/fvSchemes @@ -31,7 +31,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phi,e) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; @@ -54,10 +54,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution b/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution index a4bfb4086..77927c51c 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution +++ b/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution @@ -76,4 +76,12 @@ PIMPLE nNonOrthogonalCorrectors 0; } +relaxationFactors +{ + U 1; + UFinal 1; + e 1; + eFinal 1; +} + // ************************************************************************* // diff --git a/tutorials/compressible/sonicLiquidFoam/decompressionTank/system/fvSchemes b/tutorials/compressible/sonicLiquidFoam/decompressionTank/system/fvSchemes index 0497c9070..05cd7e80e 100644 --- a/tutorials/compressible/sonicLiquidFoam/decompressionTank/system/fvSchemes +++ b/tutorials/compressible/sonicLiquidFoam/decompressionTank/system/fvSchemes @@ -50,10 +50,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // From 3cd148c0c5ef865220fd03144209bd8e4249c388 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Fri, 27 May 2016 01:33:07 +0200 Subject: [PATCH 08/26] Backported steadyCompressibleFoam, steadyCompressibleMRFFoam, steadyCompressibleSRFFoam and tutorials (vanilla OF 3.0.1) --- .../compressible/steadyCompressibleFoam/UEqn.H | 7 +------ .../steadyCompressibleFoam/convergenceCheck.H | 9 --------- .../steadyCompressibleFoam/createFields.H | 2 ++ .../compressible/steadyCompressibleFoam/hEqn.H | 3 +-- .../steadyCompressibleFoam/initConvergenceCheck.H | 7 ------- .../compressible/steadyCompressibleFoam/pEqn.H | 14 ++++---------- .../steadyCompressibleFoam.C | 10 ++++------ .../compressible/steadyCompressibleMRFFoam/UEqn.H | 7 +------ .../steadyCompressibleMRFFoam/convergenceCheck.H | 9 --------- .../steadyCompressibleMRFFoam/createFields.H | 2 ++ .../compressible/steadyCompressibleMRFFoam/hEqn.H | 3 --- .../compressible/steadyCompressibleMRFFoam/iEqn.H | 3 +-- .../initConvergenceCheck.H | 7 ------- .../compressible/steadyCompressibleMRFFoam/pEqn.H | 14 ++++---------- .../steadyCompressibleMRFFoam.C | 10 ++++------ .../compressible/steadyCompressibleSRFFoam/UEqn.H | 7 +------ .../steadyCompressibleSRFFoam/convergenceCheck.H | 9 --------- .../steadyCompressibleSRFFoam/createFields.H | 2 ++ .../compressible/steadyCompressibleSRFFoam/iEqn.H | 3 +-- .../initConvergenceCheck.H | 7 ------- .../compressible/steadyCompressibleSRFFoam/pEqn.H | 14 ++++---------- .../steadyCompressibleSRFFoam.C | 10 ++++------ .../steadyCompressibleFoam/2bump/system/fvSchemes | 8 +------- .../transonicBump/constant/polyMesh/boundary | 4 ++-- .../transonicBump/system/fvSchemes | 8 +------- .../bentRotorStator/constant/polyMesh/boundary | 4 ++-- .../bentRotorStator/system/fvSchemes | 8 +------- .../simpleRotorStator/constant/polyMesh/boundary | 4 ++-- .../simpleRotorStator/system/fvSchemes | 8 +------- .../bentBlade/constant/polyMesh/boundary | 4 ++-- .../bentBlade/system/fvSchemes | 8 +------- .../simpleBlade/constant/polyMesh/boundary | 4 ++-- .../simpleBlade/system/fvSchemes | 8 +------- 33 files changed, 52 insertions(+), 175 deletions(-) delete mode 100644 applications/solvers/compressible/steadyCompressibleFoam/convergenceCheck.H delete mode 100644 applications/solvers/compressible/steadyCompressibleFoam/initConvergenceCheck.H delete mode 100644 applications/solvers/compressible/steadyCompressibleMRFFoam/convergenceCheck.H delete mode 100644 applications/solvers/compressible/steadyCompressibleMRFFoam/initConvergenceCheck.H delete mode 100644 applications/solvers/compressible/steadyCompressibleSRFFoam/convergenceCheck.H delete mode 100644 applications/solvers/compressible/steadyCompressibleSRFFoam/initConvergenceCheck.H diff --git a/applications/solvers/compressible/steadyCompressibleFoam/UEqn.H b/applications/solvers/compressible/steadyCompressibleFoam/UEqn.H index 4e2e22af0..204c349fb 100644 --- a/applications/solvers/compressible/steadyCompressibleFoam/UEqn.H +++ b/applications/solvers/compressible/steadyCompressibleFoam/UEqn.H @@ -10,9 +10,4 @@ UEqn.relax(); - eqnResidual = solve - ( - UEqn == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn == -fvc::grad(p)); diff --git a/applications/solvers/compressible/steadyCompressibleFoam/convergenceCheck.H b/applications/solvers/compressible/steadyCompressibleFoam/convergenceCheck.H deleted file mode 100644 index 895806319..000000000 --- a/applications/solvers/compressible/steadyCompressibleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/compressible/steadyCompressibleFoam/createFields.H b/applications/solvers/compressible/steadyCompressibleFoam/createFields.H index 9bf40b3a6..fb5848c09 100644 --- a/applications/solvers/compressible/steadyCompressibleFoam/createFields.H +++ b/applications/solvers/compressible/steadyCompressibleFoam/createFields.H @@ -53,3 +53,5 @@ thermo ) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/steadyCompressibleFoam/hEqn.H b/applications/solvers/compressible/steadyCompressibleFoam/hEqn.H index 79bc5c6a7..f6cd2ceaa 100644 --- a/applications/solvers/compressible/steadyCompressibleFoam/hEqn.H +++ b/applications/solvers/compressible/steadyCompressibleFoam/hEqn.H @@ -24,8 +24,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); // Bounding of enthalpy taken out thermo.correct(); diff --git a/applications/solvers/compressible/steadyCompressibleFoam/initConvergenceCheck.H b/applications/solvers/compressible/steadyCompressibleFoam/initConvergenceCheck.H deleted file mode 100644 index 47a1852f0..000000000 --- a/applications/solvers/compressible/steadyCompressibleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - pimple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/compressible/steadyCompressibleFoam/pEqn.H b/applications/solvers/compressible/steadyCompressibleFoam/pEqn.H index 355dae922..baf9f1625 100644 --- a/applications/solvers/compressible/steadyCompressibleFoam/pEqn.H +++ b/applications/solvers/compressible/steadyCompressibleFoam/pEqn.H @@ -8,7 +8,7 @@ surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p); // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { U = rUA*UEqn.H(); @@ -21,7 +21,7 @@ p.storePrevIter(); - for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -31,16 +31,10 @@ - fvm::laplacian(rho*rUA, p) ); - // Retain the residual from the first pressure solution - eqnResidual = pEqn.solve().initialResidual(); - - if (corr == 0 && nonOrth == 0) - { - maxResidual = max(eqnResidual, maxResidual); - } + pEqn.solve(); // Calculate the flux - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi = phid2 + pEqn.flux(); } diff --git a/applications/solvers/compressible/steadyCompressibleFoam/steadyCompressibleFoam.C b/applications/solvers/compressible/steadyCompressibleFoam/steadyCompressibleFoam.C index e1d2c9732..4fcdd878e 100644 --- a/applications/solvers/compressible/steadyCompressibleFoam/steadyCompressibleFoam.C +++ b/applications/solvers/compressible/steadyCompressibleFoam/steadyCompressibleFoam.C @@ -35,6 +35,7 @@ Author #include "fvCFD.H" #include "basicPsiThermo.H" #include "RASModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,8 +46,10 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "createFields.H" -# include "readPIMPLEControls.H" # include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,11 +60,8 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPIMPLEControls.H" # include "readFieldBounds.H" -# include "initConvergenceCheck.H" - # include "UEqn.H" # include "pEqn.H" @@ -77,8 +77,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - -# include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/UEqn.H b/applications/solvers/compressible/steadyCompressibleMRFFoam/UEqn.H index 1c39c948b..f1c57b01d 100644 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/UEqn.H +++ b/applications/solvers/compressible/steadyCompressibleMRFFoam/UEqn.H @@ -13,9 +13,4 @@ UEqn.relax(); - eqnResidual = solve - ( - UEqn == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn == -fvc::grad(p)); diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/convergenceCheck.H b/applications/solvers/compressible/steadyCompressibleMRFFoam/convergenceCheck.H deleted file mode 100644 index 895806319..000000000 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/createFields.H b/applications/solvers/compressible/steadyCompressibleMRFFoam/createFields.H index 00073568e..cbe7631a7 100644 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/createFields.H +++ b/applications/solvers/compressible/steadyCompressibleMRFFoam/createFields.H @@ -94,3 +94,5 @@ h ); i -= 0.5*magSqr(Urot); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/hEqn.H b/applications/solvers/compressible/steadyCompressibleMRFFoam/hEqn.H index 08392027f..0579637b9 100644 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/hEqn.H +++ b/applications/solvers/compressible/steadyCompressibleMRFFoam/hEqn.H @@ -20,9 +20,6 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); - // Bounding of enthalpy taken out thermo.correct(); psis = thermo.psi()/thermo.Cp()*thermo.Cv(); diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/iEqn.H b/applications/solvers/compressible/steadyCompressibleMRFFoam/iEqn.H index ca500d7af..00596aa6d 100644 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/iEqn.H +++ b/applications/solvers/compressible/steadyCompressibleMRFFoam/iEqn.H @@ -35,8 +35,7 @@ iEqn.relax(); - eqnResidual = iEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + iEqn.solve(); // Calculate enthalpy out of rothalpy h = i + 0.5*magSqr(Urot); diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/initConvergenceCheck.H b/applications/solvers/compressible/steadyCompressibleMRFFoam/initConvergenceCheck.H deleted file mode 100644 index 47a1852f0..000000000 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - pimple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/pEqn.H b/applications/solvers/compressible/steadyCompressibleMRFFoam/pEqn.H index b45e1573d..c0997ecf6 100644 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/pEqn.H +++ b/applications/solvers/compressible/steadyCompressibleMRFFoam/pEqn.H @@ -7,7 +7,7 @@ // Needs to be outside of loop since p is changing, but psi and rho are not. surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p); - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { U = rUA*UEqn.H(); @@ -25,7 +25,7 @@ p.storePrevIter(); - for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -35,16 +35,10 @@ - fvm::laplacian(rho*rUA, p) ); - // Retain the residual from the first pressure solution - eqnResidual = pEqn.solve().initialResidual(); - - if (corr == 0 && nonOrth == 0) - { - maxResidual = max(eqnResidual, maxResidual); - } + pEqn.solve(); // Calculate the flux - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi = phid2 + pEqn.flux(); } diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/steadyCompressibleMRFFoam.C b/applications/solvers/compressible/steadyCompressibleMRFFoam/steadyCompressibleMRFFoam.C index 1ec4bd8c8..84337526b 100644 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/steadyCompressibleMRFFoam.C +++ b/applications/solvers/compressible/steadyCompressibleMRFFoam/steadyCompressibleMRFFoam.C @@ -37,6 +37,7 @@ Author #include "basicPsiThermo.H" #include "RASModel.H" #include "MRFZones.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,8 +48,10 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "createFields.H" -# include "readPIMPLEControls.H" # include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,11 +62,8 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPIMPLEControls.H" # include "readFieldBounds.H" -# include "initConvergenceCheck.H" - # include "UEqn.H" # include "pEqn.H" @@ -81,8 +81,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - -# include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/compressible/steadyCompressibleSRFFoam/UEqn.H b/applications/solvers/compressible/steadyCompressibleSRFFoam/UEqn.H index 334595328..79e6bc93c 100644 --- a/applications/solvers/compressible/steadyCompressibleSRFFoam/UEqn.H +++ b/applications/solvers/compressible/steadyCompressibleSRFFoam/UEqn.H @@ -11,9 +11,4 @@ UrelEqn.relax(); - eqnResidual = solve - ( - UrelEqn == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UrelEqn == -fvc::grad(p)); diff --git a/applications/solvers/compressible/steadyCompressibleSRFFoam/convergenceCheck.H b/applications/solvers/compressible/steadyCompressibleSRFFoam/convergenceCheck.H deleted file mode 100644 index 895806319..000000000 --- a/applications/solvers/compressible/steadyCompressibleSRFFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/compressible/steadyCompressibleSRFFoam/createFields.H b/applications/solvers/compressible/steadyCompressibleSRFFoam/createFields.H index 6b84b46ba..d4e5aed10 100644 --- a/applications/solvers/compressible/steadyCompressibleSRFFoam/createFields.H +++ b/applications/solvers/compressible/steadyCompressibleSRFFoam/createFields.H @@ -101,3 +101,5 @@ h ); i -= 0.5*magSqr(SRF->U()); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/steadyCompressibleSRFFoam/iEqn.H b/applications/solvers/compressible/steadyCompressibleSRFFoam/iEqn.H index f4d8af891..5b7ab5b9f 100644 --- a/applications/solvers/compressible/steadyCompressibleSRFFoam/iEqn.H +++ b/applications/solvers/compressible/steadyCompressibleSRFFoam/iEqn.H @@ -24,8 +24,7 @@ iEqn.relax(); - eqnResidual = iEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + iEqn.solve(); // Calculate enthalpy out of rothalpy volVectorField Urot("Urot", SRF->U()); diff --git a/applications/solvers/compressible/steadyCompressibleSRFFoam/initConvergenceCheck.H b/applications/solvers/compressible/steadyCompressibleSRFFoam/initConvergenceCheck.H deleted file mode 100644 index 47a1852f0..000000000 --- a/applications/solvers/compressible/steadyCompressibleSRFFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - pimple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/compressible/steadyCompressibleSRFFoam/pEqn.H b/applications/solvers/compressible/steadyCompressibleSRFFoam/pEqn.H index f161a3c4d..ce6089e9c 100644 --- a/applications/solvers/compressible/steadyCompressibleSRFFoam/pEqn.H +++ b/applications/solvers/compressible/steadyCompressibleSRFFoam/pEqn.H @@ -7,7 +7,7 @@ // Needs to be outside of loop since p is changing, but psi and rho are not. surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p); - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { Urel = rUrelA*UrelEqn.H(); @@ -20,7 +20,7 @@ p.storePrevIter(); - for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -30,16 +30,10 @@ - fvm::laplacian(rho*rUrelA, p) ); - // Retain the residual from the first pressure solution - eqnResidual = pEqn.solve().initialResidual(); - - if (corr == 0 && nonOrth == 0) - { - maxResidual = max(eqnResidual, maxResidual); - } + pEqn.solve(); // Calculate the flux - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi = phid2 + pEqn.flux(); } diff --git a/applications/solvers/compressible/steadyCompressibleSRFFoam/steadyCompressibleSRFFoam.C b/applications/solvers/compressible/steadyCompressibleSRFFoam/steadyCompressibleSRFFoam.C index 87a48982b..5c7ad2d43 100644 --- a/applications/solvers/compressible/steadyCompressibleSRFFoam/steadyCompressibleSRFFoam.C +++ b/applications/solvers/compressible/steadyCompressibleSRFFoam/steadyCompressibleSRFFoam.C @@ -37,6 +37,7 @@ Author #include "basicPsiThermo.H" #include "RASModel.H" #include "SRFModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,8 +48,10 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "createFields.H" -# include "readPIMPLEControls.H" # include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,11 +62,8 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPIMPLEControls.H" # include "readFieldBounds.H" -# include "initConvergenceCheck.H" - # include "UEqn.H" # include "iEqn.H" # include "pEqn.H" @@ -80,8 +80,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - -# include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/tutorials/compressible/steadyCompressibleFoam/2bump/system/fvSchemes b/tutorials/compressible/steadyCompressibleFoam/2bump/system/fvSchemes index e30479824..1fff3eaa1 100644 --- a/tutorials/compressible/steadyCompressibleFoam/2bump/system/fvSchemes +++ b/tutorials/compressible/steadyCompressibleFoam/2bump/system/fvSchemes @@ -48,7 +48,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -66,10 +66,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/compressible/steadyCompressibleFoam/transonicBump/constant/polyMesh/boundary b/tutorials/compressible/steadyCompressibleFoam/transonicBump/constant/polyMesh/boundary index ee56aaa93..e40557440 100644 --- a/tutorials/compressible/steadyCompressibleFoam/transonicBump/constant/polyMesh/boundary +++ b/tutorials/compressible/steadyCompressibleFoam/transonicBump/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/compressible/steadyCompressibleFoam/transonicBump/system/fvSchemes b/tutorials/compressible/steadyCompressibleFoam/transonicBump/system/fvSchemes index 8c0c582e2..67b89fe25 100644 --- a/tutorials/compressible/steadyCompressibleFoam/transonicBump/system/fvSchemes +++ b/tutorials/compressible/steadyCompressibleFoam/transonicBump/system/fvSchemes @@ -48,7 +48,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(U,p) Gauss linear; @@ -70,10 +70,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/compressible/steadyCompressibleMRFFoam/bentRotorStator/constant/polyMesh/boundary b/tutorials/compressible/steadyCompressibleMRFFoam/bentRotorStator/constant/polyMesh/boundary index 8c06e27f8..bd4bb9360 100644 --- a/tutorials/compressible/steadyCompressibleMRFFoam/bentRotorStator/constant/polyMesh/boundary +++ b/tutorials/compressible/steadyCompressibleMRFFoam/bentRotorStator/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/compressible/steadyCompressibleMRFFoam/bentRotorStator/system/fvSchemes b/tutorials/compressible/steadyCompressibleMRFFoam/bentRotorStator/system/fvSchemes index 168edcee9..2a25d0e03 100644 --- a/tutorials/compressible/steadyCompressibleMRFFoam/bentRotorStator/system/fvSchemes +++ b/tutorials/compressible/steadyCompressibleMRFFoam/bentRotorStator/system/fvSchemes @@ -48,7 +48,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(U,p) Gauss linear; } @@ -68,10 +68,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/compressible/steadyCompressibleMRFFoam/simpleRotorStator/constant/polyMesh/boundary b/tutorials/compressible/steadyCompressibleMRFFoam/simpleRotorStator/constant/polyMesh/boundary index 8c06e27f8..bd4bb9360 100644 --- a/tutorials/compressible/steadyCompressibleMRFFoam/simpleRotorStator/constant/polyMesh/boundary +++ b/tutorials/compressible/steadyCompressibleMRFFoam/simpleRotorStator/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/compressible/steadyCompressibleMRFFoam/simpleRotorStator/system/fvSchemes b/tutorials/compressible/steadyCompressibleMRFFoam/simpleRotorStator/system/fvSchemes index 1bb70c9ee..9909be988 100644 --- a/tutorials/compressible/steadyCompressibleMRFFoam/simpleRotorStator/system/fvSchemes +++ b/tutorials/compressible/steadyCompressibleMRFFoam/simpleRotorStator/system/fvSchemes @@ -44,7 +44,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(U,p) Gauss linear; } @@ -64,10 +64,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/constant/polyMesh/boundary b/tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/constant/polyMesh/boundary index 7937839af..0f18bdcde 100644 --- a/tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/constant/polyMesh/boundary +++ b/tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/system/fvSchemes b/tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/system/fvSchemes index abc8edd65..aad1ab6c3 100644 --- a/tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/system/fvSchemes +++ b/tutorials/compressible/steadyCompressibleSRFFoam/bentBlade/system/fvSchemes @@ -44,7 +44,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; - div((muEff*dev2(grad(Urel).T()))) Gauss linear; + div((muEff*dev2(T(grad(Urel))))) Gauss linear; div(U,p) Gauss linear; @@ -65,10 +65,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/constant/polyMesh/boundary b/tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/constant/polyMesh/boundary index 7937839af..0f18bdcde 100644 --- a/tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/constant/polyMesh/boundary +++ b/tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/system/fvSchemes b/tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/system/fvSchemes index abc8edd65..aad1ab6c3 100644 --- a/tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/system/fvSchemes +++ b/tutorials/compressible/steadyCompressibleSRFFoam/simpleBlade/system/fvSchemes @@ -44,7 +44,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; - div((muEff*dev2(grad(Urel).T()))) Gauss linear; + div((muEff*dev2(T(grad(Urel))))) Gauss linear; div(U,p) Gauss linear; @@ -65,10 +65,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // From 0cd17ee5e0a46b0fda8aef5a051a5afcc5388186 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Fri, 27 May 2016 14:11:25 +0200 Subject: [PATCH 09/26] Backported COUPLED solvers and tutorials (vanilla OF 3.0.1) --- .../blockCoupledScalarTransportFoam.C | 11 ++++++----- .../solvers/coupled/conjugateHeatFoam/UEqn.H | 2 +- .../conjugateHeatFoam/conjugateHeatFoam.C | 7 +++++-- .../coupled/conjugateHeatFoam/createFields.H | 1 + .../solvers/coupled/conjugateHeatFoam/pEqn.H | 19 +++++++++---------- .../coupled/conjugateHeatSimpleFoam/UEqn.H | 6 ++---- .../conjugateHeatSimpleFoam.C | 9 +++++---- .../conjugateHeatSimpleFoam/createFields.H | 1 + .../initConvergenceCheck.H | 7 ------- .../coupled/conjugateHeatSimpleFoam/pEqn.H | 15 +++------------ .../constant/polyMesh/boundary | 4 ++-- .../blockCoupledSwirlTest/system/fvSchemes | 5 ----- .../conjugateCavity/0/solid/materials | 5 +++-- .../conjugateCavity/system/fvSchemes | 8 +------- .../conjugateCavity/system/solid/fvSchemes | 5 ----- .../conjugateCavity/0/solid/materials | 5 +++-- .../conjugateCavity/system/fvSchemes | 8 +------- .../conjugateCavity/system/solid/fvSchemes | 5 ----- 18 files changed, 43 insertions(+), 80 deletions(-) delete mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/initConvergenceCheck.H diff --git a/applications/solvers/coupled/blockCoupledScalarTransportFoam/blockCoupledScalarTransportFoam.C b/applications/solvers/coupled/blockCoupledScalarTransportFoam/blockCoupledScalarTransportFoam.C index 413ee4e5a..66a486307 100644 --- a/applications/solvers/coupled/blockCoupledScalarTransportFoam/blockCoupledScalarTransportFoam.C +++ b/applications/solvers/coupled/blockCoupledScalarTransportFoam/blockCoupledScalarTransportFoam.C @@ -39,7 +39,7 @@ Description #include "foamTime.H" #include "fvMesh.H" #include "fvBlockMatrix.H" - +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,6 +49,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + simpleControl simple(mesh); + # include "createFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,13 +60,11 @@ int main(int argc, char *argv[]) # include "CourantNo.H" - for (runTime++; !runTime.end(); runTime++) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readSIMPLEControls.H" - - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix TEqn ( diff --git a/applications/solvers/coupled/conjugateHeatFoam/UEqn.H b/applications/solvers/coupled/conjugateHeatFoam/UEqn.H index df6f90ac0..10aeeb0c6 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/UEqn.H +++ b/applications/solvers/coupled/conjugateHeatFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn.relax(); - if (momentumPredictor) + if (piso.momentumPredictor()) { solve ( diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatFoam.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatFoam.C index 89bfc93d2..5b00fd9da 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatFoam.C +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatFoam.C @@ -38,6 +38,7 @@ Description #include "thermalModel.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,6 +48,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createFluidMesh.H" # include "createSolidMesh.H" + + pisoControl piso(mesh); + # include "readGravitationalAcceleration.H" # include "createFields.H" # include "createSolidFields.H" @@ -64,7 +68,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; # include "readTimeControls.H" -# include "readPISOControls.H" # include "CourantNo.H" # include "setDeltaT.H" @@ -75,7 +78,7 @@ int main(int argc, char *argv[]) p_rgh.storePrevIter(); - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { # include "pEqn.H" } diff --git a/applications/solvers/coupled/conjugateHeatFoam/createFields.H b/applications/solvers/coupled/conjugateHeatFoam/createFields.H index 720ef6deb..fc5504c68 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/createFields.H +++ b/applications/solvers/coupled/conjugateHeatFoam/createFields.H @@ -71,6 +71,7 @@ pRefCell, pRefValue ); + mesh.schemesDict().setFluxRequired(p_rgh.name()); autoPtr turbulence ( diff --git a/applications/solvers/coupled/conjugateHeatFoam/pEqn.H b/applications/solvers/coupled/conjugateHeatFoam/pEqn.H index 57e9a156d..e85345491 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/pEqn.H +++ b/applications/solvers/coupled/conjugateHeatFoam/pEqn.H @@ -10,7 +10,7 @@ surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -19,16 +19,15 @@ p_rghEqn.setReference(pRefCell, pRefValue); - if (corr == nCorr-1 && nonOrth == nNonOrthCorr) - { - p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name() + "Final")); - } - else - { - p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name())); - } + p_rghEqn.solve + ( + mesh.solutionDict().solver + ( + p_rgh.select(piso.finalInnerIter()) + ) + ); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H index 59633497a..32510f030 100644 --- a/applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn().relax(); - eqnResidual = solve + solve ( UEqn() == @@ -22,6 +22,4 @@ )*mesh.magSf() ) ) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + ); diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/conjugateHeatSimpleFoam.C b/applications/solvers/coupled/conjugateHeatSimpleFoam/conjugateHeatSimpleFoam.C index affeaecf9..2ba10da9b 100644 --- a/applications/solvers/coupled/conjugateHeatSimpleFoam/conjugateHeatSimpleFoam.C +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/conjugateHeatSimpleFoam.C @@ -38,6 +38,7 @@ Description #include "thermalModel.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,6 +48,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createFluidMesh.H" # include "createSolidMesh.H" + + simpleControl simple(mesh); + # include "readGravitationalAcceleration.H" # include "createFields.H" # include "createSolidFields.H" @@ -56,13 +60,10 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readSIMPLEControls.H" -# include "initConvergenceCheck.H" - // Detach patches # include "detachPatches.H" diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H index 159d180cc..a60a1d76b 100644 --- a/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H @@ -71,6 +71,7 @@ pRefCell, pRefValue ); + mesh.schemesDict().setFluxRequired(p_rgh.name()); autoPtr turbulence ( diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/initConvergenceCheck.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/initConvergenceCheck.H deleted file mode 100644 index b56197f22..000000000 --- a/applications/solvers/coupled/conjugateHeatSimpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H index 559b052c6..dddf81e5b 100644 --- a/applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H @@ -11,7 +11,7 @@ surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix p_rghEqn ( @@ -20,18 +20,9 @@ p_rghEqn.setReference(pRefCell, pRefValue); - // retain the residual from the first iteration - if (nonOrth == 0) - { - eqnResidual = p_rghEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); - } - else - { - p_rghEqn.solve(); - } + p_rghEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (simple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/tutorials/coupled/blockCoupledScalarTransportFoam/blockCoupledSwirlTest/constant/polyMesh/boundary b/tutorials/coupled/blockCoupledScalarTransportFoam/blockCoupledSwirlTest/constant/polyMesh/boundary index cf8b0f726..8c24ffa42 100644 --- a/tutorials/coupled/blockCoupledScalarTransportFoam/blockCoupledSwirlTest/constant/polyMesh/boundary +++ b/tutorials/coupled/blockCoupledScalarTransportFoam/blockCoupledSwirlTest/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/coupled/blockCoupledScalarTransportFoam/blockCoupledSwirlTest/system/fvSchemes b/tutorials/coupled/blockCoupledScalarTransportFoam/blockCoupledSwirlTest/system/fvSchemes index 4f86f5b77..2834dfa86 100644 --- a/tutorials/coupled/blockCoupledScalarTransportFoam/blockCoupledSwirlTest/system/fvSchemes +++ b/tutorials/coupled/blockCoupledScalarTransportFoam/blockCoupledSwirlTest/system/fvSchemes @@ -48,9 +48,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; -} - // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/materials b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/materials index 8d96601d3..019e71299 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/materials +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/materials @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -39,4 +39,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes index 414342c91..f7c603ec2 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes // div(phi,R) Gauss upwind; // div(R) Gauss linear; // div(phi,nuTilda) Gauss upwind; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -62,10 +62,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p_rgh; -} - // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSchemes b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSchemes index 8ae0a8c2d..fa14cec57 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSchemes +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSchemes @@ -46,9 +46,4 @@ snGradSchemes default uncorrected; } -fluxRequired -{ - default no; -} - // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/materials b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/materials index 8d96601d3..019e71299 100644 --- a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/materials +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/materials @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -39,4 +39,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes index f18d60481..84fcec45f 100644 --- a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes // div(phi,R) Gauss upwind; // div(R) Gauss linear; // div(phi,nuTilda) Gauss upwind; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -62,10 +62,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p_rgh; -} - // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSchemes b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSchemes index 8ae0a8c2d..fa14cec57 100644 --- a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSchemes +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSchemes @@ -46,9 +46,4 @@ snGradSchemes default uncorrected; } -fluxRequired -{ - default no; -} - // ************************************************************************* // From 7ffe7f3f46d4330d160df860a2ed069805b189fa Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Fri, 27 May 2016 14:30:28 +0200 Subject: [PATCH 10/26] Added setFluxRequired to pUCoupledFoam and MRFPorousFoam; backported tutorials --- applications/solvers/coupled/MRFPorousFoam/createFields.H | 2 ++ applications/solvers/coupled/pUCoupledFoam/createFields.H | 2 ++ .../backwardFacingStepLaminar/constant/polyMesh/boundary | 2 +- .../backwardFacingStepLaminar/system/fvSchemes | 8 +------- .../constant/polyMesh/boundary | 2 +- .../backwardFacingStepTurbulent/system/fvSchemes | 8 +------- .../pUCoupledFoam/cavity/constant/polyMesh/boundary | 2 +- .../incompressible/pUCoupledFoam/cavity/system/fvSchemes | 8 +------- 8 files changed, 10 insertions(+), 24 deletions(-) diff --git a/applications/solvers/coupled/MRFPorousFoam/createFields.H b/applications/solvers/coupled/MRFPorousFoam/createFields.H index 51403c4a7..29df5dfc2 100644 --- a/applications/solvers/coupled/MRFPorousFoam/createFields.H +++ b/applications/solvers/coupled/MRFPorousFoam/createFields.H @@ -50,3 +50,5 @@ volVector4Field Up mesh, dimensionedVector4("zero", dimless, vector4::zero) ); + +mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/coupled/pUCoupledFoam/createFields.H b/applications/solvers/coupled/pUCoupledFoam/createFields.H index 51403c4a7..29df5dfc2 100644 --- a/applications/solvers/coupled/pUCoupledFoam/createFields.H +++ b/applications/solvers/coupled/pUCoupledFoam/createFields.H @@ -50,3 +50,5 @@ volVector4Field Up mesh, dimensionedVector4("zero", dimless, vector4::zero) ); + +mesh.schemesDict().setFluxRequired(p.name()); diff --git a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/constant/polyMesh/boundary b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/constant/polyMesh/boundary index 8e9b6ebe9..6bd5b4bb5 100644 --- a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/constant/polyMesh/boundary +++ b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSchemes b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSchemes index f92276412..e8b6cda55 100644 --- a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSchemes +++ b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepLaminar/system/fvSchemes @@ -30,7 +30,7 @@ divSchemes default none; // div(phi,U) Gauss upwind; div(phi,U) Gauss linearUpwind Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; div((grad(p)|A(U))) Gauss linear; div(U) Gauss linear; } @@ -52,10 +52,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/constant/polyMesh/boundary b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/constant/polyMesh/boundary index 8e9b6ebe9..6bd5b4bb5 100644 --- a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/constant/polyMesh/boundary +++ b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSchemes b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSchemes index b26b5fb84..11b9a4a3a 100644 --- a/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSchemes +++ b/tutorials/incompressible/pUCoupledFoam/backwardFacingStepTurbulent/system/fvSchemes @@ -31,7 +31,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div((nuEff*dev(grad(U).T()))) Gauss linear; - div((grad(p)|A(U))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; div(U) Gauss linear; } @@ -50,10 +50,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/incompressible/pUCoupledFoam/cavity/constant/polyMesh/boundary b/tutorials/incompressible/pUCoupledFoam/cavity/constant/polyMesh/boundary index bd1d0b7f1..9e2922b27 100644 --- a/tutorials/incompressible/pUCoupledFoam/cavity/constant/polyMesh/boundary +++ b/tutorials/incompressible/pUCoupledFoam/cavity/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/incompressible/pUCoupledFoam/cavity/system/fvSchemes b/tutorials/incompressible/pUCoupledFoam/cavity/system/fvSchemes index 11c47fd1e..d2048b4cd 100644 --- a/tutorials/incompressible/pUCoupledFoam/cavity/system/fvSchemes +++ b/tutorials/incompressible/pUCoupledFoam/cavity/system/fvSchemes @@ -28,7 +28,7 @@ divSchemes { default none; div(phi,U) Gauss linearUpwind Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; div(U) Gauss linear; } @@ -50,10 +50,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // From 9811dd7d25c25b0c32f1cdf2439e708786a0f1dd Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Fri, 27 May 2016 17:46:05 +0200 Subject: [PATCH 11/26] Backported heat transfer solvers and tutorials (vanilla OF 3.0.1) (in chtMultiRegionFoam and chtMultiRegionSimpleFoam only added setFluxRequired) --- .../boussinesqBuoyantFoam.C | 13 +++-- .../boussinesqBuoyantFoam/createFields.H | 1 + .../buoyantBoussinesqPisoFoam/UEqn.H | 2 +- .../buoyantBoussinesqPisoFoam.C | 7 ++- .../buoyantBoussinesqPisoFoam/createFields.H | 1 + .../buoyantBoussinesqPisoFoam/pEqn.H | 13 ++--- .../buoyantBoussinesqSimpleFoam/TEqn.H | 3 +- .../buoyantBoussinesqSimpleFoam/UEqn.H | 6 +-- .../buoyantBoussinesqSimpleFoam.C | 13 ++--- .../convergenceCheck.H | 9 ---- .../createFields.H | 2 +- .../initConvergenceCheck.H | 7 --- .../buoyantBoussinesqSimpleFoam/pEqn.H | 15 ++---- .../heatTransfer/buoyantPisoFoam/UEqn.H | 2 +- .../buoyantPisoFoam/buoyantPisoFoam.C | 7 ++- .../buoyantPisoFoam/createFields.H | 2 + .../heatTransfer/buoyantPisoFoam/pEqn.H | 13 ++--- .../heatTransfer/buoyantSimpleFoam/UEqn.H | 6 +-- .../buoyantSimpleFoam/buoyantSimpleFoam.C | 14 ++---- .../buoyantSimpleFoam/convergenceCheck.H | 9 ---- .../buoyantSimpleFoam/createFields.H | 2 + .../heatTransfer/buoyantSimpleFoam/hEqn.H | 3 +- .../buoyantSimpleFoam/initConvergenceCheck.H | 7 --- .../heatTransfer/buoyantSimpleFoam/pEqn.H | 15 ++---- .../buoyantSimpleRadiationFoam.C | 14 ++---- .../buoyantSimpleRadiationFoam/hEqn.H | 3 +- .../fluid/setRegionFluidFields.H | 2 + .../fluid/setRegionFluidFields.H | 2 + .../heatedCavity/constant/polyMesh/boundary | 5 +- .../heatedCavity/system/fvSchemes | 6 --- .../heatedCavity/system/fvSolution | 26 ++++++++-- .../hotRoom/Allclean | 1 + .../hotRoom/system/fvSchemes | 8 +--- .../hotRoom/Allclean | 1 + .../hotRoom/system/fvSchemes | 8 +--- .../constant/polyMesh/boundary | 48 +++++++++++++------ .../iglooWithFridges/system/fvSchemes | 8 +--- .../buoyantPisoFoam/hotRoom/system/fvSchemes | 8 +--- .../buoyantSimpleFoam/hotRoom/0/epsilon | 14 ++++-- .../buoyantSimpleFoam/hotRoom/0/k | 5 +- .../hotRoom/system/fvSchemes | 8 +--- .../hotRadiationRoom/0/epsilon | 17 ++++--- .../hotRadiationRoom/0/k | 5 +- .../hotRadiationRoom/system/fvSchemes | 8 +--- .../hotRadiationRoomFvDOM/system/fvSchemes | 8 +--- .../system/fvSchemes | 8 +--- .../system/bottomAir/fvSchemes | 8 +--- .../multiRegionHeater/system/fvSchemes | 8 +--- .../multiRegionHeater/system/heater/fvSchemes | 5 -- .../constant/polyMesh/boundary | 4 +- .../system/bottomAir/fvSchemes | 8 +--- .../snappyMultiRegionHeater/system/fvSchemes | 4 -- .../system/heater/fvSchemes | 5 -- .../system/leftSolid/fvSchemes | 5 -- .../system/rightSolid/fvSchemes | 5 -- .../system/topAir/fvSchemes | 8 +--- .../multiRegionHeater/system/fvSchemes | 4 -- .../multiRegionHeater/system/heater/fvSchemes | 5 -- .../multiRegionHeater/system/topAir/fvSchemes | 8 +--- 59 files changed, 166 insertions(+), 296 deletions(-) delete mode 100644 applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/convergenceCheck.H delete mode 100644 applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/initConvergenceCheck.H delete mode 100644 applications/solvers/heatTransfer/buoyantSimpleFoam/convergenceCheck.H delete mode 100644 applications/solvers/heatTransfer/buoyantSimpleFoam/initConvergenceCheck.H diff --git a/applications/solvers/heatTransfer/boussinesqBuoyantFoam/boussinesqBuoyantFoam.C b/applications/solvers/heatTransfer/boussinesqBuoyantFoam/boussinesqBuoyantFoam.C index fbb31ef8d..a2daaf199 100644 --- a/applications/solvers/heatTransfer/boussinesqBuoyantFoam/boussinesqBuoyantFoam.C +++ b/applications/solvers/heatTransfer/boussinesqBuoyantFoam/boussinesqBuoyantFoam.C @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -41,6 +42,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pisoControl piso(mesh); + # include "readTransportProperties.H" # include "readGravitationalAcceleration.H" # include "createFields.H" @@ -50,11 +54,10 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - for (runTime++; !runTime.end(); runTime++) + while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPISOControls.H" # include "CourantNo.H" fvVectorMatrix UEqn @@ -70,7 +73,7 @@ int main(int argc, char *argv[]) // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { volScalarField rUA = 1.0/UEqn.A(); @@ -80,7 +83,7 @@ int main(int argc, char *argv[]) adjustPhi(phi, U, p); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -90,7 +93,7 @@ int main(int argc, char *argv[]) pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/heatTransfer/boussinesqBuoyantFoam/createFields.H b/applications/solvers/heatTransfer/boussinesqBuoyantFoam/createFields.H index ce61861ee..bfac7811b 100644 --- a/applications/solvers/heatTransfer/boussinesqBuoyantFoam/createFields.H +++ b/applications/solvers/heatTransfer/boussinesqBuoyantFoam/createFields.H @@ -49,6 +49,7 @@ label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + mesh.schemesDict().setFluxRequired(p.name()); Info<< "Reading/calculating field rho\n" << endl; volScalarField rho diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/UEqn.H index 35387f4ff..fa68de296 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn.relax(); - if (momentumPredictor) + if (piso.momentumPredictor()) { solve ( diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/buoyantBoussinesqPisoFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/buoyantBoussinesqPisoFoam.C index 73547b6a3..e91ead7cd 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/buoyantBoussinesqPisoFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/buoyantBoussinesqPisoFoam.C @@ -48,6 +48,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "turbulenceModel.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,6 +57,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + pisoControl piso(mesh); + # include "readGravitationalAcceleration.H" # include "createFields.H" # include "initContinuityErrs.H" @@ -72,7 +76,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; # include "readTimeControls.H" -# include "readPISOControls.H" # include "CourantNo.H" # include "setDeltaT.H" @@ -80,7 +83,7 @@ int main(int argc, char *argv[]) # include "TEqn.H" // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { # include "pEqn.H" } diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/createFields.H index b2fa0af92..697bc6aba 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/createFields.H @@ -61,6 +61,7 @@ pRefCell, pRefValue ); + mesh.schemesDict().setFluxRequired(p.name()); // Kinematic density for buoyancy force diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/pEqn.H index 02d86340c..2601d0eb6 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/pEqn.H @@ -12,23 +12,16 @@ phi = phiU + rUAf*fvc::interpolate(rhok)*(g & mesh.Sf()); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvm::laplacian(rUAf, p) == fvc::div(phi) ); - if (corr == nCorr - 1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solutionDict().solver(p.name() + "Final")); - } - else - { - pEqn.solve(mesh.solutionDict().solver(p.name())); - } + pEqn.solve(mesh.solutionDict().solver(p.select(piso.finalInnerIter()))); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H index 7452a0495..3bdeea045 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H @@ -14,8 +14,7 @@ TEqn.relax(); - eqnResidual = TEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + TEqn.solve(); rhok = 1.0 - beta*(T - TRef); } diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H index bcf99e166..292f44b4b 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H @@ -8,7 +8,7 @@ UEqn().relax(); - eqnResidual = solve + solve ( UEqn() == @@ -19,6 +19,4 @@ - fvc::snGrad(p)*mesh.magSf() ) ) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + ); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C index acfd8ff48..341f0a3a4 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C @@ -48,6 +48,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,6 +57,9 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" + + simpleControl simple(mesh); + #include "readGravitationalAcceleration.H" #include "createFields.H" #include "initContinuityErrs.H" @@ -64,15 +68,10 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" - - p.storePrevIter(); - // Pressure-velocity SIMPLE corrector { #include "UEqn.H" @@ -87,8 +86,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/convergenceCheck.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/convergenceCheck.H deleted file mode 100644 index 895806319..000000000 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H index 0e668e9d9..663863637 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/createFields.H @@ -64,7 +64,7 @@ pRefCell, pRefValue ); - + mesh.schemesDict().setFluxRequired(p.name()); // Kinematic density for buoyancy force volScalarField rhok diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/initConvergenceCheck.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/initConvergenceCheck.H deleted file mode 100644 index b56197f22..000000000 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H index 6408c7ccc..256a336f3 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H @@ -12,7 +12,7 @@ rUAf*fvc::interpolate(rhok)*(g & mesh.Sf()); phi += buoyancyPhi; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -21,18 +21,9 @@ pEqn.setReference(pRefCell, pRefValue); - // retain the residual from the first iteration - if (nonOrth == 0) - { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); - } - else - { - pEqn.solve(); - } + pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (simple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= pEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantPisoFoam/UEqn.H index d4878d063..230f18661 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantPisoFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn.relax(); - if (momentumPredictor) + if (piso.momentumPredictor()) { solve ( diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C b/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C index 2a277a9bf..05dd6a70f 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C +++ b/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C @@ -37,6 +37,7 @@ Description #include "basicRhoThermo.H" #include "turbulenceModel.H" #include "fixedGradientFvPatchFields.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,6 +46,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + pisoControl piso(mesh); + # include "readGravitationalAcceleration.H" # include "createFields.H" # include "initContinuityErrs.H" @@ -59,7 +63,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { # include "readTimeControls.H" -# include "readPISOControls.H" # include "compressibleCourantNo.H" # include "setDeltaT.H" @@ -75,7 +78,7 @@ int main(int argc, char *argv[]) // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { # include "pEqn.H" } diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPisoFoam/createFields.H index b8ac5595e..616d1c170 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantPisoFoam/createFields.H @@ -65,3 +65,5 @@ dimensionedScalar initialMass = fvc::domainIntegrate(rho); dimensionedScalar totalVolume = sum(mesh.V()); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H index f78fb9483..64edba028 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H @@ -23,7 +23,7 @@ phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf()); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -32,16 +32,9 @@ - fvm::laplacian(rhorUAf, p) ); - if (corr == nCorr - 1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solutionDict().solver(p.name() + "Final")); - } - else - { - pEqn.solve(mesh.solutionDict().solver(p.name())); - } + pEqn.solve(mesh.solutionDict().solver(p.select(piso.finalInnerIter()))); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H index 0170d6e38..560988360 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H @@ -8,7 +8,7 @@ UEqn().relax(); - eqnResidual = solve + solve ( UEqn() == @@ -17,6 +17,4 @@ fvc::interpolate(rho)*(g & mesh.Sf()) - fvc::snGrad(p)*mesh.magSf() ) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + ); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C index 913f3634b..9ff38ec08 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C @@ -33,6 +33,7 @@ Description #include "basicPsiThermo.H" #include "RASModel.H" #include "fixedGradientFvPatchFields.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -41,6 +42,9 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" + + simpleControl simple(mesh); + #include "readGravitationalAcceleration.H" #include "createFields.H" #include "initContinuityErrs.H" @@ -49,16 +53,10 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" - - p.storePrevIter(); - rho.storePrevIter(); - // Pressure-velocity SIMPLE corrector { #include "UEqn.H" @@ -73,8 +71,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/convergenceCheck.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/convergenceCheck.H deleted file mode 100644 index 895806319..000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H index b304ace10..a428c20ee 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H @@ -67,3 +67,5 @@ dimensionedScalar initialMass = fvc::domainIntegrate(rho); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H index 0c507ce3d..b91a17ee7 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H @@ -11,8 +11,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); } diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/initConvergenceCheck.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/initConvergenceCheck.H deleted file mode 100644 index c920b6708..000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ - // initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 11768ea2f..0321e0748 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -14,7 +14,7 @@ rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf()); phi += buoyancyPhi; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -23,18 +23,9 @@ pEqn.setReference(pRefCell, pRefValue); - // retain the residual from the first iteration - if (nonOrth == 0) - { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); - } - else - { - pEqn.solve(); - } + pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (simple.finalNonOrthogonalIter()) { // For closed-volume cases adjust the pressure and density levels // to obey overall mass continuity diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C index f5ee87a62..3f451f99c 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C @@ -35,6 +35,7 @@ Description #include "RASModel.H" #include "fixedGradientFvPatchFields.H" #include "radiationModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,6 +44,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + simpleControl simple(mesh); + # include "readGravitationalAcceleration.H" # include "createFields.H" # include "createRadiationModel.H" @@ -52,16 +56,10 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readSIMPLEControls.H" -# include "initConvergenceCheck.H" - - p.storePrevIter(); - rho.storePrevIter(); - // Pressure-velocity SIMPLE corrector { # include "UEqn.H" @@ -76,8 +74,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - -# include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H index 24b17645d..57de44e4a 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H @@ -12,8 +12,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H index 49bffaa4d..5e584cce7 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -15,3 +15,5 @@ volScalarField& h = thermo.h(); const dimensionedScalar massIni("massIni", dimMass, initialMassFluid[i]); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H index 656fb42e5..4c1b4d921 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H @@ -22,3 +22,5 @@ const label pRefCell = pRefCellFluid[i]; const scalar pRefValue = pRefValueFluid[i]; + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/constant/polyMesh/boundary b/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/constant/polyMesh/boundary index 70a873217..8c1c27580 100644 --- a/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/constant/polyMesh/boundary +++ b/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -44,7 +44,6 @@ FoamFile frontAndBack { type empty; - physicalType empty; nFaces 800; startFace 840; } diff --git a/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/system/fvSchemes b/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/system/fvSchemes index 46bdf14a2..96ec38f0e 100644 --- a/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/system/fvSchemes +++ b/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/system/fvSchemes @@ -52,10 +52,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/system/fvSolution b/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/system/fvSolution index c91fea86e..e231e3689 100644 --- a/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/system/fvSolution +++ b/tutorials/heatTransfer/boussinesqBuoyantFoam/heatedCavity/system/fvSolution @@ -16,9 +16,29 @@ FoamFile solvers { - p ICCG 1e-06 0; - U BICCG 1e-05 0; - T BICCG 1e-05 0; + p + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0; + } + + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; + } + + T + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; + } } PISO diff --git a/tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/Allclean b/tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/Allclean index 83fcec83e..93433055a 100755 --- a/tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/Allclean +++ b/tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/Allclean @@ -4,4 +4,5 @@ . $WM_PROJECT_DIR/bin/tools/CleanFunctions cleanCase +rm -f constant/polyMesh/boundary cp 0/T.org 0/T diff --git a/tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/system/fvSchemes index 83620fd7b..1bafd5c74 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqPisoFoam/hotRoom/system/fvSchemes @@ -34,7 +34,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/Allclean b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/Allclean index 83fcec83e..93433055a 100755 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/Allclean +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/Allclean @@ -4,4 +4,5 @@ . $WM_PROJECT_DIR/bin/tools/CleanFunctions cleanCase +rm -f constant/polyMesh/boundary cp 0/T.org 0/T diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes index 120dc9023..f34199123 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/system/fvSchemes @@ -34,7 +34,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/boundary b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/boundary index 2c17efa04..2d9d01dd7 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/boundary +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -15,43 +15,61 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -6 +9 ( maxY { type empty; - nFaces 400; - startFace 22800; + nFaces 0; + startFace 59065; } minX { type empty; - nFaces 400; - startFace 23200; + nFaces 0; + startFace 59065; } maxX { type empty; - nFaces 400; - startFace 23600; + nFaces 0; + startFace 59065; } minY { type empty; - nFaces 400; - startFace 24000; + nFaces 0; + startFace 59065; } ground { type wall; - nFaces 400; - startFace 24400; + nFaces 590; + startFace 59065; } maxZ { type empty; - nFaces 400; - startFace 24800; + nFaces 0; + startFace 59655; + } + igloo_region0 + { + type wall; + nFaces 2260; + startFace 59655; + } + twoFridgeFreezers_seal_0 + { + type wall; + nFaces 1344; + startFace 61915; + } + twoFridgeFreezers_herring_1 + { + type wall; + nFaces 1116; + startFace 63259; } ) diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes index 120dc9023..f34199123 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes @@ -34,7 +34,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPisoFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantPisoFoam/hotRoom/system/fvSchemes index fbd5c70cf..9832e1b35 100644 --- a/tutorials/heatTransfer/buoyantPisoFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantPisoFoam/hotRoom/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(phi,R) Gauss upwind; div(phiU,p) Gauss linear; div(R) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -59,10 +59,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/epsilon b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/epsilon index 8f61fdf4f..31bf6d6e0 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/epsilon +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/epsilon @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -24,27 +24,31 @@ boundaryField floor { type compressible::epsilonWallFunction; + refValue uniform 0; + value uniform 0.01; Cmu 0.09; kappa 0.41; E 9.8; - value uniform 0.01; } ceiling { type compressible::epsilonWallFunction; + refValue uniform 0; + value uniform 0.01; Cmu 0.09; kappa 0.41; E 9.8; - value uniform 0.01; } fixedWalls { type compressible::epsilonWallFunction; + refValue uniform 0; + value uniform 0.01; Cmu 0.09; kappa 0.41; E 9.8; - value uniform 0.01; } } + // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/k b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/k index 22b76a2b4..bf5caa993 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/k +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/0/k @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -38,4 +38,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSchemes index 096978d29..9f1a8cd96 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSchemes @@ -33,7 +33,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -57,10 +57,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/epsilon b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/epsilon index d60a224ed..7a8fa872c 100644 --- a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/epsilon +++ b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/epsilon @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -24,35 +24,40 @@ boundaryField box { type compressible::epsilonWallFunction; + refValue uniform 0; + value uniform 0.01; Cmu 0.09; kappa 0.41; E 9.8; - value uniform 0.01; } floor { type compressible::epsilonWallFunction; + refValue uniform 0; + value uniform 0.01; Cmu 0.09; kappa 0.41; E 9.8; - value uniform 0.01; } ceiling { type compressible::epsilonWallFunction; + refValue uniform 0; + value uniform 0.01; Cmu 0.09; kappa 0.41; E 9.8; - value uniform 0.01; } fixedWalls { type compressible::epsilonWallFunction; + refValue uniform 0; + value uniform 0.01; Cmu 0.09; kappa 0.41; E 9.8; - value uniform 0.01; } } + // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/k b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/k index 8c2bd1711..a52bacc9b 100644 --- a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/k +++ b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/k @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -43,4 +43,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/fvSchemes index fe8e1b62c..5c7b4c2dc 100644 --- a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/fvSchemes @@ -33,7 +33,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/fvSchemes index 5b4dda112..4560d748a 100644 --- a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(phi,R) Gauss upwind; div(R) Gauss linear; div(Ji,Ii_h) Gauss linearUpwind Gauss linear; //Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -60,10 +60,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOMSpecularCeiling/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOMSpecularCeiling/system/fvSchemes index 5b4dda112..4560d748a 100644 --- a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOMSpecularCeiling/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOMSpecularCeiling/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(phi,R) Gauss upwind; div(R) Gauss linear; div(Ji,Ii_h) Gauss linearUpwind Gauss linear; //Gauss upwind; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -60,10 +60,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes index cbdb5c43e..cf84871b7 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -61,10 +61,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/fvSchemes index dffa496fd..947c673e9 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -60,10 +60,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes index c45fbbe2f..ced621f2d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes @@ -45,9 +45,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/polyMesh/boundary b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/polyMesh/boundary index a5a1a2810..2c11571c2 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/polyMesh/boundary +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/fvSchemes index 994d37fa3..8819b4e9a 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -60,10 +60,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/fvSchemes index c4d92e41f..0e3d160c6 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/fvSchemes @@ -38,8 +38,4 @@ snGradSchemes { } -fluxRequired -{ -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/fvSchemes index c45fbbe2f..ced621f2d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/fvSchemes @@ -45,9 +45,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes index c45fbbe2f..ced621f2d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes @@ -45,9 +45,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes index c45fbbe2f..ced621f2d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes @@ -45,9 +45,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/fvSchemes index 994d37fa3..8819b4e9a 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -60,10 +60,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/fvSchemes index c4d92e41f..0e3d160c6 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/fvSchemes @@ -38,8 +38,4 @@ snGradSchemes { } -fluxRequired -{ -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/fvSchemes index 57b67d2f5..de7b6e7c8 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/fvSchemes @@ -45,9 +45,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; -} - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/topAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/topAir/fvSchemes index 9e51abb1e..c4b9fd122 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/topAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/topAir/fvSchemes @@ -34,7 +34,7 @@ divSchemes div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(R) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes @@ -58,10 +58,4 @@ snGradSchemes default limited 0.333; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // From c9fea670b6e3180b492bd54e7201ecfda21f716e Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Fri, 27 May 2016 22:07:30 +0200 Subject: [PATCH 12/26] Backported lagrangian solvers and tutorials (vanilla OF 3.0.1) --- .../lagrangian/coalChemistryFoam/UEqn.H | 2 +- .../coalChemistryFoam/coalChemistryFoam.C | 9 ++++++--- .../coalChemistryFoam/createFields.H | 2 ++ .../lagrangian/coalChemistryFoam/pEqn.H | 10 +++++----- .../UEqn.H | 2 +- .../createFields.H | 2 ++ .../pEqn.H | 13 +++---------- .../porousExplicitSourceReactingParcelFoam.C | 7 +++++-- .../lagrangian/reactingParcelFoam/UEqn.H | 2 +- .../reactingParcelFoam/createFields.H | 2 ++ .../lagrangian/reactingParcelFoam/pEqn.H | 10 +++++----- .../reactingParcelFoam/reactingParcelFoam.C | 9 ++++++--- .../simplifiedSiwek/constant/polyMesh/boundary | 4 ++-- .../simplifiedSiwek/system/fvSchemes | 8 +------- .../simplifiedSiwek/system/fvSolution | 2 +- .../constant/polyMesh/boundary | 5 ++--- .../channelParticles/system/fvSchemes | 6 ------ .../icoLagrangianFoam/createFields.H | 2 ++ .../icoLagrangianFoam/icoLagrangianFoam.C | 11 +++++++---- .../filter/Allclean | 2 +- .../filter/constant/polyMesh/boundary | 18 +++++++++--------- .../filter/system/fvSchemes | 8 +------- .../parcelInBox/0/G | 4 ++++ .../parcelInBox/0/H2O | 4 ++++ .../parcelInBox/0/T | 4 ++++ .../parcelInBox/0/U | 4 ++++ .../parcelInBox/0/air | 4 ++++ .../parcelInBox/0/p | 4 ++++ .../parcelInBox/constant/polyMesh/boundary | 4 ++-- .../parcelInBox/system/fvSchemes | 8 +------- .../verticalChannel/system/fvSchemes | 8 +------- .../evaporationTest/constant/polyMesh/boundary | 4 ++-- .../evaporationTest/system/fvSchemes | 8 +------- .../evaporationTest/system/fvSolution | 2 +- .../rhoPisoTwinParcelFoam/UEqn.H | 2 +- .../rhoPisoTwinParcelFoam/createFields.H | 2 ++ .../rhoPisoTwinParcelFoam/pEqn.H | 10 +++++----- .../rhoPisoTwinParcelFoam.C | 12 +++++++----- .../simplifiedSiwek/constant/polyMesh/boundary | 4 ++-- .../simplifiedSiwek/system/fvSchemes | 8 +------- .../simplifiedSiwek/system/fvSolution | 2 +- 41 files changed, 116 insertions(+), 118 deletions(-) diff --git a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H index b02a7c61e..deb710cce 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H @@ -11,7 +11,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 4d031e521..570327101 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -44,6 +44,7 @@ Description #include "chemistrySolver.H" #include "timeActivatedExplicitSource.H" #include "radiationModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,6 +54,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" + + pimpleControl pimple(mesh); + #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" @@ -70,7 +74,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -89,14 +92,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- PIMPLE loop - for (int ocorr=1; ocorr<=nOuterCorr; ocorr++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H index 65be09775..12a6e9548 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H @@ -149,3 +149,5 @@ mesh, dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H index b31ad45ed..9878707eb 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rUA = 1.0/UEqn.A(); U = rUA*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -28,7 +28,7 @@ if (transonic) pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -43,7 +43,7 @@ else + fvc::ddtPhiCorr(rUA, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -56,7 +56,7 @@ else pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H index e77fe75da..f46d1d902 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H @@ -12,7 +12,7 @@ pZones.addResistance(UEqn); - if (momentumPredictor) + if (piso.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H index cf3f484bd..7a5b48ac9 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H @@ -103,3 +103,5 @@ mesh, dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H index 43d677609..ff590e59e 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H @@ -23,7 +23,7 @@ ); } - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -35,16 +35,9 @@ + massSource.SuTot() ); - if (corr == nCorr-1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solutionDict().solver("pFinal")); - } - else - { - pEqn.solve(); - } + pEqn.solve(mesh.solutionDict().solver(p.select(piso.finalInnerIter()))); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C index de63f2fbb..68ef32448 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C @@ -49,6 +49,7 @@ Description #include "radiationModel.H" #include "porousZones.H" #include "timeActivatedExplicitSource.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,6 +59,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" + + pisoControl piso(mesh); + #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" @@ -77,7 +81,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "readAdditionalSolutionControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -95,7 +98,7 @@ int main(int argc, char *argv[]) #include "hsEqn.H" // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H index 3c4a92709..1c1c1fd0c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H @@ -10,7 +10,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H index e071ac8b3..9579be78c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H @@ -109,3 +109,5 @@ mesh, dimensionedScalar("chemistry::Sh", dimEnergy/dimTime/dimVolume, 0.0) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index d27afcce8..50185f5fc 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rUA = 1.0/UEqn.A(); U = rUA*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -28,7 +28,7 @@ if (transonic) pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -43,7 +43,7 @@ else + fvc::ddtPhiCorr(rUA, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -56,7 +56,7 @@ else pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index 154774cca..93971a15b 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -37,6 +37,7 @@ Description #include "psiChemistryModel.H" #include "chemistrySolver.H" #include "radiationModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,6 +47,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" + + pimpleControl pimple(mesh); + #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" @@ -63,7 +67,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -77,13 +80,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- PIMPLE loop - for (int ocorr=1; ocorr<=nOuterCorr; ocorr++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + while (pimple.correct()) { #include "hsEqn.H" #include "pEqn.H" diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/polyMesh/boundary b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/polyMesh/boundary index dff7e8226..eedf0fdb7 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/polyMesh/boundary +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes index c538134fd..d98d660a2 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(U) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(phi,Yi_h) Gauss upwind; } @@ -62,10 +62,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution index e48e0f6b4..d459df935 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution @@ -50,7 +50,7 @@ solvers } } -PISO +PIMPLE { transonic yes; nCorrectors 2; diff --git a/tutorials/lagrangian/icoLagrangianFoam/channelParticles/constant/polyMesh/boundary b/tutorials/lagrangian/icoLagrangianFoam/channelParticles/constant/polyMesh/boundary index 0beee5a65..8e0826950 100644 --- a/tutorials/lagrangian/icoLagrangianFoam/channelParticles/constant/polyMesh/boundary +++ b/tutorials/lagrangian/icoLagrangianFoam/channelParticles/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -38,7 +38,6 @@ FoamFile frontAndBack { type empty; - physicalType empty; nFaces 2000; startFace 2110; } diff --git a/tutorials/lagrangian/icoLagrangianFoam/channelParticles/system/fvSchemes b/tutorials/lagrangian/icoLagrangianFoam/channelParticles/system/fvSchemes index 277df7d18..e807e470c 100644 --- a/tutorials/lagrangian/icoLagrangianFoam/channelParticles/system/fvSchemes +++ b/tutorials/lagrangian/icoLagrangianFoam/channelParticles/system/fvSchemes @@ -49,10 +49,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/createFields.H b/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/createFields.H index 794eb514b..54c52cb09 100644 --- a/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/createFields.H +++ b/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/createFields.H @@ -53,6 +53,8 @@ label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + mesh.schemesDict().setFluxRequired(p.name()); + dimensionedScalar rhoVal ( transportProperties.lookup("rho") diff --git a/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/icoLagrangianFoam.C b/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/icoLagrangianFoam.C index 34efa82f2..36f4462a0 100644 --- a/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/icoLagrangianFoam.C +++ b/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/icoLagrangianFoam.C @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "pisoControl.H" #include "basicKinematicCloud.H" @@ -42,6 +43,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pisoControl piso(mesh); + # include "createFields.H" # include "initContinuityErrs.H" @@ -53,7 +57,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPISOControls.H" # include "CourantNo.H" Info<< "Evolving kinematicCloud" << endl; @@ -73,7 +76,7 @@ int main(int argc, char *argv[]) // --- PISO loop - for (int corr=0; corr Date: Sat, 28 May 2016 04:11:10 +0200 Subject: [PATCH 13/26] Backported multiphase solvers and tutorials (vanilla OF 3.0.1) --- .../multiphase/MRFInterFoam/MRFInterFoam.C | 13 +++--- .../solvers/multiphase/MRFInterFoam/UEqn.H | 2 +- .../solvers/multiphase/MRFInterFoam/pEqn.H | 16 +++---- .../barotropicCavitatingFoam.C | 7 ++- .../barotropicCavitatingFoam/createFields.H | 2 + .../barotropicCavitatingFoam/pEqn.H | 4 +- .../multiphase/bubbleFoam/bubbleFoam.C | 6 ++- .../multiphase/bubbleFoam/createFields.H | 3 +- .../solvers/multiphase/bubbleFoam/pEqn.H | 4 +- .../bubbleFoam/readBubbleFoamControls.H | 6 +-- .../solvers/multiphase/cavitatingFoam/UEqn.H | 2 +- .../cavitatingFoam/cavitatingFoam.C | 9 ++-- .../multiphase/cavitatingFoam/createFields.H | 3 ++ .../solvers/multiphase/cavitatingFoam/pEqn.H | 22 ++++------ .../multiphase/cavitatingFoam/readControls.H | 2 - .../compressibleInterDyMFoam/UEqn.H | 2 +- .../alphaEqnsSubCycle.H | 6 +-- .../compressibleInterDyMFoam.C | 8 +++- .../compressibleInterDyMFoam/correctPhi.H | 4 +- .../compressibleInterDyMFoam/createControls.H | 43 +++++++++---------- .../compressibleInterDyMFoam/createFields.H | 2 + .../compressibleInterDyMFoam/pEqn.H | 13 ++---- .../compressibleInterDyMFoam/readControls.H | 31 +++++-------- .../multiphase/compressibleInterFoam/UEqn.H | 2 +- .../compressibleInterFoam/alphaEqnsSubCycle.H | 6 +-- .../compressibleInterFoam.C | 9 ++-- .../compressibleInterFoam/createControls.H | 25 ++++++----- .../compressibleInterFoam/createFields.H | 2 + .../multiphase/compressibleInterFoam/pEqn.H | 6 +-- .../compressibleInterFoam/readControls.H | 19 ++++---- .../multiphase/interDyMFoam/correctPhi.H | 4 +- .../multiphase/interDyMFoam/createControls.H | 20 ++++----- .../multiphase/interDyMFoam/createFields.H | 14 ++---- .../multiphase/interDyMFoam/interDyMFoam.C | 12 +++--- .../solvers/multiphase/interDyMFoam/pEqn.H | 16 +++---- .../multiphase/interDyMFoam/readControls.H | 15 ++----- .../solvers/multiphase/interFoam/UEqn.H | 2 +- .../multiphase/interFoam/alphaEqnSubCycle.H | 4 +- .../solvers/multiphase/interFoam/correctPhi.H | 4 +- .../multiphase/interFoam/createFields.H | 14 ++---- .../solvers/multiphase/interFoam/interFoam.C | 13 +++--- .../solvers/multiphase/interFoam/pEqn.H | 16 +++---- .../interMixingFoam/alphaEqnsSubCycle.H | 4 +- .../multiphase/interMixingFoam/createFields.H | 10 ++--- .../interMixingFoam/interMixingFoam.C | 8 ++-- .../threePhaseInterfaceProperties.C | 2 +- .../multiphase/interPhaseChangeFoam/UEqn.H | 2 +- .../interPhaseChangeFoam/alphaEqnSubCycle.H | 6 +-- .../interPhaseChangeFoam/correctPhi.H | 4 +- .../interPhaseChangeFoam/createFields.H | 8 ++-- .../interPhaseChangeFoam.C | 10 +++-- .../multiphase/interPhaseChangeFoam/pEqn.H | 16 +++---- .../multiphaseInterFoam/createFields.H | 8 ++-- .../multiphaseInterFoam/multiphaseInterFoam.C | 8 ++-- .../multiphaseMixture/multiphaseMixture.C | 8 ++-- .../multiphase/multiphaseInterFoam/pEqn.H | 16 +++---- .../solvers/multiphase/porousInterFoam/UEqn.H | 2 +- .../porousInterFoam/porousInterFoam.C | 13 +++--- .../solvers/multiphase/settlingFoam/UEqn.H | 2 +- .../settlingFoam/compressibleContinuityErrs.H | 4 +- .../multiphase/settlingFoam/createFields.H | 4 +- .../solvers/multiphase/settlingFoam/pEqn.H | 4 +- .../multiphase/settlingFoam/settlingFoam.C | 9 ++-- .../multiphase/twoLiquidMixingFoam/UEqn.H | 23 +++------- .../twoLiquidMixingFoam/createFields.H | 14 ++---- .../multiphase/twoLiquidMixingFoam/p_rghEqn.H | 10 ++--- .../twoLiquidMixingFoam/twoLiquidMixingFoam.C | 10 +++-- .../twoPhaseEulerFoam/createFields.H | 3 +- .../multiphase/twoPhaseEulerFoam/pEqn.H | 4 +- .../readTwoPhaseEulerFoamControls.H | 5 +-- .../twoPhaseEulerFoam/twoPhaseEulerFoam.C | 8 +++- .../mixerVessel2D/system/fvSchemes | 8 ---- .../nozzle/system/fvSchemes | 5 --- .../bubbleFoam/bubbleColumn/system/fvSchemes | 6 --- .../les/throttle/system/fvSchemes | 7 --- .../les/throttle/system/fvSolution | 6 +-- .../les/throttle3D/system/fvSchemes | 7 --- .../les/throttle3D/system/fvSolution | 6 +-- .../ras/throttle/system/fvSchemes | 7 --- .../ras/throttle/system/fvSolution | 5 +-- .../les/depthCharge2D/system/fvSchemes | 8 ---- .../les/depthCharge2D/system/fvSolution | 6 ++- .../les/depthCharge3D/system/fvSchemes | 8 ---- .../les/depthCharge3D/system/fvSolution | 6 ++- .../ras/damBreakWithObstacle/system/fvSchemes | 8 ---- .../system/setSubset/fvSchemes | 8 ---- .../ras/floatingObject/system/fvSchemes | 8 ---- .../floatingObject/system/setSubset/fvSchemes | 8 ---- .../ras/sloshingTank2D/system/fvSchemes | 8 ---- .../ras/sloshingTank2D3DoF/system/fvSchemes | 8 ---- .../ras/sloshingTank3D/system/fvSchemes | 8 ---- .../ras/sloshingTank3D3DoF/system/fvSchemes | 8 ---- .../ras/sloshingTank3D6DoF/system/fvSchemes | 8 ---- .../laminar/damBreak/system/fvSchemes | 8 ---- .../les/nozzleFlow2D/system/fvSchemes | 8 ---- .../interFoam/ras/damBreak/system/fvSchemes | 8 ---- .../laminar/damBreak/system/fvSchemes | 8 ---- .../laminar/damBreak/system/fvSolution | 2 +- .../laminar/damBreak4phase/system/fvSolution | 2 +- .../damBreak4phaseFine/system/fvSolution | 2 +- .../settlingFoam/dahl/system/fvSchemes | 6 --- .../settlingFoam/dahl/system/fvSolution | 2 +- .../settlingFoam/tank3D/system/fvSchemes | 6 --- .../settlingFoam/tank3D/system/fvSolution | 2 +- .../twoPhaseEulerFoam/bed/system/fvSchemes | 6 --- .../twoPhaseEulerFoam/bed2/system/fvSchemes | 6 --- .../bubbleColumn/system/fvSchemes | 6 --- 107 files changed, 310 insertions(+), 557 deletions(-) diff --git a/applications/solvers/multiphase/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/MRFInterFoam/MRFInterFoam.C index d4374d687..d2dec21ac 100644 --- a/applications/solvers/multiphase/MRFInterFoam/MRFInterFoam.C +++ b/applications/solvers/multiphase/MRFInterFoam/MRFInterFoam.C @@ -43,6 +43,7 @@ Description #include "twoPhaseMixture.H" #include "turbulenceModel.H" #include "MRFZones.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,8 +52,10 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" + + pimpleControl pimple(mesh); + #include "readGravitationalAcceleration.H" - #include "readPIMPLEControls.H" #include "initContinuityErrs.H" #include "createFields.H" #include "createMRFZones.H" @@ -67,7 +70,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "readPIMPLEControls.H" #include "readTimeControls.H" #include "CourantNo.H" #include "setDeltaT.H" @@ -77,8 +79,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // Pressure-velocity corrector - int oCorr = 0; - do + while (pimple.loop()) { twoPhaseProperties.correct(); @@ -87,7 +88,7 @@ int main(int argc, char *argv[]) # include "UEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); - } while (++oCorr < nOuterCorr); + } runTime.write(); diff --git a/applications/solvers/multiphase/MRFInterFoam/UEqn.H b/applications/solvers/multiphase/MRFInterFoam/UEqn.H index 0a65664f7..cc0763d8b 100644 --- a/applications/solvers/multiphase/MRFInterFoam/UEqn.H +++ b/applications/solvers/multiphase/MRFInterFoam/UEqn.H @@ -17,7 +17,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve ( diff --git a/applications/solvers/multiphase/MRFInterFoam/pEqn.H b/applications/solvers/multiphase/MRFInterFoam/pEqn.H index b52c7441c..49d6dc579 100644 --- a/applications/solvers/multiphase/MRFInterFoam/pEqn.H +++ b/applications/solvers/multiphase/MRFInterFoam/pEqn.H @@ -20,7 +20,7 @@ )*rUAf; adjustPhi(phi, U, p); - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pdEqn ( @@ -29,16 +29,12 @@ pdEqn.setReference(pdRefCell, pdRefValue); - if (corr == nCorr-1 && nonOrth == nNonOrthCorr) - { - pdEqn.solve(mesh.solutionDict().solver(pd.name() + "Final")); - } - else - { - pdEqn.solve(mesh.solutionDict().solver(pd.name())); - } + pdEqn.solve + ( + mesh.solutionDict().solver(pd.select(pimple.finalInnerIter())) + ); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi -= pdEqn.flux(); } diff --git a/applications/solvers/multiphase/barotropicCavitatingFoam/barotropicCavitatingFoam.C b/applications/solvers/multiphase/barotropicCavitatingFoam/barotropicCavitatingFoam.C index 4d04b5c36..ac37acbbe 100644 --- a/applications/solvers/multiphase/barotropicCavitatingFoam/barotropicCavitatingFoam.C +++ b/applications/solvers/multiphase/barotropicCavitatingFoam/barotropicCavitatingFoam.C @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -40,7 +41,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" -# include "readPISOControls.H" + + pisoControl piso(mesh); + # include "readThermodynamicProperties.H" # include "readTransportProperties.H" # include "createFields.H" @@ -61,7 +64,7 @@ int main(int argc, char *argv[]) # include "UEqn.H" // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { # include "pEqn.H" } diff --git a/applications/solvers/multiphase/barotropicCavitatingFoam/createFields.H b/applications/solvers/multiphase/barotropicCavitatingFoam/createFields.H index 1286f1d6f..835fa2cfa 100644 --- a/applications/solvers/multiphase/barotropicCavitatingFoam/createFields.H +++ b/applications/solvers/multiphase/barotropicCavitatingFoam/createFields.H @@ -75,3 +75,5 @@ ), (gamma*psig + (1.0 - gamma)*psil)/rho ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/multiphase/barotropicCavitatingFoam/pEqn.H b/applications/solvers/multiphase/barotropicCavitatingFoam/pEqn.H index 84f5f0910..cc5e701d2 100644 --- a/applications/solvers/multiphase/barotropicCavitatingFoam/pEqn.H +++ b/applications/solvers/multiphase/barotropicCavitatingFoam/pEqn.H @@ -15,7 +15,7 @@ surfaceScalarField phip = fvc::interpolate(psiByRho)*phi; - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -29,7 +29,7 @@ + fvc::div(phi) - pEqn ); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C index e77fd4a81..1104be238 100644 --- a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C +++ b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C @@ -34,6 +34,7 @@ Description #include "nearWallDist.H" #include "wallFvPatch.H" #include "Switch.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,6 +44,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pisoControl piso(mesh); + # include "readGravitationalAcceleration.H" # include "createFields.H" # include "initContinuityErrs.H" @@ -64,7 +68,7 @@ int main(int argc, char *argv[]) // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { # include "pEqn.H" diff --git a/applications/solvers/multiphase/bubbleFoam/createFields.H b/applications/solvers/multiphase/bubbleFoam/createFields.H index 875a4f1be..26013f9f4 100644 --- a/applications/solvers/multiphase/bubbleFoam/createFields.H +++ b/applications/solvers/multiphase/bubbleFoam/createFields.H @@ -178,4 +178,5 @@ label pRefCell = 0; scalar pRefValue = 0.0; - setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + setRefCell(p, piso.dict(), pRefCell, pRefValue); + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/multiphase/bubbleFoam/pEqn.H b/applications/solvers/multiphase/bubbleFoam/pEqn.H index dde9a0857..98a3ca381 100644 --- a/applications/solvers/multiphase/bubbleFoam/pEqn.H +++ b/applications/solvers/multiphase/bubbleFoam/pEqn.H @@ -38,7 +38,7 @@ alphaf*rUaAf/rhoa + betaf*rUbAf/rhob ); - for(int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -48,7 +48,7 @@ pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { surfaceScalarField SfGradp = pEqn.flux()/Dp; diff --git a/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H b/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H index bf70e2bab..05bf3c6eb 100644 --- a/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H +++ b/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H @@ -1,5 +1,3 @@ -# include "readPISOControls.H" + int nAlphaCorr(readInt(piso.dict().lookup("nAlphaCorr"))); - int nAlphaCorr(readInt(piso.lookup("nAlphaCorr"))); - - Switch correctAlpha(piso.lookup("correctAlpha")); + Switch correctAlpha(piso.dict().lookup("correctAlpha")); diff --git a/applications/solvers/multiphase/cavitatingFoam/UEqn.H b/applications/solvers/multiphase/cavitatingFoam/UEqn.H index 01911faaa..9a5761b59 100644 --- a/applications/solvers/multiphase/cavitatingFoam/UEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/UEqn.H @@ -16,7 +16,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C index ff40c6ade..d2d293a78 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C @@ -36,6 +36,7 @@ Description #include "barotropicCompressibilityModel.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,10 +46,12 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "readThermodynamicProperties.H" # include "createControls.H" # include "createFields.H" -# include "initContinuityErrs.H" # include "compressibleCourantNo.H" # include "setInitialDeltaT.H" @@ -65,13 +68,13 @@ int main(int argc, char *argv[]) runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; - for (int outerCorr = 0; outerCorr < nOuterCorr; outerCorr++) + while (pimple.loop()) { # include "rhoEqn.H" # include "gammaPsi.H" # include "UEqn.H" - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { # include "pEqn.H" } diff --git a/applications/solvers/multiphase/cavitatingFoam/createFields.H b/applications/solvers/multiphase/cavitatingFoam/createFields.H index 49c7de147..26835d1f5 100644 --- a/applications/solvers/multiphase/cavitatingFoam/createFields.H +++ b/applications/solvers/multiphase/cavitatingFoam/createFields.H @@ -83,3 +83,6 @@ ( incompressible::turbulenceModel::New(U, phiv, twoPhaseProperties) ); + + mesh.schemesDict().setFluxRequired(p.name()); + mesh.schemesDict().setFluxRequired(rho.name()); diff --git a/applications/solvers/multiphase/cavitatingFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/pEqn.H index f943f11bc..5551f303f 100644 --- a/applications/solvers/multiphase/cavitatingFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/pEqn.H @@ -1,5 +1,5 @@ { - if (nOuterCorr == 1) + if (pimple.firstIter()) { p = ( @@ -26,7 +26,7 @@ # include "resetPhivPatches.H" - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -37,16 +37,12 @@ - fvm::laplacian(rUAf, p) ); - if (corr == nCorr - 1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solutionDict().solver(p.name() + "Final")); - } - else - { - pEqn.solve(mesh.solutionDict().solver(p.name())); - } + pEqn.solve + ( + mesh.solutionDict().solver(p.select(pimple.finalInnerIter())) + ); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phiv += (phiGradp + pEqn.flux())/rhof; } @@ -82,9 +78,9 @@ U = HbyA - rUA*fvc::grad(p); // Remove the swirl component of velocity for "wedge" cases - if (piso.found("removeSwirl")) + if (pimple.dict().found("removeSwirl")) { - label swirlCmpt(readLabel(piso.lookup("removeSwirl"))); + label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl"))); Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl; U.field().replace(swirlCmpt, 0.0); diff --git a/applications/solvers/multiphase/cavitatingFoam/readControls.H b/applications/solvers/multiphase/cavitatingFoam/readControls.H index d4206bef4..a2d4dc80a 100644 --- a/applications/solvers/multiphase/cavitatingFoam/readControls.H +++ b/applications/solvers/multiphase/cavitatingFoam/readControls.H @@ -1,5 +1,3 @@ #include "readTimeControls.H" maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo")); - -#include "readPISOControls.H" diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H b/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H index 138e58fc7..4f77867f8 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H @@ -16,7 +16,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve ( diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H index 32a716313..5371c5b85 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H @@ -1,12 +1,12 @@ { label nAlphaCorr ( - readLabel(piso.lookup("nAlphaCorr")) + readLabel(pimple.dict().lookup("nAlphaCorr")) ); label nAlphaSubCycles ( - readLabel(piso.lookup("nAlphaSubCycles")) + readLabel(pimple.dict().lookup("nAlphaSubCycles")) ); surfaceScalarField phic = mag(phi/mesh.magSf()); @@ -38,7 +38,7 @@ # include "alphaEqns.H" } - if (oCorr == 0) + if (pimple.firstIter()) { interface.correct(); } diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterDyMFoam/compressibleInterDyMFoam.C index 515d3c89f..e4464c475 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -43,6 +43,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,6 +52,9 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createDynamicFvMesh.H" + + pimpleControl pimple(mesh); + #include "readGravitationalAcceleration.H" #include "createControls.H" #include "initContinuityErrs.H" @@ -101,7 +105,7 @@ int main(int argc, char *argv[]) turbulence->correct(); // --- Outer-corrector loop - for (int oCorr=0; oCorr 1 && nOuterCorr != 1) - { - FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO, " - "i.e. when the number of outer-correctors = 1" - << exit(FatalError); - } +if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) +{ + FatalErrorIn(args.executable()) + << "Sub-cycling alpha is only allowed for PISO, " + "i.e. when the number of outer-correctors = 1" + << exit(FatalError); +} - bool correctPhi = true; - if (piso.found("correctPhi")) - { - correctPhi = Switch(piso.lookup("correctPhi")); - } +bool correctPhi +( + pimple.dict().lookupOrDefault("correctPhi", true) +); - bool checkMeshCourantNo = false; - if (piso.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo")); - } +bool checkMeshCourantNo +( + pimple.dict().lookupOrDefault("checkMeshCourantNo", false) +); diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/createFields.H b/applications/solvers/multiphase/compressibleInterDyMFoam/createFields.H index 3da1b5e9c..a2f5fd0a8 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/createFields.H @@ -142,3 +142,5 @@ pcorrTypes[i] = fixedValueFvPatchScalarField::typeName; } } + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H index 56e1e6baa..df30525d3 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H @@ -4,7 +4,7 @@ tmp pEqnComp; - if (transonic) + if (pimple.transonic()) { pEqnComp = (fvm::ddt(p) + fvm::div(phi, p) - fvm::Sp(fvc::div(phi), p)); @@ -31,7 +31,7 @@ + fvc::interpolate(rho)*(g & mesh.Sf()) )*rUAf; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqnIncomp ( @@ -39,12 +39,7 @@ - fvm::laplacian(rUAf, p) ); - if - ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) + if (pimple.finalInnerIter()) { solve ( @@ -70,7 +65,7 @@ ); } - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { dgdt = (pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1)) diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H b/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H index bd209aef2..703827d6d 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H @@ -1,24 +1,15 @@ - #include "readPISOControls.H" - #include "readTimeControls.H" +#include "readTimeControls.H" - nAlphaSubCycles = readLabel(piso.lookup("nAlphaSubCycles")); +nAlphaSubCycles = readLabel(pimple.dict().lookup("nAlphaSubCycles")); - if (nAlphaSubCycles > 1 && nOuterCorr != 1) - { - FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO, " - "i.e. when the number of outer-correctors = 1" - << exit(FatalError); - } +if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) +{ + FatalErrorIn(args.executable()) + << "Sub-cycling alpha is only allowed for PISO, " + "i.e. when the number of outer-correctors = 1" + << exit(FatalError); +} - correctPhi = true; - if (piso.found("correctPhi")) - { - correctPhi = Switch(piso.lookup("correctPhi")); - } +correctPhi = pimple.dict().lookupOrDefault("correctPhi", true); - checkMeshCourantNo = false; - if (piso.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo")); - } +checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H index 0b1a9ac02..7ec0ef309 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H @@ -16,7 +16,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve ( diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H index 89ba7a4e7..d57b8cd6e 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H @@ -1,12 +1,12 @@ { label nAlphaCorr ( - readLabel(piso.lookup("nAlphaCorr")) + readLabel(pimple.dict().lookup("nAlphaCorr")) ); label nAlphaSubCycles ( - readLabel(piso.lookup("nAlphaSubCycles")) + readLabel(pimple.dict().lookup("nAlphaSubCycles")) ); surfaceScalarField phic = mag(phi/mesh.magSf()); @@ -36,7 +36,7 @@ #include "alphaEqns.H" } - if (oCorr == 0) + if (pimple.firstIter()) { interface.correct(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 2469bda8c..1fb006e6c 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -41,6 +41,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,9 +50,11 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" + + pimpleControl pimple(mesh); + #include "readGravitationalAcceleration.H" #include "createControls.H" - #include "initContinuityErrs.H" #include "createFields.H" #include "CourantNo.H" #include "setInitialDeltaT.H" @@ -71,7 +74,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Outer-corrector loop - for (int oCorr=0; oCorr 1 && nOuterCorr != 1) - { - FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO, " - "i.e. when the number of outer-correctors = 1" - << exit(FatalError); - } +if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) +{ + FatalErrorIn(args.executable()) + << "Sub-cycling alpha is only allowed for PISO, " + "i.e. when the number of outer-correctors = 1" + << exit(FatalError); +} diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index 3e6904d38..555d86782 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -127,3 +127,5 @@ ( incompressible::turbulenceModel::New(U, phi, twoPhaseProperties) ); + + mesh.schemesDict().setFluxRequired(p.name()); \ No newline at end of file diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index 9d2dc2391..f80200538 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -4,7 +4,7 @@ tmp pEqnComp; - if (transonic) + if (pimple.transonic()) { pEqnComp = (fvm::ddt(p) + fvm::div(phi, p) - fvm::Sp(fvc::div(phi), p)); @@ -30,7 +30,7 @@ + fvc::interpolate(rho)*(g & mesh.Sf()) )*rUAf; - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqnIncomp ( @@ -48,7 +48,7 @@ + pEqnIncomp ); - if (nonOrth == 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 10af30422..f5a1e5675 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/readControls.H @@ -1,12 +1,11 @@ - #include "readPISOControls.H" - #include "readTimeControls.H" +#include "readTimeControls.H" - nAlphaSubCycles = readLabel(piso.lookup("nAlphaSubCycles")); +nAlphaSubCycles = readLabel(pimple.dict().lookup("nAlphaSubCycles")); - if (nAlphaSubCycles > 1 && nOuterCorr != 1) - { - FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO, " - "i.e. when the number of outer-correctors = 1" - << exit(FatalError); - } +if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) +{ + FatalErrorIn(args.executable()) + << "Sub-cycling alpha is only allowed for PISO, " + "i.e. when the number of outer-correctors = 1" + << exit(FatalError); +} diff --git a/applications/solvers/multiphase/interDyMFoam/correctPhi.H b/applications/solvers/multiphase/interDyMFoam/correctPhi.H index 78a616422..3fb0cadf7 100644 --- a/applications/solvers/multiphase/interDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/interDyMFoam/correctPhi.H @@ -29,7 +29,7 @@ mesh.schemesDict().setFluxRequired(pcorr.name()); - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( @@ -39,7 +39,7 @@ pcorrEqn.setReference(pdRefCell, pdRefValue); pcorrEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/multiphase/interDyMFoam/createControls.H b/applications/solvers/multiphase/interDyMFoam/createControls.H index b52e0509a..4c888d9e3 100644 --- a/applications/solvers/multiphase/interDyMFoam/createControls.H +++ b/applications/solvers/multiphase/interDyMFoam/createControls.H @@ -1,13 +1,11 @@ -# include "createTimeControls.H" +#include "createTimeControls.H" - bool correctPhi = true; - if (pimple.found("correctPhi")) - { - correctPhi = Switch(pimple.lookup("correctPhi")); - } +bool correctPhi +( + pimple.dict().lookupOrDefault("correctPhi", true) +); - bool checkMeshCourantNo = false; - if (pimple.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo")); - } +bool checkMeshCourantNo +( + pimple.dict().lookupOrDefault("checkMeshCourantNo", false) +); diff --git a/applications/solvers/multiphase/interDyMFoam/createFields.H b/applications/solvers/multiphase/interDyMFoam/createFields.H index 9ecfc062e..9b66f9ea7 100644 --- a/applications/solvers/multiphase/interDyMFoam/createFields.H +++ b/applications/solvers/multiphase/interDyMFoam/createFields.H @@ -123,22 +123,14 @@ label pdRefCell = 0; scalar pdRefValue = 0.0; - setRefCell - ( - pd, - mesh.solutionDict().subDict("PIMPLE"), - pdRefCell, - pdRefValue - ); + setRefCell(pd, pimple.dict(), pdRefCell, pdRefValue); + mesh.schemesDict().setFluxRequired(pd.name()); scalar pRefValue = 0.0; if (pd.needReference()) { - pRefValue = readScalar - ( - mesh.solutionDict().subDict("PIMPLE").lookup("pRefValue") - ); + pRefValue = readScalar(pimple.dict().lookup("pRefValue")); p += dimensionedScalar ( diff --git a/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C index 6315063a9..9bf398609 100644 --- a/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C @@ -39,6 +39,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,8 +48,10 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createDynamicFvMesh.H" + + pimpleControl pimple(mesh); + # include "readGravitationalAcceleration.H" -# include "readPIMPLEControls.H" # include "initContinuityErrs.H" # include "createFields.H" # include "createControls.H" @@ -96,8 +99,7 @@ int main(int argc, char *argv[]) } // Pressure-velocity corrector - int oCorr = 0; - do + while (pimple.loop()) { twoPhaseProperties.correct(); @@ -106,7 +108,7 @@ int main(int argc, char *argv[]) # include "UEqn.H" // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { # include "pEqn.H" } @@ -124,7 +126,7 @@ int main(int argc, char *argv[]) } turbulence->correct(); - } while (++oCorr < nOuterCorr); + } runTime.write(); diff --git a/applications/solvers/multiphase/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interDyMFoam/pEqn.H index 9654dcdb5..e2dea922e 100644 --- a/applications/solvers/multiphase/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interDyMFoam/pEqn.H @@ -17,7 +17,7 @@ )*rAUf*mesh.magSf(); - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pdEqn ( @@ -26,16 +26,12 @@ pdEqn.setReference(pdRefCell, pdRefValue); - if (corr == nCorr - 1 && nonOrth == nNonOrthCorr) - { - pdEqn.solve(mesh.solutionDict().solver(pd.name() + "Final")); - } - else - { - pdEqn.solve(mesh.solutionDict().solver(pd.name())); - } + pdEqn.solve + ( + mesh.solutionDict().solver(pd.select(pimple.finalInnerIter())) + ); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi -= pdEqn.flux(); } diff --git a/applications/solvers/multiphase/interDyMFoam/readControls.H b/applications/solvers/multiphase/interDyMFoam/readControls.H index b3b4512c3..f79b9c91b 100644 --- a/applications/solvers/multiphase/interDyMFoam/readControls.H +++ b/applications/solvers/multiphase/interDyMFoam/readControls.H @@ -1,14 +1,5 @@ -# include "readTimeControls.H" -# include "readPIMPLEControls.H" +#include "readTimeControls.H" - correctPhi = true; - if (pimple.found("correctPhi")) - { - correctPhi = Switch(pimple.lookup("correctPhi")); - } +correctPhi = pimple.dict().lookupOrDefault("correctPhi", true); - checkMeshCourantNo = false; - if (pimple.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo")); - } +checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/multiphase/interFoam/UEqn.H b/applications/solvers/multiphase/interFoam/UEqn.H index 85972af16..5acb7a6ec 100644 --- a/applications/solvers/multiphase/interFoam/UEqn.H +++ b/applications/solvers/multiphase/interFoam/UEqn.H @@ -16,7 +16,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve ( diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H index fcd2848a4..30e11b4b8 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H @@ -1,11 +1,11 @@ label nAlphaCorr ( - readLabel(pimple.lookup("nAlphaCorr")) + readLabel(pimple.dict().lookup("nAlphaCorr")) ); label nAlphaSubCycles ( - readLabel(pimple.lookup("nAlphaSubCycles")) + readLabel(pimple.dict().lookup("nAlphaSubCycles")) ); if (nAlphaSubCycles > 1) diff --git a/applications/solvers/multiphase/interFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/correctPhi.H index a1cb1bf0a..ec9c54ab4 100644 --- a/applications/solvers/multiphase/interFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/correctPhi.H @@ -36,7 +36,7 @@ mesh.schemesDict().setFluxRequired(pcorr.name()); - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( @@ -46,7 +46,7 @@ pcorrEqn.setReference(pdRefCell, pdRefValue); pcorrEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index 8012f798c..db7217a14 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -103,22 +103,14 @@ label pdRefCell = 0; scalar pdRefValue = 0.0; - setRefCell - ( - pd, - mesh.solutionDict().subDict("PIMPLE"), - pdRefCell, - pdRefValue - ); + setRefCell(pd, pimple.dict(), pdRefCell, pdRefValue); + mesh.schemesDict().setFluxRequired(pd.name()); scalar pRefValue = 0.0; if (pd.needReference()) { - pRefValue = readScalar - ( - mesh.solutionDict().subDict("PIMPLE").lookup("pRefValue") - ); + pRefValue = readScalar(pimple.dict().lookup("pRefValue")); p += dimensionedScalar ( diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index c5bdc49ea..b0b136c23 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -43,6 +43,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,8 +52,10 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "readGravitationalAcceleration.H" -# include "readPIMPLEControls.H" # include "initContinuityErrs.H" # include "createFields.H" # include "createTimeControls.H" @@ -66,7 +69,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { -# include "readPIMPLEControls.H" # include "readTimeControls.H" # include "CourantNo.H" # include "setDeltaT.H" @@ -76,8 +78,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // Pressure-velocity corrector - int oCorr = 0; - do + while (pimple.loop()) { twoPhaseProperties.correct(); @@ -86,7 +87,7 @@ int main(int argc, char *argv[]) # include "UEqn.H" // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { # include "pEqn.H" } @@ -106,7 +107,7 @@ int main(int argc, char *argv[]) } turbulence->correct(); - } while (++oCorr < nOuterCorr); + } runTime.write(); diff --git a/applications/solvers/multiphase/interFoam/pEqn.H b/applications/solvers/multiphase/interFoam/pEqn.H index d2389bc16..ed5f16207 100644 --- a/applications/solvers/multiphase/interFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/pEqn.H @@ -20,7 +20,7 @@ )*rUAf*mesh.magSf(); - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pdEqn ( @@ -29,16 +29,12 @@ pdEqn.setReference(pdRefCell, pdRefValue); - if (corr == nCorr - 1 && nonOrth == nNonOrthCorr) - { - pdEqn.solve(mesh.solutionDict().solver(pd.name() + "Final")); - } - else - { - pdEqn.solve(mesh.solutionDict().solver(pd.name())); - } + pdEqn.solve + ( + mesh.solutionDict().solver(pd.select(pimple.finalInnerIter())) + ); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi -= pdEqn.flux(); } diff --git a/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H index 765087a18..dfcd5299c 100644 --- a/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H @@ -1,11 +1,11 @@ label nAlphaCorr ( - readLabel(piso.lookup("nAlphaCorr")) + readLabel(pimple.dict().lookup("nAlphaCorr")) ); label nAlphaSubCycles ( - readLabel(piso.lookup("nAlphaSubCycles")) + readLabel(pimple.dict().lookup("nAlphaSubCycles")) ); if (nAlphaSubCycles > 1) diff --git a/applications/solvers/multiphase/interMixingFoam/createFields.H b/applications/solvers/multiphase/interMixingFoam/createFields.H index 6fdd34175..5bceabf74 100644 --- a/applications/solvers/multiphase/interMixingFoam/createFields.H +++ b/applications/solvers/multiphase/interMixingFoam/createFields.H @@ -135,16 +135,14 @@ label pdRefCell = 0; scalar pdRefValue = 0.0; - setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue); + setRefCell(pd, pimple.dict(), pdRefCell, pdRefValue); + mesh.schemesDict().setFluxRequired(pd.name()); scalar pRefValue = 0.0; if (pd.needReference()) { - pRefValue = readScalar - ( - mesh.solutionDict().subDict("PISO").lookup("pRefValue") - ); + pRefValue = readScalar(pimple.dict().lookup("pRefValue")); p += dimensionedScalar ( @@ -163,3 +161,5 @@ ( incompressible::turbulenceModel::New(U, phi, threePhaseProperties) ); + + mesh.schemesDict().setFluxRequired(alpha2.name()); diff --git a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C index 44de8ab5e..fb844be70 100644 --- a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C @@ -36,6 +36,7 @@ Description #include "threePhaseMixture.H" #include "threePhaseInterfaceProperties.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,8 +45,10 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "readGravitationalAcceleration.H" -# include "readPISOControls.H" # include "initContinuityErrs.H" # include "createFields.H" # include "createTimeControls.H" @@ -59,7 +62,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { -# include "readPISOControls.H" # include "readTimeControls.H" # include "CourantNo.H" # include "setDeltaT.H" @@ -76,7 +78,7 @@ int main(int argc, char *argv[]) # include "UEqn.H" // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { # include "pEqn.H" } diff --git a/applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C b/applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C index bf8899fee..a14217572 100644 --- a/applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C +++ b/applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C @@ -170,7 +170,7 @@ Foam::threePhaseInterfaceProperties::threePhaseInterfaceProperties ( readScalar ( - mixture.U().mesh().solutionDict().subDict("PISO").lookup("cAlpha") + mixture.U().mesh().solutionDict().subDict("PIMPLE").lookup("cAlpha") ) ), sigma12_(mixture.lookup("sigma12")), diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H index c59137c7b..182fa3aad 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H @@ -17,7 +17,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve ( diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H index dd1d82803..164941f97 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H @@ -13,12 +13,12 @@ surfaceScalarField rhoPhi { label nAlphaCorr ( - readLabel(piso.lookup("nAlphaCorr")) + readLabel(pimple.dict().lookup("nAlphaCorr")) ); label nAlphaSubCycles ( - readLabel(piso.lookup("nAlphaSubCycles")) + readLabel(pimple.dict().lookup("nAlphaSubCycles")) ); surfaceScalarField phic = mag(phi/mesh.magSf()); @@ -44,7 +44,7 @@ surfaceScalarField rhoPhi # include "alphaEqn.H" } - if (nOuterCorr == 1) + if (pimple.nCorrPIMPLE() == 1) { interface.correct(); } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H b/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H index a1cb1bf0a..ec9c54ab4 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H @@ -36,7 +36,7 @@ mesh.schemesDict().setFluxRequired(pcorr.name()); - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pcorrEqn ( @@ -46,7 +46,7 @@ pcorrEqn.setReference(pdRefCell, pdRefValue); pcorrEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H b/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H index 50cc07e7a..011e879f7 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H @@ -103,16 +103,14 @@ label pdRefCell = 0; scalar pdRefValue = 0.0; - setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue); + setRefCell(pd, pimple.dict(), pdRefCell, pdRefValue); + mesh.schemesDict().setFluxRequired(pd.name()); scalar pRefValue = 0.0; if (pd.needReference()) { - pRefValue = readScalar - ( - mesh.solutionDict().subDict("PISO").lookup("pRefValue") - ); + pRefValue = readScalar(pimple.dict().lookup("pRefValue")); p += dimensionedScalar ( diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index de7b70221..e4a3fd563 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -46,6 +46,7 @@ Description #include "interfaceProperties.H" #include "phaseChangeTwoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,8 +55,10 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "readGravitationalAcceleration.H" -# include "readPISOControls.H" # include "initContinuityErrs.H" # include "createFields.H" # include "createTimeControls.H" @@ -69,7 +72,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { -# include "readPISOControls.H" # include "readTimeControls.H" # include "CourantNo.H" # include "setDeltaT.H" @@ -83,12 +85,12 @@ int main(int argc, char *argv[]) turbulence->correct(); // --- Outer-corrector loop - for (int oCorr=0; oCorrcorrect(); - } while (++oCorr < nOuterCorr); + } runTime.write(); diff --git a/applications/solvers/multiphase/settlingFoam/UEqn.H b/applications/solvers/multiphase/settlingFoam/UEqn.H index 8dba5041c..6bec880d1 100644 --- a/applications/solvers/multiphase/settlingFoam/UEqn.H +++ b/applications/solvers/multiphase/settlingFoam/UEqn.H @@ -12,7 +12,7 @@ fvVectorMatrix UEqn - fvm::laplacian(mu, U, "laplacian(muEff,U)") ); -if (momentumPredictor) +if (pimple.momentumPredictor()) { solve ( diff --git a/applications/solvers/multiphase/settlingFoam/compressibleContinuityErrs.H b/applications/solvers/multiphase/settlingFoam/compressibleContinuityErrs.H index 428465ddd..0593cfe8d 100644 --- a/applications/solvers/multiphase/settlingFoam/compressibleContinuityErrs.H +++ b/applications/solvers/multiphase/settlingFoam/compressibleContinuityErrs.H @@ -1,4 +1,4 @@ - scalar sumLocalContErr = + sumLocalContErr = runTime.deltaT().value()* mag ( @@ -6,7 +6,7 @@ + fvc::div(phi) )().weightedAverage(rho*mesh.V()).value(); - scalar globalContErr = + globalContErr = runTime.deltaT().value()* ( fvc::ddt(rho) diff --git a/applications/solvers/multiphase/settlingFoam/createFields.H b/applications/solvers/multiphase/settlingFoam/createFields.H index 400f89c43..57f62457b 100644 --- a/applications/solvers/multiphase/settlingFoam/createFields.H +++ b/applications/solvers/multiphase/settlingFoam/createFields.H @@ -133,8 +133,8 @@ label pRefCell = 0; scalar pRefValue = 0.0; - setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); - + setRefCell(p, pimple.dict(), pRefCell, pRefValue); + mesh.schemesDict().setFluxRequired(p.name()); Info<< "Calculating field mul\n" << endl; volScalarField mul diff --git a/applications/solvers/multiphase/settlingFoam/pEqn.H b/applications/solvers/multiphase/settlingFoam/pEqn.H index 65b954c6d..5c1ee980b 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)*rUAf*mesh.magSf(); -for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) +while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -27,7 +27,7 @@ for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/multiphase/settlingFoam/settlingFoam.C b/applications/solvers/multiphase/settlingFoam/settlingFoam.C index f75769fee..7b6b153cb 100644 --- a/applications/solvers/multiphase/settlingFoam/settlingFoam.C +++ b/applications/solvers/multiphase/settlingFoam/settlingFoam.C @@ -37,6 +37,7 @@ Description #include "Switch.H" #include "plasticViscosity.H" #include "yieldStress.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,6 +47,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "readGravitationalAcceleration.H" # include "createFields.H" # include "initContinuityErrs.H" @@ -59,12 +63,11 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPISOControls.H" # include "compressibleCourantNo.H" # include "rhoEqn.H" - for (int oCorr=0; oCorr Date: Sat, 28 May 2016 11:32:51 +0200 Subject: [PATCH 14/26] Backported viscoelasticFluidFoam and tutorials (vanilla OF 3.0.1) --- .../viscoelastic/viscoelasticFluidFoam/createFields.H | 3 ++- .../viscoelasticFluidFoam/viscoelasticFluidFoam.C | 11 +++++++---- .../viscoelasticFluidFoam/DCPP/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/FENE-CR/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/FENE-P/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/Feta-PTT/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/Giesekus/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/Leonov/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/Oldroyd-B/system/fvSchemes | 6 ------ .../PTT-Exponential/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/PTT-Linear/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/S-MDCPP/system/fvSchemes | 6 ------ .../WhiteMetzner/CarreauYasuda/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/XPP_DE/system/fvSchemes | 6 ------ .../viscoelasticFluidFoam/XPP_SE/system/fvSchemes | 6 ------ 15 files changed, 9 insertions(+), 83 deletions(-) diff --git a/applications/solvers/viscoelastic/viscoelasticFluidFoam/createFields.H b/applications/solvers/viscoelastic/viscoelasticFluidFoam/createFields.H index 3c0d889fa..62930834d 100644 --- a/applications/solvers/viscoelastic/viscoelasticFluidFoam/createFields.H +++ b/applications/solvers/viscoelastic/viscoelasticFluidFoam/createFields.H @@ -31,7 +31,8 @@ label pRefCell = 0; scalar pRefValue = 0.0; - setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + setRefCell(p, piso.dict(), pRefCell, pRefValue); + mesh.schemesDict().setFluxRequired(p.name()); // Create viscoelastic model viscoelasticModel visco(U, phi); diff --git a/applications/solvers/viscoelastic/viscoelasticFluidFoam/viscoelasticFluidFoam.C b/applications/solvers/viscoelastic/viscoelasticFluidFoam/viscoelasticFluidFoam.C index 6c764b22a..622d7cda5 100644 --- a/applications/solvers/viscoelastic/viscoelasticFluidFoam/viscoelasticFluidFoam.C +++ b/applications/solvers/viscoelastic/viscoelasticFluidFoam/viscoelasticFluidFoam.C @@ -34,6 +34,7 @@ Author #include "fvCFD.H" #include "viscoelasticModel.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,6 +45,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pisoControl piso(mesh); + # include "createFields.H" # include "initContinuityErrs.H" # include "createTimeControls.H" @@ -55,7 +59,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { -# include "readPISOControls.H" # include "readTimeControls.H" # include "CourantNo.H" # include "setDeltaT.H" @@ -65,7 +68,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // Pressure-velocity SIMPLE corrector loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { // Momentum predictor @@ -91,7 +94,7 @@ int main(int argc, char *argv[]) p.storePrevIter(); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -101,7 +104,7 @@ int main(int argc, char *argv[]) pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/DCPP/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/DCPP/system/fvSchemes index abad537ae..bba183ccc 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/DCPP/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/DCPP/system/fvSchemes @@ -63,10 +63,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/FENE-CR/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/FENE-CR/system/fvSchemes index 3e5833a60..b83b5014e 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/FENE-CR/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/FENE-CR/system/fvSchemes @@ -54,10 +54,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/FENE-P/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/FENE-P/system/fvSchemes index 5abff9188..8dcef9a94 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/FENE-P/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/FENE-P/system/fvSchemes @@ -54,10 +54,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/Feta-PTT/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/Feta-PTT/system/fvSchemes index 4391db454..08f4eb292 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/Feta-PTT/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/Feta-PTT/system/fvSchemes @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/Giesekus/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/Giesekus/system/fvSchemes index 4391db454..08f4eb292 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/Giesekus/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/Giesekus/system/fvSchemes @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/Leonov/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/Leonov/system/fvSchemes index dbca98d38..5b3d8a578 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/Leonov/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/Leonov/system/fvSchemes @@ -54,10 +54,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/Oldroyd-B/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/Oldroyd-B/system/fvSchemes index 3e5833a60..b83b5014e 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/Oldroyd-B/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/Oldroyd-B/system/fvSchemes @@ -54,10 +54,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/PTT-Exponential/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/PTT-Exponential/system/fvSchemes index e3e8379aa..aedee55cc 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/PTT-Exponential/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/PTT-Exponential/system/fvSchemes @@ -58,10 +58,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/PTT-Linear/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/PTT-Linear/system/fvSchemes index 5abff9188..8dcef9a94 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/PTT-Linear/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/PTT-Linear/system/fvSchemes @@ -54,10 +54,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/system/fvSchemes index 74d37ec7f..467993fe5 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/S-MDCPP/system/fvSchemes @@ -57,10 +57,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/WhiteMetzner/CarreauYasuda/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/WhiteMetzner/CarreauYasuda/system/fvSchemes index 3e5833a60..b83b5014e 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/WhiteMetzner/CarreauYasuda/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/WhiteMetzner/CarreauYasuda/system/fvSchemes @@ -54,10 +54,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/XPP_DE/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/XPP_DE/system/fvSchemes index 4feeacc8b..49ac3846a 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/XPP_DE/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/XPP_DE/system/fvSchemes @@ -69,10 +69,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/viscoelastic/viscoelasticFluidFoam/XPP_SE/system/fvSchemes b/tutorials/viscoelastic/viscoelasticFluidFoam/XPP_SE/system/fvSchemes index 903fece99..1b150fc4b 100644 --- a/tutorials/viscoelastic/viscoelasticFluidFoam/XPP_SE/system/fvSchemes +++ b/tutorials/viscoelastic/viscoelasticFluidFoam/XPP_SE/system/fvSchemes @@ -62,10 +62,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // From f3b7d067b74b6f33847e6d18380f1d09ca7471fb Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Sat, 28 May 2016 12:12:37 +0200 Subject: [PATCH 15/26] Backported surfaceTracking solvers and tutorials (vanilla OF 3.0.1) --- .../bubbleInterTrackFoam/bubbleInterTrackFoam.C | 15 ++++++++------- .../bubbleInterTrackFoam/createFields.H | 1 + .../solvers/surfaceTracking/include/setRefCell.H | 4 ++-- .../surfaceTracking/interTrackFoam/createFields.H | 1 + .../interTrackFoam/interTrackFoam.C | 14 +++++++------- .../bubble2D_r0.75mm/system/fvSchemes | 5 ----- .../bubble2D_r0.75mm/system/fvSolution | 2 +- .../interTrackFoam/hydrofoil/system/fvSchemes | 5 ----- .../interTrackFoam/hydrofoil/system/fvSolution | 2 +- .../interTrackFoam/ramp/system/fvSchemes | 5 ----- .../interTrackFoam/ramp/system/fvSolution | 2 +- .../interTrackFoam/sloshing2D/system/fvSchemes | 5 ----- .../interTrackFoam/sloshing2D/system/fvSolution | 2 +- .../interTrackFoam/tank3D/system/fvSchemes | 5 ----- .../interTrackFoam/tank3D/system/fvSolution | 2 +- 15 files changed, 24 insertions(+), 46 deletions(-) diff --git a/applications/solvers/surfaceTracking/bubbleInterTrackFoam/bubbleInterTrackFoam.C b/applications/solvers/surfaceTracking/bubbleInterTrackFoam/bubbleInterTrackFoam.C index 88ef19848..e47aac371 100644 --- a/applications/solvers/surfaceTracking/bubbleInterTrackFoam/bubbleInterTrackFoam.C +++ b/applications/solvers/surfaceTracking/bubbleInterTrackFoam/bubbleInterTrackFoam.C @@ -37,7 +37,7 @@ Description #include "inletOutletFvPatchFields.H" #include "fixedGradientFvPatchFields.H" #include "boundBox.H" - +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,6 +46,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" # include "createDynamicFvMesh.H" + + pimpleControl pimple(mesh); + # include "createFields.H" # include "initContinuityErrs.H" # include "createBubble.H" @@ -59,8 +62,6 @@ int main(int argc, char *argv[]) { Info << "Time = " << runTime.value() << endl << endl; -# include "readPISOControls.H" - interface.moveMeshPointsForOldFreeSurfDisplacement(); interface.updateDisplacementDirections(); @@ -70,7 +71,7 @@ int main(int argc, char *argv[]) Info<< "\nMax surface Courant Number = " << interface.maxCourantNumber() << endl << endl; - for (int corr=0; corr(pNeedRef, andOp()); // Find reference cell if (pNeedRef) { - point refPointi(mesh.solutionDict().subDict("PISO").lookup("pRefPoint")); + point refPointi(mesh.solutionDict().subDict("PIMPLE").lookup("pRefPoint")); label refCelli = mesh.findCell(refPointi); label hasRef = (refCelli >= 0 ? 1 : 0); label sumHasRef = returnReduce