ansys / pydpf-composites

A Python wrapper for Ansys DPF for the post-processing of composite structures.
https://composites.dpf.docs.pyansys.com
MIT License
8 stars 1 forks source link

003_short_fiber_example #383

Open MNymannG opened 10 months ago

MNymannG commented 10 months ago

๐Ÿ” Before submitting the issue

๐Ÿž Description of the bug

Directly downloading short fiber example and running it yields the following import error. Seems something in data_sources has not been updated along with example code from previous version.

runfile('C:/Users/104121/Anisotropic_test/003_short_fiber_example.py', wdir='C:/Users/104121/Anisotropic_test') Traceback (most recent call last):

File C:\pyansysvenv\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals)

File c:\users\104121\anisotropic_test\003_short_fiber_example.py:34 from ansys.dpf.composites.data_sources import get_short_fiber_composites_data_sources

ImportError: cannot import name 'get_short_fiber_composites_data_sources' from 'ansys.dpf.composites.data_sources' (C:\pyansysvenv\lib\site-packages\ansys\dpf\composites\data_sources.py)

๐Ÿ“ Steps to reproduce

Direct download and run of code for both spyder and jupyterlab yields the error above.

๐Ÿ’ป Which operating system are you using?

Windows

๐Ÿ“€ Which ANSYS version are you using?

2021R2

๐Ÿ Which Python version are you using?

3.10

๐Ÿ“ฆ Installed packages

I see a version issue between pyansys and ansys-dpf-core where i have upgraded dpf-core

(pyansysvenv) C:\Users\104121>python -m pip freeze
alabaster==0.7.13
ansys-api-fluent==0.3.12
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.0
ansys-api-pyensight==0.3.0
ansys-api-sherlock==0.1.14
ansys-api-systemcoupling==0.1.0
ansys-dpf-composites==0.2.0
ansys-dpf-core==0.10.0
ansys-dpf-gate==0.3.1
ansys-dpf-gatebin==0.4.1
ansys-dpf-post==0.4.0
ansys-dynamicreporting-core==0.4.0
ansys-fluent-core==0.14.0
ansys-grantami-bomanalytics==1.1.3
ansys-grantami-bomanalytics-openapi==1.0.0
ansys-grantami-recordlists==1.0.0
ansys-grantami-serverapi-openapi==1.0.0
ansys-grpc-dpf==0.8.1
ansys-mapdl-core==0.64.1
ansys-mapdl-reader==0.52.20
ansys-math-core==0.1.1
ansys-mechanical-core==0.8.0
ansys-meshing-prime==0.4.1
ansys-motorcad-core==0.1.3
ansys-openapi-common==1.2.1
ansys-optislang-core==0.2.1
ansys-platform-instancemanagement==1.1.1
ansys-pyensight-core==0.5.3
ansys-pythonnet==3.1.0rc1
ansys-seascape==0.2.0
ansys-sherlock-core==0.2.0
ansys-systemcoupling-core==0.1.3
appdirs==1.4.4
arrow==1.3.0
asgiref==3.7.2
astroid==2.15.8
asttokens==2.4.1
atomicwrites==1.4.1
attrs==23.1.0
autopep8==2.0.4
Babel==2.13.1
bcrypt==4.0.1
beautifulsoup4==4.12.2
binaryornot==0.4.4
black==23.10.1
bleach==6.1.0
build==1.0.3
cachetools==5.3.2
certifi==2023.7.22
cffi==1.16.0
chardet==5.2.0
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==3.0.0
clr-loader==0.2.6
colorama==0.4.6
comm==0.2.0
contourpy==1.2.0
cookiecutter==2.4.0
cryptography==41.0.5
cycler==0.12.1
debugpy==1.8.0
decorator==5.1.1
defusedxml==0.7.1
diff-match-patch==20230430
dill==0.3.7
Django==4.2.7
docstring-to-markdown==0.13
docutils==0.20.1
exceptiongroup==1.1.3
executing==2.0.1
fastjsonschema==2.18.1
filelock==3.13.1
flake8==6.0.0
fonttools==4.44.0
google-api-core==2.12.0
google-api-python-client==2.106.0
google-auth==2.23.4
google-auth-httplib2==0.1.1
googleapis-common-protos==1.61.0
grpcio==1.59.2
grpcio-status==1.48.2
h5py==3.10.0
httplib2==0.22.0
idna==3.4
imagesize==1.4.1
importlib-metadata==6.8.0
inflection==0.5.1
intervaltree==3.1.0
ipykernel==6.26.0
ipython==8.17.2
ipython-genutils==0.2.0
isort==5.12.0
jaraco.classes==3.3.0
jedi==0.18.2
jellyfish==1.0.1
Jinja2==3.1.2
jsonschema==4.19.2
jsonschema-specifications==2023.7.1
jupyter_client==8.6.0
jupyter_core==5.5.0
jupyterlab-pygments==0.2.2
keyring==24.2.0
kiwisolver==1.4.5
lazy-object-proxy==1.9.0
lxml==4.9.3
markdown-it-py==3.0.0
MarkupSafe==2.1.3
matplotlib==3.8.1
matplotlib-inline==0.1.6
mccabe==0.7.0
mdurl==0.1.2
mistune==3.0.2
more-itertools==10.1.0
mypy-extensions==1.0.0
nbclient==0.8.0
nbconvert==7.11.0
nbformat==5.9.2
nest-asyncio==1.5.8
nh3==0.2.14
numpy==1.26.1
numpydoc==1.6.0
packaging==23.2
pandas==2.1.2
pandocfilters==1.5.0
paramiko==3.3.1
parso==0.8.3
pathspec==0.11.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==10.1.0
pkginfo==1.9.6
platformdirs==3.11.0
pluggy==1.3.0
plumbum==1.8.2
pooch==1.8.0
prompt-toolkit==3.0.39
protobuf==3.20.3
psutil==5.9.6
ptyprocess==0.7.0
pure-eval==0.2.2
pyaedt==0.6.76
pyansys==2023.2.11
pyansys-docker==5.0.4
pyansys-tools-versioning==0.5.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycodestyle==2.10.0
pycparser==2.21
pydocstyle==6.3.0
pyflakes==3.0.1
Pygments==2.16.1
pyiges==0.3.1
pylint==2.17.7
pylint-venv==3.0.3
pyls-spyder==0.4.0
PyNaCl==1.5.0
pyparsing==3.1.1
pypiwin32==223
pypng==0.20220715.0
pyproject_hooks==1.0.0
PyQt5==5.15.10
PyQt5-Qt5==5.15.2
PyQt5-sip==12.13.0
PyQtWebEngine==5.15.6
PyQtWebEngine-Qt5==5.15.2
pyspnego==0.10.2
python-dateutil==2.8.2
python-lsp-black==1.3.0
python-lsp-jsonrpc==1.1.2
python-lsp-server==1.7.4
python-slugify==8.0.1
pythonnet==3.0.1
pytoolconfig==1.2.6
pytwin==0.3.0
pytz==2023.3.post1
pyvista==0.42.3
pywin32==306
pywin32-ctypes==0.2.2
PyYAML==6.0.1
pyzmq==25.1.1
QDarkStyle==3.1
qstylizer==0.2.2
QtAwesome==1.2.3
qtconsole==5.4.4
QtPy==2.4.1
readme-renderer==42.0
referencing==0.30.2
requests==2.31.0
requests-negotiate-sspi==0.5.2
requests-ntlm==1.2.0
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==13.6.0
rope==1.11.0
rpds-py==0.12.0
rpyc==5.3.1
rsa==4.9
Rtree==1.1.0
scipy==1.11.3
scooby==0.9.2
six==1.16.0
snowballstemmer==2.2.0
sortedcontainers==2.4.0
soupsieve==2.5
Sphinx==7.2.6
sphinxcontrib-applehelp==1.0.7
sphinxcontrib-devhelp==1.0.5
sphinxcontrib-htmlhelp==2.0.4
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.6
sphinxcontrib-serializinghtml==1.1.9
spyder==5.4.5
spyder-kernels==2.4.4
sqlparse==0.4.4
sspilib==0.1.0
stack-data==0.6.3
tabulate==0.9.0
text-unidecode==1.3
textdistance==4.6.0
three-merge==0.1.1
tinycss2==1.2.1
tomli==2.0.1
tomlkit==0.12.2
tornado==6.3.3
tqdm==4.66.1
traitlets==5.13.0
twine==4.0.2
types-python-dateutil==2.8.19.14
typing==3.7.4.3
typing_extensions==4.8.0
tzdata==2023.3
ujson==5.8.0
uritemplate==4.1.1
urllib3==1.26.18
vtk==9.2.6
watchdog==3.0.0
wcwidth==0.2.9
webencodings==0.5.1
websocket-client==1.6.4
whatthepatch==1.0.5
wrapt==1.15.0
yapf==0.40.2
zipp==3.17.0
greschd commented 10 months ago

Hi @MNymannG ๐Ÿ‘‹

Thanks for reporting this issue.

From the "Installed packages" list, it seems you're using version 0.2.0 of ansys-dpf-composites [1], whereas the downloaded example probably refers to 0.3.2. You can find the example corresponding to 0.2.0 here: https://composites.dpf.docs.pyansys.com/version/0.2/examples/gallery_examples/3_short_fiber_example.html#sphx-glr-examples-gallery-examples-3-short-fiber-example-py

You can choose which version the documentation refers to using a drop-down in the top-right corner of the page: image

Another issue you may encounter is that the 2021R2 Ansys version does not support PyDPF Composites. You can find a list of compatible versions on this page.

[1] The 0.2.0 version is part of the currently latest pyansys meta-package release 2023.2.11.

MNymannG commented 10 months ago

Hi Dominik

Thank you for your fast response! I think the Ansys compatibility explains my issue with version 0.2.0 as the fatigue plot did not run correctly when I tried it.

Do you know if there is a way to select the ansys version if you have multiple installed?

Best Mads

From: Dominik Gresch @.> Sent: 13. november 2023 17:13 To: ansys/pydpf-composites @.> Cc: Mads Enggrob Nymann @.>; Mention @.> Subject: Re: [ansys/pydpf-composites] 003_short_fiber_example (Issue #383)

Hi @MNymannGhttps://github.com/MNymannG ๐Ÿ‘‹

Thanks for reporting this issue.

From the "Installed packages" list, it seems you're using version 0.2.0 of ansys-dpf-composites [1], whereas the downloaded example probably refers to 0.3.2. You can find the example corresponding to 0.2.0 here: https://composites.dpf.docs.pyansys.com/version/0.2/examples/gallery_examples/3_short_fiber_example.html#sphx-glr-examples-gallery-examples-3-short-fiber-example-py

Note that you can choose the version of the documentation for PyAnsys libraries using a drop-down in the top-right corner of the page: [image]https://user-images.githubusercontent.com/5692808/282517734-bdc79661-976d-438b-a901-7cd5af3b525b.png

Please also note, the 2021R2 Ansys version does not support PyDPF Composites. You can find a list of compatible versions on this pagehttps://composites.dpf.docs.pyansys.com/version/stable/intro.html#compatibility.

[1] The 0.2.0 version is part of the currently latest pyansys meta-package release 2023.2.11https://github.com/ansys/pyansys/releases/tag/v2023.2.11.

โ€” Reply to this email directly, view it on GitHubhttps://github.com/ansys/pydpf-composites/issues/383#issuecomment-1808474454, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XUJAMAUZ2AMCZE2BTSRTYEJBHFAVCNFSM6AAAAAA7JJMPZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBYGQ3TINBVGQ. You are receiving this because you were mentioned.Message ID: @.**@.>>

greschd commented 10 months ago

Do you know if there is a way to select the ansys version if you have multiple installed?

Yes, you can pass the ansys_path parameter to the connect_to_or_start_server function. So, for example

server = connect_to_or_start_server(ansys_path="C:\\Program Files\\ANSYS Inc\\v232")

Alternatively, if you are running DPF in a Docker container (docs), this function accepts the IP and port for the server. For example:

server = connect_to_or_start_server(ip="127.0.0.1", port=50052)

The corresponding documentation can be found here: https://composites.dpf.docs.pyansys.com/version/0.2/api/_autosummary/ansys.dpf.composites.server_helpers.connect_to_or_start_server.html#connect-to-or-start-server

MNymannG commented 10 months ago

Thank you very much for your support! I donโ€™t know if you have time for more support on this. Iโ€™m quite new with python and have some difficulty understanding the structure.

Iโ€™m trying to import my own data files to run failure analysis for short fiber composites with the following: @.***

I get the following error: @.***

Iโ€™m trying to do a fatigue evaluation of the following ansys model with imported fiber direction of a short fiber composite. @.***

Hope you have time for a bit more guidance.

Thank you. Best regards Mads

From: Dominik Gresch @.> Sent: 14. november 2023 11:44 To: ansys/pydpf-composites @.> Cc: Mads Enggrob Nymann @.>; Mention @.> Subject: Re: [ansys/pydpf-composites] 003_short_fiber_example (Issue #383)

Do you know if there is a way to select the ansys version if you have multiple installed?

Yes, you can pass the ansys_path parameter to the connect_to_or_start_server function. So, for example

server = connect_to_or_start_server(ansys_path="C:\Program Files\ANSYS Inc\v232")

Alternatively, if you are running DPF in a Docker container (docshttps://dpf.docs.pyansys.com/version/stable/user_guide/getting_started_with_dpf_server.html#run-dpf-server-in-a-docker-container), this function accepts the IP and port for the server. For example:

server = connect_to_or_start_server(ip="127.0.0.1", port=50052)

The corresponding documentation can be found here: https://composites.dpf.docs.pyansys.com/version/0.2/api/_autosummary/ansys.dpf.composites.server_helpers.connect_to_or_start_server.html#connect-to-or-start-server

โ€” Reply to this email directly, view it on GitHubhttps://github.com/ansys/pydpf-composites/issues/383#issuecomment-1809961195, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XUJCUITEDYFH6N6ASQTLYENDN7AVCNFSM6AAAAAA7JJMPZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBZHE3DCMJZGU. You are receiving this because you were mentioned.Message ID: @.**@.>>

MNymannG commented 10 months ago

Hi again,

Figured out that I needed the short_fiber get data. Now Iโ€™m stuck at the field variable provider:

@.***

@.***

I canโ€™t really tell what the dpf.operator does and the input it takes.

Best Regards Mads

From: Mads Enggrob Nymann Sent: 14. november 2023 15:54 To: ansys/pydpf-composites @.>; ansys/pydpf-composites @.> Cc: Mention @.***> Subject: RE: [ansys/pydpf-composites] 003_short_fiber_example (Issue #383)

Thank you very much for your support! I donโ€™t know if you have time for more support on this. Iโ€™m quite new with python and have some difficulty understanding the structure.

Iโ€™m trying to import my own data files to run failure analysis for short fiber composites with the following: @.***

I get the following error: @.***

Iโ€™m trying to do a fatigue evaluation of the following ansys model with imported fiber direction of a short fiber composite. @.***

Hope you have time for a bit more guidance.

Thank you. Best regards Mads

From: Dominik Gresch @.**@.>> Sent: 14. november 2023 11:44 To: ansys/pydpf-composites @.**@.>> Cc: Mads Enggrob Nymann @.**@.>>; Mention @.**@.>> Subject: Re: [ansys/pydpf-composites] 003_short_fiber_example (Issue #383)

Do you know if there is a way to select the ansys version if you have multiple installed?

Yes, you can pass the ansys_path parameter to the connect_to_or_start_server function. So, for example

server = connect_to_or_start_server(ansys_path="C:\Program Files\ANSYS Inc\v232")

Alternatively, if you are running DPF in a Docker container (docshttps://dpf.docs.pyansys.com/version/stable/user_guide/getting_started_with_dpf_server.html#run-dpf-server-in-a-docker-container), this function accepts the IP and port for the server. For example:

server = connect_to_or_start_server(ip="127.0.0.1", port=50052)

The corresponding documentation can be found here: https://composites.dpf.docs.pyansys.com/version/0.2/api/_autosummary/ansys.dpf.composites.server_helpers.connect_to_or_start_server.html#connect-to-or-start-server

โ€” Reply to this email directly, view it on GitHubhttps://github.com/ansys/pydpf-composites/issues/383#issuecomment-1809961195, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XUJCUITEDYFH6N6ASQTLYENDN7AVCNFSM6AAAAAA7JJMPZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBZHE3DCMJZGU. You are receiving this because you were mentioned.Message ID: @.**@.>>

greschd commented 10 months ago

Hi Mads,

It seems since you replied via e-mail, GitHub treated some of the error message as e-mail addresses and removed them. I can only see ***@***.***.

Would you mind posting the errors directly on Github, or editing the comments above?

Thank you, Dominik

MNymannG commented 10 months ago

Hi Dominik,

Sorry about that. I have solved the issues, but I have a follow-up question: Can you explain how the failure criteria works in the given example as I canโ€™t tell where Tsai-Hill is chosen. Is it through this line? sf_op = dpf.Operator("composite::short_fiber_failure_criterion_evaluator") Is there a place where I can find a description of these ("composite::short_fiber_failure_criterion_evaluator") and how to apply them in a operator? I canโ€™t seem to find them in the API. Lastly, Iโ€™m trying to apply them to fatigue test scenarios and Iโ€™m looking for a suitable failure criteria. Weโ€™ve used Tsai-Hill before but it has been shown not to be that precise. Do you know if anyone made a Mod. Gerber, cyclic strain rate or any similar fatigue criteria?

Best Mads

From: Dominik Gresch @.> Sent: 14. november 2023 11:44 To: ansys/pydpf-composites @.> Cc: Mads Enggrob Nymann @.>; Mention @.> Subject: Re: [ansys/pydpf-composites] 003_short_fiber_example (Issue #383)

Do you know if there is a way to select the ansys version if you have multiple installed?

Yes, you can pass the ansys_path parameter to the connect_to_or_start_server function. So, for example

server = connect_to_or_start_server(ansys_path="C:\Program Files\ANSYS Inc\v232")

Alternatively, if you are running DPF in a Docker container (docshttps://dpf.docs.pyansys.com/version/stable/user_guide/getting_started_with_dpf_server.html#run-dpf-server-in-a-docker-container), this function accepts the IP and port for the server. For example:

server = connect_to_or_start_server(ip="127.0.0.1", port=50052)

The corresponding documentation can be found here: https://composites.dpf.docs.pyansys.com/version/0.2/api/_autosummary/ansys.dpf.composites.server_helpers.connect_to_or_start_server.html#connect-to-or-start-server

โ€” Reply to this email directly, view it on GitHubhttps://github.com/ansys/pydpf-composites/issues/383#issuecomment-1809961195, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XUJCUITEDYFH6N6ASQTLYENDN7AVCNFSM6AAAAAA7JJMPZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBZHE3DCMJZGU. You are receiving this because you were mentioned.Message ID: @.**@.>>

janvonrickenbach commented 10 months ago

@FedericoNegri Do you have any more documentation on the short fiber workflow in dpf, especially on the fatigue operators?

MNymannG commented 10 months ago

Hi,

Is it possible to find any documentation?

Best Mads

From: janvonrickenbach @.> Sent: 16. november 2023 09:21 To: ansys/pydpf-composites @.> Cc: Mads Enggrob Nymann @.>; Mention @.> Subject: Re: [ansys/pydpf-composites] 003_short_fiber_example (Issue #383)

@FedericoNegrihttps://github.com/FedericoNegri Do you have any more documentation on the short fiber workflow in dpf, especially on the fatigue operators?

โ€” Reply to this email directly, view it on GitHubhttps://github.com/ansys/pydpf-composites/issues/383#issuecomment-1813981286, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XUJDKIBP7UILUD3P2EJ3YEXEHJAVCNFSM6AAAAAA7JJMPZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTHE4DCMRYGY. You are receiving this because you were mentioned.Message ID: @.**@.>>

janvonrickenbach commented 10 months ago

Hi @MNymannG,

I forwarded your request, you should be contacted soon by your channel partner.

MNymannG commented 10 months ago

Hi,

Thank you very much.

From: janvonrickenbach @.> Sent: 22. november 2023 09:34 To: ansys/pydpf-composites @.> Cc: Mads Enggrob Nymann @.>; Mention @.> Subject: Re: [ansys/pydpf-composites] 003_short_fiber_example (Issue #383)

Hi @MNymannGhttps://github.com/MNymannG,

I forwarded your request, you should be contacted soon by your channel partner.

โ€” Reply to this email directly, view it on GitHubhttps://github.com/ansys/pydpf-composites/issues/383#issuecomment-1822318934, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XUJESWAYTKTWAITSLHRTYFW2GNAVCNFSM6AAAAAA7JJMPZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRSGMYTQOJTGQ. You are receiving this because you were mentioned.Message ID: @.**@.>>

MNymannG commented 8 months ago

Hi Jan,

Are there any updates on this?

Best Mads

From: janvonrickenbach @.> Sent: 16. november 2023 09:21 To: ansys/pydpf-composites @.> Cc: Mads Enggrob Nymann @.>; Mention @.> Subject: Re: [ansys/pydpf-composites] 003_short_fiber_example (Issue #383)

@FedericoNegrihttps://github.com/FedericoNegri Do you have any more documentation on the short fiber workflow in dpf, especially on the fatigue operators?

โ€” Reply to this email directly, view it on GitHubhttps://github.com/ansys/pydpf-composites/issues/383#issuecomment-1813981286, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XUJDKIBP7UILUD3P2EJ3YEXEHJAVCNFSM6AAAAAA7JJMPZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTHE4DCMRYGY. You are receiving this because you were mentioned.Message ID: @.**@.>>

janvonrickenbach commented 8 months ago

Hi @MNymannG,

Sorry for the delay. I forwarded your request in November, but apperently nothing happened. I forwarded your request again, please let me know if you don't hear anything within a week.