How to iterate through load-steps for result objects?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 452
100 Answers 250 Likes 100 Comments First Anniversary
✭✭✭✭
edited June 2023 in Structures

How to iterate through load-steps for result objects?

Tagged:

Best Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 452
    100 Answers 250 Likes 100 Comments First Anniversary
    ✭✭✭✭
    Answer ✓
    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: 82
    5 Answers 25 Likes 10 Comments First Anniversary
    ✭✭✭✭
    Answer ✓

    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)
    

Answers

  • Niklas_01
    Niklas_01 Member Posts: 2
    Name Dropper First Comment
    **

    Hello @Javier Vique , thank you for your useful code. Though, it seems to work only with temperatures and displacements, is there a possibility to get the nodal (or element) equivalent vonMises stresses for each time step?