How to get the mesh quality using ACT

M
M Member, Employee Posts: 236
50 Answers 100 Comments 100 Likes First Anniversary
✭✭✭✭
edited December 2023 in Structures

Simple check of mesh quality

Will walk through all available mesh metric quantities write ave, min, max, std to dict

    with Transaction():
        m = Model.Mesh
        m_q = {}
        mm = 1
        ctr = 1
        while mm == 1:
            try:
                m.MeshMetric = ctr
                m_nam=m.PropertyByName("MeshMetric").StringValue
                m_ave = m.Average
                m_min = m.Minimum
                m_max = m.Maximum
                m_std = m.StandardDeviation
                m_q[m_nam] = ([ctr,m_ave,m_min,m_max,m_std]) # mesh metric, counter, 
                ctr+=1
            except:
                pass
                mm = 0
Tagged:

Best Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    Another method is to use GetResultsData() to retrieve the values on the elements directly. For example, to retrieve MAPDL Jacobian Ration on element n°1, one can use:

        results = ExtAPI.DataModel.Project.Model.Analyses[0].GetResultsData() # access results
        mesh_results = results.GetResult("MESH_") # access results on mesh
        mesh_results.Components # print "components", ie, name of available results for the mesh
        mesh_results.SelectComponents(['JACOBIAN_RATIO_MAPDL']) # select MAPDL Jacobian ratio
        mesh_results.GetElementValues([1]) # print value on element 1
    
  • Erik Kostson
    Erik Kostson Member, Employee Posts: 210
    50 Answers 100 Comments 25 Likes Name Dropper
    ✭✭✭✭
    edited March 4 Answer ✓

    Just to add to the first post.

    Instead of using ctr=1 or some other integer we can now (say 2023 r2) use the following to set the type of mesh metric one wants to look at:

    m.MeshMetric=MeshMetricType.AspectRatio

Answers

  • M
    M Member, Employee Posts: 236
    50 Answers 100 Comments 100 Likes First Anniversary
    ✭✭✭✭
    edited March 12

    Much clearer. Thanks Erik!