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

Restarting simulations in openfoam with updated boundary conditions

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

Like Tree3Likes
  • 1 Post By maheshraj
  • 2 Post By julien.decharentenay

Reply
 
LinkBack Thread Tools Display Modes
Old   March 11, 2013, 07:24
Default Restarting simulations in openfoam with updated boundary conditions
  #1
New Member
 
Mahesh
Join Date: Dec 2010
Posts: 9
Rep Power: 6
maheshraj is on a distinguished road
Hi All,

Suppose I have run a simulation to 2000 iterations with a set of BC's and want to run another 2000 iterations with changed BC's or a new mass flow rate.
The iteration should start from 2001 and should use the flow field already developed.
Could you let me know how to do this?

Thanks,
Mahesh
Arthas likes this.
maheshraj is offline   Reply With Quote

Old   March 11, 2013, 10:48
Default
  #2
Senior Member
 
sail's Avatar
 
Vieri Abolaffio
Join Date: Jul 2010
Location: Always on the move.
Posts: 308
Rep Power: 7
sail is on a distinguished road
any reason why you can't simply edit the approriate file (U, p, etc...) in the 2000 directory?
__________________
http://www.leadingedge.it/
Naval architecture and CFD consultancy
sail is offline   Reply With Quote

Old   March 12, 2013, 12:18
Default
  #3
New Member
 
Mahesh
Join Date: Dec 2010
Posts: 9
Rep Power: 6
maheshraj is on a distinguished road
U or any file at 2000th iteration is a binary file and will contain the values at each node. So it is not possble to edit these files.

Last edited by maheshraj; March 13, 2013 at 09:08.
maheshraj is offline   Reply With Quote

Old   March 13, 2013, 19:39
Default
  #4
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 229
Rep Power: 9
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
I think you can do it using the changeDictionary utility.
__________________
---
Julien de Charentenay
julien.decharentenay is offline   Reply With Quote

Old   March 14, 2013, 03:45
Default
  #5
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Posts: 233
Rep Power: 7
Phicau is on a distinguished road
Quote:
Originally Posted by maheshraj View Post
U or any file at 2000th iteration is a binary file and will contain the values at each node. So it is not possible to edit these files.
Yes you can, not directly, but it takes 3 steps.

Clone your constant and system folders, along with your 2000 folder.
Then change writeFormat on controlDict from binary to ascii.
Finally run foamFormatConvert.

Then you can change whatever you want. If you proceed in the inverse way you will end up with your new case in binary format again.
Phicau is offline   Reply With Quote

Old   March 14, 2013, 13:05
Default
  #6
Senior Member
 
sail's Avatar
 
Vieri Abolaffio
Join Date: Jul 2010
Location: Always on the move.
Posts: 308
Rep Power: 7
sail is on a distinguished road
Quote:
Originally Posted by maheshraj View Post
U or any file at 2000th iteration is a binary file and will contain the values at each node. So it is not possble to edit these files.
sorry, i usually keep my writeFormat in ascii, mor ease of modification and readability.
__________________
http://www.leadingedge.it/
Naval architecture and CFD consultancy
sail is offline   Reply With Quote

Old   March 14, 2013, 14:36
Default
  #7
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 725
Rep Power: 18
mturcios777 will become famous soon enough
I would use mapFields have the target mesh equipped with new boundary conditions (and specified at cutting patches)
mturcios777 is offline   Reply With Quote

Old   January 24, 2014, 10:04
Default
  #8
Member
 
Tobias Adam
Join Date: Oct 2013
Location: Siegen
Posts: 55
Rep Power: 3
Tobias Adam is on a distinguished road
can anyone show me an example for the Mapfieldsdict?
I don know how to create this properly.
When I map the fields, I always get the old boundary conditions of the source case.

best regards Tobi
Tobias Adam is offline   Reply With Quote

Old   January 25, 2014, 01:44
Default
  #9
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 229
Rep Power: 9
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
Hi Tobi,

You may want to use the -sourceRegion/-targetRegion options of mapFields, which may be able to limit itself to the internalField (untested, and I would love to hear if it works).

But, as mentioned previously you may as well just modify the boundary conditions in the file 2000. My understanding from reading the file is that parts of it are binary but not all and you are likely to be able to edit the boundary condition definition. Below is an extract of one of my file:

Code:
LT w@M%ޓ/0|E-̡@K'2Un~;vNLrgk	@^)
3rINwȔ@(<V^M&#B|-@y{Jj\
X@N<9&m);

boundaryField
{
    minX
    {
        type            zeroGradient;
    }
    maxX
    {
        type            zeroGradient;
    }
There is some binary for the fields values, but the boundary conditions are in plain text...
Tobias Adam and RjwV like this.
__________________
---
Julien de Charentenay
julien.decharentenay is offline   Reply With Quote

Old   January 26, 2014, 14:50
Default
  #10
New Member
 
Ripudaman Manchanda
Join Date: May 2013
Posts: 29
Rep Power: 4
ripudaman is on a distinguished road
Does anyone have any idea how to automatize this?

Say I have to run 5 such instances successively where I change the boundary conditions 5 times.

Adding to the complexity, the number of time steps the solution will require to converge will be different for each case (I have modified my solver file to incorporate that). Is there anyway I could access the latestTime from outside Openfoam?
ripudaman is offline   Reply With Quote

Old   January 28, 2014, 07:38
Default
  #11
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 229
Rep Power: 9
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
It depends on your preferred environment, script and/or programming language.

Do recover the latest time, you can just loop through the directories that are numerical values and select the highest one. It should be the latest one. This is a way to do it in ruby (Note: it assumes that time directories are integer, not float. In other words, it works for steady-state simulations):

Code:
times = []
Dir.foreach(".") { |f|
 times.push(f.to_f) if ((File.directory?(f)) and (f =~ /\d+/))
}
latestTime = times.max()
__________________
---
Julien de Charentenay

Last edited by julien.decharentenay; January 28, 2014 at 07:38. Reason: Add ")" to code expression
julien.decharentenay 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
exporting boundary conditions with pointwise -> openFoam ebah6 OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 September 16, 2012 16:57
CFX13 Post Periodic interface EtaEta CFX 7 December 8, 2011 18:15
OpenFOAM class to represent initial boundary conditions sanatan OpenFOAM Programming & Development 1 March 20, 2011 10:16
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 6 April 17, 2010 23:40
Please help with flow around car modelling! Tudor Miron CFX 17 March 19, 2004 20:23


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