2D meshing: xy cross-section#
You can supply the argument type="xy"
and a z
-value, to mesh arbitrary Component
planar cross-sections.
import gdsfactory as gf
import meshio
from gdsfactory.generic_tech import get_generic_pdk
from gdsfactory.pdk import get_layer_stack
from gdsfactory.technology import LayerStack
from skfem.io import from_meshio
from gplugins.gmsh.get_mesh import create_physical_mesh, get_mesh
gf.config.rich_output()
PDK = get_generic_pdk()
PDK.activate()
waveguide = gf.components.straight_pin(length=10, taper=None)
waveguide.plot()
filtered_layer_stack = LayerStack(
layers={
k: get_layer_stack().layers[k]
for k in (
"slab90",
"core",
"via_contact",
)
}
)
filename = "mesh"
def mesh_with_physicals(mesh, filename):
mesh_from_file = meshio.read(f"{filename}.msh")
return create_physical_mesh(mesh_from_file, "triangle")
At z=0.09
um, according to the layer stack above we should see polygons from all three layers:
filename = "mesh"
mesh = get_mesh(
component=waveguide,
type="xy",
z=0.09,
layer_stack=filtered_layer_stack,
filename=f"{filename}.msh",
)
mesh = mesh_with_physicals(mesh, filename)
mesh = from_meshio(mesh)
mesh.draw().plot()
Info : [ 0%] Union
Info : [ 10%] Union - Performing intersection of shapes
Info : [ 80%] Union - Building splits of containers
Info : [ 0%] Difference
Info : [ 10%] Difference
Info : [ 20%] Difference
Info : [ 30%] Difference
Info : [ 40%] Difference
Info : [ 50%] Difference
Info : [ 60%] Difference
Info : [ 70%] Difference - Filling splits of edges
Info : [ 80%] Difference - Making faces
Info : [ 90%] Difference - Adding holes
Info : [ 0%] Fragments
Info : [ 10%] Fragments
Info : [ 20%] Fragments
Info : [ 30%] Fragments
Info : [ 40%] Fragments
Info : [ 50%] Fragments
Info : [ 60%] Fragments
Info : [ 70%] Fragments - Building splits of containers
Info : [ 80%] Fragments - Splitting faces
Info : [ 0%] Difference
Info : [ 10%] Difference
Info : [ 20%] Difference
Info : [ 30%] Difference
Info : [ 40%] Difference
Info : [ 50%] Difference
Info : [ 60%] Difference
Info : [ 70%] Difference - Filling splits of edges
Info : [ 80%] Difference - Making faces
Info : [ 90%] Difference - Adding holes
Info : [ 0%] Fragments
Info : [ 10%] Fragments
Info : [ 20%] Fragments
Info : [ 30%] Fragments
Info : [ 40%] Fragments
Info : [ 50%] Fragments
Info : [ 60%] Fragments
Info : [ 70%] Fragments - Building splits of containers
Info : [ 80%] Fragments - Splitting faces
Info : Meshing 1D...
Info : [ 0%] Meshing curve 1 (Line)
Info : [ 0%] Meshing curve 4 (Line)
Info : [ 0%] Meshing curve 2 (Line)
Info : [ 0%] Meshing curve 3 (Line)
Info : [ 0%] Meshing curve 5 (Line)
Info : [ 0%] Meshing curve 6 (Line)
Info : [ 0%] Meshing curve 7 (Line)
Info : [ 0%] Meshing curve 8 (Line)
Info : [ 0%] Meshing curve 9 (Line)
Info : [ 0%] Meshing curve 10 (Line)
Info : [ 0%] Meshing curve 11 (Line)
Info : [ 0%] Meshing curve 12 (Line)
Info : [ 0%] Meshing curve 13 (Line)
Info : [ 0%] Meshing curve 14 (Line)
Info : [ 0%] Meshing curve 15 (Line)
Info : [ 0%] Meshing curve 16 (Line)
Info : [ 0%] Meshing curve 17 (Line)
Info : [ 0%] Meshing curve 18 (Line)
Info : [ 0%] Meshing curve 19 (Line)
Info : [ 0%] Meshing curve 20 (Line)
Info : [ 0%] Meshing curve 21 (Line)
Info : [ 0%] Meshing curve 23 (Line)
Info : [ 0%] Meshing curve 24 (Line)
Info : [ 0%] Meshing curve 25 (Line)
Info : [ 0%] Meshing curve 26 (Line)
Info : [ 0%] Meshing curve 27 (Line)
Info : [ 0%] Meshing curve 29 (Line)
Info : [ 0%] Meshing curve 28 (Line)
Info : [ 20%] Meshing curve 31 (Line)
Info : [ 20%] Meshing curve 32 (Line)
Info : [ 20%] Meshing curve 33 (Line)
Info : [ 20%] Meshing curve 34 (Line)
Info : [ 20%] Meshing curve 35 (Line)
Info : [ 20%] Meshing curve 36 (Line)
Info : [ 20%] Meshing curve 37 (Line)
Info : [ 20%] Meshing curve 38 (Line)
Info : [ 20%] Meshing curve 30 (Line)
Info : [ 20%] Meshing curve 40 (Line)
Info : [ 30%] Meshing curve 41 (Line)
Info : [ 30%] Meshing curve 42 (Line)
Info : [ 20%] Meshing curve 39 (Line)
Info : [ 30%] Meshing curve 44 (Line)
Info : [ 30%] Meshing curve 45 (Line)
Info : [ 0%] Meshing curve 22 (Line)
Info : [ 30%] Meshing curve 46 (Line)
Info : [ 30%] Meshing curve 48 (Line)
Info : [ 30%] Meshing curve 47 (Line)
Info : [ 30%] Meshing curve 50 (Line)
Info : [ 30%] Meshing curve 49 (Line)
Info : [ 30%] Meshing curve 52 (Line)
Info : [ 30%] Meshing curve 43 (Line)
Info : [ 30%] Meshing curve 54 (Line)
Info : [ 30%] Meshing curve 53 (Line)
Info : [ 40%] Meshing curve 56 (Line)
Info : [ 40%] Meshing curve 57 (Line)
Info : [ 40%] Meshing curve 58 (Line)
Info : [ 40%] Meshing curve 60 (Line)
Info : [ 40%] Meshing curve 59 (Line)
Info : [ 40%] Meshing curve 55 (Line)
Info : [ 40%] Meshing curve 61 (Line)
Info : [ 40%] Meshing curve 62 (Line)
Info : [ 40%] Meshing curve 63 (Line)
Info : [ 40%] Meshing curve 64 (Line)
Info : [ 50%] Meshing curve 65 (Line)
Info : [ 50%] Meshing curve 67 (Line)
Info : [ 50%] Meshing curve 68 (Line)
Info : [ 60%] Meshing curve 70 (Line)
Info : [ 60%] Meshing curve 71 (Line)
Info : [ 60%] Meshing curve 72 (Line)
Info : [ 60%] Meshing curve 73 (Line)
Info : [ 60%] Meshing curve 74 (Line)
Info : [ 60%] Meshing curve 75 (Line)
Info : [ 30%] Meshing curve 51 (Line)
Info : [ 60%] Meshing curve 76 (Line)
Info : [ 60%] Meshing curve 77 (Line)
Info : [ 60%] Meshing curve 78 (Line)
Info : [ 60%] Meshing curve 79 (Line)
Info : [ 60%] Meshing curve 80 (Line)
Info : [ 50%] Meshing curve 66 (Line)
Info : [ 60%] Meshing curve 82 (Line)
Info : [ 60%] Meshing curve 83 (Line)
Info : [ 60%] Meshing curve 84 (Line)
Info : [ 60%] Meshing curve 85 (Line)
Info : [ 60%] Meshing curve 86 (Line)
Info : [ 60%] Meshing curve 87 (Line)
Info : [ 50%] Meshing curve 69 (Line)
Info : [ 60%] Meshing curve 88 (Line)
Info : [ 60%] Meshing curve 81 (Line)
Info : [ 60%] Meshing curve 89 (Line)
Info : [ 70%] Meshing curve 90 (Line)
Info : [ 70%] Meshing curve 92 (Line)
Info : [ 70%] Meshing curve 93 (Line)
Info : [ 70%] Meshing curve 94 (Line)
Info : [ 70%] Meshing curve 95 (Line)
Info : [ 70%] Meshing curve 96 (Line)
Info : [ 70%] Meshing curve 97 (Line)
Info : [ 80%] Meshing curve 98 (Line)
Info : [ 80%] Meshing curve 100 (Line)
Info : [ 80%] Meshing curve 101 (Line)
Info : [ 70%] Meshing curve 91 (Line)
Info : [ 80%] Meshing curve 103 (Line)
Info : [ 80%] Meshing curve 104 (Line)
Info : [ 80%] Meshing curve 105 (Line)
Info : [ 80%] Meshing curve 106 (Line)
Info : [ 80%] Meshing curve 108 (Line)
Info : [ 80%] Meshing curve 99 (Line)
Info : [ 80%] Meshing curve 109 (Line)
Info : [ 80%] Meshing curve 102 (Line)
Info : [ 90%] Meshing curve 110 (Line)
Info : [ 80%] Meshing curve 107 (Line)
Info : [ 90%] Meshing curve 111 (Line)
Info : [ 90%] Meshing curve 112 (Line)
Info : [ 90%] Meshing curve 114 (Line)
Info : [ 90%] Meshing curve 116 (Line)
Info : [ 90%] Meshing curve 117 (Line)
Info : [ 90%] Meshing curve 118 (Line)
Info : [ 90%] Meshing curve 119 (Line)
Info : [ 90%] Meshing curve 113 (Line)
Info : [ 90%] Meshing curve 121 (Line)
Info : [ 90%] Meshing curve 122 (Line)
Info : [ 90%] Meshing curve 120 (Line)
Info : [ 90%] Meshing curve 124 (Line)
Info : [100%] Meshing curve 125 (Line)
Info : [100%] Meshing curve 126 (Line)
Info : [100%] Meshing curve 127 (Line)
Info : [100%] Meshing curve 128 (Line)
Info : [100%] Meshing curve 129 (Line)
Info : [ 90%] Meshing curve 123 (Line)
Info : [100%] Meshing curve 130 (Line)
Info : [ 90%] Meshing curve 115 (Line)
Info : [100%] Meshing curve 131 (Line)
Info : [100%] Meshing curve 132 (Line)
Info : Done meshing 1D (Wall 0.00813192s, CPU 0.011944s)
Info : Meshing 2D...
Info : [ 0%] Meshing surface 1 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 2 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 3 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 4 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 5 (Plane, Frontal-Delaunay)
Info : [ 10%] Meshing surface 6 (Plane, Frontal-Delaunay)
Info : [ 10%] Meshing surface 8 (Plane, Frontal-Delaunay)
Info : [ 20%] Meshing surface 9 (Plane, Frontal-Delaunay)
Info : [ 20%] Meshing surface 10 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 11 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 12 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 13 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 14 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 15 (Plane, Frontal-Delaunay)
Info : [ 40%] Meshing surface 16 (Plane, Frontal-Delaunay)
Info : [ 40%] Meshing surface 18 (Plane, Frontal-Delaunay)
Info : [ 40%] Meshing surface 17 (Plane, Frontal-Delaunay)
Info : [ 50%] Meshing surface 19 (Plane, Frontal-Delaunay)
Info : [ 50%] Meshing surface 20 (Plane, Frontal-Delaunay)
Info : [ 50%] Meshing surface 21 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 22 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 23 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 24 (Plane, Frontal-Delaunay)
Info : [ 70%] Meshing surface 25 (Plane, Frontal-Delaunay)
Info : [ 70%] Meshing surface 26 (Plane, Frontal-Delaunay)
Info : [ 70%] Meshing surface 27 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 28 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 29 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 30 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 31 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 32 (Plane, Frontal-Delaunay)
Info : [ 90%] Meshing surface 33 (Plane, Frontal-Delaunay)
Info : [ 10%] Meshing surface 7 (Plane, Frontal-Delaunay)
Info : Done meshing 2D (Wall 0.0494003s, CPU 0.078358s)
Info : 2064 nodes 4514 elements
Info : Writing 'mesh.msh'...
Info : Done writing 'mesh.msh'
Info : Writing '/tmp/tmp9kttbby9/mesh.msh'...
Info : Done writing '/tmp/tmp9kttbby9/mesh.msh'
[]
At z=0
, you can see only the core and slab:
mesh = get_mesh(
component=waveguide,
type="xy",
z=0.0,
layer_stack=filtered_layer_stack,
filename=f"{filename}.msh",
)
mesh = mesh_with_physicals(mesh, filename)
mesh = from_meshio(mesh)
mesh.draw().plot()
Info : [ 0%] Difference
Info : [ 10%] Difference
Info : [ 20%] Difference - Performing Vertex-Face intersection
Info : [ 30%] Difference
Info : [ 40%] Difference
Info : [ 50%] Difference
Info : [ 60%] Difference
Info : [ 70%] Difference - Filling splits of edges
Info : [ 80%] Difference - Making faces
Info : [ 90%] Difference
Info : [ 0%] Fragments
Info : [ 10%] Fragments - Performing intersection of shapes
Info : Meshing 1D...
Info : [ 0%] Meshing curve 2 (Line)
Info : [ 0%] Meshing curve 1 (Line)
Info : [ 0%] Meshing curve 3 (Line)
Info : [ 0%] Meshing curve 4 (Line)
Info : Done meshing 1D (Wall 0.0250406s, CPU 0.077224s)
Info : Meshing 2D...
Info : Meshing surface 1 (Plane, Frontal-Delaunay)
Info : Done meshing 2D (Wall 0.0369686s, CPU 0.075629s)
Info : 1102 nodes 2206 elements
Info : Writing 'mesh.msh'...
Info : Done writing 'mesh.msh'
Info : Writing '/tmp/tmpaon8gaf_/mesh.msh'...
Info : Done writing '/tmp/tmpaon8gaf_/mesh.msh'
Warning : Boolean fragments skipped - too few arguments
[]
At z=1.0
, you can only see the vias appear:
mesh = get_mesh(
component=waveguide,
type="xy",
z=1.0,
layer_stack=filtered_layer_stack,
filename=f"{filename}.msh",
)
mesh = mesh_with_physicals(mesh, filename)
mesh = from_meshio(mesh)
mesh.draw().plot()
Info : [ 0%] Union
Info : [ 10%] Union - Performing intersection of shapes
Info : [ 80%] Union - Building splits of containers
Info : Meshing 1D...
Info : [ 0%] Meshing curve 2 (Line)
Info : [ 0%] Meshing curve 3 (Line)
Info : [ 0%] Meshing curve 1 (Line)
Info : [ 0%] Meshing curve 4 (Line)
Info : [ 0%] Meshing curve 5 (Line)
Info : [ 0%] Meshing curve 6 (Line)
Info : [ 0%] Meshing curve 7 (Line)
Info : [ 0%] Meshing curve 8 (Line)
Info : [ 0%] Meshing curve 9 (Line)
Info : [ 0%] Meshing curve 10 (Line)
Info : [ 0%] Meshing curve 11 (Line)
Info : [ 0%] Meshing curve 12 (Line)
Info : [ 0%] Meshing curve 13 (Line)
Info : [ 0%] Meshing curve 14 (Line)
Info : [ 0%] Meshing curve 15 (Line)
Info : [ 0%] Meshing curve 16 (Line)
Info : [ 0%] Meshing curve 17 (Line)
Info : [ 0%] Meshing curve 18 (Line)
Info : [ 0%] Meshing curve 19 (Line)
Info : [ 0%] Meshing curve 20 (Line)
Info : [ 0%] Meshing curve 21 (Line)
Info : [ 0%] Meshing curve 22 (Line)
Info : [ 0%] Meshing curve 23 (Line)
Info : [ 0%] Meshing curve 24 (Line)
Info : [ 0%] Meshing curve 25 (Line)
Info : [ 0%] Meshing curve 26 (Line)
Info : [ 0%] Meshing curve 27 (Line)
Info : [ 0%] Meshing curve 28 (Line)
Info : [ 0%] Meshing curve 29 (Line)
Info : [ 0%] Meshing curve 30 (Line)
Info : [ 0%] Meshing curve 31 (Line)
Info : [ 0%] Meshing curve 32 (Line)
Info : [ 0%] Meshing curve 33 (Line)
Info : [ 0%] Meshing curve 34 (Line)
Info : [ 0%] Meshing curve 35 (Line)
Info : [ 0%] Meshing curve 36 (Line)
Info : [ 0%] Meshing curve 37 (Line)
Info : [ 0%] Meshing curve 38 (Line)
Info : [ 0%] Meshing curve 39 (Line)
Info : [ 0%] Meshing curve 40 (Line)
Info : [ 0%] Meshing curve 41 (Line)
Info : [ 0%] Meshing curve 42 (Line)
Info : [ 0%] Meshing curve 43 (Line)
Info : [ 0%] Meshing curve 44 (Line)
Info : [ 0%] Meshing curve 45 (Line)
Info : [ 0%] Meshing curve 46 (Line)
Info : [ 0%] Meshing curve 47 (Line)
Info : [ 0%] Meshing curve 48 (Line)
Info : [ 0%] Meshing curve 49 (Line)
Info : [ 0%] Meshing curve 50 (Line)
Info : [ 0%] Meshing curve 51 (Line)
Info : [ 0%] Meshing curve 54 (Line)
Info : [ 0%] Meshing curve 53 (Line)
Info : [ 0%] Meshing curve 52 (Line)
Info : [ 0%] Meshing curve 55 (Line)
Info : [ 0%] Meshing curve 56 (Line)
Info : [ 0%] Meshing curve 57 (Line)
Info : [ 0%] Meshing curve 58 (Line)
Info : [ 0%] Meshing curve 59 (Line)
Info : [ 0%] Meshing curve 60 (Line)
Info : [ 0%] Meshing curve 61 (Line)
Info : [ 0%] Meshing curve 62 (Line)
Info : [ 0%] Meshing curve 63 (Line)
Info : [ 0%] Meshing curve 64 (Line)
Info : [ 0%] Meshing curve 66 (Line)
Info : [ 0%] Meshing curve 65 (Line)
Info : [ 0%] Meshing curve 67 (Line)
Info : [ 0%] Meshing curve 69 (Line)
Info : [ 0%] Meshing curve 68 (Line)
Info : [ 0%] Meshing curve 70 (Line)
Info : [ 0%] Meshing curve 71 (Line)
Info : [ 0%] Meshing curve 72 (Line)
Info : [ 0%] Meshing curve 73 (Line)
Info : [ 0%] Meshing curve 74 (Line)
Info : [ 0%] Meshing curve 75 (Line)
Info : [ 0%] Meshing curve 76 (Line)
Info : [ 0%] Meshing curve 77 (Line)
Info : [ 0%] Meshing curve 78 (Line)
Info : [ 0%] Meshing curve 79 (Line)
Info : [ 0%] Meshing curve 80 (Line)
Info : [ 0%] Meshing curve 81 (Line)
Info : [ 0%] Meshing curve 82 (Line)
Info : [ 0%] Meshing curve 83 (Line)
Info : [ 0%] Meshing curve 84 (Line)
Info : [ 0%] Meshing curve 85 (Line)
Info : [ 0%] Meshing curve 86 (Line)
Info : [ 0%] Meshing curve 87 (Line)
Info : [ 0%] Meshing curve 88 (Line)
Info : [ 0%] Meshing curve 89 (Line)
Info : [ 0%] Meshing curve 90 (Line)
Info : [ 0%] Meshing curve 91 (Line)
Info : [ 0%] Meshing curve 92 (Line)
Info : [ 0%] Meshing curve 93 (Line)
Info : [ 0%] Meshing curve 94 (Line)
Info : [ 0%] Meshing curve 95 (Line)
Info : [ 0%] Meshing curve 96 (Line)
Info : [ 0%] Meshing curve 97 (Line)
Info : [ 0%] Meshing curve 98 (Line)
Info : [ 0%] Meshing curve 99 (Line)
Info : [ 0%] Meshing curve 100 (Line)
Info : [ 0%] Meshing curve 101 (Line)
Info : [ 0%] Meshing curve 102 (Line)
Info : [ 0%] Meshing curve 103 (Line)
Info : [ 0%] Meshing curve 104 (Line)
Info : [ 0%] Meshing curve 105 (Line)
Info : [ 0%] Meshing curve 106 (Line)
Info : [ 0%] Meshing curve 107 (Line)
Info : [ 0%] Meshing curve 108 (Line)
Info : [ 0%] Meshing curve 110 (Line)
Info : [ 0%] Meshing curve 109 (Line)
Info : [ 0%] Meshing curve 111 (Line)
Info : [ 0%] Meshing curve 112 (Line)
Info : [ 0%] Meshing curve 113 (Line)
Info : [ 0%] Meshing curve 114 (Line)
Info : [ 0%] Meshing curve 115 (Line)
Info : [ 0%] Meshing curve 116 (Line)
Info : [ 0%] Meshing curve 117 (Line)
Info : [ 0%] Meshing curve 118 (Line)
Info : [ 0%] Meshing curve 119 (Line)
Info : [ 0%] Meshing curve 120 (Line)
Info : [ 0%] Meshing curve 122 (Line)
Info : [ 0%] Meshing curve 121 (Line)
Info : [ 0%] Meshing curve 123 (Line)
Info : [ 0%] Meshing curve 124 (Line)
Info : [ 0%] Meshing curve 125 (Line)
Info : [ 0%] Meshing curve 126 (Line)
Info : [ 0%] Meshing curve 127 (Line)
Info : [ 0%] Meshing curve 128 (Line)
Info : Done meshing 1D (Wall 0.0256682s, CPU 0.070367s)
Info : Meshing 2D...
Info : [ 0%] Meshing surface 1 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 2 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 3 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 4 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 5 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 6 (Plane, Frontal-Delaunay)
Info : [ 10%] Meshing surface 7 (Plane, Frontal-Delaunay)
Info : [ 10%] Meshing surface 8 (Plane, Frontal-Delaunay)
Info : [ 10%] Meshing surface 10 (Plane, Frontal-Delaunay)
Info : [ 10%] Meshing surface 9 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 11 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 12 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 13 (Plane, Frontal-Delaunay)
Info : [ 40%] Meshing surface 14 (Plane, Frontal-Delaunay)
Info : [ 40%] Meshing surface 15 (Plane, Frontal-Delaunay)
Info : [ 40%] Meshing surface 16 (Plane, Frontal-Delaunay)
Info : [ 50%] Meshing surface 17 (Plane, Frontal-Delaunay)
Info : [ 50%] Meshing surface 18 (Plane, Frontal-Delaunay)
Info : [ 50%] Meshing surface 19 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 20 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 21 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 22 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 23 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 24 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 25 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 26 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 27 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 28 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 29 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 30 (Plane, Frontal-Delaunay)
Info : [ 90%] Meshing surface 32 (Plane, Frontal-Delaunay)
Info : [ 90%] Meshing surface 31 (Plane, Frontal-Delaunay)
Info : Done meshing 2D (Wall 0.0138975s, CPU 0.02707s)
Info : 384 nodes 832 elements
Info : Writing 'mesh.msh'...
Info : Done writing 'mesh.msh'
Info : Writing '/tmp/tmpmaclj9ks/mesh.msh'...
Info : Done writing '/tmp/tmpmaclj9ks/mesh.msh'
[]
Controlling meshing domain#
You can use functions that return other components to modify the simulation domain, for instance gdsfactory.geometry.trim
:
waveguide = gf.components.straight_pin(length=11, taper=None)
waveguide.trim(left=3, right=5, bottom=-4, top=4)
waveguide
mesh = get_mesh(
component=waveguide,
type="xy",
z=0.09,
layer_stack=filtered_layer_stack,
filename=f"{filename}.msh",
)
mesh = mesh_with_physicals(mesh, filename)
mesh = from_meshio(mesh)
mesh.draw().plot()
Info : [ 0%] Union
Info : [ 10%] Union - Performing intersection of shapes
Info : [ 80%] Union - Building splits of containers
Info : [ 0%] Difference
Info : [ 10%] Difference
Info : [ 20%] Difference
Info : [ 30%] Difference
Info : [ 40%] Difference
Info : [ 50%] Difference
Info : [ 60%] Difference
Info : [ 70%] Difference
Info : [ 80%] Difference - Making faces
Info : [ 90%] Difference - Adding holes
Info : [ 0%] Fragments
Info : [ 10%] Fragments
Info : [ 40%] Fragments
Info : [ 70%] Fragments
Info : [ 80%] Fragments - Splitting faces
Info : [ 0%] Difference
Info : [ 10%] Difference
Info : [ 20%] Difference
Info : [ 30%] Difference
Info : [ 40%] Difference
Info : [ 50%] Difference
Info : [ 60%] Difference
Info : [ 70%] Difference
Info : [ 80%] Difference - Making faces
Info : [ 90%] Difference - Adding holes
Info : [ 0%] Fragments
Info : [ 10%] Fragments
Info : [ 40%] Fragments
Info : [ 70%] Fragments
Info : [ 80%] Fragments - Splitting faces
Info : Meshing 1D...
Info : [ 0%] Meshing curve 3 (Line)
Info : [ 0%] Meshing curve 4 (Line)
Info : [ 0%] Meshing curve 2 (Line)
Info : [ 0%] Meshing curve 1 (Line)
Info : [ 0%] Meshing curve 5 (Line)
Info : [ 0%] Meshing curve 7 (Line)
Info : [ 0%] Meshing curve 6 (Line)
Info : [ 0%] Meshing curve 8 (Line)
Info : [ 0%] Meshing curve 10 (Line)
Info : [ 0%] Meshing curve 11 (Line)
Info : [ 0%] Meshing curve 9 (Line)
Info : [ 0%] Meshing curve 12 (Line)
Info : Done meshing 1D (Wall 0.00202361s, CPU 0.006098s)
Info : Meshing 2D...
Info : [ 0%] Meshing surface 2 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 3 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 1 (Plane, Frontal-Delaunay)
Info : Done meshing 2D (Wall 0.0126897s, CPU 0.032171s)
Info : 131 nodes 288 elements
Info : Writing 'mesh.msh'...
Info : Done writing 'mesh.msh'
Info : Writing '/tmp/tmps1nx_svx/mesh.msh'...
Info : Done writing '/tmp/tmps1nx_svx/mesh.msh'
[]