Skip to content

Conversation

@tkarna
Copy link
Contributor

@tkarna tkarna commented Feb 11, 2016

Adds CylinderMesh which enables RectangleMesh that is periodic only in x or y direction.

"Ly": (cLy, READ)})

# TODO boundaries

Copy link
Contributor Author

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.

Copy link
Contributor

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)

Also make one interface to generating periodic rectangle meshes.
Currently y periodic not supported because my brain is sad.
@wence-
Copy link
Contributor

wence- commented Feb 11, 2016

I've added support for cylinders that have x, y, or z longitudinal directions, and change the interface to PeriodicRectangleMesh. My brain broke when doing the y periodic PartiallyPeriodicRectangleMesh, so I didn't support that.

Also fixed sign of rotation for y-aligned CylinderMesh
@tkarna
Copy link
Contributor Author

tkarna commented Feb 11, 2016

Looks good. I've added boundary ids for CylinderMesh and y periodicity for PartiallyPeriodicRectangleMesh. Needs testing I guess.

@wence-
Copy link
Contributor

wence- commented Feb 12, 2016

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.
@wence-
Copy link
Contributor

wence- commented Feb 12, 2016

I've added a test, let's wait for the green light then I'll merge.

@tkarna
Copy link
Contributor Author

tkarna commented Feb 12, 2016

Nice. This doesn't test the boundaries, should we add one for that too (e.g. diffusion with dirichlet bcs)?

@wence-
Copy link
Contributor

wence- commented Feb 12, 2016

Oh yes. that's a good idea.

@wence-
Copy link
Contributor

wence- commented Feb 15, 2016

OK, and now with more test.

@wence- wence- merged commit 4ff94bc into master Feb 15, 2016
wence- added a commit that referenced this pull request Feb 15, 2016
* 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
@wence- wence- deleted the cylinder-mesh branch February 15, 2016 14:13
dham pushed a commit that referenced this pull request Nov 27, 2024
* Insert zero blocks on matrix diagonals

* Pin Cython version to let petsc4py build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants