CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Understanding OpenFOAM code (https://www.cfd-online.com/Forums/openfoam-programming-development/242662-understanding-openfoam-code.html)

Numericer May 4, 2022 04:21

Understanding OpenFOAM code
 
2 Attachment(s)
I am trying to understand roughly what each method/function in OpenFOAM does by searching for it in the link cpp.openfoam.org.



As I went through the laplacianFoam.C, I got stuck with the member functions of "options" class namely constrain() and correct(). Scouring the above source code, I found the class definition and function definitions, which call member function of another class called "option" (source.constrain()), which was empty. I've attached below the screenshots.


I've been having a bit of trouble understanding OpenFOAM code this way. Are there other easy ways of knowing what the functions do?


Attachment 89640

Attachment 89641

Kummi May 5, 2022 01:41

In order to understand OpenFOAM, try to do the following:

~ Work in debug mode till your code works promptly. The debug mode locates the error appropriately during compilation which helps to understand the code better.
WM_COMPILE_OPTION=Debug

~ Try using gdb or nemiver debuggers which helps to navigate the code line by line from the scratch.
https://openfoamwiki.net/index.php/HowTo_debugging

~ Create doxygen documentation for your customized solver. It's a good reference manual with source trees to easily refer the actual code.

Hope it helps.
Thank you


All times are GMT -4. The time now is 13:06.