From 38177526ffd9719f34fcc0cec9339c301b1f461d Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 29 May 2015 11:30:40 +0100 Subject: [PATCH] simpleFoam/SRFSimpleFoam: Added support for SIMPLEC SIMPLEC (SIMPLE-consistent) is selected by setting "consistent" option true/yes: SIMPLE { nNonOrthogonalCorrectors 0; consistent yes; } which relaxes the pressure in a "consistent" manner and additional relaxation of the pressure is not generally necessary. In addition convergence of the p-U system is better and reliable with less aggressive relaxation of the momentum equation, e.g. for the motorbike tutorial: relaxationFactors { equations { U 0.9; k 0.7; omega 0.7; } } The cost per iteration is marginally higher but the convergence rate is better so the number of iterations can be reduced. The SIMPLEC algorithm also provides benefit for cases with large body-forces, e.g. SRF, see tutorials/incompressible/SRFSimpleFoam/mixer and feature request http://www.openfoam.org/mantisbt/view.php?id=1714 --- .../simpleFoam/SRFSimpleFoam/pEqn.H | 17 +++++++++-- .../solvers/incompressible/simpleFoam/pEqn.H | 19 ++++++++---- .../solutionControl/solutionControl.C | 18 +++++++---- .../solutionControl/solutionControl.H | 10 ++++++- .../solutionControl/solutionControlI.H | 8 ++++- .../SRFSimpleFoam/mixer/system/fvSolution | 12 ++------ .../SRFSimpleFoam/mixer/turbulenceProperties | 30 ------------------- .../simpleFoam/motorBike/system/fvSolution | 7 ++--- 8 files changed, 60 insertions(+), 61 deletions(-) delete mode 100644 tutorials/incompressible/SRFSimpleFoam/mixer/turbulenceProperties diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H index b9fa52c0ff..50691c0154 100644 --- a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H @@ -2,17 +2,28 @@ volScalarField rAUrel(1.0/UrelEqn().A()); volVectorField HbyA("HbyA", Urel); HbyA = rAUrel*UrelEqn().H(); - UrelEqn.clear(); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); adjustPhi(phiHbyA, Urel, p); + tmp rAtUrel(rAUrel); + + if (simple.consistent()) + { + rAtUrel = 1.0/(1.0/rAUrel - UrelEqn().H1()); + phiHbyA += + fvc::interpolate(rAtUrel() - rAUrel)*fvc::snGrad(p)*mesh.magSf(); + HbyA -= (rAUrel - rAtUrel())*fvc::grad(p); + } + + UrelEqn.clear(); + // Non-orthogonal pressure corrector loop while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( - fvm::laplacian(rAUrel, p) == fvc::div(phiHbyA) + fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); @@ -31,7 +42,7 @@ p.relax(); // Momentum corrector - Urel = HbyA - rAUrel*fvc::grad(p); + Urel = HbyA - rAtUrel()*fvc::grad(p); Urel.correctBoundaryConditions(); fvOptions.correct(Urel); } diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index 4d669c8db2..fddb3b05d4 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -2,20 +2,29 @@ volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); HbyA = rAU*UEqn().H(); - UEqn.clear(); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); - fvOptions.makeRelative(phiHbyA); - adjustPhi(phiHbyA, U, p); + tmp rAtU(rAU); + + if (simple.consistent()) + { + rAtU = 1.0/(1.0/rAU - UEqn().H1()); + phiHbyA += + fvc::interpolate(rAtU() - rAU)*fvc::snGrad(p)*mesh.magSf(); + HbyA -= (rAU - rAtU())*fvc::grad(p); + } + + UEqn.clear(); + // Non-orthogonal pressure corrector loop while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( - fvm::laplacian(rAU, p) == fvc::div(phiHbyA) + fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); @@ -34,7 +43,7 @@ p.relax(); // Momentum corrector - U = HbyA - rAU*fvc::grad(p); + U = HbyA - rAtU()*fvc::grad(p); U.correctBoundaryConditions(); fvOptions.correct(U); } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C index 8448153a69..8e3dd89075 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,16 +37,21 @@ namespace Foam void Foam::solutionControl::read(const bool absTolOnly) { - const dictionary& solnDict = this->dict(); + const dictionary& solutionDict = this->dict(); // Read solution controls nNonOrthCorr_ = - solnDict.lookupOrDefault