diff --git a/src/ansys/dpf/post/static_mechanical_simulation.py b/src/ansys/dpf/post/static_mechanical_simulation.py index d265e0043..2a254c61b 100644 --- a/src/ansys/dpf/post/static_mechanical_simulation.py +++ b/src/ansys/dpf/post/static_mechanical_simulation.py @@ -4148,6 +4148,873 @@ def creep_strain_equivalent_elemental( skin=skin, ) + def thermal_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, + 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=location, + category=ResultCategory.matrix, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_nodal( + 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, + 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract nodal thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.nodal, + category=ResultCategory.matrix, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_elemental( + self, + element_ids: Union[List[int], None] = None, + times: 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract elemental thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.elemental, + category=ResultCategory.matrix, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + + def thermal_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, + 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract principal thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=location, + category=ResultCategory.principal, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_principal_nodal( + 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, + 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract nodal principal thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.nodal, + category=ResultCategory.principal, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_principal_elemental( + self, + element_ids: Union[List[int], None] = None, + times: 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract elemental principal thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.elemental, + category=ResultCategory.principal, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + + def thermal_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, + 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract equivalent thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=location, + category=ResultCategory.equivalent, + components=None, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_equivalent_nodal( + 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, + 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract nodal equivalent strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of times 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.nodal, + category=ResultCategory.equivalent, + components=None, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_equivalent_elemental( + self, + element_ids: Union[List[int], None] = None, + times: 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, + expand_cyclic: Union[bool, List[Union[int, List[int]]]] = True, + phase_angle_cyclic: Union[float, None] = None, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract elemental equivalent thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + expand_cyclic: + For cyclic problems, whether to expand the sectors. + Can take a list of sector numbers to select specific sectors to expand + (one-based indexing). + If the problem is multi-stage, can take a list of lists of sector numbers, ordered + by stage. + phase_angle_cyclic: + For cyclic problems, phase angle to apply (in degrees). + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.elemental, + category=ResultCategory.equivalent, + components=None, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + expand_cyclic=expand_cyclic, + phase_angle_cyclic=phase_angle_cyclic, + external_layer=external_layer, + skin=skin, + ) + def reaction_force( self, node_ids: Union[List[int], None] = None, diff --git a/src/ansys/dpf/post/transient_mechanical_simulation.py b/src/ansys/dpf/post/transient_mechanical_simulation.py index 33681a9ba..9a1d5157f 100644 --- a/src/ansys/dpf/post/transient_mechanical_simulation.py +++ b/src/ansys/dpf/post/transient_mechanical_simulation.py @@ -3076,6 +3076,765 @@ def plastic_strain_eqv_elemental( skin=skin, ) + def thermal_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, + 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=location, + category=ResultCategory.matrix, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_nodal( + 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, + 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract nodal thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.nodal, + category=ResultCategory.matrix, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_elemental( + self, + element_ids: Union[List[int], None] = None, + times: 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract elemental thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.elemental, + category=ResultCategory.matrix, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + + def thermal_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, + 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract principal thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=location, + category=ResultCategory.principal, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_principal_nodal( + 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, + 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract nodal principal thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs pf elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.nodal, + category=ResultCategory.principal, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_principal_elemental( + self, + element_ids: Union[List[int], None] = None, + times: 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract elemental principal thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.elemental, + category=ResultCategory.principal, + components=components, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + + def thermal_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, + 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract equivalent thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=location, + category=ResultCategory.equivalent, + components=None, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_eqv_nodal( + 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, + 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract nodal equivalent thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + node_ids: + List of IDs of nodes to get results for. + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.nodal, + category=ResultCategory.equivalent, + components=None, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=node_ids, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + + def thermal_strain_eqv_elemental( + self, + element_ids: Union[List[int], None] = None, + times: 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, + external_layer: Union[bool, List[int]] = False, + skin: Union[bool, List[int]] = False, + ) -> DataFrame: + """Extract elemental equivalent thermal strain results from the simulation. + + Arguments `selection`, `set_ids`, `all_sets`, `times`, and `load_steps` are mutually + exclusive. + If none of the above is given, only the last result 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. + + Parameters + ---------- + element_ids: + List of IDs of elements to get results for. + times: + List of time 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. + external_layer: + Select the external layer (last layer of solid elements under the skin) + of the mesh for plotting and data extraction. If a list is passed, the external + layer is computed over list of elements. + skin: + Select the skin (creates new 2D elements connecting the external nodes) + of the mesh for plotting and data extraction. If a list is passed, the skin + is computed over list of elements (not supported for cyclic symmetry). Getting the + skin on more than one result (several time freq sets, split data...) is only + supported starting with Ansys 2023R2. + + Returns + ------- + Returns a :class:`ansys.dpf.post.data_object.DataFrame` instance. + + """ + return self._get_result( + base_name="ETH", + location=locations.elemental, + category=ResultCategory.equivalent, + components=None, + selection=selection, + times=times, + set_ids=set_ids, + all_sets=all_sets, + load_steps=load_steps, + node_ids=None, + element_ids=element_ids, + named_selections=named_selections, + external_layer=external_layer, + skin=skin, + ) + def reaction_force( self, node_ids: Union[List[int], None] = None, diff --git a/tests/test_simulation.py b/tests/test_simulation.py index f98628775..69220c3e0 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -512,61 +512,41 @@ def test_structural_temperature_elemental(self, static_simulation): assert field.data.shape == (12,) assert np.allclose(field.data, field_ref.data) - # @pytest.mark.skipif( - # not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_5_0, - # reason="Available starting DPF 5.0", - # ) - # def test_element_nodal_forces(self, 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] - # field = element_nodal_forces._fc[0] - # op = static_simulation._model.operator("ENF") - # op.inputs.bool_rotate_to_global.connect(False) - # field_ref = op.eval()[0] - # assert field.component_count == 3 - # # if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_6_2: - # # assert field.data.shape == (103750, 3) - # assert np.allclose(field.data, field_ref.data) - # - # @pytest.mark.skipif( - # not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_5_0, - # reason="Available starting DPF 5.0", - # ) - # def test_element_nodal_forces_nodal(self, 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.inputs.bool_rotate_to_global.connect(False) - # op.connect(9, post.locations.nodal) - # field_ref = op.eval()[0] - # assert field.component_count == 3 - # if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_6_2: - # assert field.data.shape == (14982, 3) - # assert np.allclose(field.data, field_ref.data) - # - # @pytest.mark.skipif( - # not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_5_0, - # reason="Available starting DPF 5.0", - # ) - # def test_element_nodal_forces_elemental(self, 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.inputs.bool_rotate_to_global.connect(False) - # op.connect(9, post.locations.elemental) - # field_ref = op.eval()[0] - # assert field.component_count == 3 - # if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_6_2: - # assert field.data.shape == (9433, 3) - # assert np.allclose(field.data, field_ref.data) + def test_thermal_strain(self, allkindofcomplexity): + static_simulation = post.StaticMechanicalSimulation(allkindofcomplexity) + # thermal_strain + result = static_simulation.thermal_strain(components=1) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = static_simulation._model.operator("ETHX") + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert field.data.shape == (40016,) + assert np.allclose(field.data, field_ref.data) + # thermal_strain_eqv + result = static_simulation.thermal_strain_eqv() + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = static_simulation._model.operator("ETH_EQV") + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert field.data.shape == (40016,) + assert np.allclose(field.data, field_ref.data) + # thermal_strain_principal + result = static_simulation.thermal_strain_principal(components=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = static_simulation._model.operator("ETH1") + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert field.data.shape == (40016,) + 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]) @@ -1084,6 +1064,43 @@ def test_thermal_dissipation_energy(self, transient_simulation): assert field.component_count == 1 assert np.allclose(field.data, field_ref.data) + def test_thermal_strain(self, allkindofcomplexity): + simulation = post.TransientMechanicalSimulation(allkindofcomplexity) + print(simulation) + # thermal_strain + result = simulation.thermal_strain(components=1) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = simulation._model.operator("ETHX") + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert field.data.shape == (40016,) + assert np.allclose(field.data, field_ref.data) + # thermal_strain_eqv + result = simulation.thermal_strain_eqv() + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = simulation._model.operator("ETH_EQV") + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert field.data.shape == (40016,) + assert np.allclose(field.data, field_ref.data) + # thermal_strain_principal + result = simulation.thermal_strain_principal(components=[1]) + assert len(result._fc) == 1 + assert result._fc.get_time_scoping().ids == [1] + field = result._fc[0] + op = simulation._model.operator("ETH1") + op.connect(9, post.locations.elemental_nodal) + field_ref = op.eval()[0] + assert field.component_count == 1 + assert field.data.shape == (40016,) + assert np.allclose(field.data, field_ref.data) + def test_kinetic_energy(self, transient_simulation): result = transient_simulation.kinetic_energy(set_ids=[2]) assert len(result._fc) == 1