Skip to content
Snippets Groups Projects
Commit ea6a8d4b authored by Henry's avatar Henry
Browse files

OpenFOAM face: removed optimization for triangles

    This Optimization causes a small discrepancy between the swept-volume of
    opposite faces of complex cells with triangular faces opposing polygons.
    It could be used without problem for tetrahedral cells.
parent dead8ec0
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -676,26 +676,29 @@ Foam::scalar Foam::face::sweptVol ...@@ -676,26 +676,29 @@ Foam::scalar Foam::face::sweptVol
const pointField& newPoints const pointField& newPoints
) const ) const
{ {
if (size() == 3) // This Optimization causes a small discrepancy between the swept-volume of
{ // opposite faces of complex cells with triangular faces opposing polygons.
return // It could be used without problem for tetrahedral cells
( // if (size() == 3)
triPointRef // {
( // return
oldPoints[operator[](0)], // (
oldPoints[operator[](1)], // triPointRef
oldPoints[operator[](2)] // (
).sweptVol // oldPoints[operator[](0)],
( // oldPoints[operator[](1)],
triPointRef // oldPoints[operator[](2)]
( // ).sweptVol
newPoints[operator[](0)], // (
newPoints[operator[](1)], // triPointRef
newPoints[operator[](2)] // (
) // newPoints[operator[](0)],
) // newPoints[operator[](1)],
); // newPoints[operator[](2)]
} // )
// )
// );
// }
scalar sv = 0; scalar sv = 0;
...@@ -708,39 +711,40 @@ Foam::scalar Foam::face::sweptVol ...@@ -708,39 +711,40 @@ Foam::scalar Foam::face::sweptVol
label nPoints = size(); label nPoints = size();
point nextOldPoint = centreOldPoint; for (register label pi=0; pi<nPoints-1; ++pi)
point nextNewPoint = centreNewPoint;
for (register label pI = 0; pI < nPoints; ++pI)
{ {
if (pI < nPoints - 1)
{
nextOldPoint = oldPoints[operator[](pI + 1)];
nextNewPoint = newPoints[operator[](pI + 1)];
}
else
{
nextOldPoint = oldPoints[operator[](0)];
nextNewPoint = newPoints[operator[](0)];
}
// Note: for best accuracy, centre point always comes last // Note: for best accuracy, centre point always comes last
sv += triPointRef sv += triPointRef
( (
centreOldPoint, centreOldPoint,
oldPoints[operator[](pI)], oldPoints[operator[](pi)],
nextOldPoint oldPoints[operator[](pi + 1)]
).sweptVol ).sweptVol
( (
triPointRef triPointRef
( (
centreNewPoint, centreNewPoint,
newPoints[operator[](pI)], newPoints[operator[](pi)],
nextNewPoint newPoints[operator[](pi + 1)]
) )
); );
} }
sv += triPointRef
(
centreOldPoint,
oldPoints[operator[](nPoints-1)],
oldPoints[operator[](0)]
).sweptVol
(
triPointRef
(
centreNewPoint,
newPoints[operator[](nPoints-1)],
newPoints[operator[](0)]
)
);
return sv; return sv;
} }
......
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