Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

boundary condition labeling #185

Open
krober10nd opened this issue Jan 21, 2021 · 1 comment
Open

boundary condition labeling #185

krober10nd opened this issue Jan 21, 2021 · 1 comment

Comments

@krober10nd
Copy link
Owner

  • Boundaries should be able to be labeled for application of solver-specific boundary conditions.
  • For example, edges/facets on top-most boundary get X integer label.
@krober10nd
Copy link
Owner Author

  • This is just an example for the future. Labels all boundary edges with a y-coordinate > 0 with a tag 11.
 import numpy as np
 
 import meshio
 import SeismicMesh
 
 bbox = (0.0, 1.0, 0.0, 1.0)
 square = SeismicMesh.Rectangle(bbox)
 points, cells = SeismicMesh.generate_mesh(domain=square, edge_length=0.20)
 
 # This gets the edges of the mesh in a winding order.
 ordered_bnde = SeismicMesh.geometry.get_winded_boundary_edges(cells)
 mdpt = points[ordered_bnde].sum(1) / 2
 sel = ordered_bnde[mdpt[:, 1] > 0, :]
 
 # Write to gmsh22 format with boundary conditions
 meshio.write_points_cells(
     "example.msh",
     points,
     cells=[
         ("triangle", cells),
         ("line", np.array(sel)),
     ],
     field_data={
         "Edges": np.array([11, 1]),
     },
     cell_data={
         "gmsh:physical": [
             np.repeat(3, len(cells)),
             np.repeat(11, len(sel)),
         ],
         "gmsh:geometrical": [
             np.repeat(1, len(cells)),
             np.repeat(1, len(sel)),
         ],
     },
     file_format="gmsh22",
     binary=False,
 )

@krober10nd krober10nd pinned this issue Feb 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant