I am attempting to solve a simple PDE on a defined mesh, then I wish to rotate that solution (the mesh is centered around the origin) so that it may be interpolated onto another mesh.
I know I have access to the points by means of:
for v in mesh.vertices:
print(v.point)
but unfortunately, I am unable to edit the points in the same manner.
Is there a way to edit a meshes domain location after a solution is saved on a gridfunction?
For all who encounter this problem in the future: mneunteufel has the answer in his code generously shared in his response. You can edit mesh points directly (and at any point in execution) via the ngmesh.Points function:
for p in mesh.ngmesh.Points():
px,py = p[0], p[1]
p[0] = func1(px,py)
p[1] = func2(px,py)
where func1, func2 are whatever you choose to mutate your mesh.
The last post gives an ok method, but is there a way to update the mesh points as a numpy array? The solution above assumes we have explicit functions to give new mesh coordinates. It would be more convenient to pass in my own array. And yes, I already know about the mesh deformation method.
You can check the latest pip pre-releases ngsolve · PyPI . As far as I’m aware, the nighly builds are not yet automatically released on pypi. I you need the latest nighly release, I guess your only options are to get the from the downloads section or build from sources.