How can I create Mesh scoping for individual bodies in an assembly of a MAPDL result file using DPF?

Options
Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 416
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited January 19 in Structures

How can I create Mesh scoping for individual bodies in an assembly of a MAPDL result file using DPF?

Tagged:

Comments

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 416
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    edited January 19
    Options

    Part IDs can't be scoped directly. We need to scope based on the mapdl_element_type property and and then split it further using mat property. Example below:

    import os
    from ansys.dpf import core as dpf
    from ansys.dpf.core.plotter import DpfPlotter
    
    out_path = r"\PATH\TO\RST"
    rst_path = os.path.join(out_path, "file.rst")
    
    ds = dpf.DataSources(rst_path)
    model = dpf.Model(ds)
    mesh = model.metadata.meshed_region
    
    """
    # SHELL181
    """
    
    scope_op = dpf.operators.scoping.on_property(requested_location="Elemental",
                                           property_name="mapdl_element_type",
                                           property_id=181,
                                           data_sources=ds)
    scoping = scope_op.outputs.mesh_scoping()
    print(scoping)
    
    mesh_scoping_op = dpf.operators.scoping.split_on_property_type(mesh_scoping=scoping, mesh=mesh, label1="mat")
    mesh_scoping = mesh_scoping_op.outputs.mesh_scoping.get_data()
    print(mesh_scoping)