CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Reading from User Defined Dictionary File (http://www.cfd-online.com/Forums/openfoam-solving/63117-reading-user-defined-dictionary-file.html)

brosemu March 29, 2009 16:52

Reading from User Defined Dictionary File
 
Hi,

I'm putting together a new solver and need to input some additional parameters for the set up of the problem. I thought it best to do this through the use of a user-defined dictionary file, call it userDict (located in the system folder). I've been through dictionary.H, dictionary.C, dictionaryIO.C to try to figure out how to use the class but am a bit lost in some of the more complex programming aspects. I also went through Time.H, Time.C, and TimeIO.C to try to figure out how controlDict is read from and that was a bit helpful. I believe that I have figured out to use the dictionary (or IOdictionary?) class once I have successfully declared an instance of it, that is where I am stuck.

So right now in my readUserControls.H file I have:

IOdictionary userDict_(IOobject("userDict",system(),IOobject::M UST_READ,IOobject::NO_WRITE,false));

int lowFn = 0;
if (userDict_.found("startFromFn"))
{
lowFn = readInt(userDict_.lookup("startFromFn"));
}

int highFn = 1;
if (userDict_.found("stopAtFn"))
{
highFn = readInt(userDict_.lookup("stopAtFn"));
}

and when I try to compile the solver it errors on the IOdictionary declaration saying that there is "no matching funcion call," basically that there is no IOobject class constructor which has arguments that match the ones that I am trying to give it. All I need help with is figuring out how to successfully declare the dictionary object. Any help?

thanks!
Bill

philippose March 29, 2009 17:10

Hello Bill,

A Good Evening to you!

I had implemented a solver about 6 months ago, which used a user-defined dictionary file for the parameters specific to the solver.... have a look at the following post:

http://www.cfd-online.com/Forums/ope...chanics-3.html

If you scroll down to the last third of the page, you will see a set of solvers (turbForceFoam and simpleForceFoam), along with the associated dictionary (forceFoamDict)....

Maybe this will be of help to you...

If you need any more help, let me know :-)!

Have a nice day!!

Philippose

brosemu March 30, 2009 15:25

Thanks for the help!

I'm all set for now.


All times are GMT -4. The time now is 17:50.