diff --git a/applications/solvers/combustion/engineFoam/pEqn.H b/applications/solvers/combustion/engineFoam/pEqn.H index 2f6333cc97..bd12a82495 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 fd892bb932..1c58a02c33 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 65afd1aeb8..4799f64567 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 7ecfe1f662..e2938bdb94 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 b10c24aa0b..d23ec0f950 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 0f0d576841..a0e0e6c74d 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 c86921371f..a014a5ab4e 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 0a3d7ed11e..ba7b4efa9a 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 c30b361e72..7644120791 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 0bfd8ad56e..810edeff30 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 7863f5d748..6fac1df95c 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/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index cdbe770d1a..66bc3bcb11 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -83,6 +83,7 @@ label addPatch pp.inGroups().append(groupName); } + // Add patch, create calculated everywhere fvMeshTools::addPatch ( @@ -207,7 +208,10 @@ void createFaces } else { - // Use neighbour side of face + // Use neighbour side of face. + // To keep faceZone pointing out of original neighbour + // we don't need to set faceFlip since that cell + // now becomes the owner modifyOrAddFace ( meshMod, @@ -217,7 +221,7 @@ void createFaces true, // face flip newMasterPatches[i], // patch for face fZone.index(), // zone for face - true, // face flip in zone + false, // face flip in zone modifiedFace // modify or add status ); } @@ -264,7 +268,7 @@ void createFaces false, // face flip newSlavePatches[i], // patch for face fZone.index(), // zone for face - false, // face flip in zone + true, // face flip in zone modifiedFace // modify or add status ); } @@ -633,18 +637,17 @@ int main(int argc, char *argv[]) // Note: This is added for the particular case where we want // master and slave in different groupNames // (ie 3D thermal baffles) - bool groupBase = false; - if (patchSource.found("groupBase")) - { - groupBase = readBool(patchSource.lookup("groupBase")); - if (groupBase) - { - groupNameMaster = groupName + "Group_master"; - groupNameSlave = groupName + "Group_slave"; - patchDictMaster.set("coupleGroup", groupNameMaster); - patchDictSlave.set("coupleGroup", groupNameSlave); - } + Switch sameGroup + ( + patchSource.lookupOrDefault("sameGroup", true) + ); + if (!sameGroup) + { + groupNameMaster = groupName + "Group_master"; + groupNameSlave = groupName + "Group_slave"; + patchDictMaster.set("coupleGroup", groupNameMaster); + patchDictSlave.set("coupleGroup", groupNameSlave); } addPatch(mesh, masterName, groupNameMaster, patchDictMaster); @@ -815,11 +818,11 @@ int main(int argc, char *argv[]) else { const dictionary& patchSource = dict.subDict("patchPairs"); - bool groupBase = false; - if (patchSource.found("groupBase")) - { - groupBase = readBool(patchSource.lookup("groupBase")); - } + + Switch sameGroup + ( + patchSource.lookupOrDefault("sameGroup", true) + ); const word& groupName = selectors[selectorI].name(); @@ -830,7 +833,7 @@ int main(int argc, char *argv[]) "patchFields" ); - if (!groupBase) + if (sameGroup) { // Add coupleGroup to all entries forAllIter(dictionary, patchFieldsDict, iter) diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 9771757c9e..6d7b9fe688 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -1078,7 +1078,6 @@ labelList addRegionPatches mesh.boundaryMesh() ); - //interfacePatches[interI] = addPatch(mesh, patch1); interfacePatches[interI] = fvMeshTools::addPatch ( mesh, @@ -1100,7 +1099,6 @@ labelList addRegionPatches point::zero, // offset mesh.boundaryMesh() ); - //addPatch(mesh, patch2); fvMeshTools::addPatch ( mesh, diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H index c2414b0f8b..4291dbde4b 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 50831a0ec9..fcd1400d59 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::solver::solver controlDict_(solverDict), maxIter_(1000), + minIter_(0), tolerance_(1e-6*pTraits::one), relTol_(pTraits::zero) { @@ -148,6 +149,7 @@ template void Foam::LduMatrix::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 7ee6da05dc..6a9b1779dd 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::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::preconditioner> @@ -182,8 +186,11 @@ Foam::PBiCCCG::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 cc8f1d1c72..5eeba96605 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::solve(Field& 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::preconditioner> @@ -174,8 +178,11 @@ Foam::PCICG::solve(Field& 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 9cf5c81223..5dea9207d6 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::solve(Field& 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::smoother> smootherPtr = LduMatrix::smoother::New @@ -140,8 +144,11 @@ Foam::SmoothSolver::solve(Field& 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 fd9c43da08..b8bc5c930c 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 a75668dfdd..fdaf834a74 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 cee5c1dc2f..aed21fe9f7 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