|
[Sponsors] |
September 28, 2010, 16:22 |
writing controlDict as otherfields
|
#1 |
New Member
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17 |
Hello Everybody,
I am trying to first read controlDict and then want to do some changes. After doing changes I am interested to write this controlDict back into system folder of my case. What I am doing are the following steps: I declared a dictionary first of all as.. IOdictionary m_controlDict(IOobject("controlDict", runTime.system(),mesh,IOobject::MUST_READ,IOobject ::AUTO_WRITE)); m_controlDict.set("endTime",50); runTime.write(); I think all the files should be written in their respective folders by using runTime.write(). But still I am not getting new controlDict file. I am sure that the value of endTime has been changed to 500 but I want to write it back to controlDict file. I have also seen another function called as write(Ostream,bool) as a member function of dictionary, but I am not getting how can I get Ostream of controlDict. Please guide me, how can I proceed with my case. Thanks a lot in advance. |
|
September 29, 2010, 06:48 |
|
#2 |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
runTime.write() will only write the changes at every writeInterval (within controlDict).
You can use controlDict.write(); to write to the file at any point within a simulation. write(Ostream,bool) is no longer a member function of dictionary because IOdictionary was also inheriting write() from regIOobject. It is now writeData(Ostream,bool). You can try it using writeData(Info); and it will write the file to screen.
__________________
Laurence R. McGlashan :: Website |
|
September 29, 2010, 07:54 |
|
#3 |
New Member
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17 |
Thanks a lot for the reply.
I tried to use controlDict.write(), but I get always error, probably, I am not selecting accurate arguments. I did like below: controlDict.write(IOstream::ASCII,IOstream::versio nNumber(2.0),IOstream::UNCOMPRESSED); but i get following error.. candidates are void Foam::regIOobject::write(Foam::Ostream&,bool)const . Can you please guide me, what I have to write inside these arguments. For the time being I am using runTime.writeNow(); but its not good because it writes all the files at that time, I just have to write specific files. Best Regards, |
|
September 29, 2010, 08:16 |
|
#5 | |
New Member
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17 |
Quote:
But it works now, I did as you say... I used "controlDict.Foam::regIOobject::write(); " and now it works really good. If you dont mind, can you please tell me why it works by controlDict.Foam::regIOobject::write() and not by simple controlDict.write(). Thanks a lot for all this help... |
||
Tags |
controldict, dictionary, ostream |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
solid to fluid heattransfer with chtMultiRegionFoam | nakor | OpenFOAM | 11 | March 21, 2011 09:28 |
Erratic disk writing | johndeas | OpenFOAM | 1 | February 5, 2010 06:37 |
An error has occurred when Writing backup file | tian | CFX | 0 | June 28, 2007 22:29 |
journal file command for writing mass flow rate | James | FLUENT | 0 | July 26, 2006 11:51 |
Fatal error error writing to tmp No space left on device | maka | OpenFOAM Installation | 2 | April 3, 2006 09:48 |