From fc2ce7372345fe4fc71694a35fc361746f11440f 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 38c5b7be8f..238a05c696 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 499885875b..b8d21b7e38 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 2b11dc73f8..39830d0135 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 c962353e3f..d84b9bd154 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 34e97b634e..fd8e2a4357 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 6f8b034581..11f140577f 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 2f352db5da..ae5478c5b6 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 3d7fffc459..8bef07a5bb 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 965ff5bad2..ad01cd5f83 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 11c028d166..bff96fdb89 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 c3b18e6bd7..cd19153462 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 8c98fb5f83..5ab7d3835f 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 2f352db5da..ae5478c5b6 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 3d7fffc459..8bef07a5bb 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 33039b3dc9..615682db12 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 38c9806ee9..4c6276711c 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 82161f230c..7b77048a99 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 b0af0e3f8b..d54f7eec24 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 d61808b23c..f4f6d5ae2a 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 439709ed07..283e450e00 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 c9cb0242bd..0d21312a30 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 cead654669..eb0bf5fcbb 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 9ec089ee4c..a9be0e59f7 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 35b49c8b8b..63c35ed424 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 b6d8067358..13200035d8 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 d683e8fbeb..7a956a09e6 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 e2f99671a3..66864139fa 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 21a9ed9525..c319804418 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 85157e8b2f..132e440bcd 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 ec0532c11b..f8c62042d6 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 625737aed1..6b4811a026 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 ccae3cc079..341de6b13e 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 002faddb59..0b82c44068 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 baf2518aa1..fbd8e5f150 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 80e13faa8d..e3a7fb67c5 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 9d3b567d3b..3edbedf39f 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 d305d1a261..0e3936bc5d 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 18083aa810..6d4eb90334 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 5b5fe720ad..f4106997c6 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 54c94d9c72..9db6844761 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 feeeaa000e..a065bcbd3c 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 f8c5a45978..7d3284e0d4 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 50691c0154..636a4c571d 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 4438a3bff5..b506bf43cf 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 b4a0f2e668..e4ad23aabc 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 8999e03663..9e2208479d 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 34cce4f166..6b7084de63 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 480ce25f7c..ce9f819646 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 6f8b034581..11f140577f 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 220e2f28a8..0f54e9fdc6 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 f266fded0a..cb5b083b88 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 b5d3e1471a..aa775bc0d0 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 ee450daab9..5d28412683 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 c620a892d1..406128feed 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 b07846b6de..37892c0e73 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 da8047914c..5b238ccefa 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 410bb604bb..65cc137acb 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 89089fe616..e1ac128810 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 1db6fc06f2..efbdc398cc 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 673f1c8271..fb23042a87 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 c968a4e313..8c8de8af6e 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 a8f4bcb9f2..ccf4bc9794 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 a026a32faf..c0a2be76a7 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 73c6ea9877..6cc93506df 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 af6c779a0c..efebaff8b1 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 8400d24687..e6723f47b2 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 63d9a344e8..a341b64e12 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 19afacf2e1..24c292b870 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 31982f4c1d..42cf70fce5 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 cf7ffd8874..2524965b28 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 a1b9241fa5..f28bb8c2aa 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 003d9a58a0..3639bd4c4e 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 497a6e3d64..fd85d96714 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 61cc90547d..437548bca9 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 c93056f329..a247985a39 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 4bc2f55c4e..7451a669b1 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 6a65b215b2..e182350114 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 01f548ad16..04b187cf85 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 9b1a8db083..0499a9c9d6 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 2db15eb830..8371a30800 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 d5c48d47aa..a98129cc7e 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 00672f2f01..0e5542672d 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 4a89f67d8f..870034570a 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 298d5366ca..0d9b134739 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 3027ae88b3..32dd1a59b6 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 4506679f7b..eda874fd02 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 0000000000..beb2c223e2 --- /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 0000000000..bc5a914757 --- /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 0000000000..c086d5f3ee --- /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 0000000000..b3e522ee05 --- /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 d8eb111f58..bc21a17c42 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 0000000000..6fc0fd67cd --- /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 0000000000..062e08b772 --- /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 7e71c2ea5f..410ea095e7 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 f3462c0da0..569c83355b 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