|
[Sponsors] |
How to get the current time within the controlDict? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 4, 2014, 13:53 |
How to get the current time within the controlDict?
|
#1 |
New Member
duan
Join Date: Apr 2014
Posts: 6
Rep Power: 12 |
Hi,
I am trying to set different writeTimeInterval rather than a constant one during the runTime. for example: if (currentRunTime<t0) writeTimeInterval=value0; else writeTimeInterval=value1; Now I have problems on how to get current time within the controlDict. Here is my code: Code:
writeInterval #codeStream { code #{ /*// the sample works scalar start = readScalar(dict.lookup("startTime")); scalar end = readScalar(dict.lookup("endTime")); label nDumps = 5; os << ((end - start)/nDumps);*/ //================================================== //how to get the current time within controlDic??? //Tried but Not work //scalar t=this->db().time().value(); //error: invalid use of ‘this’ in non-member function //scalar t = runTime().value() ; //error: ‘runTime’ was not declared in this scope //scalar t = timeDirs.last().value(); //error: ‘timeDirs’ was not declared in this scope //scalar t = time().value(); //error: too few arguments to function ‘time_t time(time_t*) label t0 = 0.4; if (t <= t0) { os << 0.05; } else { os << 0.02; } #}; }; http://www.cfd-online.com/Forums/ope...ntroldict.html http://www.openfoam.org/version2.0.0...me-control.php http://www.cfd-online.com/Forums/ope...me-scalar.html Thanks in advance. |
|
Tags |
controldict, current run time, write control |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Current density visualisation (PEM fuel cell add-on module) | pchoopanya | FLUENT | 10 | August 21, 2023 14:33 |
Multiple floating objects | CKH | OpenFOAM Running, Solving & CFD | 14 | February 20, 2019 09:08 |
Superlinear speedup in OpenFOAM 13 | msrinath80 | OpenFOAM Running, Solving & CFD | 18 | March 3, 2015 05:36 |
pisoFoam with k-epsilon turb blows up - Some questions | Heroic | OpenFOAM Running, Solving & CFD | 26 | December 17, 2012 03:34 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 18:07 |