Skip to content

Create Scenes and Animation using pyVista #451

Open
@sujal-tipnis

Description

@sujal-tipnis

Can @ajain-work help with creating a scene object and a subsequent scene animation using PyVista?
Is this something that is currently available or would have to be included as an enhancement?

I used the following scripts to create meshes, iso-surfaces, contours and vectors:

import ansys.fluent.core as pyfluent
from ansys.fluent.post.pyvista import Graphics

s = pyfluent.launch_fluent(precision="double", processor_count=4)
root = s.get_settings_root()
s.tui.solver.file.read_case(case_file_name="manifold_solution.cas.h5")
s.tui.solver.file.read_data(case_file_name="manifold_solution.dat.h5")

# Get the graphics object for mesh display
gs_1 = Graphics(s)

# Create a graphics object for mesh display
mesh1 = gs_1.Meshes["mesh-1"]

# Show edges and faces
mesh1.show_edges = True
mesh1.show_faces = True

# Get the surfaces list
mesh1.surfaces_list = ['in1','in2','in3','out1','solid_up:1', 'solid_up:1:830','solid_up:1:830-shadow']
mesh1.display("window-1")

# Disable edges and display again
mesh1.show_edges = False
mesh1.display("window-2")

# Create iso-surface on the outlet plane

surf_outlet_plane = gs_1.Surfaces["outlet-plane"]
surf_outlet_plane.surface.type = "iso-surface"
iso_surf1 = surf_outlet_plane.surface.iso_surface
iso_surf1.field = 'y-coordinate'
iso_surf1.iso_value = -0.125017
surf_outlet_plane.display("window-3")

# Create iso-surface on the mid-plane (Issue # 276)

surf_mid_plane_x = gs_1.Surfaces["mid-plane-x"]
surf_mid_plane_x.surface.type = "iso-surface"
iso_surf2 = surf_mid_plane_x.surface.iso_surface
iso_surf2.field = 'x-coordinate'
iso_surf2.iso_value = -0.174
surf_mid_plane_x.display("window-4")

# Temperature contour on the mid-plane and the outlet
local_surfaces_provider = Graphics(session=None).Surfaces
contour_temp = gs_1.Contours["contour-temperature"]
contour_temp.field = "temperature"
contour_temp.surfaces_list = ['mid-plane-x','outlet-plane']
contour_temp.display("window-4")

# Create Iso-Clip (Unavailable: Issue # 278)
surf_clip_z_inner = gs_1.Surfaces["clip-z-inner"]
surf_clip_z_inner.surface.type.allowed-values

# Contour of the Manifold Temperature
contour_temp_manifold = gs_1.Contours["contour-temperature-manifold"]
contour_temp_manifold.field = "temperature"
contour_temp_manifold.surfaces_list = ['in1','in2','in3','out1','solid_up:1', 'solid_up:1:830']
contour_temp_manifold.display("window-5")

# Vector on the mid-plane (Currently using outlet-plane since mid-plane is affected by Issue # 276)

velocity_vector = gs_1.Vectors["velocity-vector"]
velocity_vector.surfaces_list = ['outlet-plane']
velocity_vector.scale = 1
velocity_vector.display("window-6")

Can we create scenes and animation using the above objects and as per the steps outlined in this tutorial?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request. Feature work invariably requires testing-team involvement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions