labelList of cells of a cellSet/cellZone is not fully transfered to fvOption for looping
Summary
Hello community, If you decide to test the already implemented actuationDiskSource fvOption that is brought with v2306|v2012, you will find a mismatch between the scalar computed T and the total amount (scalar magnitude) of sink term applied via Usource[celli]. I propose you to check inside each loop performed based on labelList cells_, either for Froude or variableScaling.
The comparison must be done running in parallel, check the amount of cells reported via topoSet that was selected for the cellSet/cellZone created where the fvOption will applied to. By adding counters and storing variables, you will find:
- The amount of iterations inside the loops is lower that the value of cells selected via topoSet.
- If you create a variable that stores the sum of cellsV/V() you will find it does not ends as 1 as it should.
- If you ask to print in screen cells() (outside the loop) you will see that the total amount of cells reported and the list printed in screen does not match the total amount of cells selected via topoSet
- If you add a scalar inside the loop, that stores the sum of each sink term applied inside the loop, the final value of this storing variable will be lesser than the scalar thrust computed lines before. Which I think is related to 1) and 2).
Steps to reproduce
For the case of Froude method testing, I added:
// Compute calibrated thrust/power (LSRMTK:Eq. 5) const scalar T = 0.5*rhoDisk*diskArea_*pow(UrefNew,2)*CtrefNew; // variable that will store the total magnitude of sink term just for use of comparison for validation of code scalar magSource = 0.0; scalar cellInCellSet = 0.0; scalar volumenCheck = 0.0; for (const label celli : cells_) { Usource[celli] += (cellsV[celli]/totalV)*T*diskDir_; magSource += mag(Usource[celli] & diskDir_); cellInCellSet += 1.0; volumenCheck += (cellsV[celli]/totalV); } /* DEBUG PART IV*/ Info << "the variable cells_ is = " << cells_ << endl; Info << "Volumen check via (cellsV[celli]/totalV) " << volumenCheck << endl; Info << "Volumen check via V() " << V() << endl; Info << "Total cells check via cellInCellSet (counter) " << cellInCellSet << endl;
PLEASE note that I have not used reduce() for the new variables created.
Example case
I ran with 6 processor the turbineSiting tutorial, in controlDict I added the library of my 'custom actuationDiskSource'. In OpenFOAM v2012 volumenCheck = 0.5 so magSource was half of T. In OpenFOAM v2306 volumenCheck = 0.77 so magSource was like 3/4 of T.
What is the current bug behaviour?
scalar magSource does not match in value with scalar T
What is the expected correct behavior?
scalar magSource must match in value with scalar T
Environment information
OpenFOAM version : v2306|v2012 Operating system : ubuntu 22.04 Compiler : gcc
- OpenFOAM version :
- Operating system :
- Hardware info :
- Compiler :
Possible fixes
I'm not clear why the fvOptions does not receive the full list. In case I've done wrong the verification between magSource and T, I'll appreciate any clarification how to check it better.
Thanks,