Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 421
    • Issues 421
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #2273
Closed
Open
Issue created Nov 18, 2021 by Chiara Pesci@Chiara

surfaceFieldValue weightedAverage missing division for mag(Sf)

Summary

Within the surfaceFieldValue FO we can compute weighted operations, among which the weightedAverage.
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.

On the other hand, for area-averaged operations, such as weightedAreaAverage, we have both cases of weightFactor=scalar and weightFactor=vector.

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)).

Environment information

  • OpenFOAM version : v2106, develop

Possible fixes

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));
Assignee
Assign to
Time tracking