surfaceFieldValue weightedAverage missing division for mag(Sf)
Within the surfaceFieldValue FO we can compute weighted operations, among which the
When the weightField is a vector field, then it is not clear if the weighting factor is computed correctly.
The computation of the weightedAverage is done in surfaceFieldValueTemplates.C, line 195. But here the weighting factor is computed only for scalar values. As it is using the function
weightingFactor(weightField) defined in surfaceFieldValue.C, line 833. To my understanding here we are missing the case where the weightField is a vector, but we do not want an area weighting as well.
What is the expected correct behavior?
For weightedAverage operation, the weighting factor with vector weightField should be computed using a unity vector, i.e.
weightField & (Sf/mag(Sf)).
- OpenFOAM version : v2106, develop
To my understanding for the weighted averages with vector weightField we need to compute the factor as below:
weightField & (Sf/mag(Sf))
together with the change in surfaceFieldValueTemplates.C, line 193 as follows:
const scalarField factor(weightingFactor(weightField, Sf));