diff --git a/applications/solvers/combustion/engineFoam/pEqn.H b/applications/solvers/combustion/engineFoam/pEqn.H index 2f6333cc9761b89834245073ac3edfad744a318f..bd12a82495b7b8bb8ee00733d5cc374c6b44a0d6 100644 --- a/applications/solvers/combustion/engineFoam/pEqn.H +++ b/applications/solvers/combustion/engineFoam/pEqn.H @@ -91,10 +91,7 @@ K = 0.5*magSqr(U); { rhoUf = fvc::interpolate(rho*U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - rhoUf += - mesh.Sf() - *(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf)) - /sqr(mesh.magSf()); + rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf)); } if (thermo.dpdt()) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H index fd892bb9327e766841defe9190cfedaa49d382b1..1c58a02c33950e10054b8a9748c25278d939f114 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H @@ -107,10 +107,7 @@ K = 0.5*magSqr(U); { rhoUf = fvc::interpolate(rho*U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - rhoUf += - mesh.Sf() - *(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf)) - /sqr(mesh.magSf()); + rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf)); } if (thermo.dpdt()) diff --git a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/pEqn.H b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/pEqn.H index 65afd1aeb88642cae2b880ac21ba6951bab763f0..4799f6456728144ee8a1327dc2fbb064b2cd8df0 100644 --- a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/pEqn.H +++ b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/pEqn.H @@ -42,8 +42,5 @@ U.correctBoundaryConditions(); { rhoUf = fvc::interpolate(rho*U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - rhoUf += - mesh.Sf() - *(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf)) - /sqr(mesh.magSf()); + rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf)); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H index 7ecfe1f66236e7458835eb35dde5a76a7038b573..e2938bdb949776932b8e15d11e405fc52cb26553 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H @@ -51,7 +51,7 @@ fvOptions.correct(U); { Uf = fvc::interpolate(U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf()); + Uf += n*(phi/mesh.magSf() - (n & Uf)); } // Make the fluxes relative to the mesh motion diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H index b10c24aa0b7c86eb281cea29e612929b31e1ad50..d23ec0f95058a2ea46ee547ba9833b2e4851e9e9 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H @@ -93,10 +93,7 @@ K = 0.5*magSqr(U); { rhoUf = fvc::interpolate(rho*U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - rhoUf += - mesh.Sf() - *(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf)) - /sqr(mesh.magSf()); + rhoUf += n*(fvc::absolute(phi, rho, U)/mesh.magSf() - (n & rhoUf)); } if (thermo.dpdt()) diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H index 0f0d5768414323fb1df135a80b7bd1b5e27d2832..a0e0e6c74dc740175847af7d89fd41388a3dbb38 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H @@ -85,6 +85,6 @@ { Uf = fvc::interpolate(U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - Uf += mesh.Sf()*(phiv - (mesh.Sf() & Uf))/sqr(mesh.magSf()); + Uf += n*(phiv/mesh.magSf() - (n & Uf)); } } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H index c86921371f52ec96f0cff265257110280f460546..a014a5ab4edcc2ca517b2552ed655bca42297b6c 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H @@ -114,7 +114,7 @@ { Uf = fvc::interpolate(U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf()); + Uf += n*(phi/mesh.magSf() - (n & Uf)); } // Make the fluxes relative to the mesh motion diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index 0a3d7ed11e97ed60f03d44a5b8e61705d303c4f5..ba7b4efa9ae1094b0e14f3c5a43d7a76868a3102 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -55,10 +55,10 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); #include "createFields.H" - #include "createUf.H" #include "readTimeControls.H" #include "createPrghCorrTypes.H" #include "correctPhi.H" + #include "createUf.H" #include "CourantNo.H" #include "setInitialDeltaT.H" diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H index c30b361e72f9badfc98172483c455fc469552275..76441207919fe4427f6734750ff4de1a26c544f4 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H @@ -67,7 +67,7 @@ { Uf = fvc::interpolate(U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf()); + Uf += n*(phi/mesh.magSf() - (n & Uf)); } // Make the fluxes relative to the mesh motion diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C index 0bfd8ad56eab6c4ca652b238ec5f4e8c36a3847b..810edeff308fb8ee57549e504f71aeb2a53b7ac4 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C @@ -65,10 +65,10 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); #include "createFields.H" - #include "createUf.H" #include "readTimeControls.H" #include "createPcorrTypes.H" #include "../interFoam/interDyMFoam/correctPhi.H" + #include "createUf.H" #include "CourantNo.H" #include "setInitialDeltaT.H" diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H index 7863f5d74851ebba806897821174ff43b6484bea..6fac1df95c2236b94da9914f01a8de5416ed230f 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H @@ -68,7 +68,7 @@ { Uf = fvc::interpolate(U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); - Uf += mesh.Sf()*(phi - (mesh.Sf() & Uf))/sqr(mesh.magSf()); + Uf += n*(phi/mesh.magSf() - (n & Uf)); } // Make the fluxes relative to the mesh motion diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H index c2414b0f8bc24a44a14a4421f8368a2a437d939f..4291dbde4b6b205793000128b3ae0fb065738b6e 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,6 +125,9 @@ public: //- Maximum number of iterations in the solver label maxIter_; + //- Minimum number of iterations in the solver + label minIter_; + //- Final convergence tolerance Type tolerance_; diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C index 50831a0ec94afeac0f52aeca75926b7e31ad5a90..fcd1400d591f744b998b2fe65eb64537491b7890 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,6 +135,7 @@ Foam::LduMatrix<Type, DType, LUType>::solver::solver controlDict_(solverDict), maxIter_(1000), + minIter_(0), tolerance_(1e-6*pTraits<Type>::one), relTol_(pTraits<Type>::zero) { @@ -148,6 +149,7 @@ template<class Type, class DType, class LUType> void Foam::LduMatrix<Type, DType, LUType>::solver::readControls() { readControl(controlDict_, maxIter_, "maxIter"); + readControl(controlDict_, minIter_, "minIter"); readControl(controlDict_, tolerance_, "tolerance"); readControl(controlDict_, relTol_, "relTol"); } diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C index 7ee6da05dcf6bd6c733164fe77e85773b9296469..6a9b1779dd974acf5edaddd97dd3435fc581085b 100644 --- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C +++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -104,7 +104,11 @@ Foam::PBiCCCG<Type, DType, LUType>::solve solverPerf.finalResidual() = solverPerf.initialResidual(); // --- Check convergence, solve if not converged - if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_)) + if + ( + this->minIter_ > 0 + || !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + ) { // --- Select and construct the preconditioner autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner> @@ -182,8 +186,11 @@ Foam::PBiCCCG<Type, DType, LUType>::solve } while ( - solverPerf.nIterations()++ < this->maxIter_ - && !(solverPerf.checkConvergence(this->tolerance_, this->relTol_)) + ( + solverPerf.nIterations()++ < this->maxIter_ + && !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + ) + || solverPerf.nIterations() < this->minIter_ ); } diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C index cc8f1d1c72b1eb0398f6c35dd3775409150e7f1c..5eeba9660554a81d654218d1cf49b9bc25ede14f 100644 --- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C +++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,7 +92,11 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const solverPerf.finalResidual() = solverPerf.initialResidual(); // --- Check convergence, solve if not converged - if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_)) + if + ( + this->minIter_ > 0 + || !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + ) { // --- Select and construct the preconditioner autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner> @@ -174,8 +178,11 @@ Foam::PCICG<Type, DType, LUType>::solve(Field<Type>& psi) const } while ( - solverPerf.nIterations()++ < this->maxIter_ - && !(solverPerf.checkConvergence(this->tolerance_, this->relTol_)) + ( + solverPerf.nIterations()++ < this->maxIter_ + && !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + ) + || solverPerf.nIterations() < this->minIter_ ); } diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C index 9cf5c81223b71386ed7f40a0737045a30766a57d..5dea9207d6c6fa619f609e154544f67485bec5df 100644 --- a/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C +++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,7 +113,11 @@ Foam::SmoothSolver<Type, DType, LUType>::solve(Field<Type>& psi) const // Check convergence, solve if not converged - if (!solverPerf.checkConvergence(this->tolerance_, this->relTol_)) + if + ( + this->minIter_ > 0 + || !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + ) { autoPtr<typename LduMatrix<Type, DType, LUType>::smoother> smootherPtr = LduMatrix<Type, DType, LUType>::smoother::New @@ -140,8 +144,11 @@ Foam::SmoothSolver<Type, DType, LUType>::solve(Field<Type>& psi) const ); } while ( - (solverPerf.nIterations() += nSweeps_) < this->maxIter_ - && !(solverPerf.checkConvergence(this->tolerance_, this->relTol_)) + ( + (solverPerf.nIterations() += nSweeps_) < this->maxIter_ + && !solverPerf.checkConvergence(this->tolerance_, this->relTol_) + ) + || solverPerf.nIterations() < this->minIter_ ); } } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C index fd9c43da08dead04f1f4bac3b7a0a12bec88512b..b8bc5c930c5fa900a692516ed1db45a3f232c8bc 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C @@ -31,7 +31,7 @@ License namespace Foam { -defineTypeNameAndDebug(lduMatrix, 1); + defineTypeNameAndDebug(lduMatrix, 1); } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index a75668dfddbfb086c1c9485f63132a86426d2d31..fdaf834a74c5889c69f4a3ce846834040ac32a04 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -107,6 +107,9 @@ public: //- Maximum number of iterations in the solver label maxIter_; + //- Minimum number of iterations in the solver + label minIter_; + //- Final convergence tolerance scalar tolerance_; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index cee5c1dc2f1d30ce7441ce2834927d710ec5136d..aed21fe9f734e4a9fff93760c5c51a37fe363bd9 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -164,6 +164,7 @@ Foam::lduMatrix::solver::solver void Foam::lduMatrix::solver::readControls() { maxIter_ = controlDict_.lookupOrDefault<label>("maxIter", 1000); + minIter_ = controlDict_.lookupOrDefault<label>("minIter", 0); tolerance_ = controlDict_.lookupOrDefault<scalar>("tolerance", 1e-6); relTol_ = controlDict_.lookupOrDefault<scalar>("relTol", 0); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C index 32602d3f1c6ea1dcd638f2c6b0e07871581a8ddc..5b58b1c438d83cb7a89271e40262337eb85b9e41 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C @@ -69,7 +69,11 @@ Foam::solverPerformance Foam::GAMGSolver::solve // Check convergence, solve if not converged - if (!solverPerf.checkConvergence(tolerance_, relTol_)) + if + ( + minIter_ > 0 + || !solverPerf.checkConvergence(tolerance_, relTol_) + ) { // Create coarse grid correction fields PtrList<scalarField> coarseCorrFields; @@ -131,8 +135,11 @@ Foam::solverPerformance Foam::GAMGSolver::solve } } while ( - ++solverPerf.nIterations() < maxIter_ - && !(solverPerf.checkConvergence(tolerance_, relTol_)) + ( + ++solverPerf.nIterations() < maxIter_ + && !solverPerf.checkConvergence(tolerance_, relTol_) + ) + || solverPerf.nIterations() < minIter_ ); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C b/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C index 1a221013e3abf5fbdd5cf80c630840aedefef768..3b6bbb88ff79132deadff44479feea97a2d83390 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C @@ -120,7 +120,11 @@ Foam::solverPerformance Foam::PBiCG::solve solverPerf.finalResidual() = solverPerf.initialResidual(); // --- Check convergence, solve if not converged - if (!solverPerf.checkConvergence(tolerance_, relTol_)) + if + ( + minIter_ > 0 + || !solverPerf.checkConvergence(tolerance_, relTol_) + ) { // --- Select and construct the preconditioner autoPtr<lduMatrix::preconditioner> preconPtr = @@ -192,8 +196,11 @@ Foam::solverPerformance Foam::PBiCG::solve /normFactor; } while ( - solverPerf.nIterations()++ < maxIter_ - && !(solverPerf.checkConvergence(tolerance_, relTol_)) + ( + solverPerf.nIterations()++ < maxIter_ + && !solverPerf.checkConvergence(tolerance_, relTol_) + ) + || solverPerf.nIterations() < minIter_ ); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C b/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C index b3d0c3d4f1b6e55034b0e13f0e9919a63fa20a27..a684c2ecf18dc31e9c3f8f292685794cce633f62 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C @@ -111,7 +111,11 @@ Foam::solverPerformance Foam::PCG::solve solverPerf.finalResidual() = solverPerf.initialResidual(); // --- Check convergence, solve if not converged - if (!solverPerf.checkConvergence(tolerance_, relTol_)) + if + ( + minIter_ > 0 + || !solverPerf.checkConvergence(tolerance_, relTol_) + ) { // --- Select and construct the preconditioner autoPtr<lduMatrix::preconditioner> preconPtr = @@ -177,8 +181,11 @@ Foam::solverPerformance Foam::PCG::solve } while ( - solverPerf.nIterations()++ < maxIter_ - && !(solverPerf.checkConvergence(tolerance_, relTol_)) + ( + solverPerf.nIterations()++ < maxIter_ + && !solverPerf.checkConvergence(tolerance_, relTol_) + ) + || solverPerf.nIterations() < minIter_ ); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C index a83ceaca3ece7df4448e00879e1cd78887833b2c..d073e73c372d51e7cf647dd6e42bde6da64d5efd 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C @@ -138,7 +138,11 @@ Foam::solverPerformance Foam::smoothSolver::solve // Check convergence, solve if not converged - if (!solverPerf.checkConvergence(tolerance_, relTol_)) + if + ( + minIter_ > 0 + || !solverPerf.checkConvergence(tolerance_, relTol_) + ) { autoPtr<lduMatrix::smoother> smootherPtr = lduMatrix::smoother::New ( @@ -176,8 +180,11 @@ Foam::solverPerformance Foam::smoothSolver::solve )/normFactor; } while ( - (solverPerf.nIterations() += nSweeps_) < maxIter_ - && !(solverPerf.checkConvergence(tolerance_, relTol_)) + ( + (solverPerf.nIterations() += nSweeps_) < maxIter_ + && !solverPerf.checkConvergence(tolerance_, relTol_) + ) + || solverPerf.nIterations() < minIter_ ); } } diff --git a/src/finiteVolume/cfdTools/compressible/createRhoUf.H b/src/finiteVolume/cfdTools/compressible/createRhoUf.H index e91115ae75b2a5b9a6e6f932352c8129bc4b693f..312aec60dca9cdaffbd448bd17b3053e9731a3fe 100644 --- a/src/finiteVolume/cfdTools/compressible/createRhoUf.H +++ b/src/finiteVolume/cfdTools/compressible/createRhoUf.H @@ -46,9 +46,14 @@ surfaceVectorField rhoUf IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), - linearInterpolate(rho*U) + fvc::interpolate(rho*U) ); +{ + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + rhoUf += n*(phi/mesh.magSf() - (n & rhoUf)); +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/src/finiteVolume/cfdTools/incompressible/createUf.H b/src/finiteVolume/cfdTools/incompressible/createUf.H index aab92ce0e2aec37304bd634f72bcbee68ed80189..0b65f2daed23a820fd4850cea3852e61d4ddf21d 100644 --- a/src/finiteVolume/cfdTools/incompressible/createUf.H +++ b/src/finiteVolume/cfdTools/incompressible/createUf.H @@ -46,9 +46,15 @@ surfaceVectorField Uf IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), - linearInterpolate(U) + fvc::interpolate(U) ); +{ + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + Uf += n*(phi/mesh.magSf() - (n & Uf)); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif