ansys / pymapdl

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

Saving the instance of ``Mapdl`` when issuing ``mapdl.save()`` #727

Closed germa89 closed 2 years ago

germa89 commented 2 years ago

Current situation When you issue mapdl.save(), PyMAPDL is issuing SAVE MAPDL command which is fine.

Request I believe there should be an optional argument to also store the mapdl instance in an additional binary file hence when you issue next time mapdl. resume() in a different python session, you will get back to the state you were when you issued SAVE with all the correspondent mapdl attributes.

Suggestion We could use the pickle library to create the binary object. Some attributes might not be appropriate to get restored/saved or they might need to be reseted when issuing mapdl.resume(), it should be considered which ones.

akaszynski commented 2 years ago

While it's a good idea, I think this will be quite challenging. For one, while we could serialize the MAPDL mesh, we'd still have to track boundary conditions, solver settings, mesh settings, etc. There's quite a bit to track here and I think that serializing everything in the MAPDL database would be quite an undertaking. That's not to say it's not doable, but I think it might not be something worth investing time in considering the multitude of other issues to track.

If there are Python specific parameters that we need to keep track of, we can consider creating a "companion" pickle file, but as of now within pymapdl, I don't think we create anything "orphaned" from MAPDL's database.

germa89 commented 2 years ago

mmhh... I see what you mean. Wouldn't you track the boundary conditions, mesh settings, etc using the RESUME apdl command? I agree it could overload the grpc connection if you need to send the whole CDB file to be RESUMED. But I feel it will be quite useful to be able to load an existing session.

Anyway, it might be useful to have a look in the future.

germa89 commented 2 years ago

Closing issue. #Stale We can just run the same code again.