BUG: overset: out-of-date lduAddressing. Fixes #3204

Was triggering update of cell-cell stencil (=meshObject) without
corresponding rebuilding of lduAddressing (= oversetFvMeshBase storage).
- added clearOut to oversetFvMesh(Base)
- added call to clearOut when rebuilding stencil
This commit is contained in:
mattijs
2024-08-19 15:49:21 +01:00
parent aacd99c030
commit f72670edff
5 changed files with 45 additions and 24 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017,2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,7 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "cellCellStencilObject.H"
#include "dynamicOversetFvMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -36,4 +36,25 @@ namespace Foam
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::cellCellStencilObject::movePoints()
{
// Update (if needed) underlying stencil
const bool changed = stencilPtr_().update();
if (changed)
{
const auto* oversetMeshPtr = isA<oversetFvMeshBase>(mesh());
if (oversetMeshPtr)
{
// Clear out any additional (ldu)addressing
const_cast<oversetFvMeshBase&>(*oversetMeshPtr).clearOut();
}
}
return changed;
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2019,2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -54,19 +54,9 @@ typedef MeshObject<fvMesh, MoveableMeshObject, cellCellStencilObject> Stencil;
class cellCellStencilObject
:
public MeshObject<fvMesh, MoveableMeshObject, cellCellStencilObject>,
public Stencil,
public cellCellStencil
{
// Private Typedefs
typedef MeshObject
<
fvMesh,
MoveableMeshObject,
cellCellStencilObject
> MeshObject_type;
// Private Data
autoPtr<cellCellStencil> stencilPtr_;
@ -86,8 +76,7 @@ public:
const bool update = true
)
:
MeshObject_type(mesh),
Stencil(mesh),
cellCellStencil(mesh),
stencilPtr_
(
@ -111,10 +100,7 @@ public:
// Member Functions
//- Callback for geometry motion
virtual bool movePoints()
{
return stencilPtr_().update();
}
virtual bool movePoints();
//- Update stencils. Return false if nothing changed.
virtual bool update()

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022,2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -65,6 +65,10 @@ bool Foam::dynamicOversetFvMesh::update()
return false;
}
//Note: too late to do oversetFvMeshBase::clearOut() to get it
// consistent with any new cell-cell stencil since
// dynamicMotionSolverListFvMesh already triggers
// meshObject::movePoints on cellCellStencilObject
oversetFvMeshBase::update();
return true;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014-2022 OpenCFD Ltd.
Copyright (C) 2014-2022,2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -578,6 +578,14 @@ Foam::oversetFvMeshBase::primitiveLduAddr() const
}
void Foam::oversetFvMeshBase::clearOut()
{
// Cell-cell stencil is already mesh object. Clear out local
// addressing to force rebuilding addressing
lduPtr_.clear();
}
bool Foam::oversetFvMeshBase::update()
{
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2022,2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,7 +37,6 @@ SourceFiles
#ifndef oversetFvMeshBase_H
#define oversetFvMeshBase_H
#include "fvMeshPrimitiveLduAddressing.H"
#include "fvMeshPrimitiveLduAddressing.H"
#include "lduInterfaceFieldPtrsList.H"
#include "volFieldsFwd.H"
@ -238,6 +237,9 @@ public:
) const;
//- Clear out local storage
void clearOut();
//- Update the mesh for both mesh motion and topology change
virtual bool update();