Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add general mesh interpolators to the core module to avoid code duplication in submodules #468

Open
vsnever opened this issue Sep 17, 2024 · 1 comment
Assignees

Comments

@vsnever
Copy link
Member

vsnever commented Sep 17, 2024

Currently, three Cherab submodules: cherab-solps, cherab-edge2d and cherab-imas use very similar interpolators for mesh data. I propose to include in the core module the general interpolators for mesh data suggested by the General Grid Description approach introduced in IMAS. This will be useful for users working with transport codes that do not have Cherab submodules yet. This will also help avoiding code duplication in the submodules.

Five types of spatial meshes should cover all possible cases:

  • Structured 2D mesh (cells are quadrilaterals)
  • Structured 3D mesh (cells are hexahedra)
  • Unstructured 2D mesh (cells are arbitrary polygons)
  • Unstructured 3D mesh (cells are arbitrary polyhedra)
  • Hybrid 3D mesh (cells are formed by polygons extended structurally in the 3rd dimension)

I propose to add Cython grid interpolators to cherab/core/math/interpolators/mesh/, and Python classes working with such meshes to cherab/tools/mesh/.

Structured and unstructured mesh interpolators should be implemented separately for performance reasons (find_index vs KDTree search).

Although implementing an unstructured 3D mesh in general can be difficult due to the tetrahedralisation problem (unlike polygons, not all polyhedra can be tetrahedralised without introducing additional vertices), some common cases, such as meshes where all cells are convex polyhedra, are easy to implement.

@vsnever vsnever self-assigned this Sep 17, 2024
@Mateasek
Copy link
Member

Hi @vsnever,

Does the proposed architecture count with the fact that meshes can have values defined for vertices or faces/volumes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants