diff --git a/applications/solvers/combustion/fireFoam/UEqn.H b/applications/solvers/combustion/fireFoam/UEqn.H index 3b61f2c7b9..4a2d03490d 100644 --- a/applications/solvers/combustion/fireFoam/UEqn.H +++ b/applications/solvers/combustion/fireFoam/UEqn.H @@ -7,30 +7,13 @@ fvVectorMatrix UEqn UEqn.relax(); -if (oCorr == nOuterCorr - 1) -{ - solve +solve +( + UEqn + == + fvc::reconstruct ( - UEqn - == - fvc::reconstruct - ( - fvc::interpolate(rho)*(g & mesh.Sf()) - - fvc::snGrad(p)*mesh.magSf() - ), - mesh.solver("UFinal") - ); -} -else -{ - solve - ( - UEqn - == - fvc::reconstruct - ( - fvc::interpolate(rho)*(g & mesh.Sf()) - - fvc::snGrad(p)*mesh.magSf() - ) - ); -} + fvc::interpolate(rho)*(g & mesh.Sf()) + - fvc::snGrad(p)*mesh.magSf() + ) +); diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index 20f418e035..cff27389d0 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -70,6 +70,12 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop for (int oCorr=0; oCorrcorrect(); diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H index 907398581f..8d1ed0d9f8 100644 --- a/applications/solvers/combustion/fireFoam/pEqn.H +++ b/applications/solvers/combustion/fireFoam/pEqn.H @@ -30,14 +30,20 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) closedVolume = p.needReference(); - if (corr == nCorr-1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solver(p.name() + "Final")); - } - else - { - pEqn.solve(mesh.solver(p.name())); - } + pEqn.solve + ( + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { diff --git a/applications/solvers/combustion/rhoReactingFoam/pEqn.H b/applications/solvers/combustion/rhoReactingFoam/pEqn.H index a58cd28dec..c76ab5110b 100644 --- a/applications/solvers/combustion/rhoReactingFoam/pEqn.H +++ b/applications/solvers/combustion/rhoReactingFoam/pEqn.H @@ -31,14 +31,20 @@ - fvm::laplacian(rho*rUA, p) ); - if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solver(p.name() + "Final")); - } - else - { - pEqn.solve(); - } + pEqn.solve + ( + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { @@ -64,14 +70,20 @@ - fvm::laplacian(rho*rUA, p) ); - if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solver(p.name() + "Final")); - } - else - { - pEqn.solve(); - } + pEqn.solve + ( + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { diff --git a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C index 3a5bb614fe..e361d5f0cc 100644 --- a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C +++ b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C @@ -69,8 +69,14 @@ int main(int argc, char *argv[]) #include "chemistry.H" #include "rhoEqn.H" - for (label ocorr=1; ocorr <= nOuterCorr; ocorr++) + for (label oCorr=1; oCorr <= nOuterCorr; oCorr++) { + bool finalIter = oCorr == nOuterCorr-1; + if (finalIter) + { + mesh.data::add("finalIteration", true); + } + #include "UEqn.H" #include "YEqn.H" #include "hsEqn.H" @@ -80,6 +86,11 @@ int main(int argc, char *argv[]) { #include "pEqn.H" } + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } } turbulence->correct(); diff --git a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H index 9c12cf9585..954907d203 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H @@ -7,27 +7,13 @@ tmp UEqn + turbulence->divDevRhoReff(U) ); -if (oCorr == nOuterCorr-1) -{ - UEqn().relax(1); -} -else -{ - UEqn().relax(); -} +UEqn().relax(); volScalarField rUA = 1.0/UEqn().A(); if (momentumPredictor) { - if (oCorr == nOuterCorr-1) - { - solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal")); - } - else - { - solve(UEqn() == -fvc::grad(p)); - } + solve(UEqn() == -fvc::grad(p)); } else { diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H index 1433ea5cc3..4642e10ef8 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/createFields.H @@ -37,12 +37,7 @@ mesh ); -# include "compressibleCreatePhi.H" - - dimensionedScalar pMin - ( - mesh.solutionDict().subDict("PIMPLE").lookup("pMin") - ); + #include "compressibleCreatePhi.H" Info<< "Creating turbulence model\n" << endl; autoPtr turbulence @@ -56,9 +51,6 @@ ) ); - //dimensionedScalar initialMass = fvc::domainIntegrate(rho); - - Info<< "Creating field DpDt\n" << endl; volScalarField DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); diff --git a/applications/solvers/compressible/rhoPimpleFoam/hEqn.H b/applications/solvers/compressible/rhoPimpleFoam/hEqn.H index e66b99442b..3125cc3ffa 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/hEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/hEqn.H @@ -8,16 +8,8 @@ DpDt ); - if (oCorr == nOuterCorr-1) - { - hEqn.relax(); - hEqn.solve(mesh.solver("hFinal")); - } - else - { - hEqn.relax(); - hEqn.solve(); - } + hEqn.relax(); + hEqn.solve(); thermo.correct(); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index 0f3dfe450b..c0dba194e7 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -1,6 +1,5 @@ rho = thermo.rho(); -volScalarField rUA = 1.0/UEqn().A(); U = rUA*UEqn().H(); if (nCorr <= 1) @@ -29,19 +28,20 @@ if (transonic) - fvm::laplacian(rho*rUA, p) ); - if + pEqn.solve ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve(mesh.solver("pFinal")); - } - else - { - pEqn.solve(); - } + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { @@ -55,7 +55,7 @@ else fvc::interpolate(rho)* ( (fvc::interpolate(U) & mesh.Sf()) - //+ fvc::ddtPhiCorr(rUA, rho, U, phi) + + fvc::ddtPhiCorr(rUA, rho, U, phi) ); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) @@ -68,19 +68,20 @@ else - fvm::laplacian(rho*rUA, p) ); - if + pEqn.solve ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve(mesh.solver("pFinal")); - } - else - { - pEqn.solve(); - } + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { @@ -92,30 +93,15 @@ else #include "rhoEqn.H" #include "compressibleContinuityErrs.H" -//if (oCorr != nOuterCorr-1) -{ - // Explicitly relax pressure for momentum corrector - p.relax(); +// Explicitly relax pressure for momentum corrector +p.relax(); - rho = thermo.rho(); - rho.relax(); - Info<< "rho max/min : " << max(rho).value() - << " " << min(rho).value() << endl; -} +// Recalculate density from the relaxed pressure +rho = thermo.rho(); +Info<< "rho max/min : " << max(rho).value() + << " " << min(rho).value() << endl; U -= rUA*fvc::grad(p); U.correctBoundaryConditions(); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); - -bound(p, pMin); - -// For closed-volume cases adjust the pressure and density levels -// to obey overall mass continuity -/* -if (closedVolume) -{ - p += (initialMass - fvc::domainIntegrate(psi*p)) - /fvc::domainIntegrate(psi); -} -*/ diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index d4055f658d..5d21da05b6 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -61,15 +61,22 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - if (nOuterCorr != 1) - { - p.storePrevIter(); - rho.storePrevIter(); - } + #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop for (int oCorr=0; oCorrcorrect(); + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } } runTime.write(); diff --git a/applications/solvers/compressible/rhoPisoFoam/Make/files b/applications/solvers/compressible/rhoPisoFoam/Make/files deleted file mode 100644 index 3c89295014..0000000000 --- a/applications/solvers/compressible/rhoPisoFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -rhoPisoFoam.C - -EXE = $(FOAM_APPBIN)/rhoPisoFoam diff --git a/applications/solvers/compressible/rhoPisoFoam/Make/options b/applications/solvers/compressible/rhoPisoFoam/Make/options deleted file mode 100644 index 5c62488b65..0000000000 --- a/applications/solvers/compressible/rhoPisoFoam/Make/options +++ /dev/null @@ -1,13 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude - -EXE_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lbasicThermophysicalModels \ - -lspecie \ - -lcompressibleRASModels \ - -lcompressibleLESModels diff --git a/applications/solvers/compressible/rhoPisoFoam/UEqn.H b/applications/solvers/compressible/rhoPisoFoam/UEqn.H deleted file mode 100644 index 64dd52b1b0..0000000000 --- a/applications/solvers/compressible/rhoPisoFoam/UEqn.H +++ /dev/null @@ -1,11 +0,0 @@ - fvVectorMatrix UEqn - ( - fvm::ddt(rho, U) - + fvm::div(phi, U) - + turbulence->divDevRhoReff(U) - ); - - if (momentumPredictor) - { - solve(UEqn == -fvc::grad(p)); - } diff --git a/applications/solvers/compressible/rhoPisoFoam/createFields.H b/applications/solvers/compressible/rhoPisoFoam/createFields.H deleted file mode 100644 index fdb706a14c..0000000000 --- a/applications/solvers/compressible/rhoPisoFoam/createFields.H +++ /dev/null @@ -1,58 +0,0 @@ - Info<< "Reading thermophysical properties\n" << endl; - - autoPtr pThermo - ( - basicPsiThermo::New(mesh) - ); - basicPsiThermo& thermo = pThermo(); - - volScalarField& p = thermo.p(); - volScalarField& h = thermo.h(); - const volScalarField& psi = thermo.psi(); - - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermo.rho() - ); - - Info<< "\nReading field U\n" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - -# include "compressibleCreatePhi.H" - - - Info<< "Creating turbulence model\n" << endl; - autoPtr turbulence - ( - compressible::turbulenceModel::New - ( - rho, - U, - phi, - thermo - ) - ); - - - Info<< "Creating field DpDt\n" << endl; - volScalarField DpDt = - fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); diff --git a/applications/solvers/compressible/rhoPisoFoam/hEqn.H b/applications/solvers/compressible/rhoPisoFoam/hEqn.H deleted file mode 100644 index ae60d3316e..0000000000 --- a/applications/solvers/compressible/rhoPisoFoam/hEqn.H +++ /dev/null @@ -1,12 +0,0 @@ -{ - solve - ( - fvm::ddt(rho, h) - + fvm::div(phi, h) - - fvm::laplacian(turbulence->alphaEff(), h) - == - DpDt - ); - - thermo.correct(); -} diff --git a/applications/solvers/compressible/rhoPisoFoam/pEqn.H b/applications/solvers/compressible/rhoPisoFoam/pEqn.H deleted file mode 100644 index 280842ecc3..0000000000 --- a/applications/solvers/compressible/rhoPisoFoam/pEqn.H +++ /dev/null @@ -1,68 +0,0 @@ -rho = thermo.rho(); - -volScalarField rUA = 1.0/UEqn.A(); -U = rUA*UEqn.H(); - -if (transonic) -{ - surfaceScalarField phid - ( - "phid", - fvc::interpolate(psi) - *( - (fvc::interpolate(U) & mesh.Sf()) - + fvc::ddtPhiCorr(rUA, rho, U, phi) - ) - ); - - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) - { - fvScalarMatrix pEqn - ( - fvm::ddt(psi, p) - + fvm::div(phid, p) - - fvm::laplacian(rho*rUA, p) - ); - - pEqn.solve(); - - if (nonOrth == nNonOrthCorr) - { - phi == pEqn.flux(); - } - } -} -else -{ - phi = - fvc::interpolate(rho)* - ( - (fvc::interpolate(U) & mesh.Sf()) - + fvc::ddtPhiCorr(rUA, rho, U, phi) - ); - - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) - { - fvScalarMatrix pEqn - ( - fvm::ddt(psi, p) - + fvc::div(phi) - - fvm::laplacian(rho*rUA, p) - ); - - pEqn.solve(); - - if (nonOrth == nNonOrthCorr) - { - phi += pEqn.flux(); - } - } -} - -#include "rhoEqn.H" -#include "compressibleContinuityErrs.H" - -U -= rUA*fvc::grad(p); -U.correctBoundaryConditions(); - -DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); diff --git a/applications/solvers/compressible/rhoPisoFoam/rhoPisoFoam.C b/applications/solvers/compressible/rhoPisoFoam/rhoPisoFoam.C deleted file mode 100644 index 105717378e..0000000000 --- a/applications/solvers/compressible/rhoPisoFoam/rhoPisoFoam.C +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Application - rhoPisoFoam - -Description - Transient PISO solver for compressible, laminar or turbulent flow. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "basicPsiThermo.H" -#include "turbulenceModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "setRootCase.H" - - #include "createTime.H" - #include "createMesh.H" - #include "createFields.H" - #include "initContinuityErrs.H" - #include "readTimeControls.H" - #include "compressibleCourantNo.H" - #include "setInitialDeltaT.H" - - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (runTime.run()) - { - #include "readTimeControls.H" - #include "readPISOControls.H" - #include "compressibleCourantNo.H" - #include "setDeltaT.H" - - runTime++; - - Info<< "Time = " << runTime.timeName() << nl << endl; - - #include "rhoEqn.H" - #include "UEqn.H" - - // --- PISO loop - for (int corr=1; corr<=nCorr; corr++) - { - #include "hEqn.H" - #include "pEqn.H" - } - - turbulence->correct(); - - rho = thermo.rho(); - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H index 3b4ead17e7..a331d7dbb8 100644 --- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H @@ -7,14 +7,7 @@ tmp UEqn + turbulence->divDevRhoReff(U) ); -if (oCorr == nOuterCorr-1) -{ - UEqn().relax(1); -} -else -{ - UEqn().relax(); -} +UEqn().relax(); mrfZones.addCoriolis(rho, UEqn()); pZones.addResistance(UEqn()); @@ -23,14 +16,7 @@ volScalarField rUA = 1.0/UEqn().A(); if (momentumPredictor) { - if (oCorr == nOuterCorr-1) - { - solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal")); - } - else - { - solve(UEqn() == -fvc::grad(p)); - } + solve(UEqn() == -fvc::grad(p)); } else { diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H index c74fb4d84b..56f8e9f3b5 100644 --- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H @@ -30,19 +30,20 @@ if (transonic) - fvm::laplacian(rho*rUA, p) ); - if + pEqn.solve ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve(mesh.solver("pFinal")); - } - else - { - pEqn.solve(); - } + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { @@ -70,19 +71,20 @@ else - fvm::laplacian(rho*rUA, p) ); - if + pEqn.solve ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve(mesh.solver("pFinal")); - } - else - { - pEqn.solve(); - } + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index 4bae5c1e7b..7f93493f3b 100644 --- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -65,17 +65,23 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - if (nOuterCorr != 1) - { - p.storePrevIter(); - rho.storePrevIter(); - } - #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop for (int oCorr=0; oCorrcorrect(); + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } } runTime.write(); diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H b/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H index 09b75191db..5285e6e3b2 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H @@ -45,9 +45,14 @@ scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue); - dimensionedScalar pMin + dimensionedScalar rhoMax ( - mesh.solutionDict().subDict("SIMPLE").lookup("pMin") + mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax") + ); + + dimensionedScalar rhoMin + ( + mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin") ); Info<< "Creating turbulence model\n" << endl; diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H index 9e5138de8a..ff0b91bcb7 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H @@ -5,8 +5,8 @@ - fvm::Sp(fvc::div(phi), h) - fvm::laplacian(turbulence->alphaEff(), h) == - fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)")) - - p*fvc::div(phi/fvc::interpolate(rho)) + fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)") + - (rho/psi)*fvc::div(phi/fvc::interpolate(rho)) ); pZones.addEnthalpySource(thermo, rho, hEqn); diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H index 40b7cb3969..0386899612 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H @@ -1,3 +1,8 @@ +rho = thermo.rho(); +rho = max(rho, rhoMin); +rho = min(rho, rhoMax); +rho.relax(); + if (pressureImplicitPorosity) { U = trTU()&UEqn().H(); @@ -58,8 +63,6 @@ else U.correctBoundaryConditions(); -bound(p, pMin); - // For closed-volume cases adjust the pressure and density levels // to obey overall mass continuity if (closedVolume) @@ -69,5 +72,7 @@ if (closedVolume) } rho = thermo.rho(); +rho = max(rho, rhoMin); +rho = min(rho, rhoMax); rho.relax(); Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index 122280cfac..aa3de6d6fb 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -37,7 +37,7 @@ mesh ); -# include "compressibleCreatePhi.H" + #include "compressibleCreatePhi.H" label pRefCell = 0; diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/files b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/files new file mode 100644 index 0000000000..19c4661a3c --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/files @@ -0,0 +1,3 @@ +buoyantBoussinesqPimpleFoam.C + +EXE = $(FOAM_APPBIN)/buoyantBoussinesqPimpleFoam diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/Make/options b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options similarity index 100% rename from applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/Make/options rename to applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/TEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/TEqn.H similarity index 99% rename from applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/TEqn.H rename to applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/TEqn.H index ece4b8ffe5..a7a019a210 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/TEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/TEqn.H @@ -13,7 +13,6 @@ ); TEqn.relax(); - TEqn.solve(); rhok = 1.0 - beta*(T - TRef); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/UEqn.H similarity index 100% rename from applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/UEqn.H rename to applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/UEqn.H diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/buoyantBoussinesqPisoFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C similarity index 77% rename from applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/buoyantBoussinesqPisoFoam.C rename to applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C index 0269b95c90..a035a20feb 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/buoyantBoussinesqPisoFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Application - buoyantBoussinesqPisoFoam + buoyantBoussinesqPimpleFoam Description Transient solver for buoyant, turbulent flow of incompressible fluids @@ -72,20 +72,40 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readTimeControls.H" - #include "readPISOControls.H" + #include "readPIMPLEControls.H" #include "CourantNo.H" #include "setDeltaT.H" - #include "UEqn.H" - #include "TEqn.H" - - // --- PISO loop - for (int corr=0; corrcorrect(); + if (nOuterCorr != 1) + { + p.storePrevIter(); + } + + #include "UEqn.H" + #include "TEqn.H" + + // --- PISO loop + for (int corr=0; corrcorrect(); + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } + } runTime.write(); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/createFields.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H similarity index 92% rename from applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/createFields.H rename to applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H index dde0e38b33..704918bb09 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/createFields.H @@ -42,9 +42,9 @@ mesh ); -# include "createPhi.H" + #include "createPhi.H" -# include "readTransportProperties.H" + #include "readTransportProperties.H" Info<< "Creating turbulence model\n" << endl; autoPtr turbulence @@ -57,7 +57,7 @@ setRefCell ( p, - mesh.solutionDict().subDict("PISO"), + mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue ); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H new file mode 100644 index 0000000000..21be033f9b --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H @@ -0,0 +1,52 @@ +{ + volScalarField rUA("rUA", 1.0/UEqn.A()); + surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA)); + + U = rUA*UEqn.H(); + + phi = (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, U, phi); + + surfaceScalarField buoyancyPhi = + rUAf*fvc::interpolate(rhok)*(g & mesh.Sf()); + phi += buoyancyPhi; + + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix pEqn + ( + fvm::laplacian(rUAf, p) == fvc::div(phi) + ); + + pEqn.solve + ( + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); + + if (nonOrth == nNonOrthCorr) + { + // Calculate the conservative fluxes + phi -= pEqn.flux(); + + // Explicitly relax pressure for momentum corrector + p.relax(); + + // Correct the momentum source with the pressure gradient flux + // calculated from the relaxed pressure + U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf); + U.correctBoundaryConditions(); + } + } + + #include "continuityErrs.H" +} diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/Make/files b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/Make/files deleted file mode 100644 index d7b85221d8..0000000000 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -buoyantBoussinesqPisoFoam.C - -EXE = $(FOAM_APPBIN)/buoyantBoussinesqPisoFoam diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/pEqn.H deleted file mode 100644 index ff0c26f058..0000000000 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPisoFoam/pEqn.H +++ /dev/null @@ -1,41 +0,0 @@ -{ - volScalarField rUA("rUA", 1.0/UEqn.A()); - surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA)); - - U = rUA*UEqn.H(); - - surfaceScalarField phiU - ( - (fvc::interpolate(U) & mesh.Sf()) - + fvc::ddtPhiCorr(rUA, U, phi) - ); - - phi = phiU + rUAf*fvc::interpolate(rhok)*(g & mesh.Sf()); - - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) - { - fvScalarMatrix pEqn - ( - fvm::laplacian(rUAf, p) == fvc::div(phi) - ); - - if (corr == nCorr-1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solver(p.name() + "Final")); - } - else - { - pEqn.solve(mesh.solver(p.name())); - } - - if (nonOrth == nNonOrthCorr) - { - phi -= pEqn.flux(); - } - } - - U += rUA*fvc::reconstruct((phi - phiU)/rUAf); - U.correctBoundaryConditions(); - - #include "continuityErrs.H" -} diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/files b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/files new file mode 100644 index 0000000000..f4053436b5 --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/files @@ -0,0 +1,3 @@ +buoyantPimpleFoam.C + +EXE = $(FOAM_APPBIN)/buoyantPimpleFoam diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options similarity index 100% rename from applications/solvers/heatTransfer/buoyantPisoFoam/Make/options rename to applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H similarity index 100% rename from applications/solvers/heatTransfer/buoyantPisoFoam/UEqn.H rename to applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C similarity index 76% rename from applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C rename to applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index cc649d221d..c4ac77758e 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/buoyantPisoFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Application - buoyantPisoFoam + buoyantPimpleFoam Description Transient solver for buoyant, turbulent flow of compressible fluids for @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readTimeControls.H" - #include "readPISOControls.H" + #include "readPIMPLEControls.H" #include "compressibleCourantNo.H" #include "setDeltaT.H" @@ -69,21 +69,39 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" - #include "UEqn.H" - - #include "hEqn.H" - - // --- PISO loop - - for (int corr=0; corrcorrect(); + + rho = thermo.rho(); + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } } - turbulence->correct(); - - rho = thermo.rho(); - runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H similarity index 100% rename from applications/solvers/heatTransfer/buoyantPisoFoam/createFields.H rename to applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/hEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/hEqn.H similarity index 100% rename from applications/solvers/heatTransfer/buoyantPisoFoam/hEqn.H rename to applications/solvers/heatTransfer/buoyantPimpleFoam/hEqn.H diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H similarity index 58% rename from applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H rename to applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index c954c0ecb1..a1c3dbfed5 100644 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -12,16 +12,15 @@ U = rUA*UEqn.H(); - surfaceScalarField phiU + phi = fvc::interpolate(rho)* ( - fvc::interpolate(rho) - *( - (fvc::interpolate(U) & mesh.Sf()) - + fvc::ddtPhiCorr(rUA, rho, U, phi) - ) + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, rho, U, phi) ); - phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf()); + surfaceScalarField buoyancyPhi = + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf()); + phi += buoyancyPhi; for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { @@ -32,27 +31,39 @@ - fvm::laplacian(rhorUAf, p) ); - if (corr == nCorr-1 && nonOrth == nNonOrthCorr) - { - pEqn.solve(mesh.solver(p.name() + "Final")); - } - else - { - pEqn.solve(mesh.solver(p.name())); - } + pEqn.solve + ( + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { + // Calculate the conservative fluxes phi += pEqn.flux(); + + // Explicitly relax pressure for momentum corrector + p.relax(); + + // Correct the momentum source with the pressure gradient flux + // calculated from the relaxed pressure + U += rUA*fvc::reconstruct((buoyancyPhi + pEqn.flux())/rhorUAf); + U.correctBoundaryConditions(); } } // Second part of thermodynamic density update thermo.rho() += psi*p; - U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf); - U.correctBoundaryConditions(); - DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); #include "rhoEqn.H" diff --git a/applications/solvers/heatTransfer/buoyantPisoFoam/Make/files b/applications/solvers/heatTransfer/buoyantPisoFoam/Make/files deleted file mode 100644 index 65e5d52305..0000000000 --- a/applications/solvers/heatTransfer/buoyantPisoFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -buoyantPisoFoam.C - -EXE = $(FOAM_APPBIN)/buoyantPisoFoam diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index b0aa0852b2..de368a646e 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -22,16 +22,7 @@ ); pEqn.setReference(pRefCell, pRefValue); - - // retain the residual from the first iteration - if (nonOrth == 0) - { - pEqn.solve(); - } - else - { - pEqn.solve(); - } + pEqn.solve(); if (nonOrth == nNonOrthCorr) { diff --git a/applications/solvers/incompressible/pimpleDyMFoam/UEqn.H b/applications/solvers/incompressible/pimpleDyMFoam/UEqn.H deleted file mode 100644 index 2876a48b52..0000000000 --- a/applications/solvers/incompressible/pimpleDyMFoam/UEqn.H +++ /dev/null @@ -1,16 +0,0 @@ - fvVectorMatrix UEqn - ( - fvm::ddt(U) - + fvm::div(phi, U) - + turbulence->divDevReff(U) - ); - - if (ocorr != nOuterCorr-1) - { - UEqn.relax(); - } - - if (momentumPredictor) - { - solve(UEqn == -fvc::grad(p)); - } diff --git a/applications/solvers/incompressible/pimpleFoam/Allwmake b/applications/solvers/incompressible/pimpleFoam/Allwmake new file mode 100755 index 0000000000..71517c7319 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake +wmake pimpleDyMFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/incompressible/pimpleFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/UEqn.H index 12b4260e5d..3574c6553a 100644 --- a/applications/solvers/incompressible/pimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/UEqn.H @@ -7,27 +7,13 @@ tmp UEqn + turbulence->divDevReff(U) ); -if (oCorr == nOuterCorr-1) -{ - UEqn().relax(1); -} -else -{ - UEqn().relax(); -} +UEqn().relax(); volScalarField rUA = 1.0/UEqn().A(); if (momentumPredictor) { - if (oCorr == nOuterCorr-1) - { - solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal")); - } - else - { - solve(UEqn() == -fvc::grad(p)); - } + solve(UEqn() == -fvc::grad(p)); } else { diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index 41f99bb542..b5dc23a58c 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -21,19 +21,20 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) pEqn.setReference(pRefCell, pRefValue); - if + pEqn.solve ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve(mesh.solver("pFinal")); - } - else - { - pEqn.solve(); - } + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { @@ -43,11 +44,8 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) #include "continuityErrs.H" -// Explicitly relax pressure for momentum corrector except for last corrector -if (oCorr != nOuterCorr-1) -{ - p.relax(); -} +// Explicitly relax pressure for momentum corrector +p.relax(); U -= rUA*fvc::grad(p); U.correctBoundaryConditions(); diff --git a/applications/solvers/incompressible/pimpleDyMFoam/Make/files b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/files similarity index 100% rename from applications/solvers/incompressible/pimpleDyMFoam/Make/files rename to applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/files diff --git a/applications/solvers/incompressible/pimpleDyMFoam/Make/options b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options similarity index 98% rename from applications/solvers/incompressible/pimpleDyMFoam/Make/options rename to applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options index 40023adad7..6af3735d63 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/Make/options +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I.. \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ diff --git a/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H similarity index 100% rename from applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H rename to applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H diff --git a/applications/solvers/incompressible/pimpleDyMFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H similarity index 100% rename from applications/solvers/incompressible/pimpleDyMFoam/createFields.H rename to applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H new file mode 100644 index 0000000000..155f43a632 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H @@ -0,0 +1,55 @@ +U = rAU*UEqn().H(); + +if (nCorr <= 1) +{ + UEqn.clear(); +} + +phi = (fvc::interpolate(U) & mesh.Sf()); + +if (p.needReference()) +{ + fvc::makeRelative(phi, U); + adjustPhi(phi, U, p); + fvc::makeAbsolute(phi, U); +} + +for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) +{ + fvScalarMatrix pEqn + ( + fvm::laplacian(rAU, p) == fvc::div(phi) + ); + + pEqn.setReference(pRefCell, pRefValue); + + pEqn.solve + ( + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); + + if (nonOrth == nNonOrthCorr) + { + phi -= pEqn.flux(); + } +} + +#include "continuityErrs.H" + +p.relax(); + +// Make the fluxes relative to the mesh motion +fvc::makeRelative(phi, U); + +U -= rAU*fvc::grad(p); +U.correctBoundaryConditions(); diff --git a/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C similarity index 65% rename from applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C rename to applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C index ccb209b61a..0ec3c5b0aa 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C @@ -84,8 +84,14 @@ int main(int argc, char *argv[]) } // --- PIMPLE loop - for (int ocorr=0; ocorrcorrect(); + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } } runTime.write(); diff --git a/applications/solvers/incompressible/pimpleDyMFoam/readControls.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H similarity index 81% rename from applications/solvers/incompressible/pimpleDyMFoam/readControls.H rename to applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H index 3bd20c5c5c..ef396ec9ff 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/readControls.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H @@ -1,5 +1,5 @@ -# include "readTimeControls.H" -# include "readPIMPLEControls.H" + #include "readTimeControls.H" + #include "readPIMPLEControls.H" bool correctPhi = false; if (pimple.found("correctPhi")) diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index 5fb87ef128..780c51e7f3 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -62,6 +62,12 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop for (int oCorr=0; oCorrcorrect(); + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } } runTime.write(); diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/UEqn.H b/applications/solvers/multiphase/twoLiquidMixingFoam/UEqn.H index c0daa0e7ca..ed0fbf776c 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/UEqn.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/UEqn.H @@ -15,14 +15,7 @@ //- fvc::div(rho*turbulence->nuEff()*dev(fvc::grad(U)().T())) ); - if (oCorr == nOuterCorr-1) - { - UEqn.relax(1); - } - else - { - UEqn.relax(); - } + UEqn.relax(); if (momentumPredictor) { @@ -34,7 +27,6 @@ ( fvc::interpolate(rho)*(g & mesh.Sf()) - mesh.magSf()*fvc::snGrad(p) - ), - mesh.solver(oCorr == nOuterCorr-1 ? "UFinal" : "U") + ) ); } diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H b/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H index f1e07558cb..25003e1b25 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H @@ -22,18 +22,20 @@ pEqn.setReference(pRefCell, pRefValue); - if + pEqn.solve ( - corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - { - pEqn.solve(mesh.solver(p.name() + "Final")); - } - else - { - pEqn.solve(mesh.solver(p.name())); - } + mesh.solver + ( + p.select + ( + ( + finalIter + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + ) + ) + ); if (nonOrth == nNonOrthCorr) { diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C index f3b98ba8fe..cf6fc95a9c 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C @@ -68,6 +68,12 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop for (int oCorr=0; oCorrcorrect(); + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } } runTime.write(); diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/Allwmake b/applications/utilities/mesh/generation/extrudeToRegionMesh/Allwmake new file mode 100755 index 0000000000..c19360ac26 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/Allwmake @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +set -x + +wmake libso nonuniformTransformCyclic +wmake + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options b/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options index dbf50a9b09..c00ca0534b 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options @@ -1,14 +1,12 @@ EXE_INC = \ + -InonuniformTransformCyclic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - /* -I$(LIB_SRC)/surfMesh/lnInclude */ \ - /* -I$(LIB_SRC)/lagrangian/basic/lnInclude */ \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude EXE_LIBS = \ + -lnonuniformTransformCyclic \ -lfiniteVolume \ - /* -lsurfMesh */ \ - /* -llagrangian */ \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C index 4cf3c67ff9..bd7e61eff8 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -31,7 +31,8 @@ Description - if extruding boundary faces: - convert boundary faces to directMappedWall patches - extrude edges of faceZone as a _sidePatch - - extrude edges inbetween different faceZones as a cyclic _ + - extrude edges inbetween different faceZones as a + (nonuniformTransform)cyclic _ - extrudes into master direction (i.e. away from the owner cell if flipMap is false) - not parallel @@ -129,8 +130,9 @@ Usage #include "createShellMesh.H" #include "volFields.H" #include "surfaceFields.H" -#include "cyclicPolyPatch.H" #include "syncTools.H" +#include "cyclicPolyPatch.H" +#include "nonuniformTransformCyclicPolyPatch.H" using namespace Foam; @@ -596,7 +598,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) } -//XXXXXXXXX +// Find a patch face that is not extruded. Return -1 if not found. label findUncoveredPatchFace ( const fvMesh& mesh, @@ -611,20 +613,19 @@ label findUncoveredPatchFace extrudeFaceSet.insert(extrudeMeshFaces[i]); } - label patchI = -1; - const labelList& eFaces = mesh.edgeFaces()[meshEdgeI]; forAll(eFaces, i) { label faceI = eFaces[i]; if (!mesh.isInternalFace(faceI) && !extrudeFaceSet.found(faceI)) { - patchI = mesh.boundaryMesh().whichPatch(faceI); - break; + return faceI; } } - return patchI; + return -1; } + + // Count the number of faces in patches that need to be created void countExtrudePatches ( @@ -662,14 +663,14 @@ void countExtrudePatches // so choose any uncovered one. If none found put face in // undetermined zone 'side' patch - label patchI = findUncoveredPatchFace + label faceI = findUncoveredPatchFace ( mesh, UIndirectList