volPointInterpolation fails on a subMesh, when the baseMesh contains cyclicAMIs and the subMesh doesn't.
Summary
If a mesh contains cyclicAMIs, a subset of that mesh is created and then an interpolation is attempted from cell values to points on the subMesh (such as in a VTK export of a mesh subset) then the process fails when it tries to process AMI boundaries during volPointInterpolated::addSeparated from the volPointInterpolated constructor.
- It fails in both parallel and serial.
- If the interpolation switch is turned off in the function object, no error happens and the process proceeds as expected.
- For a similar test-case to that described below, if the submesh contains faces on the cyclicAMI boundaries then it appears to run OK.
- The latest version of OF for which this export works appears to be v1912.
- (In v2312 and earlier the error messages are different.)
- (I've not tested other similar boundary conditions such as cyclicsACMI and cyclicPeriodicAMI.)
Steps to reproduce
Add the following function-object to the standard v2412 pimpleFoam "mixerVesselAMI2D" tutorial case and run.
functions
{
vtkWrite
{
type vtkWrite;
libs (utilityFunctionObjects);
writeControl timeStep;
writeInterval 1;
interpolate true;
boundary false;
fields (U p);
selection
{
sphere
{
action use;
source sphere;
origin (0.045 0 0);
radius 0.01;
}
}
}
}
What is the current bug behaviour?
Running the aforementioned modified tutorial in serial in v2406 in Debug mode (and with volPointOptimisation Debug switch set to 1), yields the following error message at the end of the first time-step:
vtkWrite output Time: 0.00120482
Internal : "postProcessing/vtkWrite/mixerVesselAMI2D_00000001/internal.vtu"
volPointInterpolation::makeWeights() : constructing weighting factors
volPointInterpolation::calcBoundaryAddressing() : constructing boundary addressing
boundary:
faces :96
of which on proper patch:10
points:98
of which on proper patch:22
volPointInterpolation::makeInternalWeights() : constructing weighting factors for internal and non-coupled points.
volPointInterpolation::makeBoundaryWeights() : constructing weighting factors for boundary points.
volPointInterpolation::addSeparated
AMI: Creating AMI for source:AMI1 and target:AMI2
AMI: Patch source sum(weights) min:25469.3 max:25469.3 average:25469.3
AMI: Patch target sum(weights) min:25469.3 max:25469.3 average:25469.3
--> FOAM FATAL ERROR: (openfoam-2406)
Supplied field size is not equal to target patch size
source patch = 96
target patch = 96
supplied field = 0
From void Foam::AMIInterpolation::interpolateToSource(const Foam::UList<T>&, const CombineOp&, Foam::List<T>&, const Foam::UList<T>&) const [with Type = double; CombineOp = Foam::multiplyWeightedOp<double, Foam::plusEqOp<double> >]
in file ~/OpenFOAM/OpenFOAM-v2406/src/meshTools/lnInclude/AMIInterpolationTemplates.C at line 179.
FOAM aborting
[stack trace]
=============
#1 Foam::error::simpleExit(int, bool) at ~/OpenFOAM/OpenFOAM-v2406/src/OpenFOAM/lnInclude/error.C:313
#2 Foam::error::exiting(int, bool) at ~/OpenFOAM/OpenFOAM-v2406/src/OpenFOAM/lnInclude/error.C:271
#3 Foam::error::abort() at ~/OpenFOAM/OpenFOAM-v2406/src/OpenFOAM/lnInclude/error.C:375
#4 Foam::Ostream& Foam::operator<< Foam::error(Foam::Ostream&, Foam::errorManipFoam::error) at ~/OpenFOAM/OpenFOAM-v2406/src/OpenFOAM/lnInclude/errorManip.H:93 (discriminator 4)
#5 void Foam::AMIInterpolation::interpolateToSource<double, Foam::multiplyWeightedOp<double, Foam::plusEqOp > >(Foam::UList const&, Foam::multiplyWeightedOp<double, Foam::plusEqOp > const&, Foam::List&, Foam::UList const&) const at ~/OpenFOAM/OpenFOAM-v2406/src/meshTools/lnInclude/AMIInterpolationTemplates.C:184 (discriminator 10)
#6 Foam::tmp<Foam::Field > Foam::AMIInterpolation::interpolateToSource<double, Foam::plusEqOp >(Foam::Field const&, Foam::plusEqOp const&, Foam::UList const&) const at ~/OpenFOAM/OpenFOAM-v2406/src/meshTools/lnInclude/AMIInterpolationTemplates.C:244
#7 Foam::tmp<Foam::Field > Foam::AMIInterpolation::interpolateToSource(Foam::Field const&, Foam::UList const&) const at ~/OpenFOAM/OpenFOAM-v2406/src/meshTools/lnInclude/AMIInterpolationTemplates.C:302
#8 Foam::tmp<Foam::Field > Foam::cyclicAMIPolyPatch::interpolateUntransformed(Foam::Field const&, Foam::UList const&) const at ~/OpenFOAM/OpenFOAM-v2406/src/meshTools/lnInclude/cyclicAMIPolyPatchTemplates.C:40
#9 Foam::tmp<Foam::Field > Foam::cyclicAMIPolyPatch::interpolate(Foam::Field const&, Foam::UList const&) const at ~/OpenFOAM/OpenFOAM-v2406/src/meshTools/lnInclude/cyclicAMIPolyPatchTemplates.C:68
#10 Foam::cyclicAMIPointPatchField::swapAddSeparated(Foam::UPstream::commsTypes, Foam::Field&) const at ~/OpenFOAM/OpenFOAM-v2406/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.C:183 (discriminator 2)
#11 void Foam::volPointInterpolation::addSeparated(Foam::GeometricField<double, Foam::pointPatchField, Foam::pointMesh>&) const at ~/OpenFOAM/OpenFOAM-v2406/src/finiteVolume/lnInclude/volPointInterpolate.C:113 (discriminator 2)
#12 Foam::volPointInterpolation::makeWeights() at ~/OpenFOAM/OpenFOAM-v2406/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C:411
#13 Foam::volPointInterpolation::volPointInterpolation(Foam::fvMesh const&) at ~/OpenFOAM/OpenFOAM-v2406/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C:480
#14 Foam::functionObjects::vtkWrite::write() at ~/OpenFOAM/OpenFOAM-v2406/src/functionObjects/utilities/vtkWrite/vtkWrite.C:423 (discriminator 3)
#15 Foam::functionObjects::timeControl::write() at ~/OpenFOAM/OpenFOAM-v2406/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C:545
#16 Foam::functionObjectList::execute(bool) at ~/OpenFOAM/OpenFOAM-v2406/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C:770 (discriminator 7)
#17 Foam::Time::run() const at ~/OpenFOAM/OpenFOAM-v2406/src/OpenFOAM/db/Time/Time.C:824
#18 ? at ~/OpenFOAM/OpenFOAM-v2406/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C:122
#19 ? in /lib64/libc.so.6
#20 __libc_start_main in /lib64/libc.so.6 #21 (closed) ? in ~/OpenFOAM/OpenFOAM-v2406A/platforms/linux64Gcc85DPInt32Debug/bin/pimpleFoam
=============
Abort (core dumped)
Note that v2412 gives a very similar error message - the example is in v2406 as a debug compilation of that was already available.
What is the expected correct behavior?
The export should complete OK!
Relevant logs and/or images
Environment information
- OpenFOAM version : v2006 through v2412
- Operating system : Centos7.9/Rocky9.3
- Hardware info :
- Compiler : gcc various
Possible fixes
The submesh/volPointInterpolation/cyclicAMI needs to recognise that there are no non-"empty" cyclicAMI patches remaining and process accordingly.