|
[Sponsors] |
Beginner: How to bridge the gap between basic C++ knowledge to openFOAM programming |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 9, 2011, 15:32 |
Beginner: How to bridge the gap between basic C++ knowledge to openFOAM programming
|
#1 |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
I have a mechanical engineering background with only undergraduate classes in various programming (C++, lingo, VB, html). My goal is to become free to use openFOAM as I please.
I did all the tutorials on http://www.cplusplus.com/doc/tutorial/ to refresh my knowledge and I am still very confused when I'm trying to understand the source code in openFOAM. I get lost trying to get to the source of several layers of classes of code for simple features. What can I do to bridge this gap. Thanks |
|
August 10, 2011, 11:03 |
|
#2 |
Senior Member
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 200
Rep Power: 18 |
Hi Alex,
I'm also trying to understand some details of the source code and I'm also finding it difficult. There is no detailed manual of the code implementation but you can obtain information distributed in a lot of sources. Here is a list of links that I found useful for understanding the code: 1)Dr. Hvoje Jasak presentation at the 6th OpenFOAM workshop http://www.openfoamworkshop.org/6th_...ak2_slides.pdf 2)Dr. Tommaso Lucchini programming tutorial http://cfd.iut.ac.ir/files/Tutorial,...20Diego%20.pdf 3) The Programmer Guide Addendum that appears in the OpenFOAM wiki has many interesting topics written by different authors: http://openfoamwiki.net/index.php/Ma...rGuideAddendum This list is small but other people may help adding their preferred links. Paulo |
|
August 10, 2011, 14:07 |
|
#3 |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
Thanks for this reply. Very helpful.
|
|
August 11, 2011, 08:45 |
|
#4 |
Senior Member
|
||
August 11, 2011, 09:31 |
|
#5 | |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
Quote:
|
||
August 11, 2011, 10:50 |
|
#6 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
The programmer's guide addendum has been expanded to the "OpenFOAM guide", a subsection of the wiki:
http://openfoamwiki.net/index.php/Ca...OpenFOAM_guide I'm also planning to formalizing this into a pdf-ish programmer's guide for all OpenFOAM users. |
|
August 11, 2011, 10:51 |
|
#7 | |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
Quote:
I have had many debugging errors along the way just to get the compiler to work. Two corrections I made to the rampedFixedValueFvPatchField.C file were: Change #1: Code:
template<class Type> rampedFixedValueFvPatchField<Type>::rampedFixedValueFvPatchField ( const fvPatch& p, //const Field<Type>& iF, const DimensionedField<Type, volMesh>& iF, const dictionary& dict ) : fixedValueFvPatchField<Type>(p, iF), refValueLow_("refValueLow", dict, p.size()), refValueHigh_("refValueHigh", dict, p.size()), startRamp_(readScalar(dict.lookup("startRamp"))), endRamp_(readScalar(dict.lookup("endRamp"))), curTimeIndex_(-1) { Info << "Hello from ramp! startRamp: " << startRamp_ << " endRamp: " << endRamp_ << endl; if (dict.found("value")) { fixedValueFvPatchField<Type>::operator== ( Field<Type>("value", dict, p.size()) ); } else { fixedValueFvPatchField<Type>::operator== ( refValueLow_ + (refValueHigh_ - refValueLow_)*currentScale() ); } Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //#ifdef NoRepository //# include "rampedFixedValueFvPatchField.C" //#endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* // Code:
... Create time Create mesh for time = 0 Reading transportProperties Reading field p Reading field U icoFoamRamped: symbol lookup error: /home/alexander/OpenFOAM/alexander-2.0.1/platforms/linux64GccDPOpt/lib/libMyBCs.so: undefined symbol: _ZN4Foam28rampedFixedValueFvPatchFieldINS_6VectorIdEEEC1ERKNS_7fvPatchERKNS_16DimensionedFieldIS2_NS_7volMeshEEERKNS_10dictionaryE alexander@alexander-G50VT:~/OpenFOAM/alexander-2.0.1/run/cavity$ |
||
August 11, 2011, 10:53 |
|
#8 |
Senior Member
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 200
Rep Power: 18 |
Hi,
The NUMAP 2009 also has interesting lectures: http://powerlab.fsb.hr/ped/kturbo/Op...2009/lectures/ |
|
August 11, 2011, 11:07 |
|
#9 |
Senior Member
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 200
Rep Power: 18 |
Hi Alex,
I haven't tried these tutorials yet. In the slides, Dr. Lucchini mentions version 1.41 of OpenFOAM. I don’t know if this tutorial is compatible with version 2.01. |
|
August 11, 2011, 15:51 |
|
#10 |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
Thanks anyway vatavuk. I will continue to debug. In the meantime there is such a wealth of information on this thread that I will continue to learn and come back to the tommaso problem.
Thanks again. |
|
August 13, 2011, 09:27 |
|
#11 |
Senior Member
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 200
Rep Power: 18 |
Hi Marupio,
I've been navigating the wiki for some time but haven't seen this guide until I saw your link above. Sometimes it's difficult to find some pages in the wiki. Congratulations for your guide it will help many people. Making a pdf of it will be even better. |
|
February 15, 2012, 17:11 |
|
#12 |
New Member
Teng Wu
Join Date: Feb 2012
Posts: 9
Rep Power: 14 |
Hi Alex,
Have you successfully completed the ramped boundary condition in Dr. Tommaso's programming tutorial now? These days I'm also trying to figure out the debugging errors during the compiling process. Some issues similar with yours shows up... Teng |
|
July 9, 2015, 13:34 |
|
#13 |
Senior Member
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 200
Rep Power: 18 |
Hi,
I noticed that the links in my post #2 are broken, so I made a search and found the updated links: 1)Dr. Hvoje Jasak presentation at the 6th OpenFOAM workshop http://iweb.dl.sourceforge.net/proje...ak2_slides.pdf 2)Dr. Tommaso Lucchini programming tutorial http://www.tfd.chalmers.se/~hani/kur...ngTutorial.pdf 3) The Programmer Guide Addendum (now openFOAM guide): http://openfoamwiki.net/index.php/OpenFOAM_guide Best Regards, Paulo |
|
February 13, 2017, 23:21 |
|
#14 |
Member
Declan
Join Date: Oct 2016
Location: Ireland
Posts: 40
Rep Power: 10 |
This is still a very relevant thread for those looking to dive into the source code for the first time.
This course by Joel Guerrero has some excellent material, see module 7 for programming. http://www.wolfdynamics.com/our-serv...ing.html?id=50 If anyone else has useful links please share! |
|
July 10, 2018, 06:34 |
|
#15 |
New Member
Sebastian
Join Date: Sep 2013
Posts: 14
Rep Power: 13 |
Since I find it very helpfull, I want to share the tutorial of the user Artur here as well. It perfectly fits into the topic of this thread.
OpenFOAM programming tutorials for beginners |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A book for a beginner wanting to learn programming | frank | Main CFD Forum | 9 | May 13, 2014 00:15 |
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 | wyldckat | OpenFOAM Announcements from Other Sources | 3 | September 8, 2010 07:25 |
OpenFoam programming | prapanj | OpenFOAM | 10 | March 18, 2010 08:23 |
Programming in OpenFOAM | vinu | OpenFOAM | 2 | July 11, 2009 11:16 |
Adventure of fisrst openfoam installation on Ubuntu 710 | jussi | OpenFOAM Installation | 0 | April 24, 2008 15:25 |