Extract and plot BFE temperature from result file

Member, Moderator, Employee Posts: 873
100 Answers 500 Comments 250 Likes Second Anniversary
✭✭✭✭
edited June 2023 in Structures

How can I extract and plot the structural temperature from a binary result file?

Tagged:

Answers

  • Member, Moderator, Employee Posts: 873
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭
    Answer ✓

    Either DPF-Post or DPF-Post can be used for that. The script below can be adapted and illustrates both methods:

    1. # Get started
    2. import os
    3. from ansys.dpf import post
    4. from ansys.dpf import core
    5. # Use DPF-Post to import .rst file and check data that is contained
    6. rst_file = os.path.join(r'C:\Users\','file.rst')
    7. solution = post.load_solution(rst_file)
    8. print(solution)
    9. # Get and plot BFE temperature using DPF-Post
    10. bfe_post = solution.structural_temperature()
    11. bfe_post_scalar = bfe_post.scalar
    12. bfe_post_scalar.plot_contour(show_edges = True)
    13. # Use DPF-Core to do the same
    14. model = core.Model(rst_file)
    15. results = model.results
    16. print(results)
    17. bfe_core = results.structural_temperature()
    18. bfe_field = bfe_core.outputs.fields_container()
    19. bfe_nodal_field = bfe_field[0].to_nodal() #the elemental nodal field needs to be converted to an elemental or nodal field to be plotted
    20. mesh = model.metadata.meshed_region
    21. mesh.plot(bfe_nodal_field)
    22. bfe_data = bfe_field[0].data

Welcome!

It looks like you're new here. Sign in or register to get started.