DPF mapping between node ID/index and MAPDL node ID

cvaero Member Posts: 8
Name Dropper First Comment
edited June 2023 in Structures

DPF seems to have two different types of node IDs at least in the context of MAPDL results: one is an internal node ID and another is the node ID in MAPDL. For example it is possible to have ANSYS node IDs 100,200,300 and the corresponding internal DPF ids would be 1,2,3. The mesh scoping commands like nodes_scoping = dpf.mesh_scoping_factory.nodal_scoping(range(400, 500)) seem to use internal node IDs, although the documentation is not explicit about that. I would like to create scoping based on the MAPDL node IDs. It is not clear from docs and examples how to do that. Can you please explain?

On a related point. Is there a vectorized way to convert internal node IDs to MAPDL node IDs and vice versa? I see id and index methods in Scoping but they only take a single argument so they would need to be run in a loop



  • Pierre Thieffry
    Pierre Thieffry Member, Moderator, Employee Posts: 95
    First Anniversary Ansys Employee Solution Developer Community of Practice Member Photogenic


    there is indeed a internal numbering and the actual node numbering. For a given field, you would get the values using get_entity_data_by_id(mapdl_node_number) or get_entity_data(dpf_node_index). 

    When you define a scoping, the ids of the scoping are the actual node numbers as defined in MAPDL. The following script shows the difference between node id (mapdl) and node index (dpf). The last line also shows that the scoping is indeed on mesh node ids and not dpf indexes

    from ansys.dpf import core as dpf
    premium_server_context = dpf.AvailableServerContexts.premium
    premium_server = dpf.start_local_server(
    node_range=list(range(400, 410))
    nodes_scoping = dpf.mesh_scoping_factory.nodal_scoping(node_range)
    for nid in node_range:
      print("mapdl id {0}: {1}".format(nid,u_field.get_entity_data_by_id(nid)))
      print("dpf index {0}: {1}".format(nid,u_field.get_entity_data(nid)))

    To get the correspondence between indexes and ids, you could use this call which returns a dictionary whose keys are the dpf indexed and the values the actual node ids