ansys / pymapdl

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

Array parameters retrieval fail when the size is very big #2844

Open germa89 opened 4 months ago

germa89 commented 4 months ago

As the title.

It will take extensive debugging in MAPDL.

Example

import numpy as np
from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl()

mapdl.finish()
mapdl.clear()

mapdl.prep7()
dimensions = 1E7

mapdl.dim("myarr","", dimensions)
mapdl.vfill("myarr","rand",0, 1)  # filling array with random numbers

# Retrieving
values = mapdl.parameters["myarr"]  # fail with "MapdlExitedError: MAPDL server connection terminated"

# Setting
myarr = np.random.rand(int(1E7))
mapdl.parameters["myarr2"] = myarr*2
germa89 commented 3 months ago

Hi German, So it looks like the issue is calling VREAD in a loop; at some point MAPDL crashes (still not sure if it is PyMAPDL or MAPDL). For this case I got rid of all the loops to set parameters and used the good old method of defining a huge table as a CSV and read it all at once using TREAD. Luckily it works!

What does mapdl.parameters["SET_PARAM"] = ... use behind the scenes? I am assuming it does exactly what I tried using *VREAD; that is why I see the exact same behaviour / crash?

By @ayush-kumar-423 Related to #2844