ansys / pyfluent-visualization

Visualize Ansys Fluent simulations using Python
https://visualization.fluent.docs.pyansys.com
MIT License
26 stars 3 forks source link

feat: Display solution variables data #402

Open mkundu1 opened 3 months ago

mkundu1 commented 3 months ago
import ansys.fluent.core as pyfluent
from ansys.fluent.visualization.pyvista.solution_variables import display_solution_variables_data
solver = pyfluent.launch_fluent()
solver.file.read_case_data(file_name=r"d:/work/elbow.cas.h5")
display_solution_variables_data(session=solver, variables=["SV_P", "SV_T"], zones=["inlet1"])

image

display_solution_variables_data(session=solver, variables=["SV_P", "SV_T"], zones=["inlet2"], format = lambda i, x, y: f"{i}: {x:.2f}, {y:.2f}")

image

prmukherj commented 3 months ago

Shall we make this consistent with other PyViz features like Graphics and Plots??

>>> display_solution_variables_data(session=solver, variables=["SV_P", "SV_T"], zones=["inlet1"])

Something like:

>>> svar_disp = SolutionVariables(session=solver)
>>> svar_disp.variables = ["SV_P", "SV_T"]
>>> svar_disp.zones = ["inlet1]
>>> svar_disp.display()

format can also be an additional attribute.

Even zones can be named surface_names (or can take surface ids optionally)?

seanpearsonuk commented 3 months ago

Shall we make this consistent with other PyViz features like Graphics and Plots??

>>> display_solution_variables_data(session=solver, variables=["SV_P", "SV_T"], zones=["inlet1"])

Something like:

>>> svar_disp = SolutionVariables(session=solver)
>>> svar_disp.variables = ["SV_P", "SV_T"]
>>> svar_disp.zones = ["inlet1]
>>> svar_disp.display()

format can also be an additional attribute.

Even zones can be named surface_names (or can take surface ids optionally)?

Worth considering.

mkundu1 commented 2 months ago

Shall we make this consistent with other PyViz features like Graphics and Plots??

>>> display_solution_variables_data(session=solver, variables=["SV_P", "SV_T"], zones=["inlet1"])

Something like:

>>> svar_disp = SolutionVariables(session=solver)
>>> svar_disp.variables = ["SV_P", "SV_T"]
>>> svar_disp.zones = ["inlet1]
>>> svar_disp.display()

format can also be an additional attribute.

Even zones can be named surface_names (or can take surface ids optionally)?

@prmukherj I could not get the display working in the above approach. We can sometimes look into the change in the pyfluent and pyfluent-visualization branches feat/display-svars-object-based.