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

Write field data at a few specific timesteps

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

Like Tree1Likes
  • 1 Post By gary7

Reply
 
LinkBack Thread Tools Display Modes
Old   January 9, 2014, 17:45
Default Write field data at a few specific timesteps
  #1
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 8
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 01:43.
gary7 is offline   Reply With Quote

Old   October 21, 2016, 07:51
Default
  #2
Senior Member
 
Join Date: Mar 2015
Posts: 224
Rep Power: 4
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: 8
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: 224
Rep Power: 4
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: 8
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 likes this.
gary7 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
Problem in sampling data of custom field function in ANSYS FLUENT v14 apek_great ANSYS 1 February 26, 2014 06:10
2 datas on one plot Akuji ParaView 46 December 1, 2013 15: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 05: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 11:15.