-
Notifications
You must be signed in to change notification settings - Fork 3
/
RSS.m
62 lines (49 loc) · 1.5 KB
/
RSS.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
function SF = RSS(sS,sigma,varargin)
% compute the Schmid factor
%
% Syntax
%
% SFfun = SchmidFactor(sS) % returns spherical function
% SF = SchmidFactor(sS,v)
% SF = SchmidFactor(sS,sigma)
% SF = SchmidFactor(sS,sigma,'relative')
%
% Input
% sS - list of @slipSystem
% v - @vector3d list of tension direction
% sigma - @stressTensor
%
% Output
% SFfun - size(sS) x 1 list of @S2FunHarmonic
% SF - size(sS) x size(sigma) matrix of Schmid factors
%
b = sS.b.normalize; %#ok<*PROPLC>
n = sS.n.normalize;
% compute the relative Schmid factor by dividing by the critical resolved
% shear stress for every slip system
if check_option(varargin,'relative')
b = b./ sS.CRSS;
end
% Schmid factor with respect to a tension direction
if nargin == 1 || (isnumeric(sigma) && isempty(sigma))
SF = S2FunHarmonic.quadrature(@(v) sS.SchmidFactor(v,varargin{:}),'bandwidth',64);
elseif isa(sigma,'vector3d')
%r = sigma.normalize;
SF = dot_outer(r,b,'noSymmetry') .* dot_outer(r,n,'noSymmetry');
% Schmid factor with respect to a stress tensor
elseif isa(sigma,'stressTensor')
% normalize the stress tensor
%sigma = sigma.normalize;
if length(sigma) == 1
SF = double(EinsteinSum(sigma,[-1,-2],n,-1,b,-2));
SF = reshape(SF,size(sS));
else
SF = zeros(length(sigma),length(b));
for i = 1:length(sS.b)
SF(:,i) = double(EinsteinSum(sigma,[-1,-2],n(i),-1,b(i),-2));
end
end
else
error('Second argument should be either vector3d or stressTensor.')
end
end