We use Valgrind with callgrind to debug and profile OpenFOAM solvers in order to give out solutions to make our modified solvers run faster and get more stability. We can even generate nice looking call graphs to help us trace function calls or compare the consuming time of functions between different versions.
1. Valgrind Installation on Ubuntu terminal
2. How to use Valgrind
3. KCachegrind basic
4. Using Kcachegrind to profile overPimpleDyMFoam
The image below is an example for comparing the calculated time of child functions of overPimpleDyMFoam with other versions:
For the image, considering the executable time of overPimpleDyMFoam, we can see the function named Foam::dynamicOversetFVMesh::update() of OF1712 took 71.28% of time consumption while the counterpart of the right side is slightly bigger than 0.08%, standing at 71.68% of time consumption. This example shows that the various spending time of the same solver between other OpenFOAM versions can be detected by Valgrind
5. Reference
[1]. Josef Weidendorfer and Federico Zenith, "The KCachegrind Handbook"
シンクタンクにてリスクマネージメントにCAEを活用,その後,外資系CAEベンダーでサポートエンジニア,技術営業を得て,ESIに入社.OpenFOAMを軸としたCFD関連のエンジニアリングサービスを担当