-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement TransientMechanicalSimulation results #282
Conversation
"""Extract displacement results from the simulation. | ||
|
||
Args: | ||
component_ids: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PProfizi the docstring for component ids is not very clear, could we have a list of supported options on each result type?
Whether to return the norm of the results. | ||
selection: | ||
Selection to get results for. | ||
A Selection defines both spatial and time-like criteria for filtering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that information about redundant keyopts is missing (for example times, time_steps_ids)
By the way, where do time_sets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a mention of priority order in each docstring.
As for time_sets
, to me it is time_step_ids
.
selection: Union[Selection, None] = None, | ||
times: Union[float, List[float], None] = None, | ||
time_step_ids: Union[int, List[int], None] = None, | ||
nodes: Union[List[int], None] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we put time_step_ids, shouldn't we have node_ids instead of nodes for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching to node_ids and element_ids
time_step_ids: Union[int, List[int], None] = None, | ||
nodes: Union[List[int], None] = None, | ||
elements: Union[List[int], None] = None, | ||
named_selection: Union[str, None] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we support a list of named selection? In the implementation, I can only see one named selection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not part of the specs, but we can definitely add this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it!
named_selection=named_selection, | ||
) | ||
|
||
def plastic_state_variable_nodal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is plastic state? does it work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plastic state variable is ENL_PSV. I have not yet found a result containing that to add to the tests so right now I cannot say if this works.
named_selection=named_selection, | ||
) | ||
|
||
def hydrostatic_pressure_elemental( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity which MAPDL result is hydrostatic_pressure ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It comes from NL HPRES.
assert field.component_count == 3 | ||
assert np.allclose(field.data, field_ref.data) | ||
|
||
def test_element_nodal_forces_elemental(self, allkindofcomplexity): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that "named_selection" and "selection" keywords are not tested yet. is it because it's a work in progress?
Should we maybe add a code coverage bot to help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added a test for named_selection.
As for the Selection, the Selection object is not ready yet so no test for it. It is indeed a work in progress.
Codecov Report
@@ Coverage Diff @@
## post_refactor #282 +/- ##
=================================================
+ Coverage 79.41% 80.38% +0.96%
=================================================
Files 30 32 +2
Lines 1963 2162 +199
=================================================
+ Hits 1559 1738 +179
- Misses 404 424 +20 |
…individual modules
…ical_simulation.py.
16bf45b
to
0faa1b0
Compare
tests/test_simulation.py
Outdated
) | ||
|
||
def test_displacement(self, static_simulation): | ||
displacement_x = static_simulation.displacement( | ||
component_ids=["X"], nodes=[42, 43, 44], set_ids=[1] | ||
component_ids=["X"], node_ids=[42, 43, 44], set_ids=[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we should avoid using ids here. This can be confusing
…ent_mechanical_simulation.py
…t giving a Scoping.
Priority of arguments is given in the docstrings.
Priority of arguments is given in the docstrings.
result = transient_simulation.displacement( | ||
components=["X"], | ||
node_ids=[2, 3, 4], | ||
all_sets=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbellot000 is that what you had in mind? I added a boolean to ask explicitly for every set. This way it will be generic to all types of simulations, and it is very explicit.
* Use the time_scoping of the FieldsContainer and not its TimeFreqSupport * Add TransientMechanicalSimulation.displacement * Add TransientMechanicalSimulation.velocity and acceleration * Add TransientMechanicalSimulation.stress and all variants * Add TransientMechanicalSimulation.elastic_strain and all variants * Move TransientMechanicalSimulation and StaticMechanicalSimulation to individual modules * Confirm a first set of results for TransientMechanicalSimulation * Specify available component IDs for vectorial results. * Specify available component IDs for matrix results. * Specify available component IDs for principal results. Rework all. * Switching to node_ids and element_ids. * Add the case of list of named selections * Switch to node_ids in TestTransientMechanicalSimulation. * Add testing for list of named_selections. * Specify precedence of "selection" argument. * Mention priority order for filtering arguments. * Switch to node_ids, element_ids and named_selections in static_mechanical_simulation.py. * Add component info for vector results in static_mechanical_simulation.py * Add component info for matrix results in static_mechanical_simulation.py * Add component info for principal results in static_mechanical_simulation.py * Fix tests * Fix DataObject docstring * Fix 02-get_data_from_static_simulation.py * component_ids -> components * Also use set_ids, load_steps, and sub_steps, in signatures for transient_mechanical_simulation.py * _build_mesh_scoping now returns either a Scoping or an operator Output giving a Scoping. * sub_steps is now declared using a tuple for load_steps. Priority of arguments is given in the docstrings. * sub_steps is now declared using a tuple for load_steps. Priority of arguments is given in the docstrings. * Force mutual exclusivity of timefreq arguments, as well as of mesh scoping arguments * Add an "all_sets" argument which is set to True means all sets will be extracted. * Improve docstrings to explain extraction defaults in case of no argument given. * Add implementation for "times" input. * Reorder and fix all result methods signatures and docstrings.
* Use the time_scoping of the FieldsContainer and not its TimeFreqSupport * Add TransientMechanicalSimulation.displacement * Add TransientMechanicalSimulation.velocity and acceleration * Add TransientMechanicalSimulation.stress and all variants * Add TransientMechanicalSimulation.elastic_strain and all variants * Move TransientMechanicalSimulation and StaticMechanicalSimulation to individual modules * Confirm a first set of results for TransientMechanicalSimulation * Specify available component IDs for vectorial results. * Specify available component IDs for matrix results. * Specify available component IDs for principal results. Rework all. * Switching to node_ids and element_ids. * Add the case of list of named selections * Switch to node_ids in TestTransientMechanicalSimulation. * Add testing for list of named_selections. * Specify precedence of "selection" argument. * Mention priority order for filtering arguments. * Switch to node_ids, element_ids and named_selections in static_mechanical_simulation.py. * Add component info for vector results in static_mechanical_simulation.py * Add component info for matrix results in static_mechanical_simulation.py * Add component info for principal results in static_mechanical_simulation.py * Fix tests * Fix DataObject docstring * Fix 02-get_data_from_static_simulation.py * component_ids -> components * Also use set_ids, load_steps, and sub_steps, in signatures for transient_mechanical_simulation.py * _build_mesh_scoping now returns either a Scoping or an operator Output giving a Scoping. * sub_steps is now declared using a tuple for load_steps. Priority of arguments is given in the docstrings. * sub_steps is now declared using a tuple for load_steps. Priority of arguments is given in the docstrings. * Force mutual exclusivity of timefreq arguments, as well as of mesh scoping arguments * Add an "all_sets" argument which is set to True means all sets will be extracted. * Improve docstrings to explain extraction defaults in case of no argument given. * Add implementation for "times" input. * Reorder and fix all result methods signatures and docstrings.
Implement result extraction APIs for TransientMechanicalSimulation.
TransientMechanicalSimulation methods
(checked: tested, italic: implemented)
I would like to merge the work already done, this being mostly about the logic behind result extraction.
I lack result files with most of the results types not tested above, so the work of being exhaustive is not prioritized right now.