CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Data reader : Timestep List (

Felix August 3, 2006 13:59

Data reader : Timestep List
Hi everyone,

I need a little help on CFX 10.0 session files. I have 15 result files from a transient calculation and want to automate the post-processing. Want I want to do is to run a post-processing macro (an existing session file) in all the 15 files and I thought about doing it using a FOR loop.

The problem I have is I am not able to retrieve the different timesteps and load the associated results. Here is the command line I use:

! $TimeStep = (getValue("DATA READER", "Timestep List"));

Using this, "TimeStep" seems to be only one string element containing the correct list (I printed it in a file). But I cannot extract only one element from that list to use it and thus everything that is not TimeStep[0], the list, is empty. How sould I do it? Also, is there a way to know the number of elements in that list i.e. length(TimeStep) or something similar ?

Thanks a lot, Felix

Johnson August 7, 2006 06:41

Re: Data reader : Timestep List
Hi Felix,

You need to use a bit of Perl to chop up the string and put it into an array. Something like the following should work.



# Load a transient file and read the time step list

> load filename=myFile.res

!$timestepList = getValue("DATA READER", "Timestep List");

!@timesteps = split(/, /, $timestepList );

# Print time value and pressure for each time step

! open(FH,">myOut");

! foreach $ts ( @timesteps ) {

> load timestep=$ts

! $val = ave("Pressure", "Point 1");

! $time = getValue( "DATA READER", "Current Timevalue");

! print FH "$time $val\n";


Felix August 7, 2006 11:48

Re: Data reader : Timestep List
Thanks Johnson, it works well


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