Skip to content

ENH: forces: avoid redundant volumetric operations

Kutalmış Berçin requested to merge feature-forces-fo-performance into develop


It has been observed that employing the forces and forceCoeffs function objects in several simulations causes a slowdown ranging from 2 to 10%.

The culprits found were:

  • Calculation of velocity gradient
  • Redundant calculations performed for various internal fields


  • It is recommended to cache 'grad(U)' whenever using forces and forcesCoeffs function objects.
  • The recent commits have eliminated unnecessary computations for the internal field of devRhoReff.
    • Tests using the simpleCar tutorial ('grad(U)' was cached) produced the following 'profiling' figures: image
    • Tests using an industrial case ('grad(U)' was cached) reduced the functionObjects.execute() from ~72[s] to ~23[s].


  • EP2065
  • linux64ClangDPInt32Opt (clang13)
  • linux64GccDPInt32Opt
  • linux64GccSPDPInt64Debug
  • Alltest: No new error/No change in existing output
  • No output change in all operating conditions (e.g. direct force intensity, porosity, compressible flows etc.)
Edited by Kutalmış Berçin

Merge request reports