-
Notifications
You must be signed in to change notification settings - Fork 7
/
ORTools_example06.m
130 lines (121 loc) · 5.11 KB
/
ORTools_example06.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
% *********************************************************************
% ORTools - Example 6
% *********************************************************************
% Two-stage parent grain reconstruction in a TWIP-TRIP steel
% https://www.youtube.com/watch?v=K2rO3Mx4A8s
% *********************************************************************
% Dr. Azdiar Gazder, 2021, azdiaratuowdotedudotau
% Dr. Frank Niessen, 2021, 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 6');
%% 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/'];
Ini.phaseNames = {'Gamma','AlphaP','Epsilon'};
%% Import EBSD data and save current file name
ebsd = loadEBSD_ctf([Ini.ebsdPath,'TRWIPsteel.ctf'],'convertSpatial2EulerReferenceFrame');
ebsd = ebsd('indexed');
%% Compute, filter and smooth grains
screenPrint('SegmentStart','Computing, filtering and smoothing grains');
% Grains are calculated with a 3° threshold
[grains,ebsd.grainId] = calcGrains(ebsd('indexed'),'threshold',3*degree,...
'removeQuadruplePoints');
grains = grains.smooth(3);
%% Rename and recolor phases
screenPrint('SegmentStart','Renaming and recoloring phases');
%Rename "Iron fcc" to "Gamma", "Iron bcc (old)" to "AlphaP" and
%"Epsilon_Martensite" to "Epsilon"
ebsd = renamePhases(ebsd,Ini.phaseNames);
%Choose your favourite colors
ebsd = recolorPhases(ebsd);
%% Define the transformation system
screenPrint('SegmentStart','Finding the orientation relationship(s)');
% Choose "Epsilon" as a parent and "AlphaP" as a child phase
job1 = setParentGrainReconstructor(ebsd,grains,Ini.cifPath);
%% Plot phase map
plotMap_phases(job1,'linewidth',2);
%% Plot parent and child IPF maps
plotMap_IPF_p2c(job1,vector3d.Z,'linewidth',2);
% ************** %
%% Define and check the OR EPSILON - ALPHA
% We define the Burgers OR between Epsilon and AlphaP
job1.p2c = orientation.Burgers(job1.csParent,job1.csChild);
job1.calcParent2Child('p2c');
plotHist_OR_misfit(job1,orientation.Burgers(job1.csParent,job1.csChild),...
'legend',{'Burgers OR'});
%% Check the fit with the OR locally
% Plot parent-child and child-child OR boundary disorientation map
% We color the boundaries up to 5° disorientation to emphasize the effects
plotMap_gB_misfit(job1,'linewidth',1.5,'maxColor',5);
% The fit is quite good most places
%% Reconstruct epsilon
for k = 1:3
job1.calcGBVotes('p2c','threshold',k*2.5*degree);
job1.calcParentFromVote;
end
plotMap_IPF_p2c(job1,vector3d.Z,'linewidth',2,'parent');
%% Merge similar and show reconstructed orientation map
job1.mergeSimilar('threshold',7.5*degree);
parentIPFkey = plotMap_IPF_p2c(job1,vector3d.Z,'linewidth',2,'parent');
figure; plot(parentIPFkey);
%% Define and check the OR GAMMA - EPSILON
% Choose "Gamma" as a parent and "Epsilon" as a child phase
job2 = setParentGrainReconstructor(job1.ebsd,job1.grains,Ini.cifPath);
% We define the Shoji-Nishiyama (S-N) OR between Gamma and Epsilon
job2.p2c = orientation.ShojiNishiyama(job2.csParent,job2.csChild);
job2.calcParent2Child('p2c');
plotHist_OR_misfit(job2,...
orientation.ShojiNishiyama(job2.csParent,job2.csChild),...
'legend',{'S-N OR'});
%% Check the fit with the OR locally
% Plot parent-child and child-child OR boundary disorientation map
% We color the boundaries up to 5° disorientation to emphasize the effects
plotMap_gB_misfit(job2,'linewidth',1.5,'maxColor',5);
% The fit is quite good most places
%% Reconstruct Gamma
for k = 1:3
job2.calcGBVotes('p2c','threshold',k*2.5*degree);
job2.calcParentFromVote;
end
plotMap_IPF_p2c(job2,vector3d.Z,'linewidth',2,'parent');
%% Merge similar and show reconstructed orientation map
job2.mergeSimilar('threshold',7.5*degree);
parentIPFkey = plotMap_IPF_p2c(job2,vector3d.Z,'linewidth',2,'parent');
figure; plot(parentIPFkey);
% ************** %
%% Variant analysis Gamma-Epsilon
plotPDF_variants(job2);
% Then calculate the variant IDs of all alpha grains ...
job2.calcVariants;
% ... and plot them
plotMap_variants(job2,'linewidth',3);
% ************** %
%% Variant analysis Epsilon-AlphaP
plotPDF_variants(job1);
% Then calculate the variant IDs of all alpha grains ...
job1.calcVariants;
% ... and plot them
plotMap_variants(job1,'linewidth',3);
%% Save images
saveImage(Ini.imagePath);
%% Grain Click
grainClick(job2,'noScalebar','noFrame');
%% Summary
% This example has shown two-stage parent grain reconstruction in a
% TWIP-TRIP steel. In the first stage, alphaP martensite was reverted to
% epsilon martensite. In the second stage, epsilon martensite was reverted
% to parent austenite.