Skip to content

Add a Mode-Superposition Transient Analysis example #1256

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

PProfizi
Copy link
Contributor

@PProfizi PProfizi commented Nov 8, 2023

Closes #1255

Working locally, apart from the mesh_scoping section commented-out

TODO:

  • upload a nicer example file to the example files repo, use it
  • improve explanations, add sections, review...
  • showcase using streams instead of datasources

@PProfizi PProfizi added the examples Related to PyDPF-Core examples label Nov 8, 2023
@PProfizi PProfizi requested a review from rafacanton November 8, 2023 14:13
@PProfizi PProfizi self-assigned this Nov 8, 2023
@PProfizi
Copy link
Contributor Author

PProfizi commented Nov 8, 2023

@rajesh1359 FYI
Would you have result files for a nice-looking model for this example? IP-free

@PProfizi PProfizi changed the title Add a Modal Superposition Transient Analysis example Add a Mode-Superposition Transient Analysis example Nov 8, 2023
Copy link

codecov bot commented Nov 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (85121d4) 87.84% compared to head (8c48cac) 87.84%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1256   +/-   ##
=======================================
  Coverage   87.84%   87.84%           
=======================================
  Files          81       81           
  Lines        9538     9538           
=======================================
  Hits         8379     8379           
  Misses       1159     1159           

mode_scoping = dpf.Scoping(ids=list(range(1, 3))) # Modes of interest
displacement_fc = dpf.operators.scoping.rescope_fc(
fields_container=displacement_fc,
mesh_scoping=mode_scoping, # Input here the modes of interest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you input this to the mesh_scoping, it is understood as a Nodal scoping. Is this what you mean?

Copy link
Contributor Author

@PProfizi PProfizi Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafacanton no, interestingly enough, this displacement_fc contains fields located at Modal, which is unexpected but actually logical when using an rdsp file as input, hence the rescope on a generic Scoping (tried instantiating a Scoping as Modal but it does not work):

DPF  Fields Container
  with 21 field(s)
  defined on labels: time 

  with:
  - field 0 {time:  1} with Modal location, 1 components and 6 entities.
  - field 1 {time:  2} with Modal location, 1 components and 6 entities.
  - field 2 {time:  3} with Modal location, 1 components and 6 entities.
  - field 3 {time:  4} with Modal location, 1 components and 6 entities.
  - field 4 {time:  5} with Modal location, 1 components and 6 entities.
  - field 5 {time:  6} with Modal location, 1 components and 6 entities.
  - field 6 {time:  7} with Modal location, 1 components and 6 entities.
  - field 7 {time:  8} with Modal location, 1 components and 6 entities.
  - field 8 {time:  9} with Modal location, 1 components and 6 entities.
  - field 9 {time:  10} with Modal location, 1 components and 6 entities.
  - field 10 {time:  11} with Modal location, 1 components and 6 entities.
  - field 11 {time:  12} with Modal location, 1 components and 6 entities.
  - field 12 {time:  13} with Modal location, 1 components and 6 entities.
  - field 13 {time:  14} with Modal location, 1 components and 6 entities.
  - field 14 {time:  15} with Modal location, 1 components and 6 entities.
  - field 15 {time:  16} with Modal location, 1 components and 6 entities.
  - field 16 {time:  17} with Modal location, 1 components and 6 entities.
  - field 17 {time:  18} with Modal location, 1 components and 6 entities.
  - field 18 {time:  19} with Modal location, 1 components and 6 entities.
  - field 19 {time:  20} with Modal location, 1 components and 6 entities.
  - field 20 {time:  21} with Modal location, 1 components and 6 entities.

While trying out different combinations, I realized that this is really not straightforward with the API currently in place. For example, the Modal scoping seems to exist server-side but is impossible to build client-side.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conclusion: this example is useful to showcase how to do this, but really we lack helpers regarding mode manipulation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a bit confusing, I think it's worth adding a comment to explain

@PProfizi PProfizi requested a review from cbellot000 December 15, 2023 13:47

# msup_transient_files = examples.find_msup_transient()
msup_transient_files = {
"rst": r"D:\ANSYSDev\Sandbox\UnitTestDataFiles\expansion\msup\Transient\plate1\file.rst",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it meant to be hardcoded path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, that is until a find a nicer example file to add to our example repo

###############################################################################
# Get the expanded displacement fields on part of the mesh, for selected time-steps:
# TODO: NOT WORKING
# partial_scoping = dpf.mesh_scoping_factory.nodal_scoping(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is not working?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbellot000 when running this commented part I get:

Traceback (most recent call last):
  File "D:\ANSYSDev\Sandbox\pydpf-core\examples\01-transient_analyses\03-mode_superposition_transient.py", line 72, in <module>
    ).eval()
  File "D:\ANSYSDev\Sandbox\pydpf-core\src\ansys\dpf\core\results.py", line 266, in eval
    fc = self.__call__().outputs.fields_container()
  File "D:\ANSYSDev\Sandbox\pydpf-core\src\ansys\dpf\core\outputs.py", line 75, in __call__
    return self.get_data()
  File "D:\ANSYSDev\Sandbox\pydpf-core\src\ansys\dpf\core\outputs.py", line 72, in get_data
    return self._operator.get_output(self._pin, type_output)
  File "D:\ANSYSDev\Sandbox\pydpf-core\src\ansys\dpf\core\dpf_operator.py", line 494, in get_output
    parameters = {type_tuple[2]: type_tuple[1](self, pin)}
  File "D:\ANSYSDev\Sandbox\pydpf-core\src\ansys\dpf\gate\generated\operator_capi.py", line 402, in operator_getoutput_fields_container
    res = capi.dll.Operator_getoutput_FieldsContainer(op._internal_obj if op is not None else None, utils.to_int32(iOutput), ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
OSError: exception: access violation reading 0x0000000000000008

ANSYS LICENSE MANAGER ERROR:

System error: 10093 "Either the application has not called WSAStartup, or WSAStartup failed.
".


Process finished with exit code 1

I think the ANSYS LICENSE MANAGER ERROR is new though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who looks bad, did you create a bug in TFS to track it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, I'll do it right now

mode_scoping = dpf.Scoping(ids=list(range(1, 3))) # Modes of interest
displacement_fc = dpf.operators.scoping.rescope_fc(
fields_container=displacement_fc,
mesh_scoping=mode_scoping, # Input here the modes of interest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a bit confusing, I think it's worth adding a comment to explain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Related to PyDPF-Core examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mode-superposition transient analysis, with mode selection for expansion
3 participants