From 814abe7fbd6c2e5f4cd7d8cab19c6b621c39cb83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Roos?= <105842014+roosre@users.noreply.github.com> Date: Sun, 15 Oct 2023 23:08:24 +0200 Subject: [PATCH] Document composite:minmax_per_element_operator (#366) * Add note that the critical layer indices are 1-based. * Add note when using get_selected_indices --- examples/010_harmonic_example.py | 2 ++ src/ansys/dpf/composites/_composite_model_impl.py | 2 ++ src/ansys/dpf/composites/select_indices.py | 5 +++++ tests/basic_workflow_test.py | 2 ++ 4 files changed, 11 insertions(+) diff --git a/examples/010_harmonic_example.py b/examples/010_harmonic_example.py index 6d1b6c3b7..9918e1c18 100644 --- a/examples/010_harmonic_example.py +++ b/examples/010_harmonic_example.py @@ -131,6 +131,8 @@ failure_evaluator.inputs.strains_container(strain_at_phase) failure_evaluator.inputs.mesh(composite_model.get_mesh()) + # Note: the min/max layer indices are 1-based starting with + # Workbench 2024 R1 (DPF server 7.1) minmax_per_element = dpf.Operator("composite::minmax_per_element_operator") minmax_per_element.inputs.fields_container(failure_evaluator) minmax_per_element.inputs.mesh(composite_model.get_mesh()) diff --git a/src/ansys/dpf/composites/_composite_model_impl.py b/src/ansys/dpf/composites/_composite_model_impl.py index 6a0876b76..dc6c0acb0 100644 --- a/src/ansys/dpf/composites/_composite_model_impl.py +++ b/src/ansys/dpf/composites/_composite_model_impl.py @@ -331,6 +331,8 @@ def evaluate_failure_criteria( # Ensure that sandwich criteria are evaluated evaluate_failure_criterion_per_scope_op.inputs.request_sandwich_results(True) + # Note: the min/max layer indices are 1-based starting with + # Workbench 2024 R1 (DPF server 7.1) minmax_el_op = dpf.Operator("composite::minmax_per_element_operator") minmax_el_op.inputs.fields_container( evaluate_failure_criterion_per_scope_op.outputs.failure_container diff --git a/src/ansys/dpf/composites/select_indices.py b/src/ansys/dpf/composites/select_indices.py index 288da7fab..230d7519f 100644 --- a/src/ansys/dpf/composites/select_indices.py +++ b/src/ansys/dpf/composites/select_indices.py @@ -56,6 +56,11 @@ def get_selected_indices( Notes ----- Returns an empty selection if any of the collections is empty. + + The indices (nodes, layers, and spots) are 0-based. Pay attention to this + when using the "composite::minmax_per_element_operator" or + func:`~evaluate_failure_criteria` where the min/max layer indices + are 1-based starting with Workbench 2024 R1 (DPF server 7.1). """ if layers is None: layer_indices: Collection[int] = range(element_info.n_layers) diff --git a/tests/basic_workflow_test.py b/tests/basic_workflow_test.py index c9b92922a..a92d67dd1 100644 --- a/tests/basic_workflow_test.py +++ b/tests/basic_workflow_test.py @@ -87,6 +87,8 @@ def test_basic_workflow(dpf_server, distributed_rst): failure_evaluator.inputs.stresses_container(stress_operator.outputs.fields_container) failure_evaluator.inputs.mesh(mesh_provider.outputs.mesh) + # Note: the min/max layer indices are 1-based starting with + # Workbench 2024 R1 (DPF server 7.1) minmax_per_element = dpf.Operator("composite::minmax_per_element_operator") minmax_per_element.inputs.fields_container(failure_evaluator.outputs.fields_container) minmax_per_element.inputs.mesh(mesh_provider.outputs.mesh)