diff --git a/examples/00-Overview/02-get_data_from_static_simulation.py b/examples/00-Overview/02-get_data_from_static_simulation.py index 5c1ae02a2..c8de4746e 100644 --- a/examples/00-Overview/02-get_data_from_static_simulation.py +++ b/examples/00-Overview/02-get_data_from_static_simulation.py @@ -10,10 +10,10 @@ ############################################################################### # Imports and loading simulation # ------------------------------ -import ansys.dpf.post as dpf +from ansys.dpf import post from ansys.dpf.post import examples -simulation = dpf.load_simulation(examples.static_rst) +simulation = post.load_simulation(examples.static_rst) print(simulation) ############################################################################### diff --git a/pyproject.toml b/pyproject.toml index af3598b3d..9c6e7d202 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ maintainers = [ {name = "PyAnsys developers", email = "pyansys.support@ansys.com"}, ] dependencies = [ - "ansys.dpf.core @ git+https://git@github.com/pyansys/pydpf-core.git", + "ansys.dpf.core", "scooby", ] classifiers = [ diff --git a/src/ansys/dpf/post/common.py b/src/ansys/dpf/post/common.py index 4e8474e81..f5f0df326 100644 --- a/src/ansys/dpf/post/common.py +++ b/src/ansys/dpf/post/common.py @@ -1,7 +1,7 @@ """Module containing the common tools for a better usage of the DPF-Post module.""" +from ansys.dpf.post.harmonic_mechanical_simulation import HarmonicMechanicalSimulation from ansys.dpf.post.modal_mechanical_simulation import ModalMechanicalSimulation -from ansys.dpf.post.simulation import HarmonicMechanicalSimulation from ansys.dpf.post.static_mechanical_simulation import StaticMechanicalSimulation from ansys.dpf.post.transient_mechanical_simulation import TransientMechanicalSimulation diff --git a/src/ansys/dpf/post/harmonic_mechanical_simulation.py b/src/ansys/dpf/post/harmonic_mechanical_simulation.py new file mode 100644 index 000000000..d32e61e88 --- /dev/null +++ b/src/ansys/dpf/post/harmonic_mechanical_simulation.py @@ -0,0 +1,2724 @@ +"""Module containing the ``HarmonicMechanicalSimulation`` class.""" +from typing import List, Tuple, Union +import warnings + +from ansys.dpf import core +from ansys.dpf.post import locations +from ansys.dpf.post.data_object import DataObject +from ansys.dpf.post.selection import Selection +from ansys.dpf.post.simulation import MechanicalSimulation, ResultCategory + + +class HarmonicMechanicalSimulation(MechanicalSimulation): + """Provides methods for mechanical harmonic simulations.""" + + def _get_result( + self, + base_name: str, + location: str, + category: ResultCategory, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + amplitude: bool = False, + sweeping_phase: Union[float, None] = 0.0, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `modes` are mutually + exclusive. + If none of the above is given, only the first mode will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + base_name: + Base name for the requested result. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + category: + Type of result requested. See the :class:`ResultCategory` class. + components: + Components to get results for. + norm: + Whether to return the norm of the results. + amplitude: + Whether to return the amplitude of the result. Overrides `sweeping_phase`. + sweeping_phase: + Sweeping phase value to extract result for. If a single `float` value is given, it + must be in degrees. Unused if `amplitude=True`. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + List of sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + named_selections: + Named selection or list of named selections to get results for. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + # Build the targeted spatial and time scoping + tot = ( + (set_ids is not None) + + (all_sets is True) + + (frequencies is not None) + + (load_steps is not None) + + (selection is not None) + ) + if tot > 1: + raise ValueError( + "Arguments all_sets, selection, set_ids, frequencies, " + "and load_steps are mutually exclusive." + ) + + tot = ( + (node_ids is not None) + + (element_ids is not None) + + (named_selections is not None) + + (selection is not None) + ) + if tot > 1: + raise ValueError( + "Arguments selection, named_selections, element_ids, " + "and node_ids are mutually exclusive" + ) + + selection = self._build_selection( + selection=selection, + set_ids=set_ids, + times=frequencies, + load_steps=load_steps, + all_sets=all_sets, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + location=location, + ) + + # Build the list of requested results + if category in [ResultCategory.scalar, ResultCategory.equivalent]: + # A scalar or equivalent result has no components + to_extract = None + columns = [base_name] + elif category in [ResultCategory.vector, ResultCategory.matrix]: + # A matrix or vector result can have components selected + to_extract, columns = self._build_components_from_components( + base_name=base_name, category=category, components=components + ) + elif category == ResultCategory.principal: + # A principal type of result can have components selected + to_extract, columns = self._build_components_from_principal( + base_name=base_name, components=components + ) + else: + raise ValueError(f"'{category}' is not a valid category value.") + + # Initialize a workflow + wf = core.Workflow(server=self._model._server) + wf.progress_bar = False + + if category == ResultCategory.equivalent and base_name[0] == "E": + force_elemental_nodal = True + # elif sweeping_phase is not None: + # force_elemental_nodal = True + else: + force_elemental_nodal = False + + # Instantiate the main result operator + result_op = self._build_result_operator( + name=base_name, + location=location, + force_elemental_nodal=force_elemental_nodal, + ) + # Its output is selected as future workflow output for now + out = result_op.outputs.fields_container + # Its inputs are selected as workflow inputs for merging with selection workflows + wf.set_input_name("time_scoping", result_op.inputs.time_scoping) + wf.set_input_name("mesh_scoping", result_op.inputs.mesh_scoping) + + wf.connect_with( + selection.time_freq_selection._selection, + output_input_names=("scoping", "time_scoping"), + ) + wf.connect_with( + selection.spatial_selection._selection, + output_input_names=("scoping", "mesh_scoping"), + ) + + # Connect data_sources and streams_container inputs of selection if necessary + if "streams" in wf.input_names: + wf.connect("streams", self._model.metadata.streams_provider) + if "data_sources" in wf.input_names: + wf.connect("data_sources", self._model.metadata.data_sources) + + # Add a step to compute principal invariants if result is principal + if category == ResultCategory.principal: + # Instantiate the required operator + principal_op = self._model.operator(name="invariants_fc") + # Corresponds to scripting name principal_invariants + principal_op.connect(0, out) + wf.add_operator(operator=principal_op) + # Set as future output of the workflow + if len(to_extract) == 1: + out = getattr(principal_op.outputs, f"fields_eig_{to_extract[0]+1}") + else: + raise NotImplementedError("Cannot combine principal results yet.") + # We need to define the behavior for storing different results in a DataFrame + + # Add a step to compute equivalent if result is equivalent + elif category == ResultCategory.equivalent: + equivalent_op = self._model.operator(name="eqv_fc") + equivalent_op.connect(0, out) + wf.add_operator(operator=equivalent_op) + # Set as future output of the workflow + out = equivalent_op.outputs.fields_container + # If a strain result, change the location now + if force_elemental_nodal: + average_op = None + if location == locations.nodal: + average_op = self._model.operator(name="to_nodal_fc") + elif location == locations.elemental: + average_op = self._model.operator(name="to_elemental_fc") + if average_op is not None: + average_op.connect(0, out) + wf.add_operator(operator=average_op) + # Set as future output of the workflow + out = average_op.outputs.fields_container + + # Add an optional component selection step if result is vector, or matrix + if ( + category + in [ + ResultCategory.vector, + ResultCategory.matrix, + ] + ) and (to_extract is not None): + # Instantiate a component selector operator + extract_op = self._model.operator(name="component_selector_fc") + # Feed it the current workflow output + extract_op.connect(0, out) + # Feed it the requested components + extract_op.connect(1, to_extract) + wf.add_operator(operator=extract_op) + # Set as future output of the workflow + out = extract_op.outputs.fields_container + + # Add an optional sweeping phase or amplitude operation if requested + # (must be after comp_selector for U) + # (must be before norm operation for U) + if sweeping_phase is not None and not amplitude: + if isinstance(sweeping_phase, int): + sweeping_phase = float(sweeping_phase) + if not isinstance(sweeping_phase, float): + raise ValueError("Argument sweeping_phase must be a float.") + sweeping_op = self._model.operator(name="sweeping_phase_fc") + sweeping_op.connect(0, out) + sweeping_op.connect(2, sweeping_phase) + sweeping_op.connect(3, "degree") + sweeping_op.connect(4, False) + wf.add_operator(operator=sweeping_op) + out = sweeping_op.outputs.fields_container + elif amplitude: + amplitude_op = self._model.operator(name="amplitude_fc") + amplitude_op.connect(0, out) + wf.add_operator(operator=amplitude_op) + out = amplitude_op.outputs.fields_container + + # Add an optional norm operation if requested + # (must be after sweeping_phase for U) + if norm: + norm_op = self._model.operator(name="norm_fc") + norm_op.connect(0, out) + wf.add_operator(operator=norm_op) + out = norm_op.outputs.fields_container + + extract_scoping = self._model.operator(name="extract_scoping") + extract_scoping.connect(0, out) + merge_scopings = self._model.operator(name="merge::scoping") + merge_scopings.connect(0, extract_scoping.outputs.mesh_scoping_as_scoping) + wf.set_output_name("scoping", merge_scopings.outputs.merged_scoping) + + # Set the workflow output + wf.set_output_name("out", out) + # Evaluate the workflow + fc = wf.get_output("out", core.types.fields_container) + + # Test for empty results + if (len(fc) == 0) or all([len(f) == 0 for f in fc]): + warnings.warn( + message=f"Returned Dataframe with columns {columns} is empty.", + category=UserWarning, + ) + # Return the result wrapped in a DPF_Dataframe + return DataObject( + fields_container=fc, + columns=columns, + index=wf.get_output("scoping", core.types.scoping).ids, + ) + + def displacement( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + # amplitude: bool = False, + # sweeping_phase: Union[float, None] = 0.0, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract displacement results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements whose nodes to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="U", + location=locations.nodal, + category=ResultCategory.vector, + components=components, + norm=norm, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def velocity( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + # amplitude: bool = False, + # sweeping_phase: Union[float, None] = 0.0, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract velocity results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements whose nodes to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="V", + location=locations.nodal, + category=ResultCategory.vector, + components=components, + norm=norm, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def acceleration( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + # amplitude: bool = False, + # sweeping_phase: Union[float, None] = 0.0, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract acceleration results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements whose nodes to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="A", + location=locations.nodal, + category=ResultCategory.vector, + components=components, + norm=norm, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + location: Union[locations, str] = locations.elemental_nodal, + ) -> DataObject: + """Extract elemental nodal stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", "XX", "XY", + "XZ", and their respective equivalents 1, 2, 3, 4, 5, 6. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=location, + category=ResultCategory.matrix, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress_elemental( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract elemental stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", "XX", "XY", + "XZ", and their respective equivalents 1, 2, 3, 4, 5, 6. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=locations.elemental, + category=ResultCategory.matrix, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress_nodal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract nodal stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", "XX", "XY", + "XZ", and their respective equivalents 1, 2, 3, 4, 5, 6. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=locations.nodal, + category=ResultCategory.matrix, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress_principal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[List[str], List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + location: Union[locations, str] = locations.elemental_nodal, + ) -> DataObject: + """Extract elemental nodal principal stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are: 1, 2, and 3. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=location, + category=ResultCategory.principal, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress_principal_elemental( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[List[str], List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract elemental principal stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are: 1, 2, and 3. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=locations.elemental, + category=ResultCategory.principal, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress_principal_nodal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[List[str], List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract nodal principal stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs pf elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are: 1, 2, and 3. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=locations.nodal, + category=ResultCategory.principal, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress_eqv_von_mises( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + location: Union[locations, str] = locations.elemental_nodal, + ) -> DataObject: + """Extract elemental nodal equivalent Von Mises stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=location, + category=ResultCategory.equivalent, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress_eqv_von_mises_elemental( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract elemental equivalent Von Mises stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=locations.elemental, + category=ResultCategory.equivalent, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def stress_eqv_von_mises_nodal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract nodal equivalent Von Mises stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="S", + location=locations.nodal, + category=ResultCategory.equivalent, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + location: Union[locations, str] = locations.elemental_nodal, + ) -> DataObject: + """Extract stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", "XX", "XY", + "XZ", and their respective equivalents 1, 2, 3, 4, 5, 6. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=location, + category=ResultCategory.matrix, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain_nodal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", "XX", "XY", + "XZ", and their respective equivalents 1, 2, 3, 4, 5, 6. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=locations.nodal, + category=ResultCategory.matrix, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain_elemental( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract stress results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", "XX", "XY", + "XZ", and their respective equivalents 1, 2, 3, 4, 5, 6. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=locations.elemental, + category=ResultCategory.matrix, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain_principal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + location: Union[locations, str] = locations.elemental_nodal, + ) -> DataObject: + """Extract elemental nodal principal elastic strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are: 1, 2, and 3. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=location, + category=ResultCategory.principal, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain_principal_nodal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract nodal principal elastic strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs pf elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are: 1, 2, and 3. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=locations.nodal, + category=ResultCategory.principal, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain_principal_elemental( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract elemental principal elastic strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are: 1, 2, and 3. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=locations.elemental, + category=ResultCategory.principal, + components=components, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain_eqv_von_mises( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + location: Union[locations, str] = locations.elemental_nodal, + ) -> DataObject: + """Extract elemental nodal equivalent Von Mises elastic strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=location, + category=ResultCategory.equivalent, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain_eqv_von_mises_elemental( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract elemental equivalent Von Mises elastic strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=locations.elemental, + category=ResultCategory.equivalent, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elastic_strain_eqv_von_mises_nodal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract nodal equivalent Von Mises elastic strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EPEL", + location=locations.nodal, + category=ResultCategory.equivalent, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def reaction_force( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract reaction force results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="RF", + location=locations.nodal, + category=ResultCategory.vector, + components=components, + amplitude=False, + sweeping_phase=None, + norm=norm, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elemental_volume( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract elemental volume results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="ENG_VOL", + location=locations.elemental, + category=ResultCategory.scalar, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def elemental_mass( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract elemental mass results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="ElementalMass", + location=locations.elemental, + category=ResultCategory.scalar, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def element_nodal_forces( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + location: Union[locations, str] = locations.elemental_nodal, + ) -> DataObject: + """Extract element nodal forces results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="ENF", + location=location, + category=ResultCategory.vector, + components=components, + amplitude=False, + sweeping_phase=None, + norm=norm, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def element_nodal_forces_nodal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract element nodal forces nodal results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="ENF", + location=locations.nodal, + category=ResultCategory.vector, + components=components, + amplitude=False, + sweeping_phase=None, + norm=norm, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def element_nodal_forces_elemental( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract element nodal forces elemental results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="ENF", + location=locations.elemental, + category=ResultCategory.vector, + components=components, + amplitude=False, + sweeping_phase=None, + norm=norm, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def nodal_force( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract nodal force results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + element_ids: + List of IDs of elements to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="F", + location=locations.nodal, + category=ResultCategory.vector, + components=components, + amplitude=False, + sweeping_phase=None, + norm=norm, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def nodal_moment( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + components: Union[str, List[str], int, List[int], None] = None, + norm: bool = False, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract nodal moment results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + element_ids: + List of IDs of elements to get results for. + components: + Components to get results for. Available components are "X", "Y", "Z", + and their respective equivalents 1, 2, 3. + norm: + Whether to return the norm of the results. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="M", + location=locations.nodal, + category=ResultCategory.vector, + components=components, + amplitude=False, + sweeping_phase=None, + norm=norm, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def element_centroids( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract element centroids results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="centroids", + location=locations.elemental, + category=ResultCategory.scalar, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def thickness( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract element thickness results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="thickness", + location=locations.elemental, + category=ResultCategory.scalar, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def element_orientations( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + location: Union[locations, str] = locations.elemental_nodal, + ) -> DataObject: + """Extract elemental nodal element orientations results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + location: + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EUL", + location=location, + category=ResultCategory.scalar, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) + + def element_orientations_elemental( + self, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract elemental element orientations results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, and `element_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EUL", + location=locations.elemental, + category=ResultCategory.scalar, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + ) + + def element_orientations_nodal( + self, + node_ids: Union[List[int], None] = None, + element_ids: Union[List[int], None] = None, + frequencies: Union[float, List[float], None] = None, + set_ids: Union[int, List[int], None] = None, + all_sets: bool = False, + load_steps: Union[ + int, List[int], Tuple[int, Union[int, List[int]]], None + ] = None, + named_selections: Union[List[str], str, None] = None, + selection: Union[Selection, None] = None, + ) -> DataObject: + """Extract nodal element orientations results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `load_steps` are mutually + exclusive. + If none of the above is given, the last frequency will be returned. + + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually + exclusive. + If none of the above is given, results will be extracted for the whole mesh. + + Args: + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + frequencies: + Frequency value or list of frequency values to get results for. + set_ids: + Sets to get results for. + A set is defined as a unique combination of {time, load step, sub-step}. + all_sets: + Whether to get results for all sets. + load_steps: + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). + named_selections: + Named selection or list of named selections to get results for. + selection: + Selection to get results for. + A Selection defines both spatial and time-like criteria for filtering. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataObject` instance. + + """ + return self._get_result( + base_name="EUL", + location=locations.nodal, + category=ResultCategory.scalar, + components=None, + amplitude=False, + sweeping_phase=None, + selection=selection, + frequencies=frequencies, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + ) diff --git a/src/ansys/dpf/post/modal_mechanical_simulation.py b/src/ansys/dpf/post/modal_mechanical_simulation.py index 020ff2fe2..609e2cac7 100644 --- a/src/ansys/dpf/post/modal_mechanical_simulation.py +++ b/src/ansys/dpf/post/modal_mechanical_simulation.py @@ -3,6 +3,7 @@ import warnings from ansys.dpf import core +from ansys.dpf.post import locations from ansys.dpf.post.data_object import DataObject from ansys.dpf.post.selection import Selection from ansys.dpf.post.simulation import MechanicalSimulation, ResultCategory @@ -27,7 +28,7 @@ def _get_result( named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, ) -> DataObject: - """Extract stress results from the simulation. + """Extract results from the simulation. Arguments `selection`, `set_ids`, `all_sets`, `frequencies`, and `modes` are mutually exclusive. @@ -41,7 +42,13 @@ def _get_result( base_name: Base name for the requested result. location: - Location requested. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. category: Type of result requested. See the :class:`ResultCategory` class. components: @@ -178,9 +185,9 @@ def _get_result( # If a strain result, change the location now if force_elemental_nodal: average_op = None - if location == core.locations.nodal: + if location == locations.nodal: average_op = self._model.operator(name="to_nodal_fc") - elif location == core.locations.elemental: + elif location == locations.elemental: average_op = self._model.operator(name="to_elemental_fc") if average_op is not None: average_op.connect(0, out) @@ -288,7 +295,7 @@ def displacement( """ return self._get_result( base_name="U", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -304,13 +311,14 @@ def displacement( def stress( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -320,11 +328,13 @@ def stress( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. - Args: + Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -340,10 +350,13 @@ def stress( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -365,7 +378,7 @@ def stress( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -419,7 +432,7 @@ def stress_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -484,7 +497,7 @@ def stress_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -499,13 +512,14 @@ def stress_nodal( def stress_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, components: Union[List[str], List[int], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -515,11 +529,13 @@ def stress_principal( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -534,10 +550,13 @@ def stress_principal( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -559,7 +578,7 @@ def stress_principal( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -612,7 +631,7 @@ def stress_principal_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -676,7 +695,7 @@ def stress_principal_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -691,12 +710,13 @@ def stress_principal_nodal( def stress_eqv_von_mises( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -706,11 +726,13 @@ def stress_eqv_von_mises( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -723,10 +745,13 @@ def stress_eqv_von_mises( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -748,7 +773,7 @@ def stress_eqv_von_mises( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -798,7 +823,7 @@ def stress_eqv_von_mises_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -859,7 +884,7 @@ def stress_eqv_von_mises_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -874,13 +899,14 @@ def stress_eqv_von_mises_nodal( def elastic_strain( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -890,11 +916,13 @@ def elastic_strain( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. - Args: + Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -910,10 +938,13 @@ def elastic_strain( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -935,7 +966,7 @@ def elastic_strain( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -992,7 +1023,7 @@ def elastic_strain_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -1054,7 +1085,7 @@ def elastic_strain_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -1069,13 +1100,14 @@ def elastic_strain_elemental( def elastic_strain_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -1085,11 +1117,13 @@ def elastic_strain_principal( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -1104,10 +1138,13 @@ def elastic_strain_principal( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -1129,7 +1166,7 @@ def elastic_strain_principal( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1185,7 +1222,7 @@ def elastic_strain_principal_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -1246,7 +1283,7 @@ def elastic_strain_principal_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -1261,12 +1298,13 @@ def elastic_strain_principal_elemental( def elastic_strain_eqv_von_mises( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -1276,11 +1314,13 @@ def elastic_strain_eqv_von_mises( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -1293,10 +1333,13 @@ def elastic_strain_eqv_von_mises( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -1318,7 +1361,7 @@ def elastic_strain_eqv_von_mises( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1368,7 +1411,7 @@ def elastic_strain_eqv_von_mises_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -1429,7 +1472,7 @@ def elastic_strain_eqv_von_mises_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -1444,12 +1487,13 @@ def elastic_strain_eqv_von_mises_nodal( def plastic_state_variable( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -1459,11 +1503,13 @@ def plastic_state_variable( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -1476,10 +1522,13 @@ def plastic_state_variable( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -1501,7 +1550,7 @@ def plastic_state_variable( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1551,7 +1600,7 @@ def plastic_state_variable_elemental( """ return self._get_result( base_name="ENL_PSV", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -1612,7 +1661,7 @@ def plastic_state_variable_nodal( """ return self._get_result( base_name="ENL_PSV", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -1627,13 +1676,14 @@ def plastic_state_variable_nodal( def plastic_strain( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -1643,11 +1693,13 @@ def plastic_strain( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. - Args: + Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -1663,10 +1715,13 @@ def plastic_strain( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -1688,7 +1743,7 @@ def plastic_strain( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1745,7 +1800,7 @@ def plastic_strain_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -1807,7 +1862,7 @@ def plastic_strain_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -1822,13 +1877,14 @@ def plastic_strain_elemental( def plastic_strain_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -1838,11 +1894,13 @@ def plastic_strain_principal( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -1857,10 +1915,13 @@ def plastic_strain_principal( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -1882,7 +1943,7 @@ def plastic_strain_principal( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1938,7 +1999,7 @@ def plastic_strain_principal_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -1999,7 +2060,7 @@ def plastic_strain_principal_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -2014,12 +2075,13 @@ def plastic_strain_principal_elemental( def plastic_strain_eqv( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -2029,11 +2091,13 @@ def plastic_strain_eqv( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -2046,10 +2110,13 @@ def plastic_strain_eqv( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -2071,7 +2138,7 @@ def plastic_strain_eqv( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2124,7 +2191,7 @@ def plastic_strain_eqv_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -2182,7 +2249,7 @@ def plastic_strain_eqv_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -2250,7 +2317,7 @@ def reaction_force( """ return self._get_result( base_name="RF", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -2309,7 +2376,7 @@ def elemental_volume( """ return self._get_result( base_name="ENG_VOL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2367,7 +2434,7 @@ def elemental_mass( """ return self._get_result( base_name="ElementalMass", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2425,7 +2492,7 @@ def element_centroids( """ return self._get_result( base_name="centroids", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2483,7 +2550,7 @@ def thickness( """ return self._get_result( base_name="thickness", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2498,12 +2565,13 @@ def thickness( def element_orientations( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -2513,11 +2581,13 @@ def element_orientations( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -2530,10 +2600,13 @@ def element_orientations( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -2555,7 +2628,7 @@ def element_orientations( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2605,7 +2678,7 @@ def element_orientations_elemental( """ return self._get_result( base_name="EUL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2666,7 +2739,7 @@ def element_orientations_nodal( """ return self._get_result( base_name="EUL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -2681,12 +2754,13 @@ def element_orientations_nodal( def hydrostatic_pressure( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -2696,11 +2770,13 @@ def hydrostatic_pressure( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -2713,10 +2789,13 @@ def hydrostatic_pressure( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -2738,7 +2817,7 @@ def hydrostatic_pressure( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2791,7 +2870,7 @@ def hydrostatic_pressure_nodal( """ return self._get_result( base_name="ENL_HPRES", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -2849,7 +2928,7 @@ def hydrostatic_pressure_elemental( """ return self._get_result( base_name="ENL_HPRES", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2864,6 +2943,7 @@ def hydrostatic_pressure_elemental( def element_nodal_forces( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, frequencies: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -2871,7 +2951,7 @@ def element_nodal_forces( modes: Union[int, List[int], None] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, set_ids: Union[int, List[int], None] = None, all_sets: bool = False, ) -> DataObject: @@ -2881,11 +2961,13 @@ def element_nodal_forces( exclusive. If none of the above is given, only the first mode will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. frequencies: @@ -2903,10 +2985,13 @@ def element_nodal_forces( Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. set_ids: Sets to get results for. Equivalent to modes. Common to all simulation types for easier scripting. @@ -2929,7 +3014,7 @@ def element_nodal_forces( set_ids=set_ids, all_sets=all_sets, modes=modes, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2989,7 +3074,7 @@ def element_nodal_forces_nodal( """ return self._get_result( base_name="ENF", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -3055,7 +3140,7 @@ def element_nodal_forces_elemental( """ return self._get_result( base_name="ENF", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.vector, components=components, norm=norm, @@ -3124,7 +3209,7 @@ def nodal_force( """ return self._get_result( base_name="F", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -3193,7 +3278,7 @@ def nodal_moment( """ return self._get_result( base_name="M", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, diff --git a/src/ansys/dpf/post/post_utility.py b/src/ansys/dpf/post/post_utility.py index eb1ae9f21..9e9e7cacc 100644 --- a/src/ansys/dpf/post/post_utility.py +++ b/src/ansys/dpf/post/post_utility.py @@ -212,7 +212,7 @@ def load_simulation( if simulation_type in [ getattr(AvailableSimulationTypes, x) for x in vars(AvailableSimulationTypes) ]: - return simulation_type_str_to_class[simulation_type](data_sources, _model) + return simulation_type_str_to_class[simulation_type](data_sources) else: raise ValueError( f"Simulation type '{simulation_type}' is not a recognized simulation type." diff --git a/src/ansys/dpf/post/simulation.py b/src/ansys/dpf/post/simulation.py index a95ed97d3..717cee511 100644 --- a/src/ansys/dpf/post/simulation.py +++ b/src/ansys/dpf/post/simulation.py @@ -1,14 +1,16 @@ """Module containing the ``Simulation`` class.""" from abc import ABC from enum import Enum +from os import PathLike import re from typing import List, Tuple, Union +import ansys.dpf.core as dpf from ansys.dpf.core import DataSources, Model from ansys.dpf.core.plotter import DpfPlotter import numpy as np -from ansys.dpf import core +from ansys.dpf.post import locations from ansys.dpf.post.mesh import Mesh from ansys.dpf.post.selection import Selection @@ -374,9 +376,9 @@ def _build_components_from_principal(self, base_name, components): def _build_result_operator( self, name: str, - location: Union[core.locations, str], + location: Union[locations, str], force_elemental_nodal: bool, - ) -> core.Operator: + ) -> dpf.Operator: op = self._model.operator(name=name) op.connect(7, self.mesh._meshed_region) if force_elemental_nodal: @@ -392,9 +394,11 @@ class MechanicalSimulation(Simulation, ABC): This class provides common methods and properties for all mechanical type simulations. """ - def __init__(self, data_sources: core.DataSources, model: core.Model): + def __init__(self, result_file: PathLike): """Instantiate a mechanical type simulation.""" - super().__init__(data_sources, model) + model = dpf.Model(result_file) + data_sources = model.metadata.data_sources + super().__init__(data_sources=data_sources, model=model) def _build_selection( self, @@ -408,7 +412,7 @@ def _build_selection( named_selections: Union[List[str], str, None] = None, element_ids: Union[List[int], None] = None, node_ids: Union[List[int], None] = None, - location: core.locations = core.locations.nodal, + location: Union[locations, str] = locations.nodal, ) -> Selection: tot = ( (node_ids is not None) @@ -429,16 +433,21 @@ def _build_selection( if named_selections: selection.select_named_selection(named_selection=named_selections) elif element_ids: - if location == core.locations.nodal: + if location == locations.nodal: selection.select_nodes_of_elements(elements=element_ids, mesh=self.mesh) else: selection.select_elements(elements=element_ids) elif node_ids: + if location != locations.nodal: + raise ValueError( + "Argument 'node_ids' can only be used if 'location' " + "is equal to 'post.locations.nodal'." + ) selection.select_nodes(nodes=node_ids) # Create the TimeFreqSelection if all_sets: selection.time_freq_selection.select_with_scoping( - core.time_freq_scoping_factory.scoping_on_all_time_freqs(self._model) + dpf.time_freq_scoping_factory.scoping_on_all_time_freqs(self._model) ) elif set_ids is not None: if isinstance(set_ids, int): @@ -513,11 +522,3 @@ def _build_selection( time_freq_sets=[self.time_freq_support.n_sets] ) return selection - - -class HarmonicMechanicalSimulation(MechanicalSimulation): - """Provides methods for mechanical harmonic simulations.""" - - def _build_time_freq_scoping(self) -> core.time_freq_scoping_factory.Scoping: - """Generate a time_freq_scoping from input arguments.""" - pass diff --git a/src/ansys/dpf/post/static_mechanical_simulation.py b/src/ansys/dpf/post/static_mechanical_simulation.py index 836f71eb6..c4d9c237e 100644 --- a/src/ansys/dpf/post/static_mechanical_simulation.py +++ b/src/ansys/dpf/post/static_mechanical_simulation.py @@ -3,6 +3,7 @@ import warnings from ansys.dpf import core +from ansys.dpf.post import locations from ansys.dpf.post.data_object import DataObject from ansys.dpf.post.selection import Selection from ansys.dpf.post.simulation import MechanicalSimulation, ResultCategory @@ -29,7 +30,7 @@ def _get_result( element_ids: Union[List[int], None] = None, named_selections: Union[List[str], str, None] = None, ) -> DataObject: - """Extract stress results from the simulation. + """Extract results from the simulation. Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually exclusive. @@ -43,7 +44,13 @@ def _get_result( base_name: Base name for the requested result. location: - Location requested. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. category: Type of result requested. See the :class:`ResultCategory` class. components: @@ -61,7 +68,9 @@ def _get_result( all_sets: Whether to get results for all sets. load_steps: - List of load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). node_ids: List of IDs of nodes to get results for. element_ids: @@ -178,9 +187,9 @@ def _get_result( # If a strain result, change the location now if force_elemental_nodal: average_op = None - if location == core.locations.nodal: + if location == locations.nodal: average_op = self._model.operator(name="to_nodal_fc") - elif location == core.locations.elemental: + elif location == locations.elemental: average_op = self._model.operator(name="to_elemental_fc") if average_op is not None: average_op.connect(0, out) @@ -276,7 +285,9 @@ def displacement( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -290,7 +301,7 @@ def displacement( """ return self._get_result( base_name="U", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -306,6 +317,7 @@ def displacement( def stress( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -316,7 +328,7 @@ def stress( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal stress results from the simulation. @@ -329,6 +341,8 @@ def stress( If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -342,17 +356,22 @@ def stress( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -369,7 +388,7 @@ def stress( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -411,7 +430,9 @@ def stress_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -425,7 +446,7 @@ def stress_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -478,7 +499,9 @@ def stress_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -492,7 +515,7 @@ def stress_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -507,6 +530,7 @@ def stress_nodal( def stress_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[List[float], None] = None, components: Union[List[str], List[int], None] = None, @@ -517,7 +541,7 @@ def stress_principal( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal principal stress results from the simulation. @@ -525,11 +549,14 @@ def stress_principal( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. + If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -542,17 +569,22 @@ def stress_principal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -569,7 +601,7 @@ def stress_principal( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -610,7 +642,9 @@ def stress_principal_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -624,7 +658,7 @@ def stress_principal_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -676,7 +710,9 @@ def stress_principal_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -690,7 +726,7 @@ def stress_principal_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -705,6 +741,7 @@ def stress_principal_nodal( def stress_eqv_von_mises( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -714,7 +751,7 @@ def stress_eqv_von_mises( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal equivalent Von Mises stress results from the simulation. @@ -722,11 +759,13 @@ def stress_eqv_von_mises( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -737,17 +776,22 @@ def stress_eqv_von_mises( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -764,7 +808,7 @@ def stress_eqv_von_mises( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -802,7 +846,9 @@ def stress_eqv_von_mises_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -816,7 +862,7 @@ def stress_eqv_von_mises_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -865,7 +911,9 @@ def stress_eqv_von_mises_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -879,7 +927,7 @@ def stress_eqv_von_mises_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -894,6 +942,7 @@ def stress_eqv_von_mises_nodal( def elastic_strain( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -904,7 +953,7 @@ def elastic_strain( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract stress results from the simulation. @@ -912,11 +961,13 @@ def elastic_strain( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -930,17 +981,22 @@ def elastic_strain( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -957,7 +1013,7 @@ def elastic_strain( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1002,7 +1058,9 @@ def elastic_strain_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1016,7 +1074,7 @@ def elastic_strain_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -1066,7 +1124,9 @@ def elastic_strain_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1080,7 +1140,7 @@ def elastic_strain_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -1095,6 +1155,7 @@ def elastic_strain_elemental( def elastic_strain_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -1105,7 +1166,7 @@ def elastic_strain_principal( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal principal elastic strain results from the simulation. @@ -1113,11 +1174,13 @@ def elastic_strain_principal( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1130,17 +1193,22 @@ def elastic_strain_principal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1157,7 +1225,7 @@ def elastic_strain_principal( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1201,7 +1269,9 @@ def elastic_strain_principal_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1215,7 +1285,7 @@ def elastic_strain_principal_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -1264,7 +1334,9 @@ def elastic_strain_principal_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1278,7 +1350,7 @@ def elastic_strain_principal_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -1293,6 +1365,7 @@ def elastic_strain_principal_elemental( def elastic_strain_eqv_von_mises( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -1302,7 +1375,7 @@ def elastic_strain_eqv_von_mises( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal equivalent Von Mises elastic strain results from the simulation. @@ -1310,11 +1383,13 @@ def elastic_strain_eqv_von_mises( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1325,17 +1400,22 @@ def elastic_strain_eqv_von_mises( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1352,7 +1432,7 @@ def elastic_strain_eqv_von_mises( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1390,7 +1470,9 @@ def elastic_strain_eqv_von_mises_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1404,7 +1486,7 @@ def elastic_strain_eqv_von_mises_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -1453,7 +1535,9 @@ def elastic_strain_eqv_von_mises_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1467,7 +1551,7 @@ def elastic_strain_eqv_von_mises_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -1482,6 +1566,7 @@ def elastic_strain_eqv_von_mises_nodal( def plastic_state_variable( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -1491,7 +1576,7 @@ def plastic_state_variable( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal plastic state variable results from the simulation. @@ -1499,11 +1584,13 @@ def plastic_state_variable( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1514,17 +1601,22 @@ def plastic_state_variable( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1541,7 +1633,7 @@ def plastic_state_variable( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1579,7 +1671,9 @@ def plastic_state_variable_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1593,7 +1687,7 @@ def plastic_state_variable_elemental( """ return self._get_result( base_name="ENL_PSV", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -1642,7 +1736,9 @@ def plastic_state_variable_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1656,7 +1752,7 @@ def plastic_state_variable_nodal( """ return self._get_result( base_name="ENL_PSV", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -1671,6 +1767,7 @@ def plastic_state_variable_nodal( def plastic_strain( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -1681,7 +1778,7 @@ def plastic_strain( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal plastic strain results from the simulation. @@ -1689,11 +1786,13 @@ def plastic_strain( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1707,17 +1806,22 @@ def plastic_strain( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1734,7 +1838,7 @@ def plastic_strain( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1779,7 +1883,9 @@ def plastic_strain_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1793,7 +1899,7 @@ def plastic_strain_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -1843,7 +1949,9 @@ def plastic_strain_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1857,7 +1965,7 @@ def plastic_strain_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -1872,6 +1980,7 @@ def plastic_strain_elemental( def plastic_strain_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -1882,7 +1991,7 @@ def plastic_strain_principal( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal principal plastic strain results from the simulation. @@ -1890,11 +1999,13 @@ def plastic_strain_principal( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1907,17 +2018,22 @@ def plastic_strain_principal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1934,7 +2050,7 @@ def plastic_strain_principal( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1978,7 +2094,9 @@ def plastic_strain_principal_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1992,7 +2110,7 @@ def plastic_strain_principal_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -2041,7 +2159,9 @@ def plastic_strain_principal_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2055,7 +2175,7 @@ def plastic_strain_principal_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -2070,6 +2190,7 @@ def plastic_strain_principal_elemental( def plastic_strain_eqv( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -2079,7 +2200,7 @@ def plastic_strain_eqv( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal equivalent plastic strain results from the simulation. @@ -2087,11 +2208,13 @@ def plastic_strain_eqv( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -2102,17 +2225,22 @@ def plastic_strain_eqv( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -2129,7 +2257,7 @@ def plastic_strain_eqv( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2170,7 +2298,9 @@ def plastic_strain_eqv_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2184,7 +2314,7 @@ def plastic_strain_eqv_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -2230,7 +2360,9 @@ def plastic_strain_eqv_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2244,7 +2376,7 @@ def plastic_strain_eqv_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -2259,6 +2391,7 @@ def plastic_strain_eqv_elemental( def creep_strain( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -2269,7 +2402,7 @@ def creep_strain( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal creep strain results from the simulation. @@ -2277,11 +2410,13 @@ def creep_strain( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -2295,17 +2430,22 @@ def creep_strain( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -2322,7 +2462,7 @@ def creep_strain( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2367,7 +2507,9 @@ def creep_strain_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2381,7 +2523,7 @@ def creep_strain_nodal( """ return self._get_result( base_name="ECR", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -2431,7 +2573,9 @@ def creep_strain_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2445,7 +2589,7 @@ def creep_strain_elemental( """ return self._get_result( base_name="ECR", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -2460,6 +2604,7 @@ def creep_strain_elemental( def creep_strain_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -2470,7 +2615,7 @@ def creep_strain_principal( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal principal creep strain results from the simulation. @@ -2478,11 +2623,13 @@ def creep_strain_principal( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -2495,17 +2642,22 @@ def creep_strain_principal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -2522,7 +2674,7 @@ def creep_strain_principal( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2566,7 +2718,9 @@ def creep_strain_principal_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2580,7 +2734,7 @@ def creep_strain_principal_nodal( """ return self._get_result( base_name="ECR", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -2629,7 +2783,9 @@ def creep_strain_principal_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2643,7 +2799,7 @@ def creep_strain_principal_elemental( """ return self._get_result( base_name="ECR", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -2658,6 +2814,7 @@ def creep_strain_principal_elemental( def creep_strain_eqv( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -2667,7 +2824,7 @@ def creep_strain_eqv( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal equivalent creep strain results from the simulation. @@ -2675,11 +2832,13 @@ def creep_strain_eqv( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -2690,17 +2849,22 @@ def creep_strain_eqv( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -2717,7 +2881,7 @@ def creep_strain_eqv( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2758,7 +2922,9 @@ def creep_strain_equivalent_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2772,7 +2938,7 @@ def creep_strain_equivalent_nodal( """ return self._get_result( base_name="ECR", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -2818,7 +2984,9 @@ def creep_strain_equivalent_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2832,7 +3000,7 @@ def creep_strain_equivalent_elemental( """ return self._get_result( base_name="ECR", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -2888,7 +3056,9 @@ def reaction_force( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2902,7 +3072,7 @@ def reaction_force( """ return self._get_result( base_name="RF", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -2918,6 +3088,7 @@ def reaction_force( def elemental_volume( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -2939,6 +3110,8 @@ def elemental_volume( If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -2949,7 +3122,9 @@ def elemental_volume( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2963,7 +3138,7 @@ def elemental_volume( """ return self._get_result( base_name="ENG_VOL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2971,7 +3146,7 @@ def elemental_volume( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -3009,7 +3184,9 @@ def elemental_mass( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3023,7 +3200,7 @@ def elemental_mass( """ return self._get_result( base_name="ElementalMass", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -3069,7 +3246,9 @@ def elemental_heat_generation( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3083,7 +3262,7 @@ def elemental_heat_generation( """ return self._get_result( base_name="EHC", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -3129,7 +3308,9 @@ def element_centroids( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3143,7 +3324,7 @@ def element_centroids( """ return self._get_result( base_name="centroids", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -3189,7 +3370,9 @@ def thickness( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3203,7 +3386,7 @@ def thickness( """ return self._get_result( base_name="thickness", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -3218,6 +3401,7 @@ def thickness( def element_orientations( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -3227,7 +3411,7 @@ def element_orientations( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal element orientations results from the simulation. @@ -3235,11 +3419,13 @@ def element_orientations( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -3250,17 +3436,22 @@ def element_orientations( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -3277,7 +3468,7 @@ def element_orientations( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -3315,7 +3506,9 @@ def element_orientations_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3329,7 +3522,7 @@ def element_orientations_elemental( """ return self._get_result( base_name="EUL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -3378,7 +3571,9 @@ def element_orientations_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3392,7 +3587,7 @@ def element_orientations_nodal( """ return self._get_result( base_name="EUL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -3438,7 +3633,9 @@ def stiffness_matrix_energy( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3452,7 +3649,7 @@ def stiffness_matrix_energy( """ return self._get_result( base_name="ENG_SE", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -3498,7 +3695,9 @@ def artificial_hourglass_energy( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3512,7 +3711,7 @@ def artificial_hourglass_energy( """ return self._get_result( base_name="ENG_AHO", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -3558,7 +3757,9 @@ def thermal_dissipation_energy( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3572,7 +3773,7 @@ def thermal_dissipation_energy( """ return self._get_result( base_name="ENG_TH", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -3618,7 +3819,9 @@ def kinetic_energy( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3632,7 +3835,7 @@ def kinetic_energy( """ return self._get_result( base_name="ENG_KE", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -3647,6 +3850,7 @@ def kinetic_energy( def hydrostatic_pressure( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -3656,7 +3860,7 @@ def hydrostatic_pressure( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract hydrostatic pressure element nodal results from the simulation. @@ -3664,11 +3868,13 @@ def hydrostatic_pressure( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -3679,7 +3885,9 @@ def hydrostatic_pressure( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3701,7 +3909,7 @@ def hydrostatic_pressure( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -3742,7 +3950,9 @@ def hydrostatic_pressure_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3756,7 +3966,7 @@ def hydrostatic_pressure_nodal( """ return self._get_result( base_name="ENL_HPRES", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -3802,7 +4012,9 @@ def hydrostatic_pressure_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3816,7 +4028,7 @@ def hydrostatic_pressure_elemental( """ return self._get_result( base_name="ENL_HPRES", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -3831,6 +4043,7 @@ def hydrostatic_pressure_elemental( def structural_temperature( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -3840,7 +4053,7 @@ def structural_temperature( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract structural temperature element nodal results from the simulation. @@ -3848,11 +4061,13 @@ def structural_temperature( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -3863,17 +4078,22 @@ def structural_temperature( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -3890,7 +4110,7 @@ def structural_temperature( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -3931,7 +4151,9 @@ def structural_temperature_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3945,7 +4167,7 @@ def structural_temperature_nodal( """ return self._get_result( base_name="BFE", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components="", selection=selection, @@ -3991,7 +4213,9 @@ def structural_temperature_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -4005,7 +4229,7 @@ def structural_temperature_elemental( """ return self._get_result( base_name="BFE", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -4020,6 +4244,7 @@ def structural_temperature_elemental( def element_nodal_forces( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -4031,7 +4256,7 @@ def element_nodal_forces( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract element nodal forces results from the simulation. @@ -4039,11 +4264,13 @@ def element_nodal_forces( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -4059,17 +4286,22 @@ def element_nodal_forces( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -4087,7 +4319,7 @@ def element_nodal_forces( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -4135,7 +4367,9 @@ def element_nodal_forces_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -4149,7 +4383,7 @@ def element_nodal_forces_nodal( """ return self._get_result( base_name="ENF", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -4203,7 +4437,9 @@ def element_nodal_forces_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -4217,7 +4453,7 @@ def element_nodal_forces_elemental( """ return self._get_result( base_name="ENF", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.vector, components=components, norm=norm, @@ -4274,7 +4510,9 @@ def nodal_force( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -4288,7 +4526,7 @@ def nodal_force( """ return self._get_result( base_name="F", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -4345,7 +4583,9 @@ def nodal_moment( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -4359,7 +4599,7 @@ def nodal_moment( """ return self._get_result( base_name="M", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, diff --git a/src/ansys/dpf/post/transient_mechanical_simulation.py b/src/ansys/dpf/post/transient_mechanical_simulation.py index 2806e2573..86f3a7cd1 100644 --- a/src/ansys/dpf/post/transient_mechanical_simulation.py +++ b/src/ansys/dpf/post/transient_mechanical_simulation.py @@ -3,6 +3,7 @@ import warnings from ansys.dpf import core +from ansys.dpf.post import locations from ansys.dpf.post.data_object import DataObject from ansys.dpf.post.selection import Selection from ansys.dpf.post.simulation import MechanicalSimulation, ResultCategory @@ -29,7 +30,7 @@ def _get_result( element_ids: Union[List[int], None] = None, named_selections: Union[List[str], str, None] = None, ) -> DataObject: - """Extract stress results from the simulation. + """Extract results from the simulation. Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually exclusive. @@ -43,7 +44,13 @@ def _get_result( base_name: Base name for the requested result. location: - Location requested. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. category: Type of result requested. See the :class:`ResultCategory` class. components: @@ -62,7 +69,9 @@ def _get_result( all_sets: Whether to get results for all sets. load_steps: - List of load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). node_ids: List of IDs of nodes to get results for. element_ids: @@ -179,9 +188,9 @@ def _get_result( # If a strain result, change the location now if force_elemental_nodal: average_op = None - if location == core.locations.nodal: + if location == locations.nodal: average_op = self._model.operator(name="to_nodal_fc") - elif location == core.locations.elemental: + elif location == locations.elemental: average_op = self._model.operator(name="to_elemental_fc") if average_op is not None: average_op.connect(0, out) @@ -281,7 +290,9 @@ def displacement( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -295,7 +306,7 @@ def displacement( """ return self._get_result( base_name="U", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -352,7 +363,9 @@ def velocity( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -366,7 +379,7 @@ def velocity( """ return self._get_result( base_name="V", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -423,7 +436,9 @@ def acceleration( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -437,7 +452,7 @@ def acceleration( """ return self._get_result( base_name="A", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -453,6 +468,7 @@ def acceleration( def stress( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -463,7 +479,7 @@ def stress( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal stress results from the simulation. @@ -471,7 +487,7 @@ def stress( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. @@ -491,17 +507,22 @@ def stress( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -518,7 +539,7 @@ def stress( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -560,7 +581,9 @@ def stress_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -574,7 +597,7 @@ def stress_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -627,7 +650,9 @@ def stress_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -641,7 +666,7 @@ def stress_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -656,6 +681,7 @@ def stress_nodal( def stress_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[List[float], None] = None, components: Union[List[str], List[int], None] = None, @@ -666,7 +692,7 @@ def stress_principal( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal principal stress results from the simulation. @@ -674,11 +700,13 @@ def stress_principal( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -691,17 +719,22 @@ def stress_principal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -718,7 +751,7 @@ def stress_principal( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -759,7 +792,9 @@ def stress_principal_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -773,7 +808,7 @@ def stress_principal_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -825,7 +860,9 @@ def stress_principal_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -839,7 +876,7 @@ def stress_principal_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -854,6 +891,7 @@ def stress_principal_nodal( def stress_eqv_von_mises( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -863,7 +901,7 @@ def stress_eqv_von_mises( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal equivalent Von Mises stress results from the simulation. @@ -871,11 +909,13 @@ def stress_eqv_von_mises( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -886,17 +926,22 @@ def stress_eqv_von_mises( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -913,7 +958,7 @@ def stress_eqv_von_mises( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -951,7 +996,9 @@ def stress_eqv_von_mises_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -965,7 +1012,7 @@ def stress_eqv_von_mises_elemental( """ return self._get_result( base_name="S", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -1014,7 +1061,9 @@ def stress_eqv_von_mises_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1028,7 +1077,7 @@ def stress_eqv_von_mises_nodal( """ return self._get_result( base_name="S", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -1043,6 +1092,7 @@ def stress_eqv_von_mises_nodal( def elastic_strain( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -1053,7 +1103,7 @@ def elastic_strain( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract stress results from the simulation. @@ -1061,11 +1111,13 @@ def elastic_strain( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1079,17 +1131,22 @@ def elastic_strain( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1106,7 +1163,7 @@ def elastic_strain( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1151,7 +1208,9 @@ def elastic_strain_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1165,7 +1224,7 @@ def elastic_strain_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -1215,7 +1274,9 @@ def elastic_strain_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1229,7 +1290,7 @@ def elastic_strain_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -1244,6 +1305,7 @@ def elastic_strain_elemental( def elastic_strain_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -1254,7 +1316,7 @@ def elastic_strain_principal( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal principal elastic strain results from the simulation. @@ -1262,11 +1324,13 @@ def elastic_strain_principal( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1279,17 +1343,22 @@ def elastic_strain_principal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1306,7 +1375,7 @@ def elastic_strain_principal( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1350,7 +1419,9 @@ def elastic_strain_principal_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1364,7 +1435,7 @@ def elastic_strain_principal_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -1413,7 +1484,9 @@ def elastic_strain_principal_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1427,7 +1500,7 @@ def elastic_strain_principal_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -1442,6 +1515,7 @@ def elastic_strain_principal_elemental( def elastic_strain_eqv_von_mises( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -1451,7 +1525,7 @@ def elastic_strain_eqv_von_mises( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal equivalent Von Mises elastic strain results from the simulation. @@ -1459,11 +1533,13 @@ def elastic_strain_eqv_von_mises( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1474,17 +1550,22 @@ def elastic_strain_eqv_von_mises( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1501,7 +1582,7 @@ def elastic_strain_eqv_von_mises( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1539,7 +1620,9 @@ def elastic_strain_eqv_von_mises_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1553,7 +1636,7 @@ def elastic_strain_eqv_von_mises_elemental( """ return self._get_result( base_name="EPEL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -1602,7 +1685,9 @@ def elastic_strain_eqv_von_mises_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1616,7 +1701,7 @@ def elastic_strain_eqv_von_mises_nodal( """ return self._get_result( base_name="EPEL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -1631,6 +1716,7 @@ def elastic_strain_eqv_von_mises_nodal( def plastic_state_variable( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -1640,7 +1726,7 @@ def plastic_state_variable( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal plastic state variable results from the simulation. @@ -1648,11 +1734,13 @@ def plastic_state_variable( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1663,17 +1751,22 @@ def plastic_state_variable( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1690,7 +1783,7 @@ def plastic_state_variable( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1728,7 +1821,9 @@ def plastic_state_variable_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1742,7 +1837,7 @@ def plastic_state_variable_elemental( """ return self._get_result( base_name="ENL_PSV", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -1791,7 +1886,9 @@ def plastic_state_variable_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1805,7 +1902,7 @@ def plastic_state_variable_nodal( """ return self._get_result( base_name="ENL_PSV", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -1820,6 +1917,7 @@ def plastic_state_variable_nodal( def plastic_strain( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -1830,7 +1928,7 @@ def plastic_strain( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal plastic strain results from the simulation. @@ -1838,11 +1936,13 @@ def plastic_strain( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -1856,17 +1956,22 @@ def plastic_strain( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -1883,7 +1988,7 @@ def plastic_strain( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -1928,7 +2033,9 @@ def plastic_strain_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -1942,7 +2049,7 @@ def plastic_strain_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.matrix, components=components, selection=selection, @@ -1992,7 +2099,9 @@ def plastic_strain_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2006,7 +2115,7 @@ def plastic_strain_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.matrix, components=components, selection=selection, @@ -2021,6 +2130,7 @@ def plastic_strain_elemental( def plastic_strain_principal( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -2031,7 +2141,7 @@ def plastic_strain_principal( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal principal plastic strain results from the simulation. @@ -2039,11 +2149,13 @@ def plastic_strain_principal( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -2056,17 +2168,22 @@ def plastic_strain_principal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -2083,7 +2200,7 @@ def plastic_strain_principal( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2127,7 +2244,9 @@ def plastic_strain_principal_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2141,7 +2260,7 @@ def plastic_strain_principal_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.principal, components=components, selection=selection, @@ -2190,7 +2309,9 @@ def plastic_strain_principal_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2204,7 +2325,7 @@ def plastic_strain_principal_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.principal, components=components, selection=selection, @@ -2219,6 +2340,7 @@ def plastic_strain_principal_elemental( def plastic_strain_eqv( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -2228,7 +2350,7 @@ def plastic_strain_eqv( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal equivalent plastic strain results from the simulation. @@ -2236,11 +2358,13 @@ def plastic_strain_eqv( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -2251,17 +2375,22 @@ def plastic_strain_eqv( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -2278,7 +2407,7 @@ def plastic_strain_eqv( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2319,7 +2448,9 @@ def plastic_strain_eqv_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2333,7 +2464,7 @@ def plastic_strain_eqv_nodal( """ return self._get_result( base_name="EPPL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.equivalent, components=None, selection=selection, @@ -2379,7 +2510,9 @@ def plastic_strain_eqv_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2393,7 +2526,7 @@ def plastic_strain_eqv_elemental( """ return self._get_result( base_name="EPPL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.equivalent, components=None, selection=selection, @@ -2449,7 +2582,9 @@ def reaction_force( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2463,7 +2598,7 @@ def reaction_force( """ return self._get_result( base_name="RF", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -2510,7 +2645,9 @@ def elemental_volume( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2524,7 +2661,7 @@ def elemental_volume( """ return self._get_result( base_name="ENG_VOL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2570,7 +2707,9 @@ def elemental_mass( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2584,7 +2723,7 @@ def elemental_mass( """ return self._get_result( base_name="ElementalMass", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2630,7 +2769,9 @@ def elemental_heat_generation( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2644,7 +2785,7 @@ def elemental_heat_generation( """ return self._get_result( base_name="EHC", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2690,7 +2831,9 @@ def element_centroids( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2704,7 +2847,7 @@ def element_centroids( """ return self._get_result( base_name="centroids", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2750,7 +2893,9 @@ def thickness( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2764,7 +2909,7 @@ def thickness( """ return self._get_result( base_name="thickness", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2779,6 +2924,7 @@ def thickness( def element_orientations( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -2788,7 +2934,7 @@ def element_orientations( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract elemental nodal element orientations results from the simulation. @@ -2796,11 +2942,13 @@ def element_orientations( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -2811,17 +2959,22 @@ def element_orientations( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -2838,7 +2991,7 @@ def element_orientations( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -2876,7 +3029,9 @@ def element_orientations_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2890,7 +3045,7 @@ def element_orientations_elemental( """ return self._get_result( base_name="EUL", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -2939,7 +3094,9 @@ def element_orientations_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -2953,7 +3110,7 @@ def element_orientations_nodal( """ return self._get_result( base_name="EUL", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -2999,7 +3156,9 @@ def artificial_hourglass_energy( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3013,7 +3172,7 @@ def artificial_hourglass_energy( """ return self._get_result( base_name="ENG_AHO", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -3059,7 +3218,9 @@ def thermal_dissipation_energy( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3073,7 +3234,7 @@ def thermal_dissipation_energy( """ return self._get_result( base_name="ENG_TH", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -3119,7 +3280,9 @@ def kinetic_energy( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3133,7 +3296,7 @@ def kinetic_energy( """ return self._get_result( base_name="ENG_KE", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -3148,6 +3311,7 @@ def kinetic_energy( def hydrostatic_pressure( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -3157,7 +3321,7 @@ def hydrostatic_pressure( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract hydrostatic pressure element nodal results from the simulation. @@ -3165,11 +3329,13 @@ def hydrostatic_pressure( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -3180,17 +3346,22 @@ def hydrostatic_pressure( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -3207,7 +3378,7 @@ def hydrostatic_pressure( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -3248,7 +3419,9 @@ def hydrostatic_pressure_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3262,7 +3435,7 @@ def hydrostatic_pressure_nodal( """ return self._get_result( base_name="ENL_HPRES", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components=None, selection=selection, @@ -3308,7 +3481,9 @@ def hydrostatic_pressure_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3322,7 +3497,7 @@ def hydrostatic_pressure_elemental( """ return self._get_result( base_name="ENL_HPRES", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components=None, selection=selection, @@ -3337,6 +3512,7 @@ def hydrostatic_pressure_elemental( def structural_temperature( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, set_ids: Union[int, List[int], None] = None, @@ -3346,7 +3522,7 @@ def structural_temperature( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract structural temperature element nodal results from the simulation. @@ -3354,11 +3530,13 @@ def structural_temperature( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -3369,17 +3547,22 @@ def structural_temperature( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -3396,7 +3579,7 @@ def structural_temperature( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -3437,7 +3620,9 @@ def structural_temperature_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3451,7 +3636,7 @@ def structural_temperature_nodal( """ return self._get_result( base_name="BFE", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.scalar, components="", selection=selection, @@ -3497,7 +3682,9 @@ def structural_temperature_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3511,7 +3698,7 @@ def structural_temperature_elemental( """ return self._get_result( base_name="BFE", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.scalar, components="", selection=selection, @@ -3526,6 +3713,7 @@ def structural_temperature_elemental( def element_nodal_forces( self, + node_ids: Union[List[int], None] = None, element_ids: Union[List[int], None] = None, times: Union[float, List[float], None] = None, components: Union[str, List[str], int, List[int], None] = None, @@ -3537,7 +3725,7 @@ def element_nodal_forces( ] = None, named_selections: Union[List[str], str, None] = None, selection: Union[Selection, None] = None, - location: Union[core.locations, str] = core.locations.elemental_nodal, + location: Union[locations, str] = locations.elemental_nodal, ) -> DataObject: """Extract element nodal forces results from the simulation. @@ -3545,11 +3733,13 @@ def element_nodal_forces( exclusive. If none of the above is given, only the last result will be returned. - Arguments `selection`, `named_selections`, and `element_ids` are mutually + Arguments `selection`, `named_selections`, `element_ids`, and `node_ids` are mutually exclusive. If none of the above is given, results will be extracted for the whole mesh. Args: + node_ids: + List of IDs of nodes to get results for. element_ids: List of IDs of elements to get results for. times: @@ -3565,17 +3755,22 @@ def element_nodal_forces( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: Selection to get results for. A Selection defines both spatial and time-like criteria for filtering. location: - Location to extract results at. Available locations are listed in `core.locations` - and are: "Nodal", "Elemental", and "ElementalNodal". The default "ElementalNodal" - gives results with a value for every node at each element. "Elemental" gives results - with one value for each element. "Nodal" gives results with one value for each node. + Location to extract results at. Available locations are listed in + class:`post.locations` and are: `post.locations.nodal`, + `post.locations.elemental`, and `post.locations.elemental_nodal`. + Using the default `post.locations.elemental_nodal` results in a value + for every node at each element. Similarly, using `post.locations.elemental` + gives results with one value for each element, while using `post.locations.nodal` + gives results with one value for each node. Returns ------- @@ -3593,7 +3788,7 @@ def element_nodal_forces( set_ids=set_ids, all_sets=all_sets, load_steps=load_steps, - node_ids=None, + node_ids=node_ids, element_ids=element_ids, named_selections=named_selections, ) @@ -3641,7 +3836,9 @@ def element_nodal_forces_nodal( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3655,7 +3852,7 @@ def element_nodal_forces_nodal( """ return self._get_result( base_name="ENF", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -3709,7 +3906,9 @@ def element_nodal_forces_elemental( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3723,7 +3922,7 @@ def element_nodal_forces_elemental( """ return self._get_result( base_name="ENF", - location=core.locations.elemental, + location=locations.elemental, category=ResultCategory.vector, components=components, norm=norm, @@ -3780,7 +3979,9 @@ def nodal_force( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3794,7 +3995,7 @@ def nodal_force( """ return self._get_result( base_name="F", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, @@ -3851,7 +4052,9 @@ def nodal_moment( all_sets: Whether to get results for all sets. load_steps: - Load steps to get results for. + Load step number or list of load step numbers to get results for. + One can specify sub-steps of a load step with a tuple of format: + (load-step, sub-step number or list of sub-step numbers). named_selections: Named selection or list of named selections to get results for. selection: @@ -3865,7 +4068,7 @@ def nodal_moment( """ return self._get_result( base_name="M", - location=core.locations.nodal, + location=locations.nodal, category=ResultCategory.vector, components=components, norm=norm, diff --git a/tests/test_load_simulation.py b/tests/test_load_simulation.py index 35e3f3aba..db1b93df7 100644 --- a/tests/test_load_simulation.py +++ b/tests/test_load_simulation.py @@ -1,17 +1,17 @@ import pytest -import ansys.dpf.post as dpf +from ansys.dpf import post from ansys.dpf.post.common import AvailableSimulationTypes +from ansys.dpf.post.harmonic_mechanical_simulation import HarmonicMechanicalSimulation from ansys.dpf.post.modal_mechanical_simulation import ModalMechanicalSimulation -from ansys.dpf.post.simulation import HarmonicMechanicalSimulation from ansys.dpf.post.static_mechanical_simulation import StaticMechanicalSimulation from ansys.dpf.post.transient_mechanical_simulation import TransientMechanicalSimulation def test_load_simulation_static_mechanical(simple_bar, complex_model): - simulation = dpf.load_simulation(data_sources=simple_bar) + simulation = post.load_simulation(data_sources=simple_bar) assert type(simulation) == StaticMechanicalSimulation - simulation = dpf.load_simulation( + simulation = post.load_simulation( data_sources=complex_model, simulation_type=AvailableSimulationTypes.static_mechanical, ) @@ -19,9 +19,9 @@ def test_load_simulation_static_mechanical(simple_bar, complex_model): def test_load_simulation_transient_mechanical(plate_msup, complex_model): - simulation = dpf.load_simulation(data_sources=plate_msup) + simulation = post.load_simulation(data_sources=plate_msup) assert type(simulation) == TransientMechanicalSimulation - simulation = dpf.load_simulation( + simulation = post.load_simulation( data_sources=complex_model, simulation_type=AvailableSimulationTypes.transient_mechanical, ) @@ -29,9 +29,9 @@ def test_load_simulation_transient_mechanical(plate_msup, complex_model): def test_load_simulation_modal_mechanical(modalallkindofcomplexity, complex_model): - simulation = dpf.load_simulation(data_sources=modalallkindofcomplexity) + simulation = post.load_simulation(data_sources=modalallkindofcomplexity) assert type(simulation) == ModalMechanicalSimulation - simulation = dpf.load_simulation( + simulation = post.load_simulation( data_sources=complex_model, simulation_type=AvailableSimulationTypes.transient_mechanical, ) @@ -39,9 +39,9 @@ def test_load_simulation_modal_mechanical(modalallkindofcomplexity, complex_mode def test_load_simulation_harmonic_mechanical(complex_model, simple_bar): - simulation = dpf.load_simulation(data_sources=complex_model) + simulation = post.load_simulation(data_sources=complex_model) assert type(simulation) == HarmonicMechanicalSimulation - simulation = dpf.load_simulation( + simulation = post.load_simulation( data_sources=simple_bar, simulation_type=AvailableSimulationTypes.harmonic_mechanical, ) @@ -50,7 +50,7 @@ def test_load_simulation_harmonic_mechanical(complex_model, simple_bar): def test_load_simulation_raise_simulation_type(simple_bar): with pytest.raises(ValueError, match="is not a recognized simulation type"): - _ = dpf.load_simulation( + _ = post.load_simulation( data_sources=simple_bar, simulation_type="test", ) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index eab6fb34d..f824d2e8f 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -3,18 +3,33 @@ import pytest from pytest import fixture -import ansys.dpf.post as dpf +from ansys.dpf import post from ansys.dpf.post.common import AvailableSimulationTypes +from ansys.dpf.post.harmonic_mechanical_simulation import HarmonicMechanicalSimulation +from ansys.dpf.post.modal_mechanical_simulation import ModalMechanicalSimulation +from ansys.dpf.post.static_mechanical_simulation import StaticMechanicalSimulation +from ansys.dpf.post.transient_mechanical_simulation import TransientMechanicalSimulation @fixture def static_simulation(static_rst): - return dpf.load_simulation( + return post.load_simulation( data_sources=static_rst, simulation_type=AvailableSimulationTypes.static_mechanical, ) +def test_simulation_init(static_rst): + simulation = StaticMechanicalSimulation(static_rst) + assert simulation is not None + simulation = TransientMechanicalSimulation(static_rst) + assert simulation is not None + simulation = ModalMechanicalSimulation(static_rst) + assert simulation is not None + simulation = HarmonicMechanicalSimulation(static_rst) + assert simulation is not None + + def test_simulation_results(static_simulation): results = static_simulation.results assert len(results) == 12 @@ -38,7 +53,7 @@ def test_simulation_loads(static_simulation): def test_simulation_mesh(static_simulation): mesh = static_simulation.mesh - assert isinstance(mesh, dpf.mesh.Mesh) + assert isinstance(mesh, post.mesh.Mesh) def test_simulation_named_selections(static_simulation): @@ -49,7 +64,7 @@ def test_simulation_named_selections(static_simulation): def test_simulation_active_selection(static_simulation): assert static_simulation.active_selection is None - selection = dpf.selection.Selection() + selection = post.selection.Selection() static_simulation.activate_selection(selection=selection) assert static_simulation.active_selection == selection static_simulation.deactivate_selection() @@ -87,6 +102,14 @@ def test_raise_mutually_exclusive(self, static_simulation): with pytest.raises(ValueError, match="exclusive"): _ = static_simulation.displacement(load_steps=[1], set_ids=[1]) + def test_raise_node_ids_elemental(self, static_simulation): + with pytest.raises( + ValueError, match="Argument 'node_ids' can only be used if 'location'" + ): + _ = static_simulation.stress( + node_ids=[42], location=post.locations.elemental + ) + def test_displacement(self, static_simulation): displacement_x = static_simulation.displacement( components=["X"], node_ids=[42, 43, 44] @@ -202,7 +225,7 @@ def test_stress(self, static_simulation): assert stress_x._fc.get_time_scoping().ids == [1] field = stress_x._fc[0] op = static_simulation._model.operator("SX") - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (64,) @@ -214,7 +237,7 @@ def test_stress_elemental(self, static_simulation): assert stress_x._fc.get_time_scoping().ids == [1] field = stress_x._fc[0] op = static_simulation._model.operator("SX") - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (8,) @@ -226,7 +249,7 @@ def test_stress_nodal(self, static_simulation): assert stress_x._fc.get_time_scoping().ids == [1] field = stress_x._fc[0] op = static_simulation._model.operator("SX") - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (81,) @@ -238,7 +261,7 @@ def test_stress_principal(self, static_simulation): assert result._fc.get_time_scoping().ids == [1] field = result._fc[0] op = static_simulation._model.operator("S1") - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (64,) @@ -250,7 +273,7 @@ def test_stress_principal_nodal(self, static_simulation): assert result._fc.get_time_scoping().ids == [1] field = result._fc[0] op = static_simulation._model.operator("S2") - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (81,) @@ -262,7 +285,7 @@ def test_stress_principal_elemental(self, static_simulation): assert result._fc.get_time_scoping().ids == [1] field = result._fc[0] op = static_simulation._model.operator("S3") - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (8,) @@ -274,7 +297,7 @@ def test_stress_eqv_von_mises(self, static_simulation): assert result._fc.get_time_scoping().ids == [1] field = result._fc[0] op = static_simulation._model.operator("S_eqv") - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (64,) @@ -286,7 +309,7 @@ def test_stress_eqv_von_mises_elemental(self, static_simulation): assert stress_vm._fc.get_time_scoping().ids == [1] field = stress_vm._fc[0] op = static_simulation._model.operator("S_eqv") - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (8,) @@ -298,7 +321,7 @@ def test_stress_eqv_von_mises_nodal(self, static_simulation): assert stress_vm._fc.get_time_scoping().ids == [1] field = stress_vm._fc[0] op = static_simulation._model.operator("S_eqv") - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (81,) @@ -388,7 +411,7 @@ def test_structural_temperature_nodal(self, static_simulation): assert structural_temperature_nodal._fc.get_time_scoping().ids == [1] field = structural_temperature_nodal._fc[0] op = static_simulation._model.operator("BFE") - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (81,) @@ -402,14 +425,14 @@ def test_structural_temperature_elemental(self, static_simulation): assert structural_temperature_elemental._fc.get_time_scoping().ids == [1] field = structural_temperature_elemental._fc[0] op = static_simulation._model.operator("BFE") - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert field.data.shape == (12,) assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces(self, allkindofcomplexity): - static_simulation = dpf.load_simulation(data_sources=allkindofcomplexity) + static_simulation = post.load_simulation(data_sources=allkindofcomplexity) element_nodal_forces = static_simulation.element_nodal_forces() assert len(element_nodal_forces._fc) == 1 assert element_nodal_forces._fc.get_time_scoping().ids == [1] @@ -421,36 +444,91 @@ def test_element_nodal_forces(self, allkindofcomplexity): assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces_nodal(self, allkindofcomplexity): - static_simulation = dpf.load_simulation(data_sources=allkindofcomplexity) + static_simulation = post.load_simulation(data_sources=allkindofcomplexity) element_nodal_forces = static_simulation.element_nodal_forces_nodal() assert len(element_nodal_forces._fc) == 3 assert element_nodal_forces._fc.get_time_scoping().ids == [1] field = element_nodal_forces._fc[0] op = static_simulation._model.operator("ENF") - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 3 assert field.data.shape == (14982, 3) assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces_elemental(self, allkindofcomplexity): - static_simulation = dpf.load_simulation(data_sources=allkindofcomplexity) + static_simulation = post.load_simulation(data_sources=allkindofcomplexity) element_nodal_forces = static_simulation.element_nodal_forces_elemental() assert len(element_nodal_forces._fc) == 3 assert element_nodal_forces._fc.get_time_scoping().ids == [1] field = element_nodal_forces._fc[0] op = static_simulation._model.operator("ENF") - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 3 assert field.data.shape == (9433, 3) assert np.allclose(field.data, field_ref.data) + def test_elastic_strain_eqv_von_mises(self, static_simulation): + result = static_simulation.elastic_strain_eqv_von_mises(set_ids=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = static_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=static_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = static_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + field_ref = equivalent_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises_nodal(self, static_simulation): + result = static_simulation.elastic_strain_eqv_von_mises_nodal(set_ids=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = static_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=static_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = static_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + average_op = static_simulation._model.operator(name="to_nodal_fc") + average_op.connect(0, equivalent_op.outputs.fields_container) + field_ref = average_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises_elemental(self, static_simulation): + result = static_simulation.elastic_strain_eqv_von_mises_elemental(set_ids=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = static_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=static_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = static_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + average_op = static_simulation._model.operator(name="to_elemental_fc") + average_op.connect(0, equivalent_op.outputs.fields_container) + field_ref = average_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + class TestTransientMechanicalSimulation: @fixture def transient_simulation(self, plate_msup): - return dpf.load_simulation( + return post.load_simulation( data_sources=plate_msup, simulation_type=AvailableSimulationTypes.transient_mechanical, ) @@ -571,7 +649,7 @@ def test_stress(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -586,7 +664,7 @@ def test_stress_elemental(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -601,7 +679,7 @@ def test_stress_nodal(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -616,7 +694,7 @@ def test_stress_principal(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -631,7 +709,7 @@ def test_stress_principal_nodal(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -648,7 +726,7 @@ def test_stress_principal_elemental(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -663,7 +741,7 @@ def test_stress_eqv_von_mises(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -678,7 +756,7 @@ def test_stress_eqv_von_mises_elemental(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -693,7 +771,7 @@ def test_stress_eqv_von_mises_nodal(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -708,7 +786,7 @@ def test_elastic_strain(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -725,7 +803,7 @@ def test_elastic_strain_elemental(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -740,7 +818,7 @@ def test_elastic_strain_nodal(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -757,7 +835,7 @@ def test_elastic_strain_principal(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) principal_op = transient_simulation._model.operator(name="invariants_fc") principal_op.connect(0, op.outputs.fields_container) field_ref = principal_op.outputs.fields_eig_1()[0] @@ -776,7 +854,7 @@ def test_elastic_strain_principal_nodal(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) principal_op = transient_simulation._model.operator(name="invariants_fc") principal_op.connect(0, op.outputs.fields_container) field_ref = principal_op.outputs.fields_eig_2()[0] @@ -795,7 +873,7 @@ def test_elastic_strain_principal_elemental(self, transient_simulation): 2, server=transient_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) principal_op = transient_simulation._model.operator(name="invariants_fc") principal_op.connect(0, op.outputs.fields_container) field_ref = principal_op.outputs.fields_eig_3()[0] @@ -803,7 +881,7 @@ def test_elastic_strain_principal_elemental(self, transient_simulation): assert np.allclose(field.data, field_ref.data) def test_reaction_force(self, allkindofcomplexity): - transient_simulation = dpf.load_simulation( + transient_simulation = post.load_simulation( data_sources=allkindofcomplexity, simulation_type=AvailableSimulationTypes.transient_mechanical, ) @@ -873,7 +951,7 @@ def test_structural_temperature_nodal(self, transient_simulation): assert result._fc.get_time_scoping().ids == [2] field = result._fc[0] op = transient_simulation._model.operator("BFE") - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -884,13 +962,13 @@ def test_structural_temperature_elemental(self, transient_simulation): assert result._fc.get_time_scoping().ids == [2] field = result._fc[0] op = transient_simulation._model.operator("BFE") - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces(self, allkindofcomplexity): - transient_simulation = dpf.load_simulation( + transient_simulation = post.load_simulation( data_sources=allkindofcomplexity, simulation_type=AvailableSimulationTypes.transient_mechanical, ) @@ -904,7 +982,7 @@ def test_element_nodal_forces(self, allkindofcomplexity): assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces_nodal(self, allkindofcomplexity): - transient_simulation = dpf.load_simulation( + transient_simulation = post.load_simulation( data_sources=allkindofcomplexity, simulation_type=AvailableSimulationTypes.transient_mechanical, ) @@ -913,13 +991,13 @@ def test_element_nodal_forces_nodal(self, allkindofcomplexity): assert result._fc.get_time_scoping().ids == [1] field = result._fc[0] op = transient_simulation._model.operator("ENF") - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 3 assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces_elemental(self, allkindofcomplexity): - transient_simulation = dpf.load_simulation( + transient_simulation = post.load_simulation( data_sources=allkindofcomplexity, simulation_type=AvailableSimulationTypes.transient_mechanical, ) @@ -928,16 +1006,73 @@ def test_element_nodal_forces_elemental(self, allkindofcomplexity): assert result._fc.get_time_scoping().ids == [1] field = result._fc[0] op = transient_simulation._model.operator("ENF") - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 3 assert np.allclose(field.data, field_ref.data) + def test_elastic_strain_eqv_von_mises(self, transient_simulation): + result = transient_simulation.elastic_strain_eqv_von_mises(set_ids=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = transient_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=transient_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = transient_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + field_ref = equivalent_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises_nodal(self, transient_simulation): + result = transient_simulation.elastic_strain_eqv_von_mises_nodal(set_ids=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = transient_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=transient_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = transient_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + average_op = transient_simulation._model.operator(name="to_nodal_fc") + average_op.connect(0, equivalent_op.outputs.fields_container) + field_ref = average_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises_elemental(self, transient_simulation): + result = transient_simulation.elastic_strain_eqv_von_mises_elemental( + set_ids=[1] + ) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = transient_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=transient_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = transient_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + average_op = transient_simulation._model.operator(name="to_elemental_fc") + average_op.connect(0, equivalent_op.outputs.fields_container) + field_ref = average_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + class TestModalMechanicalSimulation: @fixture def modal_simulation(self, modalallkindofcomplexity): - return dpf.load_simulation( + return post.load_simulation( data_sources=modalallkindofcomplexity, simulation_type=AvailableSimulationTypes.modal_mechanical, ) @@ -971,7 +1106,7 @@ def test_displacement(self, modal_simulation): assert np.allclose(field.data, field_ref.data) def test_reaction_force(self, allkindofcomplexity): - modal_simulation = dpf.load_simulation( + modal_simulation = post.load_simulation( data_sources=allkindofcomplexity, simulation_type=AvailableSimulationTypes.modal_mechanical, ) @@ -985,7 +1120,7 @@ def test_reaction_force(self, allkindofcomplexity): assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces(self, allkindofcomplexity): - modal_simulation = dpf.load_simulation( + modal_simulation = post.load_simulation( data_sources=allkindofcomplexity, simulation_type=AvailableSimulationTypes.modal_mechanical, ) @@ -999,7 +1134,7 @@ def test_element_nodal_forces(self, allkindofcomplexity): assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces_nodal(self, allkindofcomplexity): - modal_simulation = dpf.load_simulation( + modal_simulation = post.load_simulation( data_sources=allkindofcomplexity, simulation_type=AvailableSimulationTypes.modal_mechanical, ) @@ -1008,13 +1143,13 @@ def test_element_nodal_forces_nodal(self, allkindofcomplexity): assert result._fc.get_time_scoping().ids == [1] field = result._fc[0] op = modal_simulation._model.operator("ENF") - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 3 assert np.allclose(field.data, field_ref.data) def test_element_nodal_forces_elemental(self, allkindofcomplexity): - modal_simulation = dpf.load_simulation( + modal_simulation = post.load_simulation( data_sources=allkindofcomplexity, simulation_type=AvailableSimulationTypes.modal_mechanical, ) @@ -1023,7 +1158,7 @@ def test_element_nodal_forces_elemental(self, allkindofcomplexity): assert result._fc.get_time_scoping().ids == [1] field = result._fc[0] op = modal_simulation._model.operator("ENF") - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 3 assert np.allclose(field.data, field_ref.data) @@ -1038,7 +1173,7 @@ def test_stress(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1053,7 +1188,7 @@ def test_stress_elemental(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1068,7 +1203,7 @@ def test_stress_nodal(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1083,7 +1218,7 @@ def test_stress_principal(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1098,7 +1233,7 @@ def test_stress_principal_nodal(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1113,7 +1248,7 @@ def test_stress_principal_elemental(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1128,7 +1263,7 @@ def test_stress_eqv_von_mises(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1143,7 +1278,7 @@ def test_stress_eqv_von_mises_elemental(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1158,7 +1293,7 @@ def test_stress_eqv_von_mises_nodal(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1184,7 +1319,7 @@ def test_elastic_strain(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1199,7 +1334,7 @@ def test_elastic_strain_elemental(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1214,7 +1349,7 @@ def test_elastic_strain_nodal(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) + op.connect(9, post.locations.nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1229,7 +1364,7 @@ def test_elastic_strain_principal(self, modal_simulation): 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental_nodal) + op.connect(9, post.locations.elemental_nodal) principal_op = modal_simulation._model.operator(name="invariants_fc") principal_op.connect(0, op.outputs.fields_container) field_ref = principal_op.outputs.fields_eig_1()[0] @@ -1243,13 +1378,15 @@ def test_elastic_strain_principal_nodal(self, modal_simulation): assert len(result._fc) == 2 assert result._fc.get_time_scoping().ids == [2] field = result._fc[0] - op = modal_simulation._model.operator("EPEL2") + op = modal_simulation._model.operator("EPEL") time_scoping = core.time_freq_scoping_factory.scoping_by_set( 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.nodal) - field_ref = op.eval()[0] + op.connect(9, post.locations.nodal) + principal_op = modal_simulation._model.operator(name="invariants_fc") + principal_op.connect(0, op.outputs.fields_container) + field_ref = principal_op.outputs.fields_eig_2()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) @@ -1260,12 +1397,528 @@ def test_elastic_strain_principal_elemental(self, modal_simulation): assert len(result._fc) == 2 assert result._fc.get_time_scoping().ids == [2] field = result._fc[0] - op = modal_simulation._model.operator("EPEL3") + op = modal_simulation._model.operator("EPEL") time_scoping = core.time_freq_scoping_factory.scoping_by_set( 2, server=modal_simulation._model._server ) op.connect(0, time_scoping) - op.connect(9, core.locations.elemental) + op.connect(9, post.locations.elemental) + principal_op = modal_simulation._model.operator(name="invariants_fc") + principal_op.connect(0, op.outputs.fields_container) + field_ref = principal_op.outputs.fields_eig_3()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises(self, modal_simulation): + result = modal_simulation.elastic_strain_eqv_von_mises(set_ids=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = modal_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=modal_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = modal_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + field_ref = equivalent_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises_nodal(self, modal_simulation): + result = modal_simulation.elastic_strain_eqv_von_mises_nodal(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = modal_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=modal_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = modal_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + average_op = modal_simulation._model.operator(name="to_nodal_fc") + average_op.connect(0, equivalent_op.outputs.fields_container) + field_ref = average_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises_elemental(self, modal_simulation): + result = modal_simulation.elastic_strain_eqv_von_mises_elemental(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = modal_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=modal_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = modal_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + average_op = modal_simulation._model.operator(name="to_elemental_fc") + average_op.connect(0, equivalent_op.outputs.fields_container) + field_ref = average_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + +class TestHarmonicMechanicalSimulation: + @fixture + def harmonic_simulation(self, complex_model): + return post.load_simulation( + data_sources=complex_model, + simulation_type=AvailableSimulationTypes.harmonic_mechanical, + ) + + def test_displacement(self, harmonic_simulation): + print(harmonic_simulation) + + result = harmonic_simulation.displacement(components=["X"], node_ids=[2, 3, 4]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("UX") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + mesh_scoping = core.mesh_scoping_factory.nodal_scoping( + [2, 3, 4], server=harmonic_simulation._model._server + ) + op.connect(1, mesh_scoping) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert field.data.shape == (3,) + assert np.allclose(field.data, field_ref.data) + + # def test_amplitude(self, harmonic_simulation): + # result = harmonic_simulation.displacement( + # components=["X"], node_ids=[2, 3, 4], amplitude=True + # ) + # assert len(result._fc) == 1 + # assert result._fc.get_time_scoping().ids == [1] + # field = result._fc[0] + # + # op = harmonic_simulation._model.operator("UX") + # time_scoping = core.time_freq_scoping_factory.scoping_by_set( + # 1, server=harmonic_simulation._model._server + # ) + # op.connect(0, time_scoping) + # mesh_scoping = core.mesh_scoping_factory.nodal_scoping( + # [2, 3, 4], server=harmonic_simulation._model._server + # ) + # op.connect(1, mesh_scoping) + # amplitude_op = harmonic_simulation._model.operator("amplitude_fc") + # amplitude_op.connect(0, op.outputs.fields_container) + # field_ref = amplitude_op.eval()[0] + # + # assert field.component_count == 1 + # assert field.data.shape == (3,) + # assert np.allclose(field.data, field_ref.data) + + # def test_velocity(self, harmonic_simulation): + # print(harmonic_simulation) + # + # result = harmonic_simulation.velocity(components=["X"], node_ids=[2, 3, 4]) + # assert len(result._fc) == 2 + # assert result._fc.get_time_scoping().ids == [1] + # field = result._fc[0] + # op = harmonic_simulation._model.operator("VX") + # time_scoping = core.time_freq_scoping_factory.scoping_by_set( + # 1, server=harmonic_simulation._model._server + # ) + # op.connect(0, time_scoping) + # mesh_scoping = core.mesh_scoping_factory.nodal_scoping( + # [2, 3, 4], server=harmonic_simulation._model._server + # ) + # op.connect(1, mesh_scoping) + # field_ref = op.eval()[0] + # assert field.component_count == 1 + # assert field.data.shape == (3,) + # assert np.allclose(field.data, field_ref.data) + # + # def test_acceleration(self, harmonic_simulation): + # print(harmonic_simulation) + # + # result = harmonic_simulation.acceleration(components=["X"], node_ids=[2, 3, 4]) + # assert len(result._fc) == 2 + # assert result._fc.get_time_scoping().ids == [1] + # field = result._fc[0] + # op = harmonic_simulation._model.operator("AX") + # time_scoping = core.time_freq_scoping_factory.scoping_by_set( + # 1, server=harmonic_simulation._model._server + # ) + # op.connect(0, time_scoping) + # mesh_scoping = core.mesh_scoping_factory.nodal_scoping( + # [2, 3, 4], server=harmonic_simulation._model._server + # ) + # op.connect(1, mesh_scoping) + # field_ref = op.eval()[0] + # assert field.component_count == 1 + # assert field.data.shape == (3,) + # assert np.allclose(field.data, field_ref.data) + + def test_reaction_force(self, allkindofcomplexity): + harmonic_simulation = post.load_simulation( + data_sources=allkindofcomplexity, + simulation_type=AvailableSimulationTypes.harmonic_mechanical, + ) + result = harmonic_simulation.reaction_force(set_ids=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("RF") + field_ref = op.eval()[0] + assert field.component_count == 3 + assert np.allclose(field.data, field_ref.data) + + def test_element_nodal_forces(self, allkindofcomplexity): + harmonic_simulation = post.load_simulation( + data_sources=allkindofcomplexity, + simulation_type=AvailableSimulationTypes.harmonic_mechanical, + ) + result = harmonic_simulation.element_nodal_forces(set_ids=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("ENF") + field_ref = op.eval()[0] + assert field.component_count == 3 + assert np.allclose(field.data, field_ref.data) + + def test_element_nodal_forces_nodal(self, allkindofcomplexity): + harmonic_simulation = post.load_simulation( + data_sources=allkindofcomplexity, + simulation_type=AvailableSimulationTypes.harmonic_mechanical, + ) + result = harmonic_simulation.element_nodal_forces_nodal(set_ids=[1]) + assert len(result._fc) == 3 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("ENF") + op.connect(9, post.locations.nodal) + field_ref = op.eval()[0] + assert field.component_count == 3 + assert np.allclose(field.data, field_ref.data) + + def test_element_nodal_forces_elemental(self, allkindofcomplexity): + harmonic_simulation = post.load_simulation( + data_sources=allkindofcomplexity, + simulation_type=AvailableSimulationTypes.harmonic_mechanical, + ) + result = harmonic_simulation.element_nodal_forces_elemental(set_ids=[1]) + assert len(result._fc) == 3 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("ENF") + op.connect(9, post.locations.elemental) + field_ref = op.eval()[0] + assert field.component_count == 3 + assert np.allclose(field.data, field_ref.data) + + def test_stress(self, harmonic_simulation): + print(harmonic_simulation) + result = harmonic_simulation.stress(components=1, set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("SX") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_stress_elemental(self, harmonic_simulation): + result = harmonic_simulation.stress_elemental(components=1, set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("SX") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_stress_nodal(self, harmonic_simulation): + result = harmonic_simulation.stress_nodal(components=1, set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("SX") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_stress_principal(self, harmonic_simulation): + result = harmonic_simulation.stress_principal(components=1, set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("S1") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_stress_principal_nodal(self, harmonic_simulation): + result = harmonic_simulation.stress_principal_nodal(components=2, set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("S2") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_stress_principal_elemental(self, harmonic_simulation): + result = harmonic_simulation.stress_principal_elemental( + components=3, set_ids=[1] + ) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("S3") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_stress_eqv_von_mises(self, harmonic_simulation): + result = harmonic_simulation.stress_eqv_von_mises(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("S_eqv") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_stress_eqv_von_mises_elemental(self, harmonic_simulation): + result = harmonic_simulation.stress_eqv_von_mises_elemental(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("S_eqv") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_stress_eqv_von_mises_nodal(self, harmonic_simulation): + result = harmonic_simulation.stress_eqv_von_mises_nodal(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("S_eqv") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elemental_volume(self, harmonic_simulation): + result = harmonic_simulation.elemental_volume(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("ENG_VOL") + field_ref = op.eval()[0] + print(field_ref) + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain(components=1, set_ids=1) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPELX") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) field_ref = op.eval()[0] assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_elemental(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain_elemental(components=1, set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPELX") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_nodal(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain_nodal(components=1, set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPELX") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_principal(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain_principal(components=1, set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + principal_op = harmonic_simulation._model.operator(name="invariants_fc") + principal_op.connect(0, op.outputs.fields_container) + field_ref = principal_op.outputs.fields_eig_1()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_principal_nodal(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain_principal_nodal( + components=2, set_ids=[1] + ) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.nodal) + principal_op = harmonic_simulation._model.operator(name="invariants_fc") + principal_op.connect(0, op.outputs.fields_container) + field_ref = principal_op.outputs.fields_eig_2()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_principal_elemental(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain_principal_elemental( + components=3, set_ids=[1] + ) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental) + principal_op = harmonic_simulation._model.operator(name="invariants_fc") + principal_op.connect(0, op.outputs.fields_container) + field_ref = principal_op.outputs.fields_eig_3()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain_eqv_von_mises(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = harmonic_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + field_ref = equivalent_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises_nodal(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain_eqv_von_mises_nodal(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = harmonic_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + average_op = harmonic_simulation._model.operator(name="to_nodal_fc") + average_op.connect(0, equivalent_op.outputs.fields_container) + field_ref = average_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data) + + def test_elastic_strain_eqv_von_mises_elemental(self, harmonic_simulation): + result = harmonic_simulation.elastic_strain_eqv_von_mises_elemental(set_ids=[1]) + assert len(result._fc) == 2 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = harmonic_simulation._model.operator("EPEL") + time_scoping = core.time_freq_scoping_factory.scoping_by_set( + 1, server=harmonic_simulation._model._server + ) + op.connect(0, time_scoping) + op.connect(9, post.locations.elemental_nodal) + equivalent_op = harmonic_simulation._model.operator(name="eqv_fc") + equivalent_op.connect(0, op.outputs.fields_container) + average_op = harmonic_simulation._model.operator(name="to_elemental_fc") + average_op.connect(0, equivalent_op.outputs.fields_container) + field_ref = average_op.outputs.fields_container()[0] + assert field.component_count == 1 + assert np.allclose(field.data, field_ref.data)