functionObjects::interfaceHeight: Corrected parallel operation

This commit is contained in:
Will Bainbridge
2023-05-31 11:35:29 +01:00
parent e00ff00dcd
commit 1d78434bee
8 changed files with 47 additions and 28 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -93,16 +93,16 @@ void Foam::functionObjects::interfaceHeight::writePositions()
// line. The latter is equal to the equivalent length with alpha equal
// to one.
scalar sumLength = 0, sumLengthAlpha = 0;
for(label si = 0; si < set.size() - 1; ++ si)
for (label si = 0; si < set.size() - 1; ++ si)
{
if (set.segments()[si] != set.segments()[si+1])
{
continue;
}
if (set.segments()[si] != set.segments()[si+1]) continue;
const vector& p0 = set.pointCoord(si), p1 = set.pointCoord(si+1);
const label c0 = set.cells()[si], c1 = set.cells()[si+1];
const label f0 = set.faces()[si], f1 = set.faces()[si+1];
if (f0 != -1 && f1 != -1) continue;
const scalar a0 = interpolator->interpolate(p0, c0, f0);
const scalar a1 = interpolator->interpolate(p1, c1, f1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,7 +58,7 @@ void Foam::sampledSets::lineCell::calcSamples
searchEngine(),
start_,
end_,
false,
0,
true,
samplingPositions,
samplingDistances,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,6 +45,7 @@ namespace sampledSets
void Foam::sampledSets::lineCellFace::calcSamples
(
const label storeFaces,
DynamicList<point>& samplingPositions,
DynamicList<scalar>& samplingDistances,
DynamicList<label>& samplingSegments,
@ -58,7 +59,7 @@ void Foam::sampledSets::lineCellFace::calcSamples
searchEngine(),
start_,
end_,
true,
storeFaces,
true,
samplingPositions,
samplingDistances,
@ -69,7 +70,7 @@ void Foam::sampledSets::lineCellFace::calcSamples
}
void Foam::sampledSets::lineCellFace::genSamples()
void Foam::sampledSets::lineCellFace::genSamples(const label storeFaces)
{
DynamicList<point> samplingPositions;
DynamicList<scalar> samplingDistances;
@ -79,6 +80,7 @@ void Foam::sampledSets::lineCellFace::genSamples()
calcSamples
(
storeFaces,
samplingPositions,
samplingDistances,
samplingSegments,
@ -117,7 +119,7 @@ Foam::sampledSets::lineCellFace::lineCellFace
start_(dict.lookup("start")),
end_(dict.lookup("end"))
{
genSamples();
genSamples(1);
}
@ -135,7 +137,7 @@ Foam::sampledSets::lineCellFace::lineCellFace
start_(start),
end_(end)
{
genSamples();
genSamples(2);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,6 +85,7 @@ class lineCellFace
//- Calculate all the sampling points
virtual void calcSamples
(
const label storeFaces,
DynamicList<point>& samplingPositions,
DynamicList<scalar>& samplingDistances,
DynamicList<label>& samplingSegments,
@ -93,7 +94,7 @@ class lineCellFace
) const;
//- Uses calcSamples to obtain samples and copies them into *this
void genSamples();
void genSamples(const label storeFaces);
public:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -51,7 +51,7 @@ void Foam::sampledSets::lineFace::calcSamples
const meshSearch& searchEngine,
const vector& start,
const vector& end,
const bool storeFaces,
const label storeFaces,
const bool storeCells,
DynamicList<point>& samplingPositions,
DynamicList<scalar>& samplingDistances,
@ -280,7 +280,7 @@ void Foam::sampledSets::lineFace::calcSamples
searchEngine(),
start_,
end_,
true,
1,
false,
samplingPositions,
samplingDistances,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -112,7 +112,7 @@ public:
const meshSearch& searchEngine,
const vector& start,
const vector& end,
const bool storeFaces,
const label storeFaces,
const bool storeCells,
DynamicList<point>& samplingPositions,
DynamicList<scalar>& samplingDistances,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -139,7 +139,7 @@ bool Foam::sampledSetParticle::move
while (onInternalFace(td.mesh))
{
if (td.storeCells_) storeCell(cloud, td);
if (td.storeFaces_) storeFace(cloud, td);
if (td.storeFaces_ > 0) storeFace(cloud, td);
hitFace(setF_*s, 0, cloud, td);
@ -151,7 +151,7 @@ bool Foam::sampledSetParticle::move
if (onFace())
{
if (td.storeCells_) storeCell(cloud, td);
if (td.storeFaces_) storeFace(cloud, td);
if (td.storeFaces_ > 0) storeFace(cloud, td);
hitFace(setF_*s, 0, cloud, td);
}
@ -247,6 +247,18 @@ void Foam::sampledSetParticle::hitWallPatch
}
void Foam::sampledSetParticle::correctAfterParallelTransfer
(
sampledSetCloud& cloud,
trackingData& td
)
{
particle::correctAfterParallelTransfer(cloud, td);
if (td.storeFaces_ > 1) storeFace(cloud, td);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const sampledSetParticle& p)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -75,7 +75,7 @@ public:
const bool storeSet_;
//- Are we storing the faces we track through?
const bool storeFaces_;
const label storeFaces_;
//- Are we storing the cells we track through?
const bool storeCells_;
@ -97,9 +97,9 @@ public:
(
sampledSetCloud& cloud,
const List<point>& set,
bool storeSet,
bool storeFaces,
bool storeCells,
const bool storeSet,
const label storeFaces,
const bool storeCells,
DynamicList<point>& positions,
DynamicList<scalar>& distances,
DynamicList<label>& cells,
@ -211,6 +211,10 @@ public:
//- Hit a wall patch. Ends the track.
void hitWallPatch(sampledSetCloud&, trackingData&);
//- Do corrections to the particle and tracking data following a
// transfer between processors
void correctAfterParallelTransfer(sampledSetCloud&, trackingData&);
// IOstream Operators