Extract and plot BFE temperature from result file

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
edited June 2023 in Structures

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

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

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

    # Get started
    import os
    from ansys.dpf import post
    from ansys.dpf import core
    # Use DPF-Post to import .rst file and check data that is contained
    rst_file = os.path.join(r'C:\Users\','file.rst')
    solution = post.load_solution(rst_file)
    print(solution)
    # Get and plot BFE temperature using DPF-Post
    bfe_post = solution.structural_temperature()
    bfe_post_scalar = bfe_post.scalar
    bfe_post_scalar.plot_contour(show_edges = True)
    # Use DPF-Core to do the same
    model = core.Model(rst_file)
    results = model.results
    print(results)
    bfe_core = results.structural_temperature()
    bfe_field = bfe_core.outputs.fields_container()
    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
    mesh = model.metadata.meshed_region
    mesh.plot(bfe_nodal_field)
    bfe_data = bfe_field[0].data