mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: nearWallFields: particles located outside mesh. See #947.
This commit is contained in:
@ -3,7 +3,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-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -73,8 +73,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
{
|
{
|
||||||
const fvPatch& patch = mesh_.boundary()[patchi];
|
const fvPatch& patch = mesh_.boundary()[patchi];
|
||||||
|
|
||||||
vectorField nf(patch.nf());
|
const vectorField nf(patch.nf());
|
||||||
vectorField faceCellCentres(patch.patch().faceCellCentres());
|
const vectorField faceCellCentres(patch.patch().faceCellCentres());
|
||||||
const labelUList& faceCells = patch.patch().faceCells();
|
const labelUList& faceCells = patch.patch().faceCells();
|
||||||
|
|
||||||
forAll(patch, patchFacei)
|
forAll(patch, patchFacei)
|
||||||
@ -96,8 +96,6 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
|
|
||||||
// Starting point and tet
|
// Starting point and tet
|
||||||
point start;
|
point start;
|
||||||
label tetFacei = -1;
|
|
||||||
label tetPti = -1;
|
|
||||||
const label celli = faceCells[patchFacei];
|
const label celli = faceCells[patchFacei];
|
||||||
|
|
||||||
if (startInfo.hit())
|
if (startInfo.hit())
|
||||||
@ -105,22 +103,28 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
// Move start point slightly in so it is inside the tet
|
// Move start point slightly in so it is inside the tet
|
||||||
const face& f = mesh_.faces()[meshFacei];
|
const face& f = mesh_.faces()[meshFacei];
|
||||||
|
|
||||||
tetFacei = meshFacei;
|
label tetFacei = meshFacei;
|
||||||
tetPti = (startInfo.index()+1) % f.size();
|
label tetPti = (startInfo.index()+1) % f.size();
|
||||||
|
|
||||||
start = startInfo.hitPoint();
|
start = startInfo.hitPoint();
|
||||||
|
|
||||||
//// Uncomment below to shift slightly in:
|
// Uncomment below to shift slightly in:
|
||||||
tetIndices tet(celli, tetFacei, tetPti);
|
tetIndices tet(celli, tetFacei, tetPti);
|
||||||
start =
|
start =
|
||||||
(1.0 - 1e-6)*startInfo.hitPoint()
|
(1.0 - 1e-6)*startInfo.hitPoint()
|
||||||
+ 1e-6*tet.tet(mesh_).centre();
|
+ 1e-6*tet.tet(mesh_).centre();
|
||||||
|
|
||||||
|
// Re-check that we have a valid location
|
||||||
|
mesh_.findTetFacePt(celli, start, tetFacei, tetPti);
|
||||||
|
if (tetFacei == -1)
|
||||||
|
{
|
||||||
|
start = faceCellCentres[patchFacei];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fallback: start tracking from neighbouring cell centre
|
// Fallback: start tracking from neighbouring cell centre
|
||||||
start = faceCellCentres[patchFacei];
|
start = faceCellCentres[patchFacei];
|
||||||
mesh_.findTetFacePt(celli, start, tetFacei, tetPti);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const point end = start-distance_*nf[patchFacei];
|
const point end = start-distance_*nf[patchFacei];
|
||||||
@ -132,7 +136,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
(
|
(
|
||||||
mesh_,
|
mesh_,
|
||||||
start,
|
start,
|
||||||
-1,
|
celli,
|
||||||
end,
|
end,
|
||||||
globalWalls.toGlobal(nPatchFaces) // passive data
|
globalWalls.toGlobal(nPatchFaces) // passive data
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user