Skip to content

Commit

Permalink
Document composite:minmax_per_element_operator (#366)
Browse files Browse the repository at this point in the history
* Add note that the critical layer indices are 1-based.

* Add note when using get_selected_indices
  • Loading branch information
roosre authored Oct 15, 2023
1 parent e8dfb77 commit 814abe7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/010_harmonic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 2 additions & 0 deletions src/ansys/dpf/composites/_composite_model_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/ansys/dpf/composites/select_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tests/basic_workflow_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 814abe7

Please sign in to comment.