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

Write data at specific times, not intervals

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

Like Tree2Likes
  • 2 Post By dybuk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2019, 03:49
Default Write data at specific times, not intervals
  #1
Member
 
Martin
Join Date: Aug 2018
Posts: 31
Rep Power: 3
artymk4 is on a distinguished road
Is it possible to write data at specified times (timesteps) instead of fixed intervals?
I want to output data multiple times only at the end of simulation. If I wanted to write data only at the very last time step, I could do this:
Code:
endTime         4000;
deltaT          1;
writeControl    timeStep;
writeInterval   4000;
But I want to write data at time steps 3970, 3980, 3990, 4000. I know I could do this with purgeWrite:
Code:
endTime         4000;
deltaT          1;
writeControl    timeStep;
writeInterval   10;
purgeWrite      4;
But this way my simulation would take much more time because of useless writing every 10 time steps from the beginning (400 times instead of 4).


There's another option, to end simulation at time 3970 with writeInterval 3970 so I get only one output. And then starting simulation again from latest time with writeInterval 10 and endTime 4000. But this is not ideal because it's not automatic, I need to change controlDict during simulation.
My solution would be this:
Code:
endTime         4000;
deltaT          1;
writeControl    timeStep;
writeInterval   (3970 3980 3990 4000);
but it's not working because writeInterval needs to be scalar. Maybe this can be suggestion for next update. Or can I modify OpenFOAM so it will accept more values, not only one interval. But I have no idea how to do that.
artymk4 is offline   Reply With Quote

Old   May 13, 2019, 01:37
Default
  #2
Member
 
W.T
Join Date: Oct 2012
Posts: 31
Rep Power: 8
dybuk is on a distinguished road
You can use systemCall function object and second controlDictfile

For eg.
controlDict

Code:
endTime         4000;
deltaT          1;
writeControl    timeStep;
writeInterval   3970;
newControlDict
Code:
endTime         4000;
deltaT          1;
writeControl    timeStep;
writeInterval   10;

and in systemCall function object setup

Code:
writeCalls
        (
            "cp system/newControlDict system/controlDict"
        );
In time step 3970 you will save the result and change the write interval to 10 so you will end with saved time step 3970 3980 3990 4000
Daniel_Khazaei and artymk4 like this.
dybuk is offline   Reply With Quote

Old   May 16, 2019, 05:25
Default
  #3
Member
 
Martin
Join Date: Aug 2018
Posts: 31
Rep Power: 3
artymk4 is on a distinguished road
Quote:
Originally Posted by dybuk View Post
You can use systemCall function object and second controlDictfile

For eg.
controlDict

Code:
endTime         4000;
deltaT          1;
writeControl    timeStep;
writeInterval   3970;
newControlDict
Code:
endTime         4000;
deltaT          1;
writeControl    timeStep;
writeInterval   10;
and in systemCall function object setup

Code:
writeCalls
        (
            "cp system/newControlDict system/controlDict"
        );
In time step 3970 you will save the result and change the write interval to 10 so you will end with saved time step 3970 3980 3990 4000
Thanks, I didn't know about function systemCall. However I'm using foam-extend-4.0 which lacks this function. I got error Unknown function type systemCall
artymk4 is offline   Reply With Quote

Old   September 7, 2019, 05:48
Default
  #4
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 523
Rep Power: 15
jherb is on a distinguished road
Have you added the library to the run?
Code:
functionObjectLibs ( "libsystemCall.so" );
See: https://openfoamwiki.net/index.php/T...ect_systemCall


Actually, you also need this lib:
Code:
libs ( "libutilityFunctionObjects.so" );
jherb is offline   Reply With Quote

Reply

Tags
data output, specific timesteps, writecontrol, writeinterval

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFX ERROR : unable to write the requested IO string array data set. HJH CFX 3 March 18, 2016 03:14
How to extract data from a specific layer of the grids? ripperjack OpenFOAM Post-Processing 1 October 29, 2014 08:57
error message cuteapathy CFX 14 March 20, 2012 06:45
How to extract data of specific variable from PHI and Q1 file? mukut Phoenics 3 October 17, 2011 06:13
Constant velocity of the material Sas CFX 15 July 13, 2010 08:56


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