Skip to content

Commit

Permalink
Implement ModalMechanicalSimulation results (#289)
Browse files Browse the repository at this point in the history
* Add modal_mechanical_simulation.py

* Reorder arguments and docstrings in modal_mechanical_simulation.py

* Fix test_load_simulation.py

* Expose frequencies and modes for Modal results, and take first mode only by default.

* Update all result methods and docstrings accordingly

* Filter results according to list for modal

* Fix (load_steps, sub_steps) logic.

* Add stress tests for modal

* Redirect modes to set_ids for modal

* Test more results for modal

* Add location argument to generic result methods of ModalMechanicalSimulation

* Add location argument to generic result methods of StaticMechanicalSimulation

* Add location argument to generic result methods of TransientMechanicalSimulation

* Add Selection.select_nodes_of_elements

* Allow for several named selections in Selection.select_named_selection

* Fix SpatialSelection.select_nodes_of_elements

* Switch ModalMechanicalSimulation._get_result to using Selection API and workflow.

* Allow for multiple set_ids to correspond to a single "times" or "frequency" value.

* Move set_ids and all_sets to bottom of signatures, update docstrings.

* Swith StaticMechanicalSimulation._get_result and TransientMechanicalSimulation._get_result to using Selection API

* Fix errors due to switch to Selection API

* Fix TimeFreqSelection.select_time_freq_values by setting the field for values as scalar.

* Always use eqv_fc

* Fix Simulation._build_components_from_principal for string input.

* Fix principal step to use invariants_fc. Cannot ask for multiple principal results anymore. The combination logic needs to be defined.

* Update tests to not use EPEL1 and others but instead use the Mechanical-equivalent of invariants_fc

* Initiate DataObjects with an Index

* Initiate DataObjects with an Index

* Fix DataObject init

* Set scoping as output of result workflow to give as index argument ot DataObject

* Add elastic_strain_eqv_von_mises to Transient

* Add elastic_strain_eqv_von_mises to Static

* Add elastic_strain_eqv_von_mises to Modal

* Delay averaging when asking for eqv strain

* Fix setting scoping as output for index of DataObject
  • Loading branch information
PProfizi authored Feb 24, 2023
1 parent ab61458 commit dead1a9
Show file tree
Hide file tree
Showing 9 changed files with 4,504 additions and 314 deletions.
6 changes: 2 additions & 4 deletions src/ansys/dpf/post/common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""Module containing the common tools for a better usage of the DPF-Post module."""

from ansys.dpf.post.simulation import (
HarmonicMechanicalSimulation,
ModalMechanicalSimulation,
)
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

Expand Down
18 changes: 7 additions & 11 deletions src/ansys/dpf/post/data_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
class DataObject:
"""Exposes the fields container generated by a result provider."""

def __init__(
self, fields_container=None, server=None, mesh_scoping=None, columns=None
):
def __init__(self, fields_container=None, server=None, index=None, columns=None):
"""Wrap a FieldsContainer within a DataObject.
Parameters
Expand All @@ -16,17 +14,17 @@ def __init__(
:class:`ansys.dpf.core.fields_container.FieldsContainer`to wrap.
server:
DPF server to use.
mesh_scoping:
Scoping to use.
index:
Index to use.
columns:
Columns to use.
"""
self._fc = fields_container
if columns:
if columns is not None:
self._columns = columns

if mesh_scoping:
self._mesh_scoping = mesh_scoping
if index is not None:
self._index = index

# super().__init__(fields_container._internal_obj, server)

Expand Down Expand Up @@ -93,9 +91,7 @@ def as_data_frame(self, columns=None, **kwargs):
"This function requires for the DataObject to contain only"
"one data entity."
)
df = pd.DataFrame(
self.as_array(), columns=columns, index=self._mesh_scoping.ids
)
df = pd.DataFrame(self.as_array(), columns=columns, index=self._index)
df.name = self._fc[-1].name
return df

Expand Down
Loading

0 comments on commit dead1a9

Please sign in to comment.