Heat passed through contact surface with the use of PyDPF

Dimosthenis Tsalagradas
Member, Employee Posts: 2
✭✭✭
in Structures
How to calculate the heat that has passed through a contact surface with the use of PyDPF?
Tagged:
0
Comments
-
The script below measures the heat that has passed through the selected contact surface by getting the CONTA174 element heat flow and plots it at a specific time step of the analysis. Also it sums up and prints the total heat that has passed through the preferable contact surface during the whole analysis.
A prerequisite for the generation of the contact surface named selection is to add the following APDL command under the desired contact:
my_cont = cid
And the following command object before solution:
/PREP7 ESEL, S, TYPE, , my_cont CM, PCB_CONT, ELEM ALLSEL /SOLU
The PyDPF script is as follows:
from ansys.dpf import core as dpf from ansys.dpf.core.plotter import DpfPlotter import numpy as np """ Load result file and create model database """ path = "../../model/file.rth" ds = dpf.DataSources(path) model = dpf.Model(ds) mesh = model.metadata.meshed_region """ Select preferable Named Selection set in Mechanical """ get_NSs = model.metadata.available_named_selections mesh_scoping = model.metadata.named_selection("PCB_CONT_2") """ Scope Named Selection to corresponding Mesh """ scoping_op = dpf.operators.mesh.from_scoping() scoping_op.inputs.scoping.connect(mesh_scoping) scoping_op.inputs.mesh.connect(mesh) my_mesh = scoping_op.outputs.mesh() """ Get Heat Flow results at last time step """ contact_heatFlow_op = dpf.operators.result.nmisc( # time_scoping=-1, mesh_scoping=mesh_scoping, data_sources=ds, item_index=98, ) contact_heatFlow_res = contact_heatFlow_op.outputs.fields_container() """ Contour Plot: Heat Flow """ sargs = dict(title="Contact Heat Flow [J]", title_font_size=30, label_font_size=20) plot = DpfPlotter() plot.add_field(contact_heatFlow_res[0], my_mesh, show_max=True, show_min=True, notebook=False, scalar_bar_args=sargs) plot.show_figure(show_axes=True) """ Total Heat Flow through contact(s) """ heat_flow = np.sum(np.array(contact_heatFlow_res[0].data)) print("Total Heat Flow: ", round(heat_flow,2), " [J]")
0