How to move Element Table Data to Nodal in DPF
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.
Answers
-
Jim, I believe the "elemental_nodal_to_nodal" operator is what you are looking for.
0 -
Pierre,
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.
0 -
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 mech_dpf.setExtAPI(ExtAPI) """ 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() cont_op.inputs.requested_location.Connect("Elemental") cont_op.inputs.property_name.Connect("mapdl_element_type") cont_op.inputs.property_id.Connect(174) cont_op.inputs.data_sources.Connect(ds) 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() pene_op.inputs.mesh_scoping.Connect(my_cont_scoping) pene_op.inputs.data_sources.Connect(ds) pene_op.inputs.item_index.Connect(9) 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] nID_i.append(corner_nodes[i]) nID_j.append(corner_nodes[j]) nID_k.append(corner_nodes[k]) nID_l.append(corner_nodes[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() #op.inputs.any.Connect(my_nodal_pene_i) model.ReleaseStreams()
I hope this script answers the question!
1