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

Apply deltaT in utility

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By MartinB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 10, 2010, 12:39
Default Apply deltaT in utility
  #1
New Member
 
Bo Terp Paulsen
Join Date: Oct 2010
Posts: 13
Rep Power: 16
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:
alpha=C*runTime.deltaT().value();
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
Default
  #2
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
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:
Code:
    ... header from wallGradU.C ...
int main(int argc, char *argv[])
{
    timeSelector::addOptions();
    #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 ...
Martin
hojjat.m likes this.
MartinB is offline   Reply With Quote

Reply

Tags
deltat, openfoam 1.5-dev


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 Off
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 23: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 12:45


All times are GMT -4. The time now is 20:13.