Skip to content

Error in mappedPatches/mappedPolyPatch/mappedPatchBase.C

Summary

I am facing two contradicting error when applying samplingModes (nearestCell and nearestOnlyCell) in a MultiRegion problem.

Steps to reproduce

This can be easily reproduced by changing the sampleMode of the interface to nearestCell or nearestOnlyCell in a chtMultiRegion tutorial in constant/polyMesh/boundary file.

Example case

What is the current bug behaviour?

So I am running a MultiRegion problem, and I had a problem in mapping the cells at the interface, so I tried using different sampleMode, and when I came to try the nearestCell and the nearestOnlyCell , I found two contradicting errors.

So this is the boundary patch I am trying to map in constant/fluid/polyMesh/boundary:

airfoil
   {
       type            mappedPatch;
       inGroups        1(mappedPatch);
       nFaces          292;
       startFace       123418;
       sampleMode      nearestCell;
       sampleRegion    solid;
       samplePatch     airfoil;
       offsetMode normal;
       offset ( 0 0 0 );
       distance 0.00005;
   }

As you see here I am specifying the patch name as here as samplePatch airfoil, this is the error I get.


--> FOAM FATAL ERROR: (openfoam-2012)
No need to supply a patch name when in nearestCell mode.

    From void Foam::mappedPatchBase::findLocalSamples(Foam::mappedPatchBase::sampleMode, Foam::label, const Foam::word&, const Foam::word&, const pointField&, Foam::List<Foam::Tuple2<Foam::Tuple2<Foam::PointIndexHit<Foam::Vector<double> >, Foam::Tuple2<double, int> >, int> >&) const
    in file mappedPatches/mappedPolyPatch/mappedPatchBase.C at line 321.

FOAM exiting

From this error, I understood that I should remove the samplePatch entry, when I commented it as you see here:

airfoil
 {
     type            mappedPatch;
     inGroups        1(mappedPatch);
     nFaces          292;
     startFace       123418;
     sampleMode      nearestCell;
     sampleRegion    solid;
//      samplePatch     airfoil;
     offsetMode normal;
     offset ( 0 0 0 );
     distance 0.00005;
 }

I got this error:

--> FOAM FATAL ERROR: (openfoam-2012)
Supply either a patchName or a coupleGroup for patch airfoil in region fluid

    From const Foam::word& Foam::mappedPatchBase::samplePatch() const
    in file /home/pawan/OpenFOAM/OpenFOAM/OpenFOAM-v2012/src/meshTools/lnInclude/mappedPatchBaseI.H at line 74.

FOAM exiting

which is contradicting the previous error I got.

What is the expected correct behavior?

I am expecting that this contradiction doesn't appear, and that it works in one of the two cases.

Relevant logs and/or images

Environment information

  • OpenFOAM version : v2012
  • Operating system : WSL
  • Hardware info :
  • Compiler : gcc

Possible fixes

Edited by Zeinab Abosedaira