|
With the Python scripting capabilities of CFD-VIEW, you can quickly and
easily perform the repetitive tasks you encounter when post-processing
transient simulations.
In this user tip, we present the scripting commands and functions that can be utilized for
transient simulation post-processing. A Free Surface (VOF) simulation example is used to
illustrate the procedure.
As shown in figure 1 below, the transient simulation models a bubble of air entering a tube
filled with water.
Figure 1. Simulation example - Air bubble entering a water-filled tube.
The Python script will create a Point Probe (see figure 1 above) and write to a text file the values
of the transient time, the X-direction velocity (U), and the static pressure (P).
To start, launch CFD-VIEW, but do not import any DTF file nor open any MDL file. Open the Python
Script Editor from 'Tools -> Edit Python Script', or by clicking on the "Edit
Python Script" button in the toolbar. In the editor, type in the script below.
Note:
-
This script shows how to create a point probe and write data to a file. This is, of course,
only an example to present the structure of a script when applied to transient simulations.
It is possible to perform other operations such as creating plane cuts, saving images,
saving plot data, etc.
-
This script can also be run headless (i.e. from the command line) without opening the GUI. To do so, type in:
XCFD-VIEW -nogui -script script_name.py
Note that you also need to add the function <Quit()> at the end of the script
(after <f.close()> in our example) to terminate the CFD-VIEW process.
If you have any questions about this feature or would like us to discuss other topics in the future,
please let us know.
Regards,
Olivier Demaneuf
ESI CFD Support Team
|