CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Modifying Session Files for CFD Post processing (https://www.cfd-online.com/Forums/cfx/108801-modifying-session-files-cfd-post-processing.html)

Crank-Shaft November 1, 2012 17:01

Modifying Session Files for CFD Post processing
 
Hi all,

I have only recently started to learn about CFD Post Session features and I managed to record actions in the following sequence -
1 Create a longitudinal, stream-wise plane.
2 Create a contour of stream-wise velocity for the selected time step, which I manually selected from the instance selection menu. (I have 50 time steps now just to understand the process)
3 Save the image into the directory.

The main limitation of this is that everytime I want to replicate this sequence for each time step I have to manually select it. The file name also remains static and this causes previous images to simply be replaced with the new file in the same directory. Hence, I am currently making 50 folders (50 time-steps) and just altering the 'time-step' value at the top of the Session file re-running the sequence of actions.

Is it possible to edit the session script so that all the time steps are automatically incremented and the images are saved with the respective time steps in the title? This will save me A LOT of time and I would really appreciate the help.

Thank you

mjgraf November 1, 2012 18:45

add some perl code in the cse to handle this.
Check the documentation on how to implement perl in your cse, ccl language. This is very powerful. Have fun.


quick snippet

Code:

! @steplist = ( 31..157, 159, 160, 161 );

! foreach $curstep (@steplist) {
> load timestep=$curstep
! ($solverstep, $units) = evaluate( "Accumulated Time Step" );

DO SOME STUFF

! }

Load the final res file as you typically would for a transient. Hopefully you have state file with the setup for the image you want, load this. If you record a session where you export the image, look at this code and wrap the image export in the foreach and use the variables to modify the naming, etc.

If you are using a TEXT feature, you can add the Expression "Accumulated Time Step" and this will change as the timesteps are loaded.

Quote:

Originally Posted by Crank-Shaft (Post 389748)
Hi all,

I have only recently started to learn about CFD Post Session features and I managed to record actions in the following sequence -
1 Create a longitudinal, stream-wise plane.
2 Create a contour of stream-wise velocity for the selected time step, which I manually selected from the instance selection menu. (I have 50 time steps now just to understand the process)
3 Save the image into the directory.

The main limitation of this is that everytime I want to replicate this sequence for each time step I have to manually select it. The file name also remains static and this causes previous images to simply be replaced with the new file in the same directory. Hence, I am currently making 50 folders (50 time-steps) and just altering the 'time-step' value at the top of the Session file re-running the sequence of actions.

Is it possible to edit the session script so that all the time steps are automatically incremented and the images are saved with the respective time steps in the title? This will save me A LOT of time and I would really appreciate the help.

Thank you


Crank-Shaft November 1, 2012 20:48

Thanks so much for that informative post.

I have no experience with Perl language however, I know some basics of C and MATLAB.

I will try to implement these ideas perhaps, with the aid of a friend and you report back on progress. At the very least, the current session file I created saves me about 50-60 separate mouse actions and this will hopefully save some significant time.

This is OK for the preliminary stages however, when I switch to a fully transient study with a LES I will definitely need to try and implement automated capturing, hard-copy saving and appending of filenames.

Does anyone else have any similar experiences or encounters they can share?

Crank-Shaft November 2, 2012 07:44

1 Attachment(s)
Code:

! @steplist = ( 31..157, 159, 160, 161 );
! foreach $curstep (@steplist) { > load timestep=$curstep
! ($solverstep, $units) = evaluate( "Accumulated Time Step" );
DO SOME STUFF  ! }

I have copied my main case file and CFD Post state file and tried the code snippet you provided. I also managed to record a new session including file opening, loading results, creating a contour, creating a chart, exporting both and saving the state.

This was implemented within your code snippet and I found that the time steps were actually being loaded iteratively as the for loop suggests. This is a very positive result. I verified the functionality by choosing time step 5 and then when the session is played back it reverts to the array {1,2} as documented in the session script. Thank you so much for your assistance.

Now I will need to try and implement a feature which appends file names with the "Accumulated Time Step" which hasn't been successful yet.

I have attached my current script. I welcome any suggestions and feedback.:)

singer1812 November 2, 2012 11:11

Something like below? I havent checked it, so you will have to debug exact details.

# Load a transient file and read the time step list
> load filename=myFile.res
!$timestepList = getValue("DATA READER", "Timestep List");
!@timesteps = split(/, /, $timestepList );


! foreach $ts ( @timesteps ) {
> load timestep=$ts
!$c="P".$ts."B.csv";
! open(FH,">$c");
! $val = ave("Pressure", "Point 1");
! $time = getValue( "DATA READER", "Current Timevalue");
! print FH "$ts $time $val\n";
!close FH;
!}

Crank-Shaft November 4, 2012 21:17

I haven't had the chance to try this yet. I will implement this as soon as I can and report back on progress.

Thanks for your help Singer.

Crank-Shaft November 11, 2012 04:46

5 Attachment(s)
Thanks for you help so far everyone.

I have recently extracted some data from the flow domain I am analysing and I am finding it a little difficult to interpret the results.

Please refer to the attached images including the line locations which were used for the profile data and I would really appreciate if someone is able to clarify the following areas of confusion for me -
- The standard SST model which is present in Fluent is following Menter's formulation and is applicable in this case since the wall-y+ values are low enough. Hence, I assume that the blending feature is being used to resolve the free-stream and the near-wall region.
- Exact same meshes were used for both simulation cases and all settings are identical except the low-Re correction. Why is Wall-y+ values are significantly higher for the low-Re model?
- Is is reasonable to try and assess the length of the recirculation region and the point of reattachment from the 0 wall shear stress? I imagine that the shear stress values are dependent on the skin-friction coefficient, which is based on the vel. magnitudes. What could be an explanation for the variation between the two models here?

A little off-topic from the session files however, I didn't necessarily think this required a new thread.

Thanks for your guidance.


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