Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions src/ansys/dpf/core/operators/averaging/force_summation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ class force_summation(Operator):
Type of force to be processed (0: Total forces (static, damping, and inertia)., 1 (default): Static forces, 2: Damping forces, 3: Inertia forces)
spoint: Field or FieldsContainer, optional
Field or fields container of the coordinates of the point used for moment summations. Defaults to (0,0,0).
scoping_filter: int, optional
Selected set of nodes.

- 0 (default): Sum all nodal forces for all selected nodes, excluding contact elements
- 1: Sum all nodal forces for contact nodes only.
- 2: Sum all nodal forces for all selected nodes, including contact elements.


Outputs
-------
Expand Down Expand Up @@ -79,6 +86,8 @@ class force_summation(Operator):
>>> op.inputs.force_type.connect(my_force_type)
>>> my_spoint = dpf.Field()
>>> op.inputs.spoint.connect(my_spoint)
>>> my_scoping_filter = int()
>>> op.inputs.scoping_filter.connect(my_scoping_filter)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.averaging.force_summation(
Expand All @@ -89,6 +98,7 @@ class force_summation(Operator):
... data_sources=my_data_sources,
... force_type=my_force_type,
... spoint=my_spoint,
... scoping_filter=my_scoping_filter,
... )

>>> # Get output data
Expand All @@ -109,6 +119,7 @@ def __init__(
data_sources=None,
force_type=None,
spoint=None,
scoping_filter=None,
config=None,
server=None,
):
Expand All @@ -133,6 +144,8 @@ def __init__(
self.inputs.force_type.connect(force_type)
if spoint is not None:
self.inputs.spoint.connect(spoint)
if scoping_filter is not None:
self.inputs.scoping_filter.connect(scoping_filter)

@staticmethod
def _spec() -> Specification:
Expand Down Expand Up @@ -186,6 +199,17 @@ def _spec() -> Specification:
optional=True,
document=r"""Field or fields container of the coordinates of the point used for moment summations. Defaults to (0,0,0).""",
),
9: PinSpecification(
name="scoping_filter",
type_names=["int32"],
optional=True,
document=r"""Selected set of nodes.

- 0 (default): Sum all nodal forces for all selected nodes, excluding contact elements
- 1: Sum all nodal forces for contact nodes only.
- 2: Sum all nodal forces for all selected nodes, including contact elements.
""",
),
},
map_output_pin_spec={
0: PinSpecification(
Expand Down Expand Up @@ -294,6 +318,8 @@ class InputsForceSummation(_Inputs):
>>> op.inputs.force_type.connect(my_force_type)
>>> my_spoint = dpf.Field()
>>> op.inputs.spoint.connect(my_spoint)
>>> my_scoping_filter = int()
>>> op.inputs.scoping_filter.connect(my_scoping_filter)
"""

def __init__(self, op: Operator):
Expand Down Expand Up @@ -326,6 +352,10 @@ def __init__(self, op: Operator):
force_summation._spec().input_pin(6), 6, op, -1
)
self._inputs.append(self._spoint)
self._scoping_filter: Input[int] = Input(
force_summation._spec().input_pin(9), 9, op, -1
)
self._inputs.append(self._scoping_filter)

@property
def time_scoping(self) -> Input[Scoping]:
Expand Down Expand Up @@ -474,6 +504,32 @@ def spoint(self) -> Input[Field | FieldsContainer]:
"""
return self._spoint

@property
def scoping_filter(self) -> Input[int]:
r"""Allows to connect scoping_filter input to the operator.

Selected set of nodes.

- 0 (default): Sum all nodal forces for all selected nodes, excluding contact elements
- 1: Sum all nodal forces for contact nodes only.
- 2: Sum all nodal forces for all selected nodes, including contact elements.


Returns
-------
input:
An Input instance for this pin.

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.force_summation()
>>> op.inputs.scoping_filter.connect(my_scoping_filter)
>>> # or
>>> op.inputs.scoping_filter(my_scoping_filter)
"""
return self._scoping_filter


class OutputsForceSummation(_Outputs):
"""Intermediate class used to get outputs from
Expand Down
34 changes: 0 additions & 34 deletions src/ansys/dpf/core/operators/averaging/force_summation_psd.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class force_summation_psd(Operator):

Outputs
-------
force_accumulation: FieldsContainer
Returns the sum of forces for the 1-sigma displacement solution on the scoped nodes/elements.
moment_accumulation: FieldsContainer
Returns the sum of moments for the 1-sigma displacement solution on the scoped nodes/elements.
forces_on_nodes: FieldsContainer
Expand Down Expand Up @@ -93,7 +91,6 @@ class force_summation_psd(Operator):
... )

>>> # Get output data
>>> result_force_accumulation = op.outputs.force_accumulation()
>>> result_moment_accumulation = op.outputs.moment_accumulation()
>>> result_forces_on_nodes = op.outputs.forces_on_nodes()
>>> result_moments_on_nodes = op.outputs.moments_on_nodes()
Expand Down Expand Up @@ -186,12 +183,6 @@ def _spec() -> Specification:
),
},
map_output_pin_spec={
0: PinSpecification(
name="force_accumulation",
type_names=["fields_container"],
optional=False,
document=r"""Returns the sum of forces for the 1-sigma displacement solution on the scoped nodes/elements.""",
),
1: PinSpecification(
name="moment_accumulation",
type_names=["fields_container"],
Expand Down Expand Up @@ -470,18 +461,13 @@ class OutputsForceSummationPsd(_Outputs):
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.force_summation_psd()
>>> # Connect inputs : op.inputs. ...
>>> result_force_accumulation = op.outputs.force_accumulation()
>>> result_moment_accumulation = op.outputs.moment_accumulation()
>>> result_forces_on_nodes = op.outputs.forces_on_nodes()
>>> result_moments_on_nodes = op.outputs.moments_on_nodes()
"""

def __init__(self, op: Operator):
super().__init__(force_summation_psd._spec().outputs, op)
self._force_accumulation: Output[FieldsContainer] = Output(
force_summation_psd._spec().output_pin(0), 0, op
)
self._outputs.append(self._force_accumulation)
self._moment_accumulation: Output[FieldsContainer] = Output(
force_summation_psd._spec().output_pin(1), 1, op
)
Expand All @@ -495,26 +481,6 @@ def __init__(self, op: Operator):
)
self._outputs.append(self._moments_on_nodes)

@property
def force_accumulation(self) -> Output[FieldsContainer]:
r"""Allows to get force_accumulation output of the operator

Returns the sum of forces for the 1-sigma displacement solution on the scoped nodes/elements.

Returns
-------
output:
An Output instance for this pin.

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.force_summation_psd()
>>> # Get the output from op.outputs. ...
>>> result_force_accumulation = op.outputs.force_accumulation()
"""
return self._force_accumulation

@property
def moment_accumulation(self) -> Output[FieldsContainer]:
r"""Allows to get moment_accumulation output of the operator
Expand Down
1 change: 1 addition & 0 deletions src/ansys/dpf/core/operators/utility/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from .forward_field import forward_field
from .forward_fields_container import forward_fields_container
from .forward_meshes_container import forward_meshes_container
from .get_operators import get_operators
from .hdf5dpf_workglow_provider import hdf5dpf_workglow_provider
from .html_doc import html_doc
from .incremental_concatenate_as_fc import incremental_concatenate_as_fc
Expand Down
Loading