CorrectPhi: Added pressureReference argument to set the reference cell

so that the same reference cell is used for pcorr and p or p_rgh to improve
consistency between flux and flux correction.
This commit is contained in:
Henry Weller
2021-04-30 21:07:15 +01:00
parent 007658b768
commit e8ff92cd67
72 changed files with 172 additions and 122 deletions

View File

@ -96,7 +96,6 @@ pressureReference pressureReference
( (
p, p,
p_rgh, p_rgh,
rho,
pimple.dict(), pimple.dict(),
thermo.incompressible() thermo.incompressible()
); );

View File

@ -38,7 +38,7 @@ volScalarField& p = thermo.p();
#include "compressibleCreatePhi.H" #include "compressibleCreatePhi.H"
pressureReference pressureReference(p, rho, pimple.dict(), false); pressureReference pressureReference(p, pimple.dict(), false);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());

View File

@ -43,7 +43,6 @@ volVectorField U
pressureReference pressureReference pressureReference pressureReference
( (
p, p,
rho,
pimple.dict(), pimple.dict(),
thermo.incompressible() thermo.incompressible()
); );

View File

@ -41,7 +41,6 @@ volVectorField U
pressureReference pressureReference pressureReference pressureReference
( (
p, p,
rho,
simple.dict(), simple.dict(),
thermo.incompressible() thermo.incompressible()
); );

View File

@ -109,10 +109,7 @@ DB.name() = "DB";
dimensionedScalar DBU = 1.0/(2.0*mu*rho); dimensionedScalar DBU = 1.0/(2.0*mu*rho);
DBU.name() = "DBU"; DBU.name() = "DBU";
pressureReference pressureReference(p, piso.dict());
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, piso.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());
mesh.setFluxRequired(pB.name()); mesh.setFluxRequired(pB.name());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,6 +50,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "pisoControl.H" #include "pisoControl.H"
#include "pressureReference.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -113,7 +114,12 @@ int main(int argc, char *argv[])
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA) fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();
if (piso.finalNonOrthogonalIter()) if (piso.finalNonOrthogonalIter())

View File

@ -83,7 +83,6 @@ pressureReference pressureReference
( (
p, p,
p_rgh, p_rgh,
rho,
pimple.dict(), pimple.dict(),
thermo.incompressible() thermo.incompressible()
); );

View File

@ -81,7 +81,6 @@ pressureReference pressureReference
( (
p, p,
p_rgh, p_rgh,
rho,
simple.dict(), simple.dict(),
thermo.incompressible() thermo.incompressible()
); );

View File

@ -8,7 +8,6 @@ forAll(fluidRegions, i)
new pressureReference new pressureReference
( (
p_rghFluid[i], p_rghFluid[i],
rhoFluid[i],
pimples.pimple(i).dict(), pimples.pimple(i).dict(),
false false
) )

View File

@ -49,6 +49,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "simpleControl.H" #include "simpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"
@ -143,7 +144,12 @@ int main(int argc, char *argv[])
fvm::laplacian(rAU, p) == fvc::div(phiHbyA) fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();
if (simple.finalNonOrthogonalIter()) if (simple.finalNonOrthogonalIter())

View File

@ -29,9 +29,8 @@ volVectorField U
#include "createPhi.H" #include "createPhi.H"
label pRefCell = 0; pressureReference pressureReference(p, simple.dict());
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());

View File

@ -36,6 +36,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "SRFModel.H" #include "SRFModel.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"

View File

@ -40,9 +40,7 @@ surfaceScalarField phi
linearInterpolate(Urel) & mesh.Sf() linearInterpolate(Urel) & mesh.Sf()
); );
label pRefCell = 0; pressureReference pressureReference(p, pimple.dict());
scalar pRefValue = 0.0;
setRefCell(p, pimple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());
Info<< "Creating SRF model\n" << endl; Info<< "Creating SRF model\n" << endl;

View File

@ -38,7 +38,11 @@ while (pimple.correctNonOrthogonal())
fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA) fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();

View File

@ -11,6 +11,7 @@ CorrectPhi
p, p,
dimensionedScalar("rAUf", dimTime, 1), dimensionedScalar("rAUf", dimTime, 1),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );

View File

@ -30,10 +30,8 @@ volVectorField U
#include "createPhi.H" #include "createPhi.H"
pressureReference pressureReference(p, pimple.dict());
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, pimple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());

View File

@ -42,7 +42,11 @@ while (pimple.correctNonOrthogonal())
fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA) fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();

View File

@ -37,6 +37,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"

View File

@ -29,9 +29,8 @@ volVectorField U
#include "createPhi.H" #include "createPhi.H"
label pRefCell = 0; pressureReference pressureReference(p, piso.dict());
scalar pRefValue = 0.0;
setRefCell(p, piso.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());

View File

@ -24,7 +24,11 @@ while (piso.correctNonOrthogonal())
fvm::laplacian(rAU, p) == fvc::div(phiHbyA) fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();

View File

@ -38,6 +38,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "pisoControl.H" #include "pisoControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"

View File

@ -35,6 +35,7 @@ Description
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "SRFModel.H" #include "SRFModel.H"
#include "simpleControl.H" #include "simpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"

View File

@ -40,9 +40,8 @@ surfaceScalarField phi
linearInterpolate(Urel) & mesh.Sf() linearInterpolate(Urel) & mesh.Sf()
); );
label pRefCell = 0; pressureReference pressureReference(p, simple.dict());
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());
Info<< "Creating SRF model\n" << endl; Info<< "Creating SRF model\n" << endl;

View File

@ -29,7 +29,11 @@
fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA) fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();

View File

@ -29,9 +29,8 @@ volVectorField U
#include "createPhi.H" #include "createPhi.H"
label pRefCell = 0; pressureReference pressureReference(p, simple.dict());
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());

View File

@ -28,7 +28,11 @@
fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA) fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();

View File

@ -31,7 +31,11 @@ while (simple.correctNonOrthogonal())
fvScalarMatrix pEqn = tpEqn.ref(); fvScalarMatrix pEqn = tpEqn.ref();
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();

View File

@ -35,6 +35,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "simpleControl.H" #include "simpleControl.H"
#include "pressureReference.H"
#include "IOporosityModelList.H" #include "IOporosityModelList.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"

View File

@ -34,6 +34,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "simpleControl.H" #include "simpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"

View File

@ -10,6 +10,7 @@ CorrectPhi
p, p,
dimensionedScalar("rAUf", dimTime, 1), dimensionedScalar("rAUf", dimTime, 1),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );

View File

@ -59,9 +59,8 @@ surfaceScalarField phic
linearInterpolate(Uc) & mesh.Sf() linearInterpolate(Uc) & mesh.Sf()
); );
label pRefCell = 0; pressureReference pressureReference(p, pimple.dict());
scalar pRefValue = 0.0;
setRefCell(p, pimple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());
Info<< "Creating turbulence model\n" << endl; Info<< "Creating turbulence model\n" << endl;

View File

@ -80,6 +80,7 @@ namespace Foam
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "phaseKinematicMomentumTransportModel.H" #include "phaseKinematicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"

View File

@ -34,7 +34,11 @@
+ fvc::div(alphacf*phiHbyASp) + fvc::div(alphacf*phiHbyASp)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
pEqn.solve(); pEqn.solve();

View File

@ -109,7 +109,6 @@ pressureReference pressureReference
( (
p, p,
p_rgh, p_rgh,
rho,
pimple.dict(), pimple.dict(),
thermo.incompressible() thermo.incompressible()
); );

View File

@ -90,7 +90,6 @@ volScalarField K("K", 0.5*magSqr(U));
pressureReference pressureReference pressureReference pressureReference
( (
p, p,
rho,
pimple.dict(), pimple.dict(),
thermo.incompressible() thermo.incompressible()
); );

View File

@ -50,6 +50,7 @@ Description
#include "compressibleInterPhaseTransportModel.H" #include "compressibleInterPhaseTransportModel.H"
#include "noPhaseChange.H" #include "noPhaseChange.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"

View File

@ -11,6 +11,7 @@ CorrectPhi
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
divU(), divU(),
pressureReference,
pimple pimple
); );

View File

@ -57,6 +57,9 @@ mesh.setFluxRequired(alpha1.name());
#include "gh.H" #include "gh.H"
pressureReference pressureReference(mixture.p(), p_rgh, pimple.dict(), false);
// Mass flux // Mass flux
// Initialisation does not matter because rhoPhi is reset after the // Initialisation does not matter because rhoPhi is reset after the
// alpha1 solution before it is used in the U equation. // alpha1 solution before it is used in the U equation.

View File

@ -99,16 +99,7 @@ volScalarField p
p_rgh + rho*gh p_rgh + rho*gh
); );
label pRefCell = 0; pressureReference pressureReference(p, p_rgh, pimple.dict());
scalar pRefValue = 0.0;
setRefCell
(
p,
p_rgh,
pimple.dict(),
pRefCell,
pRefValue
);
if (p_rgh.needReference()) if (p_rgh.needReference())
{ {
@ -116,7 +107,8 @@ if (p_rgh.needReference())
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -41,6 +41,7 @@ Description
#include "momentumTransportModel.H" #include "momentumTransportModel.H"
#include "dynamicMomentumTransportModel.H" #include "dynamicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"
#include "gaussLaplacianScheme.H" #include "gaussLaplacianScheme.H"

View File

@ -30,7 +30,11 @@
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA) fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference
(
pressureReference.refCell(),
getRefCellValue(p_rgh, pressureReference.refCell())
);
p_rghEqn.solve(); p_rghEqn.solve();
@ -56,7 +60,8 @@
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -13,6 +13,7 @@ if (divU.valid())
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
divU(), divU(),
pressureReference,
pimple pimple
); );
} }
@ -25,6 +26,7 @@ else
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );
} }

View File

@ -86,16 +86,7 @@ volScalarField p
p_rgh + rho*gh p_rgh + rho*gh
); );
label pRefCell = 0; pressureReference pressureReference(p, p_rgh, pimple.dict());
scalar pRefValue = 0.0;
setRefCell
(
p,
p_rgh,
pimple.dict(),
pRefCell,
pRefValue
);
if (p_rgh.needReference()) if (p_rgh.needReference())
{ {
@ -103,7 +94,8 @@ if (p_rgh.needReference())
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -29,6 +29,7 @@ if
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );
} }
@ -43,6 +44,7 @@ if
p_rgh, p_rgh,
dimensionedScalar(dimTime/rho.dimensions(), 1), dimensionedScalar(dimTime/rho.dimensions(), 1),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );
} }

View File

@ -43,6 +43,7 @@ Description
#include "noPhaseChange.H" #include "noPhaseChange.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"

View File

@ -11,6 +11,7 @@ CorrectPhi
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );

View File

@ -99,16 +99,7 @@ volScalarField p
p_rgh + rho*gh p_rgh + rho*gh
); );
label pRefCell = 0; pressureReference pressureReference(p, p_rgh, pimple.dict());
scalar pRefValue = 0.0;
setRefCell
(
p,
p_rgh,
pimple.dict(),
pRefCell,
pRefValue
);
if (p_rgh.needReference()) if (p_rgh.needReference())
{ {
@ -116,7 +107,8 @@ if (p_rgh.needReference())
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -25,6 +25,7 @@ if (correctPhi)
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );
@ -41,6 +42,7 @@ else
p_rgh, p_rgh,
dimensionedScalar(dimTime/rho.dimensions(), 1), dimensionedScalar(dimTime/rho.dimensions(), 1),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );

View File

@ -39,6 +39,7 @@ Description
#include "immiscibleIncompressibleThreePhaseMixture.H" #include "immiscibleIncompressibleThreePhaseMixture.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"

View File

@ -45,7 +45,11 @@
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA) fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference
(
pressureReference.refCell(),
getRefCellValue(p_rgh, pressureReference.refCell())
);
p_rghEqn.solve(); p_rghEqn.solve();
@ -77,7 +81,8 @@
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -49,7 +49,11 @@
== Sp_rgh == Sp_rgh
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference
(
pressureReference.refCell(),
getRefCellValue(p_rgh, pressureReference.refCell())
);
p_rghEqn.solve(); p_rghEqn.solve();
@ -81,7 +85,8 @@
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -40,7 +40,6 @@ pressureReference pressureReference
( (
p, p,
p_rgh, p_rgh,
fluid.rho(),
pimple.dict(), pimple.dict(),
fluid.incompressible() fluid.incompressible()
); );

View File

@ -158,7 +158,13 @@ int main(int argc, char *argv[])
if (correctPhi) if (correctPhi)
{ {
fluid.correctPhi(p_rgh, divU, pimple); fluid.correctPhi
(
p_rgh,
divU,
pressureReference,
pimple
);
} }
if (checkMeshCourantNo) if (checkMeshCourantNo)

View File

@ -40,6 +40,7 @@ License
#include "BlendedInterfacialModel.H" #include "BlendedInterfacialModel.H"
#include "movingWallVelocityFvPatchVectorField.H" #include "movingWallVelocityFvPatchVectorField.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -900,6 +901,7 @@ void Foam::phaseSystem::correctPhi
( (
const volScalarField& p_rgh, const volScalarField& p_rgh,
const tmp<volScalarField>& divU, const tmp<volScalarField>& divU,
const pressureReference& pressureReference,
nonOrthogonalSolutionControl& pimple nonOrthogonalSolutionControl& pimple
) )
{ {
@ -955,6 +957,7 @@ void Foam::phaseSystem::correctPhi
// surfaceScalarField("rAUf", fvc::interpolate(rAU())), // surfaceScalarField("rAUf", fvc::interpolate(rAU())),
dimensionedScalar(dimTime/dimDensity, 1), dimensionedScalar(dimTime/dimDensity, 1),
divU(), divU(),
pressureReference,
pimple pimple
); );

View File

@ -61,6 +61,7 @@ class blendingMethod;
template<class modelType> class BlendedInterfacialModel; template<class modelType> class BlendedInterfacialModel;
class surfaceTensionModel; class surfaceTensionModel;
class aspectRatioModel; class aspectRatioModel;
class pressureReference;
class nonOrthogonalSolutionControl; class nonOrthogonalSolutionControl;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -700,6 +701,7 @@ public:
( (
const volScalarField& p_rgh, const volScalarField& p_rgh,
const tmp<volScalarField>& divU, const tmp<volScalarField>& divU,
const pressureReference& pressureReference,
nonOrthogonalSolutionControl& pimple nonOrthogonalSolutionControl& pimple
); );

View File

@ -11,6 +11,7 @@ CorrectPhi
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );

View File

@ -69,16 +69,7 @@ volScalarField p
p_rgh + rho*gh p_rgh + rho*gh
); );
label pRefCell = 0; pressureReference pressureReference(p, p_rgh, pimple.dict());
scalar pRefValue = 0.0;
setRefCell
(
p,
p_rgh,
pimple.dict(),
pRefCell,
pRefValue
);
if (p_rgh.needReference()) if (p_rgh.needReference())
{ {
@ -86,8 +77,10 @@ if (p_rgh.needReference())
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh;
} }
mesh.setFluxRequired(p_rgh.name()); mesh.setFluxRequired(p_rgh.name());

View File

@ -25,6 +25,7 @@ if (correctPhi)
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );
@ -41,6 +42,7 @@ else
p_rgh, p_rgh,
dimensionedScalar(dimTime/rho.dimensions(), 1), dimensionedScalar(dimTime/rho.dimensions(), 1),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );

View File

@ -38,6 +38,7 @@ Description
#include "multiphaseMixture.H" #include "multiphaseMixture.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"

View File

@ -45,7 +45,11 @@
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA) fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference
(
pressureReference.refCell(),
getRefCellValue(p_rgh, pressureReference.refCell())
);
p_rghEqn.solve(); p_rghEqn.solve();
@ -77,7 +81,8 @@
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -11,6 +11,7 @@ CorrectPhi
p_gh, p_gh,
surfaceScalarField("rAUf", fvc::interpolate(rAU)), surfaceScalarField("rAUf", fvc::interpolate(rAU)),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );

View File

@ -70,10 +70,8 @@ volScalarField p_gh
// Height is made relative to field 'refLevel' // Height is made relative to field 'refLevel'
p_gh = p - (g & mesh.C()); p_gh = p - (g & mesh.C());
pressureReference pressureReference(p_gh, pimple.dict());
label p_ghRefCell = 0;
scalar p_ghRefValue = 0.0;
setRefCell(p_gh, pimple.dict(), p_ghRefCell, p_ghRefValue);
mesh.setFluxRequired(p_gh.name()); mesh.setFluxRequired(p_gh.name());
#include "createMRF.H" #include "createMRF.H"

View File

@ -9,6 +9,7 @@ if (!runTime.restart() &&correctPhi)
p_gh, p_gh,
surfaceScalarField("rAUf", fvc::interpolate(rAU)), surfaceScalarField("rAUf", fvc::interpolate(rAU)),
geometricZeroField(), geometricZeroField(),
pressureReference,
pimple pimple
); );
} }

View File

@ -34,7 +34,11 @@ while (pimple.correctNonOrthogonal())
fvm::laplacian(rAUf, p_gh) == fvc::div(phiHbyA) fvm::laplacian(rAUf, p_gh) == fvc::div(phiHbyA)
); );
p_ghEqn.setReference(p_ghRefCell, p_ghRefValue); p_ghEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);
p_ghEqn.solve(); p_ghEqn.solve();

View File

@ -43,6 +43,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
#include "fvModels.H" #include "fvModels.H"
#include "fvConstraints.H" #include "fvConstraints.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"

View File

@ -88,16 +88,7 @@ volScalarField p
p_rgh + rho*gh p_rgh + rho*gh
); );
label pRefCell = 0; pressureReference pressureReference(p, p_rgh, pimple.dict());
scalar pRefValue = 0.0;
setRefCell
(
p,
p_rgh,
pimple.dict(),
pRefCell,
pRefValue
);
if (p_rgh.needReference()) if (p_rgh.needReference())
{ {
@ -105,7 +96,8 @@ if (p_rgh.needReference())
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -27,7 +27,11 @@
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA) fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
); );
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.setReference
(
pressureReference.refCell(),
getRefCellValue(p_rgh, pressureReference.refCell())
);
p_rghEqn.solve(); p_rghEqn.solve();
@ -50,7 +54,8 @@
( (
"p", "p",
p.dimensions(), p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell) pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,6 +37,7 @@ Description
#include "incompressibleTwoPhaseMixture.H" #include "incompressibleTwoPhaseMixture.H"
#include "kinematicMomentumTransportModel.H" #include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureReference.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -34,6 +34,7 @@ License
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "adjustPhi.H" #include "adjustPhi.H"
#include "fvcMeshPhi.H" #include "fvcMeshPhi.H"
#include "pressureReference.H"
#include "nonOrthogonalSolutionControl.H" #include "nonOrthogonalSolutionControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,6 +47,7 @@ void Foam::CorrectPhi
const volScalarField& p, const volScalarField& p,
const RAUfType& rAUf, const RAUfType& rAUf,
const DivUType& divU, const DivUType& divU,
const pressureReference& pressureReference,
nonOrthogonalSolutionControl& pcorrControl nonOrthogonalSolutionControl& pcorrControl
) )
{ {
@ -99,7 +101,7 @@ void Foam::CorrectPhi
fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divU fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divU
); );
pcorrEqn.setReference(0, 0); pcorrEqn.setReference(pressureReference.refCell(), 0);
pcorrEqn.solve(); pcorrEqn.solve();

View File

@ -48,6 +48,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class pressureReference;
class nonOrthogonalSolutionControl; class nonOrthogonalSolutionControl;
//- If the mesh is moving correct the velocity BCs on the moving walls to //- If the mesh is moving correct the velocity BCs on the moving walls to
@ -77,6 +78,7 @@ namespace Foam
const volScalarField& p, const volScalarField& p,
const RAUfType& rAUf, const RAUfType& rAUf,
const DivUType& divU, const DivUType& divU,
const pressureReference& pressureReference,
nonOrthogonalSolutionControl& pcorrControl nonOrthogonalSolutionControl& pcorrControl
); );

View File

@ -32,7 +32,6 @@ Foam::pressureReference::pressureReference
( (
const volScalarField& p, const volScalarField& p,
const volScalarField& pRef, const volScalarField& pRef,
const volScalarField& rho,
const dictionary& dict, const dictionary& dict,
const bool pRefRequired const bool pRefRequired
) )
@ -112,12 +111,11 @@ Foam::pressureReference::pressureReference
Foam::pressureReference::pressureReference Foam::pressureReference::pressureReference
( (
const volScalarField& p, const volScalarField& p,
const volScalarField& rho,
const dictionary& dict, const dictionary& dict,
const bool pRefRequired const bool pRefRequired
) )
: :
pressureReference(p, p, rho, dict, pRefRequired) pressureReference(p, p, dict, pRefRequired)
{} {}

View File

@ -69,7 +69,6 @@ public:
( (
const volScalarField& p, const volScalarField& p,
const volScalarField& pRef, const volScalarField& pRef,
const volScalarField& rho,
const dictionary& dict, const dictionary& dict,
const bool pRefRequired = true const bool pRefRequired = true
); );
@ -78,7 +77,6 @@ public:
pressureReference pressureReference
( (
const volScalarField& p, const volScalarField& p,
const volScalarField& rho,
const dictionary& dict, const dictionary& dict,
const bool pRefRequired = true const bool pRefRequired = true
); );