CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Edit controlDict at runtime

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 18, 2014, 12:50
Default Edit controlDict at runtime
  #1
New Member
 
Join Date: Sep 2013
Posts: 8
Rep Power: 3
menonshyam is on a distinguished road
Hello all,

I am trying to edit fields in the controlDict file during the course of my simulation. The code below works just fine if i run my application on a single core but if i use multiple cores through mpirun, I am unable to get the field to update. Any ideas on this!?

IOdictionary controlDict(IOobject("controlDict", runTime.system(),mesh,IOobject::MUST_READ,IOobject ::AUTO_WRITE));
controlDict.set("endTime",50);
controlDict.Foam::regIOobject::write();

Thanks!
menonshyam is offline   Reply With Quote

Old   June 18, 2014, 13:04
Default RE:
  #2
New Member
 
Join Date: Sep 2013
Posts: 8
Rep Power: 3
menonshyam is on a distinguished road
Actually this does work..seems like there was some issue in decomposePar but the code works!
menonshyam is offline   Reply With Quote

Old   July 15, 2014, 19:55
Default Trouble with editing controldict in parallel run
  #3
New Member
 
Join Date: Sep 2013
Posts: 8
Rep Power: 3
menonshyam is on a distinguished road
Hello,

So i am still having trouble getting a parallel run to stop based on a condition in the code by editing the control dict file. This is what i have right now:

If condition {
controlDict.set("stopAt","noWriteNow");
controlDict.Foam::regIOobject::write();
}

However when i decompose and run this code on multiple processors, in the processors where this condition is satisfied, a new 'system' folder is created with the updated controlDict as per the code. But the remaining processors and the job itself still appear to keep on running. How do i fix this so that the job ends on all the processors!?

Thanks!
menonshyam is offline   Reply With Quote

Old   July 16, 2014, 04:14
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,132
Rep Power: 20
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

it depends.

If you need to stop simulation when criterion is satisfied on every processor, then you can use reduce operation (http://foam.sourceforge.net/docs/cpp/a07342.html) with 'and' binary operation. So criterion is true only when it is true on every processor.

If you need to stop simulation when criterion is satisfied on any processor, then you can use scatter operation (http://foam.sourceforge.net/docs/cpp/a01997.html) to notify every processor that it's time to stop.
alexeym is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Probes/Sensors in runtime gabitinho OpenFOAM Post-Processing 9 August 14, 2015 12:55
Problem in3D model processing mebinitap OpenFOAM 2 December 12, 2014 05:40
Laptop for CFD - recommendation Far Hardware 20 May 31, 2012 17:01
writing controlDict as otherfields ubaid OpenFOAM 5 September 29, 2010 07:28
ParaView Compilation jakaranda OpenFOAM Installation 3 October 27, 2008 12:46


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