How to get the mesh quality using ACT

M
M Member, Employee Posts: 199
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
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:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 734
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    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