Export time series of STL files (for mesh, Q-isosurface) in ANSYS CFD-Post by script (playing session file)
Overview
I'm still learning, but it seems that basically what you need to do for writing a script for CFD-Post are:
- Record the session
- Modify the session file (e.g., adding the for loop)
- Play the modified session file
So I did the recording, then modified that session file thanks to ( http://www.cfdresearch.com/ansys-fluent-cfd-post-scripts/ ). Basically simply adding the for loop.
Not sure of the syntax yet, but it seems the variable can be specified with $
prefix, as in shell script.
Sample
Let's say you have a time series of the result file (e.g., flapping wing) and you want to same some of them as STL file.
In the sample below, the you're saving 100 time instances as 1.stl, 2.stl, ... for each directory, where actual timestep
values for Fluent simulation are 10, 20, 30, ... so the timestep has to be specifed as $i*10
.
Here you're saving wing surface and Q-isosurface, both of them had to be created before playing the script.
# Session file started: 2019/10/04 16:21:36 # CFX-19.1 # To avoid unnecessary file pre-processing and modifications, include # COMMAND FILE at the top of your session file. # If it is not included, the file is assumed to be older and will be # modified for backward compatibility. COMMAND FILE: CFX Post Version = 19.1 END ! for ($i=1; $i <= 100; $i=$i+1) { > load timestep=$i*10 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 = E:/wing_surface/$i.stl Export Geometry = On Export Location Aliases = Export Node Numbers = Off Export Null Data = On Export Type = STL Export Units System = Current Export Variable Type = Current External Export Data = None Include File Information = Off Include Header = On Location = back Location List = wing_surf Null Token = null Overwrite = On Precision = 8 Separator = ", " Spatial Variables = X,Y,Z Variable List = Vector Brackets = () Vector Display = Scalar END >export 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 = E:/Q/$i.stl Export Geometry = On Export Location Aliases = Export Node Numbers = Off Export Null Data = On Export Type = STL Export Units System = Current Export Variable Type = Current External Export Data = None Include File Information = Off Include Header = On Location = back Location List = /VORTEX CORE REGION:Q Null Token = null Overwrite = On Precision = 8 Separator = ", " Spatial Variables = X,Y,Z Variable List = Vector Brackets = () Vector Display = Scalar END >export !}