ansys / ansys/pyfluent-visualization
Visualize solution variable data
- Dominant language
- Python
- Stars
- 53
- Forks
- 7
- Avg merge
- 4h 58m
- Merged PRs (30d)
- 1
Description
It might be useful to visualize the solution variable data in numerical format to understand how the data is ordered in space. For a face-thread, we can draw the background mesh and plot the centroid data as point cloud with variable data as labels. Following is an example code in pyvista without the background mesh:
```
import ansys.fluent.core as pyfluent
solver = pyfluent.launch_fluent()
solver.file.read_case_data(file_name=r"d:/work/elbow.cas.h5")
centroid_data = solver.fields.solution_variable_data.get_data(solution_variable_name="SV_CENTROID", zone_names=["inlet1"], domain_name="mixture")["inlet1"]
centroid_data = centroid_data.reshape(-1, 3)
pressure_data = solver.fields.solution_variable_data.get_data(solution_variable_name="SV_P", zone_names=["inlet1"], domain_name="mixture")["inlet1"]
import pyvista as pv
poly = pv.PolyData(centroid_data)
poly["Pressure"] = [f"{i},{p:.2f}" for i, p in enumerate(pressure_data)]
plotter = pv.Plotter()
plotter.add_point_labels(poly, "Pressure", point_size=3, point_color='black', font_size=10, bold=False, shape=None)
plotter.show_axes()
plotter.show()
```

Contributor guide
Research direction
Start with the solver.fields.solution_variable_data.get_data entry point and the PyVista example in the issue, including centroid reshaping and point labels. Check linked pull request #402 for the current implementation; done should visualize face-thread centroid variable data as a labeled point cloud together with the background mesh.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100