I would like to extract the X, Y, and Z components of displacement and rotation for a static mechanical simulation, similar to what can be done with "Pymapdl-reader". I am aware that the latest function under the "ansys-dpf-post" package, "solution=post.load_simulation(rstfile); displacement=solution.displacement()", can extract the X, Y, and Z components of displacement. However, this is not sufficient as I also require the X, Y, and Z components of rotation. I am hoping that this function can be updated to allow for the extraction of all six degrees of freedom of displacement, including rotational displacement.
Steps for implementing the feature
Enhance the functionality of the "solution=post.load_simulation(rstfile); displacement=solution.displacement()" function in the ANSYS-DPF-POST package to enable it to extract the nodal solutions for all six degrees of freedom. These degrees of freedom include the X, Y, and Z components of displacement, as well as the X, Y, and Z components of rotation.
Useful links and references
Here is a brief demo of using this function.
from ansys.dpf import post
from ansys.dpf.post import examples
simulation = post.load_simulation(examples.download_crankshaft())
displacement = simulation.displacement()
print(displacement)
results U
set_id 3
node comp
4872 X -3.41e-05
Y 1.54e-03
Z -2.64e-06
9005 X -5.56e-05
Y 1.44e-03
Z 5.31e-06
...
The following is the current function code. We want to improve it to allow for the extraction of displacements with 6 degrees of freedom: the X, Y, and Z components of displacement, as well as the X, Y, and Z components of rotation.
def displacement(
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,
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,
) -> DataFrame:
"""Extract displacement 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.
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.
times:
List of time 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.DataFrame` instance.
"""
return self._get_result(
base_name="U",
location=locations.nodal,
category=ResultCategory.vector,
components=components,
norm=norm,
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,
)
Description of the feature
I would like to extract the X, Y, and Z components of displacement and rotation for a static mechanical simulation, similar to what can be done with "Pymapdl-reader". I am aware that the latest function under the "ansys-dpf-post" package, "solution=post.load_simulation(rstfile); displacement=solution.displacement()", can extract the X, Y, and Z components of displacement. However, this is not sufficient as I also require the X, Y, and Z components of rotation. I am hoping that this function can be updated to allow for the extraction of all six degrees of freedom of displacement, including rotational displacement.
Steps for implementing the feature
Enhance the functionality of the "solution=post.load_simulation(rstfile); displacement=solution.displacement()" function in the ANSYS-DPF-POST package to enable it to extract the nodal solutions for all six degrees of freedom. These degrees of freedom include the X, Y, and Z components of displacement, as well as the X, Y, and Z components of rotation.
Useful links and references
Here is a brief demo of using this function.
The following is the current function code. We want to improve it to allow for the extraction of displacements with 6 degrees of freedom: the X, Y, and Z components of displacement, as well as the X, Y, and Z components of rotation.