Hello,
I am currently trying to develop a script that uses the elementary nodal forces and I have to perform the extraction with PyDPF from the result file. I am working with Ansys 2023R1 and here is my current script:
import os
from ansys.dpf import core as dpf
input_file = "file.rst"
bolt_selection = "SELECTION"
axis = 0
coord_sys = 0
# Select the ansys version 2023 for DPF
ansys_path = os.getenv("AWP_ROOT232")
if ansys_path is None:
ansys_path = os.getenv("AWP_ROOT231")
# print(ansys_path)
# Start the DPF server
server = dpf.start_local_server(ansys_path=ansys_path)
# print(server)
# Open the model
model = dpf.Model(input_file)
# print(model)
# Read the results
results = model.results
print(results)
# Extract the scoping of the named selection
mesh_scoping = model.metadata.named_selection(bolt_selection)
print(mesh_scoping)
print(mesh_scoping.ids)
# Extract nodal forces on selection
enf = results.element_nodal_forces(
time_scoping=1, mesh_scoping=mesh_scoping
)
fields = enf.eval()
print(fields)
field = fields[0]
print(field.data)
The script runs, I will attach to this request an archive containing the model to provide the data, but my issue is that I do not obtain the same results with ENF in Ansys. In this specific test case, I am expecting to obtain -25N in x direction but the script returns zero.
After investigating I think this is related to the scoping I am using. Element nodal forces seems to be defined on Element Nodal location while my scoping coming from the named selection is defined on Nodal location. However I don't know how to fix this to get the same results as the one obtained with Mechanical.
Would you know how to proceed?
Thank you in advance!