Closed GuillemBarroso closed 1 year ago
"we were wondering with @germa89 if we could plot the cohesive damage instead of the displacements using ".animate()"."
Hi @GuillemBarroso , @germa89. Sure, you should be able to with something like this:
disp_op = model.results.displacement.on_all_time_freqs
dam_op = dpf.operators.result.nmisc(data_sources=data_src, item_index=70).on_all_time_freqs
damage_fc = dam_op.eval()
damage_fc.animate(deform_by=disp_op)
See here for the example:
# The deform_by argument can be:
# - a FieldsContainer of nodal 3D vectorial length fields
# stress_fields.animate(deform_by=model.results.displacement.on_all_time_freqs.eval())
# - a Result giving nodal 3D vectorial length fields
# stress_fields.animate(deform_by=model.results.displacement.on_all_time_freqs())
# - an Operator which outputs nodal 3D vectorial length fields
# stress_fields.animate(deform_by=model.results.displacement.on_all_time_freqs)
# It must evaluate to a FieldsContainer of same length as the one being animated.
"we were wondering with @germa89 if we could plot the cohesive damage instead of the displacements using ".animate()"."
Hi @GuillemBarroso , @germa89. Sure, you should be able to with something like this:
disp_op = model.results.displacement.on_all_time_freqs dam_op = dpf.operators.result.nmisc(data_sources=data_src, item_index=70) damage_fc = dam_op.on_all_time_freqs.eval()
See here for the example:
# The deform_by argument can be: # - a FieldsContainer of nodal 3D vectorial length fields # stress_fields.animate(deform_by=model.results.displacement.on_all_time_freqs.eval()) # - a Result giving nodal 3D vectorial length fields # stress_fields.animate(deform_by=model.results.displacement.on_all_time_freqs()) # - an Operator which outputs nodal 3D vectorial length fields # stress_fields.animate(deform_by=model.results.displacement.on_all_time_freqs) # It must evaluate to a FieldsContainer of same length as the one being animated.
Great, I'll try to implement that. Thanks!
Also, I am not sure I understand why this part is required in the example:
try:
# ONLY IF DPF SERVER DEPLOYED WITH gRPC COMMUNICATION
# Upload file to DPF server
temp_directory = tempfile.gettempdir()
rst_path = mapdl.download_result(temp_directory)
dpf.connect_to_server()
server_file_path = dpf.upload_file_in_tmp_folder(rst_path)
data_src = dpf.DataSources(server_file_path)
except:
# Using DPF locally
rst = mapdl.download_result()
data_src = dpf.DataSources(rst)
Also, I am not sure I understand why this part is required in the example:
try: # ONLY IF DPF SERVER DEPLOYED WITH gRPC COMMUNICATION # Upload file to DPF server temp_directory = tempfile.gettempdir() rst_path = mapdl.download_result(temp_directory) dpf.connect_to_server() server_file_path = dpf.upload_file_in_tmp_folder(rst_path) data_src = dpf.DataSources(server_file_path) except: # Using DPF locally rst = mapdl.download_result() data_src = dpf.DataSources(rst)
I got an error when running the example, see related issue #1611. As far as I understand, the error obtained is because I am using MADPL from the available Docker image but I have DPF installed locally. I thought it was a good idea to account for this case in the examples, so I added the try/except to accept both scenarios.
@PProfizi, let me know if I am missing something.
Before submitting the issue
pip install --upgrade --upgrade-strategy eager ansys-mapdl-core
)Description of the bug
The example on cohesive elements contains two different animations:
pv.Plotter()
..animate()
method from DPF (added in PR #1599).The two of them are correctly displayed when building the docs locally, see screenshot:
However, the dev docs are not showing the same, see screenshot:
It looks like the animation generated with
pv.Plotter
is not able to get properly rendered. Instead,.animate()
works just fine.@PProfizi, we were wondering with @germa89 if we could plot the cohesive damage instead of the displacements using ".animate()".
Also, it would be great to understand why the animation is not properly rendered using
pv.Plotter()
.Steps To Reproduce
Build documentation.
The example is located here.
Which Operating System are you using?
Windows
Which Python version are you using?
3.9
PyMAPDL Report
Show the Report!
```text PyMAPDL Software and Environment Report Packages Requirements ********************* Core packages ------------- ansys.mapdl.core : 0.64.dev0 numpy : 1.23.4 appdirs : 1.4.4 scipy : 1.9.3 grpc : Package not found ansys.api.mapdl.v0 : Package not found ansys.mapdl.reader : 0.52.3 google.protobuf : Package not found Optional packages ----------------- matplotlib : 3.6.2 pyvista : 0.37.0 pyiges : 0.2.1 tqdm : 4.64.1 Ansys Installation ****************** Version Location ------------------ 222 C:\Program Files\ANSYS Inc\v222 Ansys Environment Variables *************************** ANSYS222_DIR C:\Program Files\ANSYS Inc\v222\ANSYS ANSYSLIC_DIR C:\Program Files\ANSYS Inc\Shared Files\Licensing AWP_ROOT222 C:\Program Files\ANSYS Inc\v222 CADOE_LIBDIR222 C:\Program Files\ANSYS Inc\v222\CommonFiles\Language\en-us ```Installed packages
Show the installed packages!
```text aiohttp==3.8.3 aiosignal==1.2.0 alabaster==0.7.12 ansys-api-mapdl==0.5.1 ansys-api-platform-instancemanagement==1.0.0b3 ansys-dpf-core==0.6.2 ansys-dpf-gate==0.2.3 ansys-dpf-gatebin==0.2.3 ansys-grpc-dpf==0.6.1 -e git+https://github.com/pyansys/pymapdl.git@b93ea297c947598d55ae22f170e2867ee5843e85#egg=ansys_mapdl_core ansys-mapdl-reader==0.52.3 ansys-platform-instancemanagement==1.0.2 ansys-sphinx-theme==0.7.0 anyio==3.6.2 appdirs==1.4.4 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 asttokens==2.1.0 async-timeout==4.0.2 attrs==22.1.0 autobahn==22.7.1 Automat==22.10.0 Babel==2.11.0 backcall==0.2.0 beautifulsoup4==4.11.1 bleach==5.0.1 cachetools==5.2.0 certifi @ file:///C:/b/abs_ac29jvt43w/croot/certifi_1665076682579/work/certifi cffi==1.15.1 charset-normalizer==2.1.1 click==8.1.3 colorama==0.4.6 constantly==15.1.0 contourpy==1.0.6 cryptography==38.0.3 cycler==0.11.0 debugpy==1.6.3 decorator==5.1.1 defusedxml==0.7.1 docutils==0.19 entrypoints==0.4 exceptiongroup==1.0.0 executing==1.2.0 fastjsonschema==2.16.2 fonttools==4.38.0 frozenlist==1.3.1 geomdl==5.3.1 google-api-core==2.10.2 google-api-python-client==2.65.0 google-auth==2.14.0 google-auth-httplib2==0.1.0 googleapis-common-protos==1.56.4 grpcio==1.50.0 httplib2==0.21.0 hyperlink==21.0.0 idna==3.4 imageio==2.22.3 imageio-ffmpeg==0.4.7 imagesize==1.4.1 importlib-metadata==5.0.0 incremental==22.10.0 iniconfig==1.1.1 ipydatawidgets==4.3.2 ipykernel==6.17.0 ipython==8.6.0 ipython-genutils==0.2.0 ipywidgets==8.0.2 jedi==0.18.1 Jinja2==3.1.2 json5==0.9.10 jsonschema==4.17.0 jupyter-server==1.21.0 jupyter-sphinx==0.4.0 jupyter_client==7.4.4 jupyter_core==4.11.2 jupyterlab==3.5.0 jupyterlab-pygments==0.2.2 jupyterlab-widgets==3.0.3 jupyterlab_server==2.16.2 kiwisolver==1.4.4 livereload==2.6.3 MarkupSafe==2.1.1 matplotlib==3.6.2 matplotlib-inline==0.1.6 mistune==2.0.4 multidict==6.0.2 nbclassic==0.4.7 nbclient==0.7.0 nbconvert==7.2.3 nbformat==5.7.0 nest-asyncio==1.5.6 notebook==6.5.2 notebook_shim==0.2.0 numpy==1.23.4 numpydoc==1.5.0 packaging==21.3 pandas==1.5.1 pandocfilters==1.5.0 parso==0.8.3 pickleshare==0.7.5 Pillow==9.3.0 plotly==5.11.0 pluggy==1.0.0 pooch==1.6.0 prometheus-client==0.15.0 prompt-toolkit==3.0.31 protobuf==3.20.3 protoc-gen-swagger==0.1.0 psutil==5.9.3 pure-eval==0.2.2 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.21 pydata-sphinx-theme==0.9.0 Pygments==2.13.0 pyiges==0.2.1 pypandoc==1.9 pyparsing==3.0.9 pyrsistent==0.19.1 pytest==7.2.0 pytest-sphinx==0.5.0 python-dateutil==2.8.2 pythreejs==2.4.1 pytz==2022.6 pyvista==0.37.0 pywin32==304 pywinpty==2.0.9 pyzmq==24.0.1 requests==2.28.1 rsa==4.9 scipy==1.9.3 scooby==0.7.0 Send2Trash==1.8.0 six==1.16.0 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.3.2.post1 Sphinx==5.3.0 sphinx-autobuild==2021.3.14 sphinx-copybutton==0.5.0 sphinx-gallery==0.11.1 sphinx-notfound-page==0.8.3 sphinx_autodoc_typehints==1.19.4 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 sphinxcontrib-websupport==1.2.4 sphinxemoji==0.2.0 stack-data==0.6.0 tenacity==8.1.0 terminado==0.17.0 tinycss2==1.2.1 tomli==2.0.1 tornado==6.2 tqdm==4.64.1 traitlets==5.5.0 traittypes==0.2.1 Twisted==22.10.0 twisted-iocpsupport==1.0.2 txaio==22.2.1 typing_extensions==4.4.0 uritemplate==4.1.1 urllib3==1.26.12 vtk==9.2.2 wcwidth==0.2.5 webencodings==0.5.1 websocket-client==1.4.1 widgetsnbextension==4.0.3 wincertstore==0.2 wslink==1.9.1 yarl==1.8.1 zipp==3.10.0 zope.interface==5.5.0 ```