CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM

Apply deltaT in utility

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

LinkBack Thread Tools Display Modes
Old   December 10, 2010, 12:39
Default Apply deltaT in utility
New Member
Bo Terp Paulsen
Join Date: Oct 2010
Posts: 13
Rep Power: 7
botp is on a distinguished road
Dear all,

At the moment I am trying to modify a utility file, where I want to multiply a constant by deltaT. I use a fixed Courant number, so I do not know the time step beforehand.

I have tried the following:
where alpha is the expression I want to modify, and C is a constant.

When I recompile the utility I get the following error message: error: ‘runTime’ was not declared in this scope.

I know there is not much information in the post, but if anybody could give me an advise on how to declare runTime, it will be appreciated.

Kind regards,
Bo Terp

Ps. I am using OF 1.5-dev
botp is offline   Reply With Quote

Old   December 10, 2010, 14:37
Senior Member
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 252
Rep Power: 11
MartinB is on a distinguished road
Hi Bo Terp,

have a look at /applications/utilities/postProcessing/wall/wallGradU/wallGradU.C for example.

Here is a code snippet that shows how to access the time values:
    ... header from wallGradU.C ...
int main(int argc, char *argv[])
    #include "setRootCase.H"
#   include "createTime.H"
    instantList timeDirs = timeSelector::select0(runTime, args);
#   include "createMesh.H"

    scalar lastTimeStep = 0; // added
    scalar deltaTime = 0; // added
    forAll(timeDirs, timeI)
        runTime.setTime(timeDirs[timeI], timeI);
        deltaTime = timeDirs[timeI].value() - lastTimeStep; // added
        lastTimeStep = timeDirs[timeI].value(); // added

        Info<< "Time = " << runTime.timeName() << endl;
        Info<< "deltaT = " << deltaTime << endl; // added

        ... more code ...
MartinB is offline   Reply With Quote


deltat, openfoam 1.5-dev

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
Sample Utility not working in OpenFoam 1.6 titio OpenFOAM Post-Processing 6 November 15, 2014 19:04
problem with sampling Utility in openFOAM 1.6 carmir OpenFOAM Post-Processing 10 February 26, 2014 03:00
How to compile a new utility rudy OpenFOAM 4 October 1, 2011 22:48
Sample Utility not working in OpenFoam 1.6 titio OpenFOAM Post-Processing 0 February 5, 2010 13:12
Courant utility does not always use correct deltat schmidt_d OpenFOAM Bugs 0 June 5, 2007 11:45

All times are GMT -4. The time now is 14:11.