Mapping Structured Mesh material labels to an Unstructured Mesh #2532
Replies: 2 comments
-
Hi Rafael, That's correct, it's safer to not assume particular ordering of the mesh elements. I would create a Vladimir |
Beta Was this translation helpful? Give feedback.
-
@rafaelmarch3 so this shouldn't be an issue. I do something similar to this within my crystal plasticity code where I need to assign a grain ID to each element if I'm using the auto mesh generator within MFEM. Here's an example of how I do it in one of my mesh generation programs: https://github.com/LLNL/ExaConstit/blob/exaconstit-dev/scripts/meshing/mesh_generator.cpp or here in my main driver https://github.com/LLNL/ExaConstit/blob/exaconstit-dev/src/mechanics_driver.cpp#L234-L269. The key is to make sure in your case the material ID / voxel label is read into the serial mesh with the x direction iterating the fastest, then the y direction and finally the z direction. Once your serial mesh has the element IDs assigned then you can create the parallel mesh and the IDs will be correctly assigned. Also, the voxel thing shouldn't be an issue if your mesh has the same number of elements in each x,y, and z direction as your voxel image. I do this all the time in my simulations and the mapping works out just fine. If that's not the case then you would have to work on the mapping aspect of things. One thing you might want to do is double check and make sure your material array actually has the correct ordering of things that you expect. I've run into this issue before where it didn't correspond to the x->y->z type ordering so my element attributes were completely off when I read them into my simulations. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm having some issues mapping material labels from an structured array (3D image) into a MFEM Mesh object. Here's the way I'm doing it:
When I run the simulation (deformation of a heterogeneous volume) and open the vtk, the material array shows a completely different spatial distribution of my 1's and 2's. I believe this is related to the fact that MFEM is built for a generic unstructured mesh, so the global ids of each element of the mesh do not necessarily follow the index logic of my image file (first x, then y and then z).
Any ideas on how to overcome this? One idea would be to look at the centroids of each cell as a way to map between the voxel values and the mesh elements. But I wonder if there would be any more straightforward way?
Thank you,
Rafael March.
Beta Was this translation helpful? Give feedback.
All reactions