Update the mesh in PyAnsys

Hello,
I would like to update one mesh with another mesh using a PyMAPDL command. Specifically, I have a .db file that I'll load using the PyMAPDL command mapdl.resume(). After loading it, I save the mesh as a new parameter, let's call it original_mesh. Next, I make some modifications to node locations using the mapdl.n() command. Then, I perform an analysis on the modified mesh. Once the analysis is complete, I need to replace the modified mesh with the original_mesh. One approach to achieve this is by restoring the modified node locations to their original values, But, for that I need to run a mapdl.n() commad in a loop, and it is time consuming as the no. of nodes are very large.
Is there a way to directly replace the modified mesh with the original_mesh without the need for any loops or node-by-node updates?
Example:
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
fname='modalat.db'
mapdl.resume(fname)
original_mesh = mapdl.mesh.grid.copy
mapdl.prep7()
mapdl.n(10,1,2,3)
mapdl.n(11,2,0,0)
mapdl.run('/SOLU')
mapdl.solve()
!Here I need to replace mapdl.mesh with original_mesh
Please suggest how to do the same.
Thanks,
Dr. Samukham
Comments
-
@Rohith Patchigolla or @M do you have any ideas?
0 -
@Samukham, what do you mean by replace the mesh? When you run an analysis the results file is written and the mesh data is included. There is no tool to rewrite that data with different node locations. We can however still use it in conjunction with that alternate node data via DPF and other means. For that I again need more info about what you mean by “replacing” the mesh and more importantly, the meaningful end goal.
0 -
@Samukham, could you simply resume the db again to get the previous mesh. db file should still have the old mesh as you have not saved it.
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
fname='modalat.db'
mapdl.resume(fname)
original_mesh = mapdl.mesh.grid.copy
mapdl.prep7()
mapdl.n(10,1,2,3)
mapdl.n(11,2,0,0)
mapdl.run('/SOLU')
mapdl.solve()
!Here I need to replace mapdl.mesh with original_mesh
mapdl.resume(fname)
original_mesh = mapdl.mesh.grid.copy0