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

Example proposal: How can I plot in pydpf-post results on a mesh part linked to a named selection? #513

Open
jviqueg opened this issue Sep 25, 2023 · 0 comments
Labels
enhancement New feature or request examples Related to PyDPF-Post examples

Comments

@jviqueg
Copy link

jviqueg commented Sep 25, 2023

📝 Description of the example

'Extract results on named selections - Modal Simulation' example shows how to plot results on a specific named selection. Results are only shown on that named selection, but the rest of the structure is kept grey. Is there any way to only plot the mesh which is linked to the named selection and not the whole structure?
Having a look at pydpf-post manual, we can see that simulation.plot has only mesh=true or mesh=false, but it does not allow to link to a specific part of the mesh. What it can be done is to use plot contour and its pyvista options, for instance opacity.
Here the code to plot on BAR_1 named selection from the example commented before:

from ansys.dpf import post
from ansys.dpf.post import examples

example_path = examples.download_modal_frame()
solution = post.load_solution(example_path)

disp = solution.displacement()
disp_on_named_selection = solution.displacement(named_selection='BAR_1')
dx = disp_on_named_selection.x

all_elem = solution.mesh.elements.scoping.ids
elem_ns = solution.mesh.named_selection('BAR_1').ids

pl = dx.plot_contour("time", [1], nan_opacity = 0.0) 

📁 Files needed for running the example

None

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

Ansys 2023R2

🐍 Which Python version are you using?

3.8

📦 Installed packages

aiohttp==3.8.3
aiosignal==1.2.0
ansys-api-mapdl==0.5.1
ansys-api-mechanical==0.1.0
ansys-api-meshing-prime==0.1.1
ansys-api-platform-instancemanagement==1.0.0b3
ansys-corba==0.1.1
ansys-dpf-composites==0.3.1
ansys-dpf-core==0.9.0
ansys-dpf-gate==0.4.1
ansys-dpf-gatebin==0.3.1
ansys-dpf-post==0.4.0
ansys-grpc-dpf==0.7.1
ansys-mapdl-core==0.65.2
ansys-mapdl-reader==0.52.20
ansys-mechanical-core==0.9.2
ansys-meshing-prime==0.3.2
ansys-platform-instancemanagement==1.1.1
ansys-pythonnet==3.1.0rc1
ansys-tools-path==0.3.1
anyio==3.6.1
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.8
async-timeout==4.0.2
attrs==22.1.0
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==5.0.1
cachetools==5.3.1
certifi==2023.5.7
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.7
clr-loader==0.2.5
colorama==0.4.6
contourpy==1.0.5
cycler==0.11.0
debugpy==1.6.3
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
executing==1.1.1
fastjsonschema==2.16.2
fatpack==0.7.3
fonttools==4.37.4
frozenlist==1.3.1
geomdl==5.3.1
google-api-core==2.11.1
google-api-python-client==2.93.0
google-auth==2.22.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.59.1
grpcio==1.56.0
httplib2==0.22.0
idna==3.4
imageio==2.22.2
importlib-metadata==6.8.0
importlib-resources==5.10.0
ipykernel==6.16.0
ipython==8.5.0
ipython-genutils==0.2.0
ipywidgets==8.0.2
jedi==0.18.1
Jinja2==3.1.2
jsonschema==4.16.0
jupyter==1.0.0
jupyter-console==6.4.4
jupyter-core==4.11.1
jupyter-server==1.21.0
jupyter_client==7.4.2
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.3
kiwisolver==1.4.4
MarkupSafe==2.1.1
matplotlib==3.6.1
matplotlib-inline==0.1.6
mistune==2.0.4
multidict==6.0.2
nbclassic==0.4.5
nbclient==0.7.0
nbconvert==7.2.1
nbformat==5.7.0
nest-asyncio==1.5.6
notebook==6.5.1
notebook_shim==0.2.0
numpy==1.24.4
packaging==23.1
pandas==1.5.1
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.2.0
pkgutil_resolve_name==1.3.10
platformdirs==3.9.1
pooch==1.7.0
prometheus-client==0.15.0
prompt-toolkit==3.0.31
protobuf==3.20.3
protoc-gen-swagger==0.1.0
psutil==5.9.5
pure-eval==0.2.2
pyansys-tools-versioning==0.4.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
Pygments==2.13.0
pyiges==0.3.1
pyparsing==3.1.0
pyrsistent==0.18.1
python-dateutil==2.8.2
pytz==2022.6
pyvista==0.42.2
pywin32==304
pywinpty==2.0.8
pyzmq==24.0.1
qtconsole==5.3.2
QtPy==2.2.1
requests==2.31.0
rsa==4.9
scipy==1.10.0
scooby==0.6.0
Send2Trash==1.8.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.3.2.post1
stack-data==0.5.1
terminado==0.16.0
tinycss2==1.2.1
tornado==6.2
tqdm==4.65.0
traitlets==5.4.0
uritemplate==4.1.1
urllib3==1.26.16
vtk==9.2.2
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.4.1
widgetsnbextension==4.0.3
wslink==1.9.0
yarl==1.8.1
zipp==3.16.1
@PProfizi PProfizi added enhancement New feature or request examples Related to PyDPF-Post examples labels Oct 12, 2023
@PProfizi PProfizi transferred this issue from ansys/pydpf-core Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request examples Related to PyDPF-Post examples
Projects
None yet
Development

No branches or pull requests

2 participants