diff --git a/ReleaseNotes-dev b/ReleaseNotes-dev index fa80518f35..5f25edc276 100644 --- a/ReleaseNotes-dev +++ b/ReleaseNotes-dev @@ -120,6 +120,8 @@ + reuses tracking state in interpolation - improves consistency and speed *** *Updated* split cyclics into two separate patches. See [[./doc/changes/splitCyclic.txt]] + * *New* cyclics (and all coupled patches) have optional + matchTolerance entry to allow looser area matching tolerance. * *Updated* interpolation (volPointInterpolation) now works without the globalPointPatch. Moving mesh cases can now be run non-parallel and continued in parallel and reconstructed without any limitation. @@ -264,8 +266,6 @@ internal field instead of boundary field. + =ensight=: new output format for all sampledSurfaces. + Function objects: - + =residualControl=: new function object to allow users to terminate steady - state calculations when the defined residual levels are achieved + =abortCalculation=: watches for presence of the named file in the $FOAM_CASE directory and aborts the calculation if it is present + =timeActivatedFileUpdate=: performs a file copy/replacement once a @@ -312,8 +312,3 @@ * Other + compilable with =clang= In your prefs.sh set the WM_COMPILER to Clang - + dlclose error: upon exit of e.g. paraFoam you can get the error - Inconsistency detected by ld.so: dl-close.c: 731: _dl_close: Assertion - `map->l_init_called' failed! - This seems to happen with a mix of system libraries and a thirdParty - compiler. diff --git a/applications/solvers/DNS/dnsFoam/createFields.H b/applications/solvers/DNS/dnsFoam/createFields.H index 36fc513e02..6c1bb42929 100644 --- a/applications/solvers/DNS/dnsFoam/createFields.H +++ b/applications/solvers/DNS/dnsFoam/createFields.H @@ -26,4 +26,4 @@ mesh ); -# include "createPhi.H" + #include "createPhi.H" diff --git a/applications/solvers/DNS/dnsFoam/dnsFoam.C b/applications/solvers/DNS/dnsFoam/dnsFoam.C index d3f1da2d99..befa5e9655 100644 --- a/applications/solvers/DNS/dnsFoam/dnsFoam.C +++ b/applications/solvers/DNS/dnsFoam/dnsFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,7 +110,12 @@ int main(int argc, char *argv[]) if (runTime.outputTime()) { - calcEk(U, K).write(runTime.timePath()/"Ek", runTime.graphFormat()); + calcEk(U, K).write + ( + runTime.path()/"graphs"/runTime.timeName(), + "Ek", + runTime.graphFormat() + ); } Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/basic/laplacianFoam/laplacianFoam.C b/applications/solvers/basic/laplacianFoam/laplacianFoam.C index b498db2d97..e2efee8f45 100644 --- a/applications/solvers/basic/laplacianFoam/laplacianFoam.C +++ b/applications/solvers/basic/laplacianFoam/laplacianFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -41,17 +42,17 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "createFields.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating temperature distribution\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { solve ( diff --git a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C index ce5580d50b..3c0c0f3b14 100644 --- a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C +++ b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,32 +30,30 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "createFields.H" -# include "setRootCase.H" + simpleControl simple(mesh); -# include "createTime.H" -# include "createMesh.H" -# include "createFields.H" - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nCalculating scalar transport\n" << endl; -# include "CourantNo.H" + #include "CourantNo.H" - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readSIMPLEControls.H" - - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { solve ( diff --git a/applications/solvers/combustion/PDRFoam/PDRFoam.C b/applications/solvers/combustion/PDRFoam/PDRFoam.C index 2f11a8db1a..3c4da27187 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoam.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoam.C @@ -53,6 +53,18 @@ Description PDR (porosity/distributed resistance) modelling is included to handle regions containing blockages which cannot be resolved by the mesh. + The fields used by this solver are: + + betav: Volume porosity + Lobs: Average diameter of obstacle in cell (m) + Aw: Obstacle surface area per unit volume (1/m) + CR: Drag tensor (1/m) + CT: Turbulence generation parameter (1/m) + Nv: Number of obstacles in cell per unit volume (m^-2) + nsv: Tensor whose diagonal indicates the number to substract from + Nv to get the number of obstacles crossing the flow in each + direction. + \*---------------------------------------------------------------------------*/ #include "fvCFD.H" @@ -64,6 +76,7 @@ Description #include "ignition.H" #include "Switch.H" #include "bound.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -81,6 +94,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + scalar StCoNum = 0.0; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -90,7 +105,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -98,26 +112,34 @@ int main(int argc, char *argv[]) Info<< "\n\nTime = " << runTime.timeName() << endl; #include "rhoEqn.H" - #include "UEqn.H" - // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + // --- Pressure-velocity PIMPLE corrector loop + for (pimple.start(); pimple.loop(); pimple++) { - #include "bEqn.H" - #include "ftEqn.H" - #include "huEqn.H" - #include "hEqn.H" + #include "UEqn.H" - if (!ign.ignited()) + // --- PISO loop + for (int corr=1; corr<=pimple.nCorr(); corr++) { - hu == h; + #include "bEqn.H" + #include "ftEqn.H" + #include "huEqn.H" + #include "hEqn.H" + + if (!ign.ignited()) + { + hu == h; + } + + #include "pEqn.H" } - #include "pEqn.H" + if (pimple.turbCorr()) + { + turbulence->correct(); + } } - turbulence->correct(); - runTime.write(); Info<< "\nExecutionTime = " diff --git a/applications/solvers/combustion/PDRFoam/UEqn.H b/applications/solvers/combustion/PDRFoam/UEqn.H index deb00a3121..70912c7cfa 100644 --- a/applications/solvers/combustion/PDRFoam/UEqn.H +++ b/applications/solvers/combustion/PDRFoam/UEqn.H @@ -9,7 +9,7 @@ volSymmTensorField invA(inv(I*UEqn.A() + drag->Dcu())); - if (momentumPredictor) + if (pimple.momentumPredictor()) { U = invA & (UEqn.H() - betav*fvc::grad(p)); U.correctBoundaryConditions(); diff --git a/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C b/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C index c58339940e..4817928910 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C index ed860d9ca9..d97dd54463 100644 --- a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C +++ b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/combustion/PDRFoam/pEqn.H b/applications/solvers/combustion/PDRFoam/pEqn.H index 9488e60e72..3c6a6341f9 100644 --- a/applications/solvers/combustion/PDRFoam/pEqn.H +++ b/applications/solvers/combustion/PDRFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); U = invA & UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -24,9 +24,12 @@ if (transonic) - fvm::laplacian(rho*invA, p) ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -41,7 +44,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -50,9 +53,12 @@ else - fvm::laplacian(rho*invA, p) ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/XiFoam/UEqn.H b/applications/solvers/combustion/XiFoam/UEqn.H index 9697c6e1ed..1e626d75b8 100644 --- a/applications/solvers/combustion/XiFoam/UEqn.H +++ b/applications/solvers/combustion/XiFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/combustion/XiFoam/XiFoam.C b/applications/solvers/combustion/XiFoam/XiFoam.C index b551d2dd8b..fc3658269a 100644 --- a/applications/solvers/combustion/XiFoam/XiFoam.C +++ b/applications/solvers/combustion/XiFoam/XiFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,6 +55,7 @@ Description #include "laminarFlameSpeed.H" #include "ignition.H" #include "Switch.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -72,6 +73,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -79,17 +82,17 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; + #include "rhoEqn.H" + // --- Pressure-velocity PIMPLE corrector loop - for (int oCorr=0; oCorrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } } rho = thermo.rho(); diff --git a/applications/solvers/combustion/XiFoam/pEqn.H b/applications/solvers/combustion/XiFoam/pEqn.H index 4168eb0e34..bef433d388 100644 --- a/applications/solvers/combustion/XiFoam/pEqn.H +++ b/applications/solvers/combustion/XiFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); U = rAU*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -24,9 +24,12 @@ if (transonic) - fvm::laplacian(rho*rAU, p) ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -41,7 +44,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -50,9 +53,12 @@ else - fvm::laplacian(rho*rAU, p) ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C index 89cc360d9f..bb1f3f2018 100644 --- a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C +++ b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,6 +35,7 @@ Description #include "basicPsiThermo.H" #include "turbulenceModel.H" #include "OFstream.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,13 +52,14 @@ int main(int argc, char *argv[]) #include "setInitialDeltaT.H" #include "startSummary.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { - #include "readPISOControls.H" #include "readEngineTimeControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -71,16 +73,23 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" - #include "UEqn.H" - - // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + // --- Pressure-velocity PIMPLE corrector loop + for (pimple.start(); pimple.loop(); pimple++) { - #include "hEqn.H" - #include "pEqn.H" - } + #include "UEqn.H" - turbulence->correct(); + // --- PISO loop + for (int corr=1; corr<=pimple.nCorr(); corr++) + { + #include "hEqn.H" + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } runTime.write(); diff --git a/applications/solvers/combustion/dieselEngineFoam/UEqn.H b/applications/solvers/combustion/dieselEngineFoam/UEqn.H index 47912e8dd5..c6caf5989c 100644 --- a/applications/solvers/combustion/dieselEngineFoam/UEqn.H +++ b/applications/solvers/combustion/dieselEngineFoam/UEqn.H @@ -8,7 +8,7 @@ + dieselSpray.momentumSource() ); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C index 92bd3ba1f6..94ab928999 100644 --- a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C +++ b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,7 @@ Description #include "volPointInterpolation.H" #include "thermoPhysicsTypes.H" #include "mathematicalConstants.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,13 +62,14 @@ int main(int argc, char *argv[]) #include "setInitialDeltaT.H" #include "startSummary.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { - #include "readPISOControls.H" #include "readEngineTimeControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -77,10 +79,6 @@ int main(int argc, char *argv[]) Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl; mesh.move(); - const_cast - ( - volPointInterpolation::New(mesh) - ).updateMesh(); dieselSpray.evolve(); @@ -106,22 +104,26 @@ int main(int argc, char *argv[]) chemistrySh = kappa*chemistry.Sh()(); - #include "rhoEqn.H" - #include "UEqn.H" - for (label ocorr=1; ocorr <= nOuterCorr; ocorr++) + #include "rhoEqn.H" + + for (pimple.start(); pimple.loop(); pimple++) { + #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + for (int corr=1; corr<=pimple.nCorr(); corr++) { #include "pEqn.H" } - } - turbulence->correct(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } #include "logSummary.H" #include "spraySummary.H" diff --git a/applications/solvers/combustion/dieselEngineFoam/pEqn.H b/applications/solvers/combustion/dieselEngineFoam/pEqn.H index 049db9d250..42228cc7b0 100644 --- a/applications/solvers/combustion/dieselEngineFoam/pEqn.H +++ b/applications/solvers/combustion/dieselEngineFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField A(UEqn.A()); U = UEqn.H()/A; -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -12,7 +12,7 @@ if (transonic) *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -23,9 +23,12 @@ if (transonic) Sevap ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -36,7 +39,7 @@ else phi = fvc::interpolate(rho) *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -47,9 +50,12 @@ else Sevap ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/dieselFoam/dieselFoam.C b/applications/solvers/combustion/dieselFoam/dieselFoam.C index c5ea609ed7..7fd7410247 100644 --- a/applications/solvers/combustion/dieselFoam/dieselFoam.C +++ b/applications/solvers/combustion/dieselFoam/dieselFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,7 @@ Description #include "OFstream.H" #include "Switch.H" #include "mathematicalConstants.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,13 +59,14 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -98,21 +100,25 @@ int main(int argc, char *argv[]) chemistrySh = kappa*chemistry.Sh()(); #include "rhoEqn.H" - #include "UEqn.H" - for (label ocorr=1; ocorr <= nOuterCorr; ocorr++) + // --- Pressure-velocity PIMPLE corrector loop + for (pimple.start(); pimple.loop(); pimple++) { + #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } #include "spraySummary.H" diff --git a/applications/solvers/combustion/dieselFoam/pEqn.H b/applications/solvers/combustion/dieselFoam/pEqn.H index cb9f95c03f..5c4bd5ddf6 100644 --- a/applications/solvers/combustion/dieselFoam/pEqn.H +++ b/applications/solvers/combustion/dieselFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); U = rAU*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -26,9 +26,12 @@ if (transonic) Sevap ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -43,7 +46,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -54,9 +57,12 @@ else Sevap ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/engineFoam/UEqn.H b/applications/solvers/combustion/engineFoam/UEqn.H index 64dd52b1b0..eff9e1a5d2 100644 --- a/applications/solvers/combustion/engineFoam/UEqn.H +++ b/applications/solvers/combustion/engineFoam/UEqn.H @@ -5,7 +5,7 @@ + turbulence->divDevRhoReff(U) ); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/combustion/engineFoam/engineFoam.C b/applications/solvers/combustion/engineFoam/engineFoam.C index 4fedd9b92c..b92da02651 100644 --- a/applications/solvers/combustion/engineFoam/engineFoam.C +++ b/applications/solvers/combustion/engineFoam/engineFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,6 +58,7 @@ Description #include "Switch.H" #include "OFstream.H" #include "mathematicalConstants.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -75,13 +76,14 @@ int main(int argc, char *argv[]) #include "setInitialDeltaT.H" #include "startSummary.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { - #include "readPISOControls.H" #include "readEngineTimeControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -94,11 +96,11 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" - #include "UEqn.H" - - // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + // --- Pressure-velocity PIMPLE corrector loop + for (pimple.start(); pimple.loop(); pimple++) { + #include "UEqn.H" + #include "ftEqn.H" #include "bEqn.H" #include "huEqn.H" @@ -109,10 +111,17 @@ int main(int argc, char *argv[]) hu == h; } - #include "pEqn.H" - } + // --- PISO loop + for (int corr=1; corr<=pimple.nCorr(); corr++) + { + #include "pEqn.H" + } - turbulence->correct(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } #include "logSummary.H" diff --git a/applications/solvers/combustion/engineFoam/pEqn.H b/applications/solvers/combustion/engineFoam/pEqn.H index 78a90c2357..1b75a93398 100644 --- a/applications/solvers/combustion/engineFoam/pEqn.H +++ b/applications/solvers/combustion/engineFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); U = rAU*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -12,18 +12,21 @@ if (transonic) *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) - + fvm::div(phid, p, "div(phid,p)") + + fvm::div(phid, p) - fvm::laplacian(rho*rAU, p) ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -34,7 +37,7 @@ else phi = fvc::interpolate(rho) *((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -43,9 +46,12 @@ else - fvm::laplacian(rho*rAU, p) ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index c4b7be29fc..a517eccde1 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -34,7 +34,7 @@ Description #include "turbulenceModel.H" #include "combustionModel.H" #include "radiationModel.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,13 +51,14 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { - #include "readPIMPLEControls.H" #include "readTimeControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -68,12 +69,7 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { #include "UEqn.H" @@ -81,13 +77,16 @@ int main(int argc, char *argv[]) #include "fuhsEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } rho = thermo.rho(); diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H index 74b3cdc958..6813950e19 100644 --- a/applications/solvers/combustion/fireFoam/pEqn.H +++ b/applications/solvers/combustion/fireFoam/pEqn.H @@ -15,7 +15,7 @@ surfaceScalarField phiU phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf(); -for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) +for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { surfaceScalarField rhorAUf(fvc::interpolate(rho*rAU)); @@ -28,20 +28,10 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) p_rghEqn.solve ( - mesh.solver - ( - p_rgh.select - ( - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ) + mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += p_rghEqn.flux(); } diff --git a/applications/solvers/combustion/reactingFoam/UEqn.H b/applications/solvers/combustion/reactingFoam/UEqn.H index 9697c6e1ed..1e626d75b8 100644 --- a/applications/solvers/combustion/reactingFoam/UEqn.H +++ b/applications/solvers/combustion/reactingFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/combustion/reactingFoam/chemistry.H b/applications/solvers/combustion/reactingFoam/chemistry.H index 3a36aaac52..99f418af6f 100644 --- a/applications/solvers/combustion/reactingFoam/chemistry.H +++ b/applications/solvers/combustion/reactingFoam/chemistry.H @@ -1,3 +1,4 @@ +if (chemistry.chemistry()) { Info<< "Solving chemistry" << endl; @@ -10,17 +11,29 @@ // turbulent time scale if (turbulentReaction) { - volScalarField tk - ( - Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon()) - ); - volScalarField tc - ( - chemistry.tc() - ); + tmp tepsilon(turbulence->epsilon()); + const volScalarField& epsilon = tepsilon(); + tmp tmuEff(turbulence->muEff()); + const volScalarField& muEff = tmuEff(); + tmp ttc(chemistry.tc()); + const volScalarField& tc = ttc(); - // Chalmers PaSR model - kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk); + forAll(epsilon, i) + { + if (epsilon[i] > 0) + { + // Chalmers PaSR model + scalar tk = Cmix.value()*Foam::sqrt(muEff[i]/rho[i]/epsilon[i]); + kappa[i] = + (runTime.deltaTValue() + tc[i]) + /(runTime.deltaTValue() + tc[i] + tk); + } + else + { + // Return to laminar combustion + kappa[i] = 1.0; + } + } } else { diff --git a/applications/solvers/combustion/reactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/pEqn.H index 4168eb0e34..bef433d388 100644 --- a/applications/solvers/combustion/reactingFoam/pEqn.H +++ b/applications/solvers/combustion/reactingFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); U = rAU*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -24,9 +24,12 @@ if (transonic) - fvm::laplacian(rho*rAU, p) ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -41,7 +44,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -50,9 +53,12 @@ else - fvm::laplacian(rho*rAU, p) ); - pEqn.solve(); + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index 42fe69390a..ca156c3f7f 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,6 +35,7 @@ Description #include "psiChemistryModel.H" #include "chemistrySolver.H" #include "multivariateScheme.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,6 +52,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -58,7 +61,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -68,20 +70,23 @@ int main(int argc, char *argv[]) #include "chemistry.H" #include "rhoEqn.H" - for (label ocorr=1; ocorr <= nOuterCorr; ocorr++) + for (pimple.start(); pimple.loop(); pimple++) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } if (runTime.write()) { diff --git a/applications/solvers/combustion/rhoReactingFoam/Make/options b/applications/solvers/combustion/rhoReactingFoam/Make/options index 6386af8c55..d6306816fd 100644 --- a/applications/solvers/combustion/rhoReactingFoam/Make/options +++ b/applications/solvers/combustion/rhoReactingFoam/Make/options @@ -5,7 +5,9 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(FOAM_SOLVERS)/combustion/reactingFoam + EXE_LIBS = \ -lcompressibleTurbulenceModel \ diff --git a/applications/solvers/combustion/rhoReactingFoam/UEqn.H b/applications/solvers/combustion/rhoReactingFoam/UEqn.H index 9697c6e1ed..1e626d75b8 100644 --- a/applications/solvers/combustion/rhoReactingFoam/UEqn.H +++ b/applications/solvers/combustion/rhoReactingFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/combustion/rhoReactingFoam/chemistry.H b/applications/solvers/combustion/rhoReactingFoam/chemistry.H deleted file mode 100644 index 841b434a71..0000000000 --- a/applications/solvers/combustion/rhoReactingFoam/chemistry.H +++ /dev/null @@ -1,28 +0,0 @@ -{ - Info<< "Solving chemistry" << endl; - - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - if (turbulentReaction) - { - volScalarField tk - ( - Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon()) - ); - volScalarField tc(chemistry.tc()); - - // Chalmers PaSR model - kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk); - } - else - { - kappa = 1.0; - } - - chemistrySh = kappa*chemistry.Sh()(); -} diff --git a/applications/solvers/combustion/rhoReactingFoam/pEqn.H b/applications/solvers/combustion/rhoReactingFoam/pEqn.H index 21f5ec080b..724f45e189 100644 --- a/applications/solvers/combustion/rhoReactingFoam/pEqn.H +++ b/applications/solvers/combustion/rhoReactingFoam/pEqn.H @@ -8,7 +8,7 @@ volScalarField rAU(1.0/UEqn.A()); U = rAU*UEqn.H(); - if (transonic) + if (pimple.transonic()) { surfaceScalarField phiv ( @@ -30,7 +30,7 @@ + correction(fvm::ddt(psi, p) + fvm::div(phid, p)) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -40,20 +40,10 @@ pEqn.solve ( - mesh.solver - ( - p.select - ( - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } @@ -74,7 +64,7 @@ + fvc::div(phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -84,20 +74,10 @@ pEqn.solve ( - mesh.solver - ( - p.select - ( - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C index 5181a50b29..9c22e63c51 100644 --- a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C +++ b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C @@ -36,7 +36,7 @@ Description #include "rhoChemistryModel.H" #include "chemistrySolver.H" #include "multivariateScheme.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,6 +53,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -60,7 +62,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -71,25 +72,23 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + for (int corr=1; corr<=pimple.nCorr(); corr++) { #include "pEqn.H" } - } - turbulence->correct(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } rho = thermo.rho(); diff --git a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H index 27b06029b8..03bc6e76e7 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H @@ -11,7 +11,7 @@ UEqn().relax(); volScalarField rAU(1.0/UEqn().A()); -if (momentumPredictor) +if (pimple.momentumPredictor()) { solve(UEqn() == -fvc::grad(p)); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index 4029b8fc8d..eea0ea9bff 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -5,12 +5,12 @@ rho.relax(); U = rAU*UEqn().H(); -if (nCorr <= 1) +if (pimple.nCorr() <= 1) { UEqn.clear(); } -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -22,7 +22,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -33,18 +33,10 @@ if (transonic) pEqn.solve ( - mesh.solver - ( - p.select - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -59,7 +51,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { // Pressure corrector fvScalarMatrix pEqn @@ -71,18 +63,10 @@ else pEqn.solve ( - mesh.solver - ( - p.select - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index f399ae40cb..a5e92c8479 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -37,7 +37,7 @@ Description #include "basicPsiThermo.H" #include "turbulenceModel.H" #include "bound.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,12 +49,13 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + pimpleControl pimple(mesh); + Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { #include "readTimeControls.H" - #include "readPIMPLEControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -65,14 +66,9 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { - if (nOuterCorr != 1) + if (pimple.nOuterCorr() != 1) { p.storePrevIter(); rho.storePrevIter(); @@ -82,12 +78,15 @@ int main(int argc, char *argv[]) #include "hEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } } runTime.write(); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C index 9bceaa1167..97cc2cc256 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C @@ -40,7 +40,7 @@ Description #include "MRFZones.H" #include "porousZones.H" #include "fvcSmooth.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" #include "bound.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,18 +50,21 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - #include "readPIMPLEControls.H" + + pimpleControl pimple(mesh); + #include "setInitialrDeltaT.H" #include "createFields.H" #include "createZones.H" #include "initContinuityErrs.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { #include "readTimeControls.H" - #include "readPIMPLEControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -74,14 +77,9 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { - if (nOuterCorr != 1) + if (pimple.nOuterCorr() != 1) { p.storePrevIter(); rho.storePrevIter(); @@ -93,7 +91,7 @@ int main(int argc, char *argv[]) #include "hEqn.H" // --- PISO loop - for (int corr=0; corr("maxDeltaT", GREAT) + pimple.dict().lookupOrDefault("maxDeltaT", GREAT) ); volScalarField rDeltaT diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/setrDeltaT.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/setrDeltaT.H index e854f03d35..d56283d13f 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/setrDeltaT.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/setrDeltaT.H @@ -1,22 +1,24 @@ { + const dictionary& pimpleDict = pimple.dict(); + scalar maxCo ( - pimple.lookupOrDefault("maxCo", 0.8) + pimpleDict.lookupOrDefault("maxCo", 0.8) ); scalar rDeltaTSmoothingCoeff ( - pimple.lookupOrDefault("rDeltaTSmoothingCoeff", 0.02) + pimpleDict.lookupOrDefault("rDeltaTSmoothingCoeff", 0.02) ); scalar rDeltaTDampingCoeff ( - pimple.lookupOrDefault("rDeltaTDampingCoeff", 1.0) + pimpleDict.lookupOrDefault("rDeltaTDampingCoeff", 1.0) ); scalar maxDeltaT ( - pimple.lookupOrDefault("maxDeltaT", GREAT) + pimpleDict.lookupOrDefault("maxDeltaT", GREAT) ); volScalarField rDeltaT0("rDeltaT0", rDeltaT); @@ -29,7 +31,7 @@ /((2*maxCo)*mesh.V()*rho.dimensionedInternalField()) ); - if (transonic) + if (pimple.transonic()) { surfaceScalarField phid ( diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H index 4efb76bd45..f3b115d0da 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H @@ -15,7 +15,7 @@ pZones.addResistance(UEqn()); volScalarField rAU(1.0/UEqn().A()); -if (momentumPredictor) +if (pimple.momentumPredictor()) { solve(UEqn() == -fvc::grad(p)); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H index 4a0626e3d1..5e54f970cd 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H @@ -6,12 +6,12 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); U = rAU*UEqn().H(); -if (nCorr <= 1) +if (pimple.nCorr() <= 1) { UEqn.clear(); } -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -24,7 +24,7 @@ if (transonic) ); mrfZones.relativeFlux(fvc::interpolate(psi), phid); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -35,20 +35,10 @@ if (transonic) pEqn.solve ( - mesh.solver - ( - p.select - ( - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -64,7 +54,7 @@ else ); mrfZones.relativeFlux(fvc::interpolate(rho), phi); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { // Pressure corrector fvScalarMatrix pEqn @@ -76,20 +66,10 @@ else pEqn.solve ( - mesh.solver - ( - p.select - ( - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index 94e3f67e59..ad9e04cc7e 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -39,7 +39,7 @@ Description #include "bound.H" #include "MRFZones.H" #include "porousZones.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,6 +52,8 @@ int main(int argc, char *argv[]) #include "createZones.H" #include "initContinuityErrs.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -59,7 +61,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPIMPLEControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -70,14 +71,9 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { - if (nOuterCorr != 1) + if (pimple.nOuterCorr() != 1) { p.storePrevIter(); rho.storePrevIter(); @@ -87,12 +83,15 @@ int main(int argc, char *argv[]) #include "hEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } } runTime.write(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index 4574a096ef..54af64c003 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++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -32,7 +32,7 @@ if (transonic) pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -43,7 +43,7 @@ else phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); closedVolume = adjustPhi(phi, U, p); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -54,7 +54,7 @@ else pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H index 44b391a7b5..4fc258870b 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H @@ -11,7 +11,7 @@ UEqn.clear(); bool closedVolume = false; -if (transonic) +if (simple.transonic()) { surfaceScalarField phid ( @@ -20,7 +20,7 @@ if (transonic) ); mrfZones.relativeFlux(fvc::interpolate(psi), phid); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { tmp tpEqn; @@ -37,7 +37,7 @@ if (transonic) tpEqn().solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi == tpEqn().flux(); } @@ -50,7 +50,7 @@ else closedVolume = adjustPhi(phi, U, p); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { tmp tpEqn; @@ -67,7 +67,7 @@ else tpEqn().solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi -= tpEqn().flux(); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C index 83898240ff..e210e971ca 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C @@ -36,6 +36,7 @@ Description #include "RASModel.H" #include "MRFZones.H" #include "thermalPorousZones.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,16 +49,16 @@ int main(int argc, char *argv[]) #include "createZones.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - p.storePrevIter(); rho.storePrevIter(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C index a8ddcbeb6c..63b6586cb4 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,6 +33,7 @@ Description #include "fvCFD.H" #include "basicPsiThermo.H" #include "RASModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,16 +45,16 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - p.storePrevIter(); rho.storePrevIter(); diff --git a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H index 36b77f0399..9eb783feca 100644 --- a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H @@ -12,9 +12,9 @@ UEqn.clear(); bool closedVolume = false; -if (transonic) +if (simple.transonic()) { - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { surfaceScalarField phid ( @@ -54,7 +54,7 @@ if (transonic) pEqn.solve(); } - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi == phic + pEqn.flux(); } @@ -62,7 +62,7 @@ if (transonic) } else { - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { phi = fvc::interpolate(rho*U) & mesh.Sf(); closedVolume = adjustPhi(phi, U, p); @@ -88,7 +88,7 @@ else } - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi += pEqn.flux(); } @@ -119,7 +119,7 @@ rho = thermo.rho(); rho = max(rho, rhoMin); rho = min(rho, rhoMax); -if (!transonic) +if (!simple.transonic()) { rho.relax(); } diff --git a/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C b/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C index c804e4e45d..13b8ebddc4 100644 --- a/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C +++ b/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C @@ -35,6 +35,7 @@ Description #include "RASModel.H" #include "mixedFvPatchFields.H" #include "bound.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,20 +47,20 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - p.storePrevIter(); rho.storePrevIter(); - if (!transonic) + if (!simple.transonic()) { rho.storePrevIter(); } diff --git a/applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C b/applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C index c8ed4e2cbd..96c07a1756 100644 --- a/applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C +++ b/applications/solvers/discreteMethods/molecularDynamics/mdEquilibrationFoam/mdEquilibrationFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,10 +34,11 @@ Description int main(int argc, char *argv[]) { + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" -# include "setRootCase.H" -# include "createTime.H" -# include "createMesh.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nReading field U\n" << endl; volVectorField U @@ -57,9 +58,9 @@ int main(int argc, char *argv[]) moleculeCloud molecules(mesh, pot); -# include "temperatureAndPressureVariables.H" + #include "temperatureAndPressureVariables.H" -# include "readmdEquilibrationDict.H" + #include "readmdEquilibrationDict.H" label nAveragingSteps = 0; @@ -67,18 +68,17 @@ int main(int argc, char *argv[]) while (runTime.loop()) { - nAveragingSteps++; Info<< "Time = " << runTime.timeName() << endl; molecules.evolve(); -# include "meanMomentumEnergyAndNMols.H" + #include "meanMomentumEnergyAndNMols.H" -# include "temperatureAndPressure.H" + #include "temperatureAndPressure.H" -# include "temperatureEquilibration.H" + #include "temperatureEquilibration.H" runTime.write(); @@ -96,3 +96,6 @@ int main(int argc, char *argv[]) return 0; } + + +// ************************************************************************* // diff --git a/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C index 6bd90a8128..779172803d 100644 --- a/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C +++ b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,10 +34,11 @@ Description int main(int argc, char *argv[]) { + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" -# include "setRootCase.H" -# include "createTime.H" -# include "createMesh.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nReading field U\n" << endl; volVectorField U @@ -57,7 +58,7 @@ int main(int argc, char *argv[]) moleculeCloud molecules(mesh, pot); -# include "temperatureAndPressureVariables.H" + #include "temperatureAndPressureVariables.H" label nAveragingSteps = 0; @@ -65,16 +66,15 @@ int main(int argc, char *argv[]) while (runTime.loop()) { - nAveragingSteps++; Info<< "Time = " << runTime.timeName() << endl; molecules.evolve(); -# include "meanMomentumEnergyAndNMols.H" + #include "meanMomentumEnergyAndNMols.H" -# include "temperatureAndPressure.H" + #include "temperatureAndPressure.H" runTime.write(); @@ -92,3 +92,6 @@ int main(int argc, char *argv[]) return 0; } + + +// ************************************************************************* // diff --git a/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C b/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C index 151d17a398..1ec8b86022 100644 --- a/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C +++ b/applications/solvers/electromagnetics/magneticFoam/magneticFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,6 +38,7 @@ Description #include "OSspecific.H" #include "magnet.H" #include "electromagneticConstants.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,7 +66,8 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "createFields.H" - #include "readSIMPLEControls.H" + + simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,7 +75,7 @@ int main(int argc, char *argv[]) runTime++; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { solve(fvm::laplacian(murf, psi) + fvc::div(murf*Mrf)); } diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/UEqn.H index df6f90ac02..07f46ec998 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve ( diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C index c8542832dc..ce177dfeb9 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C @@ -48,7 +48,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,6 +64,8 @@ int main(int argc, char *argv[]) #include "CourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -73,19 +75,13 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readTimeControls.H" - #include "readPIMPLEControls.H" #include "CourantNo.H" #include "setDeltaT.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { - if (nOuterCorr != 1) + if (pimple.nOuterCorr() != 1) { p_rgh.storePrevIter(); } @@ -94,12 +90,15 @@ int main(int argc, char *argv[]) #include "TEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } } runTime.write(); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H index 363ac11fb1..8ac13dc93e 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H @@ -10,7 +10,7 @@ surfaceScalarField buoyancyPhi(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix p_rghEqn ( @@ -21,20 +21,10 @@ p_rghEqn.solve ( - mesh.solver - ( - p_rgh.select - ( - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ) + mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H index 9a53619af5..cbe464fc02 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H @@ -8,7 +8,7 @@ UEqn().relax(); - if (momentumPredictor) + if (simple.momentumPredictor()) { solve ( diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C index 1a5086e130..06d0f2df38 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,16 +61,16 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - p_rgh.storePrevIter(); // Pressure-velocity SIMPLE corrector diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H index 0e8ae4e793..5d643837ff 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H @@ -11,7 +11,7 @@ surfaceScalarField buoyancyPhi(rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix p_rghEqn ( @@ -22,7 +22,7 @@ p_rghEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H index c8b9f13180..7dff741e66 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H @@ -9,7 +9,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve ( diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index 161ebc509d..3c3eb76ac0 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -37,7 +37,7 @@ Description #include "basicRhoThermo.H" #include "turbulenceModel.H" #include "fixedGradientFvPatchFields.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,6 +53,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -60,7 +62,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPIMPLEControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -71,14 +72,9 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { - if (nOuterCorr != 1) + if (pimple.nOuterCorr() != 1) { p_rgh.storePrevIter(); } @@ -87,16 +83,19 @@ int main(int argc, char *argv[]) #include "hEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); - - rho = thermo.rho(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } } + rho = thermo.rho(); + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index 343ff2b800..b47d65b842 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -25,7 +25,7 @@ + fvc::div(phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix p_rghEqn ( @@ -35,20 +35,10 @@ p_rghEqn.solve ( - mesh.solver - ( - p_rgh.select - ( - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ) + mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { // Calculate the conservative fluxes phi += p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H index 5fbfb3f764..ca28910aaf 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H @@ -8,7 +8,7 @@ UEqn().relax(); - if (momentumPredictor) + if (simple.momentumPredictor()) { solve ( diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C index 5891efcbf8..d70b03a45b 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,6 +33,7 @@ Description #include "basicPsiThermo.H" #include "RASModel.H" #include "fixedGradientFvPatchFields.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,16 +46,16 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - p_rgh.storePrevIter(); rho.storePrevIter(); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 6f39aff1c1..17bf590f29 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -14,7 +14,7 @@ surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); phi -= buoyancyPhi; - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix p_rghEqn ( @@ -24,7 +24,7 @@ p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C index 51aaaadae3..70fc290088 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,6 +35,7 @@ Description #include "RASModel.H" #include "fixedGradientFvPatchFields.H" #include "radiationModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,16 +49,16 @@ int main(int argc, char *argv[]) #include "createRadiationModel.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - p_rgh.storePrevIter(); rho.storePrevIter(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index a0b356578b..262b9da61f 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C @@ -8,10 +8,10 @@ License This file is part of OpenFOAM. - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -19,8 +19,7 @@ License for more details. You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C index e25669e04a..1c7863c2ff 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C @@ -48,6 +48,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" +#include "simpleControl.H" template void zeroCells @@ -74,16 +75,16 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - p.storePrevIter(); laminarTransport.lookup("lambda") >> lambda; @@ -121,7 +122,7 @@ int main(int argc, char *argv[]) adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -131,7 +132,7 @@ int main(int argc, char *argv[]) pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi -= pEqn.flux(); } @@ -184,7 +185,7 @@ int main(int argc, char *argv[]) adjustPhi(phia, Ua, pa); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix paEqn ( @@ -194,7 +195,7 @@ int main(int argc, char *argv[]) paEqn.setReference(paRefCell, paRefValue); paEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phia -= paEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/UEqn.H index b897eec4b5..08c06d3f46 100644 --- a/applications/solvers/incompressible/pimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/UEqn.H @@ -11,7 +11,7 @@ UEqn().relax(); volScalarField rAU(1.0/UEqn().A()); -if (momentumPredictor) +if (pimple.momentumPredictor()) { solve(UEqn() == -fvc::grad(p)); } diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index 8326f35a6b..da9b7581bf 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -1,6 +1,6 @@ U = rAU*UEqn().H(); -if (nCorr <= 1) +if (pimple.nCorr() <= 1) { UEqn.clear(); } @@ -11,7 +11,7 @@ phi = (fvc::interpolate(U) & mesh.Sf()) adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop -for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) +for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { // Pressure corrector fvScalarMatrix pEqn @@ -23,18 +23,10 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) pEqn.solve ( - mesh.solver - ( - p.select - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H index 652773fea7..e43a40b94b 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H @@ -11,7 +11,7 @@ UEqn().relax(); rAU = 1.0/UEqn().A(); -if (momentumPredictor) +if (pimple.momentumPredictor()) { solve(UEqn() == -fvc::grad(p)); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H index f137c0027f..e112db4621 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H @@ -50,7 +50,7 @@ pcorrTypes ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pcorrEqn ( @@ -60,7 +60,7 @@ pcorrEqn.setReference(pRefCell, pRefValue); pcorrEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi -= pcorrEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H index 88a0056e77..7e84ef50fe 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H @@ -1,6 +1,6 @@ U = rAU*UEqn().H(); -if (nCorr <= 1) +if (pimple.nCorr() <= 1) { UEqn.clear(); } @@ -14,7 +14,7 @@ if (p.needReference()) fvc::makeAbsolute(phi, U); } -for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) +for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -25,20 +25,10 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) pEqn.solve ( - mesh.solver - ( - p.select - ( - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi -= pEqn.flux(); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C index 73f34858d4..3bedfc756d 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C @@ -36,7 +36,7 @@ Description #include "singlePhaseTransportModel.H" #include "turbulenceModel.H" #include "dynamicFvMesh.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,11 +46,12 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createDynamicFvMesh.H" - #include "readPIMPLEControls.H" #include "initContinuityErrs.H" #include "createFields.H" #include "readTimeControls.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -85,14 +86,9 @@ int main(int argc, char *argv[]) } // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { - if (nOuterCorr != 1) + if (pimple.nOuterCorr() != 1) { p.storePrevIter(); } @@ -100,12 +96,15 @@ int main(int argc, char *argv[]) #include "UEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } } runTime.write(); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H index 8789bd0ab4..8f48f5d7d4 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H @@ -1,9 +1,10 @@ #include "readTimeControls.H" - #include "readPIMPLEControls.H" + + const dictionary& pimpleDict = pimple.dict(); const bool correctPhi = - pimple.lookupOrDefault("correctPhi", false); + pimpleDict.lookupOrDefault("correctPhi", false); const bool checkMeshCourantNo = - pimple.lookupOrDefault("checkMeshCourantNo", false); + pimpleDict.lookupOrDefault("checkMeshCourantNo", false); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index d1b98ee10e..8d7bcc372d 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -35,7 +35,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "turbulenceModel.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,12 +47,15 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + pimpleControl pimple(mesh); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { #include "readTimeControls.H" - #include "readPIMPLEControls.H" #include "CourantNo.H" #include "setDeltaT.H" @@ -61,14 +64,9 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { - if (nOuterCorr != 1) + if (pimple.nOuterCorr() != 1) { p.storePrevIter(); } @@ -76,12 +74,15 @@ int main(int argc, char *argv[]) #include "UEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } } runTime.write(); diff --git a/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C b/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C index 197cb83ff9..a86a3977b3 100644 --- a/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C +++ b/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,6 +33,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,6 +45,8 @@ int main(int argc, char *argv[]) #include "readGravitationalAcceleration.H" #include "createFields.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -52,10 +55,10 @@ int main(int argc, char *argv[]) { Info<< "\n Time = " << runTime.timeName() << nl << endl; - #include "readPISOControls.H" #include "CourantNo.H" - for (int ucorr=0; ucorr. Application - rhoPisoTwinParcelFoam + MRFSimpleFoam Description - Transient solver for compressible, turbulent flow with two thermo-clouds. + Steady-state solver for incompressible, turbulent flow of non-Newtonian + fluids with MRF regions. \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "basicPsiThermo.H" -#include "turbulenceModel.H" - -#include "basicThermoCloud.H" -#include "basicKinematicCloud.H" +#include "singlePhaseTransportModel.H" +#include "RASModel.H" +#include "MRFZones.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,54 +44,32 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - #include "readGravitationalAcceleration.H" #include "createFields.H" - #include "createClouds.H" - #include "readPISOControls.H" #include "initContinuityErrs.H" - #include "readTimeControls.H" - #include "compressibleCourantNo.H" - #include "setInitialDeltaT.H" + + MRFZones mrfZones(mesh); + mrfZones.correctBoundaryVelocity(U); + + simpleControl simple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.run()) + while (simple.loop()) { - #include "readTimeControls.H" - #include "readPISOControls.H" - #include "compressibleCourantNo.H" - #include "setDeltaT.H" - - runTime++; - Info<< "Time = " << runTime.timeName() << nl << endl; - thermoCloud1.evolve(); + p.storePrevIter(); - kinematicCloud1.evolve(); - - - #include "rhoEqn.H" - - // --- PIMPLE loop - for (int ocorr=1; ocorr<=nOuterCorr; ocorr++) + // --- Pressure-velocity SIMPLE corrector { #include "UEqn.H" - - // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) - { - #include "hsEqn.H" - #include "pEqn.H" - } + #include "pEqn.H" } turbulence->correct(); - rho = thermo.rho(); - runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/files b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/files new file mode 100644 index 0000000000..56c194272d --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/files @@ -0,0 +1,3 @@ +MRFSimpleFoam.C + +EXE = $(FOAM_APPBIN)/MRFSimpleFoam diff --git a/tutorials/incompressible/MRFSimpleFoam/MRFSimpleFoam/Make/options b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/options similarity index 97% rename from tutorials/incompressible/MRFSimpleFoam/MRFSimpleFoam/Make/options rename to applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/options index 1223bdd06f..81310cc2e0 100644 --- a/tutorials/incompressible/MRFSimpleFoam/MRFSimpleFoam/Make/options +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I.. \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ -I$(LIB_SRC)/transportModels \ diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H new file mode 100644 index 0000000000..27d50944ce --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H @@ -0,0 +1,12 @@ + // Momentum predictor + + tmp UEqn + ( + fvm::div(phi, U) + + turbulence->divDevReff(U) + ); + mrfZones.addCoriolis(UEqn()); + + UEqn().relax(); + + solve(UEqn() == -fvc::grad(p)); diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H new file mode 100644 index 0000000000..81f5c20480 --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H @@ -0,0 +1,37 @@ +{ + p.boundaryField().updateCoeffs(); + + volScalarField rAU(1.0/UEqn().A()); + U = rAU*UEqn().H(); + UEqn.clear(); + + phi = fvc::interpolate(U, "interpolate(HbyA)") & mesh.Sf(); + mrfZones.relativeFlux(phi); + adjustPhi(phi, U, p); + + // Non-orthogonal pressure corrector loop + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) + { + fvScalarMatrix pEqn + ( + fvm::laplacian(rAU, p) == fvc::div(phi) + ); + + pEqn.setReference(pRefCell, pRefValue); + pEqn.solve(); + + if (nonOrth == simple.nNonOrthCorr()) + { + phi -= pEqn.flux(); + } + } + + #include "continuityErrs.H" + + // Explicitly relax pressure for momentum corrector + p.relax(); + + // Momentum corrector + U -= rAU*fvc::grad(p); + U.correctBoundaryConditions(); +} diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/Make/files b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/Make/files new file mode 100644 index 0000000000..3250f4139d --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/Make/files @@ -0,0 +1,3 @@ +SRFSimpleFoam.C + +EXE = $(FOAM_APPBIN)/SRFSimpleFoam diff --git a/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/Make/options b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/Make/options similarity index 97% rename from tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/Make/options rename to applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/Make/options index cc3cd5e731..66a349da05 100644 --- a/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/Make/options +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I.. \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ diff --git a/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/simpleSRFFoam.C b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/SRFSimpleFoam.C similarity index 90% rename from tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/simpleSRFFoam.C rename to applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/SRFSimpleFoam.C index aac457a468..d3b5067c4f 100644 --- a/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/simpleSRFFoam.C +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/SRFSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Application - simpleSRFFoam + SRFSimpleFoam Description Steady-state solver for incompressible, turbulent flow of non-Newtonian @@ -34,6 +34,7 @@ Description #include "singlePhaseTransportModel.H" #include "RASModel.H" #include "SRFModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,20 +46,19 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 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 + // --- Pressure-velocity SIMPLE corrector { #include "UrelEqn.H" #include "pEqn.H" @@ -87,8 +87,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/incompressible/simpleSRFFoam/simpleSRFFoam/UrelEqn.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/UrelEqn.H similarity index 57% rename from tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/UrelEqn.H rename to applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/UrelEqn.H index ac0bc044b7..38c64acb7b 100644 --- a/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/UrelEqn.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/UrelEqn.H @@ -1,4 +1,5 @@ // Relative momentum predictor + tmp UrelEqn ( fvm::div(phi, Urel) @@ -8,9 +9,4 @@ UrelEqn().relax(); - eqnResidual = solve - ( - UrelEqn() == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UrelEqn() == -fvc::grad(p)); diff --git a/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/createFields.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/createFields.H similarity index 100% rename from tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/createFields.H rename to applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/createFields.H diff --git a/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H similarity index 53% rename from tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/pEqn.H rename to applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H index b2bc37fd5d..beb73bd341 100644 --- a/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H @@ -1,34 +1,37 @@ { p.boundaryField().updateCoeffs(); - volScalarField AUrel = UrelEqn().A(); - Urel = UrelEqn().H()/AUrel; + + volScalarField rAUrel(1.0/UrelEqn().A()); + Urel = rAUrel*UrelEqn().H(); UrelEqn.clear(); - phi = fvc::interpolate(Urel) & mesh.Sf(); + + phi = fvc::interpolate(Urel, "interpolate(HbyA)") & mesh.Sf(); adjustPhi(phi, Urel, p); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( - fvm::laplacian(1.0/AUrel, p) == fvc::div(phi) + fvm::laplacian(rAUrel, p) == fvc::div(phi) ); pEqn.setReference(pRefCell, pRefValue); + pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi -= pEqn.flux(); - } + } } -# include "continuityErrs.H" + #include "continuityErrs.H" // Explicitly relax pressure for momentum corrector p.relax(); // Momentum corrector - Urel -= fvc::grad(p)/AUrel; + Urel -= rAUrel*fvc::grad(p); Urel.correctBoundaryConditions(); } diff --git a/applications/solvers/incompressible/simpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/UEqn.H index e6fb6bf89e..0ee8abf0be 100644 --- a/applications/solvers/incompressible/simpleFoam/UEqn.H +++ b/applications/solvers/incompressible/simpleFoam/UEqn.H @@ -1,4 +1,4 @@ - // Solve the Momentum equation + // Momentum predictor tmp UEqn ( diff --git a/applications/solvers/incompressible/simpleFoam/createFields.H b/applications/solvers/incompressible/simpleFoam/createFields.H index b957c72650..947da10c9d 100644 --- a/applications/solvers/incompressible/simpleFoam/createFields.H +++ b/applications/solvers/incompressible/simpleFoam/createFields.H @@ -26,14 +26,13 @@ mesh ); -# include "createPhi.H" + #include "createPhi.H" label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue); - singlePhaseTransportModel laminarTransport(U, phi); autoPtr turbulence diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index 0b1500213a..699cdcb3cf 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -1,24 +1,26 @@ +{ p.boundaryField().updateCoeffs(); - volScalarField AU(UEqn().A()); - U = UEqn().H()/AU; + volScalarField rAU(1.0/UEqn().A()); + U = rAU*UEqn().H(); UEqn.clear(); - phi = fvc::interpolate(U) & mesh.Sf(); + + phi = fvc::interpolate(U, "interpolate(HbyA)") & mesh.Sf(); adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( - fvm::laplacian(1.0/AU, p) == fvc::div(phi) + fvm::laplacian(rAU, p) == fvc::div(phi) ); pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi -= pEqn.flux(); } @@ -30,5 +32,6 @@ p.relax(); // Momentum corrector - U -= fvc::grad(p)/AU; + U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); +} diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H index d14adbb493..e4614b7063 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H @@ -6,13 +6,7 @@ if (pZones.size()) { // nUCorrectors for pressureImplicitPorosity - if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors")) - { - nUCorr = readInt - ( - mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors") - ); - } + nUCorr = simple.dict().lookupOrDefault("nUCorrectors", 0); if (nUCorr > 0) { diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H index a97ff3983c..5908396d18 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H @@ -11,7 +11,7 @@ UEqn.clear(); phi = fvc::interpolate(U) & mesh.Sf(); adjustPhi(phi, U, p); -for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) +for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++) { tmp tpEqn; @@ -35,7 +35,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) tpEqn().solve(); } - if (nonOrth == nNonOrthCorr) + if (nonOrth == simple.nNonOrthCorr()) { phi -= tpEqn().flux(); } diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C index 3507fded85..123fd811ea 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C @@ -34,6 +34,7 @@ Description #include "singlePhaseTransportModel.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 "createPorousZones.H" #include "initContinuityErrs.H" @@ -50,12 +54,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" - p.storePrevIter(); // Pressure-velocity SIMPLE corrector diff --git a/applications/solvers/incompressible/simpleFoam/simpleFoam.C b/applications/solvers/incompressible/simpleFoam/simpleFoam.C index fdb5fe0a9d..beb50f0f3f 100644 --- a/applications/solvers/incompressible/simpleFoam/simpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/simpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,19 +44,19 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (simple.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readSIMPLEControls.H" - p.storePrevIter(); - // Pressure-velocity SIMPLE corrector + // --- Pressure-velocity SIMPLE corrector { #include "UEqn.H" #include "pEqn.H" diff --git a/applications/solvers/incompressible/simpleFoam/windSimpleFoam/Make/files b/applications/solvers/incompressible/simpleFoam/windSimpleFoam/Make/files new file mode 100644 index 0000000000..d7fe780806 --- /dev/null +++ b/applications/solvers/incompressible/simpleFoam/windSimpleFoam/Make/files @@ -0,0 +1,3 @@ +windSimpleFoam.C + +EXE = $(FOAM_APPBIN)/windSimpleFoam diff --git a/tutorials/incompressible/simpleWindFoam/simpleWindFoam/Make/options b/applications/solvers/incompressible/simpleFoam/windSimpleFoam/Make/options similarity index 97% rename from tutorials/incompressible/simpleWindFoam/simpleWindFoam/Make/options rename to applications/solvers/incompressible/simpleFoam/windSimpleFoam/Make/options index 648de52f52..057788a483 100644 --- a/tutorials/incompressible/simpleWindFoam/simpleWindFoam/Make/options +++ b/applications/solvers/incompressible/simpleFoam/windSimpleFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I.. \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ -I$(LIB_SRC)/transportModels \ diff --git a/tutorials/incompressible/simpleWindFoam/simpleWindFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/windSimpleFoam/UEqn.H similarity index 63% rename from tutorials/incompressible/simpleWindFoam/simpleWindFoam/UEqn.H rename to applications/solvers/incompressible/simpleFoam/windSimpleFoam/UEqn.H index bc4a8a4cf7..dc4d5655cf 100644 --- a/tutorials/incompressible/simpleWindFoam/simpleWindFoam/UEqn.H +++ b/applications/solvers/incompressible/simpleFoam/windSimpleFoam/UEqn.H @@ -11,9 +11,4 @@ // Add resistance on the actuation disks actuationDisks.addSu(UEqn()); - eqnResidual = solve - ( - UEqn() == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); \ No newline at end of file + solve(UEqn() == -fvc::grad(p)); diff --git a/tutorials/incompressible/simpleWindFoam/simpleWindFoam/simpleWindFoam.C b/applications/solvers/incompressible/simpleFoam/windSimpleFoam/windSimpleFoam.C similarity index 94% rename from tutorials/incompressible/simpleWindFoam/simpleWindFoam/simpleWindFoam.C rename to applications/solvers/incompressible/simpleFoam/windSimpleFoam/windSimpleFoam.C index 16b422c783..f2d095ae8f 100644 --- a/tutorials/incompressible/simpleWindFoam/simpleWindFoam/simpleWindFoam.C +++ b/applications/solvers/incompressible/simpleFoam/windSimpleFoam/windSimpleFoam.C @@ -34,6 +34,7 @@ Description #include "singlePhaseTransportModel.H" #include "RASModel.H" #include "IObasicSourceList.H" +#include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,17 +46,18 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + IObasicSourceList actuationDisks(mesh); + + simpleControl simple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 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 @@ -71,9 +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/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C b/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C index 534c64bd9b..a9da394140 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C @@ -46,7 +46,7 @@ Description #include "timeActivatedExplicitSource.H" #include "SLGThermo.H" #include "fvcSmooth.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,6 +57,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "readGravitationalAcceleration.H" + + pimpleControl pimple(mesh); + #include "readTimeControls.H" #include "readAdditionalSolutionControls.H" #include "createFields.H" @@ -72,7 +75,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "readPIMPLEControls.H" #include "readChemistryProperties.H" #include "readAdditionalSolutionControls.H" #include "readTimeControls.H" @@ -89,14 +91,9 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { - if (nOuterCorr != 1) + if (pimple.nOuterCorr() != 1) { p.storePrevIter(); } @@ -108,7 +105,7 @@ int main(int argc, char *argv[]) #include "hsEqn.H" // --- PISO loop - for (int corr=0; corr("maxDeltaT", GREAT)); // Smoothing parameter (0-1) when smoothing iterations > 0 -scalar alphaTauSmooth +scalar rDeltaTSmoothingCoeff ( - runTime.controlDict().lookupOrDefault("alphaTauSmooth", 0.1) -); - -// Maximum change in cell density per iteration (relative to previous value) -scalar alphaTauRho -( - runTime.controlDict().lookupOrDefault("alphaTauRho", 0.05) -); - -// Maximum change in cell velocity per iteration (relative to previous value) -scalar alphaTauU -( - runTime.controlDict().lookupOrDefault("alphaTauU", 0.05) + pimple.dict().lookupOrDefault("rDeltaTSmoothingCoeff", 0.1) ); // Maximum change in cell temperature per iteration (relative to previous value) -scalar alphaTauTemp -( - runTime.controlDict().lookupOrDefault("alphaTauTemp", 0.05) -); - -// Max specie mass fraction that can be consumed/gained per chemistry -// integration step -scalar alphaTauSpecie -( - runTime.controlDict().lookupOrDefault("alphaTauSpecie", 0.05) -); - -// Maximum unboundedness allowed (fraction of 1) -scalar specieMaxUnbound -( - runTime.controlDict().lookupOrDefault("specieMaxUnbound", 0.01) -); +scalar alphaTemp(pimple.dict().lookupOrDefault("alphaTemp", 0.05)); // ************************************************************************* // diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/timeScales.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/timeScales.H index 2f8e036554..e6d0fa85c4 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/timeScales.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/timeScales.H @@ -28,40 +28,40 @@ Info<< "Time scales min/max:" << endl; { // Cache old time scale field - tmp tinvTau0 + tmp trDeltaT ( new volScalarField ( IOobject ( - "invTau0", + "rDeltaT0", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ), - invTau + rDeltaT ) ); - const volScalarField& invTau0 = tinvTau0(); + const volScalarField& rDeltaT0 = trDeltaT(); // Flow time scale // ~~~~~~~~~~~~~~~ { - invTau = + rDeltaT = fvc::surfaceSum ( mag(phi)*mesh.deltaCoeffs()/(maxCo*mesh.magSf()) ) /rho; - invTau.max(1.0/maxDeltaT); + rDeltaT.max(1.0/maxDeltaT); Info<< " Flow = " - << gMin(1/invTau.internalField()) << ", " - << gMax(1/invTau.internalField()) << endl; + << gMin(1/rDeltaT.internalField()) << ", " + << gMax(1/rDeltaT.internalField()) << endl; } @@ -82,12 +82,12 @@ Info<< "Time scales min/max:" << endl; /rho ); - tau = alphaTauTemp*thermo.Cp()*T/(tau + ROOTVSMALL); + tau = alphaTemp*thermo.Cp()*T/(tau + ROOTVSMALL); Info<< " Temperature = " << min(maxDeltaT, gMin(tau)) << ", " << min(maxDeltaT, gMax(tau)) << endl; - invTau.internalField() = max(invTau.internalField(), 1/tau); + rDeltaT.internalField() = max(rDeltaT.internalField(), 1/tau); } @@ -95,21 +95,20 @@ Info<< "Time scales min/max:" << endl; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // - reduce as much as required for flow, but limit source contributions const dimensionedScalar deltaTRamp("deltaTRamp", dimless, 1/(1 + 0.2)); - invTau = max(invTau, invTau0*deltaTRamp); - tinvTau0.clear(); + rDeltaT = max(rDeltaT, rDeltaT0*deltaTRamp); // Limit the largest time scale // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - invTau.max(1/maxDeltaT); + rDeltaT.max(1/maxDeltaT); // Spatially smooth the time scale field // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - fvc::smooth(invTau, alphaTauSmooth); + fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); - Info<< " Overall = " << min(1/invTau).value() - << ", " << max(1/invTau).value() << nl << endl; + Info<< " Overall = " << min(1/rDeltaT).value() + << ", " << max(1/rDeltaT).value() << nl << endl; } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/Make/options b/applications/solvers/lagrangian/coalChemistryFoam/Make/options index ab0bd2c08a..f2f8d1e758 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/Make/options +++ b/applications/solvers/lagrangian/coalChemistryFoam/Make/options @@ -19,7 +19,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/ODE/lnInclude + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(FOAM_SOLVERS)/combustion/reactingFoam + EXE_LIBS = \ -lfiniteVolume \ @@ -43,4 +46,5 @@ EXE_LIBS = \ -lradiationModels \ -lregionModels \ -lsurfaceFilmModels \ - -lODE + -lODE \ + -lsampling diff --git a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H index d58b74ab9c..e7f242fa5f 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/chemistry.H b/applications/solvers/lagrangian/coalChemistryFoam/chemistry.H deleted file mode 100644 index a1a5cb39ba..0000000000 --- a/applications/solvers/lagrangian/coalChemistryFoam/chemistry.H +++ /dev/null @@ -1,32 +0,0 @@ -if (chemistry.chemistry()) -{ - Info<< "Solving chemistry" << endl; - - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - if (turbulentReaction) - { - DimensionedField tk - ( - Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon()) - ); - DimensionedField tc - ( - chemistry.tc()().dimensionedInternalField() - ); - - // Chalmers PaSR model - kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk); - } - else - { - kappa = 1.0; - } - - chemistrySh = kappa*chemistry.Sh()(); -} diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index b1f8b99a31..3d0eabcef8 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -45,7 +45,7 @@ Description #include "timeActivatedExplicitSource.H" #include "radiationModel.H" #include "SLGThermo.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,6 +65,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -72,7 +74,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -91,25 +92,23 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } rho = thermo.rho(); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H index 0e5cb3e1fe..de0c04577a 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); U = rAU*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -28,18 +28,10 @@ if (transonic) pEqn.solve ( - mesh.solver - ( - p.select - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -54,7 +46,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -67,18 +59,10 @@ else pEqn.solve ( - mesh.solver - ( - p.select - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelDyMFoam/Make/options b/applications/solvers/lagrangian/icoUncoupledKinematicParcelDyMFoam/Make/options index f7bb7d2f2d..0786933541 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelDyMFoam/Make/options +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelDyMFoam/Make/options @@ -14,7 +14,8 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ @@ -33,4 +34,5 @@ EXE_LIBS = \ -lsurfaceFilmModels \ -ldynamicMesh \ -ldynamicFvMesh \ - -ltopoChangerFvMesh + -ltopoChangerFvMesh \ + -lsampling diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options index 1de2ec74de..58d80278f8 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options @@ -12,6 +12,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ -llagrangian \ @@ -26,4 +27,5 @@ EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lregionModels \ - -lsurfaceFilmModels + -lsurfaceFilmModels \ + -lsampling diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options index 1ff1aaa612..f2dffe2998 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options @@ -19,7 +19,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(FOAM_SOLVERS)/combustion/reactingFoam + EXE_LIBS = \ -lfiniteVolume \ @@ -42,4 +45,5 @@ EXE_LIBS = \ -lradiationModels \ -lODE \ -lregionModels \ - -lsurfaceFilmModels + -lsurfaceFilmModels \ + -lsampling diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H index 35394576f8..e52431f1e8 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 (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/chemistry.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/chemistry.H deleted file mode 100644 index 1690487b45..0000000000 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/chemistry.H +++ /dev/null @@ -1,31 +0,0 @@ -{ - Info<< "Solving chemistry" << endl; - - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - if (turbulentReaction) - { - DimensionedField tk - ( - Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon()) - ); - DimensionedField tc - ( - chemistry.tc()().dimensionedInternalField() - ); - - // Chalmers PaSR model - kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk); - } - else - { - kappa = 1.0; - } - - chemistrySh = kappa*chemistry.Sh()(); -} diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H index 27921d6396..63d746fe79 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H @@ -32,7 +32,7 @@ + massSource.SuTot() ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -42,17 +42,10 @@ pEqn.solve ( - mesh.solver - ( - p.select - ( - corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C index 35dfc7e616..638d83da0c 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,6 +49,7 @@ Description #include "porousZones.H" #include "timeActivatedExplicitSource.H" #include "SLGThermo.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,6 +71,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -77,7 +80,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" @@ -90,17 +92,25 @@ int main(int argc, char *argv[]) #include "chemistry.H" #include "rhoEqn.H" - #include "UEqn.H" - #include "YEqn.H" - #include "hsEqn.H" - // --- PISO loop - for (int corr=0; corrcorrect(); + // --- PISO loop + for (int corr=0; corrcorrect(); + } + } rho = thermo.rho(); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options index 1efc598b5b..6e225cc092 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options @@ -18,7 +18,10 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ - -I$(LIB_SRC)/ODE/lnInclude + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(FOAM_SOLVERS)/combustion/reactingFoam + EXE_LIBS = \ -lfiniteVolume \ @@ -37,4 +40,5 @@ EXE_LIBS = \ -lradiationModels \ -lsurfaceFilmModels \ -llagrangianIntermediate \ - -lODE + -lODE \ + -lsampling diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H index 2e8f979be4..a64e50a2d2 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H @@ -4,13 +4,23 @@ + fvm::div(phi, U) + turbulence->divDevRhoReff(U) == - rho.dimensionedInternalField()*g - + parcels.SU(U) + parcels.SU(U) ); UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { - solve(UEqn == -fvc::grad(p)); + solve + ( + UEqn + == + fvc::reconstruct + ( + ( + - ghf*fvc::snGrad(rho) + - fvc::snGrad(p_rgh) + )*mesh.magSf() + ) + ); } diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H index 8526b590a2..db79376614 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H @@ -5,7 +5,7 @@ tmp > mvConvection mesh, fields, phi, - mesh.divScheme("div(phi,Yi_h)") + mesh.divScheme("div(phi,Yi_hs)") ) ); @@ -23,7 +23,7 @@ tmp > mvConvection ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - - fvm::laplacian(turbulence->muEff(), Yi) + - fvm::laplacian(turbulence->alphaEff(), Yi) == parcels.SYi(i, Yi) + surfaceFilm.Srho(i) diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/chemistry.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/chemistry.H deleted file mode 100644 index 5dd7ce9cb0..0000000000 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/chemistry.H +++ /dev/null @@ -1,31 +0,0 @@ -{ - Info << "Solving chemistry" << endl; - - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - if (turbulentReaction) - { - DimensionedField tk - ( - Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon()) - ); - DimensionedField tc - ( - chemistry.tc()().dimensionedInternalField() - ); - - // Chalmers PaSR model - kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk); - } - else - { - kappa = 1.0; - } - - chemistrySh = kappa*chemistry.Sh()(); -} diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H index 2e3208b0ee..a5a87c73ef 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H @@ -15,11 +15,6 @@ const word inertSpecie(thermo.lookup("inertSpecie")); - volScalarField& p = thermo.p(); - volScalarField& hs = thermo.hs(); - const volScalarField& T = thermo.T(); - const volScalarField& psi = thermo.psi(); - Info<< "Creating field rho\n" << endl; volScalarField rho ( @@ -34,6 +29,11 @@ thermo.rho() ); + volScalarField& p = thermo.p(); + volScalarField& hs = thermo.hs(); + const volScalarField& T = thermo.T(); + const volScalarField& psi = thermo.psi(); + Info<< "\nReading field U\n" << endl; volVectorField U ( @@ -84,6 +84,28 @@ fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p) ); + + Info<< "Calculating field g.h\n" << endl; + volScalarField gh("gh", g & mesh.C()); + + surfaceScalarField ghf("gh", g & mesh.Cf()); + + volScalarField p_rgh + ( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + // Force p_rgh to be consistent with p + p_rgh = p - rho*gh; + multivariateSurfaceInterpolationScheme::fieldTable fields; forAll(Y, i) diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H index 0cb2318252..feb112f652 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H @@ -19,4 +19,6 @@ thermo.correct(); radiation->correct(); + + Info<< "min/max(T) = " << min(T).value() << ", " << max(T).value() << endl; } diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H index 9d028d4502..bbfb5be051 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H @@ -1,74 +1,50 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); +surfaceScalarField rhorAUf(rAU.name(), fvc::interpolate(rho*rAU)); U = rAU*UEqn.H(); -if (transonic) +surfaceScalarField phiU +( + fvc::interpolate(rho) + *( + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rAU, rho, U, phi) + ) +); + +phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf(); + +for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { - surfaceScalarField phid + fvScalarMatrix p_rghEqn ( - "phid", - fvc::interpolate(psi) - *( - (fvc::interpolate(U) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU, rho, U, phi) - ) + fvc::ddt(psi, rho)*gh + + fvc::div(phi) + + fvm::ddt(psi, p_rgh) + - fvm::laplacian(rhorAUf, p_rgh) + == + parcels.Srho() + + surfaceFilm.Srho() ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + p_rghEqn.solve + ( + mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) + ); + + if (nonOrth == pimple.nNonOrthCorr()) { - fvScalarMatrix pEqn - ( - fvm::ddt(psi, p) - + fvm::div(phid, p) - - fvm::laplacian(rho*rAU, p) - == - parcels.Srho() - + surfaceFilm.Srho() - ); - - pEqn.solve(); - - if (nonOrth == nNonOrthCorr) - { - phi == pEqn.flux(); - } + phi += p_rghEqn.flux(); } } -else -{ - phi = - fvc::interpolate(rho) - *( - (fvc::interpolate(U) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU, rho, U, phi) - ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) - { - fvScalarMatrix pEqn - ( - fvm::ddt(psi, p) - + fvc::div(phi) - - fvm::laplacian(rho*rAU, p) - == - parcels.Srho() - + surfaceFilm.Srho() - ); - - pEqn.solve(); - - if (nonOrth == nNonOrthCorr) - { - phi += pEqn.flux(); - } - } -} +p = p_rgh + rho*gh; #include "rhoEqn.H" #include "compressibleContinuityErrs.H" -U -= rAU*fvc::grad(p); +U += rAU*fvc::reconstruct((phi - phiU)/rhorAUf); U.correctBoundaryConditions(); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C index f788da57e4..6ae930c7a7 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,6 +39,7 @@ Description #include "chemistrySolver.H" #include "radiationModel.H" #include "SLGThermo.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,6 +60,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -66,8 +69,8 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" + #include "setMultiRegionDeltaT.H" #include "setDeltaT.H" runTime++; @@ -84,24 +87,24 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- PIMPLE loop - for (int ocorr=1; ocorr<=nOuterCorr; ocorr++) + for (pimple.start(); pimple.loop(); pimple++) { #include "UEqn.H" #include "YEqn.H" + #include "hsEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + for (int corr=1; corr<=pimple.nCorr(); corr++) { - #include "hsEqn.H" #include "pEqn.H" } - Info<< "T gas min/max = " << min(T).value() << ", " - << max(T).value() << endl; + if (pimple.turbCorr()) + { + turbulence->correct(); + } } - turbulence->correct(); - rho = thermo.rho(); if (runTime.write()) diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/setMultiRegionDeltaT.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/setMultiRegionDeltaT.H new file mode 100644 index 0000000000..037a09f93d --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/setMultiRegionDeltaT.H @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Global + setMultiRegionDeltaT + +Description + Reset the timestep to maintain a constant maximum Courant numbers. + Reduction of time-step is immediate, but increase is damped to avoid + unstable oscillations. + +\*---------------------------------------------------------------------------*/ + +if (adjustTimeStep) +{ + if (CoNum == -GREAT) + { + CoNum = SMALL; + } + + const scalar TFactorFluid = maxCo/(CoNum + SMALL); + const scalar TFactorFilm = maxCo/(surfaceFilm.CourantNumber() + SMALL); + + const scalar dt0 = runTime.deltaTValue(); + + runTime.setDeltaT + ( + min + ( + dt0*min(min(TFactorFluid, TFactorFilm), 1.2), + maxDeltaT + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/Make/options index fb54b88e26..fc312bb5fa 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/Make/options @@ -18,7 +18,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(FOAM_SOLVERS)/combustion/reactingFoam + EXE_LIBS = \ -lfiniteVolume \ @@ -41,4 +44,5 @@ EXE_LIBS = \ -lradiationModels \ -lODE \ -lregionModels \ - -lsurfaceFilmModels + -lsurfaceFilmModels \ + -lsampling diff --git a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H index 2e8f979be4..31e00d8f35 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/chemistry.H b/applications/solvers/lagrangian/reactingParcelFoam/chemistry.H deleted file mode 100644 index 1690487b45..0000000000 --- a/applications/solvers/lagrangian/reactingParcelFoam/chemistry.H +++ /dev/null @@ -1,31 +0,0 @@ -{ - Info<< "Solving chemistry" << endl; - - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - if (turbulentReaction) - { - DimensionedField tk - ( - Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon()) - ); - DimensionedField tc - ( - chemistry.tc()().dimensionedInternalField() - ); - - // Chalmers PaSR model - kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk); - } - else - { - kappa = 1.0; - } - - chemistrySh = kappa*chemistry.Sh()(); -} diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index 15999a1798..3bf304cecc 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); U = rAU*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -28,18 +28,10 @@ if (transonic) pEqn.solve ( - mesh.solver - ( - p.select - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi == pEqn.flux(); } @@ -54,7 +46,7 @@ else + fvc::ddtPhiCorr(rAU, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -67,18 +59,10 @@ else pEqn.solve ( - mesh.solver - ( - p.select - ( - pimpleCorr.finalIter() - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index f938d0f22b..ae2a06a363 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -38,7 +38,7 @@ Description #include "chemistrySolver.H" #include "radiationModel.H" #include "SLGThermo.H" -#include "pimpleLoop.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,6 +58,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -65,7 +67,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -79,28 +80,26 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop - for - ( - pimpleLoop pimpleCorr(mesh, nOuterCorr); - pimpleCorr.loop(); - pimpleCorr++ - ) + for (pimple.start(); pimple.loop(); pimple++) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" // --- PISO loop - for (int corr=0; corrcorrect(); - - rho = thermo.rho(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } } + rho = thermo.rho(); + if (runTime.write()) { chemistry.dQ()().write(); diff --git a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options index d302015a31..7a7ddc0432 100644 --- a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options +++ b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options @@ -9,7 +9,8 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ -llagrangian \ @@ -24,4 +25,5 @@ EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lregionModels \ - -lsurfaceFilmModels + -lsurfaceFilmModels \ + -lsampling diff --git a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C index 8c509ab72c..d028a1376f 100644 --- a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C +++ b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,6 +34,7 @@ Description #include "nearWallDist.H" #include "wallFvPatch.H" #include "Switch.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,6 +48,8 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -58,26 +61,32 @@ int main(int argc, char *argv[]) #include "readBubbleFoamControls.H" #include "CourantNo.H" - #include "alphaEqn.H" - #include "liftDragCoeffs.H" - #include "UEqns.H" - - // --- PISO loop - - for (int corr=0; corr(currPatch)) { - const scalarField& nuw = nutb.boundaryField()[patchi]; + const scalarField& nutbw = nutb.boundaryField()[patchi]; - scalarField magFaceGradU(mag(U.boundaryField()[patchi].snGrad())); + scalarField magFaceGradU(mag(Ub.boundaryField()[patchi].snGrad())); forAll(currPatch, facei) { @@ -43,7 +44,7 @@ scalar yPlus = Cmu25*y[patchi][facei] *::sqrt(k[faceCelli]) - /nub.value(); + /nub_; // For corner cells (with two boundary or more faces), @@ -59,7 +60,7 @@ if (yPlus > 11.6) { G[faceCelli] += - nuw[facei]*magFaceGradU[facei] + (nutbw[facei] + nub_)*magFaceGradU[facei] *Cmu25*::sqrt(k[faceCelli]) /(kappa_*y[patchi][facei]); } diff --git a/applications/solvers/multiphase/cavitatingFoam/UEqn.H b/applications/solvers/multiphase/cavitatingFoam/UEqn.H index 01911faaa3..9a5761b59f 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 2e35e0bfc3..64eb38f71e 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ Description #include "barotropicCompressibilityModel.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,6 +53,8 @@ int main(int argc, char *argv[]) #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" + pimpleControl pimple(mesh); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -65,19 +68,22 @@ int main(int argc, char *argv[]) runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; - for (int outerCorr=0; outerCorrcorrect(); + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } runTime.write(); diff --git a/applications/solvers/multiphase/cavitatingFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/pEqn.H index 6b6fc73eb9..c604539cde 100644 --- a/applications/solvers/multiphase/cavitatingFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/pEqn.H @@ -1,5 +1,5 @@ { - if (nOuterCorr == 1) + if (pimple.nOuterCorr() == 1) { p = ( @@ -26,7 +26,7 @@ #include "resetPhivPatches.H" - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix pEqn ( @@ -37,16 +37,12 @@ - fvm::laplacian(rAUf, p) ); - if (corr == nCorr-1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solver(p.name() + "Final")); - } - else - { - pEqn.solve(mesh.solver(p.name())); - } + pEqn.solve + ( + mesh.solver(p.select(pimple.finalInnerIter(corr, nonOrth))) + ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { phiv += (phiGradp + pEqn.flux())/rhof; } @@ -82,9 +78,9 @@ U = HbyA - rAU*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 f53e7b9eb1..234478955b 100644 --- a/applications/solvers/multiphase/cavitatingFoam/readControls.H +++ b/applications/solvers/multiphase/cavitatingFoam/readControls.H @@ -4,6 +4,3 @@ scalar maxAcousticCo ( readScalar(runTime.controlDict().lookup("maxAcousticCo")) ); - - -#include "readPISOControls.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H index 320953ab6f..257f6d48b5 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 7645b2d4aa..9161c80563 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H @@ -1,13 +1,7 @@ { - label nAlphaCorr - ( - readLabel(piso.lookup("nAlphaCorr")) - ); + label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - label nAlphaSubCycles - ( - readLabel(piso.lookup("nAlphaSubCycles")) - ); + label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); surfaceScalarField phic(mag(phi/mesh.magSf())); phic = min(interface.cAlpha()*phic, max(phic)); @@ -36,7 +30,7 @@ #include "alphaEqns.H" } - if (oCorr == 0) + if (pimple.corr() == 0) { interface.correct(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H index a973c23dfe..532d2bcc05 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/alphaEqnsSubCycle.H @@ -1,13 +1,7 @@ { - label nAlphaCorr - ( - readLabel(piso.lookup("nAlphaCorr")) - ); + label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - label nAlphaSubCycles - ( - readLabel(piso.lookup("nAlphaSubCycles")) - ); + label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); surfaceScalarField phic(mag(phi/mesh.magSf())); phic = min(interface.cAlpha()*phic, max(phic)); @@ -38,7 +32,7 @@ #include "alphaEqns.H" } - if (oCorr == 0) + if (pimple.corr() == 0) { interface.correct(); } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index a6fe17ee9b..2adf446fda 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,6 +44,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,6 +54,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createDynamicFvMesh.H" #include "readGravitationalAcceleration.H" + + pimpleControl pimple(mesh); + #include "readControls.H" #include "initContinuityErrs.H" #include "createFields.H" @@ -113,7 +117,7 @@ int main(int argc, char *argv[]) turbulence->correct(); // --- Outer-corrector loop - for (int oCorr=0; oCorr p_rghEqnComp; - if (transonic) + if (pimple.transonic()) { p_rghEqnComp = ( @@ -39,7 +39,7 @@ - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); - for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix p_rghEqnIncomp ( @@ -55,18 +55,10 @@ ) *p_rghEqnComp() + p_rghEqnIncomp, - mesh.solver - ( - p_rgh.select - ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { dgdt = (pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1)) diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H index a2e4ef3747..38bacbf4ea 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H @@ -1,17 +1,10 @@ - #include "readPISOControls.H" - #include "readTimeControls.H" + #include "readTimeControls.H" - label nAlphaCorr - ( - readLabel(piso.lookup("nAlphaCorr")) - ); + label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - label nAlphaSubCycles - ( - readLabel(piso.lookup("nAlphaSubCycles")) - ); + label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); - if (nAlphaSubCycles > 1 && nOuterCorr != 1) + if (nAlphaSubCycles > 1 && pimple.nOuterCorr() != 1) { FatalErrorIn(args.executable()) << "Sub-cycling alpha is only allowed for PISO, " @@ -19,14 +12,8 @@ << 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/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 4aed5e9c07..d8204d7f2d 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,6 +51,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "readGravitationalAcceleration.H" + + pimpleControl pimple(mesh); + #include "readControls.H" #include "initContinuityErrs.H" #include "createFields.H" @@ -71,7 +75,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; // --- Outer-corrector loop - for (int oCorr=0; oCorrcorrect(); + } } rho = alpha1*rho1 + alpha2*rho2; - turbulence->correct(); - runTime.write(); Info<< "ExecutionTime = " diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index 047f2f3c4c..28c42abe79 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -4,7 +4,7 @@ tmp p_rghEqnComp; - if (transonic) + if (pimple.transonic()) { p_rghEqnComp = ( @@ -39,7 +39,7 @@ - ghf*fvc::snGrad(rho) )*rAUf*mesh.magSf(); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++) { fvScalarMatrix p_rghEqnIncomp ( @@ -55,18 +55,10 @@ ) *p_rghEqnComp() + p_rghEqnIncomp, - mesh.solver - ( - p_rgh.select - ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) + mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth))) ); - if (nonOrth == nNonOrthCorr) + if (nonOrth == pimple.nNonOrthCorr()) { 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 7e23354f47..954fcb27f2 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/readControls.H @@ -1,17 +1,16 @@ - #include "readPISOControls.H" #include "readTimeControls.H" 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 && nOuterCorr != 1) + if (nAlphaSubCycles > 1 && pimple.nOuterCorr() != 1) { FatalErrorIn(args.executable()) << "Sub-cycling alpha is only allowed for PISO, " diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C index 7f28e63e94..10ea651604 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,6 +44,7 @@ Description #include "twoPhaseMixture.H" #include "turbulenceModel.H" #include "fvcSmooth.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,9 +53,11 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - #include "readPISOControls.H" #include "initContinuityErrs.H" #include "createFields.H" + + pimpleControl pimple(mesh); + #include "correctPhi.H" #include "CourantNo.H" #include "setInitialrDeltaT.H" @@ -65,8 +68,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "readPISOControls.H" - runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; @@ -76,13 +77,19 @@ int main(int argc, char *argv[]) twoPhaseProperties.correct(); #include "alphaEqnSubCycle.H" - turbulence->correct(); - #include "UEqn.H" - // --- PISO loop - for (int corr=0; corrcorrect(); + + // --- Pressure-velocity PIMPLE corrector loop + for (pimple.start(); pimple.loop(); pimple++) { - #include "pEqn.H" + #include "UEqn.H" + + // --- PISO loop + for (int corr=0; corr 1) { diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/setInitialrDeltaT.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/setInitialrDeltaT.H index 210c65627d..c7ac175848 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/setInitialrDeltaT.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/setInitialrDeltaT.H @@ -1,6 +1,6 @@ scalar maxDeltaT ( - piso.lookupOrDefault("maxDeltaT", GREAT) + pimple.dict().lookupOrDefault("maxDeltaT", GREAT) ); volScalarField rDeltaT diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H index 208d01b484..8525a8bf67 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H @@ -1,52 +1,54 @@ { + const dictionary& pimpleDict = pimple.dict(); + scalar maxCo ( - piso.lookupOrDefault("maxCo", 0.9) + pimpleDict.lookupOrDefault("maxCo", 0.9) ); scalar maxAlphaCo ( - piso.lookupOrDefault("maxAlphaCo", 0.2) + pimpleDict.lookupOrDefault("maxAlphaCo", 0.2) ); scalar rDeltaTSmoothingCoeff ( - piso.lookupOrDefault("rDeltaTSmoothingCoeff", 0.1) + pimpleDict.lookupOrDefault("rDeltaTSmoothingCoeff", 0.1) ); label nAlphaSpreadIter ( - piso.lookupOrDefault