From c9fea670b6e3180b492bd54e7201ecfda21f716e Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Fri, 27 May 2016 22:07:30 +0200 Subject: [PATCH] Backported lagrangian solvers and tutorials (vanilla OF 3.0.1) --- .../lagrangian/coalChemistryFoam/UEqn.H | 2 +- .../coalChemistryFoam/coalChemistryFoam.C | 9 ++++++--- .../coalChemistryFoam/createFields.H | 2 ++ .../lagrangian/coalChemistryFoam/pEqn.H | 10 +++++----- .../UEqn.H | 2 +- .../createFields.H | 2 ++ .../pEqn.H | 13 +++---------- .../porousExplicitSourceReactingParcelFoam.C | 7 +++++-- .../lagrangian/reactingParcelFoam/UEqn.H | 2 +- .../reactingParcelFoam/createFields.H | 2 ++ .../lagrangian/reactingParcelFoam/pEqn.H | 10 +++++----- .../reactingParcelFoam/reactingParcelFoam.C | 9 ++++++--- .../simplifiedSiwek/constant/polyMesh/boundary | 4 ++-- .../simplifiedSiwek/system/fvSchemes | 8 +------- .../simplifiedSiwek/system/fvSolution | 2 +- .../constant/polyMesh/boundary | 5 ++--- .../channelParticles/system/fvSchemes | 6 ------ .../icoLagrangianFoam/createFields.H | 2 ++ .../icoLagrangianFoam/icoLagrangianFoam.C | 11 +++++++---- .../filter/Allclean | 2 +- .../filter/constant/polyMesh/boundary | 18 +++++++++--------- .../filter/system/fvSchemes | 8 +------- .../parcelInBox/0/G | 4 ++++ .../parcelInBox/0/H2O | 4 ++++ .../parcelInBox/0/T | 4 ++++ .../parcelInBox/0/U | 4 ++++ .../parcelInBox/0/air | 4 ++++ .../parcelInBox/0/p | 4 ++++ .../parcelInBox/constant/polyMesh/boundary | 4 ++-- .../parcelInBox/system/fvSchemes | 8 +------- .../verticalChannel/system/fvSchemes | 8 +------- .../evaporationTest/constant/polyMesh/boundary | 4 ++-- .../evaporationTest/system/fvSchemes | 8 +------- .../evaporationTest/system/fvSolution | 2 +- .../rhoPisoTwinParcelFoam/UEqn.H | 2 +- .../rhoPisoTwinParcelFoam/createFields.H | 2 ++ .../rhoPisoTwinParcelFoam/pEqn.H | 10 +++++----- .../rhoPisoTwinParcelFoam.C | 12 +++++++----- .../simplifiedSiwek/constant/polyMesh/boundary | 4 ++-- .../simplifiedSiwek/system/fvSchemes | 8 +------- .../simplifiedSiwek/system/fvSolution | 2 +- 41 files changed, 116 insertions(+), 118 deletions(-) diff --git a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H index b02a7c61e..deb710cce 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H @@ -11,7 +11,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 4d031e521..570327101 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -44,6 +44,7 @@ Description #include "chemistrySolver.H" #include "timeActivatedExplicitSource.H" #include "radiationModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,6 +54,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" + + pimpleControl pimple(mesh); + #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" @@ -70,7 +74,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -89,14 +92,14 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- PIMPLE loop - for (int ocorr=1; ocorr<=nOuterCorr; ocorr++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + while (pimple.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H index 65be09775..12a6e9548 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H @@ -149,3 +149,5 @@ mesh, dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H index b31ad45ed..9878707eb 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rUA = 1.0/UEqn.A(); U = rUA*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -28,7 +28,7 @@ if (transonic) pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -43,7 +43,7 @@ else + fvc::ddtPhiCorr(rUA, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -56,7 +56,7 @@ else pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H index e77fe75da..f46d1d902 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H @@ -12,7 +12,7 @@ pZones.addResistance(UEqn); - if (momentumPredictor) + if (piso.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H index cf3f484bd..7a5b48ac9 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H @@ -103,3 +103,5 @@ mesh, dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H index 43d677609..ff590e59e 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H @@ -23,7 +23,7 @@ ); } - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -35,16 +35,9 @@ + massSource.SuTot() ); - if (corr == nCorr-1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solutionDict().solver("pFinal")); - } - else - { - pEqn.solve(); - } + pEqn.solve(mesh.solutionDict().solver(p.select(piso.finalInnerIter()))); - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C index de63f2fbb..68ef32448 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C @@ -49,6 +49,7 @@ Description #include "radiationModel.H" #include "porousZones.H" #include "timeActivatedExplicitSource.H" +#include "pisoControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,6 +59,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" + + pisoControl piso(mesh); + #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" @@ -77,7 +81,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "readAdditionalSolutionControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -95,7 +98,7 @@ int main(int argc, char *argv[]) #include "hsEqn.H" // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { #include "pEqn.H" } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H index 3c4a92709..1c1c1fd0c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H @@ -10,7 +10,7 @@ UEqn.relax(); - if (momentumPredictor) + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H index e071ac8b3..9579be78c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H @@ -109,3 +109,5 @@ mesh, dimensionedScalar("chemistry::Sh", dimEnergy/dimTime/dimVolume, 0.0) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index d27afcce8..50185f5fc 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -3,7 +3,7 @@ rho = thermo.rho(); volScalarField rUA = 1.0/UEqn.A(); U = rUA*UEqn.H(); -if (transonic) +if (pimple.transonic()) { surfaceScalarField phid ( @@ -15,7 +15,7 @@ if (transonic) ) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -28,7 +28,7 @@ if (transonic) pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi == pEqn.flux(); } @@ -43,7 +43,7 @@ else + fvc::ddtPhiCorr(rUA, rho, U, phi) ); - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -56,7 +56,7 @@ else pEqn.solve(); - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi += pEqn.flux(); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index 154774cca..93971a15b 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -37,6 +37,7 @@ Description #include "psiChemistryModel.H" #include "chemistrySolver.H" #include "radiationModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,6 +47,9 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" + + pimpleControl pimple(mesh); + #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" @@ -63,7 +67,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -77,13 +80,13 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" // --- PIMPLE loop - for (int ocorr=1; ocorr<=nOuterCorr; ocorr++) + while (pimple.loop()) { #include "UEqn.H" #include "YEqn.H" // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) + while (pimple.correct()) { #include "hsEqn.H" #include "pEqn.H" diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/polyMesh/boundary b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/polyMesh/boundary index dff7e8226..eedf0fdb7 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/polyMesh/boundary +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes index c538134fd..d98d660a2 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSchemes @@ -36,7 +36,7 @@ divSchemes div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(U) Gauss linear; - div((muEff*dev2(grad(U).T()))) Gauss linear; + div((muEff*dev2(T(grad(U))))) Gauss linear; div(phi,Yi_h) Gauss upwind; } @@ -62,10 +62,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p ; -} - // ************************************************************************* // diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution index e48e0f6b4..d459df935 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution @@ -50,7 +50,7 @@ solvers } } -PISO +PIMPLE { transonic yes; nCorrectors 2; diff --git a/tutorials/lagrangian/icoLagrangianFoam/channelParticles/constant/polyMesh/boundary b/tutorials/lagrangian/icoLagrangianFoam/channelParticles/constant/polyMesh/boundary index 0beee5a65..8e0826950 100644 --- a/tutorials/lagrangian/icoLagrangianFoam/channelParticles/constant/polyMesh/boundary +++ b/tutorials/lagrangian/icoLagrangianFoam/channelParticles/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 3.2 | +| \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | +| \\/ M anipulation | For copyright notice see file Copyright | \*---------------------------------------------------------------------------*/ FoamFile { @@ -38,7 +38,6 @@ FoamFile frontAndBack { type empty; - physicalType empty; nFaces 2000; startFace 2110; } diff --git a/tutorials/lagrangian/icoLagrangianFoam/channelParticles/system/fvSchemes b/tutorials/lagrangian/icoLagrangianFoam/channelParticles/system/fvSchemes index 277df7d18..e807e470c 100644 --- a/tutorials/lagrangian/icoLagrangianFoam/channelParticles/system/fvSchemes +++ b/tutorials/lagrangian/icoLagrangianFoam/channelParticles/system/fvSchemes @@ -49,10 +49,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p; -} - // ************************************************************************* // diff --git a/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/createFields.H b/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/createFields.H index 794eb514b..54c52cb09 100644 --- a/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/createFields.H +++ b/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/createFields.H @@ -53,6 +53,8 @@ label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + mesh.schemesDict().setFluxRequired(p.name()); + dimensionedScalar rhoVal ( transportProperties.lookup("rho") diff --git a/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/icoLagrangianFoam.C b/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/icoLagrangianFoam.C index 34efa82f2..36f4462a0 100644 --- a/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/icoLagrangianFoam.C +++ b/tutorials/lagrangian/icoLagrangianFoam/icoLagrangianFoam/icoLagrangianFoam.C @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "pisoControl.H" #include "basicKinematicCloud.H" @@ -42,6 +43,9 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pisoControl piso(mesh); + # include "createFields.H" # include "initContinuityErrs.H" @@ -53,7 +57,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPISOControls.H" # include "CourantNo.H" Info<< "Evolving kinematicCloud" << endl; @@ -73,7 +76,7 @@ int main(int argc, char *argv[]) // --- PISO loop - for (int corr=0; corr