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

Fix elements orderings considering element volumes #40

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

alexbenedicto
Copy link
Contributor

Linked with issue #35

This is the second attempt at making a PR after sustaining merge errors in previous PR, now closed at: #39

Like stated previously, fix_elements_orderings feature would operate nodes ordering modification on all cells of a mesh that have a specific element type.
But if only half of the cells being of that specific cell type were invalid, all of them would still be reordered.

This PR aims at considering the volume of the cells to be taken into account when considering to reorder or not the nodes of a cell.

@alexbenedicto alexbenedicto linked an issue Sep 17, 2024 that may be closed by this pull request
@untereiner
Copy link

@alexbenedicto I don't understand the fix neither the initial program. If you follow the right-hand rule their is only one possible permutation for vertices: https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellsDemo/

I don't understand why this function takes as arguments another permutations.

You have to check that every tuple of indices follows this arrangement. I am not sure someone wants to use another geometric convention.

@alexbenedicto
Copy link
Contributor Author

@untereiner This program is a tool that allows user to correct the nodes ordering of specific cells of a mesh.
What I understood is that the original design was to allow a quick change of convention from grids that were converted to .vtu but with invalid Z orientation for example. So when you work in GEOS with a Tetrahedron grid with the invalid Z direction, you just have to switch 2 nodes id of every tetrahedrons to make their volume positive again.

Therefore in the original version, if the user knows the correct convention for the tetrahedrons, he can change the nodes ordering of ALL tetrahedrons at once.

The correction I added was to answer a demand from users where their grids still contained invalid volumes like in the case with the Tetrahedron grid. But this time, not all tetrahedrons had an invalid volume, only half of them for example (and yes I received a grid with this issue). So if you were to use the original code, you would reorder all of your tetrahedrons but still end up with half of them with an invalid volume (this time the other half).

This new version allows for more control to only operate the nodes ordering on cells that have an invalid volume, or still on all cells.

@untereiner
Copy link

Ok but the ordering should be deduced for each tetrahedron depending on the sign of the volume (if you look inside or outside the volume). What I don’t understand is why the ordering as a parameter.

@alexbenedicto
Copy link
Contributor Author

@untereiner So for each cell found to be problematic in the mesh, I should have an algorithm that can find the right ordering ?

@untereiner
Copy link

If you have negative volume then take a face and invert two vertices to turn right hand.
Also when the z is going downside the volume of the elements should not be negative. The volume of an element doesn’t depend where the 0 is. Draw it on a paper.

…e node ordering himself. Just needs to specify the name of elements to check.
…e node ordering himself. Just needs to specify the name of elements to check.
…erated cells cannot be treated because the problem lies more in the generation of the mesh itself than with a convention error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix element ordering only for invalid element volumes
3 participants