Commit 77b03e2e authored by Henry Weller's avatar Henry Weller
Browse files

Specialized dotInterpolate for the efficient calculation of flux fields

e.g. (fvc::interpolate(HbyA) & mesh.Sf()) -> fvc::flux(HbyA)

This removes the need to create an intermediate face-vector field when
computing fluxes which is more efficient, reduces the peak storage and
improved cache coherency in addition to providing a simpler and cleaner
API.
parent 4dedba47
......@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
surfaceScalarField phiHbyA
(
"phiHbyA",
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ rAUf*fvc::ddtCorr(U, phi)
);
......
......@@ -24,13 +24,13 @@ surfaceScalarField phi
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
fvc::interpolate(U) & mesh.Sf()
fvc::flux(U)
);
if (args.optionFound("initialiseUBCs"))
{
U.correctBoundaryConditions();
phi = fvc::interpolate(U) & mesh.Sf();
phi = fvc::flux(U);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -121,8 +121,7 @@ int main(int argc, char *argv[])
U.correctBoundaryConditions();
Info<< "Interpolated velocity error = "
<< (sqrt(sum(sqr((fvc::interpolate(U) & mesh.Sf()) - phi)))
/sum(mesh.magSf())).value()
<< (sqrt(sum(sqr(fvc::flux(U) - phi)))/sum(mesh.magSf())).value()
<< endl;
// Write U and phi
......
......@@ -10,7 +10,7 @@ if (pimple.transonic())
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
/fvc::interpolate(rho)
)
......@@ -41,7 +41,7 @@ else
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
)
);
......
......@@ -11,7 +11,7 @@ if (pimple.transonic())
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
)
);
......@@ -43,7 +43,7 @@ else
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
......
......@@ -12,7 +12,7 @@ if (pimple.transonic())
fvc::interpolate(psi)
*(
(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
)
)
......@@ -46,7 +46,7 @@ else
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)
);
......
......@@ -10,7 +10,7 @@ surfaceScalarField phiHbyA
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
+ phig
......
......@@ -19,7 +19,7 @@ if (pimple.transonic())
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
)
);
......@@ -51,7 +51,7 @@ else
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
......
......@@ -19,7 +19,7 @@ if (pimple.transonic())
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
/fvc::interpolate(rho)
)
......@@ -63,7 +63,7 @@ else
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
)
);
......
......@@ -15,7 +15,7 @@
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
+ phig
......
......@@ -15,7 +15,7 @@
(
"phiHbyA",
(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
)
);
......@@ -56,7 +56,7 @@
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
......
......@@ -95,7 +95,7 @@ surfaceScalarField neg
dimensionedScalar("neg", dimless, -1.0)
);
surfaceScalarField phi("phi", mesh.Sf() & fvc::interpolate(rhoU));
surfaceScalarField phi("phi", fvc::flux(rhoU));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
......
......@@ -208,7 +208,7 @@ int main(int argc, char *argv[])
"sigmaDotU",
(
fvc::interpolate(muEff)*mesh.magSf()*fvc::snGrad(U)
+ (mesh.Sf() & fvc::interpolate(tauMC))
+ fvc::dotInterpolate(mesh.Sf(), tauMC)
)
& (a_pos*U_pos + a_neg*U_neg)
);
......
......@@ -201,9 +201,9 @@ int main(int argc, char *argv[])
"sigmaDotU",
(
fvc::interpolate(muEff)*mesh.magSf()*fvc::snGrad(U)
+ (mesh.Sf() & fvc::interpolate(tauMC))
+ fvc::dotInterpolate(mesh.Sf(), tauMC)
)
& (a_pos*U_pos + a_neg*U_neg)
& (a_pos*U_pos + a_neg*U_neg)
);
solve
......
......@@ -19,7 +19,7 @@ if (pimple.transonic())
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
)
);
......@@ -51,7 +51,7 @@ else
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
......
......@@ -19,7 +19,7 @@ if (pimple.transonic())
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
/fvc::interpolate(rho)
)
......@@ -63,7 +63,7 @@ else
(
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
)
);
......
......@@ -19,7 +19,7 @@ if (pimple.transonic())
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(HbyA) & mesh.Sf())
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
)
);
......@@ -51,7 +51,7 @@ else
surfaceScalarField phiHbyA
(
"phiHbyA",
(fvc::interpolate(rho*HbyA) & mesh.Sf())
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
);
......
......@@ -38,7 +38,7 @@
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
fvc::interpolate(psi)*fvc::flux(U)
);
rDeltaT.dimensionedInternalField() = max
......
......@@ -12,7 +12,7 @@
(
"phid",
fvc::interpolate(psi)
*(fvc::interpolate(HbyA) & mesh.Sf())
*fvc::flux(HbyA)
);
MRF.makeRelative(fvc::interpolate(psi), phid);
......@@ -42,12 +42,7 @@
}
else
{
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::interpolate(rho*HbyA) & mesh.Sf()
);
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
closedVolume = adjustPhi(phiHbyA, U, p);
......
......@@ -11,7 +11,7 @@ if (simple.transonic())
(
"phid",
fvc::interpolate(psi)
*(fvc::interpolate(HbyA) & mesh.Sf())
*fvc::flux(HbyA)
);
MRF.makeRelative(fvc::interpolate(psi), phid);
......@@ -52,12 +52,7 @@ if (simple.transonic())
}
else
{
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::interpolate(rho*HbyA) & mesh.Sf()
);
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
closedVolume = adjustPhi(phiHbyA, U, p);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment