BUG: reconstructPar: do not locate positions. See #2205.
Specific to the VOF-to-lagrangian FO is to generate particles which potentially do not relate to the mesh. So here they are preserved instead of trying to locate them on the reconstructed mesh. Note: this has the same effect of actually copying the file...
This commit is contained in:
parent
e5cb375ab7
commit
913f844eb6
@ -116,14 +116,30 @@ Foam::label Foam::lagrangianReconstructor::reconstructPositions
|
||||
}
|
||||
else
|
||||
{
|
||||
// No valid coordinates. Use built-in locating from cell -1
|
||||
// No valid coordinates. Two choices:
|
||||
// - assume reconstructed mesh contains the position so do
|
||||
// a locate with the (reconstructed) mesh
|
||||
// - preserve -1 as cell id, maintain the read location
|
||||
lagrangianPositions.append
|
||||
(
|
||||
|
||||
//- Option 1: locate on reconstructed mesh
|
||||
//new passivePositionParticle
|
||||
//(
|
||||
// mesh_,
|
||||
// ppi.location(),
|
||||
// mappedCell
|
||||
//)
|
||||
|
||||
//- Option 2: maintain read location
|
||||
new passivePositionParticle
|
||||
(
|
||||
mesh_,
|
||||
ppi.location(),
|
||||
mappedCell
|
||||
Zero, // position
|
||||
-1, // celli
|
||||
-1, // tetFacei
|
||||
-1, // tetPti
|
||||
ppi.location()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from components (known location)
|
||||
passivePositionParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -83,16 +83,18 @@ public:
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from a position and a cell.
|
||||
// Searches for the rest of the required topology.
|
||||
//- Construct from components (supplied location)
|
||||
passivePositionParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const vector& position,
|
||||
const label celli = -1
|
||||
const barycentric& coordinates,
|
||||
const label celli,
|
||||
const label tetFacei,
|
||||
const label tetPti,
|
||||
const vector& position
|
||||
)
|
||||
:
|
||||
particle(mesh, position, celli),
|
||||
particle(mesh, coordinates, celli, tetFacei, tetPti),
|
||||
location_(position)
|
||||
{}
|
||||
|
||||
@ -168,6 +170,34 @@ public:
|
||||
{
|
||||
return location_;
|
||||
}
|
||||
|
||||
//- Write the particle position and cell id
|
||||
virtual void writePosition(Ostream& os) const
|
||||
{
|
||||
// Use cached location() instead of calculated position()
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << location() << token::SPACE << cell();
|
||||
}
|
||||
else
|
||||
{
|
||||
positionsCompat1706 p;
|
||||
|
||||
const size_t s =
|
||||
(
|
||||
offsetof(positionsCompat1706, facei)
|
||||
- offsetof(positionsCompat1706, position)
|
||||
);
|
||||
|
||||
p.position = location();
|
||||
p.celli = cell();
|
||||
|
||||
os.write(reinterpret_cast<const char*>(&p.position), s);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check(FUNCTION_NAME);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user