snappyHexMesh :: Prediction of maxNewCells wrong with new code
Summary
Hey everybody, in v2306, the balancing method within snappy was improved based on the code snippet I provided to L2. !607 (merged)
The issue appears now due to a one-liner change from Mattijs:
- This line now calculates only zero for the
maxLocalCell
variable, if we first refine and then balance 4a5f542c - This is related to the fact that this line was introduced by Mattijs to fix the wrong
balance
calculation: https://develop.openfoam.com/Development/openfoam/-/blob/develop/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C?ref_type=heads#L2762
Hence, the calculation of maxLocalCells
is wrong (as it is zero all the time and the trigger value will never be taken into account). However, this value is mainly necessary if e.g., locally on one single proc a refinement happens significantly (imagine a refinement based on the surfaceFeatureAngle while using a level (4 6)
refinement for example.
The discrepancy at the moment is:
- The balancing factor is calculated correctly (in previous versions we were over predicting the nNewCells value due to the fact that the refinement took place alreads)
- On the other hand, the balancing trigger value
maxLocalCells
is zero now (if refineAndBalance is used) and thus, the trigger will not be used anymore
Steps to reproduce
To check that the values of maxLocalCells
are always zero, simply execute snappyHexMesh while having maxLocalCells 100000000;
to explicitly go step into the refineAndBalance
function rather than balanceAndRefine
.
What is the current bug behaviour?
Described in the summary.
What is the expected correct behavior?
If we use refineAndBalance
the maxLocalCells
should be calculated correctly.