interFoam et. al.: Changed phiU to phiHbyA and cache HbyA rather than changing U

This commit is contained in:
Henry
2012-04-18 16:33:59 +01:00
parent 88d6efca27
commit 6ce4484918
8 changed files with 109 additions and 73 deletions

View File

@ -1,29 +1,36 @@
{
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rAUf(fvc::interpolate(rAU));
volScalarField rAU("Dp", 1.0/UEqn.A());
surfaceScalarField rAUf("Dpf", fvc::interpolate(rAU));
U = rAU*UEqn.H();
surfaceScalarField phiU
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
surfaceScalarField phiHbyA
(
"phiU",
(fvc::interpolate(U) & mesh.Sf())
"phiHbyA",
(fvc::interpolate(HbyA) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
);
mrfZones.relativeFlux(phiU);
adjustPhi(phiU, U, p_rgh);
mrfZones.relativeFlux(phiHbyA);
phi = phiU +
adjustPhi(phiHbyA, U, p_rgh);
surfaceScalarField phig
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf();
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf()
);
phiHbyA += phig;
while (pimple.correctNonOrthogonal())
{
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));
@ -32,13 +39,13 @@
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"
p == p_rgh + rho*gh;

View File

@ -1,31 +1,38 @@
{
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rAUf(fvc::interpolate(rAU));
volScalarField rAU("Dp", 1.0/UEqn.A());
surfaceScalarField rAUf("Dpf", fvc::interpolate(rAU));
U = rAU*UEqn.H();
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
phiAbs =
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phiAbs);
surfaceScalarField phiHbyA
(
(fvc::interpolate(HbyA) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phiAbs)
);
if (p_rgh.needReference())
{
fvc::makeRelative(phiAbs, U);
adjustPhi(phiAbs, U, p_rgh);
fvc::makeAbsolute(phiAbs, U);
fvc::makeRelative(phiHbyA, U);
adjustPhi(phiHbyA, U, p_rgh);
fvc::makeAbsolute(phiHbyA, U);
}
phi = phiAbs +
surfaceScalarField phig
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf();
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf()
);
phiHbyA += phig;
while (pimple.correctNonOrthogonal())
{
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));
@ -34,13 +41,13 @@
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 - phiAbs)/rAUf);
U.correctBoundaryConditions();
#include "continuityErrs.H"
phiAbs = phi;

View File

@ -1,28 +1,34 @@
{
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rAUf(fvc::interpolate(rAU));
volScalarField rAU("Dp", 1.0/UEqn.A());
surfaceScalarField rAUf("Dpf", fvc::interpolate(rAU));
U = rAU*UEqn.H();
surfaceScalarField phiU
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H();
surfaceScalarField phiHbyA
(
"phiU",
(fvc::interpolate(U) & mesh.Sf())
"phiHbyA",
(fvc::interpolate(HbyA) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
);
adjustPhi(phiU, U, p_rgh);
adjustPhi(phiHbyA, U, p_rgh);
phi = phiU +
surfaceScalarField phig
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf();
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf()
);
phiHbyA += phig;
while (pimple.correctNonOrthogonal())
{
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));
@ -31,13 +37,13 @@
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"
p == p_rgh + rho*gh;