fev-14 1 CFD-Post: Transient Custom Results February/2013 How-to Procedure Vinicius Strugata Ambrosio
fev-14 1
CFD-Post: Transient Custom Results
February/2013
How-to Procedure
Vinicius Strugata Ambrosio
fev-14 2
Contents
Introduction
Problem Definition
Solution
Adapting the Solution
Comments
Version Date Author Reviewed By Comments
1.0 26/02/2013 Vinicius S. Ambrosio
Document History:
fev-14 3
• This document presents a method to generate multiple results along the time steps of a transient simulation using CFD-Post
• All you will need is suitable Project Schematic containing
– A CFD-Post System
– A CCL (CFX Command Language) script, used to export the results
– A Perl script, used to iterates over the time steps
– A transient simulation system (Fluent, CFX) to generate results along the time
Introduction
fev-14 4
• The user needs to post process the results from a transient simulation
• Usually this kind of simulation generates a large number of data, which makes the post processing a potentially difficult task
• It’s required a custom result for each time step
• The transient data is generated by a Fluent simulation solver • CFD Post is able to post process a great variety of data types, including the ones
generated by Fluent (*.cas, *.cas.gz, *.cas.zip *.dat, *.dat.gz, *.dat.zip, *.msh, *.cdat, *.cdat.gz)
• Besides that, CFD-Post is able to execute CCL (CFX Command Language) scripts. It’s possible to embed Perl commands in these scripts, which in turn leverages the power of CCL
Problem Definition
fev-14 5
• The analysis of the results can be executed in the usual way, that is:
I. Decide the variables you are interested to:
a) Example: pressure, velocity, volume fraction, etc …
II. Decide the place in the domain you want to inspect these variables:
a) You can use the domain (all or a part), the boundaries, or
b) You can use Locations: Points, Lines, Planes, etc, placed arbitrarily in the domain
III. Decide the way these variables will be presented/published:
a) 2D Charts, Tables, etc
b) Color Fields, Contour Plots, etc
c) Iso-surfaces, Streamlines, Volume Rendering
IV. Use a CCL Script to:
a) Traverse along the time steps
b) Export the results to a file (image or text file)
The Strategy
fev-14 6
• In order to demonstrate the solution, it’s required a transient result simulation
• The simulation chosen for this demonstration is the “Tank Flush”, from the ANSYS Fluent Training Material
Solution
fev-14 7
• The key to solve this problem is to use a combination of CCL and Perl commands
• This is called “Power Syntax” in the CFD-Post Documentation
• Procedure:
Solution
I. Insert a result you intend to generate for each time step. Example: A figure for a particular time step
1) Export via CCL the figure to the disk
2) To do so, the easiest way is record a session while executing manually this task
3) Click on Session → New Session. Set the file name for the session.
4) Click on Session → Start Recording.
5) Click on File → Save Picture …
a) Change the setting if required and click on “Save”
6) Click on Session → Stop Recording.
CCL Session File generated
fev-14 8
• Procedure (cont):
I. Use the Command Editor to combine the CCL script that you generated in the previous step and the Perl command to iterates over the time steps
Solution
1) Click on Tools → Command Editor
2) Paste the contents of the CCL script generated in this editor.
3) Now inserts the below Perl commands (more details in the following slides)
CCL Session File is executed for each time
step
Gets the Time Steps
Iterates over the Time
Steps
fev-14 9
Solution
4) Click on Process to execute the commands
5) The desired files will be generated in the specified folder
a) Please notice that the time step is part of the filename.
• Procedure (cont):
fev-14 10
• This is the complete script, provided for your convenience
Solution
# Session file
# CFX-14.5 build 2012.09.19-21.47
# Description:
# The goal of this script is to generate output results for all timesteps available
# Data: 26/02/2013
# Version: 1.0.0
COMMAND FILE:
CFX Post Version = 14.5
END
# Gets the timesteps
! $timestepList = getValue("DATA READER", "Timestep List");
! @timesteps = split(/, /, $timestepList );
! $nTimesteps = @timesteps;
! $userFilesPath = “C:/Temp/";
fev-14 11
• This is the complete script, provided for your convenience (cont)
Solution
! for $timeStep (@timesteps) {
> load timestep=$timeStep
! $filename = $userFilesPath . "Figure-$timeStep.png";
HARDCOPY:
Antialiasing = On
Hardcopy Filename = $filename
Hardcopy Format = png
Hardcopy Tolerance = 0.0001
Image Height = 600
Image Scale = 100
Image Width = 600
JPEG Image Quality = 80
Paper Orientation = Landscape
Paper Size = Letter
Print Line Width = 1
Print Quality = High
Screen Capture = Off
Use Screen Size = On
White Background = Off
END
!}
fev-14 12
• The presented method is generic enough to outputs any kind of data generated by CFD-Post
Adapting the Solution
• For example, let’s suppose you want to export the data along a Line
• All you need to do is:
– Obtain the CCL script required to export the data (using the session recorder shown earlier)
– Modify the script so that it can be used alongside the Perl script (changing the filename, etc)
The data in this line
can be exported
The resulting set of CSV files,
one for each time step
fev-14 13
• This is the complete script, provided for your convenience
Adapting the Solution
# Session file
# CFX-14.5 build 2012.09.19-21.47
# Description:
# The goal of this script is to generate output results for all timesteps available
# Data: 26/02/2013
# Version: 1.0.0
COMMAND FILE:
CFX Post Version = 14.5
END
# Gets the timesteps
! $timestepList = getValue("DATA READER", "Timestep List");
! @timesteps = split(/, /, $timestepList );
! $nTimesteps = @timesteps;
! $userFilesPath = “C:/Temp/";
fev-14 14
• This is the complete script, provided for your convenience (cont)
Adapting the Solution
! for $timeStep (@timesteps) {
> load timestep=$timeStep
! $filename = $userFilesPath . "Export-Line1-$timeStep.csv";
EXPORT:
ANSYS Export Data = Element Heat Flux
ANSYS File Format = ANSYS
ANSYS Reference Temperature = 0.0 [K]
ANSYS Specify Reference Temperature = Off
ANSYS Supplemental HTC = 0.0 [W m^-2 K^-1]
Additional Variable List =
BC Profile Type = Inlet Velocity
Export Connectivity = Off
Export Coord Frame = Global
Export File = $filename
Export Geometry = On
Export Location Aliases =
Export Node Numbers = Off
Export Null Data = On
Export Type = Generic
Export Units System = Current
Export Variable Type = Current
fev-14 15
• This is the complete script, provided for your convenience (cont)
Adapting the Solution
External Export Data = None
Include File Information = Off
Include Header = On
Location = ambient
Location List = /LINE:Line 1
Null Token = null
Overwrite = On
Precision = 8
Separator = ", "
Spatial Variables = X,Y,Z
Variable List = Water.Volume Fraction
Vector Brackets = ()
Vector Display = Scalar
END
>export
!}
fev-14 16
• This procedure is not necessary if you just want to export a set of images from a transient simulation result
• To do that, just proceed with the animation configuration and mark the option “Save Frames as Image Files”, as shown below. The images and the movie will be generated when you click on the “Play” button
Comments
fev-14 17
Contacts
• If you need help
• https://esss.zendesk.com/home