Using ACT, how can I retrieve stress results?

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 813
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

Using ACT, how can I retrieve stress results?

Tagged:

Best Answer

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 813
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options
    • The following code can be used to retrieve all components of the stress tensor on one element:

        model=ExtAPI.DataModel.Project.Model # refer to model
        reader = model.Analyses[0].GetResultsData() # get results data of first analysis in the tree
        StressResults = reader.GetResult('S') # obtain stress results
        StressElement1 = StressResults.GetElementValues(1) # retrieve results on element n°1
      
    • To retrieve the values in one direction only, the following code can be used:

        model=ExtAPI.DataModel.Project.Model # refer to model
        reader = model.Analyses[0].GetResultsData() # get results data of first analysis in the tree
        StressResults = reader.GetResult('S') # obtain stress results
        StressResults.SelectComponents(["X"]) # select direction
        StressXElement1=StressResults.GetElementValues(1) # retrieve results on element n°1
      

Answers

  • Luiza
    Luiza Member Posts: 7
    Name Dropper First Comment
    Options

    Hi, using the first method for result extraction in a thermal-electric simulation in Ansys WB 2022R2 I get the following error "Error HRESULT E_FAIL has been returned from a call to a COM component.". The error appears in the third line when reader.GetResult is called for results like "Temperature", " Electric Voltage" , and it works only for one result called "EF" which is the directional electric field intensity. All results are from the same analysis. Do you know how to overcome this issue?

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 813
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Options

    Hi @Luiza , this error typically happens when asking for a result that is not in the result file. To check which results are available and get their names, you can use reader.ResultNames.

    Hope this helps!