|
[Sponsors] |
Question about db().lookupObject<volScalarField> |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 18, 2020, 05:17 |
Question about db().lookupObject<volScalarField>
|
#1 |
New Member
Join Date: Nov 2020
Posts: 6
Rep Power: 5 |
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 07:16. |
|
November 18, 2020, 06:47 |
|
#2 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
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 |
|
November 18, 2020, 07:55 |
|
#3 | |
New Member
Join Date: Nov 2020
Posts: 6
Rep Power: 5 |
Quote:
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)? |
||
November 18, 2020, 08:23 |
|
#4 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
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. |
|
April 13, 2021, 07:06 |
|
#5 |
New Member
rocco
Join Date: Nov 2020
Posts: 13
Rep Power: 5 |
Hello everybody. I would like to use the pressure value calculated by my solver (internCondensatingEvaporatingfoam) within a library (constant.C). I tried to recall it as you recommend in this post, but the solver gives errors. As I understand it I should call the p object, but any way I use to call it doesn't work. Would anyone know how to give me some advice? I don't know what to put here const volScalarField & p = <???>. LookupObject <volScalarField> ("p");
Best Regards, Rocco |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about symmetry in Autodesk Cfd 2016 | ecto | Autodesk Simulation CFD | 0 | October 20, 2015 04:16 |
small question about the functionalities of topological changes in OpenFoam | ngj | OpenFOAM Running, Solving & CFD | 2 | February 28, 2013 10:02 |
Question Re Engineering Data Source | imnull | ANSYS | 0 | March 5, 2012 13:51 |
internal field question - PitzDaily Case | atareen64 | OpenFOAM Running, Solving & CFD | 2 | January 26, 2011 15:26 |
Poisson Solver question | Suresh | Main CFD Forum | 3 | August 12, 2005 04:37 |