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

Define _localNonOverlappingFaceIDs for Gmsh #857

Merged
merged 34 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7b7ba0d
Define _localNonOverlappingFaceIDs for Gmsh
guyer Apr 30, 2022
2a9a81e
Drop encoding needed by Py27(?)
guyer Jun 2, 2022
278a4f4
Remove questions from changelog
guyer Jun 2, 2022
a4cc7ca
Remove unmerged PRs from changelog
guyer Jun 2, 2022
6b23f97
Merge branch 'master' into gmsh_nonoverlapping_faces
guyer Jun 3, 2022
7f036dc
ping
guyer Jun 3, 2022
1717b1f
Revert "Remove unmerged PRs from changelog"
guyer Jun 3, 2022
6ea9397
Revert "Remove questions from changelog"
guyer Jun 3, 2022
0fb779e
Revert "Drop encoding needed by Py27(?)"
guyer Jun 3, 2022
9d24cab
Revert "ping"
guyer Jun 3, 2022
c735223
Add accumulation test for Gmsh ghost faces
guyer Jun 6, 2022
7dc4ebc
Add custom spelling
guyer Jun 7, 2022
7733333
Remove unneeded CellVariable from test
guyer Jun 7, 2022
c090fad
Simply test structure
guyer Jun 7, 2022
b1138ac
Add test of Grid2D ghost accumulation
guyer Jun 9, 2022
f538071
Add more (failing) tests of parallelizable meshes
guyer Jun 9, 2022
41b6e3b
"Fix" spelling with math
guyer Jun 9, 2022
bd726bb
Exclude ghost faces from Grid meshes
guyer Jun 9, 2022
b1a2710
Fix buggy check of masked faces
guyer Jun 10, 2022
e156c46
Refactor and document `_nonOverlappingFaces` property
guyer Jun 10, 2022
0097185
Test double-counting of faces on partition boundary
guyer Jun 10, 2022
d8e4659
Fix test
guyer Jun 11, 2022
e1f8ed6
Record number of cells specificed by dx, dy, dz
guyer Jun 11, 2022
39ab957
Ensure faces are "owned" by only one processor
guyer Jun 11, 2022
3ff06d9
Add face topologies for Grid2D
guyer Jun 12, 2022
8fc4b96
Add face topologies for Grid3D
guyer Jun 12, 2022
2b47206
Test `FaceVariable.globalValue`
guyer Jun 12, 2022
8f18e17
Fix ancient typos
guyer Jun 12, 2022
8dd0e85
Enable ghosting integers
guyer Jun 13, 2022
8f8519b
Remove redundant method
guyer Jun 13, 2022
453ad55
Refactor _getGhostedValues
guyer Jun 14, 2022
ca87358
Move imports to top of module
guyer Jun 14, 2022
7d35ed2
Document `in1dMA`
guyer Jun 14, 2022
70fadb5
Fix spelling
guyer Jun 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ XZ
x.y.z
YZ
Zhitenev
10x10x10
1D
2D
2x4
Expand Down
102 changes: 102 additions & 0 deletions fipy/meshes/gmshMesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,35 @@ def _localOverlappingCellIDs(self):
return nx.arange(len(self.mesh.cellGlobalIDs)
+ len(self.mesh.gCellGlobalIDs))

@property
def _nonOverlappingFaces(self):
return (nx.in1d(self.mesh.faceCellIDs[0],
self.mesh._localNonOverlappingCellIDs)
| nx.in1d(self.mesh.faceCellIDs[1],
self.mesh._localNonOverlappingCellIDs))

@property
def _localNonOverlappingFaceIDs(self):
"""Return the IDs of the local mesh in isolation.

Does not include the IDs of faces of boundary cells.

E.g., would return [0, 1, 3, 4, 6, 7, 9, 10, 11, 13, 14, 15]
for mesh A

```
A || B
--6---7-----7---8--
13 14 15/14 15 16
--3---4-----4---5--
9 10 11/10 11 12
--0---1-----1---2--
||
```

.. note:: Trivial except for parallel meshes
"""
return nx.arange(self.mesh.numberOfFaces)[..., self._nonOverlappingFaces]



Expand Down Expand Up @@ -2221,6 +2250,79 @@ def _test(self):

>>> if parallelComm.procID == 0:
... os.remove(posFile)


Ensure that ghost faces are excluded from accumulating operations (#856).
Six exterior surfaces of 10x10x10 cube mesh should each have a total
area of 100, regardless of partitioning.

>>> geo = '''
... cellSize = 1.;
...
... Point(1) = {0, 0, 0, cellSize};
... Point(2) = {10, 0, 0, cellSize};
... Point(3) = {10, 10, 0, cellSize};
... Point(4) = {0, 10, 0, cellSize};
...
... Point(11) = {0, 0, 10, cellSize};
... Point(12) = {10, 0, 10, cellSize};
... Point(13) = {10, 10, 10, cellSize};
... Point(14) = {0, 10, 10, cellSize};
...
... Line(1) = {1, 2};
... Line(2) = {2, 3};
... Line(3) = {3, 4};
... Line(4) = {4, 1};
...
... Line(11) = {11, 12};
... Line(12) = {12, 13};
... Line(13) = {13, 14};
... Line(14) = {14, 11};
...
... Line(21) = {1, 11};
... Line(22) = {2, 12};
... Line(23) = {3, 13};
... Line(24) = {4, 14};
...
... Line Loop(1) = {1, 2, 3, 4};
... Line Loop(2) = {11, 12, 13, 14};
... Line Loop(3) = {1, 22, -11, -21};
... Line Loop(4) = {2, 23, -12, -22};
... Line Loop(5) = {3, 24, -13, -23};
... Line Loop(6) = {4, 21, -14, -24};
...
... Plane Surface(1) = {1};
... Plane Surface(2) = {2};
... Plane Surface(3) = {3};
... Plane Surface(4) = {4};
... Plane Surface(5) = {5};
... Plane Surface(6) = {6};
...
... Surface Loop(1) = {1, 2, 3, 4, 5, 6};
...
... Volume(1) = {1};
...
... Physical Surface("bottom") = {1};
... Physical Surface("top") = {2};
... Physical Surface("front") = {3};
... Physical Surface("right") = {4};
... Physical Surface("back") = {5};
... Physical Surface("left") = {6};
...
... Physical Volume("box") = {1};
... '''

>>> cube = Gmsh3D(geo) # doctest: +GMSH

>>> for surface in ["bottom", "top", "front", "right", "back", "left"]: # doctest: +GMSH
... area = (cube._faceAreas * cube.physicalFaces[surface]).sum() # doctest: +GMSH
... print(surface, numerix.allclose(area, 100)) # doctest: +GMSH
bottom True
top True
front True
right True
back True
left True
"""

class GmshGrid2D(Gmsh2D):
Expand Down