PyDPF-Core: How to Extract Contact Results from LS-DYNA INTFOR File?

Hello, I'm looking for some guidance on post-processing LS-DYNA contact results (INTFOR files) using PyDPF-Core. I'm trying to extract contact interface data (like contact forces/pressures), but I'm running into issues.
Context: I have an LS-DYNA simulation, and I’m using the Python PyDPF-Core library to read results. The standard workflow for reading D3Plot results works great for things like stress or displacement.
Problem: The contact interface results are stored in a separate LS-DYNA INTFOR file. I tried to use a similar approach for the INTFOR file, but the typical D3Plot method doesn’t work here – I get an error when attempting to load or query the INTFOR data.
I have read that PyDPF can handle LS-DYNA results, but I'm unsure how to plug in the .intfor file or get those contact results out.
Question: Has anyone successfully extracted contact interface results from an LS-DYNA INTFOR file using PyDPF-Core? If so, how can this be done?
Specifically, I'd appreciate guidance on:
The correct way to include or load an INTFOR file in PyDPF-Core (e.g. via DataSources or another method) so that contact results become available. Do I need to use the LS-DYNA binout file instead of the raw .intfor?
I'm trying to be as clear as possible, and I apologise if I missed something obvious. Any advice or examples would be greatly appreciated! Thank you in advance for your help.
Cheers,
B
Answers
-
I could be wrong, but I think currently it is only possible to extract info from d3plot and binout files... @Ayush Kumar please correct me if I'm mistaken.
0 -
Do you know how to extract info on contact?
When using ls-prepost I use the intfor files. However, I need to script the process.
0 -
@Pernelle Marone-Hitz that is correct,
intfor
files are not supported via PyDPF currently.@midnight_prophet you can get contact information by setting the RCFORC option in the *DATABASE card, this will show up results in the binout, which you can extract using PyDPF.
Refer to the example below:
https://dpf.docs.pyansys.com/version/stable/examples/14-lsdyna/00-lsdyna_operators.html#sphx-glr-examples-14-lsdyna-00-lsdyna-operators-py2 -
Hi Ayush,
Thanks for letting me know! This sounds like a suitable option. Will run that now.
Have a nice day,
Ben0 -
Hi @Ayush Kumar ,
I have successfully outputted and plotted the contact forces.
However, when I try to extract the contact forces at specific nodes via scoping. I produce empty arrays.
If you could provide some guidance that would be amazing.
Below is my current function;
def contact_analysis(patient_dir, cond_region): # Generate the list of file paths binout = [os.path.join(patient_dir, f) for f in os.listdir(patient_dir) if f.startswith("binout")] ds = dpf.DataSources() ds.set_result_file_path(binout[0], "binout") model = dpf.Model(ds) print("Available Results in My Model:", model.metadata.result_info) # Create a Scoping object with your node IDs and location node_ids_scoping = dpf.Scoping(ids=cond_region, location=dpf.locations.nodal) interface_sco = dpf.Scoping(ids=[3], location="interface") FC_op = model.results.interface_contact_force() FC_op.inputs.entity_scoping.connect(interface_sco) FC = FC_op.eval() print(FC) # rescope_op = dpf.operators.scoping.rescope() # rescope_op.inputs.fields.connect(FC.time_freq_support.time_frequencies) # rescope_op.inputs.mesh_scoping.connect(FC[0].scoping) # t_field = rescope_op.outputs.fields_as_field() # t_vals = t_field.data # Trying to rescope to my nodal IDs rescope_op = dpf.operators.scoping.rescope() rescope_op.inputs.fields.connect(FC) # the *entire* container rescope_op.inputs.mesh_scoping.connect(node_ids_scoping) # nodal scoping FC_nodes = rescope_op.eval() # print out sizes of each field lengths = [f.data.size for f in FC_nodes] print(" each time‐step field has %d entries" % lengths[0]) t_vals = np.linspace(0.0, 0.3, 1581) print("T_vals ", t_vals.shape) FX = FC.select_component(0) FY = FC.select_component(1) FZ = FC.select_component(2) FX = FC_nodes.select_component(0) FY = FC_nodes.select_component(1) FZ = FC_nodes.select_component(2) plt.plot(t_vals, FX.get_field({"interface": 3, "idtype": 0}).data, label="FX, ") plt.plot(t_vals, FX.get_field({"interface": 3, "idtype": 1}).data, label="FX, master") plt.plot(t_vals, FY.get_field({"interface": 3, "idtype": 0}).data, label="FY, ") plt.plot(t_vals, FY.get_field({"interface": 3, "idtype": 1}).data, label="FY, master") plt.plot(t_vals, FZ.get_field({"interface": 3, "idtype": 0}).data, label="FZ, ") plt.plot(t_vals, FZ.get_field({"interface": 3, "idtype": 1}).data, label="FZ, master") plt.xlabel("Time (s)") plt.xlim([0, 0.3]) plt.ylabel("Contact Force (N)") plt.title("BAV") plt.legend() plt.show()
Regards,
B0 -
@midnight_prophet the fields container
FC
contains summation of all contact nodal forces for the contact pair. The IDs in the field are time ids and not node ids. Therefore, you can only extract contact force sum for a particular contact at a particular time point.0