Skip to content

interIsoFoam crashes with AMR with load balancing

Summary

If interIsoFoam is combined with a AMR with load balancing as in:

https://github.com/HenningScheufler/multiDimAMR

isoAdvection crashes in syncProcPatches

Steps to reproduce

run dambreakWithObstacle with interIsoFoam

Reason

In the current code, it is assumed that the boundary patches do not change which is not the case with load balancing.

procPatchLabels_ needs to be recalculated after the redistribution step

Environment information

  • OpenFOAM version :
  • Operating system :
  • Hardware info :
  • Compiler :

Possible fixes

// add
void Foam::advection::isoAdvection::setProcessorPatches()
{
    const polyBoundaryMesh& patches = mesh_.boundaryMesh();
    surfaceCellFacesOnProcPatches_.clear();
    surfaceCellFacesOnProcPatches_.resize(patches.size());

    // Append all processor patch labels to the list
    procPatchLabels_.clear();
    forAll(patches, patchi)
    {
        if
        (
            isA<processorPolyPatch>(patches[patchi])
            && patches[patchi].size() > 0
        )
        {
            procPatchLabels_.append(patchi);
        }
    }
}

template < class SpType, class SuType >
void Foam::advection::isoAdvection::advect(const SpType& Sp, const SuType& Su)
{
    DebugInFunction << endl;

    if (mesh_.topoChanging()) // added
    {
        setProcessorPatches();
    }

another solution would be to remove the procPatchLabels_:

and modify syncProcPatch

forAll(surfaceCellFacesOnProcPatches_, patchi)
{
    if (isA<processorPolyPatch>(patches[patchi]) && patches[patchi].size())
    {