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

Error when <dictionary>.lookup("variable"). OpenFOAM 1.6-ext

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

Like Tree1Likes
  • 1 Post By Malthe Eisum

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 5, 2015, 07:41
Default Error when <dictionary>.lookup("variable"). OpenFOAM 1.6-ext
  #1
New Member
 
Malthe V. Eisum
Join Date: Nov 2015
Location: Nibe, Denmark
Posts: 5
Rep Power: 10
Malthe Eisum is on a distinguished road
I'm making my owen solver from icoFoam, where I add a body force B = U0m*(2*pi/period)*cos((2*pi/period)*t).
Where the period and free stream velocity (U0m) is to be loaded fra a dictionary. I think I have figured out the syntax from looking in "createFields.H" to keep it simple I started with the assumption that the variables was gonna be placed in "transportProperties".

Code:
IOdictionary transportProperties
(
    IOobject
    (
        "transportProperties",
         runTime.constant(),
         mesh,
         IOobject::MUST_READ,
         IOobject::NO_WRITE
    )
);

scalar period(transportProperties.lookup("period"));
scalar U0m(transportProperties.lookup("U0m"));
added the last two lines, but when I try to make the solver i get the following error:
Code:
createFields.H: In function 'int main(int, char**)':
createFields.H:20: error: cannot convert 'Foam::ITstream' to 'Foam::scalar' 
createFields.H:21: error: cannot convert 'Foam::ITstream' to 'Foam::scalar' in initialization
Additional questions
  1. What is good practice, shall I add min variables (period,U0m) in the transportPorperties or make an additional dictionary?
  2. I need the variables to be of class scalar, what is the syntax in the dictionary? is it as that of an dimensionedScalar omitting the dimension array:
    Code:
    period     period 9.72;
__________________
Malthe Eisum
Malthe Eisum is offline   Reply With Quote

Old   December 5, 2015, 07:59
Default Found my own answer
  #2
New Member
 
Malthe V. Eisum
Join Date: Nov 2015
Location: Nibe, Denmark
Posts: 5
Rep Power: 10
Malthe Eisum is on a distinguished road
Have spend 48 hours searching for an answer for my problems and the 15 min after posting my thread I find my own answer.

http://www.cfd-online.com/Forums/ope...nt-solver.html
tonnykz likes this.
__________________
Malthe Eisum
Malthe Eisum is offline   Reply With Quote

Reply

Tags
.lookup(""), openfoam 1.6-ext

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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 06:29
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 14:36
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 10:04
Test directory missing in OpenFOAM 1.6 ext andrewryan OpenFOAM 2 March 20, 2011 16:41
Openfoam 1.6 ar_mofidi OpenFOAM 1 November 4, 2009 06:26


All times are GMT -4. The time now is 12:00.