ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
421 stars 119 forks source link

Bug located in booleans.py #2266

Closed saschamk closed 1 year ago

saschamk commented 1 year ago

🤓 Before submitting the issue

🔍 Description of the bug

mapdl.asbl() seems to have a small bug in it's definition. When issuing the command in pyansys and specifying that the initial area is to be deleted (keepa="DELETE"), the initial area is not deleted. Workaround with specifing default values with BOPTN [ mapdl.boptn(value="NO") ] beforehand gets the job done.

When checking out the defintion of the asbl command, I think the error is in line 427 of file booleans.py (ansys-mapdl-core version 0.65.2)

Implementation is:

command = f"ASBL,{na},{nl},{keepa},{keepl}"

which should - according to my understanding - have an aditional komma before {keepa}:

command = f"ASBL,{na},{nl},,{keepa},{keepl}"

For reference, the APDL ASBL Command definition is: ASBL, NA, NL, --, KEEPA, KEEPL which has this blank space inbetween to presumably keep the format of for example the ASBA command that has the additional SEPO as a key: ASBA, NA, NL, SEPO, KEEPA, KEEPL

The corresponding MAPDL Code would be for example: FINISH /CLEAR,NOSTART /PREP7
k,1,0,0 k,2,0,1 k,3,1,1 k,4,1,0 a,1,2,3,4
l,1,3 asbl,1,5,,delete,keep

🕵️ Steps To Reproduce

#Minimum working example
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()

mapdl.prep7()
mapdl.k(1,0,0)
mapdl.k(2,1,0)
mapdl.k(3,1,1)
mapdl.k(4,0,1)
area_no = mapdl.a(1,2,3,4)
line_no = mapdl.l(1,3)

# mapdl.boptn(value="NO") # if issued, initial area is deleted

mapdl.asbl(na=area_no,nl=line_no,keepa="DELETE",keepl="KEEP") # keepa="delete" but area is still kept

mapdl.open_gui() # for visualization

mapdl.exit()

💻 Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.10

📝 PyMAPDL Report


PyMAPDL Software and Environment Report

Packages Requirements


Core packages

ansys.mapdl.core : 0.65.2 numpy : 1.23.3 appdirs : 1.4.4 scipy : 1.9.1 grpc : Package not found ansys.api.mapdl.v0 : Package not found ansys.mapdl.reader : 0.52.0 google.protobuf : Package not found

Optional packages

matplotlib : 3.5.3 pyvista : 0.36.1 pyiges : 0.3.1 tqdm : 4.64.1

Ansys Installation


Version Location

211 C:\Program Files\ANSYS Inc\v211

Ansys Environment Variables


ANSYS211_DIR C:\Program Files\ANSYS Inc\v211\ANSYS AWP_LOCALE211 de AWP_ROOT211 C:\Program Files\ANSYS Inc\v211 CADOE_LIBDIR211 C:\Program Files\ANSYS Inc\v211\CommonFiles\Language\de

📝 Installed packages

aiohttp==3.8.1 aiosignal==1.2.0 ansys-api-mapdl==0.5.1 ansys-api-platform-instancemanagement==1.0.0b3 ansys-mapdl-core==0.65.2 ansys-mapdl-reader==0.52.0 ansys-platform-instancemanagement==1.0.2 ansys-tools-path==0.3.1 appdirs==1.4.4 async-timeout==4.0.2 attrs==22.1.0 autopep8==2.0.1 certifi==2022.12.7 charset-normalizer==2.1.1 click==8.1.6 colorama==0.4.5 cycler==0.11.0 et-xmlfile==1.1.0 fatpack==0.7.7 fonttools==4.37.1 frozenlist==1.3.1 geomdl==5.3.1 googleapis-common-protos==1.56.4 grpcio==1.48.1 h5py==3.8.0 idna==3.3 imageio==2.21.3 importlib-metadata==4.12.0 kiwisolver==1.4.4 matplotlib==3.5.3 multidict==6.0.2 numpy==1.23.3 opencv-python==4.6.0.66 openpyxl==3.0.10 packaging==21.3 pandas==1.5.2 Pillow==9.2.0 platformdirs==3.10.0 protobuf==3.20.1 protoc-gen-swagger==0.1.0 psutil==5.9.5 pyansys-tools-versioning==0.4.0 pycodestyle==2.10.0 pyiges==0.3.1 pyparsing==3.0.9 python-dateutil==2.8.2 pytz==2022.7 pyvista==0.36.1 requests==2.28.2 scipy==1.9.1 scooby==0.6.0 six==1.16.0 tomli==2.0.1 tqdm==4.64.1 urllib3==1.26.14 vtk==9.2.0rc2 wslink==1.8.2 yarl==1.8.1 zipp==3.8.1

📝 Logger output file

No response

germa89 commented 1 year ago

Hi @saschamk

Thank you very much for opening this issue. I'm working on it already!