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

Reading in Pressure Values from OpenFOAM code?

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

Like Tree1Likes
  • 1 Post By hk318i

Reply
 
LinkBack Thread Tools Display Modes
Old   August 4, 2016, 11:48
Default Reading in Pressure Values from OpenFOAM code?
  #1
New Member
 
Dominic
Join Date: May 2016
Posts: 27
Rep Power: 2
Verse is on a distinguished road
Hello, I've run into the problem of accessing my pressure values, from within my code during runtime.

I've been using the following syntax:

Code:
const volScalarField & p = mesh.lookupObject<volScalarField>("p");
and yet after compiling successfully, I get this error during runtime:

Code:
Name: 
p


--> FOAM FATAL ERROR: 

    request for volScalarField p from objectRegistry region0 failed
    available objects of type volScalarField are

0
(
)


    From function objectRegistry::lookupObject<Type>(const word&) const
    in file /home/verse/foam/foam-extend-3.1/src/foam/lnInclude/objectRegistryTemplates.C at line 139.

FOAM aborting

Aborted (core dumped)
Any idea what's wrong? I'm using foam-extend 3.1
Verse is offline   Reply With Quote

Old   August 5, 2016, 12:35
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: UK
Posts: 231
Rep Power: 10
hk318i is on a distinguished road
It means that there is no volScalarField available in the database which means that your code is trying to access it before it is created by the solver. You may included your code before createFields.
Verse likes this.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Old   August 8, 2016, 08:31
Default
  #3
New Member
 
Dominic
Join Date: May 2016
Posts: 27
Rep Power: 2
Verse is on a distinguished road
That is indeed correct.... I realized that I commetted out that line in the beginning of my code...
Verse is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to call 'p' as pressure into my code from OpenFOAM? atmcfd OpenFOAM Programming & Development 9 March 25, 2016 18:13
static vs. total pressure auf dem feld FLUENT 17 February 26, 2016 14:04
chtmultiregionsimplefoam: different pressure values in openFoam and Fluent vasava OpenFOAM Running, Solving & CFD 0 November 7, 2014 04:35
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 10:04
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 06:13


All times are GMT -4. The time now is 18:26.