Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot XDMF with PyVista #454

Closed
adtzlr opened this issue Apr 20, 2023 · 1 comment · Fixed by #456
Closed

Plot XDMF with PyVista #454

adtzlr opened this issue Apr 20, 2023 · 1 comment · Fixed by #456

Comments

@adtzlr
Copy link
Owner

adtzlr commented Apr 20, 2023

starting with pyvista >= 0.39 it is possible to read XDMF files.

import pyvista as pv

file = pv.XdmfReader("result.xdmf")
file.set_active_time_value(1.0)

mesh = file.read()[0]
warped = mesh.warp_by_vector("Displacement")

warped.plot(scalars="Principal Values of Logarithmic Strain", component=0, cmap="turbo", show_edges=True)

gives

Bildschirmfoto vom 2023-04-21 00-24-07

@adtzlr adtzlr changed the title Show XDMF with PyVista Plot XDMF with PyVista Apr 21, 2023
@adtzlr
Copy link
Owner Author

adtzlr commented Apr 22, 2023

currently implemented as

result = fem.ResultXdmf("result.xdmf", time=10)
# result = fem.Result(mesh, field)
plotter = result.plot(
    scalars="Principal Values of Logarithmic Strain",
    scalar_bar_vertical=True,
    off_screen=True,
)
plotter.show(screenshot="test.png")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant