From acaf72b4b4f6e6a13ae16bf1f8a91dbaed37ae1f Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sat, 13 Feb 2016 17:48:26 +0000 Subject: [PATCH] Solvers: Added support for extrapolated pressure boundary conditions The boundary conditions of HbyA are now constrained by the new "constrainHbyA" function which applies the velocity boundary values for patches for which the velocity cannot be modified by assignment and pressure extrapolation is not specified via the new "fixedFluxExtrapolatedPressureFvPatchScalarField". The new function "constrainPressure" sets the pressure gradient appropriately for "fixedFluxPressureFvPatchScalarField" and "fixedFluxExtrapolatedPressureFvPatchScalarField" boundary conditions to ensure the evaluated flux corresponds to the known velocity values at the boundary. The "fixedFluxPressureFvPatchScalarField" boundary condition operates exactly as before, ensuring the correct flux at fixed-flux boundaries by compensating for the body forces (gravity in particular) with the pressure gradient. The new "fixedFluxExtrapolatedPressureFvPatchScalarField" boundary condition may be used for cases with or without body-forces to set the pressure gradient to compensate not only for the body-force but also the extrapolated "HbyA" which provides a second-order boundary condition for pressure. This is useful for a range a problems including impinging flow, extrapolated inlet conditions with body-forces or for highly viscous flows, pressure-induced separation etc. To test this boundary condition at walls in the motorBike tutorial case set lowerWall { type fixedFluxExtrapolatedPressure; } motorBikeGroup { type fixedFluxExtrapolatedPressure; } Currently the new extrapolated pressure boundary condition is supported for all incompressible and sub-sonic compressible solvers except those providing implicit and tensorial porosity support. The approach will be extended to cover these solvers and options in the future. Note: the extrapolated pressure boundary condition is experimental and requires further testing to assess the range of applicability, stability, accuracy etc. Henry G. Weller CFD Direct Ltd. --- applications/solvers/DNS/dnsFoam/dnsFoam.C | 9 +- .../solvers/combustion/PDRFoam/pEqn.H | 4 +- applications/solvers/combustion/XiFoam/pEqn.H | 7 +- .../solvers/combustion/engineFoam/pEqn.H | 11 +- .../solvers/combustion/fireFoam/fireFoam.C | 3 +- .../solvers/combustion/fireFoam/pEqn.H | 16 +- .../solvers/combustion/reactingFoam/pEqn.H | 7 +- .../solvers/combustion/reactingFoam/pcEqn.H | 6 +- .../rhoReactingBuoyantFoam/pEqn.H | 16 +- .../rhoReactingBuoyantFoam.C | 3 +- .../reactingFoam/rhoReactingFoam/pEqn.H | 7 +- .../mixedFixedValueSlipFvPatchField.H | 9 ++ .../solvers/compressible/rhoPimpleFoam/pEqn.H | 7 +- .../compressible/rhoPimpleFoam/pcEqn.H | 6 +- .../rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H | 7 +- .../solvers/compressible/rhoSimpleFoam/pEqn.H | 12 +- .../compressible/rhoSimpleFoam/pcEqn.H | 8 +- .../rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H | 8 +- .../solvers/compressible/sonicFoam/pEqn.H | 5 +- .../sonicFoam/sonicDyMFoam/pEqn.H | 5 +- .../electromagnetics/mhdFoam/mhdFoam.C | 10 +- .../buoyantBoussinesqPimpleFoam.C | 3 +- .../buoyantBoussinesqPimpleFoam/pEqn.H | 15 +- .../buoyantBoussinesqSimpleFoam.C | 3 +- .../buoyantBoussinesqSimpleFoam/pEqn.H | 14 +- .../buoyantPimpleFoam/buoyantPimpleFoam.C | 3 +- .../heatTransfer/buoyantPimpleFoam/pEqn.H | 26 +--- .../buoyantSimpleFoam/buoyantSimpleFoam.C | 3 +- .../heatTransfer/buoyantSimpleFoam/pEqn.H | 16 +- .../chtMultiRegionFoam/chtMultiRegionFoam.C | 3 +- .../chtMultiRegionSimpleFoam.C | 3 +- .../chtMultiRegionSimpleFoam/fluid/pEqn.H | 16 +- .../chtMultiRegionFoam/fluid/pEqn.H | 16 +- .../adjointShapeOptimizationFoam.C | 8 +- .../solvers/incompressible/icoFoam/icoFoam.C | 9 +- .../nonNewtonianIcoFoam/nonNewtonianIcoFoam.C | 9 +- .../pimpleFoam/SRFPimpleFoam/pEqn.H | 3 + .../solvers/incompressible/pimpleFoam/pEqn.H | 19 +-- .../pimpleFoam/pimpleDyMFoam/pEqn.H | 19 +-- .../pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C | 3 +- .../incompressible/pimpleFoam/pimpleFoam.C | 3 +- .../solvers/incompressible/pisoFoam/pEqn.H | 6 +- .../simpleFoam/SRFSimpleFoam/pEqn.H | 3 + .../solvers/incompressible/simpleFoam/pEqn.H | 7 +- .../simpleFoam/porousSimpleFoam/pEqn.H | 7 +- .../solvers/lagrangian/DPMFoam/DPMFoam.C | 3 +- .../solvers/lagrangian/DPMFoam/pEqn.H | 11 +- .../lagrangian/coalChemistryFoam/pEqn.H | 7 +- .../lagrangian/reactingParcelFilmFoam/pEqn.H | 16 +- .../reactingParcelFilmFoam.C | 3 +- .../lagrangian/reactingParcelFoam/pEqn.H | 8 +- .../simpleReactingParcelFoam/pEqn.H | 11 +- .../solvers/lagrangian/sprayFoam/pEqn.H | 7 +- .../lagrangian/sprayFoam/sprayDyMFoam/pEqn.H | 7 +- .../cavitatingFoam/cavitatingDyMFoam/pEqn.H | 4 +- .../solvers/multiphase/cavitatingFoam/pEqn.H | 4 +- .../compressibleInterDyMFoam.C | 3 +- .../compressibleInterDyMFoam/pEqn.H | 16 +- .../compressibleInterFoam.C | 3 +- .../multiphase/compressibleInterFoam/pEqn.H | 16 +- .../compressibleMultiphaseInterFoam.C | 3 +- .../compressibleMultiphaseInterFoam/pEqn.H | 16 +- .../multiphase/driftFluxFoam/driftFluxFoam.C | 3 +- .../solvers/multiphase/driftFluxFoam/pEqn.H | 16 +- .../interFoam/interDyMFoam/interDyMFoam.C | 3 +- .../multiphase/interFoam/interDyMFoam/pEqn.H | 16 +- .../solvers/multiphase/interFoam/interFoam.C | 3 +- .../interMixingFoam/interMixingFoam.C | 3 +- .../solvers/multiphase/interFoam/pEqn.H | 14 +- .../interPhaseChangeDyMFoam.C | 3 +- .../interPhaseChangeDyMFoam/pEqn.H | 16 +- .../interPhaseChangeFoam.C | 3 +- .../multiphase/interPhaseChangeFoam/pEqn.H | 16 +- .../multiphaseEulerFoam/multiphaseEulerFoam.C | 3 +- .../multiphaseInterDyMFoam.C | 3 +- .../multiphaseInterFoam/multiphaseInterFoam.C | 3 +- .../potentialFreeSurfaceFoam/pEqn.H | 15 +- .../potentialFreeSurfaceDyMFoam/pEqn.H | 15 +- .../potentialFreeSurfaceDyMFoam.C | 3 +- .../potentialFreeSurfaceFoam.C | 3 +- .../reactingMultiphaseEulerFoam.C | 3 +- .../reactingTwoPhaseEulerFoam.C | 3 +- .../multiphase/twoLiquidMixingFoam/pEqn.H | 16 +- .../twoLiquidMixingFoam/twoLiquidMixingFoam.C | 3 +- .../twoPhaseEulerFoam/twoPhaseEulerFoam.C | 3 +- src/finiteVolume/Make/files | 2 + .../general/constrainHbyA/constrainHbyA.C | 73 +++++++++ .../general/constrainHbyA/constrainHbyA.H | 61 ++++++++ .../constrainPressure/constrainPressure.C | 134 ++++++++++++++++ .../constrainPressure/constrainPressure.H | 131 ++++++++++++++++ .../cfdTools/general/include/fvCFD.H | 3 + ...uxExtrapolatedPressureFvPatchScalarField.C | 100 ++++++++++++ ...uxExtrapolatedPressureFvPatchScalarField.H | 147 ++++++++++++++++++ .../circuitBoardCooling/system/fvSchemes | 8 +- .../pimpleFoam/pitzDaily/system/fvSchemes | 11 +- 95 files changed, 886 insertions(+), 474 deletions(-) create mode 100644 src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.C create mode 100644 src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.H create mode 100644 src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.C create mode 100644 src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.H create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.H diff --git a/applications/solvers/DNS/dnsFoam/dnsFoam.C b/applications/solvers/DNS/dnsFoam/dnsFoam.C index 38c5b7be8..238a05c69 100644 --- a/applications/solvers/DNS/dnsFoam/dnsFoam.C +++ b/applications/solvers/DNS/dnsFoam/dnsFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,9 +88,7 @@ int main(int argc, char *argv[]) { volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -98,6 +96,9 @@ int main(int argc, char *argv[]) + rAUf*fvc::ddtCorr(U, phi) ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, U, phiHbyA, rAUf); + fvScalarMatrix pEqn ( fvm::laplacian(rAUf, p) == fvc::div(phiHbyA) diff --git a/applications/solvers/combustion/PDRFoam/pEqn.H b/applications/solvers/combustion/PDRFoam/pEqn.H index 499885875..b8d21b7e3 100644 --- a/applications/solvers/combustion/PDRFoam/pEqn.H +++ b/applications/solvers/combustion/PDRFoam/pEqn.H @@ -1,9 +1,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); - -volVectorField HbyA("HbyA", U); -HbyA = invA & UEqn.H(); +volVectorField HbyA(constrainHbyA(invA & UEqn.H(), U, p)); if (pimple.transonic()) { diff --git a/applications/solvers/combustion/XiFoam/pEqn.H b/applications/solvers/combustion/XiFoam/pEqn.H index 2b11dc73f..39830d013 100644 --- a/applications/solvers/combustion/XiFoam/pEqn.H +++ b/applications/solvers/combustion/XiFoam/pEqn.H @@ -2,9 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn.H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); if (pimple.transonic()) { @@ -52,6 +50,9 @@ else MRF.makeRelative(phiHbyA); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn diff --git a/applications/solvers/combustion/engineFoam/pEqn.H b/applications/solvers/combustion/engineFoam/pEqn.H index c962353e3..d84b9bd15 100644 --- a/applications/solvers/combustion/engineFoam/pEqn.H +++ b/applications/solvers/combustion/engineFoam/pEqn.H @@ -2,9 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn.H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); if (pimple.transonic()) { @@ -29,7 +27,7 @@ if (pimple.transonic()) ( fvm::ddt(psi, p) + fvm::div(phid, p) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) ); @@ -56,13 +54,16 @@ else 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()) { fvScalarMatrix pEqn ( fvm::ddt(psi, p) + fvc::div(phiHbyA) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) ); diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index 34e97b634..fd8e2a435 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,6 @@ Description #include "psiCombustionModel.H" #include "pimpleControl.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H index 6f8b03458..11f140577 100644 --- a/applications/solvers/combustion/fireFoam/pEqn.H +++ b/applications/solvers/combustion/fireFoam/pEqn.H @@ -2,9 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn.H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -20,16 +18,8 @@ surfaceScalarField phiHbyA MRF.makeRelative(fvc::interpolate(rho), phiHbyA); -// Update the fixedFluxPressure BCs to ensure flux consistency -setSnGrad -( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - *rho.boundaryField() - )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()) -); +// Update the pressure BCs to ensure flux consistency +constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/combustion/reactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/pEqn.H index 2f352db5d..ae5478c5b 100644 --- a/applications/solvers/combustion/reactingFoam/pEqn.H +++ b/applications/solvers/combustion/reactingFoam/pEqn.H @@ -5,9 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); if (pimple.nCorrPISO() <= 1) { @@ -60,6 +58,9 @@ else 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 diff --git a/applications/solvers/combustion/reactingFoam/pcEqn.H b/applications/solvers/combustion/reactingFoam/pcEqn.H index 3d7fffc45..8bef07a5b 100644 --- a/applications/solvers/combustion/reactingFoam/pcEqn.H +++ b/applications/solvers/combustion/reactingFoam/pcEqn.H @@ -5,8 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1())); -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); if (pimple.nCorrPISO() <= 1) { @@ -76,6 +75,9 @@ else 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 diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H index 965ff5bad..ad01cd5f8 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H @@ -7,9 +7,7 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -25,16 +23,8 @@ MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - *rho.boundaryField() - )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF); fvScalarMatrix p_rghDDtEqn ( diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C index 11c028d16..bff96fdb8 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,6 @@ Description #include "multivariateScheme.H" #include "pimpleControl.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H index c3b18e6bd..cd1915346 100644 --- a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H @@ -7,9 +7,7 @@ volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); if (pimple.transonic()) { @@ -65,6 +63,9 @@ MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + fvScalarMatrix pDDtEqn ( fvc::ddt(rho) + psi*correction(fvm::ddt(p)) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H index 8c98fb5f8..5ab7d3835 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H @@ -130,6 +130,15 @@ public: // Member functions + // Access + + //- Return false: this patch field is not altered by assignment + virtual bool assignable() const + { + return false; + } + + // Mapping functions //- Map (and resize as needed) from self given a mapping object diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index 2f352db5d..ae5478c5b 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -5,9 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); if (pimple.nCorrPISO() <= 1) { @@ -60,6 +58,9 @@ else 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 diff --git a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H index 3d7fffc45..8bef07a5b 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H @@ -5,8 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1())); -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); if (pimple.nCorrPISO() <= 1) { @@ -76,6 +75,9 @@ else 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 diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H index 33039b3dc..615682db1 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleDyMFoam/pEqn.H @@ -5,9 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); if (pimple.nCorrPISO() <= 1) { @@ -60,6 +58,9 @@ else 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 diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index 38c9806ee..4c6276711 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -1,8 +1,7 @@ { volScalarField rAU(1.0/UEqn().A()); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); - + surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); UEqn.clear(); bool closedVolume = false; @@ -23,7 +22,7 @@ fvScalarMatrix pEqn ( fvm::div(phid, p) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) ); @@ -53,12 +52,15 @@ 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 ( fvc::div(phiHbyA) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rhorAUf, p) == fvOptions(psi, p, rho.name()) ); diff --git a/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H index 82161f230..7b77048a9 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H @@ -1,9 +1,6 @@ volScalarField rAU(1.0/UEqn().A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1())); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); - +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); UEqn.clear(); bool closedVolume = false; @@ -70,6 +67,9 @@ else 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/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H index b0af0e3f8..d54f7eec2 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H @@ -1,16 +1,16 @@ { const volScalarField& psi = thermo.psi(); - volVectorField HbyA("HbyA", U); - + tmp tHbyA; if (pressureImplicitPorosity) { - HbyA = trTU() & UEqn().H(); + tHbyA = constrainHbyA(trTU()&UEqn().H(), U, p); } else { - HbyA = trAU()*UEqn().H(); + tHbyA = constrainHbyA(trAU()*UEqn().H(), U, p); } + volVectorField& HbyA = tHbyA(); UEqn.clear(); diff --git a/applications/solvers/compressible/sonicFoam/pEqn.H b/applications/solvers/compressible/sonicFoam/pEqn.H index d61808b23..f4f6d5ae2 100644 --- a/applications/solvers/compressible/sonicFoam/pEqn.H +++ b/applications/solvers/compressible/sonicFoam/pEqn.H @@ -2,10 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn.H(); - +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phid ( "phid", diff --git a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/pEqn.H b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/pEqn.H index 439709ed0..283e450e0 100644 --- a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/pEqn.H +++ b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/pEqn.H @@ -2,10 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn.H(); - +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phid ( "phid", diff --git a/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C b/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C index c9cb0242b..0d21312a3 100644 --- a/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C +++ b/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -97,10 +97,7 @@ int main(int argc, char *argv[]) { volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -108,6 +105,9 @@ int main(int argc, char *argv[]) + rAUf*fvc::ddtCorr(U, phi) ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, U, phiHbyA, rAUf); + while (piso.correctNonOrthogonal()) { fvScalarMatrix pEqn diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C index cead65466..eb0bf5fcb 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/buoyantBoussinesqPimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,6 @@ Description #include "radiationModel.H" #include "fvOptions.H" #include "pimpleControl.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H index 9ec089ee4..a9be0e59f 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H @@ -1,9 +1,7 @@ { volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phig(-rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf()); @@ -17,15 +15,8 @@ MRF.makeRelative(phiHbyA); - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C index 35b49c8b8..63c35ed42 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,6 @@ Description #include "radiationModel.H" #include "fvOptions.H" #include "simpleControl.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H index b6d806735..13200035d 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H @@ -1,9 +1,8 @@ { volScalarField rAU("rAU", 1.0/UEqn().A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_rgh)); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); UEqn.clear(); surfaceScalarField phig(-rAUf*ghf*fvc::snGrad(rhok)*mesh.magSf()); @@ -20,15 +19,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); while (simple.correctNonOrthogonal()) { diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index d683e8fbe..7a956a09e 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,6 @@ Description #include "radiationModel.H" #include "fvOptions.H" #include "pimpleControl.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index e2f99671a..66864139f 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -6,35 +6,25 @@ thermo.rho() -= psi*p_rgh; volScalarField rAU(1.0/UEqn.A()); - surfaceScalarField rAUf("rAUf", fvc::interpolate(rho*rAU)); + surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - - surfaceScalarField phig(-rAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); + surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); surfaceScalarField phiHbyA ( "phiHbyA", ( (fvc::interpolate(rho*HbyA) & mesh.Sf()) - + rAUf*fvc::ddtCorr(rho, U, phi) + + rhorAUf*fvc::ddtCorr(rho, U, phi) ) + phig ); MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - *rho.boundaryField() - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF); fvScalarMatrix p_rghDDtEqn ( @@ -49,7 +39,7 @@ fvScalarMatrix p_rghEqn ( p_rghDDtEqn - - fvm::laplacian(rAUf, p_rgh) + - fvm::laplacian(rhorAUf, p_rgh) ); p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); @@ -64,7 +54,7 @@ // Correct the momentum source with the pressure gradient flux // calculated from the relaxed pressure - U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf); + U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf); U.correctBoundaryConditions(); fvOptions.correct(U); K = 0.5*magSqr(U); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C index 21a9ed952..c31980441 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,6 @@ Description #include "radiationModel.H" #include "simpleControl.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 85157e8b2..132e440bc 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -4,9 +4,7 @@ volScalarField rAU("rAU", 1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_rgh)); UEqn.clear(); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -23,16 +21,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - *rho.boundaryField() - )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF); while (simple.correctNonOrthogonal()) { diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C index ec0532c11..f8c62042d 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,6 @@ Description #include "radiationModel.H" #include "fvOptions.H" #include "coordinateSystem.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index 625737aed..6b4811a02 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,6 @@ Description #include "radiationModel.H" #include "fvOptions.H" #include "coordinateSystem.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H index ccae3cc07..341de6b13 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H @@ -6,9 +6,7 @@ volScalarField rAU("rAU", 1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_rgh)); UEqn.clear(); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -25,16 +23,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - *rho.boundaryField() - )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF); dimensionedScalar compressibility = fvc::domainIntegrate(psi); bool compressible = (compressibility.value() > SMALL); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H index 002faddb5..0b82c4406 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H @@ -7,9 +7,7 @@ volScalarField rAU("rAU", 1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_rgh)); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -25,16 +23,8 @@ MRF.makeRelative(fvc::interpolate(rho), phiHbyA); - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - *rho.boundaryField() - )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF); { fvScalarMatrix p_rghDDtEqn diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C index baf2518aa..fbd8e5f15 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,8 +125,7 @@ int main(int argc, char *argv[]) fvOptions.correct(U); volScalarField rAU(1.0/UEqn().A()); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); UEqn.clear(); surfaceScalarField phiHbyA ( @@ -135,6 +134,9 @@ int main(int argc, char *argv[]) ); adjustPhi(phiHbyA, U, p); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, U, phiHbyA, rAU); + // Non-orthogonal pressure corrector loop while (simple.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/icoFoam/icoFoam.C b/applications/solvers/incompressible/icoFoam/icoFoam.C index 80e13faa8..e3a7fb67c 100644 --- a/applications/solvers/incompressible/icoFoam/icoFoam.C +++ b/applications/solvers/incompressible/icoFoam/icoFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,9 +73,7 @@ int main(int argc, char *argv[]) while (piso.correct()) { volScalarField rAU(1.0/UEqn.A()); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -85,6 +83,9 @@ int main(int argc, char *argv[]) adjustPhi(phiHbyA, U, p); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, U, phiHbyA, rAU); + // Non-orthogonal pressure corrector loop while (piso.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/nonNewtonianIcoFoam/nonNewtonianIcoFoam.C b/applications/solvers/incompressible/nonNewtonianIcoFoam/nonNewtonianIcoFoam.C index 9d3b567d3..3edbedf39 100644 --- a/applications/solvers/incompressible/nonNewtonianIcoFoam/nonNewtonianIcoFoam.C +++ b/applications/solvers/incompressible/nonNewtonianIcoFoam/nonNewtonianIcoFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,9 +77,7 @@ int main(int argc, char *argv[]) while (piso.correct()) { volScalarField rAU(1.0/UEqn.A()); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -89,6 +87,9 @@ int main(int argc, char *argv[]) adjustPhi(phiHbyA, U, p); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, U, phiHbyA, rAU); + // Non-orthogonal pressure corrector loop while (piso.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H index d305d1a26..0e3936bc5 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/pEqn.H @@ -26,6 +26,9 @@ if (pimple.nCorrPISO() <= 1) UrelEqn.clear(); } +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, Urel, phiHbyA, rAtUrel()); + // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index 18083aa81..6d4eb9033 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -1,7 +1,5 @@ volScalarField rAU(1.0/UEqn().A()); -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); - +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -28,17 +26,8 @@ if (pimple.nCorrPISO() <= 1) UEqn.clear(); } -surfaceScalarField rAUf("rAUf", fvc::interpolate(rAtU())); - -// Update the fixedFluxPressure BCs to ensure flux consistency -setSnGrad -( - p.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) -); +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, U, phiHbyA, rAtU(), MRF); // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) @@ -46,7 +35,7 @@ while (pimple.correctNonOrthogonal()) // Pressure corrector fvScalarMatrix pEqn ( - fvm::laplacian(rAUf, p) == fvc::div(phiHbyA) + fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H index 5b5fe720a..f4106997c 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H @@ -1,7 +1,5 @@ volScalarField rAU(1.0/UEqn().A()); -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); - +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -33,24 +31,15 @@ if (pimple.nCorrPISO() <= 1) UEqn.clear(); } -surfaceScalarField rAUf("rAUf", fvc::interpolate(rAtU())); - -// Update the fixedFluxPressure BCs to ensure flux consistency -setSnGrad -( - p.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) -); +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, U, phiHbyA, rAtU(), MRF); // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( - fvm::laplacian(rAUf, p) == fvc::div(phiHbyA) + fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C index 54c94d9c7..9db684476 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,6 @@ Description #include "pimpleControl.H" #include "CorrectPhi.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index feeeaa000..a065bcbd3 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,6 @@ Description #include "turbulentTransportModel.H" #include "pimpleControl.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/incompressible/pisoFoam/pEqn.H b/applications/solvers/incompressible/pisoFoam/pEqn.H index f8c5a4597..7d3284e0d 100644 --- a/applications/solvers/incompressible/pisoFoam/pEqn.H +++ b/applications/solvers/incompressible/pisoFoam/pEqn.H @@ -1,6 +1,5 @@ volScalarField rAU(1.0/UEqn.A()); -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn.H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -12,6 +11,9 @@ MRF.makeRelative(phiHbyA); adjustPhi(phiHbyA, U, p); +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, U, phiHbyA, rAU, MRF); + // Non-orthogonal pressure corrector loop while (piso.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H index 50691c015..636a4c571 100644 --- a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H @@ -18,6 +18,9 @@ UrelEqn.clear(); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, Urel, phiHbyA, rAtUrel()); + // Non-orthogonal pressure corrector loop while (simple.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index 4438a3bff..b506bf43c 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -1,8 +1,6 @@ { volScalarField rAU(1.0/UEqn().A()); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); MRF.makeRelative(phiHbyA); adjustPhi(phiHbyA, U, p); @@ -19,6 +17,9 @@ UEqn.clear(); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, U, phiHbyA, rAtU(), MRF); + // Non-orthogonal pressure corrector loop while (simple.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H index b4a0f2e66..e4ad23aab 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H @@ -1,12 +1,13 @@ -volVectorField HbyA("HbyA", U); +tmp tHbyA; if (pressureImplicitPorosity) { - HbyA = trTU()&UEqn().H(); + tHbyA = constrainHbyA(trTU()&UEqn().H(), U, p); } else { - HbyA = trAU()*UEqn().H(); + tHbyA = constrainHbyA(trAU()*UEqn().H(), U, p); } +volVectorField& HbyA = tHbyA(); UEqn.clear(); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); diff --git a/applications/solvers/lagrangian/DPMFoam/DPMFoam.C b/applications/solvers/lagrangian/DPMFoam/DPMFoam.C index 8999e0366..9e2208479 100644 --- a/applications/solvers/lagrangian/DPMFoam/DPMFoam.C +++ b/applications/solvers/lagrangian/DPMFoam/DPMFoam.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-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,6 @@ Description #include "singlePhaseTransportModel.H" #include "PhaseIncompressibleTurbulenceModel.H" #include "pimpleControl.H" -#include "fixedFluxPressureFvPatchScalarField.H" #ifdef MPPIC #include "basicKinematicMPPICCloud.H" diff --git a/applications/solvers/lagrangian/DPMFoam/pEqn.H b/applications/solvers/lagrangian/DPMFoam/pEqn.H index 34cce4f16..6b7084de6 100644 --- a/applications/solvers/lagrangian/DPMFoam/pEqn.H +++ b/applications/solvers/lagrangian/DPMFoam/pEqn.H @@ -12,15 +12,8 @@ ) ); - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & Uc.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUcf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, Uc, phiHbyA, rAUcf); // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) diff --git a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H index 480ce25f7..ce9f81964 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H @@ -2,9 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn.H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); if (pimple.transonic()) { @@ -53,6 +51,9 @@ else 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 diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H index 6f8b03458..11f140577 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H @@ -2,9 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn.H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -20,16 +18,8 @@ surfaceScalarField phiHbyA MRF.makeRelative(fvc::interpolate(rho), phiHbyA); -// Update the fixedFluxPressure BCs to ensure flux consistency -setSnGrad -( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - *rho.boundaryField() - )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()) -); +// Update the pressure BCs to ensure flux consistency +constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C index 220e2f28a..0f54e9fdc 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,6 @@ Description #include "SLGThermo.H" #include "fvOptions.H" #include "pimpleControl.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index f266fded0..cb5b083b8 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -7,10 +7,7 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -22,6 +19,9 @@ MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + fvScalarMatrix pDDtEqn ( fvc::ddt(rho) + psi*correction(fvm::ddt(p)) diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H index b5d3e1471..aa775bc0d 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H @@ -4,11 +4,9 @@ thermo.rho() -= psi*p; volScalarField rAU(1.0/UEqn().A()); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); - + surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); UEqn.clear(); - surfaceScalarField phiHbyA ( "phiHbyA", @@ -17,12 +15,15 @@ MRF.makeRelative(fvc::interpolate(rho), phiHbyA); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF); + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( fvc::div(phiHbyA) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rhorAUf, p) == parcels.Srho() + fvOptions(psi, p, rho.name()) diff --git a/applications/solvers/lagrangian/sprayFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/pEqn.H index ee450daab..5d2841268 100644 --- a/applications/solvers/lagrangian/sprayFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/pEqn.H @@ -5,9 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); if (pimple.nCorrPISO() <= 1) { @@ -61,6 +59,9 @@ else 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 diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H index c620a892d..406128fee 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H @@ -5,9 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p)); if (pimple.nCorrPISO() <= 1) { @@ -61,6 +59,9 @@ else 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()) { fvScalarMatrix pEqn diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H index b07846b6d..37892c0e7 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H @@ -13,9 +13,7 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); phi = (fvc::interpolate(HbyA) & mesh.Sf()) + rhorAUf*fvc::ddtCorr(U, Uf); diff --git a/applications/solvers/multiphase/cavitatingFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/pEqn.H index da8047914..5b238ccef 100644 --- a/applications/solvers/multiphase/cavitatingFoam/pEqn.H +++ b/applications/solvers/multiphase/cavitatingFoam/pEqn.H @@ -13,9 +13,7 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); phi = (fvc::interpolate(HbyA) & mesh.Sf()) + rhorAUf*fvc::ddtCorr(U, phi); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C index 410bb604b..65cc137ac 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,7 +47,6 @@ Description #include "turbulentFluidThermoModel.H" #include "pimpleControl.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H index 89089fe61..e1ac12881 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H @@ -1,10 +1,7 @@ { volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -22,15 +19,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf); // Make the fluxes relative to the mesh motion fvc::makeRelative(phiHbyA, U); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 1db6fc06f..efbdc398c 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,7 +44,6 @@ Description #include "twoPhaseMixtureThermo.H" #include "turbulentFluidThermoModel.H" #include "pimpleControl.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index 673f1c827..fb23042a8 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -1,10 +1,7 @@ { volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -22,15 +19,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf); tmp p_rghEqnComp1; tmp p_rghEqnComp2; diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseInterFoam.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseInterFoam.C index c968a4e31..8c8de8af6 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseInterFoam.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/compressibleMultiphaseInterFoam.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-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,6 @@ Description #include "multiphaseMixtureThermo.H" #include "turbulentFluidThermoModel.H" #include "pimpleControl.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/pEqn.H index a8f4bcb9f..ccf4bc979 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/pEqn.H @@ -1,10 +1,7 @@ { volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -22,15 +19,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf); PtrList p_rghEqnComps(mixture.phases().size()); diff --git a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C index a026a32fa..c0a2be76a 100644 --- a/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C +++ b/applications/solvers/multiphase/driftFluxFoam/driftFluxFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,6 @@ Description #include "CompressibleTurbulenceModel.H" #include "pimpleControl.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" #include "gaussLaplacianScheme.H" #include "uncorrectedSnGrad.H" diff --git a/applications/solvers/multiphase/driftFluxFoam/pEqn.H b/applications/solvers/multiphase/driftFluxFoam/pEqn.H index 73c6ea987..6cc93506d 100644 --- a/applications/solvers/multiphase/driftFluxFoam/pEqn.H +++ b/applications/solvers/multiphase/driftFluxFoam/pEqn.H @@ -1,10 +1,7 @@ { volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -23,15 +20,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index af6c779a0..efebaff8b 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,7 +44,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H index 8400d2468..e6723f47b 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H @@ -1,10 +1,7 @@ { rAU = 1.0/UEqn.A(); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -30,15 +27,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 63d9a344e..a341b64e1 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,7 +48,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index 19afacf2e..24c292b87 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" diff --git a/applications/solvers/multiphase/interFoam/pEqn.H b/applications/solvers/multiphase/interFoam/pEqn.H index 31982f4c1..42cf70fce 100644 --- a/applications/solvers/multiphase/interFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/pEqn.H @@ -2,8 +2,7 @@ volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( @@ -24,15 +23,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C index cf7ffd887..2524965b2 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/interPhaseChangeDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H index a1b9241fa..f28bb8c2a 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeDyMFoam/pEqn.H @@ -1,10 +1,7 @@ { rAU = 1.0/UEqn.A(); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -29,15 +26,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf); Pair> vDotP = mixture->vDotP(); const volScalarField& vDotcP = vDotP[0](); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index 003d9a58a..3639bd4c4 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,7 +48,6 @@ Description #include "turbulentTransportModel.H" #include "pimpleControl.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H index 497a6e3d6..fd85d9671 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H @@ -1,10 +1,7 @@ { volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -23,15 +20,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf); Pair> vDotP = mixture->vDotP(); const volScalarField& vDotcP = vDotP[0](); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C index 61cc90547..437548bca 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,7 +40,6 @@ Description #include "pimpleControl.H" #include "IOMRFZoneList.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/multiphaseInterDyMFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/multiphaseInterDyMFoam.C index c93056f32..a247985a3 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/multiphaseInterDyMFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterDyMFoam/multiphaseInterDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C index 4bc2f55c4..7451a669b 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H index 6a65b215b..e18235011 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H @@ -1,8 +1,6 @@ volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - -volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_gh)); if (pimple.nCorrPISO() <= 1) { @@ -19,15 +17,8 @@ surfaceScalarField phiHbyA MRF.makeRelative(phiHbyA); adjustPhi(phiHbyA, U, p_gh); -// Update the fixedFluxPressure BCs to ensure flux consistency -setSnGrad -( - p_gh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) -); +// Update the pressure BCs to ensure flux consistency +constrainPressure(p_gh, U, phiHbyA, rAUf); // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H index 01f548ad1..04b187cf8 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H @@ -1,9 +1,7 @@ { rAU = 1.0/UEqn().A(); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); + volVectorField HbyA(constrainHbyA(rAU*UEqn().H(), U, p_gh)); if (pimple.nCorrPISO() <= 1) { @@ -26,15 +24,8 @@ fvc::makeAbsolute(phiHbyA, U); } - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_gh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_gh, U, phiHbyA, rAUf); // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/potentialFreeSurfaceDyMFoam.C b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/potentialFreeSurfaceDyMFoam.C index 9b1a8db08..0499a9c9d 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/potentialFreeSurfaceDyMFoam.C +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/potentialFreeSurfaceDyMFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,7 +44,6 @@ Description #include "pimpleControl.H" #include "fvOptions.H" #include "CorrectPhi.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C index 2db15eb83..8371a3080 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,6 @@ Description #include "turbulentTransportModel.H" #include "pimpleControl.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/reactingMultiphaseEulerFoam.C b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/reactingMultiphaseEulerFoam.C index d5c48d47a..a98129cc7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/reactingMultiphaseEulerFoam.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/reactingMultiphaseEulerFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,6 @@ Description #include "fvCFD.H" #include "multiphaseSystem.H" -#include "fixedFluxPressureFvPatchScalarField.H" #include "pimpleControl.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C index 00672f2f0..0e5542672 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/reactingTwoPhaseEulerFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,6 @@ Description #include "fvCFD.H" #include "twoPhaseSystem.H" #include "phaseCompressibleTurbulenceModel.H" -#include "fixedFluxPressureFvPatchScalarField.H" #include "pimpleControl.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H b/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H index 4a89f67d8..870034570 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/pEqn.H @@ -1,10 +1,7 @@ { volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); - - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); - + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); surfaceScalarField phiHbyA ( "phiHbyA", @@ -20,15 +17,8 @@ phiHbyA += phig; - // Update the fixedFluxPressure BCs to ensure flux consistency - setSnGrad - ( - p_rgh.boundaryField(), - ( - phiHbyA.boundaryField() - - (mesh.Sf().boundaryField() & U.boundaryField()) - )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) - ); + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf); while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C index 298d5366c..0d9b13473 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,7 +37,6 @@ Description #include "incompressibleTwoPhaseMixture.H" #include "turbulentTransportModel.H" #include "pimpleControl.H" -#include "fixedFluxPressureFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C index 3027ae88b..32dd1a59b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,6 @@ Description #include "PhaseCompressibleTurbulenceModel.H" #include "pimpleControl.H" #include "fvOptions.H" -#include "fixedFluxPressureFvPatchScalarField.H" #include "fixedValueFvsPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 4506679f7..eda874fd0 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -138,6 +138,7 @@ $(derivedFvPatchFields)/externalCoupledMixed/externalCoupledMixedFvPatchFields.C $(derivedFvPatchFields)/fan/fanFvPatchFields.C $(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +$(derivedFvPatchFields)/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C $(derivedFvPatchFields)/fixedJump/fixedJumpFvPatchFields.C $(derivedFvPatchFields)/fixedJumpAMI/fixedJumpAMIFvPatchFields.C @@ -394,6 +395,7 @@ finiteVolume/fvc/fvcReconstructMag.C general = cfdTools/general $(general)/findRefCell/findRefCell.C +$(general)/constrainHbyA/constrainHbyA.C $(general)/adjustPhi/adjustPhi.C $(general)/bound/bound.C $(general)/CorrectPhi/correctUphiBCs.C diff --git a/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.C b/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.C new file mode 100644 index 000000000..beb2c223e --- /dev/null +++ b/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +#include "constrainHbyA.H" +#include "volFields.H" +#include "fixedFluxExtrapolatedPressureFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::tmp Foam::constrainHbyA +( + const tmp& tHbyA, + const volVectorField& U, + const volScalarField& p +) +{ + tmp tHbyANew; + + if (tHbyA.isTmp()) + { + volVectorField* HbyAPtr = tHbyA.ptr(); + HbyAPtr->rename("HbyA"); + tHbyANew = HbyAPtr; + } + else + { + tHbyANew = new volVectorField("HbyA", tHbyA); + } + + volVectorField& HbyA = tHbyANew(); + + forAll(U.boundaryField(), patchi) + { + if + ( + !U.boundaryField()[patchi].assignable() + && !isA + ( + p.boundaryField()[patchi] + ) + ) + { + HbyA.boundaryField()[patchi] = U.boundaryField()[patchi]; + } + } + + return tHbyANew; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.H b/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.H new file mode 100644 index 000000000..bc5a91475 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/constrainHbyA/constrainHbyA.H @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 . + +Class + Foam::constrainHbyA + +Description + +SourceFiles + constrainHbyA.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constrainHbyA_H +#define constrainHbyA_H + +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +tmp constrainHbyA +( + const tmp& tHbyA, + const volVectorField& U, + const volScalarField& p +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.C b/src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.C new file mode 100644 index 000000000..c086d5f3e --- /dev/null +++ b/src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.C @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +#include "constrainPressure.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "geometricOneField.H" +#include "fixedFluxPressureFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void Foam::constrainPressure +( + volScalarField& p, + const RhoType& rho, + const volVectorField& U, + const surfaceScalarField& phiHbyA, + const RAUType& rhorAU, + const MRFType& MRF +) +{ + const fvMesh& mesh = p.mesh(); + volScalarField::GeometricBoundaryField& pBf = p.boundaryField(); + + bool hasFixedFluxBCs = false; + forAll(pBf, patchi) + { + if (isA(pBf[patchi])) + { + hasFixedFluxBCs = true; + break; + } + } + + if (hasFixedFluxBCs) + { + const surfaceScalarField::GeometricBoundaryField& phiHbyABf = + phiHbyA.boundaryField(); + const typename RAUType::GeometricBoundaryField& rhorAUBf = + rhorAU.boundaryField(); + const surfaceScalarField::GeometricBoundaryField& magSfBf = + mesh.magSf().boundaryField(); + + // Pre-compute tho relative flux for all patches: currently MRFZone does + // not support computing the relative flux for individual patches + FieldField phiRelBf + ( + MRF.relative(mesh.Sf().boundaryField() & U.boundaryField()) + ); + + forAll(pBf, patchi) + { + if (isA(pBf[patchi])) + { + refCast(pBf[patchi]) + .updateCoeffs + ( + ( + phiHbyABf[patchi] + - rho.boundaryField()[patchi]*phiRelBf[patchi] + ) + /(magSfBf[patchi]*rhorAUBf[patchi]) + ); + } + } + } +} + + +template +void Foam::constrainPressure +( + volScalarField& p, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phiHbyA, + const RAUType& rAU +) +{ + constrainPressure(p, rho, U, phiHbyA, rAU, NullMRF()); +} + + +template +void Foam::constrainPressure +( + volScalarField& p, + const volVectorField& U, + const surfaceScalarField& phiHbyA, + const RAUType& rAU, + const MRFType& MRF +) +{ + constrainPressure(p, geometricOneField(), U, phiHbyA, rAU, MRF); +} + + +template +void Foam::constrainPressure +( + volScalarField& p, + const volVectorField& U, + const surfaceScalarField& phiHbyA, + const RAUType& rAU +) +{ + constrainPressure(p, U, phiHbyA, rAU, NullMRF()); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.H b/src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.H new file mode 100644 index 000000000..b3e522ee0 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/constrainPressure/constrainPressure.H @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 . + +Class + Foam::constrainPressure + +Description + +SourceFiles + constrainPressure.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constrainPressure_H +#define constrainPressure_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "IOMRFZoneList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +/*---------------------------------------------------------------------------*\ + Class NullMRF Declaration +\*---------------------------------------------------------------------------*/ + +class NullMRF +{ +public: + + // Constructors + + //- Construct null + NullMRF() + {} + + + // Member Functions + + //- Return the argument unchanged + template + inline const Type& relative(const Type& U) const + { + return U; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void constrainPressure +( + volScalarField& p, + const RhoType& rho, + const volVectorField& U, + const surfaceScalarField& phiHbyA, + const RAUType& rhorAU, + const MRFType& MRF +); + +template +void constrainPressure +( + volScalarField& p, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phiHbyA, + const RAUType& rhorAU +); + +template +void constrainPressure +( + volScalarField& p, + const volVectorField& U, + const surfaceScalarField& phiHbyA, + const RAUType& rAU, + const MRFType& MRF +); + +template +void constrainPressure +( + volScalarField& p, + const volVectorField& U, + const surfaceScalarField& phiHbyA, + const RAUType& rAU +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "constrainPressure.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/include/fvCFD.H b/src/finiteVolume/cfdTools/general/include/fvCFD.H index d8eb111f5..bc21a17c4 100644 --- a/src/finiteVolume/cfdTools/general/include/fvCFD.H +++ b/src/finiteVolume/cfdTools/general/include/fvCFD.H @@ -12,6 +12,9 @@ #include "uniformDimensionedFields.H" #include "calculatedFvPatchFields.H" #include "fixedValueFvPatchFields.H" +#include "fixedFluxPressureFvPatchScalarField.H" +#include "constrainHbyA.H" +#include "constrainPressure.H" #include "adjustPhi.H" #include "findRefCell.H" #include "IOMRFZoneList.H" diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.C new file mode 100644 index 000000000..6fc0fd67c --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +#include "fixedFluxExtrapolatedPressureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fixedFluxExtrapolatedPressureFvPatchScalarField:: +fixedFluxExtrapolatedPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedFluxPressureFvPatchScalarField(p, iF) +{} + + +Foam::fixedFluxExtrapolatedPressureFvPatchScalarField:: +fixedFluxExtrapolatedPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedFluxPressureFvPatchScalarField(p, iF, dict) +{} + + +Foam::fixedFluxExtrapolatedPressureFvPatchScalarField:: +fixedFluxExtrapolatedPressureFvPatchScalarField +( + const fixedFluxExtrapolatedPressureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedFluxPressureFvPatchScalarField(ptf, p, iF, mapper) +{} + + +Foam::fixedFluxExtrapolatedPressureFvPatchScalarField:: +fixedFluxExtrapolatedPressureFvPatchScalarField +( + const fixedFluxExtrapolatedPressureFvPatchScalarField& wbppsf +) +: + fixedFluxPressureFvPatchScalarField(wbppsf) +{} + + +Foam::fixedFluxExtrapolatedPressureFvPatchScalarField:: +fixedFluxExtrapolatedPressureFvPatchScalarField +( + const fixedFluxExtrapolatedPressureFvPatchScalarField& wbppsf, + const DimensionedField& iF +) +: + fixedFluxPressureFvPatchScalarField(wbppsf, iF) +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + fixedFluxExtrapolatedPressureFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.H new file mode 100644 index 000000000..062e08b77 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxExtrapolatedPressure/fixedFluxExtrapolatedPressureFvPatchScalarField.H @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 . + +Class + Foam::fixedFluxExtrapolatedPressureFvPatchScalarField + +Group + grpInletBoundaryConditions grpWallBoundaryConditions + +Description + This boundary condition sets the pressure gradient to the provided value + such that the flux on the boundary is that specified by the velocity + boundary condition. + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fixedFluxExtrapolatedPressure; + } + \endverbatim + +SeeAlso + Foam::fixedGradientFvPatchField + +SourceFiles + fixedFluxExtrapolatedPressureFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedFluxExtrapolatedPressureFvPatchScalarFields_H +#define fixedFluxExtrapolatedPressureFvPatchScalarFields_H + +#include "fixedFluxPressureFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fixedFluxExtrapolatedPressureFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class fixedFluxExtrapolatedPressureFvPatchScalarField +: + public fixedFluxPressureFvPatchScalarField +{ + +public: + + //- Runtime type information + TypeName("fixedFluxExtrapolatedPressure"); + + + // Constructors + + //- Construct from patch and internal field + fixedFluxExtrapolatedPressureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fixedFluxExtrapolatedPressureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // fixedFluxExtrapolatedPressureFvPatchScalarField onto a new patch + fixedFluxExtrapolatedPressureFvPatchScalarField + ( + const fixedFluxExtrapolatedPressureFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedFluxExtrapolatedPressureFvPatchScalarField + ( + const fixedFluxExtrapolatedPressureFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new fixedFluxExtrapolatedPressureFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedFluxExtrapolatedPressureFvPatchScalarField + ( + const fixedFluxExtrapolatedPressureFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new fixedFluxExtrapolatedPressureFvPatchScalarField(*this, iF) + ); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/fvSchemes index 7e71c2ea5..410ea095e 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/fvSchemes @@ -38,13 +38,7 @@ divSchemes laplacianSchemes { - default none; - laplacian((rho*nuEff),U) Gauss linear uncorrected; - laplacian(rhorAUf,p_rgh) Gauss linear uncorrected; - laplacian(alphaEff,h) Gauss linear uncorrected; - laplacian((rho*DkEff),k) Gauss linear uncorrected; - laplacian((rho*DepsilonEff),epsilon) Gauss linear uncorrected; - laplacian((rho*DomegaEff),omega) Gauss linear uncorrected; + default Gauss linear uncorrected; } interpolationSchemes diff --git a/tutorials/incompressible/pimpleFoam/pitzDaily/system/fvSchemes b/tutorials/incompressible/pimpleFoam/pitzDaily/system/fvSchemes index f3462c0da..569c83355 100644 --- a/tutorials/incompressible/pimpleFoam/pitzDaily/system/fvSchemes +++ b/tutorials/incompressible/pimpleFoam/pitzDaily/system/fvSchemes @@ -23,8 +23,6 @@ ddtSchemes gradSchemes { default Gauss linear; - grad(p) Gauss linear; - grad(U) Gauss linear; } divSchemes @@ -41,19 +39,12 @@ divSchemes laplacianSchemes { - default none; - laplacian(nuEff,U) Gauss linear corrected; - laplacian(rAUf,p) Gauss linear corrected; - laplacian(DkEff,k) Gauss linear corrected; - laplacian(DepsilonEff,epsilon) Gauss linear corrected; - laplacian(DREff,R) Gauss linear corrected; - laplacian(DnuTildaEff,nuTilda) Gauss linear corrected; + default Gauss linear corrected; } interpolationSchemes { default linear; - interpolate(U) linear; } snGradSchemes