Skip to content

Commit

Permalink
CorrectPhi: Added pressureReference argument to set the reference cell
Browse files Browse the repository at this point in the history
so that the same reference cell is used for pcorr and p or p_rgh to improve
consistency between flux and flux correction.
  • Loading branch information
Henry Weller committed Apr 30, 2021
1 parent 007658b commit e8ff92c
Show file tree
Hide file tree
Showing 72 changed files with 172 additions and 122 deletions.
Expand Up @@ -96,7 +96,6 @@ pressureReference pressureReference
(
p,
p_rgh,
rho,
pimple.dict(),
thermo.incompressible()
);
Expand Down
Expand Up @@ -38,7 +38,7 @@ volScalarField& p = thermo.p();

#include "compressibleCreatePhi.H"

pressureReference pressureReference(p, rho, pimple.dict(), false);
pressureReference pressureReference(p, pimple.dict(), false);

mesh.setFluxRequired(p.name());

Expand Down
Expand Up @@ -43,7 +43,6 @@ volVectorField U
pressureReference pressureReference
(
p,
rho,
pimple.dict(),
thermo.incompressible()
);
Expand Down
Expand Up @@ -41,7 +41,6 @@ volVectorField U
pressureReference pressureReference
(
p,
rho,
simple.dict(),
thermo.incompressible()
);
Expand Down
5 changes: 1 addition & 4 deletions applications/solvers/electromagnetics/mhdFoam/createFields.H
Expand Up @@ -109,10 +109,7 @@ DB.name() = "DB";
dimensionedScalar DBU = 1.0/(2.0*mu*rho);
DBU.name() = "DBU";


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, piso.dict(), pRefCell, pRefValue);
pressureReference pressureReference(p, piso.dict());

mesh.setFluxRequired(p.name());
mesh.setFluxRequired(pB.name());
10 changes: 8 additions & 2 deletions applications/solvers/electromagnetics/mhdFoam/mhdFoam.C
Expand Up @@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
Expand Down Expand Up @@ -50,6 +50,7 @@ Description

#include "fvCFD.H"
#include "pisoControl.H"
#include "pressureReference.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Expand Down Expand Up @@ -113,7 +114,12 @@ int main(int argc, char *argv[])
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

if (piso.finalNonOrthogonalIter())
Expand Down
Expand Up @@ -83,7 +83,6 @@ pressureReference pressureReference
(
p,
p_rgh,
rho,
pimple.dict(),
thermo.incompressible()
);
Expand Down
Expand Up @@ -81,7 +81,6 @@ pressureReference pressureReference
(
p,
p_rgh,
rho,
simple.dict(),
thermo.incompressible()
);
Expand Down
Expand Up @@ -8,7 +8,6 @@ forAll(fluidRegions, i)
new pressureReference
(
p_rghFluid[i],
rhoFluid[i],
pimples.pimple(i).dict(),
false
)
Expand Down
Expand Up @@ -49,6 +49,7 @@ Description
#include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H"
#include "simpleControl.H"
#include "pressureReference.H"
#include "fvModels.H"
#include "fvConstraints.H"

Expand Down Expand Up @@ -143,7 +144,12 @@ int main(int argc, char *argv[])
fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

if (simple.finalNonOrthogonalIter())
Expand Down
Expand Up @@ -29,9 +29,8 @@ volVectorField U
#include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
pressureReference pressureReference(p, simple.dict());

mesh.setFluxRequired(p.name());


Expand Down
Expand Up @@ -36,6 +36,7 @@ Description
#include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H"
#include "pressureReference.H"
#include "SRFModel.H"
#include "fvModels.H"
#include "fvConstraints.H"
Expand Down
Expand Up @@ -40,9 +40,7 @@ surfaceScalarField phi
linearInterpolate(Urel) & mesh.Sf()
);

label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, pimple.dict(), pRefCell, pRefValue);
pressureReference pressureReference(p, pimple.dict());
mesh.setFluxRequired(p.name());

Info<< "Creating SRF model\n" << endl;
Expand Down
Expand Up @@ -38,7 +38,11 @@ while (pimple.correctNonOrthogonal())
fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

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

Expand Down
Expand Up @@ -30,10 +30,8 @@ volVectorField U

#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());


Expand Down
6 changes: 5 additions & 1 deletion applications/solvers/incompressible/pimpleFoam/pEqn.H
Expand Up @@ -42,7 +42,11 @@ while (pimple.correctNonOrthogonal())
fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

Expand Down
Expand Up @@ -37,6 +37,7 @@ Description
#include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H"
#include "pressureReference.H"
#include "CorrectPhi.H"
#include "fvModels.H"
#include "fvConstraints.H"
Expand Down
5 changes: 2 additions & 3 deletions applications/solvers/incompressible/pisoFoam/createFields.H
Expand Up @@ -29,9 +29,8 @@ volVectorField U
#include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, piso.dict(), pRefCell, pRefValue);
pressureReference pressureReference(p, piso.dict());

mesh.setFluxRequired(p.name());


Expand Down
6 changes: 5 additions & 1 deletion applications/solvers/incompressible/pisoFoam/pEqn.H
Expand Up @@ -24,7 +24,11 @@ while (piso.correctNonOrthogonal())
fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

Expand Down
1 change: 1 addition & 0 deletions applications/solvers/incompressible/pisoFoam/pisoFoam.C
Expand Up @@ -38,6 +38,7 @@ Description
#include "singlePhaseTransportModel.H"
#include "kinematicMomentumTransportModel.H"
#include "pisoControl.H"
#include "pressureReference.H"
#include "fvModels.H"
#include "fvConstraints.H"

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

Expand Down
Expand Up @@ -40,9 +40,8 @@ surfaceScalarField phi
linearInterpolate(Urel) & mesh.Sf()
);

label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
pressureReference pressureReference(p, simple.dict());

mesh.setFluxRequired(p.name());

Info<< "Creating SRF model\n" << endl;
Expand Down
Expand Up @@ -29,7 +29,11 @@
fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

Expand Down
5 changes: 2 additions & 3 deletions applications/solvers/incompressible/simpleFoam/createFields.H
Expand Up @@ -29,9 +29,8 @@ volVectorField U
#include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
pressureReference pressureReference(p, simple.dict());

mesh.setFluxRequired(p.name());


Expand Down
6 changes: 5 additions & 1 deletion applications/solvers/incompressible/simpleFoam/pEqn.H
Expand Up @@ -28,7 +28,11 @@
fvm::laplacian(rAtU(), p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

Expand Down
Expand Up @@ -31,7 +31,11 @@ while (simple.correctNonOrthogonal())

fvScalarMatrix pEqn = tpEqn.ref();

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

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

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

Expand Down
Expand Up @@ -59,9 +59,8 @@ surfaceScalarField phic
linearInterpolate(Uc) & mesh.Sf()
);

label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, pimple.dict(), pRefCell, pRefValue);
pressureReference pressureReference(p, pimple.dict());

mesh.setFluxRequired(p.name());

Info<< "Creating turbulence model\n" << endl;
Expand Down
Expand Up @@ -80,6 +80,7 @@ namespace Foam
#include "singlePhaseTransportModel.H"
#include "phaseKinematicMomentumTransportModel.H"
#include "pimpleControl.H"
#include "pressureReference.H"
#include "CorrectPhi.H"
#include "fvModels.H"
#include "fvConstraints.H"
Expand Down
6 changes: 5 additions & 1 deletion applications/solvers/lagrangian/denseParticleFoam/pEqn.H
Expand Up @@ -34,7 +34,11 @@
+ fvc::div(alphacf*phiHbyASp)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.setReference
(
pressureReference.refCell(),
pressureReference.refValue()
);

pEqn.solve();

Expand Down
Expand Up @@ -109,7 +109,6 @@ pressureReference pressureReference
(
p,
p_rgh,
rho,
pimple.dict(),
thermo.incompressible()
);
Expand Down
Expand Up @@ -90,7 +90,6 @@ volScalarField K("K", 0.5*magSqr(U));
pressureReference pressureReference
(
p,
rho,
pimple.dict(),
thermo.incompressible()
);
Expand Down
Expand Up @@ -50,6 +50,7 @@ Description
#include "compressibleInterPhaseTransportModel.H"
#include "noPhaseChange.H"
#include "pimpleControl.H"
#include "pressureReference.H"
#include "fvModels.H"
#include "fvConstraints.H"
#include "CorrectPhi.H"
Expand Down
Expand Up @@ -11,6 +11,7 @@ CorrectPhi
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
divU(),
pressureReference,
pimple
);

Expand Down

0 comments on commit e8ff92c

Please sign in to comment.