CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

writing controlDict as otherfields

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ubaid

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 28, 2010, 15:22
Default writing controlDict as otherfields
  #1
New Member
 
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17
ubaid is on a distinguished road
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.
mm.abdollahzadeh likes this.
ubaid is offline   Reply With Quote

Old   September 29, 2010, 05:48
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
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
l_r_mcglashan is offline   Reply With Quote

Old   September 29, 2010, 06:54
Default
  #3
New Member
 
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17
ubaid is on a distinguished road
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,
ubaid is offline   Reply With Quote

Old   September 29, 2010, 06:57
Default
  #4
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Have you got the latest version of OF-1.7.x?

Try controlDict.Foam::regIOobject::write(); if you haven't.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   September 29, 2010, 07:16
Default
  #5
New Member
 
Nadeem
Join Date: Mar 2009
Location: München, Bavarian, Deutschland
Posts: 24
Rep Power: 17
ubaid is on a distinguished road
Quote:
Originally Posted by l_r_mcglashan View Post
Have you got the latest version of OF-1.7.x?

Try controlDict.Foam::regIOobject::write(); if you haven't.
I think so I am using old version of 1.7.

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...
ubaid is offline   Reply With Quote

Old   September 29, 2010, 07:28
Default
  #6
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
See http://www.openfoam.com/mantisbt/view.php?id=34
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Reply

Tags
controldict, dictionary, ostream


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
solid to fluid heattransfer with chtMultiRegionFoam nakor OpenFOAM 11 March 21, 2011 08:28
Erratic disk writing johndeas OpenFOAM 1 February 5, 2010 05:37
An error has occurred when Writing backup file tian CFX 0 June 28, 2007 21:29
journal file command for writing mass flow rate James FLUENT 0 July 26, 2006 10:51
Fatal error error writing to tmp No space left on device maka OpenFOAM Installation 2 April 3, 2006 08:48


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