|
[Sponsors] |
May 9, 2019, 04:49 |
Write data at specific times, not intervals
|
#1 |
Member
Martin
Join Date: Aug 2018
Posts: 33
Rep Power: 8 |
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; Code:
endTime 4000; deltaT 1; writeControl timeStep; writeInterval 10; purgeWrite 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); |
|
May 13, 2019, 02:37 |
|
#2 |
Member
W.T
Join Date: Oct 2012
Posts: 35
Rep Power: 14 |
You can use systemCall function object and second controlDictfile
For eg. controlDict Code:
endTime 4000; deltaT 1; writeControl timeStep; writeInterval 3970; Code:
endTime 4000; deltaT 1; writeControl timeStep; writeInterval 10; and in systemCall function object setup Code:
writeCalls ( "cp system/newControlDict system/controlDict" ); |
|
May 16, 2019, 06:25 |
|
#3 | |
Member
Martin
Join Date: Aug 2018
Posts: 33
Rep Power: 8 |
Quote:
|
||
September 7, 2019, 06:48 |
|
#4 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
Have you added the library to the run?
Code:
functionObjectLibs ( "libsystemCall.so" ); Actually, you also need this lib: Code:
libs ( "libutilityFunctionObjects.so" ); |
|
April 25, 2020, 05:27 |
|
#5 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
I'll just post the solution I've found just in case someone is interested: I used OF1912 and there you have the function object timeActivatedFileUpdate. Where you basically can update a given file to a specific time step. So each time one wants a different timestep to written the fields out one can update the control dict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1912 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application rhoPimpleFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 0.26; deltaT 2e-6; adjustTimeStep yes; maxCo 3.0; writeControl adjustable; #include "writeInterval" //writeInterval 0.01; purgeWrite 0; writeFormat ascii; writePrecision 8; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; functions { #includeFunc MachNo #includeFunc residuals fileUpdate1 { type timeActivatedFileUpdate; libs ("libutilityFunctionObjects.so"); writeControl timeStep; writeInterval 1; fileToUpdate "<system>/writeInterval"; timeVsFile ( (-1 "<system>/writeInterval.00") (0.002 "<system>/writeInterval.01") (0.005 "<system>/writeInterval.02") (0.011 "<system>/writeInterval.03") (0.022 "<system>/writeInterval.04") (0.028 "<system>/writeInterval.05") (0.08 "<system>/writeInterval.06") (0.09 "<system>/writeInterval.07") (0.1 "<system>/writeInterval.08") (0.11 "<system>/writeInterval.09") (0.153 "<system>/writeInterval.10") (0.16 "<system>/writeInterval.11") (0.17 "<system>/writeInterval.12") (0.18 "<system>/writeInterval.13") (0.23 "<system>/writeInterval.14") (0.24 "<system>/writeInterval.15") (0.25 "<system>/writeInterval.16") ); } } The files writeInterval contain the desired time step, e.g. /writeInterval.16 contains the entry: writeInterval 0.252614931093667; In this way I could achieve that the fields are written out at irregular time steps. |
|
November 11, 2020, 00:02 |
|
#6 |
Member
Stanley John
Join Date: Sep 2018
Posts: 79
Rep Power: 8 |
Hi can you post your writeinterval file?
is it valid for foundation version? |
|
November 11, 2020, 04:51 |
|
#7 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
I don't know if it is valid for the foundation version. The file contains simply the entries
Code:
writeInterval 0.252614931093667; |
|
November 13, 2020, 03:30 |
Write data as needed in controlDict, of6
|
#8 | |
New Member
Duc Anh
Join Date: Dec 2018
Posts: 22
Rep Power: 7 |
Quote:
I want to write data only at the 3 final steps (98 99 100) Thank dybuk for your interesting answers, but when I use systemCall as you said. However, nothing happens. Anybody can help me? This is controlDict Code:
startFrom startTime; startTime 0; stopAt endTime; endTime 0.0001;//0.007; //0.00052;//0.002; //1 first 0.00052; deltaT 0.000001; //0.0000005; writeControl timeStep;//adjustableRunTime;// writeInterval 96; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; adjustTimeStep no; maxCo 0.9; maxDeltaT 0.1; writeCalls ( "cp system/newControlDict system/controlDict" ); Code:
startFrom startTime; startTime 0; stopAt endTime; endTime 0.0001;// 0.007; //0.00052;//0.002; //1 first 0.00052; deltaT 0.000001; //0.0000005; writeControl timeStep;//adjustableRunTime;// writeInterval 1; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; adjustTimeStep no; maxCo 0.9; maxDeltaT 0.1; libs ( "libutilityFunctionObjects.so" ); |
||
Tags |
data output, specific timesteps, writecontrol, writeinterval |
|
|
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 04:14 |
How to extract data from a specific layer of the grids? | ripperjack | OpenFOAM Post-Processing | 1 | October 29, 2014 09:57 |
error message | cuteapathy | CFX | 14 | March 20, 2012 07:45 |
How to extract data of specific variable from PHI and Q1 file? | mukut | Phoenics | 3 | October 17, 2011 07:13 |
Constant velocity of the material | Sas | CFX | 15 | July 13, 2010 09:56 |