%Lattice parameters
a=2.95; b=2.95; c=4.686;
alpha=90*degree; beta=90*degree; gamma=120*degree;
%Grain orientation Euler angles
Phi1=0*degree
Theta=0*degree
Phi2=0*degree
% crystal symmetry
CS = crystalSymmetry('6/mmm', [a,b,c], [alpha, beta, gamma], 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Ti-Hex', 'color', 'light blue');
% specimen symmetry
SS = specimenSymmetry('triclinic');
%Grain orientation
ori = orientation('Euler', Phi1, Theta, Phi2, 'bunge', CS, SS);
%Uniaxial Loading dire tions (orthogonal directions)
xcs = Miller (1,0,-1,0, CS, 'uvw')
ycs = Miller (-1,2,-1,0, CS, 'uvw')
zcs = Miller (0,0,0,1, CS, 'uvw')
%Plot loading directions on a stereographic plot
plot(xcs)
hold all
plot(ycs)
plot(zcs)
hold off
% orientation matrix
g = Euler2mat (Phi1, Theta, Phi2, 'bunge', CS,SS);
gT = transpose(g)
% Obtain loading directions in terms of the crystal orientation
% [1 0 -1 0], [-1 2 -1 0] and [0 0 0 1] in three index array to multiply
% with g matrix
x = [1, 0.5, 0]
y = [0, 1, 0]
z = [0, 0, 1]
xcs = gT * x';
ycs = gT * y';
zcs = gT * z';
xcs = Miller(xcs(1),xcs(2),xcs(3),CS,'uvw')
ycs = Miller(ycs(1),ycs(2),ycs(3),CS,'uvw')
zcs = Miller(zcs(1),zcs(2),zcs(3),CS,'uvw')
xcs = normalize(xcs)
ycs = normalize(ycs)
zcs = normalize(zcs)
% {0001} Slip
% Shear direction
mx = Miller(1,1,-2,0,CS,'uvw');
% Plane
k = Miller(0,0,0,1,CS,'hkl')
k = [0, 0, 1]
%calculate plane normal
T = [b^2*c^2*sin(alpha)^2, a*b*c^2*(cos(alpha)*cos(beta)-cos(gamma)), a*b^2*c*(cos(alpha)*cos(gamma)-cos(beta));
a*b*c^2*(cos(alpha)*cos(beta)-cos(gamma)), a^2*c^2*sin(beta)^2, a^2*b*c*(cos(beta)*cos(gamma)-cos(alpha));
a*b^2*c*(cos(alpha)*cos(gamma)-cos(beta)), a^2*b*c*(cos(beta)*cos(gamma)-cos(alpha)), a^2*b^2*sin(gamma)^2];
n = T * k'
n = Miller(n(1),n(2),n(3),CS,'uvw');
nx = normalize(n)
rx = xcs
ry = ycs
rz = zcs
% Find symmetrically equivalent slip and plane normal directions
[m,l] = symmetrise(mx),CS,SS
[n,l] = symmetrise(nx),CS,SS
plot(m,'antipodal')
hold all
plot(n)
hold off
% Find planes and directions that are normal
[r,c] = find(isnull(dot_outer(vector3d(m),vector3d(n))));
m = m(r);
n = n(c);
plot(m,'antipodal')
hold all
plot(n)
plot(rx)
hold off
tau = zeros(numel(m),numel(rx));
%Calculate individual Schmid factors by calculating the angles
for i = 1:numel(m)
anglem = degree - angle_outer(m(i),rx)
ang = anglem / degree
anglen = degree - angle_outer(n(i),rx)
ang = anglen / degree
R = cos(anglem)*cos(anglen)
tau(i,:) = R;
end
if numel(m)>1
[tauMaxx,ind] = max(abs(tau));
m = m(ind);
n = n(ind);
else
tauMaxx = tau;
ind = ones(size(tauMaxx));
end
tauMaxx
%Clear cache and work out for y direction ------------------
clear m
clear n
clear i
clear tau
clear r
clear c
[m,l] = symmetrise(mx),CS,SS
[n,l] = symmetrise(nx),CS,SS
plot(m,'antipodal')
hold all
plot(n)
hold off
[r,c] = find(isnull(dot_outer(vector3d(m),vector3d(n))));
m = m(r);
n = n(c);
plot(m,'antipodal')
hold all
plot(n)
plot(ry)
hold off
tau = zeros(numel(m),numel(ry));
%Calculate individual Schmid factors by calculating the angles
for i = 1:numel(m)
anglem = angle_outer(m(i),ry)
%anglem = min(anglem(:))
ang = anglem / degree
anglen = angle_outer(n(i),ry)
%anglen = min(anglen(:))
ang = anglen / degree
R = cos(anglem)*cos(anglen)
tau(i,:) = R;
end
if numel(m)>1
[tauMaxy,ind] = max(abs(tau));
m = m(ind);
n = n(ind);
else
tauMaxy = tau;
ind = ones(size(tauMaxy));
end
tauMaxy
%Clear cache and work out for z direction ------------------
clear m
clear n
clear i
clear tau
clear r
clear c
[m,l] = symmetrise(mx),CS,SS
[n,l] = symmetrise(nx),CS,SS
plot(m,'antipodal')
hold all
plot(n)
hold off
[r,c] = find(isnull(dot_outer(vector3d(m),vector3d(n))));
m = m(r);
n = n(c);
plot(m,'antipodal')
hold all
plot(n)
plot(rz)
hold off
tau = zeros(numel(m),numel(rz));
%Calculate individual Schmid factors by calculating the angles
for i = 1:numel(m)
anglem = angle_outer(m(i),rz)
%anglem = min(anglem(:))
ang = anglem / degree
anglen = angle_outer(n(i),rz)
%anglen = min(anglen(:))
ang = anglen / degree
R = cos(anglem)*cos(anglen)
tau(i,:) = R;
end
if numel(m)>1
[tauMaxz,ind] = max(abs(tau));
m = m(ind);
n = n(ind);
else
tauMaxz = tau;
ind = ones(size(tauMaxz));
end
tauMaxz
% Display Schmid factors
h=msgbox({'x,y,z:', num2str(tauMaxx), num2str(tauMaxy), num2str(tauMaxz)}, 'Schmid Factors')