CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

choose a specific time

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 4, 2011, 21:10
Default choose a specific time
  #1
New Member
 
David Thériault
Join Date: Nov 2010
Posts: 8
Rep Power: 6
dav1dt is on a distinguished road
Hi All

My problem is: I want to choose a specific time in my post-processing code but I don't know how. I have seen a lot of loop with runtime where it chooses all the time-directories one after another but nothing about only the last time-directory for example.

You can find that code in postChannel:

// For each time step read all fields
forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Collapsing fields for time " << runTime.timeName() << endl;

# include "readFields.H"
# include "calculateFields.H"

// Average fields over channel down to a line
# include "collapse.H"
}

But me I try to get (roughly) ----> //For last Time step read all field

I try several things but I'm not familiar with C++.

If someone could give me a hint, it will be great.

Thx

David

Last edited by dav1dt; January 4, 2011 at 23:03.
dav1dt is offline   Reply With Quote

Old   January 7, 2011, 11:46
Default
  #2
Member
 
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 52
Rep Power: 8
r08n is on a distinguished road
Quote:
Originally Posted by dav1dt View Post
Hi All

But me I try to get (roughly) ----> //For last Time step read all field
Do you want to select fields for the last time?

I have never done this myself, but just guessing: if you look at the 'postChannel' source (which you quote anyway), there is a reference to a 'timeSelector' class:

Code:
instantList timeDirs = timeSelector::select0(runTime, args);
Its description says:

Quote:
The result program would receive -time, -latestTime, -constant and -noZero options. The -constant option explicitly includes the constant/ directory in the time list and the -noZero option explicitly excludes the 0/ directory from the time list.
So, I guess, you need to supply the option '-latestTime' in the 'args' before calling timeSelector::select0. The function 'timeSelector::addOptions' shows how to do it:

Code:
argList::validOptions.insert("latestTime", "");
Now, the 'timeDirs' will probably contain only the last time directory.

As I said, I haven't tested it, just a hint.
r08n is offline   Reply With Quote

Old   January 10, 2011, 12:19
Default
  #3
New Member
 
David Thériault
Join Date: Nov 2010
Posts: 8
Rep Power: 6
dav1dt is on a distinguished road
Thank you

I'll give you feedback on this shortly.
dav1dt is offline   Reply With Quote

Old   January 20, 2011, 16:20
Default
  #4
New Member
 
David Thériault
Join Date: Nov 2010
Posts: 8
Rep Power: 6
dav1dt is on a distinguished road
Hi

I didn't succeed the way you suggested. However I have been able to do what I wanted. I wrote my latestTime's number in a dictionary and asked openFoam to read and use it.

david
dav1dt is offline   Reply With Quote

Reply

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
Pressure time history at specific points on a surface during unsteady simulation drrbradford NUMECA 0 July 15, 2010 10:13
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 09:15
Problems with simulating TurbFOAM barath.ezhilan OpenFOAM 13 July 16, 2009 05:55
Differences between serial and parallel runs carsten OpenFOAM Bugs 11 September 12, 2008 11:16
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 01:24.