Hi all,
I have a grid grid = bempp.api.shapes.sphere(r=0.5, origin=(0, 0, 0), h=0.2)
and I want to obtain the swapped normals .
Any help is highly appreciated.
Thanks a lot!
Hi all,
I have a grid grid = bempp.api.shapes.sphere(r=0.5, origin=(0, 0, 0), h=0.2)
and I want to obtain the swapped normals .
Any help is highly appreciated.
Thanks a lot!
Hi Chayma,
You can obtain the normals of the grid with grid.normals
, which are the unit-sized normal vectors at each triangular element.
You can check the orientation of the normals by exporting the grid and opening it in Gmsh.
There is no built-in functionality to swap the orientation of the normals. A workaround would be creating another grid with an opposite triangle orientation, e.g., grid_swapped = bempp.api.Grid(grid.vertices, grid.elements[[0,2,1],:])
, where the order of the element indices are changed.
Be aware that Bempp assumes that the user defines the grid with consistent normal orientation.
Dear Elwin,
Thank you very much for your reply.
I used also swapped_grid=bempp.api.grid.grid.union([grid], swapped_normals=len([grid])*[True]).
Best,
Chayma.