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/)
-   -   Want to learn more about C++ and OpenFOAM's source code (https://www.cfd-online.com/Forums/openfoam-programming-development/140278-want-learn-more-about-c-openfoams-source-code.html)

zahraa August 12, 2014 08:38

Want to learn more about C++ and OpenFOAM's source code
 
Hi
I am new to openFoam and now i am working on C++ and cfd. now i want to know what should i do if i want to be a professional. i studied many tutorials and many parts of user guide so far and i am familiar with chtmultiregionFoam.

adambarfi August 12, 2014 09:00

Hi Zahraa,

I'm not an openFoam expert but I think you should do different projects. that make you to have struggle with it and it's the best way to learn. also surfing this forum and the wiki and http://foam.sourceforge.net/docs/cpp/ website could help you to extend your knowledge.
Also the textbook written by Nima Samkhaniani would help you a lot.

Regards,
Mostafa

zahraa August 12, 2014 15:29

Thank you. Samkhaniani book was useful but now i want to be able to write code and understand the structure of openfoam, how it works exactly.what i should do to understand?:)

hchen August 13, 2014 07:21

Quote:

Originally Posted by zahraa (Post 505644)
Thank you. Samkhaniani book was useful but now i want to be able to write code and understand the structure of openfoam, how it works exactly.what i should do to understand?:)

Hi,

I am wondering which book do you refer for Samkhaniani book?

Could you provide a link or copy?

Thanks!

Hao

adambarfi August 13, 2014 08:31

Quote:

Originally Posted by hchen (Post 505735)
Hi,

I am wondering which book do you refer for Samkhaniani book?

Could you provide a link or copy?

Thanks!

Hao

It's a Persian textbook and only exist in Iran.

eric.m.tridas August 13, 2014 17:09

How familiar are you with C++? OpenFOAM frequently exploits some of the more complex C++ programming concepts. When I first started with OpenFOAM and was looking into the source code it all looked alien to me. In the mean time I worked on some other projects that really improved my C++ skills. Additionally, I read a few books about C++. When I revisited the code I realized that I could understand a lot more of what was going on.

I based the first code I wrote on code from other solvers and just explored the source code to get an idea of how to use the different classes.

I would just suggest reading some C++ books or taking a class on it then just look at the source code for all of the classes (found in the src folder of your OpenFOAM install) and the solvers (in the applications/solvers folder of your OF install).

Good luck!

zahraa August 14, 2014 07:59

Thank you very much Eric

jhoepken August 14, 2014 08:29

I can only agree with the Eric. Having at least a basic understanding of C++, OOP and maybe even some design patterns is of great help, when you are trying to learn do code with OpenFOAM.

Rather than starting with programing a new library, I suggest you start with programming some pre- or post-processing applications, to get familiar with OpenFOAM data structures. Tomislav has written a nice tutorial on how to write a new application from scratch, maybe you find that helpful: http://www.sourceflux.de/blog/howto-...n-in-openfoam/

Otherwise there is no real hands-on guide for developing with OpenFOAM, yet. You'll have to rely on the free tutorials available online, written by other enthusiasts :).

zahraa August 17, 2014 17:04

Thank you Jens:)


All times are GMT -4. The time now is 00:48.