How to calculate volume of elements whose stresses are above a given value (e.g. 100MPa)?

Javier Vique
Member, Employee Posts: 93
✭✭✭✭
in Structures
I would like to identify elements whose stresses are above 100MPa and calculate their volume, calculating afterwards the percentage against total volume.
Tagged:
0
Answers
-
For this exercise, we will assume that it is ok to get stresses at centroid. Based on this assumption, this would be the code using dpf:
import mech_dpf import Ans.DataProcessing as dpf mech_dpf.setExtAPI(ExtAPI) analysis = ExtAPI.DataModel.Project.Model.Analyses[0] dataSource = dpf.DataSources(analysis.ResultFileName) model = dpf.Model(dataSource) op_seqv = dpf.operators.result.stress_eqv_as_mechanical() op_seqv.inputs.data_sources.Connect(dataSource) op_seqv.inputs.requested_location.Connect(dpf.locations.elemental) seqv = op_seqv.outputs.fields_container.GetData() MyThreshold = 100 op_hp = dpf.operators.filter.field_high_pass_fc() op_hp.inputs.fields_container.Connect(seqv) op_hp.inputs.threshold.Connect(MyThreshold) seqv_h = op_hp.outputs.fields_container.GetData() op_v = dpf.operators.result.elemental_volume() op_v.inputs.data_sources.Connect(dataSource) v_fc = op_v.outputs.fields_container.GetData() op_tv = dpf.operators.math.accumulate() op_tv.inputs.fieldA.Connect(v_fc[0]) tv_fc = op_tv.outputs.field.GetData() total_vol = tv_fc.Data[0] op_r = dpf.operators.scoping.rescope_fc() op_r.inputs.fields_container.Connect(v_fc) op_r.inputs.mesh_scoping.Connect(seqv_h[0].Scoping) v_fc_100 = op_r.outputs.fields_container.GetData() op_v100 = dpf.operators.math.accumulate() op_v100.inputs.fieldA.Connect(v_fc_100[0]) v100_fc = op_v100.outputs.field.GetData() vol100 = v100_fc.Data[0] print('% above 100MPa : ' + str(vol100/total_vol*100))
0