How to move Element Table Data to Nodal in DPF

Jim Kosloski
Jim Kosloski Member, Employee Posts: 16
First Anniversary Ansys Employee First Comment
edited June 2023 in Structures

Element table data is per element, but often stored per node (i.e results at node I , J , K , L). How can use DPF to get this data as "Nodal" values. I suppose going the other way would work if it is easier, average the nodal values and get 1 value per element.

What I am trying to do is create a plot of contact gap-volume. I want to multiply the gap by the contact area. If anyone has an example of how to do this in DPF, that would be very helpful.



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

    Jim, I believe the "elemental_nodal_to_nodal" operator is what you are looking for.

  • Jim Kosloski
    Jim Kosloski Member, Employee Posts: 16
    First Anniversary Ansys Employee First Comment


    I need to BUILD the element nodal field first. The ETABLE data is 1 value per element, but that value can be at NODE I, J, K, or L. So have 4 separate elemental fields that I need to assemble into a single element_nodal field.

    Example for CONT174: PENE NMISC - 9 10 11 12

    9 is the value at node I of the element, 10 at node J, etc.

  • George Tzortzopoulos
    George Tzortzopoulos Member, Employee Posts: 12
    First Anniversary First Comment Name Dropper Photogenic
    edited July 2023

    Hello Jim,

    I don't know if this topic is still of your interest, but I will provide an answer for potential future reference:

    import mech_dpf
    import Ans.DataProcessing as dpf
    Create DPF DataSources and Model
    analysis = Model.Analyses[0]
    ds = dpf.DataSources(analysis.ResultFileName)
    model = dpf.Model(ds)
    Get whole mesh
    mesh = model.Mesh
    Scope to all CONTA174 elements
    cont_op = dpf.operators.scoping.on_property()
    my_cont_scoping = cont_op.outputs.mesh_scoping.GetData()
    Get NMISC result with index 9 —> PENE at Node I
    pene_op = dpf.operators.result.nmisc()
    my_pene = pene_op.outputs.fields_container.GetData()[0]
    Get corner nodes of each element in the scoping and store them at distinct lists
    i = 0
    j = 1
    k = 2
    l = 3
    nID_i = []
    nID_j = []
    nID_k = []
    nID_l = []
    for elem_id in my_pene.ScopingIds:
        corner_nodes = mesh.ElementById(elem_id).CornerNodeIds # returns a list with order [I,J,K,L]
    Create a custom nodal field for corner node I (same procedure for nodes J, K, and L)
    my_nodal_pene_i = dpf.FieldsFactory.CreateScalarField(my_pene.ElementaryDataCount, "Nodal")
    my_nodal_pene_i.Scoping.Ids = nID_i
    my_nodal_pene_i.Data = my_pene.Data
    In case Python Result is issued
    #op = dpf.operators.utility.forward()

    I hope this script answers the question!