Python Based Automation

Use python based automation to quickly setup Virtual Wind Tunnel simulations in batch mode.

Setting up multiple simulations that are variations of a base simulation can be very time consuming. Running Virtual Wind Tunnel in batch mode can speed up this process by setting up the base simulation once manually and coding the variations in a script. This batch-processing feature is now enabled with a combination of template files and a python script. The python script can be programmed to read, modify, and write template files from within Virtual Wind Tunnel without you interacting with the Virtual Wind Tunnel graphical interface.

The current capability is a proof of concept that can import a model, an .xml template and then export an .stl model and .xml file. The ultraFluidX solver can then read the .stl and .xml files to run the simulation.
To invoke Virtual Wind Tunnel in batch mode, run the Virtual Wind Tunnel executable with the python script as an argument. In this example, the python script is named userScript.py.
>> $VWT_PATH/hwVWTuFX/hwx/bin/win64/ExecWinEnvVWTUFX.exe -C Inspire -p VWT -pr UFX -f $USER_PATH/userScript.py
Below is a sample python script that reads in a model, an .xml template file, and writes out an .stl and complete .xml template file inside a folder named uFX_Simulation.
from hwx import inspire
import hwvwtplugin
import hwfdmplugin
import hwui
import hwutl
# Open Model
inspire.openFile(r“usrPATH/roadster_test.nas”)
# Import Template
template = hwvwtplugin.hwvwtTemplateUtil()
complete = hwvwtplugin.hwvwtUtil.COMPLETE
template.ReadTemplateFile(“usrPATH/templateIn.xml",complete)
# Give the path with filename and it will create the XML file
directory = hwutl.hwString(“usrPATH/templateOut.xml”)
template.ExportTemplateFile(directory, complete)
# Exit
hwfdmplugin.hwfdmClient.GetActiveModel().SetModified(False)
hwfdmplugin.hwfdmClient.GetClient().Exit()