mappedPatchBase is not updated if the sampleMesh is topochanging
Summary
This could be an issue in the imaginable solver: chtMultiRegionDyMFoam.
mappedPatchBase should recalculate the addressing to the sampledPatch if the sampledMesh changes its topology. The addressing should also be recalculated if the mesh owning the patch changes its topolology. This would be the case with dynamicMotionSolverFvMesh with e.g. displacementLaplacian motion solver. In case of AMR, the fields are remapped after calling mappedPatchBase::clearOut
Possible fixes
mappedPatchBaseI.H:
inline const Foam::mapDistribute& Foam::mappedPatchBase::map() const
{
const polyMesh& thisMesh = patch_.boundaryMesh().mesh();
bool topoChange = sampleMesh().topoChanging() || thisMesh.topoChanging();
if (topoChange)
{
mapPtr_.clear();
}
if (mapPtr_.empty())
{
calcMapping();
}
return *mapPtr_;
}
inline const Foam::AMIPatchToPatchInterpolation& Foam::mappedPatchBase::AMI
(
bool forceUpdate
) const
{
const polyMesh& thisMesh = patch_.boundaryMesh().mesh();
bool topoChange = sampleMesh().topoChanging() || thisMesh.topoChanging();
if (topoChange || forceUpdate)
{
AMIPtr_.clear();
}
if (AMIPtr_.empty())
{
calcAMI();
}
return *AMIPtr_;
}
mappedPatchBase.C:
const Foam::autoPtr<Foam::searchableSurface>& Foam::mappedPatchBase::surfPtr()
const
{
const polyMesh& thisMesh = patch_.boundaryMesh().mesh();
bool topoChange = thisMesh.topoChanging();
if (topoChange)
{
surfPtr_.clear();
}
const word surfType(surfDict_.lookupOrDefault<word>("type", "none"));
if (!surfPtr_.valid() && surfType != "none")
{
...
...