|
[Sponsors] |
April 9, 2011, 15:05 |
Dictionary Updating
|
#1 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Hello all,
Just a quick question. If I have created a dictionary as an IOdictionary, how do I go about changing the entries in a solver and then writing the updated entries to the original file. I'm currently trying dict.subDict().set(keyword,value), which compiles but doesn't update. It seems like I should use a dict.write() function, but the compiler says the call is ambiguous. Thanks in advance! |
|
April 11, 2011, 14:37 |
|
#3 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Using 1.6 to maintain compatibility with some external packages. So for the full namespace, that would be the Foam::IOobject etc. version of the call?
I figured out an alternative way, and that was to set WRITE_OPTIONS parameter to MUST_WRITE, in which case the dictionary gets updated every time runTime.write() gets called. As a little background, I am logging the values of a few variables at locations on the boundary of a moving mesh. I want to specify approximate locations in a dictionary, after which I do a search for the faces whose centroid is closest to the points I've specified (at the start of the run). Since I may need to restart the solver at a later time, I need the dictionary to be updated periodically. So, in short, the new IOdictionary is declared: Code:
IOdictionary updatedDict ( IOobject ( "updatedDict", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE, true ) ); |
|
April 11, 2011, 15:06 |
|
#5 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Good to know, we may be migrating in the near future if we can figure the compatibility. Thanks!
|
|
June 29, 2011, 20:54 |
|
#7 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
I did this on OF 1.6 with no problems. You may need to explicitly specify the subDict you are updating, as the subDict member function takes the name of the sub-dictionary as its argument.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
writing subDict in a dictionary | ubaid | OpenFOAM Programming & Development | 3 | October 25, 2014 18:17 |
Some questions about mesh updating in dynamic mesh technique | lzgwhy | Main CFD Forum | 0 | June 14, 2009 09:01 |
Reading from User Defined Dictionary File | brosemu | OpenFOAM Running, Solving & CFD | 2 | March 30, 2009 16:25 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |
FoamX error aachenBomb case | Ervin Adorean (Adorean) | OpenFOAM Pre-Processing | 13 | March 7, 2005 04:50 |