General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

how to get the node id of the maximum stress/strain using ACT?

    • akashp81995
      Subscriber
    • Ashish Khemka
      Forum Moderator


      Right-click on the stress result item and then export the result. You will get an excel sheet of node ids and corresponding stress values.

      Regards Ashish Khemka
    • akashp81995
      Subscriber
      Hi @akhemka Thank you for your response. I think it would help me do it manually.
      I am trying to get the node ID with the maximum stress value using Python for ACT. And I might have to get the same for hundreds of results. So using this method suggested by you would create hundreds of files. In order to avoid this, I am looking for a Python API/Command that would give me the node ID with the maximum stress value without having to export the stress results.

      Thanks in advance Akash Purushothaman
    • pmaroneh
      Ansys Employee
      in order to help you out, I would first need to know how you have retrieved the max stress values ? Indeed there are several ways to do that:
      Through the automation API: insert a stress result and get the maximum value from the details view (ExtAPI.DataModel.Project.Model.Analyses[0].Solution.AddNormalStress() etc)
      Through the result reader (ExtAPI.DataModel.Project.Model.Analyses[0].GetResultsData())
      If you could share your script, it would help.
    • monSL
      Subscriber
      Hi
      I'd be interested as well on understanding how to get the max stress value using ACT and IronPython. Would you have any other updated about it?

      Thanks M
    • akashp81995
      Subscriber
      I've used the first method that you'd mentioned about. Code below:
      model = ExtAPI.DataModel.Project.Model
      solution = model.Analyses[0].Solution
      new_stress = solution.AddNormalStress new_stress.EvaluateAllResults max_stress = new_stress.Maximum

      In this method I've retrieved the maximum stress value.
      Thanks & Regards Akash Purushothaman
    • pmaroneh
      Ansys Employee
      Thanks for the additional information . In such case you can make use of the PlotData property from the result plot to loop through the data table and find the nodes that have the maximum stress value. Below is a script based on yours. Also adding a screenshot so that it's easier to read.


      # Create Normal Stress Plot
      model = ExtAPI.DataModel.Project.Model
      solution = model.Analyses[0].Solution
      new_stress = solution.AddNormalStress new_stress.EvaluateAllResults max_stress = new_stress.Maximum

      # Extract data from plot
      plot_data = new_stress.PlotData
      nodes = plot_data ['Node']
      result_value = plot_data ['Values']

      # Handle unit conversion
      import units
      currentLengthUnit=ExtAPI.DataModel.CurrentUnitFromQuantityName('Stress')
      scale_factor=units.ConvertUnit(1.,currentLengthUnit,result_value.Unit)

      for index in range(len(nodes)):
      if result_value[index] == max_stress.Value*scale_factor:
      print(nodes[index])
    • akashp81995
      Subscriber
      Thank you..
      Thank you.. it works for stress values..
      It doesnt work for contact pressure.. what changes do I need to make??
      Thanks in advance
      Akash Purushothaman

    • Erik Kostson
      Ansys Employee


      Have in mind that we do not provide extensive help and codes/scripts for act application - we can advice only.

      So for contact pressure there are multiple ways:

      The first one is to use the contact tool:
      ctool=solution.AddContactTool pres=ctool.AddPressure pres.....
      etc.... (so do similar things as the previous code that was given by my colleague and that you used).



      So another way of doing what you want is to use a user defined result scoped to the contact elements (say conta174) and use the pressure results (CONTPRES - results).

      Example below:

      model = ExtAPI.DataModel.Project.Model
      solution = model.Analyses[0].Solution
      useres=solution.AddUserDefinedResult you then need to select by Element Name ID, set elements to the contact elements, units, etc..
      etc....
      ....


      All the best

      Erik




Viewing 8 reply threads
  • The topic ‘how to get the node id of the maximum stress/strain using ACT?’ is closed to new replies.