How do I add custom results to an h5dpf file?
from ansys.dpf import core as dpf dpf.start_local_server(ansys_path=r"C:\Program Files\ANSYS Inc\v252") rst_path = r"…\file.rst" model = dpf.Model(rst_path) # Metadata for the h5dpf file mesh = model.metadata.meshed_region tf = model.metadata.time_freq_support r_info = model.metadata.result_info.unit_system disp = model.results.displacement.eval() # Create a Custom Result custom_res_f = dpf.fields_factory.create_3d_vector_field(num_entities=2) custom_res_f.data = [1, 2, 3, 4, 5, 6] custom_res_f.scoping.ids = [1, 2] custom_res_fc = dpf.FieldsContainer() custom_res_fc.labels = ['time'] custom_res_fc.add_field({'time' : 1}, custom_res_f) h5_filepath = r"…\file_custom.h5" # Write to h5dpf h5 = dpf.operators.serialization.hdf5dpf_generate_result_file() # operator instantiation h5.connect(0, h5_filepath) h5.connect(1, mesh) h5.connect(2, tf) h5.connect(3, r_info) h5.connect(4, "U") h5.connect(5, disp) h5.connect(6, "Custom Result") h5.connect(7, custom_res_fc) my_ds = h5.outputs.data_sources()