ansys / pymapdl

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

Bug located in DIM command. #3327

Open mikerife opened 1 month ago

mikerife commented 1 month ago

🤓 Before submitting the issue

🔍 Description of the bug

When defining a 4 or 5 D array the number of 'extents' and 'variables' change to match the array dimension. So for a 4D array the extents add 'LMAX' and 'VAR4'. PyMAPDL only condsiders dimensions up to 3.

The "TYPE" on the PyMAPDL command page will need updating as well as the type is 'ARR4' for a 4D array and similar with 5D.

🕵️ Steps To Reproduce

The log will automatically be formatted as Python code! No need to type backticks.

💻 Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.10

💾 Which MAPDL version are you using?

24R1

📝 PyMAPDL Report

Show the Report! ```text # PASTE HERE THE OUTPUT OF `python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())"` here ```

📝 Installed packages

Show the installed packages! ```text # PASTE HERE THE OUTPUT OF `python -m pip freeze` here ```

📝 Logger output file

Show the logger output file. ```text # PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE. ```
mikerife commented 1 month ago

@germa89 @clatapie perhaps it is better to have a "dim4" and "dim5" commands as the MAPDL behavior of dim is 'anti-pattern' for Python as the number of function fields can change....??? @mcMunich and @pmaroneh do you have any thoughts here? mike

germa89 commented 1 month ago

Hi @mikerife

Thank you for bringing this up. You are right, that it is an anti-pattern changing the number of arguments.

I am not 100% sure how to fix this. But I would probably add a function that wraps mapdl.dim and if type is TAB4 or TAB5, then redirect the output to another dim function (maybe mapdl._dim45 for instance). If not, just use the default mapdl.dim. I think it is not very transparent to the user, but it is also how MAPDL is defined.... so 🤷🏻‍♂️

What do you think @koubaa ??