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

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

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 5, 2015, 07:41
Default Error when <dictionary>.lookup("variable"). OpenFOAM 1.6-ext
  #1
New Member
 
Malthe Eisum
Join Date: Nov 2015
Location: Copenhagen, Denmark
Posts: 5
Rep Power: 3
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
Master student Technical University of Denmark
Malthe Eisum is offline   Reply With Quote

Old   December 5, 2015, 07:59
Default Found my own answer
  #2
New Member
 
Malthe Eisum
Join Date: Nov 2015
Location: Copenhagen, Denmark
Posts: 5
Rep Power: 3
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
__________________
Malthe Eisum
Master student Technical University of Denmark
Malthe Eisum is offline   Reply With Quote

Reply

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

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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 6 September 18, 2016 16:23
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13: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 10:51.