CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Understanding OpenFOAM code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 4, 2022, 04:21
Default Understanding OpenFOAM code
  #1
New Member
 
Join Date: Apr 2015
Posts: 15
Rep Power: 11
Numericer is on a distinguished road
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?


constrain.png

option.C.png
Numericer is offline   Reply With Quote

Old   May 5, 2022, 01:41
Default
  #2
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 349
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
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
Kummi is offline   Reply With Quote

Reply

Tags
source code


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 11:58
OpenFOAM.com versus OpenFOAM.org: Which version to use? wyldckat OpenFOAM 19 March 25, 2023 07:50
OpenFOAM, progress in academia and industry, after 13 years' effort sharonyue OpenFOAM 5 March 29, 2018 12:09
Specific OpenFOAM Code pbhuter OpenFOAM 13 June 30, 2012 19:06
Design Integration with CFD? John C. Chien Main CFD Forum 19 May 17, 2001 15:56


All times are GMT -4. The time now is 16:26.