Open Matlab File in the Editor MTEX

Grain Boundary Tutorial

geometrical properties of grain boundaries

On this page ...
Grain boundaries generation
Properties of grain boundaries
Line intersections

Grain boundaries generation

To work with grain boundaries we need some ebsd data and have to detect grains within the data set.

% load some example data
mtexdata twins

% detect grains
[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd('indexed'))

% smooth them
grains = grains.smooth

% visualize the grains
plot(grains,grains.meanOrientation)

% extract the grain boundaries
gB = grains.boundary
 loading data ...
 saving data to /home/hielscher/mtex/master/data/twins.mat
 
grains = grain2d  
 
 Phase  Grains  Pixels    Mineral  Symmetry  Crystal reference frame
     1     121   22833  Magnesium     6/mmm        X||a*, Y||b, Z||c
 
 Properties: GOS, meanRotation
 
 
ebsd = EBSD  
 
 Phase  Orientations     Mineral       Color  Symmetry  Crystal reference frame
     0     46 (0.2%)  notIndexed                                               
     1  22833 (100%)   Magnesium  light blue     6/mmm        X||a*, Y||b, Z||c
 
 Properties: bands, bc, bs, error, mad, x, y, grainId, mis2mean
 Scan unit : um
 
 
ebsd = EBSD  
 
 Phase  Orientations     Mineral       Color  Symmetry  Crystal reference frame
     0     46 (0.2%)  notIndexed                                               
     1  22833 (100%)   Magnesium  light blue     6/mmm        X||a*, Y||b, Z||c
 
 Properties: bands, bc, bs, error, mad, x, y, grainId, mis2mean
 Scan unit : um
 
 
grains = grain2d  
 
 Phase  Grains  Pixels    Mineral  Symmetry  Crystal reference frame
     1     121   22833  Magnesium     6/mmm        X||a*, Y||b, Z||c
 
 Properties: GOS, meanRotation
 
  I'm going to colorize the orientation data with the 
  standard MTEX colorkey. To view the colorkey do:
 
  oM = ipdfHSVOrientationMapping(ori_variable_name)
  plot(oM)
 
gB = grainBoundary  
 
 Segments   mineral 1  mineral 2
      606  notIndexed  Magnesium
     3219   Magnesium  Magnesium

Properties of grain boundaries

A variable of type grain boundary contains the following properties

These can be used to colorize the grain boundaries. By the following command we plot the grain boundaries colorized by the misorientation angle

plot(gB('indexed'),gB('indexed').misorientation.angle./degree,'linewidth',2)
mtexColorbar

The output tells us that we have 3219 Magnesium to Magnesium boundary segments and 606 boundary segements where the grains are cutted by the scanning boundary. To restrict the grain boundaries to a specific phase transistion you shall do

plot(gB,gB.direction.rho,'linewidth',2)

Line intersections

Let start by defining some line by its endpoints and plot in on top of the boundary plot

xy1 = [0,10];   % staring point
xy2 = [31,41]; % end point

plot(grains.boundary)
line([xy1(1);xy2(1)],[xy1(2);xy2(2)],'linestyle',':','linewidth',2,'color','cyan')

The command intersect computes the intersections of all boundary segments with the given line

[x,y] = grains.boundary.intersect(xy1,xy2);
hold on
scatter(x,y,'red')
hold off
% find the number of intersection points
sum(~isnan(x))
ans =
    10