DPF point cloud search - what are the inputs?

Ray_Greene
Ray_Greene Member Posts: 5
First Comment

Dear ADF:

What are the search and reference domains please? list of node Ids, list of nodes, objects?

Thanks,

Ray

Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 240
    First Anniversary First Comment 5 Likes Ansys Employee

    I have not tried this yet, but in reviewing the documentation I think the reference domain is a dpf mesh region. This can be retrieved from a results file from this operator:
    op = dpf.operators.mesh.mesh_provider() # operator instantiation

    If you want to define a sub-region of the total mesh from the results file you can use this operator:

    op = dpf.operators.mesh.from_scoping() # operator instantiation

    The search domain is the same type. The point cloud search operator will loop over the nodes in the reference domain and find the closest nodal point in the search domain.

    Here is also an exampe of building your own DPF mesh region from Mechanical data. You can build it from any data, like an external point cloud file in a similar way. All you need is a definition of points and connectivity. I doubt you even need the nodal connectivity for the point cloud operator to work as it is likely based solely on nodal locations.

    def GetDpfMeshFromMechMesh(ExtAPI, BodyIds=None):
        """
        Get a DPF mesh region from a mechanical mesh
        Args:
            BodyIds (list of int) (optional): Ids for GeoBodies to get region
        Returns:
            dpf.MeshedRegion
        """
        MechMesh=ExtAPI.DataModel.MeshDataByName("Global")
        #Get the node ids
        if BodyIds!=None:
            NdIds=set()
            for Id in BodyIds:
                Region=MechMesh.MeshRegionById(Id)
                NdIds.update(Region.NodeIds)
        else:
            NdIds=set(MechMesh.NodeIds)
        #convet to elem. ids.
        ElIds=MechMesh.ElementIdsFromNodeIds(NdIds)
        #Convert to Dpf MeshRegion
        DpfMesh=dpf.MeshedRegion(0,0)
        NdIndexByIds={}
        i=0
        for NdId in NdIds:
            N=MechMesh.NodeById(NdId)
            NdIndexByIds[N.Id]=i
            DpfMesh.AddNode(N.Id, [N.X, N.Y, N.Z])
            i+=1
        for ElId in ElIds:
            E=MechMesh.ElementById(ElId)
            DpfMesh.AddSolidElement(E.Id,[NdIndexByIds[N.Id] for N in E.Nodes])
        return DpfMesh
    

  • Ray_Greene
    Ray_Greene Member Posts: 5
    First Comment

    Mike:

    Thanks for the great support !

    Here's where you got me to:

    1. The DPF point cloud search acts on a "DPF Meshed Region" and the out of the box operators work on bodies.
    2. Does not work (your function to create a "Meshed Region") on a list of nodal Ids with the same z; it returns the parent body meshed region ← any suggestions or hope to get it to work on the list of Ids with the same z?

    Thanks again,

    Ray

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 240
    First Anniversary First Comment 5 Likes Ansys Employee

    This is an example of implementation in Mechanical. I can try to get a working example that also builds the DPF mesh without the need of a results file (so it can be used prior to solve). In this example the mesh is based on the results file data.

  • Ray_Greene
    Ray_Greene Member Posts: 5
    First Comment

    Mike:

    Thanks for super instructive code! I can appreciate it, and really want to apply it; but I could not create it in a finite amount of time :)

    But I do not have shell bodies, I have a Worksheet nodal named selection from bodies (that are part of a more complex assembly). I created these from your shells and now your code will not make DPF Meshed Region. Any rabbits left in the magician's hat?

    Really, really, appreciate the support,

    Ray