Inverted cells due to mirroring transformation
- Dominant language
- Python
- Stars
- 35
- Forks
- 14
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 11
Description
Hi @waltersma,
if I run the example from above with a matrix for mirroring, I get negative volumes. Here is my code part:
```
#...
# transform copy in x-direction to be adjacent to original
transform = [
1, 0, 0, 0.032,
0, -1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
]
transform_params = prime.TransformParams(model, transform)
prime.Transform(model).transform_zonelets(part.id, copied_cell_zonelets, transform_params)
# use a beta api to merge nodes and connect the two meshes
merge_params = prime.MergeBoundaryNodesParams(
model,
merge_node_type=prime.MergeNodeType.ALLALL,
tolerance=0.0001,
use_absolute_tolerance=True,
)
result = prime.Connect(model).merge_boundary_nodes(part.id, face_zonelets, copied_face_zonelets, merge_params)
# write as a fluent mesh file
mesh_util.write(file_name="hex.msh")
vtool = prime.VolumeMeshTool(model=model)
result = vtool.check_mesh(part_id=part.id, params=prime.CheckMeshParams(model=model))
print("Non positive volumes:", result.has_non_positive_volumes)
print("Non positive areas:", result.has_non_positive_areas)
print("Invalid shape:", result.has_invalid_shape)
print("Left handed faces:", result.has_left_handed_faces)
```
Output:
```
Non positive volumes: True
Non positive areas: False
Invalid shape: False
Left handed faces: True
```
This is an issue, right? I used the version 0.7.0.
Best regards, Susanne
_Originally posted by @susannehaase in https://github.com/ansys/pyprimemesh/discussions/915#discussioncomment-12326102_
Contributor guide
Research direction
Start by reproducing the reported mirroring example with the version 0.7.0 transformation matrix, then run VolumeMeshTool.check_mesh with CheckMeshParams and compare the reported non-positive volumes and left-handed faces. Trace transform_zonelets and the subsequent merge_boundary_nodes call; done means mirrored and merged cells retain valid volume and face orientation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100