-
Notifications
You must be signed in to change notification settings - Fork 174
Add CylinderMesh #704
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
Add CylinderMesh #704
Conversation
| "Ly": (cLy, READ)}) | ||
|
|
||
| # TODO boundaries | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boundary definition is missing. How to add that? Presumably 1 is y==0 and 2 is y==Ly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to do it after creating the CylinderMesh. Something like:
...
plex = mesh._from_cell_list(2, cells, vertices)
plex.createLabel("boundary_ids")
plex.markBoundaryFaces("boundary_faces")
coords = plex.getCoordinates()
coord_sec = plex.getCoordinateSection()
if plex.getStratumSize("boundary_faces", 1) > 0:
boundary_faces = plex.getStratumIS("boundary_faces", 1).getIndices()
for face in boundary_faces:
face_coords = plex.vecGetClosure(coord_sec, coords, face)
if abs(face_coords[2]) < eps and abs(face_coords[5]) < eps:
# bottom of cylinder (z is longitudinal direction)
plex.setLabelValue("boundary_ids", face, 1)
if abs(face_coords[2] - depth) < eps and abs(face_coords[5] - depth) < eps:
# top of cylinder
plex.setLabelValue("boundary_ids", face, 2)4a6763c to
5957618
Compare
Also make one interface to generating periodic rectangle meshes. Currently y periodic not supported because my brain is sad.
|
I've added support for cylinders that have x, y, or z longitudinal directions, and change the interface to |
Also fixed sign of rotation for y-aligned CylinderMesh
|
Looks good. I've added boundary ids for |
|
Thanks. We can adapt the periodic interval advection tests to 2d I think. |
Partially periodic meshes don't need ncell > 3 in both directions, only the periodic direction.
In a similar vein to the periodic interval, we just advect a sine wave.
|
I've added a test, let's wait for the green light then I'll merge. |
|
Nice. This doesn't test the boundaries, should we add one for that too (e.g. diffusion with dirichlet bcs)? |
|
Oh yes. that's a good idea. |
|
OK, and now with more test. |
* cylinder-mesh: tests: Augment helmholtz test for partial periodicity tests: Fix incorrect use of parallel marker Added direction kwarg to Periodic*SquareMesh Add advection test on partially periodic rectangle Don't require ncell > 3 in non-periodic direction Added CylinderMesh boundaries and support for y-periodic mesh Allow specifying longitudinal axis for CylinderMesh added CylinderMesh and first version of x-periodic RectangleMesh
* Insert zero blocks on matrix diagonals * Pin Cython version to let petsc4py build
Adds CylinderMesh which enables RectangleMesh that is periodic only in x or y direction.