-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAvg_Taylor_factor.m
More file actions
36 lines (27 loc) · 971 Bytes
/
Avg_Taylor_factor.m
File metadata and controls
36 lines (27 loc) · 971 Bytes
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
%This code is for calculating average Taylor factor using MTEX
clc;
clear;
cs = crystalSymmetry('432');
ss = specimenSymmetry('1');
%define a family of slip systems
sS = slipSystem.fcc(cs);
%%some plane strain
q = 0.5;
epsilon= strainTensor([1 0 0; 0 -q 0;0 0 q-1]);
%% Asking the euler angle input from User
prompt = 'Enter your file name having orientation of grain in apostrophe(''myfile.txt''):-';
name_of_file = input(prompt);
grain_orientation = dlmread(name_of_file);
%% Assigning grain orientations to a variable all_Euler
all_euler = grain_orientation;
Taylor_factor=[];
loopcnt = 0;
for counter=1:1:size(all_euler,1)
euler = all_euler(counter,:)*degree;
ori = orientation('Euler',euler,cs,ss);
[M,~,W] = calcTaylor(inv(ori)*epsilon,sS.symmetrise);
Taylor_factor = [Taylor_factor;M];
loopcnt = loopcnt + 1;
end
%calculate average Taylor factor
Avg_Taylor_Factor=(sum(Taylor_factor,'all'))/loopcnt