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

Write field data at a few specific timesteps

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

Like Tree2Likes
  • 2 Post By gary7

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2014, 16:45
Default Write field data at a few specific timesteps
  #1
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 15
gary7 is on a distinguished road
Hi All,

Is it possible to control the writing of the filed data happens at some specific timesteps which are not necessarily a multiple of "writingInterval"? Let's say I want the data to be written only at timesteps = 10, 17, 43 and 71. Right now I have to write data out every timestep in order to obtain field at these timesteps.

How can I write data only at the mentioned timesteps?

Cheers,
Kasra.

Last edited by gary7; January 10, 2014 at 00:43.
gary7 is offline   Reply With Quote

Old   October 21, 2016, 07:51
Default
  #2
Senior Member
 
Join Date: Mar 2015
Posts: 250
Rep Power: 12
KateEisenhower is on a distinguished road
Hi Kasra,

have you found any answer to this question? Of course one could write a shell-script which reads the OpenFOAM output and changes the controlDict at the appropriate time, but that isn't very elegant.

Best regards,

Kate
KateEisenhower is offline   Reply With Quote

Old   October 21, 2016, 13:40
Default
  #3
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 15
gary7 is on a distinguished road
Hi Kate,

I used a quick hack to do it. It is not the best way to do it but it does the job:

Code:
if
(
   mag(runTime.value() - runTime.deltaT().value() * 10) < SMALL
)
{
    runTime.writeNow();
}
This will write out the results at 10th timestep.

Cheers,
Kasra.
gary7 is offline   Reply With Quote

Old   October 24, 2016, 06:12
Default
  #4
Senior Member
 
Join Date: Mar 2015
Posts: 250
Rep Power: 12
KateEisenhower is on a distinguished road
Hi Kasra,

thanks for your response. This works only for a fixed timestep, right?

Kate
KateEisenhower is offline   Reply With Quote

Old   October 24, 2016, 16:42
Default
  #5
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 15
gary7 is on a distinguished road
That's right. You can write the results at specific timesteps, you can add more timesteps using "or" (||) operator. However, the clean and robust way of doing it is defining an IOdictionary and list the required timesteps in there and use those instead of hard coding the timesteps right into the code.
KateEisenhower and reza.saghi like this.
gary7 is offline   Reply With Quote

Old   March 11, 2020, 12:31
Default
  #6
New Member
 
Mark
Join Date: Oct 2018
Posts: 18
Rep Power: 7
Brandani is on a distinguished road
Hi! Do you happen to know how to use the IO dictionary to make your simulation write out user-specified times?
Brandani is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in sampling data of custom field function in ANSYS FLUENT v14 apek_great ANSYS 1 February 26, 2014 05:10
[General] 2 datas on one plot Akuji ParaView 46 December 1, 2013 14:06
Indentify internal field value at specific patch Giancarlo_IngChimico OpenFOAM Programming & Development 6 April 16, 2013 12:29
User field function for specific heat deifnition crevoise STAR-CCM+ 2 January 28, 2013 04:25
Access raw field data (scalars, vectors) on mesh haakon OpenFOAM Programming & Development 3 September 25, 2012 10:01


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