Von mises stress boolean index error


When trying to plot the von mises stress with a named selection using the code below I get the following error:
_ plotter.add_field(vm_stress_nodal, mesh_region)_
IndexError: boolean index did not match indexed array along dimension 0; dimension is 1044 but corresponding boolean dimension is 348_

How do I edit my code to allow me to plot the named selection mesh and associated von mises stress ?

nameselection = named_selec[0]
mesh_scoping = mesh.named_selection(nameselection)

plot = DpfPlotter()

stress = model.results.stress(mesh_scoping=mesh_scoping).eval()
vm_stress = ops.result.stress_von_mises(data_sources=model,mesh_scoping=mesh_scoping)
stress_eqv_fields = vm_stress.outputs.fields_container()
vm_stress_nodal = stress_eqv_fields[0]

mesh_scoping = dpf.operators.scoping.on_named_selection(named_selection_name=nameselection,data_sources=model).outputs.mesh_scoping()
mesh_region = dpf.operators.mesh.from_scoping(scoping=mesh_scoping, mesh=mesh).outputs.mesh()

plotter = DpfPlotter()
plotter.add_field(vm_stress_nodal, mesh_region)



  • Rajesh Meena
    Rajesh Meena Moderator, Employee Posts: 78
    First Anniversary Solution Developer Community of Practice Member Ansys Employee 5 Likes

    @LTC This is probably because you have mix solid and shell, or it elemental nodal results. If you have small rst. please share. Else, try changing requested_location to "Nodal" or "Elemental"