Skip to content
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

FIX: Add animation using DPF animate() #1599

Merged
merged 13 commits into from
Nov 4, 2022
Merged

Conversation

GuillemBarroso
Copy link
Contributor

Investigating issue #1579.

🐞 Problem
Locally, the documentation shows the correct animation. However, it looks like it is not able to display it properly in the deployed documentation.

This PR attempts to use the .animate() method from DPF in order to have the animation properly displayed in the documentation.

Changes:

  • composite_dcb.py:
    • Add try except to also accept both local DPF and server DPF.
    • Add section with animation using .animate() method.
  • requrements_docs.txt:
    • Upgrade vtk dependency to version 9.2.2. An error was found when pip install -r requrements/requirements_docs.txt complaining about not finding version 9.0.3.

💡 Conclusion
The animation using .animate() is different from the one generated using pv.Plotter(). It only shows the displacements instead of the cohesive damage.

First, we would need to confirm that the .animate() Gif is properly displayed in the documentation. Then, I will create an issue to further investigate how to display the cohesive damage using .animate().

@github-actions github-actions bot added Dependencies Documentation Documentation related (improving, adding, etc) BUG Issue, problem or error in PyMAPDL labels Oct 31, 2022
@github-actions
Copy link
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

@codecov
Copy link

codecov bot commented Oct 31, 2022

Codecov Report

Merging #1599 (b93ea29) into main (6fb508e) will increase coverage by 3.39%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #1599      +/-   ##
==========================================
+ Coverage   79.52%   82.92%   +3.39%     
==========================================
  Files          44       44              
  Lines        7151     7151              
==========================================
+ Hits         5687     5930     +243     
+ Misses       1464     1221     -243     

@germa89
Copy link
Collaborator

germa89 commented Oct 31, 2022

@GuillemBarroso there is something going on with the doc build. It doesn't finish!

@GuillemBarroso
Copy link
Contributor Author

@GuillemBarroso there is something going on with the doc build. It doesn't finish!

Hm... It did finish when I built it locally this morning!

@github-actions github-actions bot added CI/CD Related with CICD, Github Actions, etc Maintenance General maintenance of the repo (libraries, cicd, etc) labels Oct 31, 2022
@germa89
Copy link
Collaborator

germa89 commented Oct 31, 2022

@GuillemBarroso

I dont think it works:

reading sources... [100%] mapdl_commands/solution/load_step_options .. user_guide/xpl

WARNING: Cell printed to stderr:
2022-10-31 16:22:15.349 (   1.457s) [        31A26740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:15.373 (   1.481s) [        31A26740]    vtkExtractEdges.cxx:551   INFO| Created 21886 edges

WARNING: Cell printed to stderr:
2022-10-31 16:22:16.085 (   2.193s) [        31A26740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:16.108 (   2.216s) [        31A26740]    vtkExtractEdges.cxx:551   INFO| Created 21886 edges

WARNING: Cell printed to stderr:
2022-10-31 16:22:17.386 (   3.494s) [        31A26740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:17.521 (   3.629s) [        31A26740]    vtkExtractEdges.cxx:551   INFO| Created 65658 edges

WARNING: Cell printed to stderr:
2022-10-31 16:22:18.784 (   4.892s) [        31A26740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:18.854 (   4.962s) [        31A26740]    vtkExtractEdges.cxx:551   INFO| Created 65658 edges

WARNING: Cell printed to stderr:
2022-10-31 16:22:19.539 (   5.647s) [        31A26740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:19.627 (   5.735s) [        31A26740]    vtkExtractEdges.cxx:551   INFO| Created 87544 edges

WARNING: Cell printed to stderr:
2022-10-31 16:22:20.357 (   6.465s) [        31A26740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:20.461 (   6.569s) [        31A26740]    vtkExtractEdges.cxx:551   INFO| Created 87544 edges

WARNING: Cell printed to stderr:
2022-10-31 16:22:20.678 (   6.786s) [        31A26740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered

WARNING: Cell printed to stderr:
2022-10-31 16:22:57.841 (  32.403s) [        79A3D740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:57.848 (  32.410s) [        79A3D740]    vtkExtractEdges.cxx:551   INFO| Created 9992 edges

WARNING: Cell printed to stderr:
2022-10-31 16:22:59.260 (  33.822s) [        79A3D740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:59.261 (  33.822s) [        79A3D740]    vtkExtractEdges.cxx:551   INFO| Created 222 edges

WARNING: Cell printed to stderr:
2022-10-31 16:22:59.869 (  34.430s) [        79A3D740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:22:59.869 (  34.431s) [        79A3D740]    vtkExtractEdges.cxx:551   INFO| Created 222 edges

WARNING: Cell printed to stderr:
2022-10-31 16:23:00.187 (  34.749s) [        79A3D740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:23:00.188 (  34.749s) [        79A3D740]    vtkExtractEdges.cxx:551   INFO| Created 222 edges

looking for now-outdated files... none found

@akaszynski
Copy link
Collaborator

WARNING: Cell printed to stderr:
2022-10-31 16:23:00.187 (  34.749s) [        79A3D740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:23:00.188 (  34.749s) [        79A3D740]    vtkExtractEdges.cxx:551   INFO| Created 222 edges

These warnings were added in VTK 9.2.2 and are harmless. PyVista needs to suppress these by adding an option in extract_edges to warn if edges are renumbered.

@germa89
Copy link
Collaborator

germa89 commented Oct 31, 2022

WARNING: Cell printed to stderr:
2022-10-31 16:23:00.187 (  34.749s) [        79A3D740]    vtkExtractEdges.cxx:435   INFO| Executing edge extractor: points are renumbered
2022-10-31 16:23:00.188 (  34.749s) [        79A3D740]    vtkExtractEdges.cxx:551   INFO| Created 222 edges

These warnings were added in VTK 9.2.2 and are harmless. PyVista needs to suppress these by adding an option in extract_edges to warn if edges are renumbered.

So I guess it should be fixed upstream.

By the way, we should probably consider upgrading VTK. @GuillemBarroso realised we are a couple of releases behind. Maybe when Pyvista fixes the warnings??

@akaszynski
Copy link
Collaborator

I've only seen that in the latest VTK v9.2.2

Let me check the workflows to see which one is getting installed.

@akaszynski
Copy link
Collaborator

Yea, it's vtk==9.0.3, which is weird, at least in the docs build.

Either something changed upstream (and pyvista hasn't made a new release lately), or we need to fix something.

Depending on how annoying it is, we can get a patch release out soon. About to finally drop a minor release.

@GuillemBarroso
Copy link
Contributor Author

When I tried to install the doc dependencies with pip install -r requirements/requirements_docs.txt I got the following error:

image

That is why I checked, and I found that the latest version was 9.2.2. Although I find it weird that it cannot find a previous stable version such as the 9.0.3.

@germa89
Copy link
Collaborator

germa89 commented Nov 2, 2022

When I tried to install the doc dependencies with pip install -r requirements/requirements_docs.txt I got the following error:

Have you used a newly created python env??

@germa89
Copy link
Collaborator

germa89 commented Nov 2, 2022

After plenty of re-runs, now it works. It didn't make sense to fail.

There are some merge conflicts which after fixed will re-trigger the workflows... let's see if we are more lucky now.

Copy link
Collaborator

@germa89 germa89 left a comment

Choose a reason for hiding this comment

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

LGTM. Good job @GuillemBarroso !

examples/00-mapdl-examples/composite_dcb.py Show resolved Hide resolved
examples/00-mapdl-examples/composite_dcb.py Outdated Show resolved Hide resolved
@GuillemBarroso
Copy link
Contributor Author

When I tried to install the doc dependencies with pip install -r requirements/requirements_docs.txt I got the following error:

Have you used a newly created python env??

Yes! I always do. Just in case I have tried again, and I get the same message: "No matching distribution found for vtk==9.0.3"

@akaszynski
Copy link
Collaborator

That is why I checked, and I found that the latest version was 9.2.2. Although I find it weird that it cannot find a previous stable version such as the 9.0.3.

It's there on PyPI. I bet your issue is the release doesn't have a Python 3.10 wheel. See:
https://pypi.org/project/vtk/9.0.3/#files

@germa89
Copy link
Collaborator

germa89 commented Nov 2, 2022

@GuillemBarroso if you are using conda just create a new python environment using conda env create --name mynewenv python=3.9.

Co-authored-by: German <28149841+germa89@users.noreply.github.com>
@GuillemBarroso
Copy link
Contributor Author

@GuillemBarroso if you are using conda just create a new python environment using conda env create --name mynewenv python=3.9.

Thanks @germa89. I was using Python venv as recommended in the dev guide.

Now I have just installed conda and I was able to install the doc requirements. Thanks.

@GuillemBarroso GuillemBarroso merged commit 3145975 into main Nov 4, 2022
@GuillemBarroso GuillemBarroso deleted the fix/animation-example branch November 4, 2022 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Issue, problem or error in PyMAPDL CI/CD Related with CICD, Github Actions, etc Dependencies Documentation Documentation related (improving, adding, etc) Maintenance General maintenance of the repo (libraries, cicd, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants