|
[Sponsors] |
implementing dictionary and using values therefrom |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 7, 2011, 13:15 |
implementing dictionary and using values therefrom
|
#1 |
Senior Member
|
Hello All,
I would like to implement an additional computation into some solvers. Basically, an additional action should be taken if a certain testvalue has been passed. Basically it works, but only with the threshold value hardcoded within the code. In order to avoid recompiling the specific solver every time the threshold value is changed, I would like to make a dictionary file such as the "transportProperties" residing in the constant-folder. How can I get the values inside such files into my solver for comparison reason? For example it works to write: if (p[celli] > scalar(12)) { action that is desired; } What do I have to write instead of "scalar(12)" for the routine to take over the value "testvalue" from the dictionary? What I have working by now (in simplefied form) are following entries: Within the solver I have: Code:
forAll(mesh.cells(),celli) { if (p[celli] > scalar(12)) {action1;} else {action2;} } Code:
IOdictionary dictionaryName ( IOobject ( "dictionaryName", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionedScalar testvalue(dictionaryName.lookup("testvalue")); As I said: The first snippet works fine, the second complains if there is no file "dictionaryName" within the constant-folder and is fine if that is there. But all my tries in taking over a value from the dictionary-file failed so far. Compilation is fine, though... |
|
|
|