pymapdl
pymapdl copied to clipboard
Bug located in enriched command output for prcint
🤓 Before submitting the issue
- [X] I have visited the Troubleshooting section.
- [X] I have searched among the existing issues.
- [X] I am using a Python virtual environment.
- [X] I am using the latest version of PyMAPDL and its dependencies (fully updated virtual environment). You can update them using
pip install --upgrade --upgrade-strategy eager ansys-mapdl-corein your activated virtual environment.
🔍 Description of the bug
The three different enriched command outputs return empty for the prcint command.
🕵️ Steps To Reproduce
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl(loglevel="WARNING", print_com=True)
mapdl.clear()
mapdl.units("MPA")
# parameters
# material
EXX_1 = 210_000
PR_1 = 0.3
# loading
P = 10
# geometry
L = 30 # DISTANCE FROM THE SUPPORT POINT TO LOADING POINT
H = 0.6 # THICKNESS OF BEAM
AA = 10.0 # CRACK LENGTH
D = 3 # THE LEFT END TO SUPPORT POINT
BB = 0.2 # FINE MESH AREA
PP = -10 # LOADING
B = 1 # SPECIMEN WIDTH
NN = 1 # CHANGE OF MESH SIZE
mapdl.prep7()
# define element type for beam
mapdl.et(1, "PLANE182") # ELEMENT TYPE 182
mapdl.keyopt(1, 3, 2) # PLANE STRAIN
# MATERIAL PROPERTIES
mapdl.mp("EX", 1, EXX_1)
mapdl.mp("PRXY", 1, PR_1)
# use bottom up modeling starting with keypoints
mapdl.k(1, 0, 0)
mapdl.k(2, 2*(D+L))
mapdl.k(3, 2*(D+L), 2*H)
mapdl.k(4, '', 2*H)
mapdl.k(5, '', H)
mapdl.k(6, D+AA, H)
mapdl.k(7, '', H)
mapdl.k(8, D+AA-BB, H)
mapdl.k(9, D+AA-BB, H+BB)
mapdl.k(10, D+AA+BB, H+BB)
mapdl.k(11, D+AA+BB, H-BB)
mapdl.k(12, D+AA-BB, H-BB)
mapdl.k(13, D+AA-BB, H)
mapdl.k(21, D, 0)
mapdl.k(22, 2*(D+L)-D, 0)
mapdl.k(23, D+L, 2*H)
mapdl.k(26, D+AA+BB, H)
# define lines
mapdl.a(6, 26, 10, 9, 8)
mapdl.a(13, 12, 11, 26, 6)
mapdl.a(2, 3, 10, 26, 11)
mapdl.a(1, 21, 12, 13, 7)
mapdl.a(21, 22, 2, 11, 12)
mapdl.a(3, 23, 4, 9, 10)
mapdl.a(4, 5, 8, 9)
# size the areas 1 and 2 for meshing then mesh
mapdl.aesize(1, BB/10*NN)
mapdl.aesize(2, BB/10*NN)
mapdl.amesh(1, 2)
# size all areas except 1 and 2 and mesh
mapdl.asel("U", "AREA", "", 1, 2)
mapdl.aesize("ALL", BB/2*NN)
mapdl.amesh("ALL")
mapdl.allsel()
# define target and contact elements with the default keyopts
mapdl.et(2, "TARGE169")
mapdl.et(3, "CONTA172")
# define real constant set for the contact elements
# all default values will be used
mapdl.r(3)
# Generate the target surface
mapdl.lsel("S", "", "", 5, 23, 18)
mapdl.cm("TARGET", "LINE") # create component for later use
mapdl.type(2)
mapdl.nsll("S", 0)
mapdl.esln("S", 0)
mapdl.esurf()
mapdl.allsel()
# Generate the contact surface
mapdl.lsel("S", "", "", 9, 15, 6)
mapdl.cm("CONTACT", "LINE") # create component for later use
mapdl.type(3)
mapdl.nsll("S", 0)
mapdl.esln("S", 0)
mapdl.esurf()
mapdl.allsel()
# create component of crack tip node
mapdl.ksel("S", "KP", "", 6)
mapdl.nslk("S")
mapdl.cm("TIPP", "NODE")
mapdl.allsel("ALL")
mapdl.slashsolu()
mapdl.antype('static')
mapdl.time(1)
# create boundary conditions. clamp location
mapdl.ksel("S", "KP", "", 21)
mapdl.nslk("S")
mapdl.d("ALL", "UX")
mapdl.d("ALL", "UY")
mapdl.allsel()
# hold fixed in Y at other location
mapdl.ksel("S", "KP", "", 22)
mapdl.nslk("S")
mapdl.d("ALL", "UY")
mapdl.allsel()
# apply load
mapdl.ksel("S", "KP", "", 23)
mapdl.nslk("S")
mapdl.f("ALL", "FY", -P)
mapdl.allsel()
# DEFINE VCCT CRACK
mapdl.cint("NEW", 1)
mapdl.cint("TYPE", "VCCT")
mapdl.cint("CTNC", "TIPP") # set CRACK TIP NODE COMPONENT
mapdl.cint("SYMM", "OFF") # SYMMETRY OFF
mapdl.cint("NORMAL") # DEFINE CRACK PLANE NORMAL
mapdl.solve()
mapdl.finish()
mapdl.post1()
mapdl.set('last')
print(mapdl.prcint(1, 'tipp', 'G1'))
print(mapdl.prcint(1, 'tipp', 'G1').to_list())
💻 Which Operating System are you using?
Windows
🐍 Which Python version are you using?
3.10
📝 PyMAPDL Report
Show the Report!
PyMAPDL Software and Environment Report
Packages Requirements
*********************
Core packages
-------------
ansys.mapdl.core : 0.67.0
numpy : 1.24.2
platformdirs : 3.9.1
scipy : 1.10.1
grpc : Package not found
ansys.api.mapdl.v0 : Package not found
ansys.mapdl.reader : 0.52.19
google.protobuf : Package not found
Optional packages
-----------------
matplotlib : 3.7.1
pyvista : 0.42.3
pyiges : 0.3.1
tqdm : 4.65.0
Ansys Installation
******************
Version Location
------------------
201 C:\Program Files\ANSYS Inc\v201
202 C:\Program Files\ANSYS Inc\v202
211 C:\Program Files\ANSYS Inc\v211
212 C:\Program Files\ANSYS Inc\v212
221 C:\Program Files\ANSYS Inc\v221
222 C:\Program Files\ANSYS Inc\v222
231 C:\Program Files\ANSYS Inc\v231
232 C:\Program Files\ANSYS Inc\v232
Ansys Environment Variables
***************************
ANSYS201_DIR C:\Program Files\ANSYS Inc\v201\ANSYS
ANSYS202_DIR C:\Program Files\ANSYS Inc\v202\ANSYS
ANSYS211_DIR C:\Program Files\ANSYS Inc\v211\ANSYS
ANSYS212_DIR C:\Program Files\ANSYS Inc\v212\ANSYS
ANSYS221_DIR C:\Program Files\ANSYS Inc\v221\ANSYS
ANSYS222_DIR C:\Program Files\ANSYS Inc\v222\ANSYS
ANSYS231_DIR C:\Program Files\ANSYS Inc\v231\ANSYS
ANSYS232_DIR C:\Program Files\ANSYS Inc\v232\ANSYS
ANSYSCLOUDCLI_ROOT C:\Program Files\ANSYS Inc\ANSYS Cloud\ANSYS Cloud CLI\
ANSYSELECTRON_ROOT C:\Program Files\ANSYS Inc\ANSYS Cloud\ANSYS Electron\
ANSYSEM_ROOT231 C:\Program Files\AnsysEM\v231\Win64
ANSYSLIC_DIR C:\Program Files\ANSYS Inc\Shared Files\Licensing
ANSYSNCODE221_DIR C:\Program Files\nCode\ANSYS 2022 R1 nCode DesignLife 64-bit
ANSYS_SYSDIR winx64
ANSYS_SYSDIR32 win32
AWP_LOCALE201 en-us
AWP_LOCALE202 en-us
AWP_LOCALE211 en-us
AWP_LOCALE212 en-us
AWP_LOCALE221 en-us
AWP_LOCALE222 en-us
AWP_LOCALE231 en-us
AWP_LOCALE232 en-us
AWP_ROOT201 C:\Program Files\ANSYS Inc\v201
AWP_ROOT202 C:\Program Files\ANSYS Inc\v202
AWP_ROOT211 C:\Program Files\ANSYS Inc\v211
AWP_ROOT212 C:\Program Files\ANSYS Inc\v212
AWP_ROOT221 C:\Program Files\ANSYS Inc\v221
AWP_ROOT222 C:\Program Files\ANSYS Inc\v222
AWP_ROOT231 C:\Program Files\ANSYS Inc\v231
AWP_ROOT232 C:\Program Files\ANSYS Inc\v232
CADOE_LIBDIR201 C:\Program Files\ANSYS Inc\v201\CommonFiles\Language\en-us
CADOE_LIBDIR211 C:\Program Files\ANSYS Inc\v211\CommonFiles\Language\en-us
CADOE_LIBDIR212 C:\Program Files\ANSYS Inc\v212\CommonFiles\Language\en-us
CADOE_LIBDIR221 C:\Program Files\ANSYS Inc\v221\CommonFiles\Language\en-us
CADOE_LIBDIR222 C:\Program Files\ANSYS Inc\v222\CommonFiles\Language\en-us
CADOE_LIBDIR231 C:\Program Files\ANSYS Inc\v231\CommonFiles\Language\en-us
CADOE_LIBDIR232 C:\Program Files\ANSYS Inc\v232\CommonFiles\Language\en-us
ICEFLOW_ANSYS_PORT 9600
📝 Installed packages
Show the installed packages!
aiofiles==22.1.0
aiohttp==3.8.4
aiosignal==1.3.1
aiosqlite==0.18.0
ansys-api-mapdl==0.5.1
ansys-api-platform-instancemanagement==1.0.0b3
ansys-dpf-core==0.8.1
ansys-dpf-gate==0.3.1
ansys-dpf-gatebin==0.3.1
ansys-grpc-dpf==0.7.1
ansys-mapdl-core==0.67.0
ansys-mapdl-reader==0.52.19
ansys-math-core==0.1.3
ansys-platform-instancemanagement==1.1.1
ansys-tools-path==0.3.1
anyio==3.6.2
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
arrow==1.2.3
asttokens==2.2.1
async-lru==2.0.4
async-timeout==4.0.2
attrs==22.2.0
Babel==2.12.1
backcall==0.2.0
beautifulsoup4==4.12.0
bleach==6.0.0
bokeh==3.2.2
cachetools==5.3.1
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
cmocean==3.0.3
colorama==0.4.6
colorcet==3.0.1
comm==0.1.4
contourpy==1.0.7
cycler==0.11.0
debugpy==1.6.6
decorator==5.1.1
defusedxml==0.7.1
executing==1.2.0
fastjsonschema==2.16.3
flake8==7.0.0
fonttools==4.39.2
fqdn==1.5.1
frozenlist==1.3.3
geomdl==5.3.1
google-api-core==2.11.1
google-api-python-client==2.92.0
google-auth==2.21.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.58.0
grpcio==1.51.3
httplib2==0.22.0
idna==3.4
imageio==2.26.1
importlib-metadata==6.1.0
ipycanvas==0.13.1
ipydatawidgets==4.3.5
ipyevents==2.0.2
ipykernel==6.22.0
ipython==8.11.0
ipython-genutils==0.2.0
ipyvtklink==0.2.3
ipywidgets==8.1.1
isoduration==20.11.0
jedi==0.18.2
Jinja2==3.1.2
json5==0.9.11
jsonpointer==2.3
jsonschema==4.17.3
jupyter-events==0.6.3
jupyter-lsp==2.2.0
jupyter-ydoc==0.2.3
jupyter_client==8.1.0
jupyter_core==5.3.0
jupyter_server==2.5.0
jupyter_server_fileid==0.8.0
jupyter_server_proxy==4.1.0
jupyter_server_terminals==0.4.4
jupyter_server_ydoc==0.8.0
jupyterlab==4.0.7
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.9
jupyterlab_server==2.20.0
kiwisolver==1.4.4
linkify-it-py==2.0.2
Markdown==3.5
markdown-it-py==3.0.0
MarkupSafe==2.1.2
matplotlib==3.7.1
matplotlib-inline==0.1.6
mccabe==0.7.0
mdit-py-plugins==0.4.0
mdurl==0.1.2
meshio==5.3.4
mistune==2.0.5
multidict==6.0.4
nbclassic==0.5.3
nbclient==0.7.2
nbconvert==7.2.10
nbformat==5.8.0
nest-asyncio==1.5.6
notebook==6.5.3
notebook_shim==0.2.2
numpy==1.24.2
packaging==23.0
pandas==2.0.2
pandocfilters==1.5.0
panel==1.2.3
param==1.13.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.4.0
platformdirs==3.9.1
pooch==1.7.0
prometheus-client==0.16.0
prompt-toolkit==3.0.38
protobuf==3.20.3
protoc-gen-swagger==0.1.0
psutil==5.9.4
pure-eval==0.2.2
pyansys-tools-versioning==0.4.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycodestyle==2.11.1
pycparser==2.21
pyct==0.5.0
pyflakes==3.2.0
Pygments==2.14.0
pyiges==0.3.1
pyparsing==3.0.9
pyrsistent==0.19.3
python-dateutil==2.8.2
python-json-logger==2.0.7
pythreejs==2.4.2
pytz==2023.3
pyvista==0.42.3
pyviz_comms==3.0.0
pywin32==305
pywinpty==2.0.10
PyYAML==6.0
pyzmq==25.0.2
requests==2.28.2
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==13.6.0
rsa==4.9
scipy==1.10.1
scooby==0.7.1
Send2Trash==1.8.0
simpervisor==1.0.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.4
stack-data==0.6.2
terminado==0.17.1
tinycss2==1.2.1
tomli==2.0.1
tornado==6.2
tqdm==4.65.0
traitlets==5.9.0
traittypes==0.2.1
trame==3.2.7
trame-client==2.12.6
trame-components==2.1.0
trame-deckgl==2.0.1
trame-markdown==2.0.2
trame-matplotlib==2.0.1
trame-plotly==2.1.0
trame-rca==0.3.0
trame-router==2.0.1
trame-server==2.12.0
trame-simput==2.3.1
trame-vega==2.0.2
trame-vtk==2.5.9
trame-vuetify==2.3.1
typing_extensions==4.8.0
tzdata==2023.3
uc-micro-py==1.0.2
uri-template==1.2.0
uritemplate==4.1.1
urllib3==1.26.15
vtk==9.2.6
wcwidth==0.2.6
webcolors==1.12
webencodings==0.5.1
websocket-client==1.5.1
widgetsnbextension==4.0.9
wslink==1.12.3
xyzservices==2023.10.0
y-py==0.5.9
yarl==1.8.2
ypy-websocket==0.8.2
zipp==3.15.0
📝 Logger output file
Show the logger output file.
# PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE.
Hi @mikerife
Thank you for opening this issue.
I get the following ouput from the last two print commands:
***** POST1 VCCT RESULT LISTING *****
CrackID = 1
Crack Front Node = 1
ENERGY RELEASE RATE Values = 0.32585E-03
[]
What kind of output do you expect? Something like:
>>> print(mapdl.prcint(1, 'tipp', 'G1').to_list())
[1,1,0.32585E-03]
Meaning, a list of list, for each element: [% CrackID%, %CrackFrontNode%, %ENERGYRELEASERATE%]??
Regarding the dataframe output, I guess the best bet is to have each row (index) as the crack ID?
>>> print(mapdl.prcint(1, 'tipp', 'G1').to_dataframe())
Crack Front node Energy Release Rate
1 1 0.000326
>>> # Same as:
>>> print(pd.DataFrame(columns=["Crack Front node", "Energy Release Rate"], data=[[1,0.32585E-03]], index=[1]))
Crack Front node Energy Release Rate
1 1 0.000326
Hi @germa89 yeah, those seem to follow the expectations comparing to other listing commands with enhanced output. On that example if you issue:
mapdl.prcint(1)
It will print the G1, G2, G3, and GSUM which could be a more useful post processing step. I had added G1 just to double check the enhanced output behavior.
Mike
Ok ... can we assume then that all the output from prcint will follow:
CrackID = % only_one_integer%
Crack Front Node = %only_one_integer%
ENERGY RELEASE RATE Values = %between 1 and 4 floats scientific notation%
Is Crack Front Node always only one node? 🤔
@germa89 No, not in 3D. Then any of the nodes at the crack front can be used/reported. Let me get you an example or two of multiple cracks and multiple crack front node.
I will wait for your input then. :)