From 42c61d36a3765207b916b93d1a2ffdc2674df66c Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Sat, 9 Apr 2016 18:17:55 +0200 Subject: [PATCH 01/55] Backport setReference from vanilla 3.0.1 --- .../solvers/basic/potentialDyMFoam/correctPhi.H | 4 +++- .../solvers/engine/icoDyMEngineFoam/correctPhi.H | 4 +++- .../solvers/engine/turbDyMEngineFoam/correctPhi.H | 4 +++- .../solvers/immersedBoundary/interIbFoam/correctPhi.H | 2 ++ .../solvers/incompressible/icoDyMFoam/correctPhi.H | 4 +++- .../incompressible/icoDyMSimpleFoam/correctPhi.H | 2 ++ .../solvers/incompressible/icoFoam/createFields.H | 1 + .../solvers/incompressible/pimpleDyMFoam/correctPhi.H | 10 ++++++---- .../multiphase/compressibleInterDyMFoam/correctPhi.H | 4 +++- .../solvers/multiphase/interDyMFoam/correctPhi.H | 2 ++ .../solvers/multiphase/interFoam/correctPhi.H | 2 ++ .../multiphase/interPhaseChangeFoam/correctPhi.H | 2 ++ src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C | 11 +++++++++++ src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H | 4 +++- .../incompressible/icoFoam/cavity/system/fvSchemes | 6 ------ 15 files changed, 46 insertions(+), 16 deletions(-) diff --git a/applications/solvers/basic/potentialDyMFoam/correctPhi.H b/applications/solvers/basic/potentialDyMFoam/correctPhi.H index 9a32c5ecc..6c78a0960 100644 --- a/applications/solvers/basic/potentialDyMFoam/correctPhi.H +++ b/applications/solvers/basic/potentialDyMFoam/correctPhi.H @@ -34,7 +34,9 @@ fvc::makeAbsolute(phi, U); } - for(int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + mesh.setFluxRequired(pcorr.name()); + + for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pcorrEqn ( diff --git a/applications/solvers/engine/icoDyMEngineFoam/correctPhi.H b/applications/solvers/engine/icoDyMEngineFoam/correctPhi.H index 0f6422d53..15ce43ec7 100644 --- a/applications/solvers/engine/icoDyMEngineFoam/correctPhi.H +++ b/applications/solvers/engine/icoDyMEngineFoam/correctPhi.H @@ -24,7 +24,9 @@ pcorrTypes ); - phi = (fvc::interpolate(U) & mesh.Sf()); + phi = fvc::interpolate(U) & mesh.Sf(); + + mesh.setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/engine/turbDyMEngineFoam/correctPhi.H b/applications/solvers/engine/turbDyMEngineFoam/correctPhi.H index 0f6422d53..15ce43ec7 100644 --- a/applications/solvers/engine/turbDyMEngineFoam/correctPhi.H +++ b/applications/solvers/engine/turbDyMEngineFoam/correctPhi.H @@ -24,7 +24,9 @@ pcorrTypes ); - phi = (fvc::interpolate(U) & mesh.Sf()); + phi = fvc::interpolate(U) & mesh.Sf(); + + mesh.setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/immersedBoundary/interIbFoam/correctPhi.H b/applications/solvers/immersedBoundary/interIbFoam/correctPhi.H index cf979e1d1..9945bf708 100644 --- a/applications/solvers/immersedBoundary/interIbFoam/correctPhi.H +++ b/applications/solvers/immersedBoundary/interIbFoam/correctPhi.H @@ -36,6 +36,8 @@ immersedBoundaryAdjustPhi(phi, U); adjustPhi(phi, U, pcorr); + mesh.setFluxRequired(pcorr.name()); + for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pcorrEqn diff --git a/applications/solvers/incompressible/icoDyMFoam/correctPhi.H b/applications/solvers/incompressible/icoDyMFoam/correctPhi.H index 9a32c5ecc..6c78a0960 100644 --- a/applications/solvers/incompressible/icoDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/icoDyMFoam/correctPhi.H @@ -34,7 +34,9 @@ fvc::makeAbsolute(phi, U); } - for(int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + mesh.setFluxRequired(pcorr.name()); + + for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pcorrEqn ( diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H b/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H index 69978f0e6..3f9a190d4 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H @@ -24,6 +24,8 @@ pcorrTypes ); + mesh.setFluxRequired(pcorr.name()); + for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pcorrEqn diff --git a/applications/solvers/incompressible/icoFoam/createFields.H b/applications/solvers/incompressible/icoFoam/createFields.H index 6a7d6b9a8..f2374b961 100644 --- a/applications/solvers/incompressible/icoFoam/createFields.H +++ b/applications/solvers/incompressible/icoFoam/createFields.H @@ -53,3 +53,4 @@ label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H index ce45e1bd3..27d7c9113 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H @@ -7,7 +7,7 @@ zeroGradientFvPatchScalarField::typeName ); - for (label i = 0; i < p.boundaryField().size(); i++) + for (label i=0; i Date: Sat, 9 Apr 2016 22:55:19 +0200 Subject: [PATCH 02/55] Modified pisoFoam according to vanilla 3.0.1 --- .../incompressible/pisoFoam/pisoFoam.C | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/applications/solvers/incompressible/pisoFoam/pisoFoam.C b/applications/solvers/incompressible/pisoFoam/pisoFoam.C index 5dadd3953..67f634291 100644 --- a/applications/solvers/incompressible/pisoFoam/pisoFoam.C +++ b/applications/solvers/incompressible/pisoFoam/pisoFoam.C @@ -34,15 +34,19 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "turbulenceModel.H" +#include "pisoControl.H" +#include "fvOptions.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { # include "setRootCase.H" - # include "createTime.H" # include "createMesh.H" + + pisoControl piso(mesh); + # include "createFields.H" # include "initContinuityErrs.H" @@ -54,7 +58,6 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPISOControls.H" # include "CourantNo.H" // Pressure-velocity PISO corrector @@ -70,14 +73,14 @@ int main(int argc, char *argv[]) UEqn.relax(); - if (momentumPredictor) + if (piso.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); } // --- PISO loop - for (int corr = 0; corr < nCorr; corr++) + while (piso.correct()) { volScalarField rUA = 1.0/UEqn.A(); @@ -88,7 +91,7 @@ int main(int argc, char *argv[]) adjustPhi(phi, U, p); // Non-orthogonal pressure corrector loop - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + while (piso.correctNonOrthogonal()) { // Pressure corrector @@ -99,11 +102,7 @@ int main(int argc, char *argv[]) pEqn.setReference(pRefCell, pRefValue); - if - ( - corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) + if (piso.finalInnerIter()) { pEqn.solve(mesh.solutionDict().solver("pFinal")); } @@ -112,7 +111,7 @@ int main(int argc, char *argv[]) pEqn.solve(); } - if (nonOrth == nNonOrthCorr) + if (piso.finalNonOrthogonalIter()) { phi -= pEqn.flux(); } From 964b873d22e1d9a40fcf1543b52af1e3ffdd31af Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Sat, 9 Apr 2016 23:07:25 +0200 Subject: [PATCH 03/55] Added solutionControl class from vanilla 3.0.1 --- src/finiteVolume/Make/files | 6 + .../pimpleControl/pimpleControl.C | 239 +++++++++++++++++ .../pimpleControl/pimpleControl.H | 163 ++++++++++++ .../pimpleControl/pimpleControlI.H | 101 ++++++++ .../solutionControl/pisoControl/pisoControl.C | 50 ++++ .../solutionControl/pisoControl/pisoControl.H | 86 +++++++ .../simpleControl/simpleControl.C | 157 ++++++++++++ .../simpleControl/simpleControl.H | 111 ++++++++ .../solutionControl/solutionControl.C | 242 ++++++++++++++++++ .../solutionControl/solutionControl.H | 231 +++++++++++++++++ .../solutionControl/solutionControlI.H | 98 +++++++ .../solutionControlTemplates.C | 62 +++++ 12 files changed, 1546 insertions(+) create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControlI.H create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.C create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.H create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.H create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlI.H create mode 100644 src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 3fb994320..1c0fe963a 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -396,6 +396,12 @@ $(general)/findRefCell/findRefCell.C $(general)/adjustPhi/adjustPhi.C $(general)/bound/bound.C +solutionControl = $(general)/solutionControl +$(solutionControl)/solutionControl/solutionControl.C +$(solutionControl)/simpleControl/simpleControl.C +$(solutionControl)/pimpleControl/pimpleControl.C +$(solutionControl)/pisoControl/pisoControl.C + porousMedia = $(general)/porousMedia $(porousMedia)/porousZone.C $(porousMedia)/porousZones.C diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C new file mode 100644 index 000000000..94ef2a965 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C @@ -0,0 +1,239 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "pimpleControl.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(pimpleControl, 0); +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::pimpleControl::read() +{ + solutionControl::read(false); + + // Read solution controls + const dictionary& pimpleDict = dict(); + nCorrPIMPLE_ = pimpleDict.lookupOrDefault