How to iterate through load-steps for result objects?

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

How to iterate through load-steps for result objects?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 416
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓
    Options
    ResData = ExtAPI.DataModel.Project.Model.Analyses[0].GetResultsData()
    
    DataSets = ResData.ListTimeFreq
    
    es = Model.Analyses[0].Solution.Children[1]
    for data_set in DataSets:
        es.DisplayTime = Quantity("%s [sec]" % data_set)
        es.EvaluateAllResults()
        print es.Maximum
    
  • Javier Vique
    Javier Vique Member, Employee Posts: 76
    First Answer First Anniversary Name Dropper 5 Likes
    Answer ✓
    Options

    There is one way to do it if you don't have any result object in your Solution. For instance, imagine that you want to read nodal temperature results, without creating the result object. You use GetResultsData() function, which has the option CurrentTimeFreq to select which time results are read. Below an example where temperature is read for each time without result object creation:

    model= ExtAPI.DataModel.Project.Model
    meshData = model.Analyses[0].MeshData
    my_nodes = meshData.NodeIds
    reader = model.Analyses[0].GetResultsData()
    datasets = reader.ListTimeFreq
    for i in range(len(datasets)):
        reader.CurrentTimeFreq = reader.ListTimeFreq[i] #Here is where time is selected
        TEMPResults = reader.GetResult('TEMP')
        valuesTEMP = TEMPResults.GetNodeValues(my_nodes)