diff --git a/applications/solvers/basic/laplacianFoam/Make/options b/applications/solvers/basic/laplacianFoam/Make/options index d27c95d033..04ef6c148d 100644 --- a/applications/solvers/basic/laplacianFoam/Make/options +++ b/applications/solvers/basic/laplacianFoam/Make/options @@ -4,4 +4,5 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ + -lfvOptions \ -lmeshTools diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H index 5ab7d3835f..be5014394d 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -184,7 +184,8 @@ public: //- Evaluate the patch field virtual void evaluate ( - const Pstream::commsTypes commsType=Pstream::blocking + const Pstream::commsTypes commsType= + Pstream::commsTypes::blocking ); //- Return face-gradient transform diagonal diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H index a7ee3eca45..84f70f2cd0 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/createFields.H @@ -2,11 +2,11 @@ Info<< "Reading thermophysical properties\n" << endl; -autoPtr pThermo +autoPtr pThermo ( - psiThermo::New(mesh) + fluidThermo::New(mesh) ); -psiThermo& thermo = pThermo(); +fluidThermo& thermo = pThermo(); thermo.validate(args.executable(), "h", "e"); volScalarField& p = thermo.p(); @@ -40,27 +40,7 @@ volVectorField U #include "compressibleCreatePhi.H" -dimensionedScalar rhoMax -( - dimensionedScalar::lookupOrDefault - ( - "rhoMax", - pimple.dict(), - dimDensity, - GREAT - ) -); - -dimensionedScalar rhoMin -( - dimensionedScalar::lookupOrDefault - ( - "rhoMin", - pimple.dict(), - dimDensity, - 0 - ) -); +pressureControl pressureControl(p, rho, pimple.dict(), false); Info<< "Creating turbulence model\n" << endl; autoPtr turbulence diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index ac7107acf0..73ecafd89f 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -1,8 +1,3 @@ -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); - volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); @@ -12,55 +7,54 @@ if (pimple.nCorrPISO() <= 1) tUEqn.clear(); } +surfaceScalarField phiHbyA +( + "phiHbyA", + ( + fvc::flux(rho*HbyA) + + rhorAUf*fvc::ddtCorr(rho, U, phi) + ) +); + +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + if (pimple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *( - fvc::flux(HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho) - ) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - - MRF.makeRelative(fvc::interpolate(psi), phid); + phiHbyA -= fvc::interpolate(p)*phid; while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) + + fvc::div(phiHbyA) + fvm::div(phid, p) - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) ); + // Relax the pressure equation to ensure diagonal-dominance + pEqn.relax(); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) { - phi == pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA - ( - "phiHbyA", - ( - fvc::flux(rho*HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, phi) - ) - ); - - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); - while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -87,19 +81,20 @@ else // Explicitly relax pressure for momentum corrector p.relax(); -// Recalculate density from the relaxed pressure -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); -Info<< "rho max/min : " << max(rho).value() - << " " << min(rho).value() << endl; - U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); fvOptions.correct(U); K = 0.5*magSqr(U); +pressureControl.limit(p); +p.correctBoundaryConditions(); +rho = thermo.rho(); + +if (!pimple.transonic()) +{ + rho.relax(); +} + if (thermo.dpdt()) { dpdt = fvc::ddt(p); diff --git a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H index 713f443fc5..afbc2851e4 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H @@ -1,8 +1,3 @@ -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); - volScalarField rAU(1.0/UEqn.A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); @@ -12,72 +7,64 @@ if (pimple.nCorrPISO() <= 1) tUEqn.clear(); } +surfaceScalarField phiHbyA +( + "phiHbyA", + ( + fvc::flux(rho*HbyA) + + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi) + ) +); + +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +volScalarField rhorAtU("rhorAtU", rho*rAtU); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF); + if (pimple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *( - fvc::flux(HbyA) - + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi) - /fvc::interpolate(rho) - ) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - MRF.makeRelative(fvc::interpolate(psi), phid); - - surfaceScalarField phic - ( - "phic", + phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf() - ); + - fvc::interpolate(p)*phid; HbyA -= (rAU - rAtU)*fvc::grad(p); - volScalarField rhorAtU("rhorAtU", rho*rAtU); - while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) + + fvc::div(phiHbyA) + fvm::div(phid, p) - + fvc::div(phic) - fvm::laplacian(rhorAtU, p) == fvOptions(psi, p, rho.name()) ); + // Relax the pressure equation to ensure diagonal-dominance + pEqn.relax(); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) { - phi == phic + pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA - ( - "phiHbyA", - ( - fvc::flux(rho*HbyA) - + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi) - ) - ); - - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf(); HbyA -= (rAU - rAtU)*fvc::grad(p); - volScalarField rhorAtU("rhorAtU", rho*rAtU); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF); - while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -109,19 +96,16 @@ U.correctBoundaryConditions(); fvOptions.correct(U); K = 0.5*magSqr(U); -if (thermo.dpdt()) -{ - dpdt = fvc::ddt(p); -} - -// Recalculate density from the relaxed pressure +pressureControl.limit(p); +p.correctBoundaryConditions(); rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); if (!pimple.transonic()) { rho.relax(); } -Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; +if (thermo.dpdt()) +{ + dpdt = fvc::ddt(p); +} diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H index 7bd540df40..0f85562618 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H @@ -1,8 +1,3 @@ -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); - volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); @@ -12,55 +7,53 @@ if (pimple.nCorrPISO() <= 1) tUEqn.clear(); } +surfaceScalarField phiHbyA +( + "phiHbyA", + fvc::flux(rho*HbyA) + + rhorAUf*fvc::ddtCorr(rho, U, rhoUf) +); + +fvc::makeRelative(phiHbyA, rho, U); +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + if (pimple.transonic()) { surfaceScalarField phid ( "phid", - fvc::interpolate(psi) - *( - fvc::flux(HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho) - ) + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); - - fvc::makeRelative(phid, psi, U); - MRF.makeRelative(fvc::interpolate(psi), phid); + phiHbyA -= fvc::interpolate(p)*phid; while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) + + fvc::div(phiHbyA) + fvm::div(phid, p) - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) ); + // Relax the pressure equation to ensure diagonal-dominance + pEqn.relax(); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) { - phi == pEqn.flux(); + phi = phiHbyA + pEqn.flux(); } } } else { - surfaceScalarField phiHbyA - ( - "phiHbyA", - fvc::flux(rho*HbyA) - + rhorAUf*fvc::ddtCorr(rho, U, rhoUf) - ); - - fvc::makeRelative(phiHbyA, rho, U); - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); - while (pimple.correctNonOrthogonal()) { // Pressure corrector @@ -88,19 +81,20 @@ else // Explicitly relax pressure for momentum corrector p.relax(); -// Recalculate density from the relaxed pressure -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); -Info<< "rho max/min : " << max(rho).value() - << " " << min(rho).value() << endl; - U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); fvOptions.correct(U); K = 0.5*magSqr(U); +pressureControl.limit(p); +p.correctBoundaryConditions(); +rho = thermo.rho(); + +if (!pimple.transonic()) +{ + rho.relax(); +} + { rhoUf = fvc::interpolate(rho*U); surfaceVectorField n(mesh.Sf()/mesh.magSf()); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C index c7046bb9b4..493b35f692 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/rhoPimpleDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Application - rhoPimpleFoam + rhoPimpleDyMFoam Group grpCompressibleSolvers grpMovingMeshSolvers @@ -38,10 +38,11 @@ Description #include "fvCFD.H" #include "dynamicFvMesh.H" -#include "psiThermo.H" +#include "fluidThermo.H" #include "turbulentFluidThermoModel.H" #include "bound.H" #include "pimpleControl.H" +#include "pressureControl.H" #include "CorrectPhi.H" #include "fvOptions.H" #include "localEulerDdtScheme.H" diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index 1a74933ea8..0fbe7717e3 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,10 +37,11 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "psiThermo.H" +#include "fluidThermo.H" #include "turbulentFluidThermoModel.H" #include "bound.H" #include "pimpleControl.H" +#include "pressureControl.H" #include "fvOptions.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index 60b7d183ee..c7914f89d3 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -1,5 +1,5 @@ Info<< "Reading thermophysical properties\n" << endl; -autoPtr pThermo + autoPtr pThermo ( fluidThermo::New(mesh) @@ -7,6 +7,8 @@ autoPtr pThermo fluidThermo& thermo = pThermo(); thermo.validate(args.executable(), "h", "e"); +volScalarField& p = thermo.p(); + volScalarField rho ( IOobject @@ -20,8 +22,6 @@ volScalarField rho thermo.rho() ); -volScalarField& p = thermo.p(); - Info<< "Reading field U\n" << endl; volVectorField U ( @@ -40,34 +40,8 @@ volVectorField U pressureControl pressureControl(p, rho, simple.dict()); -label pRefCell = 0; -scalar pRefValue = 0.0; -setRefCell(p, simple.dict(), pRefCell, pRefValue); - mesh.setFluxRequired(p.name()); -dimensionedScalar rhoMax -( - dimensionedScalar::lookupOrDefault - ( - "rhoMax", - simple.dict(), - dimDensity, - GREAT - ) -); - -dimensionedScalar rhoMin -( - dimensionedScalar::lookupOrDefault - ( - "rhoMin", - simple.dict(), - dimDensity, - 0 - ) -); - Info<< "Creating turbulence model\n" << endl; autoPtr turbulence ( diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index f65724a908..95b3806902 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -8,16 +8,18 @@ bool closedVolume = false; + surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); + MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + if (simple.transonic()) { - surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); - surfaceScalarField rhof(fvc::interpolate(rho)); - MRF.makeRelative(rhof, phiHbyA); - surfaceScalarField phid ( "phid", - (fvc::interpolate(psi)/rhof)*phiHbyA + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); phiHbyA -= fvc::interpolate(p)*phid; @@ -51,14 +53,8 @@ } else { - surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - closedVolume = adjustPhi(phiHbyA, U, p); - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); - while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn diff --git a/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H index 0ecb8ddb2c..8084b305aa 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H @@ -5,16 +5,20 @@ tUEqn.clear(); bool closedVolume = false; +surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); +MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + +volScalarField rhorAtU("rhorAtU", rho*rAtU); + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF); + if (simple.transonic()) { - surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); - surfaceScalarField rhof(fvc::interpolate(rho)); - MRF.makeRelative(rhof, phiHbyA); - surfaceScalarField phid ( "phid", - (fvc::interpolate(psi)/rhof)*phiHbyA + (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA ); phiHbyA += @@ -23,14 +27,12 @@ if (simple.transonic()) HbyA -= (rAU - rAtU)*fvc::grad(p); - volScalarField rhorAtU("rhorAtU", rho*rAtU); - while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( - fvm::div(phid, p) - + fvc::div(phiHbyA) + fvc::div(phiHbyA) + + fvm::div(phid, p) - fvm::laplacian(rhorAtU, p) == fvOptions(psi, p, rho.name()) @@ -55,19 +57,11 @@ if (simple.transonic()) } else { - surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); - MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - closedVolume = adjustPhi(phiHbyA, U, p); phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf(); HbyA -= (rAU - rAtU)*fvc::grad(p); - volScalarField rhorAtU("rhorAtU", rho*rAtU); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF); - while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn diff --git a/applications/solvers/multiphase/VoF/alphaEqn.H b/applications/solvers/multiphase/VoF/alphaEqn.H index 570442a304..abae00fb38 100644 --- a/applications/solvers/multiphase/VoF/alphaEqn.H +++ b/applications/solvers/multiphase/VoF/alphaEqn.H @@ -2,46 +2,57 @@ word alphaScheme("div(phi,alpha)"); word alpharScheme("div(phirb,alpha)"); - tmp> ddtAlpha - ( - fv::ddtScheme::New - ( - mesh, - mesh.ddtScheme("ddt(alpha)") - ) - ); - // Set the off-centering coefficient according to ddt scheme scalar ocCoeff = 0; - if - ( - isType>(ddtAlpha()) - || isType>(ddtAlpha()) - ) { - ocCoeff = 0; - } - else if (isType>(ddtAlpha())) - { - if (nAlphaSubCycles > 1) + tmp> tddtAlpha + ( + fv::ddtScheme::New + ( + mesh, + mesh.ddtScheme("ddt(alpha)") + ) + ); + const fv::ddtScheme& ddtAlpha = tddtAlpha(); + + if + ( + isType>(ddtAlpha) + || isType>(ddtAlpha) + ) + { + ocCoeff = 0; + } + else if (isType>(ddtAlpha)) + { + if (nAlphaSubCycles > 1) + { + FatalErrorInFunction + << "Sub-cycling is not supported " + "with the CrankNicolson ddt scheme" + << exit(FatalError); + } + + if + ( + alphaRestart + || mesh.time().timeIndex() > mesh.time().startTimeIndex() + 1 + ) + { + ocCoeff = + refCast>(ddtAlpha) + .ocCoeff(); + } + } + else { FatalErrorInFunction - << "Sub-cycling is not supported " - "with the CrankNicolson ddt scheme" + << "Only Euler and CrankNicolson ddt schemes are supported" << exit(FatalError); } - - ocCoeff = - refCast>(ddtAlpha()) - .ocCoeff(); - } - else - { - FatalErrorInFunction - << "Only Euler and CrankNicolson ddt schemes are supported" - << exit(FatalError); } + // Set the time blending factor, 1 for Euler scalar cnCoeff = 1.0/(1.0 + ocCoeff); // Standard face-flux compression coefficient @@ -136,8 +147,8 @@ ( fvc::flux ( - phi, - alpha1, + phiCN(), + cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime(), alphaScheme ) + fvc::flux @@ -148,13 +159,6 @@ ) ); - // Calculate the Crank-Nicolson off-centred alpha flux - if (ocCoeff > 0) - { - talphaPhiUn = - cnCoeff*talphaPhiUn + (1.0 - cnCoeff)*alphaPhi.oldTime(); - } - if (MULESCorr) { tmp talphaPhiCorr(talphaPhiUn() - alphaPhi); diff --git a/applications/solvers/multiphase/VoF/createAlphaFluxes.H b/applications/solvers/multiphase/VoF/createAlphaFluxes.H new file mode 100644 index 0000000000..e75c2fe0b0 --- /dev/null +++ b/applications/solvers/multiphase/VoF/createAlphaFluxes.H @@ -0,0 +1,20 @@ +IOobject alphaPhiHeader +( + "alphaPhi", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE +); + +const bool alphaRestart = alphaPhiHeader.headerOk(); + +// MULES flux from previous time-step +surfaceScalarField alphaPhi +( + alphaPhiHeader, + phi*fvc::interpolate(alpha1) +); + +// MULES Correction +tmp talphaPhiCorr0; diff --git a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H index af74f0362a..60dd2aecc8 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H @@ -5,7 +5,7 @@ + fvm::div(rhoPhi, T) - fvm::laplacian(mixture.alphaEff(turbulence->mut()), T) + ( - divU*p + fvc::div(fvc::absolute(phi, U), p) + fvc::ddt(rho, K) + fvc::div(rhoPhi, K) ) *( diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index a0b11bf1f3..300b7579bb 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -64,6 +64,7 @@ int main(int argc, char *argv[]) #include "initContinuityErrs.H" #include "createControl.H" #include "createFields.H" + #include "createAlphaFluxes.H" #include "createFvOptions.H" #include "createUf.H" #include "createControls.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 66401103bc..a657caf01e 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -64,6 +64,7 @@ int main(int argc, char *argv[]) #include "createControl.H" #include "createTimeControls.H" #include "createFields.H" + #include "createAlphaFluxes.H" #include "createFvOptions.H" volScalarField& p = mixture.p(); @@ -112,7 +113,6 @@ int main(int argc, char *argv[]) solve(fvm::ddt(rho) + fvc::div(rhoPhi)); #include "UEqn.H" - volScalarField divU(fvc::div(fvc::absolute(phi, U))); #include "TEqn.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index 9bac4d8259..46168e6b87 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -101,21 +101,4 @@ autoPtr turbulence Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); -// MULES flux from previous time-step -surfaceScalarField alphaPhi -( - IOobject - ( - "alphaPhi", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - phi*fvc::interpolate(alpha1) -); - -// MULES Correction -tmp talphaPhiCorr0; - #include "createMRF.H" diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index f820cf874f..23bdacf6b2 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -121,20 +121,6 @@ if (p_rgh.needReference()) mesh.setFluxRequired(p_rgh.name()); mesh.setFluxRequired(alpha1.name()); -// MULES flux from previous time-step -surfaceScalarField alphaPhi -( - IOobject - ( - "alphaPhi", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - phi*fvc::interpolate(alpha1) -); - // MULES compressed flux is registered in case scalarTransport FO needs it. surfaceScalarField alphaPhiUn ( @@ -150,7 +136,4 @@ surfaceScalarField alphaPhiUn dimensionedScalar("zero", phi.dimensions(), 0.0) ); -// MULES Correction -tmp talphaPhiCorr0; - #include "createMRF.H" diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index 5342f7697e..1dd92f95a1 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -63,6 +63,7 @@ int main(int argc, char *argv[]) #include "createTimeControls.H" #include "createDyMControls.H" #include "createFields.H" + #include "createAlphaFluxes.H" #include "createFvOptions.H" volScalarField rAU diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 7d9d2e5ec7..858624b2d5 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -66,6 +66,7 @@ int main(int argc, char *argv[]) #include "createTimeControls.H" #include "initContinuityErrs.H" #include "createFields.H" + #include "createAlphaFluxes.H" #include "createFvOptions.H" #include "correctPhi.H" diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H index 5e916dce2f..3445c81fb9 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/pU/pEqn.H @@ -294,12 +294,11 @@ while (pimple.correct()) forAll(phases, phasei) { phaseModel& phase = phases[phasei]; + const volScalarField& alpha = phase; + volScalarField& rho = phase.thermo().rho(); if (phase.compressible()) { - const volScalarField& alpha = phase; - const volScalarField& rho = phase.rho(); - if (pimple.transonic()) { surfaceScalarField phid @@ -357,21 +356,29 @@ while (pimple.correct()) ).ptr() ); } + } + else + { + pEqnComps.set + ( + phasei, + fvm::Su(-(fvOptions(alpha, rho)&rho)/rho, p_rgh).ptr() + ); + } - if (fluid.transfersMass(phase)) + if (fluid.transfersMass(phase)) + { + if (pEqnComps.set(phasei)) { - if (pEqnComps.set(phasei)) - { - pEqnComps[phasei] -= fluid.dmdt(phase)/rho; - } - else - { - pEqnComps.set - ( - phasei, - fvm::Su(-fluid.dmdt(phase)/rho, p_rgh) - ); - } + pEqnComps[phasei] -= fluid.dmdt(phase)/rho; + } + else + { + pEqnComps.set + ( + phasei, + fvm::Su(-fluid.dmdt(phase)/rho, p_rgh) + ); } } } @@ -421,7 +428,7 @@ while (pimple.correct()) phase.phi() = phiHbyAs[phasei] + alpharAUfs[phasei]*mSfGradp; // Set the phase dilatation rates - if (phase.compressible()) + if (pEqnComps.set(phasei)) { phase.divU(-pEqnComps[phasei] & p_rgh); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H index f268beae62..3365febdf6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pU/pEqn.H @@ -230,9 +230,10 @@ while (pimple.correct()) tmp pEqnComp2; // Construct the compressibility parts of the pressure equation - if (pimple.transonic()) + + if (phase1.compressible()) { - if (phase1.compressible()) + if (pimple.transonic()) { surfaceScalarField phid1 ( @@ -257,8 +258,24 @@ while (pimple.correct()) deleteDemandDrivenData(pEqnComp1.ref().faceFluxCorrectionPtr()); pEqnComp1.ref().relax(); } + else + { + pEqnComp1 = + ( + phase1.continuityError() + - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) + )/rho1 + + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)); + } + } + else + { + pEqnComp1 = fvm::Su(-(fvOptions(alpha1, rho1)&rho1)/rho1, p_rgh); + } - if (phase2.compressible()) + if (phase2.compressible()) + { + if (pimple.transonic()) { surfaceScalarField phid2 ( @@ -279,23 +296,11 @@ while (pimple.correct()) + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) ) ); + deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr()); pEqnComp2.ref().relax(); } - } - else - { - if (phase1.compressible()) - { - pEqnComp1 = - ( - phase1.continuityError() - - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) - )/rho1 - + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)); - } - - if (phase2.compressible()) + else { pEqnComp2 = ( @@ -305,6 +310,10 @@ while (pimple.correct()) + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)); } } + else + { + pEqnComp2 = fvm::Su(-(fvOptions(alpha2, rho2)&rho2)/rho2, p_rgh); + } if (fluid.transfersMass()) { @@ -390,11 +399,11 @@ while (pimple.correct()) } // Set the phase dilatation rates - if (phase1.compressible()) + if (pEqnComp1.valid()) { phase1.divU(-pEqnComp1 & p_rgh); } - if (phase2.compressible()) + if (pEqnComp2.valid()) { phase2.divU(-pEqnComp2 & p_rgh); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H index 05bca24c45..d2202eb890 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/pUf/pEqn.H @@ -215,79 +215,91 @@ while (pimple.correct()) tmp pEqnComp1; tmp pEqnComp2; - if (pimple.transonic()) - { - surfaceScalarField phid1 - ( - IOobject::groupName("phid", phase1.name()), - fvc::interpolate(psi1)*phi1 - ); - surfaceScalarField phid2 - ( - IOobject::groupName("phid", phase2.name()), - fvc::interpolate(psi2)*phi2 - ); + // Construct the compressibility parts of the pressure equation - if (phase1.compressible()) + if (phase1.compressible()) + { + if (pimple.transonic()) { - pEqnComp1 = + surfaceScalarField phid1 ( - phase1.continuityError() - - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) - )/rho1 - + correction - ( - (alpha1/rho1)* - ( - psi1*fvm::ddt(p_rgh) - + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh) - ) + IOobject::groupName("phid", phase1.name()), + fvc::interpolate(psi1)*phi1 ); + + pEqnComp1 = + ( + phase1.continuityError() + - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) + )/rho1 + + correction + ( + (alpha1/rho1)* + ( + psi1*fvm::ddt(p_rgh) + + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh) + ) + ); + deleteDemandDrivenData(pEqnComp1.ref().faceFluxCorrectionPtr()); pEqnComp1.ref().relax(); } - - if (phase2.compressible()) + else { - pEqnComp2 = - ( - phase2.continuityError() - - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) - )/rho2 - + correction - ( - (alpha2/rho2)* + pEqnComp1 = ( - psi2*fvm::ddt(p_rgh) - + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) - ) - ); - deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr()); - pEqnComp2.ref().relax(); + phase1.continuityError() + - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) + )/rho1 + + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)); } } else { - if (phase1.compressible()) - { - pEqnComp1 = - ( - phase1.continuityError() - - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) - )/rho1 - + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)); - } + pEqnComp1 = fvm::Su(-(fvOptions(alpha1, rho1)&rho1)/rho1, p_rgh); + } - if (phase2.compressible()) + if (phase2.compressible()) + { + if (pimple.transonic()) + { + surfaceScalarField phid2 + ( + IOobject::groupName("phid", phase2.name()), + fvc::interpolate(psi2)*phi2 + ); + + pEqnComp2 = + ( + phase2.continuityError() + - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) + )/rho2 + + correction + ( + (alpha2/rho2)* + ( + psi2*fvm::ddt(p_rgh) + + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) + ) + ); + + deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr()); + pEqnComp2.ref().relax(); + } + else { pEqnComp2 = - ( - phase2.continuityError() - - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) - )/rho2 - + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)); + ( + phase2.continuityError() + - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) + )/rho2 + + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)); } } + else + { + pEqnComp2 = fvm::Su(-(fvOptions(alpha2, rho2)&rho2)/rho2, p_rgh); + } if (fluid.transfersMass()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C index 8feaaf8ca6..1963b11425 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,13 +73,13 @@ Lavieville::fLiquid ) const { return - pos(alphaLiquid-alphaCrit_) + pos(alphaLiquid - alphaCrit_) *( 1 - 0.5*exp(-20*(alphaLiquid - alphaCrit_)) ) + neg(alphaLiquid - alphaCrit_) *( - pow(0.5*(alphaLiquid/alphaCrit_), 20*alphaCrit_) + 0.5*pow(alphaLiquid/alphaCrit_, 20*alphaCrit_) ); } diff --git a/applications/test/FixedList/Test-FixedList.C b/applications/test/FixedList/Test-FixedList.C index 0a2c56a229..ec496e1e03 100644 --- a/applications/test/FixedList/Test-FixedList.C +++ b/applications/test/FixedList/Test-FixedList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,7 +92,11 @@ int main(int argc, char *argv[]) Serr<< "slave sending to master " << Pstream::masterNo() << endl; - OPstream toMaster(Pstream::blocking, Pstream::masterNo()); + OPstream toMaster + ( + Pstream::commsTypes::blocking, + Pstream::masterNo() + ); FixedList list3; list3[0] = 0; @@ -109,7 +113,7 @@ int main(int argc, char *argv[]) ) { Serr << "master receiving from slave " << slave << endl; - IPstream fromSlave(Pstream::blocking, slave); + IPstream fromSlave(Pstream::commsTypes::blocking, slave); FixedList list3(fromSlave); Serr<< list3 << endl; diff --git a/applications/test/parallel-communicators/Test-parallel-communicators.C b/applications/test/parallel-communicators/Test-parallel-communicators.C index 5593e07eff..d3805c24fd 100644 --- a/applications/test/parallel-communicators/Test-parallel-communicators.C +++ b/applications/test/parallel-communicators/Test-parallel-communicators.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,7 +65,7 @@ scalar sumReduce scalar slaveValue; UIPstream::read ( - Pstream::blocking, + Pstream::commsTypes::blocking, slave, reinterpret_cast(&slaveValue), sizeof(scalar), @@ -87,7 +87,7 @@ scalar sumReduce { UOPstream::write ( - UPstream::blocking, + UPstream::commsTypes::blocking, slave, reinterpret_cast(&sum), sizeof(scalar), @@ -101,7 +101,7 @@ scalar sumReduce { UOPstream::write ( - UPstream::blocking, + UPstream::commsTypes::blocking, UPstream::masterNo(), reinterpret_cast(&localValue), sizeof(scalar), @@ -113,7 +113,7 @@ scalar sumReduce { UIPstream::read ( - UPstream::blocking, + UPstream::commsTypes::blocking, UPstream::masterNo(), reinterpret_cast(&sum), sizeof(scalar), diff --git a/applications/test/parallel-nonBlocking/Test-parallel-nonBlocking.C b/applications/test/parallel-nonBlocking/Test-parallel-nonBlocking.C index eb37bd07f5..0e55717483 100644 --- a/applications/test/parallel-nonBlocking/Test-parallel-nonBlocking.C +++ b/applications/test/parallel-nonBlocking/Test-parallel-nonBlocking.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) Pstream::myProcNo() ); - PstreamBuffers pBufs(Pstream::nonBlocking); + PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); if (Pstream::myProcNo() != Pstream::masterNo()) { @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) // Send allData back - PstreamBuffers pBufs2(Pstream::nonBlocking); + PstreamBuffers pBufs2(Pstream::commsTypes::nonBlocking); if (Pstream::myProcNo() == Pstream::masterNo()) { for @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) // Do a non-blocking send inbetween { - PstreamBuffers pBufs(Pstream::nonBlocking); + PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); for (label proci = 0; proci < Pstream::nProcs(); proci++) { diff --git a/applications/test/parallel/Test-parallel.C b/applications/test/parallel/Test-parallel.C index 9b10ae6107..7a61b77f72 100644 --- a/applications/test/parallel/Test-parallel.C +++ b/applications/test/parallel/Test-parallel.C @@ -134,12 +134,12 @@ void testTransfer(const T& input) { { Perr<< "slave sending to master " << Pstream::masterNo() << endl; - OPstream toMaster(Pstream::blocking, Pstream::masterNo()); + OPstream toMaster(Pstream::commsTypes::blocking, Pstream::masterNo()); toMaster << data; } Perr<< "slave receiving from master " << Pstream::masterNo() << endl; - IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); + IPstream fromMaster(Pstream::commsTypes::blocking, Pstream::masterNo()); fromMaster >> data; Perr<< data << endl; } @@ -153,7 +153,7 @@ void testTransfer(const T& input) ) { Perr<< "master receiving from slave " << slave << endl; - IPstream fromSlave(Pstream::blocking, slave); + IPstream fromSlave(Pstream::commsTypes::blocking, slave); fromSlave >> data; Perr<< data << endl; } @@ -166,7 +166,7 @@ void testTransfer(const T& input) ) { Perr<< "master sending to slave " << slave << endl; - OPstream toSlave(Pstream::blocking, slave); + OPstream toSlave(Pstream::commsTypes::blocking, slave); toSlave << data; } } @@ -187,12 +187,21 @@ void testTokenized(const T& data) { { Perr<< "slave sending to master " << Pstream::masterNo() << endl; - OPstream toMaster(Pstream::blocking, Pstream::masterNo()); + OPstream toMaster + ( + Pstream::commsTypes::blocking, + Pstream::masterNo() + ); + toMaster << data; } Perr<< "slave receiving from master " << Pstream::masterNo() << endl; - IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); + IPstream fromMaster + ( + Pstream::commsTypes::blocking, + Pstream::masterNo() + ); fromMaster >> tok; Perr<< tok.info() << endl; @@ -207,7 +216,7 @@ void testTokenized(const T& data) ) { Perr<< "master receiving from slave " << slave << endl; - IPstream fromSlave(Pstream::blocking, slave); + IPstream fromSlave(Pstream::commsTypes::blocking, slave); fromSlave >> tok; Perr<< tok.info() << endl; } @@ -220,7 +229,7 @@ void testTokenized(const T& data) ) { Perr<< "master sending to slave " << slave << endl; - OPstream toSlave(Pstream::blocking, slave); + OPstream toSlave(Pstream::commsTypes::blocking, slave); toSlave << data; } } diff --git a/applications/test/router/Gather/Gather.C b/applications/test/router/Gather/Gather.C index dd2035b626..24391f4e35 100644 --- a/applications/test/router/Gather/Gather.C +++ b/applications/test/router/Gather/Gather.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,7 +63,7 @@ Gather::Gather(const T0& localData, const bool redistribute) slave++, procIndex++ ) { - IPstream fromSlave(Pstream::scheduled, slave); + IPstream fromSlave(Pstream::commsTypes::scheduled, slave); fromSlave >> this->operator[](procIndex); } @@ -75,7 +75,7 @@ Gather::Gather(const T0& localData, const bool redistribute) slave++, procIndex++ ) { - OPstream toSlave(Pstream::scheduled, slave); + OPstream toSlave(Pstream::commsTypes::scheduled, slave); if (redistribute) { @@ -92,13 +92,21 @@ Gather::Gather(const T0& localData, const bool redistribute) { // Slave: send my local data to master { - OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); + OPstream toMaster + ( + Pstream::commsTypes::scheduled, + Pstream::masterNo() + ); toMaster << localData; } // Receive data from master { - IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); + IPstream fromMaster + ( + Pstream::commsTypes::scheduled, + Pstream::masterNo() + ); if (redistribute) { fromMaster >> *this; diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index 5d6cdd3a69..ac85d25323 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -641,7 +641,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches labelList rotation(faces.size(), label(0)); labelList faceMap(faces.size(), label(-1)); - PstreamBuffers pBufs(Pstream::nonBlocking); + PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); // Send ordering forAll(sortMesh.boundaryMesh(), patchi) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index a26d989123..456ce03b8e 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -430,7 +430,7 @@ void Foam::mergeAndWrite // Receive slave ones for (int slave=1; slave> nbrPatchInfo; diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 2cc79daf72..0e1f3c253c 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -394,7 +394,7 @@ void getInterfaceSizes slave++ ) { - IPstream fromSlave(Pstream::blocking, slave); + IPstream fromSlave(Pstream::commsTypes::blocking, slave); EdgeMap> slaveSizes(fromSlave); @@ -439,7 +439,11 @@ void getInterfaceSizes { // Send to master { - OPstream toMaster(Pstream::blocking, Pstream::masterNo()); + OPstream toMaster + ( + Pstream::commsTypes::blocking, + Pstream::masterNo() + ); toMaster << regionsToSize; } } diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 48cfbac21f..5a8a64d037 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License @@ -46,6 +46,9 @@ Usage Decompose all regions in regionProperties. Does not check for existence of processor*. + - \par -copyZero + Copy \a 0 directory to processor* rather than decompose the fields. + - \par -copyUniform Copy any \a uniform directories too. @@ -162,6 +165,10 @@ void decomposeUniform const fileName timePath = processorDb.timePath(); + // If no fields have been decomposed the destination + // directory will not have been created so make sure. + mkDir(timePath); + if (copyUniform || mesh.distributed()) { cp @@ -172,7 +179,7 @@ void decomposeUniform } else { - // link with relative paths + // Link with relative paths string parentPath = string("..")/".."; if (regionDir != word::null) @@ -224,6 +231,11 @@ int main(int argc, char *argv[]) "decomposition method or as a volScalarField for post-processing." ); argList::addBoolOption + ( + "copyZero", + "Copy \a 0 directory to processor* rather than decompose the fields" + ); + argList::addBoolOption ( "copyUniform", "copy any uniform/ directories too" @@ -256,6 +268,7 @@ int main(int argc, char *argv[]) bool allRegions = args.optionFound("allRegions"); bool writeCellDist = args.optionFound("cellDist"); + bool copyZero = args.optionFound("copyZero"); bool copyUniform = args.optionFound("copyUniform"); bool decomposeFieldsOnly = args.optionFound("fields"); bool decomposeSets = !args.optionFound("noSets"); @@ -495,668 +508,715 @@ int main(int argc, char *argv[]) } - - // Caches - // ~~~~~~ - // Cached processor meshes and maps. These are only preserved if running - // with multiple times. - PtrList