Automating repetitive CFD tasks and performing batch operations more efficiently.
If you’re in the field of computational fluid dynamics testing or studies, you already know how much time and effort it takes to complete the tasks involved. Hours upon hours are spent on geometry clean-up, meshing, and post-processing. Furthermore, when you’re dealing with similar models that have new constraints or dimensions, the work can feel tedious. But don’t worry! There’s a way to simplify all of this: Automation. By automating the CFD workflow, you can save yourself countless hours. This is especially useful when optimizing variables for a design to get the best output, which often requires multiple runs of the model. With automation, you can simulate the maximum number of cases in the allotted time frame, giving you a significant advantage in the product design life cycle. The best part is that the Fidelity Python application programming interface (API) is here to help you achieve this by automating any CFD workflow to boost the productivity of your design cycle.
APIs are an excellent tool for automating repetitive tasks and performing batch operations more efficiently. They can help reduce workload time and boost productivity, especially when dealing with new designs that require similar workflows. Additionally, APIs can assess mesh convergence and simulation parameter sensitivity, perform mesh adaptation for simulation accuracy, and implement best practices among colleagues and teams. The Fidelity Python API is easily compatible with any versioning system, making it an ideal choice for use on both Windows and Linux systems. With the help of an integrated development environment (IDE), such as GitLab or GitHub, you can easily load the Fidelity Python API and take full advantage of its many benefits.
The Fidelity Python API provides a comprehensive workflow, which includes CAD import, post-processing, project management, and job submission, among other essential features. It is crucial to note that the current version of the API uses Python 3.8.5 and is regularly updated to the most recent version.
Python scripts can be run in the following ways:
Run a python script in a shell on Linux:
fidelity2022.2 -print -batch -noFork -script script_full_path/script.py
Run a python script in a command prompt on Windows:
"Installation_path\Fidelity 2022.2\fidelityClient.bat" -print -batch -noFork -script script_full_path\script.py
-batch: ensures that Fidelity is run in batch mode. When -batch is not specified, the GUI will open, and the script will run and is visible in the GUI.
-noFork: the user gets the terminal control back only after executing the script. When -noFork is not specified, the user will get the terminal control back right after initializing Fidelity (script will be executed in the background).
-print: enables the output in the shell.
-script script_full_path/script.py: specifies the Python script to be run.
I: From the project management panel
While executing the script, a loading screen blocking the GUI will appear. Once the script has run, it is possible to undo or redo the step in one step using the undo/redo tabs on the panel. The execution of the script is encapsulated as a task in the action tree.
II: On selection
Fidelity returns the list of selected entities as arguments, making selecting arguments where we aim to run a script easily.
III. Python hooks
Python hooks can be integrated into the workflow to automatically execute Python commands before or after a specific task. These scripts are stored in Fidelity installation under /_resources/_hooks/ and under the corresponding subfolder:
Note:
Leave a Reply