Scripted PolygonsΒΆ

Learning targets

  • Use scripting to create complicated polygons

  • Transparent boundary conditions in 3D

  • Inhomogeneous exterior domain: waveguides and layered media

This example describes a computational domain with transparent boundary conditions at all sides. In this case, waveguides are included some of which touch the boundary of the computational domain, and which are modeled to extend also to the exterior domain. Further, a substrate is included which also extends to the exterior domain.

The following figure shows an image of parts of the geometry and mesh:

_images/ex3d_scripted_polygons_mesh1.png

The input file layout.jcm is shown below, it is created using the Matlab script run_geometry.m together with the template file layout.ring_resonator.jcmt, also shown below.

Input Files

  • layout.jcm [ASCII]

     1
     2Layout3D {
     3  Name = "TutorialExample3D"
     4  UnitOfLength = 1e-06
     5  MeshOptions {
     6    MaximumSideLength = 4
     7    MinimumMeshAngle = 18
     8  }
     9  Extrusion {
    10    Objects {
    11      Polygon {
    12        Name = "ComputationalDomain"
    13        DomainId = 10
    14        Priority = -1
    15        Points = [-6.375 -7.625 ;7.175 -7.625 ;7.175 7.625 ;-6.375 7.625 ;]
    16        Boundary {
    17          Class = Transparent
    18        }
    19      }
    20      Polygon {
    21        Name = "Waveguide"
    22        DomainId = 20
    23        Priority = 1
    24        MeshOptions {
    25          MaximumSideLength = 0.45
    26        }
    27        Points = [5.550000 -7.625000 ;6.050000 -7.625000 ;6.050000 7.625000 ;5.550000 7.625000 ;]
    28      }
    29      Polygon {
    30        Name = "Ring"
    31        DomainId = 20
    32        Priority = 1
    33        MeshOptions {
    34          MaximumSideLength = 0.45
    35        }
    36        Points = [5.244714 1.485540 ;5.202486 1.954725 ;5.118372 2.418235 ;4.993047 2.872339 ;4.827521 3.313381 ;4.623127 3.737810 ;4.381510 4.142209 ;4.104615 4.523321 ;3.794673 4.878079 ;3.454178 5.203625 ;3.085873 5.497339 ;2.692721 5.756856 ;2.277890 5.980087 ;1.844718 6.165233 ;1.396693 6.310805 ;0.937424 6.415630 ;0.470606 6.478865 ;0.000000 6.500000 ;-0.470606 6.478865 ;-0.937424 6.415630 ;-1.396693 6.310805 ;-1.844718 6.165233 ;-2.277890 5.980087 ;-2.692721 5.756856 ;-3.085873 5.497339 ;-3.454178 5.203625 ;-3.794673 4.878079 ;-4.104615 4.523321 ;-4.381510 4.142209 ;-4.623127 3.737810 ;-4.827521 3.313381 ;-4.993047 2.872339 ;-5.118372 2.418235 ;-5.202486 1.954725 ;-5.244714 1.485540 ;-5.244714 -1.485540 ;-5.202486 -1.954725 ;-5.118372 -2.418235 ;-4.993047 -2.872339 ;-4.827521 -3.313381 ;-4.623127 -3.737810 ;-4.381510 -4.142209 ;-4.104615 -4.523321 ;-3.794673 -4.878079 ;-3.454178 -5.203625 ;-3.085873 -5.497339 ;-2.692721 -5.756856 ;-2.277890 -5.980087 ;-1.844718 -6.165233 ;-1.396693 -6.310805 ;-0.937424 -6.415630 ;-0.470606 -6.478865 ;-0.000000 -6.500000 ;0.470606 -6.478865 ;0.937424 -6.415630 ;1.396693 -6.310805 ;1.844718 -6.165233 ;2.277890 -5.980087 ;2.692721 -5.756856 ;3.085873 -5.497339 ;3.454178 -5.203625 ;3.794673 -4.878079 ;4.104615 -4.523321 ;4.381510 -4.142209 ;4.623127 -3.737810 ;4.827521 -3.313381 ;4.993047 -2.872339 ;5.118372 -2.418235 ;5.202486 -1.954725 ;5.244714 -1.485540 ;]
    37      }
    38      Polygon {
    39        Name = "Ring_Inner_Edge"
    40        DomainId = 10
    41        Priority = 2
    42        MeshOptions {
    43          MaximumSideLength = 4
    44        }
    45        Points = [4.745217 1.463108 ;4.707011 1.887608 ;4.630908 2.306974 ;4.517518 2.717831 ;4.367757 3.116869 ;4.182829 3.500876 ;3.964223 3.866761 ;3.713700 4.211577 ;3.433276 4.532548 ;3.125209 4.827089 ;2.791980 5.092831 ;2.436272 5.327632 ;2.060948 5.529602 ;1.669030 5.697116 ;1.263675 5.828824 ;0.848145 5.923666 ;0.425787 5.980878 ;0.000000 6.000000 ;-0.425787 5.980878 ;-0.848145 5.923666 ;-1.263675 5.828824 ;-1.669030 5.697116 ;-2.060948 5.529602 ;-2.436272 5.327632 ;-2.791980 5.092831 ;-3.125209 4.827089 ;-3.433276 4.532548 ;-3.713700 4.211577 ;-3.964223 3.866761 ;-4.182829 3.500876 ;-4.367757 3.116869 ;-4.517518 2.717831 ;-4.630908 2.306974 ;-4.707011 1.887608 ;-4.745217 1.463108 ;-4.745217 -1.463108 ;-4.707011 -1.887608 ;-4.630908 -2.306974 ;-4.517518 -2.717831 ;-4.367757 -3.116869 ;-4.182829 -3.500876 ;-3.964223 -3.866761 ;-3.713700 -4.211577 ;-3.433276 -4.532548 ;-3.125209 -4.827089 ;-2.791980 -5.092831 ;-2.436272 -5.327632 ;-2.060948 -5.529602 ;-1.669030 -5.697116 ;-1.263675 -5.828824 ;-0.848145 -5.923666 ;-0.425787 -5.980878 ;-0.000000 -6.000000 ;0.425787 -5.980878 ;0.848145 -5.923666 ;1.263675 -5.828824 ;1.669030 -5.697116 ;2.060948 -5.529602 ;2.436272 -5.327632 ;2.791980 -5.092831 ;3.125209 -4.827089 ;3.433276 -4.532548 ;3.713700 -4.211577 ;3.964223 -3.866761 ;4.182829 -3.500876 ;4.367757 -3.116869 ;4.517518 -2.717831 ;4.630908 -2.306974 ;4.707011 -1.887608 ;4.745217 -1.463108 ;]
    46      }
    47    }
    48    MultiLayer {
    49      LayerInterface {
    50        BoundaryClass = Transparent
    51      }
    52      Layer {
    53        Thickness = 0.225
    54        DomainIdMapping = [10 1, 20 1]
    55      }
    56      LayerInterface {
    57        GlobalZ = 0.0
    58      }
    59      Layer {
    60        Thickness = 0.25
    61        DomainIdMapping = [10 3, 20 2]
    62      }
    63      Layer {
    64        Thickness = 0.225
    65        DomainIdMapping = [10 3, 20 3]
    66      }
    67      LayerInterface {
    68        BoundaryClass = Transparent
    69      }
    70    }
    71  }
    72  
    73  
    
  • Matlab script run_geometry.m [ASCII]

     1% Interface for 3D ring resonator (stadium shape) geometry setup
     2
     3keys.uol = 1.0e-6; % Unit of Length (in m)
     4
     5% incoming waveguide
     6keys.wg_width = 0.5; % waveguide width
     7keys.wg_height = 0.25; % waveguide height 
     8
     9% resonator parameters
    10keys.resonator_radius = 5.0; % ring resonator radius
    11keys.resonator_wg_gap = 0.3; % gap between resonator and waveguide
    12keys.resonator_coupling_length = 2.5;
    13
    14% meshing parameter
    15keys.wg_segment_length = 0.45; % discretization segment length
    16
    17jcmwave_geo('.', keys, 'jcmt_pattern', 'ring_resonator', 'show', inf);
    
  • Layout template file layout.ring_resonator.jcmt [ASCII]

      1<?
      2keys.slc1 = 4; % background
      3keys.slc2 = keys.wg_segment_length; % waveguide
      4keys.offset_xy = keys.wg_segment_length*2.5;
      5keys.offset_z = keys.wg_segment_length/2;
      6
      7% coordinate positions from layout parameters
      8x1 = - keys.resonator_radius - keys.wg_width/2 - keys.offset_xy;
      9x2 = keys.resonator_radius + keys.wg_width/2 + keys.resonator_wg_gap;
     10x3 = x2 + keys.wg_width;
     11x4 = x3 + keys.offset_xy;
     12
     13y1 = -(keys.resonator_radius + keys.wg_width/2 + keys.offset_xy + keys.resonator_coupling_length/2);
     14y2 = -y1;
     15
     16keys.points_cd = [x1 y1; x4 y1; x4 y2; x1 y2];
     17keys.points_wg = [x2 y1; x3 y1; x3 y2; x2 y2];
     18
     19% define circles
     20n = ceil(2*pi*keys.resonator_radius/keys.wg_segment_length);
     21points_ring_outer = (keys.resonator_radius + keys.wg_width/2)*exp(1i*[0.5:n]*2*pi/n);
     22points_ring_inner = (keys.resonator_radius - keys.wg_width/2)*exp(1i*[0.5:n]*2*pi/n);
     23
     24% insert linear segments to the circles (making them 
     25points_ring_outer(1:end/2) = points_ring_outer(1:end/2) + keys.resonator_coupling_length*0.5i;
     26points_ring_inner(1:end/2) = points_ring_inner(1:end/2) + keys.resonator_coupling_length*0.5i;
     27points_ring_outer(end/2+1:end) = points_ring_outer(end/2+1:end) - keys.resonator_coupling_length*0.5i;
     28points_ring_inner(end/2+1:end) = points_ring_inner(end/2+1:end) - keys.resonator_coupling_length*0.5i;
     29
     30keys.points_ring_outer = [real(points_ring_outer); imag(points_ring_outer)].';
     31keys.points_ring_inner = [real(points_ring_inner); imag(points_ring_inner)].';
     32
     33?>
     34Layout3D {
     35  Name = "TutorialExample3D"
     36  UnitOfLength = %(uol)e
     37  MeshOptions { 
     38    MaximumSideLength = %(slc1)e
     39    MinimumMeshAngle = 18
     40  }
     41  BoundaryConditions {
     42    Boundary {
     43      Direction = All 
     44      Class = Transparent 
     45    }
     46  }
     47  Extrusion {
     48    Objects {
     49      Polygon { 
     50        Name = "ComputationalDomain" 
     51        DomainId = 10 
     52        Priority = -1 
     53        Points = %(points_cd)3f        
     54      }
     55      Polygon { 
     56        Name = "Waveguide" 
     57        DomainId = 20 
     58        Priority = 1
     59        MeshOptions {
     60          MaximumSideLength = %(slc2)e          
     61        }
     62        Points = %(points_wg)6f
     63      }
     64      Polygon { 
     65        Name = "Ring" 
     66        DomainId = 20 
     67        Priority = 1
     68        MeshOptions {
     69          MaximumSideLength = %(slc2)e          
     70        }
     71        Points = %(points_ring_outer)6f
     72      }
     73      Polygon { 
     74        Name = "Ring_Inner_Edge"
     75        DomainId = 10
     76        Priority = 2
     77        MeshOptions {
     78          MaximumSideLength = %(slc1)e          
     79        }
     80        Points = %(points_ring_inner)6f
     81      }
     82    }
     83    MultiLayer {
     84
     85      Layer { 
     86        Thickness = %(offset_z)e
     87        DomainIdMapping = [10 1, 20 1]
     88      }
     89      LayerInterface {
     90        GlobalZ = 0.0
     91      }
     92      Layer { 
     93        Thickness = %(wg_height)e
     94        DomainIdMapping = [10 3, 20 2]
     95      }
     96      Layer { 
     97        Thickness = %(offset_z)e
     98        DomainIdMapping = [10 3, 20 3]
     99      }
    100    }
    101  }
    102}