Z-Corner Rounding

Learning targets

  • Use scripting to describe a complicated dependency in z-direction

This example describes a unit cell of a hexagonal lattice (equilateral triangular lattice) of cones with capping layer and corner rounding. The computational domain is specified as extruded polygon, the cone is specified as extruded circle where radius and material change with the z-coordinate. The x- and y-positions of the polygon points as well as the height-dependence of the cone parameters are computed in few lines of Matlab code in a template file which is run from a script (please see also the documentation for the JCMsuite Matlab® Interface).

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

_images/ex3d_z_corner_rounding_mesh.png

Input Files

  • layout.jcm [ASCII]

     1Layout3D {
     2  Name = "TutorialExample3D"
     3  UnitOfLength = 1e-09
     4  MeshOptions {
     5    MaximumSideLength = 100
     6    MinimumMeshAngle = 20
     7  }
     8  Extrusion {
     9    Objects {
    10      Polygon {
    11        Name = "ComputationalDomain/Air"
    12        DomainId = 101
    13        Priority = -1
    14        Points = [125.000 216.506 -125.000 216.506 -250.000 0.000 -125.000 -216.506 125.000 -216.506 250.000 -0.000]
    15        Boundary {
    16          Number = [1 2 3 4 5 6]
    17          Class = Periodic
    18        }
    19      }      
    20      Circle {
    21        DomainId = 102
    22        Radius = 123.601319405876
    23      }
    24    }
    25    MultiLayer {
    26      LayerInterface {
    27        GeometryValues = [Circle{1}/Radius:156.139]
    28        BoundaryClass = Transparent
    29      }
    30      Layer {
    31        Thickness = 50
    32        DomainIdMapping = [101 1, 102 1]
    33      }
    34      LayerInterface {
    35        GeometryValues = [Circle{1}/Radius:150.000]
    36      }
    37      Layer {
    38        Thickness = 350
    39        DomainIdMapping = [101 4, 102 2]
    40      }
    41      LayerInterface {
    42        GeometryValues = [Circle{1}/Radius:107.025]
    43      }
    44      Layer {
    45        Thickness = 50
    46        DomainIdMapping = [101 4, 102 3]
    47      }
    48      LayerInterface {
    49        GeometryValues = [Circle{1}/Radius:100.886]
    50      }
    51      Layer {
    52        Thickness = 15
    53        DomainIdMapping = [101 4, 102 3]
    54      }
    55      LayerInterface {
    56        GeometryValues = [Circle{1}/Radius:95.025]
    57      }
    58      Layer {
    59        Thickness = 10.9807621135332
    60        DomainIdMapping = [101 4, 102 3]
    61      }
    62      LayerInterface {
    63        GeometryValues = [Circle{1}/Radius:82.696]
    64      }
    65      Layer {
    66        Thickness = 4.01923788646684
    67        DomainIdMapping = [101 4, 102 3]
    68      }
    69      LayerInterface {
    70        GeometryValues = [Circle{1}/Radius:67.203]
    71      }
    72      Layer {
    73        Thickness = 50
    74        DomainIdMapping = [101 4, 102 4]
    75      }
    76      
    77      LayerInterface {
    78        GeometryValues = [Circle{1}/Radius:91.063]
    79        BoundaryClass = Transparent
    80      }
    81    }
    82  }
    83}
    84
    
  • Matlab script run_geometry.m [ASCII]

     1% Interface for 3D unit cell of a hexagonal lattice 
     2% 2D-periodic hexagonal array of 3D cones 
     3% with capping layer and with corner rounding
     4
     5keys.uol = 1e-9;
     6keys.p = 500.0; % periodicity length
     7keys.h1 = 350.0; % height of lower material
     8keys.h2 = 80.0; % height of top material (capping layer)
     9keys.radius_bottom = 150; % cone radius bottom
    10keys.cone_swa = 83.0; % cone sidewall angle
    11keys.corner_rounding_r = 30.0; % top corner rounding radius
    12keys.corner_rounding_n = 2; % corner rounding number of segments
    13
    14keys.slc1 = 100; % maximum triangle sidelength
    15
    16jcmwave_geo('.', keys, 'jcmt_pattern', 'matlab', 'show', inf);
    
  • Layout template file layout.matlab.jcmt [ASCII]

     1<?
     2% Matlab definition of a hexagon
     3angles = [1:6]*2*pi/6; points = keys.p/2*exp(1i*angles);
     4keys.points_cd(1:2:12) = real(points(:));
     5keys.points_cd(2:2:12) = imag(points(:));
     6
     7% build the cone from layers of different heights
     8offset = 50; % computational domain offset in +/-z-direction
     9heights = [-offset, 0, keys.h1, keys.h1 + keys.h2, keys.h1 + keys.h2 + offset];
    10% additional corner rounding at the top
    11angles = linspace(0, 90, keys.corner_rounding_n + 2);
    12r = keys.corner_rounding_r;
    13heights = unique([heights keys.h1 + keys.h2 - r + r*sind(angles)]);
    14% thicknesses of the different layers
    15thicknesses = heights(2:end) - heights(1:end-1);
    16% radii of the cone at different heights
    17radii = keys.radius_bottom - tand(90-keys.cone_swa)*heights;
    18keys.radius_mean = radii(1)/2+radii(end)/2;
    19indices_rounded_corner = find(heights >= keys.h1 + keys.h2 - r ...
    20                            & heights <= keys.h1 + keys.h2);
    21radii(indices_rounded_corner) = radii(indices_rounded_corner) - r*(1 - cosd(angles));
    22?>
    23Layout3D {
    24  Name = "TutorialExample3D"
    25  UnitOfLength = %(uol)e  
    26  MeshOptions {
    27    MaximumSideLength = %(slc1)e
    28    MinimumMeshAngle = 20
    29  }
    30  Extrusion{    
    31    Objects {
    32      Polygon {
    33        Name = "ComputationalDomain/Air"
    34        DomainId = 101
    35        Priority = -1
    36        Points = %(points_cd)3f
    37        <?
    38          for counter = 1:length(keys.points_cd)/2
    39              keys.number_ = counter;
    40?>      Boundary {
    41          Number = %(number_)d
    42          Class = Periodic
    43        }
    44       <?
    45         end
    46?>     }
    47      
    48       Circle {
    49         DomainId = 102
    50         Radius = %(radius_mean)e
    51       }
    52     }
    53     MultiLayer {    
    54      <?
    55for counter = 1:length(thicknesses)
    56  keys.thickness_ = thicknesses(counter);
    57  keys.radius_ = radii(counter);
    58  if heights(counter) < 0
    59    keys.material_1 = 1;
    60    keys.material_2 = 1;
    61  elseif heights(counter) < keys.h1;
    62    keys.material_1 = 4;
    63    keys.material_2 = 2;
    64  elseif heights(counter) < keys.h1+keys.h2;
    65    keys.material_1 = 4;
    66    keys.material_2 = 3;
    67  else
    68    keys.material_1 = 4;
    69    keys.material_2 = 4;
    70  end
    71?>    LayerInterface {
    72      GeometryValues = [Circle{1}/Radius:%(radius_)3f]
    73      <? 
    74    if counter==1
    75?>      BoundaryClass = Transparent
    76      <? 
    77    end
    78?>    }
    79      Layer {
    80        Thickness = %(thickness_)e
    81        DomainIdMapping = [101 %(material_1)d, 102 %(material_2)d]
    82      }
    83      <?
    84end
    85keys.radius_ = radii(counter+1);
    86?>
    87      LayerInterface {
    88        GeometryValues = [Circle{1}/Radius:%(radius_)3f]
    89        BoundaryClass = Transparent
    90      }
    91    }  
    92  }
    93}
    94