CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[Tutorials] OpenFOAM programming tutorials for beginners

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree192Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2018, 02:29
Default
  #41
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 250
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Quote:
Originally Posted by Artur View Post
Hi All,

Just wanted to say I (finally) upgraded all of the tutorials to work with OpenFOAM 5.x. Sorry it took so long, but they're here now. I also added a new tutorial showing how to deal with parsing command line arguments and options, following up on some questions asked in this thread a while ago.

Artur
Great job Arthur! Was looking for command line arguments, which I did long time before, and found perfect instructions here!)

Cheers,
Alex
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   June 7, 2018, 08:59
Default
  #42
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Hi All,


Just wanted to say I added a new tutorial looking at the nuts and bolts of mesh generation. I wanted to get a glimpse of that part of OF myself in line with my recent side project of learning to use Engrid and though it might be interesting to some of you as well. If you're interested in what I've been up to with Engrid check out this post:
Primsatic boundary layer creation fixed


All the best,


Artur
makaveli_lcf likes this.
Artur is offline   Reply With Quote

Old   July 8, 2018, 11:42
Default
  #43
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Hi All,


Just wanted to say I added a brief new tutorial on writing custom momentum sources based on an actuator disk example.


All the best,


Artur
makaveli_lcf likes this.
Artur is offline   Reply With Quote

Old   July 10, 2018, 14:48
Default
  #44
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Dear All,


Apologies for spamming the thread again the same week, but I just realised a new version of OpenFOAM has been released, so we're now at 6 from the openfoam.org branch. I tested the tutorials and they all seem to work fine without any modifications. I also restructured them a bit to make it easier for me to test them automatically in the future.


All the best


Artur
Artur is offline   Reply With Quote

Old   March 8, 2019, 15:04
Default
  #45
New Member
 
Febriyan Prayoga
Join Date: Apr 2016
Location: Seoul
Posts: 21
Rep Power: 9
febriyan91 is on a distinguished road
Quote:
Originally Posted by Artur View Post
Hi Foamers!

I wanted to share with you a couple of simple pieces of codes I wrote to demonstrate basic OpenFOAM functionality to beginner C++ programmers:
https://github.com/UnnamedMoose/Basi...mmingTutorials

The reason for the existence of these is that during my time at a University I've found that many students starting their research using OpenFOAM are required to develop code for it but have little to no prior knowledge of C++. This usually makes it very hard for them to jump from basic programming to the admittedly complex OpenFOAM framework, and also makes using many on-line materials quite challenging. The above tutorials hope to help with making this step. I've "tested" them on a few of my colleagues and collaborators and I hope they may help a wider audience in the future.

Feedback always welcome! But please bear in mind I'm self-taught both in OpenFOAM and C++, so go easy on me

Also, if you'd like to contribute a new tutorial or offer improvements to the ones already there, I'd highly welcome your input!

Happy foaming,

Artur
Thank you so much for sharing!
febriyan91 is offline   Reply With Quote

Old   July 9, 2019, 02:27
Default
  #46
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Hi All,


Just a quick update: I've upgraded the tutorials to work with the new OpenFOAM 7. Changes required were minimal but at least now everything works out-of-the-box.


Happy foaming,


A
snak, WaterHammer1985 and Tesbo like this.
Artur is offline   Reply With Quote

Old   August 30, 2019, 05:52
Default ThankYou
  #47
Member
 
Arthur
Join Date: Aug 2014
Location: Italy
Posts: 47
Rep Power: 11
Artur.Ant is on a distinguished road
Thank you very much. Appreciate a lot your work. It was a good idea to make some tutorials for the new c++ users.
Artur.Ant is offline   Reply With Quote

Old   September 2, 2019, 13:20
Default Thank you
  #48
New Member
 
Alex
Join Date: Sep 2019
Posts: 1
Rep Power: 0
Zywx is on a distinguished road
Thank you for your job, I'm new in this world and I'm learning a lot with your posts.
I have OF7 and I have an error in all the tutorials and I dont know why.




tutorial1

Quote:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM FATAL ERROR:
cannot find file "/home/alexp/OpenFOAM/alexp-7/BasicOpenFOAMProgrammingTutorials-master/OFtutorial01_inputOutput/testCase/controlDict"

From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::rea dStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 538.

FOAM exiting

In the tutorial2

Quote:
./Allrun: línea 3: 18058 segmentation fault (core dumped) openfoam ofTutorial2 someWordIPassed 5. -someSwitch -someInt 2 -dict path_to_nowhere_in_particular

./testAll

Quote:
Checking: OFtutorial00_helloWorld/
PASS: ./Allwmake
FAIL: ./Allrun
Checking: OFtutorial01_inputOutput/
PASS: ./Allwmake
FAIL: ./Allrun
Checking: OFtutorial02_commandLineArgumentsAndOptions/
PASS: ./Allwmake
FAIL: ./Allrun
Checking: OFtutorial03_understandingTheMesh/
PASS: ./Allwmake
FAIL: ./Allrun
Checking: OFtutorial04_basicFieldOperations/

I feel bad for being the only one to have this problem.
Zywx is offline   Reply With Quote

Old   September 3, 2019, 03:30
Default
  #49
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Hi,

From the first error message, it seems as though the test case is missing the controlDict file. Are you sure it checked out properly and contains the usual OpenFOAM folder structure?

Regards,

Artur
Artur is offline   Reply With Quote

Old   May 18, 2020, 19:40
Default
  #50
New Member
 
Kumar Pushpak
Join Date: Apr 2019
Posts: 9
Rep Power: 7
khool_chelsea is on a distinguished road
Hey thanks. This was just what i needed to get started.
Artur likes this.
khool_chelsea is offline   Reply With Quote

Old   November 3, 2020, 11:04
Default unable to see tutorials
  #51
New Member
 
John
Join Date: Nov 2013
Location: USA
Posts: 22
Rep Power: 12
Gallienus is on a distinguished road
Quote:
Originally Posted by Artur View Post
Hi Foamers!

I wanted to share with you a couple of simple pieces of codes I wrote to demonstrate basic OpenFOAM functionality to beginner C++ programmers:
https://github.com/UnnamedMoose/Basi...mmingTutorials
Artur
Is there some place I can see the tutorials without coding them 1st? When I click on the link I get sent to branches which show code revisions on Github. It's not althogether clear which branch I should follow for a tutorial as often there seem to be over 100 branches for one tutorial.
Gallienus is offline   Reply With Quote

Old   November 3, 2020, 12:51
Default
  #52
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Hi,

Thanks for the interest in the tutorials. You can view the original materials on the main github site: https://github.com/UnnamedMoose/Basi...mmingTutorials . There you can navigate from one tutorial to another and explore the contents without downloading or compiling anything. To be clear, as I explain in the README, there are no formal slides, notes or any other document beyond the readme. Each tutorial explains everything inside the actual source code, giving you on-the-fly description of what's what and how all the pieces come together.

Hope this helps,

Artur
Gallienus likes this.
Artur is offline   Reply With Quote

Old   December 11, 2020, 03:13
Default
  #53
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Just a quick update: I've tested the tutorials with OpenFOAM-8 and it all works fine. I've also merged a tutorial contributed by a member of the community, for which many thanks go to Ramkumar!

Happy foaming,

A
granzer and mikulo like this.
Artur is offline   Reply With Quote

Old   January 25, 2021, 15:51
Default
  #54
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Hi All, another quick update: the tutorials now include an example of how the SIMPLE algorithm works! Mmany thanks to Ramkumar for contributing the tutorial.
Tobi and petros like this.
Artur is offline   Reply With Quote

Old   January 26, 2021, 07:31
Default
  #55
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Arthur, thank you for your effort. Do you mind if I put you onto my website under the section Community Contributions?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 26, 2021, 11:14
Default
  #56
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Quote:
Originally Posted by Tobi View Post
Arthur, thank you for your effort. Do you mind if I put you onto my website under the section Community Contributions?

Sure, go ahead
Artur is offline   Reply With Quote

Old   February 17, 2021, 07:37
Default
  #57
Member
 
Callum Guy
Join Date: Dec 2019
Location: Scotland
Posts: 44
Rep Power: 6
CallumG is on a distinguished road
I've just come across the repository and firstly - it's awesome how much time and effrot you've put into it - it's a credit to the community!

Just a quick question, is there any plans for it to work with openfoam.com releases?

Thanks again!
Callum
CallumG is offline   Reply With Quote

Old   February 17, 2021, 15:29
Default
  #58
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Hi,
Thanks for the positive feedback Callum, much appreciated!
Not at the moment, no - I don't think it'd be too much work to get it working, as the two versions are not that far apart in terms of basic pieces used in the tutorials, but it would potentially complicate maintenance for me a lot. I decided to use the other branch because that's what I was using at the time I started the tutorials, but I do not have a strong preference over one or the other. If you can convince me it's worth changing, I can rewrite everything to work with the openfoam.com branch But then I'd drop compatibility with the current one.
Cheers,
A
Artur is offline   Reply With Quote

Old   February 19, 2021, 01:40
Post
  #59
New Member
 
Yashas Gandhi
Join Date: Feb 2021
Posts: 1
Rep Power: 0
Yashas Gandhi is on a distinguished road
Hello!
I am new to OpenFOAM and trying out these tutorials. I don't understand how appending works in OFtutorial1 and any explanation will be very much appreciated. This is the hash table given in customProperties file:
Code:
someHashTable
(
    key0 (0 0 0)
    key1 (1 0 0)
);
Now, in the OFtutorial.C file, we append and write a new entry:
Code:
// Append to the imported hash table and wirte it too
    someHashTable.insert("newKey", vector(1., 0., 0.));
    outputFilePtr() << someHashTable << endl;
Now, in output file, we get following:
Code:
(
key0 (0 0 0)
newKey (1 0 0)
key1 (1 0 0)
)
So I am confused as to why the new entry got inserted between the two existing entries and not at the end of the table like how usually appending works in Ubuntu.
Yashas Gandhi is offline   Reply With Quote

Old   February 19, 2021, 04:27
Default
  #60
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 19
Artur will become famous soon enough
Hi,


Hash tables are, by definition, unsorted - unlike lists or arrays. Here, specific keys (strings in this case) point to values at specific locations in an underlying data structure. Have a look here: https://en.wikipedia.org/wiki/Hash_t...0_1_0_0_SP.svg


Cheers,


A
Yashas Gandhi likes this.
Artur is offline   Reply With Quote

Reply

Tags
turorial files, tutorial

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 05:29
OpenFOAM 4.0 Released CFDFoundation OpenFOAM Announcements from OpenFOAM Foundation 2 October 6, 2017 05:40
OpenFOAM Training: Programming CFD Course 12-13 and 19-20 April 2016 cfd.direct OpenFOAM Announcements from Other Sources 0 January 14, 2016 10:19
OpenFOAM v3.0.1 Training, London, Houston, Berlin, Jan-Mar 2016 cfd.direct OpenFOAM Announcements from Other Sources 0 January 5, 2016 03:18
Openfoam Programming from scratch shovan OpenFOAM Programming & Development 1 July 9, 2015 12:38


All times are GMT -4. The time now is 05:04.