How to export rth to vtk using python (pyAnsys or other libs)?

Options

Hi
I've completed a Steady-State Thermal simulation which solved in HPC cluster and got some result file includes file.db, file.rth and more.
Is there any way that I could transfer the result files to vtk format file by using ansys python libs or other way?

Tagged:

Comments

  • Mike Rife
    Mike Rife Member, Employee Posts: 35
    First Answer 5 Likes First Anniversary First Comment
    Options

    Hi @wanghao
    Do you really want every result in the rth file exported out to a VTK format?

    In PyDPF there is a vtk_export - seach the documentation for more info. But this only exports out the results that have been gathered to fields.

    In PyMAPDL the mesh.grid creates a PyVista/VTK data object of the mesh and we can add fields to it as well. Then use the PyVista save operation to write out the VTK file.

  • wanghao
    wanghao Member Posts: 16
    Name Dropper First Comment
    Options

    Hi @Mike Rife
    I find the vtk_export class in PyDPF but not works for me.
    By the way I found the python library ansys-mapdl-reader and meets my needs by the scripts below.

    from ansys.mapdl import reader as pymapdl_reader
    result = pymapdl_reader.read_binary("./file.rth")
    result.save_as_vtk("file.vtk")
    

    Thanks for reply!