Commit 08baa6ed authored by Henry's avatar Henry
Browse files

fixedFluxPressure BC: the snGrad is now pushed into the BC from pEqn.H rather...

fixedFluxPressure BC: the snGrad is now pushed into the BC from pEqn.H rather than being evaluated in the BC
parent cda13049
......@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
for (int corr=1; corr<=1; corr++)
{
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rAU));
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
......@@ -94,12 +94,12 @@ int main(int argc, char *argv[])
(
"phiHbyA",
(fvc::interpolate(HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(U, phi)
+ rAUf*fvc::ddtCorr(U, phi)
);
fvScalarMatrix pEqn
(
fvm::laplacian(Dp, p) == fvc::div(phiHbyA)
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
);
pEqn.solve();
......
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
......@@ -14,7 +14,7 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)/fvc::interpolate(rho)
);
......@@ -26,7 +26,7 @@ if (pimple.transonic())
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
......@@ -48,7 +48,7 @@ else
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
......@@ -60,7 +60,7 @@ else
(
fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
......
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
......@@ -15,7 +15,7 @@ if (pimple.transonic())
*(
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + Dp*fvc::ddtCorr(rho, U, phi)
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi)
)/fvc::interpolate(rho)
- fvc::meshPhi(rho, U)
)
......@@ -51,7 +51,7 @@ else
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + Dp*fvc::ddtCorr(rho, U, phi)
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi)
)
- fvc::interpolate(rho)*fvc::meshPhi(rho, U)
);
......
......@@ -41,6 +41,7 @@ Description
#include "psiCombustionModel.H"
#include "pimpleControl.H"
#include "fvIOoptionList.H"
#include "fixedFluxPressureFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
phi.boundaryField() =
fvc::interpolate(rho.boundaryField()*U.boundaryField())
& mesh.Sf().boundaryField();
surfaceScalarField phig(-Dp*ghf*fvc::snGrad(rho)*mesh.magSf());
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
surfaceScalarField phiHbyA
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
+ phig
);
fvOptions.makeRelative(phiHbyA);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the fixedFluxPressure BCs to ensure flux consistency
setSnGrad<fixedFluxPressureFvPatchScalarField>
(
p_rgh.boundaryField(),
(
phiHbyA.boundaryField()
- fvOptions.relative(mesh.Sf().boundaryField() & U.boundaryField())
*rho.boundaryField()
)/(mesh.magSf().boundaryField()*rhorAUf.boundaryField())
);
while (pimple.correctNonOrthogonal())
{
......@@ -30,7 +38,7 @@ while (pimple.correctNonOrthogonal())
fvc::ddt(psi, rho)*gh
+ fvc::div(phiHbyA)
+ fvm::ddt(psi, p_rgh)
- fvm::laplacian(Dp, p_rgh)
- fvm::laplacian(rhorAUf, p_rgh)
==
parcels.Srho()
+ surfaceFilm.Srho()
......@@ -44,7 +52,7 @@ while (pimple.correctNonOrthogonal())
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA + p_rghEqn.flux();
U = HbyA + rAU*fvc::reconstruct((p_rghEqn.flux() + phig)/Dp);
U = HbyA + rAU*fvc::reconstruct((p_rghEqn.flux() + phig)/rhorAUf);
U.correctBoundaryConditions();
fvOptions.correct(U);
}
......
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
......@@ -14,7 +14,7 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)/fvc::interpolate(rho)
);
......@@ -48,7 +48,7 @@ else
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
......
......@@ -6,25 +6,36 @@
thermo.rho() -= psi*p;
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
surfaceScalarField phig(-Dp*ghf*fvc::snGrad(rho)*mesh.magSf());
surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
surfaceScalarField phiHbyA
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
+ phig
);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the fixedFluxPressure BCs to ensure flux consistency
setSnGrad<fixedFluxPressureFvPatchScalarField>
(
p_rgh.boundaryField(),
(
phiHbyA.boundaryField()
- fvOptions.relative(mesh.Sf().boundaryField() & U.boundaryField())
*rho.boundaryField()
)/(mesh.magSf().boundaryField()*rhorAUf.boundaryField())
);
fvScalarMatrix p_rghDDtEqn
(
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
......@@ -38,7 +49,7 @@
fvScalarMatrix p_rghEqn
(
p_rghDDtEqn
- fvm::laplacian(Dp, p_rgh)
- fvm::laplacian(rhorAUf, p_rgh)
);
fvOptions.constrain(p_rghEqn);
......@@ -55,7 +66,7 @@
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/Dp);
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf);
U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);
......
......@@ -36,6 +36,7 @@ Description
#include "multivariateScheme.H"
#include "pimpleControl.H"
#include "fvIOoptionList.H"
#include "fixedFluxPressureFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -6,7 +6,7 @@
thermo.rho() -= psi*p;
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
......@@ -18,7 +18,7 @@
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)/fvc::interpolate(rho)
);
......@@ -39,7 +39,7 @@
fvScalarMatrix pEqn
(
pDDtEqn
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
......@@ -61,7 +61,7 @@
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
......@@ -80,7 +80,7 @@
fvScalarMatrix pEqn
(
pDDtEqn
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
);
fvOptions.constrain(pEqn);
......
......@@ -4,7 +4,7 @@ rho = min(rho, rhoMax);
rho.relax();
volScalarField rAU(1.0/UEqn().A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
......@@ -22,7 +22,7 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)/fvc::interpolate(rho)
);
......@@ -34,7 +34,7 @@ if (pimple.transonic())
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
......@@ -56,14 +56,12 @@ else
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
volScalarField Dp("Dp", rho*rAU);
while (pimple.correctNonOrthogonal())
{
// Pressure corrector
......@@ -71,7 +69,7 @@ else
(
fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
......
......@@ -4,7 +4,7 @@ rho = min(rho, rhoMax);
rho.relax();
volScalarField rAU(1.0/UEqn().A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
......@@ -22,7 +22,7 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phiAbs)
+ rhorAUf*fvc::ddtCorr(rho, U, phiAbs)
)/fvc::interpolate(rho)
);
......@@ -34,7 +34,7 @@ if (pimple.transonic())
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
......@@ -55,7 +55,7 @@ else
(
"phiHbyA",
(fvc::interpolate(rho*HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phiAbs)
+ rhorAUf*fvc::ddtCorr(rho, U, phiAbs)
);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
......@@ -67,7 +67,7 @@ else
(
fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
......
......@@ -35,7 +35,7 @@ if (pimple.transonic())
HbyA -= (rAU - rAtU)*fvc::grad(p);
volScalarField Dp("Dp", rho*rAtU);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
while (pimple.correctNonOrthogonal())
{
......@@ -44,7 +44,7 @@ if (pimple.transonic())
fvm::ddt(psi, p)
+ fvm::div(phid, p)
+ fvc::div(phic)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAtU, p)
==
fvOptions(psi, p, rho.name())
);
......@@ -75,7 +75,7 @@ else
phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf();
HbyA -= (rAU - rAtU)*fvc::grad(p);
volScalarField Dp("Dp", rho*rAtU);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
while (pimple.correctNonOrthogonal())
{
......@@ -83,7 +83,7 @@ else
(
fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAtU, p)
==
fvOptions(psi, p, rho.name())
);
......
......@@ -26,7 +26,7 @@ if (simple.transonic())
HbyA -= (rAU - rAtU)*fvc::grad(p);
volScalarField Dp("Dp", rho*rAtU);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
while (simple.correctNonOrthogonal())
{
......@@ -34,7 +34,7 @@ if (simple.transonic())
(
fvm::div(phid, p)
+ fvc::div(phic)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAtU, p)
==
fvOptions(psi, p, rho.name())
);
......@@ -67,14 +67,14 @@ else
phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf();
HbyA -= (rAU - rAtU)*fvc::grad(p);
volScalarField Dp("Dp", rho*rAtU);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAtU, p)
==
fvOptions(psi, p, rho.name())
);
......
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
......@@ -12,7 +12,7 @@ surfaceScalarField phid
fvc::interpolate(psi)*
(
(mesh.Sf() & fvc::interpolate(rho*HbyA))
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)/fvc::interpolate(rho)
);
......@@ -23,7 +23,7 @@ while (pimple.correctNonOrthogonal())
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
);
pEqn.solve();
......
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
......@@ -13,7 +13,7 @@ surfaceScalarField phid
*(
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + Dp*fvc::ddtCorr(rho, U, phi)
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi)
)/fvc::interpolate(rho)
- fvc::meshPhi(rho, U)
)
......@@ -25,7 +25,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
);
pEqn.solve();
......
......@@ -75,8 +75,12 @@ int main(int argc, char *argv[])
// --- Pressure corrector loop
while (pimple.correct())
{
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rho*rAU));
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rhorAUf
(
"rhorAUf",
fvc::interpolate(rho*rAU)
);
U = rAU*UEqn.H();
......@@ -86,7 +90,7 @@ int main(int argc, char *argv[])
psi
*(
(fvc::interpolate(rho*U) & mesh.Sf())
+ Dp*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)/fvc::interpolate(rho)
);
......@@ -97,7 +101,7 @@ int main(int argc, char *argv[])
fvm::ddt(psi, p)
+ fvc::div(phi)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
- fvm::laplacian(rhorAUf, p)
);
pEqn.solve();
......
......@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++)
{
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField Dp("Dp", fvc::interpolate(rAU));
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
......@@ -102,14 +102,14 @@ int main(int argc, char *argv[])
(
"phiHbyA",
(fvc::interpolate(HbyA) & mesh.Sf())
+ Dp*fvc::ddtCorr(U, phi)
+ rAUf*fvc::ddtCorr(U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(Dp, p) == fvc::div(phiHbyA)
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
);
pEqn.setReference(pRefCell, pRefValue);
......@@ -143,14 +143,14 @@ int main(int argc, char *argv[])
BEqn.solve();
volScalarField rAB(1.0/BEqn.A());