-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathORTools_example02.m
148 lines (137 loc) · 5.91 KB
/
ORTools_example02.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
% *********************************************************************
% ORTools - Example 2
% *********************************************************************
% Reconstruction of beta parent grains from
% alpha in titanium alloys.
% The MTEX description for reconstruction is given here:
% https://mtex-toolbox.github.io/TiBetaReconstruction.html
% https://www.youtube.com/watch?v=e6R0dApUc8Q&t=921s
% *********************************************************************
% Dr. Azdiar Gazder, 2020, azdiaratuowdotedudotau
% Dr. Frank Niessen, 2020, contactatfniessendotcom
% (Remove "dot" and "at" to make this email address valid)
% *********************************************************************
home; close all; clear variables;
currentFolder;
set(0,'DefaultFigureWindowStyle','normal');
screenPrint('StartUp','ORTools - Example 2');
%% Initialize MTEX
% Startup and set some settings
startup_mtex;
setMTEXpref('xAxisDirection','east');
setMTEXpref('zAxisDirection','outOfPlane');
setMTEXpref('FontSize',14);
setInterp2Tex;
% Default directories - Do not modify
Ini.dataPath = [strrep(pwd,'\','/'),'/data/'];
Ini.cifPath = [Ini.dataPath,'input/cif/'];
Ini.ebsdPath = [Ini.dataPath,'input/ebsd/'];
Ini.texturePath = [Ini.dataPath,'output/texture/'];
Ini.imagePath = [Ini.dataPath,'output/images/'];
%% Load data
% Open the MTEX dataset on alpha and beta titanium
mtexDataset = 'alphaBetaTitanium';
screenPrint('SegmentStart',sprintf('Loading MTEX example data ''%s''',mtexDataset));
ebsd = mtexdata(mtexDataset);
%% Compute, filter and smooth grains
screenPrint('SegmentStart','Computing, filtering and smoothing grains');
% Grains are calculated with a 1.5° threshold
[grains,ebsd.grainId] = calcGrains(ebsd('indexed'),'threshold',1.5*degree,...
'removeQuadruplePoints');
%% Rename and recolor phases
screenPrint('SegmentStart','Renaming and recoloring phases');
phaseNames = {'Alpha','Beta'};
% Rename "Ti (BETA) to "Beta"and "Ti (alpha)" to "Alpha"
ebsd = renamePhases(ebsd,phaseNames);
% Choose your favourite colors
ebsd = recolorPhases(ebsd);
%% Finding the orientation relationship
screenPrint('SegmentStart','Finding the orientation relationship(s)');
% Choose Beta as a parent and Alpha as a child phase in the transition
job = setParentGrainReconstructor(ebsd,grains,Ini.cifPath);
% Use the peak fitter in the pop-up menu
% - Adjust the threshold to include only the largest peak
job = defineORs(job);
% Check the disorientation and compare it with the Burgers OR
plotHist_OR_misfit(job,orientation.Burgers(job.csParent,job.csChild),...
'legend',{'Burgers OR'});
xlim([0,10]);
% - The misfit with Burgers OR and the experimental OR is almost
% identical
%% Plotting (with ORTools functions)
screenPrint('SegmentStart','Plotting some ORTools maps');
% Use some of the ORTools functions to visualize the determined OR
% and its relation to the microstructure
% Phase map
plotMap_phases(job,'linewidth',1);
% - The microstructure consists of 99.75 % alpha
% Parent and child IPF maps
plotMap_IPF_p2c(job,vector3d.Z,'linewidth',1,'child');
% - We can visually recognize the prior beta grains
% Child-child grain boundary misorientation map
plotMap_gB_c2c(job,'linewidth',1);
% - Alpha of same prior beta grain seem to have ~58° misorientation
% Plot a map of the OR boundary disorientation, or misfit
plotMap_gB_misfit(job,'linewidth',1.5, 'maxColor', 10);
% - A threshold of 10° shows where the prior beta boundaries are
% Plot parent-child and child-child OR boundary probability map
plotMap_gB_prob(job,'linewidth',1.5);
% - This is also manifested in the OR probability map
% We can plot the OR and boundary misorientation axes and color the
% experimental points according to their disorientation angle from the OR
% We plot the
% - parent-child misorientation axes in the parent basis
% - parent-child misorientation axes in the child basis
% - and the child-child misorientation axes in the child basis
plotIPDF_gB_misfit(job);
% And we can do the same for the OR probability
plotIPDF_gB_prob(job);
%% Compute parent orientations from triple junctions
% We can use a voting algorithm which votes for a parent orientation at
% triple points of child grains
job.calcTPVotes('minFit',2.5*degree,'maxFit',5*degree);
% Check the votes for all grains
figure
plot(job.grains,job.votes.prob(:,1));
mtexColorbar
% .... and calculate parent orientations for all grains with a > 70%
% probability
job.calcParentFromVote('minProb',0.7);
%Plot the data
figure;
plot(job.parentGrains,job.parentGrains.meanOrientation,'linewidth',1.5);
%% Grow parent grains at grain boundaries by voting algorithm
% We can then let the parent grains grow into the child grains by a voting
% algorithm
for k = 1:3
job.calcGBVotes('p2c','threshold',k*2.5*degree);
job.calcParentFromVote
end
% This is the resulting reconstructed parent microstructure
figure;
plot(job.parentGrains,job.parentGrains.meanOrientation,'linewidth',1.5);
%% Clean reconstructed grains
% We now merge grains with similar orientation
job.mergeSimilar('threshold',5*degree);
% and merge small inclusions into larger grains
job.mergeInclusions('maxSize',5);
% and then plot the cleaned reconstructed parent microstructure
figure;
plot(job.parentGrains,job.parentGrains.meanOrientation,'linewidth',1.5)
%% Variant analysis
% Plot the variant pole figure
figure;
plotPDF_variants(job);
% We can calculate variants and packets
job.calcVariants;
% and plot the variant map
plotMap_variants(job,'linewidth',3);
%plotMap_variants(job,'grains','linewidth',3); %Plot grain data instead
%% Plot reconstructed parent EBSD orientations and the IPF key
parentIPFkey = plotMap_IPF_p2c(job,vector3d.Z,'linewidth',3,'parent');
figure; plot(parentIPFkey);
%% Save images
saveImage(Ini.imagePath);
%% Check the beta grains interactively by clicking on them
grainClick(job,'noScalebar','noFrame');
%grainClick(job,'grains','noScalebar','noFrame'); %Plot grain data instead