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

What are dictionaries in Openfoam ?

Register Blogs Community New Posts Updated Threads Search

Like Tree11Likes
  • 2 Post By granzer
  • 5 Post By GerhardHolzinger
  • 4 Post By granzer

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2019, 02:42
Default What are dictionaries in Openfoam ?
  #1
Senior Member
 
Mandeep Shetty
Join Date: Apr 2016
Posts: 188
Rep Power: 10
granzer is on a distinguished road
I am an absolute beginner to Openfoam and I am trying to understand what the dictionaries are in open foam. It is stated that blockMeshDict is a dictionary. I am not able to understand how this file is a dictionary.
a) It contains a dictionary (is this a sudictionary?) named Foamfile, which in accordance with the definition of dictionary has certain keywords within {}.
b) blockMeshDict file also contains list such "vertices" which are not with in any braces {}.
c)Also in the boundary-list there are boundaries named 'movingwall' and its definition is given with in braces{} so is this movingwall a dictionary?
d) Shouldn't the blockMeshDict be a datafile instead of being called a dictionary?
e) Also its given "Most OpenFOAM data files are themselves dictionaries containing a set of keyword entries." How is this possible..ie is everything with in such a file given with in {...} and the name of that datafile being the dictionary name?
f) What are dictionaries??
unicrey and pfguo like this.
granzer is offline   Reply With Quote

Old   June 25, 2019, 05:23
Default
  #2
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Quote:
a) It contains a dictionary (is this a sudictionary?) named Foamfile, which in accordance with the definition of dictionary has certain keywords within {}.
b) blockMeshDict file also contains list such "vertices" which are not with in any braces {}.
c)Also in the boundary-list there are boundaries named 'movingwall' and its definition is given with in braces{} so is this movingwall a dictionary?
d) Shouldn't the blockMeshDict be a datafile instead of being called a dictionary?
e) Also its given "Most OpenFOAM data files are themselves dictionaries containing a set of keyword entries." How is this possible..ie is everything with in such a file given with in {...} and the name of that datafile being the dictionary name?
f) What are dictionaries??
The term dictionary in OpenFOAM-parlance is derived from the dictionary data type. Yet, in everyday use, people refer to certain files as dictionaries, e.g. the file blockMeshDict, and people also refer to certain contents of a file as a dictionary, e.g. the solvers dictionary in the file fvSolution.

a; A dictionary may contain sub-dictionaries. That is all perfectly fine.

b; a dictionary may contain any data, i.e. blockMeshDict containing lists of vertices, blocks, etc. is nothing unusual.

c; the boundary-list is a list of dictionaries, with each dictionary entry (e.g. the movingWall entry) being the definition of a boundary patch.

d; blockMeshDict is called a dictionary most-probably by convention. If you take a look at the relevent code of blockMesh, where the file blockMeshDict is ultimately being read, you find that reading the file creates an object of the type IOdictionary, which contains the contents of the file blockMeshDict. So calling blockMeshDict a dictionary, and not a data file, is justified.


f; a dictionary is either a certain entry in a file, see the PISO dictionary of fvSolution

Code:
PISO
{
    nCorrectors     2;
    nNonOrthogonalCorrectors 0;
    pRefCell        0;
    pRefValue       0;
}
or, a dictionary may also refer to a file as a whole, see how icoFoam reads the file transportProperties:

Code:
IOdictionary transportProperties
(
    IOobject
    (
        "transportProperties",
        runTime.constant(),
        mesh,
        IOobject::MUST_READ_IF_MODIFIED,
        IOobject::NO_WRITE
    )
);
In both cases, we refer to the thing in question as a dictionary.
That's a bit murky, yet correct.


I guess the answer to question e follows from the other answers.


The User Guide on the dictionary as part of OpenFOAM's IO syntax

The Doxygen entry of the dictionary data type
Tobi, granzer, pfguo and 2 others like this.
GerhardHolzinger is offline   Reply With Quote

Old   November 20, 2020, 09:55
Default
  #3
New Member
 
Join Date: Nov 2020
Posts: 6
Rep Power: 6
user92 is on a distinguished road
Quote:
Originally Posted by granzer View Post
I am an absolute beginner to Openfoam
Hello! I wonder how your learning experience went? I hope you did not give up any recommendations to a beginner? what helped you the most (strategy, reference, tutorial, etc)?
user92 is offline   Reply With Quote

Old   November 25, 2020, 01:47
Default
  #4
Senior Member
 
Mandeep Shetty
Join Date: Apr 2016
Posts: 188
Rep Power: 10
granzer is on a distinguished road
Quote:
Originally Posted by user92 View Post
Hello! I wonder how your learning experience went? I hope you did not give up any recommendations to a beginner? what helped you the most (strategy, reference, tutorial, etc)?
I have gotten better @ it. . My recommendation would depend on what are you looking to do with OF. If you want to just run a simple simulation then search for a suitable solver and run the tutorial for it. That should teach you how to use the solver. If your simulation complex then depending on the complexity you may need to change the solver...which would involve little coding. If you can find the solver edits that is reqired made by someone else you can directly use that...else you will need to do the code edits yourslef..which is where things get a little complicated. You will need basic understanding of C++ and object-oriented programing to nevigate the codes. Then you will need to understand all different classes and objects used in OF themselves..which I am sorry to say requires a lots and lots of reading...and there isn't just one shot place to get all the info. (Google is your friend. So try googling the same question you have in different way). But as you read different materials you will build up the knowledge and that helps as you move forward..as you start to build on what you have already learnt and things start making sense. Parallelly you will need to understand the CFD algorithms ( and the math) themselves so you will need to hit the CFD texts books and lectures too. This is so you know what the code itself is meant to do. So at the at the top you have the difference CFD algorithms which are used to model different kinds of flows. Below that is the C++ ( the language syntax) code which is used to implement the CFD algorithms . Also, you will need to leant to you linux/scripting. Optionally learning Python helps too. I am not trying to deter you...it's but deciding to use OF is not a decision that should be taken lightly and it's a very rewarding journey and you will learn a lot CFD the math and the algorithms how they are implemented in therms of code...and also a powerful and extensively used coding language such as C++ and scripting in Python.
granzer is offline   Reply With Quote

Reply

Tags
blockmeshdict, dictionaries


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 06:29
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology wyldckat OpenFOAM 17 November 10, 2017 16:54
OpenFOAM Training Jan-Apr 2017, Virtual, London, Houston, Berlin cfd.direct OpenFOAM Announcements from Other Sources 0 September 21, 2016 12:50
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 15:25
The OpenFOAM extensions project mbeaudoin OpenFOAM 16 October 9, 2007 10:33


All times are GMT -4. The time now is 11:47.