Open ashwinvis opened 1 month ago
Loading the EXODUS mesh file is easy. We can add supports for other meshes with help of meshio (https://github.com/nschloe/meshio) in the future if this works.
In [8]: mesh = xr.open_dataset("naca(10x4).e")
In [9]: mesh
Out[9]:
<xarray.Dataset> Size: 2MB
Dimensions: (time_step: 0, num_el_blk: 1, num_side_sets: 5,
num_nodes: 72734, num_dim: 2, num_el_in_blk1: 23924,
num_nod_per_el1: 8, num_side_ss1: 80, num_df_ss1: 240,
num_side_ss2: 80, num_df_ss2: 240, num_side_ss3: 300,
num_df_ss3: 900, num_side_ss4: 300, num_df_ss4: 900,
num_side_ss5: 202, num_df_ss5: 606, num_qa_rec: 1, four: 4,
num_elem: 23924)
Dimensions without coordinates: time_step, num_el_blk, num_side_sets,
num_nodes, num_dim, num_el_in_blk1,
num_nod_per_el1, num_side_ss1, num_df_ss1,
num_side_ss2, num_df_ss2, num_side_ss3,
num_df_ss3, num_side_ss4, num_df_ss4,
num_side_ss5, num_df_ss5, num_qa_rec, four,
num_elem
Data variables: (12/30)
time_whole (time_step) float64 0B ...
eb_status (num_el_blk) int32 4B ...
eb_prop1 (num_el_blk) int32 4B ...
ss_status (num_side_sets) int32 20B ...
ss_prop1 (num_side_sets) int32 20B ...
coordx (num_nodes) float64 582kB ...
... ...
side_ss5 (num_side_ss5) int32 808B ...
dist_fact_ss5 (num_df_ss5) float64 5kB ...
qa_records (num_qa_rec, four) |S33 132B ...
elem_map (num_elem) int32 96kB ...
elem_num_map (num_elem) int32 96kB ...
node_num_map (num_nodes) int32 291kB ...
Attributes:
api_version: 8.03
version: 8.03
floating_point_word_size: 8
file_size: 1
maximum_name_length: 32
int64_status: 0
title: cubit(C:/Users/gaura/Desktop/bioinspired_aerod...
@airwarriorg91 if you are interested and if you think it is not too complicated, I can assign this to you. You don't have to work through it all alone, so feel free to submit an incomplete pull-request and we can refine it together.
The UXarray approach seems promising. I make a PR and try it out. Fixing this might be a step for including support for Hybrid meshes like the naca one (https://github.com/eX-Mech/pymech-test-data/tree/main/nek/naca). The extension for other mesh formats can be extended later as NEK5000 supports exodus and GMSH mesh formats.
In #31, we attempt to add support for structured curvilinear meshes (incomplete) by adding indices as the dimensions, instead of x and y.
Here the question is how to open a unstructured mesh into a Xarray dataset. In this case, we cannot rely on indexing the mesh. We have an example file which fits this description.
https://github.com/eX-Mech/pymech-test-data/tree/main/nek/naca
Close to the airfoil we cannot rely on indexing to group together elements.
Possible approaches
We need to explore and see what is the best approach:
There is a uxarray package which could be repurposed to load unstructured data.
pymech.readnek
xarray.open_dataset
Convert to vtk and use pyvista-xarray: