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

Question about db().lookupObject<volScalarField>

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

Like Tree2Likes
  • 1 Post By simrego
  • 1 Post By simrego

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 18, 2020, 06:17
Default Question about db().lookupObject<volScalarField>
  #1
New Member
 
Join Date: Nov 2020
Posts: 5
Rep Power: 2
user92 is on a distinguished road
Hello everyone,

I have a question about the line of code below which I found here in Line 84


const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");

I couldn't find a clear explanation for it, so I supposed that db stands for a database in OpenFOAM? and the code is looking for "p" in <volScalarField>

I suppose further that <volScalarField> must come from an .H file which has "p" ... is this right? if yes, is the file volScalarField.H available somewhere?

Thank you

Last edited by user92; November 18, 2020 at 08:16.
user92 is offline   Reply With Quote

Old   November 18, 2020, 07:47
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 381
Rep Power: 8
simrego is on a distinguished road
Hi!


after the "database" (db) is accessed, read like this: you are looking for an object (lookupObject), which is a volScalarField type (<volScalarField>), and called p ("p").

volScalarField is a typedef, it is a "shorter notation" of GeometricField<scalar, fvPatchField, volMesh>
It is defined here:
https://openfoam.com/documentation/g...ce.html#l00059
user92 likes this.
simrego is offline   Reply With Quote

Old   November 18, 2020, 08:55
Default
  #3
New Member
 
Join Date: Nov 2020
Posts: 5
Rep Power: 2
user92 is on a distinguished road
Quote:
Originally Posted by simrego View Post
Hi!


after the "database" (db) is accessed, read like this: you are looking for an object (lookupObject), which is a volScalarField type (<volScalarField>), and called p ("p").

volScalarField is a typedef, it is a "shorter notation" of GeometricField<scalar, fvPatchField, volMesh>
It is defined here:
https://openfoam.com/documentation/g...ce.html#l00059

Thank you I have a few more clarifications if I may ask

- I wonder if there is a link to the db where I can see all objects there including "p"?

- does <...> always describe types? or is it only a syntax for lookupObject<type>("object name")?

for example what you mentioned: GeometricField<scalar, fvPatchField, volMesh> ... does this mean that scalar, fvPatchField, volMesh are also types since they are inside <>? if yes, is is fine to have multiple types (3 in this case)?
user92 is offline   Reply With Quote

Old   November 18, 2020, 09:23
Default
  #4
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 381
Rep Power: 8
simrego is on a distinguished road
You can read a bit about the objectRegistry here:
https://openfoamwiki.net/index.php/O...objectRegistry


And for the <> stuff, this is called templating. You should dig into the C++ programming language for details.
user92 likes this.
simrego is offline   Reply With Quote

Reply

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
Question about symmetry in Autodesk Cfd 2016 ecto Autodesk Simulation CFD 0 October 20, 2015 05:16
small question about the functionalities of topological changes in OpenFoam ngj OpenFOAM Running, Solving & CFD 2 February 28, 2013 11:02
Question Re Engineering Data Source imnull ANSYS 0 March 5, 2012 14:51
internal field question - PitzDaily Case atareen64 OpenFOAM Running, Solving & CFD 2 January 26, 2011 16:26
Poisson Solver question Suresh Main CFD Forum 3 August 12, 2005 05:37


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