How to extract Contact Frictional Stress and Contact Sliding Distance using DPF in Mechanical?
Rohith Patchigolla
Member, Moderator, Employee Posts: 206
✭✭✭✭
in Structures
How to extract Contact Frictional Stress and Contact Sliding Distance using DPF in Mechanical for a certain Contact object?
Tagged:
0
Answers
-
One can use the below script (tested in v2024R1) to extract the Contact Frictional Stress and Contact Sliding Distance from a Contact Object, by taking the name of the contact as an input.
#Input ContactObjectName = "Frictional - 3blocks\Solid To 3blocks\Solid" #Extract Contact Element IDs based on SolverData first_analysis = ExtAPI.DataModel.Project.Model.Analyses[0] first_solution = ExtAPI.DataModel.Project.Model.Analyses[0].Solution solver_data = first_solution.SolverData contact_object = ExtAPI.DataModel.GetObjectsByName(ContactObjectName)[0] contact_object_data = solver_data.GetObjectData(contact_object) cont_elem_type_id = contact_object_data.SourceId cont_elems = solver_data.ElementIdsByMaterialId(str(cont_elem_type_id)) import mech_dpf import Ans.DataProcessing as dpf #Result Data dataSource = dpf.DataSources(first_solution.ResultFilePath) #model my_model = dpf.Model(first_solution.ResultFilePath) #time scoping my_time_scoping = [1] #scoping my_scoping = dpf.Scoping() my_scoping.Location = "Elemental" my_scoping.Ids = cont_elems ContFricStress_Op = dpf.operators.result.contact_friction_stress(time_scoping=my_time_scoping,data_sources=dataSource,mesh_scoping=my_scoping).outputs.fields_container.GetData()[0] ContSlidingDistance_Op = dpf.operators.result.contact_sliding_distance(time_scoping=my_time_scoping,data_sources=dataSource,mesh_scoping=my_scoping).outputs.fields_container.GetData()[0] #Extract All Data #print(ContFricStress_Op.Data) #print(ContSlidingDistance_Op.Data) #Data at a ContactElementID number #ElemID = 3813 #print(ContFricStress_Op.GetEntityDataById(ElemID)) #print(ContSlidingDistance_Op.GetEntityDataById(ElemID)) #Release Locked RST my_model.ReleaseStreams()
1