… With Ansys Fluent, Dynamic Reporting, and PyAnsys.
In the world of engineering, simulation plays a vital role in designing and optimizing complex systems. Whether you’re working on aerodynamics, heat transfer, or fluid dynamics, the ability to simulate and analyse your designs is crucial. However, once you’ve run these simulations and processed the results, what’s next? How do you turn the raw data into a presentable format for obtaining valuable insights? This is where tools like Ansys Dynamic Reporting come into play. For example, consideransys-fluent-core (PyFluent Documentation) provides Pythonic access to Ansys Fluent. Its features enable the seamless use of Fluent within the Python ecosystem and broad access to native Fluent features. It also provides a Python interface to generate simulation reports and export them in HTML, PDF, and PPTX formats, utilizing Ansys Dynamic Reporting behind the scenes.
This article will explore how to utilize the PyAnsys ecosystem to streamline CFD simulations and generate comprehensive reports using PyFluent and PyDynamicReporting. Additionally, it will demonstrate how to access and integrate the generated reports with modern tech stacks for use within an end-to-end workflow as a web application.
What is Ansys Dynamic Reporting?
Ansys Dynamic Reporting, documented as Nexus, is a report generator utilized in various Ansys products. It enables you to gather data from different sources and in multiple formats, which can then be consolidated, analysed, and presented in highly interactive reports. Key features of Ansys Dynamic Reporting include:- Native support for multiple data formats.
- Ability to store data from various sources, such as CAD packages, simulation software, and postprocessors.
- Tools for data aggregation, filtering, and processing within the database.
- A web-based interface for seamless and intuitive interaction with database items.
- A template editor to create report templates.
- Live reports with automatic updates when new data becomes available.
- High interactivity in generated reports.
What is PyDynamicReporting?
PyDynamicReporting is a Python client library designed for Ansys Dynamic Reporting, formerly known as Nexus. Ansys Dynamic Reporting is a system that allows you to store various types of items, such as images, text, 3D scenes, and tables, in a database for organization and dynamic report generation. By using PyDynamicReporting, you can access all of Ansys Dynamic Reporting’s features in a more Python-friendly manner when connected to an instance of the service. Please refer detailed documentation and installation guide: Ansys PyDynamicReporting.Getting Started with PyFluent & PyDynamicReporting
This article guides you through setting up the environment and crafting a simulation using PyFluent for an example scenario. Following that, it will demonstrate the use of PyFluent to create and export a report that takes advantage of Ansys Dynamic Reporting. Upon finishing the PyFluent process, the article will re-establish a connection with the Fluent Report Server to retrieve the data and export the report’s URL. This can be conveniently integrated into other processes, such as web applications.Setting Up Your Environment
Before you dive into using these tools, you’ll need to set up your environment. Ensure you have licensed copies of the relevant Ansys products. The following products are required for a smooth setup process:- Install Python (if not already installed):
- Activate the virtual environment:
-
For Windows CMD:
-
For Windows Powershell:
From now on, all the commands must be executed within the virtual environment.
- Install the Libraries:
Note: For beginners who may find the above steps challenging, consider using the Ansys Python Manager to install Python and PyAnsys Metapackages. This tool also simplifies the process of creating and managing virtual environments.
Fluent Simulation Workflow for Example Case
Reading Ansys Fluent Simulation data using PyFluent.
Import required libraries/modulesNote: The FluentReportServer directory is created by Ansys Fluent at current working directory. It contains the Ansys Dynamic Reporting database and relevant database files.
Ansys PyDynamicReporting Workflow
Connecting with FluentReportServer (ADR Service) using PyDynamicReporting library
Import required libraries/modulesNote: You can use any image file to create item_image, but it is recommended that you use PNG, or JPEG format.Get the URL of the report
Note: Once the ADR service has stopped, the url will not return a report any more. Make sure to call the stop method at the right time.e.g., with Plotly Dash To create a simple Dash web application that renders a URL with an iframe using Dash Bootstrap Components (dbc), you’ll need to have Dash and dbc installed. You can install them using pip if you haven’t already: