mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
multiphase: Changed phiU to phiHbyA and cache HbyA rather than store the velocity predictor in U
This commit is contained in:
@ -2,8 +2,8 @@
|
|||||||
rho1 = eos1->rho(p, T);
|
rho1 = eos1->rho(p, T);
|
||||||
rho2 = eos2->rho(p, T);
|
rho2 = eos2->rho(p, T);
|
||||||
|
|
||||||
volScalarField rAU = 1.0/UEqn.A();
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf = fvc::interpolate(rAU);
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
tmp<fvScalarMatrix> p_rghEqnComp1;
|
tmp<fvScalarMatrix> p_rghEqnComp1;
|
||||||
tmp<fvScalarMatrix> p_rghEqnComp2;
|
tmp<fvScalarMatrix> p_rghEqnComp2;
|
||||||
@ -27,20 +27,25 @@
|
|||||||
- fvc::Sp(fvc::div(phid2), p_rgh);
|
- fvc::Sp(fvc::div(phid2), p_rgh);
|
||||||
}
|
}
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiU
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
phi = phiU +
|
surfaceScalarField phig
|
||||||
|
(
|
||||||
(
|
(
|
||||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||||
- ghf*fvc::snGrad(rho)
|
- ghf*fvc::snGrad(rho)
|
||||||
)*rAUf*mesh.magSf();
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
// Thermodynamic density needs to be updated by psi*d(p) after the
|
// Thermodynamic density needs to be updated by psi*d(p) after the
|
||||||
// pressure solution - done in 2 parts. Part 1:
|
// pressure solution - done in 2 parts. Part 1:
|
||||||
@ -50,7 +55,7 @@
|
|||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqnIncomp
|
fvScalarMatrix p_rghEqnIncomp
|
||||||
(
|
(
|
||||||
fvc::div(phi)
|
fvc::div(phiHbyA)
|
||||||
- fvm::laplacian(rAUf, p_rgh)
|
- fvm::laplacian(rAUf, p_rgh)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -74,13 +79,15 @@
|
|||||||
pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
|
pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
|
||||||
- pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
|
- pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
|
||||||
);
|
);
|
||||||
phi += p_rghEqnIncomp.flux();
|
|
||||||
|
phi = phiHbyA + p_rghEqnIncomp.flux();
|
||||||
|
|
||||||
|
U = HbyA
|
||||||
|
+ rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
|
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
|
||||||
|
|
||||||
rho1 = eos1->rho(p, T);
|
rho1 = eos1->rho(p, T);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU("Dp", 1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf("Dpf", fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
@ -11,7 +11,6 @@
|
|||||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
mrfZones.relativeFlux(phiHbyA);
|
mrfZones.relativeFlux(phiHbyA);
|
||||||
|
|
||||||
adjustPhi(phiHbyA, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU("Dp", 1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf("Dpf", fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU("Dp", 1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf("Dpf", fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = rAU*UEqn.H();
|
HbyA = rAU*UEqn.H();
|
||||||
|
|||||||
@ -1,24 +1,28 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiU
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi =
|
surfaceScalarField phig
|
||||||
phiU
|
(
|
||||||
+ (
|
(
|
||||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||||
- ghf*fvc::snGrad(rho)
|
- ghf*fvc::snGrad(rho)
|
||||||
)*rAUf*mesh.magSf();
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP();
|
Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP();
|
||||||
const volScalarField& vDotcP = vDotP[0]();
|
const volScalarField& vDotcP = vDotP[0]();
|
||||||
@ -28,7 +32,7 @@
|
|||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvc::div(phi) - fvm::laplacian(rAUf, p_rgh)
|
fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh)
|
||||||
- (vDotvP - vDotcP)*(pSat - rho*gh) + fvm::Sp(vDotvP - vDotcP, p_rgh)
|
- (vDotvP - vDotcP)*(pSat - rho*gh) + fvm::Sp(vDotvP - vDotcP, p_rgh)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -38,13 +42,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi += p_rghEqn.flux();
|
phi = phiHbyA + p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -1,31 +1,32 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiU
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
//+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
mrfZones.relativeFlux(phiU);
|
mrfZones.relativeFlux(phiHbyA);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi =
|
surfaceScalarField phig
|
||||||
phiU
|
(
|
||||||
+ (
|
- ghf*fvc::snGrad(rho)*rAUf*mesh.magSf()
|
||||||
mixture.surfaceTensionForce()
|
);
|
||||||
- ghf*fvc::snGrad(rho)
|
|
||||||
)*rAUf*mesh.magSf();
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -34,13 +35,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -1,29 +1,34 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
surfaceScalarField phiU
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi = phiU +
|
surfaceScalarField phig
|
||||||
(
|
(
|
||||||
mixture.surfaceTensionForce()
|
(
|
||||||
- ghf*fvc::snGrad(rho)
|
mixture.surfaceTensionForce()
|
||||||
)*rAUf*mesh.magSf();
|
- ghf*fvc::snGrad(rho)
|
||||||
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -32,13 +37,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -1,54 +1,60 @@
|
|||||||
volScalarField rAU(1.0/UEqn.A());
|
|
||||||
|
|
||||||
surfaceScalarField rAUf
|
|
||||||
(
|
|
||||||
"(rho*(1|A(U)))",
|
|
||||||
fvc::interpolate(rho)*fvc::interpolate(rAU)
|
|
||||||
);
|
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
|
||||||
phi =
|
|
||||||
fvc::interpolate(rho)
|
|
||||||
*(
|
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
|
||||||
);
|
|
||||||
|
|
||||||
surfaceScalarField phiU("phiU", phi);
|
|
||||||
phi -= ghf*fvc::snGrad(rho)*rAUf*mesh.magSf();
|
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
|
|
||||||
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rho*rAU));
|
||||||
|
|
||||||
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::ddt(rho) + fvc::div(phi)
|
fvc::interpolate(rho)
|
||||||
|
*(
|
||||||
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
surfaceScalarField phig
|
||||||
|
(
|
||||||
|
- ghf*fvc::snGrad(rho)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
phiHbyA += phig;
|
||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
fvScalarMatrix p_rghEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rAUf, p_rgh) == fvc::ddt(rho) + fvc::div(phiHbyA)
|
||||||
|
);
|
||||||
|
|
||||||
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
|
|
||||||
|
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
||||||
|
|
||||||
|
if (pimple.finalNonOrthogonalIter())
|
||||||
|
{
|
||||||
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p == p_rgh + rho*gh;
|
||||||
|
|
||||||
|
if (p_rgh.needReference())
|
||||||
|
{
|
||||||
|
p += dimensionedScalar
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
p.dimensions(),
|
||||||
|
pRefValue - getRefCellValue(p, pRefCell)
|
||||||
|
);
|
||||||
|
p_rgh = p - rho*gh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "rhoEqn.H"
|
||||||
|
#include "compressibleContinuityErrs.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
|
||||||
|
|
||||||
if (p_rgh.needReference())
|
|
||||||
{
|
|
||||||
p += dimensionedScalar
|
|
||||||
(
|
|
||||||
"p",
|
|
||||||
p.dimensions(),
|
|
||||||
pRefValue - getRefCellValue(p, pRefCell)
|
|
||||||
);
|
|
||||||
p_rgh = p - rho*gh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "rhoEqn.H"
|
|
||||||
#include "compressibleContinuityErrs.H"
|
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|||||||
@ -1,24 +1,31 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
surfaceScalarField rAUf(fvc::interpolate(rAU));
|
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
|
||||||
|
|
||||||
U = rAU*UEqn.H();
|
volVectorField HbyA("HbyA", U);
|
||||||
surfaceScalarField phiU
|
HbyA = rAU*UEqn.H();
|
||||||
|
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiU",
|
"phiHbyA",
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
);
|
);
|
||||||
|
|
||||||
adjustPhi(phiU, U, p_rgh);
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
|
||||||
phi = phiU - ghf*fvc::snGrad(rho)*rAUf*mesh.magSf();
|
surfaceScalarField phig
|
||||||
|
(
|
||||||
|
- ghf*fvc::snGrad(rho)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phi)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -27,13 +34,13 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi -= p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
p == p_rgh + rho*gh;
|
p == p_rgh + rho*gh;
|
||||||
|
|||||||
@ -41,6 +41,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
|||||||
phiHbyAName_("phiHbyA"),
|
phiHbyAName_("phiHbyA"),
|
||||||
phiName_("phi"),
|
phiName_("phi"),
|
||||||
rhoName_("rho"),
|
rhoName_("rho"),
|
||||||
|
DpName_("Dp"),
|
||||||
adjoint_(false)
|
adjoint_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
|||||||
phiHbyAName_(ptf.phiHbyAName_),
|
phiHbyAName_(ptf.phiHbyAName_),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
rhoName_(ptf.rhoName_),
|
rhoName_(ptf.rhoName_),
|
||||||
|
DpName_(ptf.rhoName_),
|
||||||
adjoint_(ptf.adjoint_)
|
adjoint_(ptf.adjoint_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -72,6 +74,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
|||||||
phiHbyAName_(dict.lookupOrDefault<word>("phiHbyA", "phiHbyA")),
|
phiHbyAName_(dict.lookupOrDefault<word>("phiHbyA", "phiHbyA")),
|
||||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||||
|
DpName_(dict.lookupOrDefault<word>("Dp", "Dp")),
|
||||||
adjoint_(dict.lookupOrDefault<Switch>("adjoint", false))
|
adjoint_(dict.lookupOrDefault<Switch>("adjoint", false))
|
||||||
{
|
{
|
||||||
if (dict.found("gradient"))
|
if (dict.found("gradient"))
|
||||||
@ -97,6 +100,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
|||||||
phiHbyAName_(wbppsf.phiHbyAName_),
|
phiHbyAName_(wbppsf.phiHbyAName_),
|
||||||
phiName_(wbppsf.phiName_),
|
phiName_(wbppsf.phiName_),
|
||||||
rhoName_(wbppsf.rhoName_),
|
rhoName_(wbppsf.rhoName_),
|
||||||
|
DpName_(wbppsf.DpName_),
|
||||||
adjoint_(wbppsf.adjoint_)
|
adjoint_(wbppsf.adjoint_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -111,6 +115,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
|||||||
phiHbyAName_(wbppsf.phiHbyAName_),
|
phiHbyAName_(wbppsf.phiHbyAName_),
|
||||||
phiName_(wbppsf.phiName_),
|
phiName_(wbppsf.phiName_),
|
||||||
rhoName_(wbppsf.rhoName_),
|
rhoName_(wbppsf.rhoName_),
|
||||||
|
DpName_(wbppsf.DpName_),
|
||||||
adjoint_(wbppsf.adjoint_)
|
adjoint_(wbppsf.adjoint_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -136,6 +141,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
|||||||
fvsPatchField<scalar> phip =
|
fvsPatchField<scalar> phip =
|
||||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||||
|
|
||||||
|
/*
|
||||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
{
|
{
|
||||||
const fvPatchField<scalar>& rhop =
|
const fvPatchField<scalar>& rhop =
|
||||||
@ -144,16 +150,38 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
|||||||
phip /= rhop;
|
phip /= rhop;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fvPatchField<scalar>& Dpp =
|
if (phiHbyA.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
patch().lookupPatchField<volScalarField, scalar>("Dp");
|
{
|
||||||
|
const fvPatchField<scalar>& rhop =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
|
phiHbyAp /= rhop;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
const scalarField *DppPtr = NULL;
|
||||||
|
|
||||||
|
if (db().foundObject<volScalarField>(DpName_))
|
||||||
|
{
|
||||||
|
DppPtr =
|
||||||
|
&patch().lookupPatchField<volScalarField, scalar>(DpName_);
|
||||||
|
}
|
||||||
|
else if (db().foundObject<surfaceScalarField>(DpName_))
|
||||||
|
{
|
||||||
|
const surfaceScalarField& Dp =
|
||||||
|
db().lookupObject<surfaceScalarField>(DpName_);
|
||||||
|
|
||||||
|
DppPtr =
|
||||||
|
&patch().patchField<surfaceScalarField, scalar>(Dp);
|
||||||
|
}
|
||||||
|
|
||||||
if (adjoint_)
|
if (adjoint_)
|
||||||
{
|
{
|
||||||
gradient() = (phip - phiHbyAp)/patch().magSf()/Dpp;
|
gradient() = (phip - phiHbyAp)/patch().magSf()/(*DppPtr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gradient() = (phiHbyAp - phip)/patch().magSf()/Dpp;
|
gradient() = (phiHbyAp - phip)/patch().magSf()/(*DppPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||||
@ -166,6 +194,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
|
|||||||
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
|
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
|
||||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||||
|
writeEntryIfDifferent<word>(os, "Dp", "Dp", rhoName_);
|
||||||
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
|
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
|
||||||
gradient().writeEntry("gradient", os);
|
gradient().writeEntry("gradient", os);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,6 +71,9 @@ class fixedFluxPressureFvPatchScalarField
|
|||||||
// if neccessary
|
// if neccessary
|
||||||
word rhoName_;
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Name of the pressure diffusivity field
|
||||||
|
word DpName_;
|
||||||
|
|
||||||
//- Is the pressure adjoint, i.e. has the opposite sign
|
//- Is the pressure adjoint, i.e. has the opposite sign
|
||||||
Switch adjoint_;
|
Switch adjoint_;
|
||||||
|
|
||||||
|
|||||||
@ -136,6 +136,7 @@ void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs()
|
|||||||
fvsPatchField<scalar> phip =
|
fvsPatchField<scalar> phip =
|
||||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||||
|
|
||||||
|
/*
|
||||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
{
|
{
|
||||||
const fvPatchField<scalar>& rhop =
|
const fvPatchField<scalar>& rhop =
|
||||||
@ -144,6 +145,15 @@ void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs()
|
|||||||
phip /= rhop;
|
phip /= rhop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (phiHbyA.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
|
{
|
||||||
|
const fvPatchField<scalar>& rhop =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
|
||||||
|
phiHbyAp /= rhop;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
const fvsPatchField<scalar>& Dpp =
|
const fvsPatchField<scalar>& Dpp =
|
||||||
patch().lookupPatchField<surfaceScalarField, scalar>("Dp");
|
patch().lookupPatchField<surfaceScalarField, scalar>("Dp");
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ laplacianSchemes
|
|||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
laplacian(muEff,U) Gauss linear corrected;
|
laplacian(muEff,U) Gauss linear corrected;
|
||||||
laplacian((rho*(1|A(U))),p_rgh) Gauss linear corrected;
|
laplacian(Dp,p_rgh) Gauss linear corrected;
|
||||||
laplacian(DkEff,k) Gauss linear corrected;
|
laplacian(DkEff,k) Gauss linear corrected;
|
||||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
||||||
laplacian(mut,Alpha) Gauss linear corrected;
|
laplacian(mut,Alpha) Gauss linear corrected;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ laplacianSchemes
|
|||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
laplacian(muEff,U) Gauss linear corrected;
|
laplacian(muEff,U) Gauss linear corrected;
|
||||||
laplacian((rho*(1|A(U))),p_rgh) Gauss linear corrected;
|
laplacian(Dp,p_rgh) Gauss linear corrected;
|
||||||
laplacian(DkEff,k) Gauss linear corrected;
|
laplacian(DkEff,k) Gauss linear corrected;
|
||||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
||||||
laplacian(mut,Alpha) Gauss linear corrected;
|
laplacian(mut,Alpha) Gauss linear corrected;
|
||||||
|
|||||||
Reference in New Issue
Block a user