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

How to access a volscalarfield

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 6, 2021, 08:51
Default How to access a volscalarfield
  #1
New Member
 
Omair
Join Date: May 2017
Posts: 9
Rep Power: 9
m.omair is on a distinguished road
Hi everyone,
I am coding a new specie transport library in OpenFOAM. I need to access density which is calculated by the 'equation of state'. I have tried using the following code but no success...
Code:
scalar volVectorField& rho_ = rho().db().lookupObject<volVectorField>("rho");

Any help in this regard please.
m.omair is offline   Reply With Quote

Old   July 6, 2021, 08:57
Default
  #2
New Member
 
Omair
Join Date: May 2017
Posts: 9
Rep Power: 9
m.omair is on a distinguished road
I get the following error with above code...
Quote:
error: expected initializer before ‘&’ token
m.omair is offline   Reply With Quote

Old   July 6, 2021, 13:31
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by m.omair View Post
Hi everyone,
I am coding a new specie transport library in OpenFOAM. I need to access density which is calculated by the 'equation of state'. I have tried using the following code but no success...
Code:
scalar volVectorField& rho_ = rho().db().lookupObject<volVectorField>("rho");

Any help in this regard please.
Your code looks pretty strange on two accounts. First you have declared the variable as a "scalar volVectorField" - just wrong. You want "volScalarField" as the type. Second, you appear to be working from rho(), so why do you need to look that up via the database?
olesen is offline   Reply With Quote

Reply

Tags
volscalarfield;scalar


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
Error message Bruno_Jorge Main CFD Forum 1 February 5, 2019 12:12
namespace Foam Argen OpenFOAM 4 February 5, 2019 09:55
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 07:16
How do I access a volScalarField in a submodel of the class radiationModel? tos OpenFOAM Programming & Development 0 July 9, 2013 07:05
Access a volScalarField from BC code Hisham OpenFOAM Programming & Development 6 November 25, 2011 16:33


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