Merging grains may be useful when reconstructing parent grain structures, i.e., before phase transition or before twinning. In this section we will use a twinning example for illustration. Lets start by importing some Magnesium data and reconstructing the grain structure:
Next we identify all twinning boundaries
Merge grains along boundaries
The command merge will merge grains together that have a common boundary which is specified as the second argument. In our example we want to merge all grains that have a common twinning boundary so we do
Grain relationships
The second output argument paraentId of merge is a list with the same size as the child grains which indicates for each child grain into which parent grain it has been merged. The id of the common grain is usually different from the ids of the merged grains and can be found by
Hence, we can find all childs of grain 16 by
Estimate twin area fraction
Determining which of the measured grains are original grains and which are twins is a tough problem. Here we make a very simple assumption by labeling those areas as twins that make up less than half of the merged (original) parent grain
The parentId may also be used to compute properties of the parent grains by averaging over the corresponding child grain properties. This can be done with the MATLAB command accumarray
The above result is a bit unrealistic since the averages are computed between the childs ignoring their relative areas. A better approach is to compute a weighted average by the following lines.
Setting Up the EBSD Data for the Merged Grains
Note that the Id's of the merged grains does not fit the grainIds stored in the initial ebsd variable. As a consequence, the following command will not give the right result
In order to update the grainId in the ebsd variable to the merged grains, we proceed as follows.
Now the variable ebsd_merged can be indexed by the merged grains, i.e.