How to extract temperature time history of an arbitrary point in the assembly?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 389
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited June 2023 in Structures

How to extract temperature time history of an arbitrary point in the assembly?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 389
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓

    Using temperature probe and scoping it to a local coordinate system at an arbitrary location.

    from collections import OrderedDict
    
    my_point = [8.5, 10.5, 3.5]
    
    # Add a coordinate system
    coordinate_systems = Model.CoordinateSystems
    csys = coordinate_systems.AddCoordinateSystem()
    
    # Set the origin
    csys.SetOriginLocation(Quantity("%s [mm]" % my_point[0]),
                           Quantity("%s [mm]" % my_point[1]),
                           Quantity("%s [mm]" % my_point[2]))
    
    analysis = Model.Analyses[0]
    # Add Temperature probe
    temp_probe = analysis.Solution.AddTemperatureProbe()
    # Scope it to the LCS
    temp_probe.LocationMethod = LocationDefinitionMethod.CoordinateSystem
    temp_probe.CoordinateSystemSelection = csys
    temp_probe.EvaluateAllResults()
    
    temp_probe.Activate()
    
    # Access the table data
    
    temp_data = OrderedDict()
    paneTabular = ExtAPI.UserInterface.GetPane(MechanicalPanelEnum.TabularData)
    control = paneTabular.ControlUnknown
    for row in range(1, control.RowsCount+1):
        time = control.cell(row, 2).Text
        temperature = control.cell(row, 3).Text
        temp_data.update({time: temperature})
    
    # Print Temp.
    
    for time, temperature in temp_data.iteritems():
        print "%s: %s" % (time, temperature)