-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeCFxLOL.m
194 lines (147 loc) · 5.05 KB
/
CodeCFxLOL.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
clc
clear
close all
path="AirfoilData.xlsx";
[X,U]=Import_Script(path);
U_d = zeros(1,length(U));
length_U = length(U);
U_d=gradient(U,X);
U_dd=gradient(U_d,X);
del1=[-120^-1 3/10];
del2=[-1/9072 -1/945 37/315];
k_p=conv(conv(del2,del2),[1 0]);
f2_p=conv([1/6 2],del2);
F_del2=(conv((2*[0 0 f2_p]-4*k_p),del2)-[0 conv(2*k_p,del1)]);
lamda_s=roots(F_del2);
a=real(lamda_s)<10 & real(lamda_s)>-12;
lamda_itr = zeros(1, length_U);
lamda_itr(1) = lamda_s(a);
mu = 1.789*10^-5;
rho = 1.225;
delta1_ = zeros(1, length_U);
delta2_ = zeros(1, length_U);
delta1_(1) = 0.3-lamda_itr(1)/120;
delta2_(1) = 37/315-lamda_itr(1)/945-lamda_itr(1)^2/9072;
K = zeros(1, length_U);
K(1) = delta2_(1)^2*lamda_itr(1);
z = zeros(1, length_U);
z(1) = K(1)/U_d(1);
F = zeros(1, length_U);
f1 = zeros(1, length_U);
f2 = zeros(1, length_U);
f1(1) = delta1_(1)/delta2_(1);
f2(1) = (2+lamda_itr(1)/6)*delta2_(1);
F(1) = 2*f2(1)-4*K(1)-2*K(1)*f1(1);
F0_U0 = -0.0652*U_dd(1)/U_d(1)^2;
z(2) = z(1)+F0_U0*( X(2) - X(1) );
delta = zeros(1, length_U);
delta1 = zeros(1, length_U);
delta2 = zeros(1, length_U);
delta(1) = sqrt(lamda_itr(1)*mu/rho/U_d(1));
delta1(1) = delta(1)*delta1_(1);
delta2(1) = delta(1)*delta2_(1);
%
for i = 2:length(U_d)
K(i) = z(i)*U_d(i);
P1=[0 0 0 0 0 -K(i)]+k_p;
Lamda_itr_s=roots(P1);
j=abs(imag(Lamda_itr_s))>0;
Lamda_itr_s(j)=[];
b=real(Lamda_itr_s)<lamda_itr(1) & real(Lamda_itr_s)>-12;
if b==0
break
end
lamda_itr(i) = Lamda_itr_s(b);
delta1_(i) = 0.3-lamda_itr(i)/120;
delta2_(i) = 37/315-lamda_itr(i)/945-lamda_itr(i)^2/9072;
delta(i) = sqrt(lamda_itr(i)*mu/rho/U_d(i));
delta1(i) = delta(i)*delta1_(i);
delta2(i) = delta(i)*delta2_(i);
f1(i) = delta1_(i)/delta2_(i);
f2(i) = (2+lamda_itr(i)/6)*delta2_(i);
F(i) = 2*f2(i)-4*K(i)-2*K(i)*f1(i);
z(i+1) = z(i)+F(i)/U(i)*(X(i+1)-X(i));
end
% Delta1 vs X
figure
plot(X, delta)
xlim([0 0.7])
xlabel('$X$','interpreter','latex','FontSize',14);
ylabel('$\delta$','interpreter','latex','FontSize',14);
title('$\delta$ $vs$ $X$','interpreter','latex','FontSize',14);
% Delta1 vs X
figure
plot(X, delta1)
xlim([0 0.7])
xlabel('$X$','interpreter','latex','FontSize',14);
ylabel('$\delta_{1}$','interpreter','latex','FontSize',14);
title('$\delta_{1}$ $vs$ $X$','interpreter','latex','FontSize',14);
% Delta2 vs X
figure
plot(X, delta2)
xlim([0 0.7])
xlabel('$X$','interpreter','latex','FontSize',14);
ylabel('$\delta_{2}$','interpreter','latex','FontSize',14);
title('$\delta_{2}$ $vs$ $X$ $Laminar$','interpreter','latex','FontSize',14);
% Cfx vs X
figure
cfx = ( 2.*f2 .* U ) ./ (sqrt(rho/mu) .* sqrt(z));
plot(X,cfx)
xlabel('$X$','interpreter','latex','FontSize',14);
ylabel('$C{fx}$','interpreter','latex','FontSize',14);
title('$C_{fx}$ $vs$ $X$ $Laminar$','interpreter','latex','FontSize',14);
% tau_w vs x
tau_w = cfx * 0.5 * rho;
plot(X,tau_w)
xlabel('$X$','interpreter','latex','FontSize',14);
ylabel('$\tau_{w}$','interpreter','latex','FontSize',14);
title('$\tau_{w}$ $vs$ $X$ $Laminar$','interpreter','latex','FontSize',14);
H=f1;
log_Rex=log10(rho.*U.*X./mu);
F_H=-40.4557+64.8066*H-26.7538*H.^2+3.3819*H.^3;
d=find(abs(log_Rex-F_H)<0.01);
x_s=X(d);
f=f1(d);
delta2(d) = delta2(d-1);
delta(d) = 1.4*delta(d-1);
syms x
eqn= (-delta(d)/delta2(d)+x+3.3+1.5501*(x-0.6778)^-3.064==0);
H_(d) = double(vpasolve(eqn,x,1));
H_11 = double(vpasolve(1.1+0.86*(x-3.3)^-0.777==H_(d),x,1));
H_1(d)=H_11;
for i = d+1:length(U_d)
if H_(i-1) > 1.8 && H_(i-1) < 2.8
break
end
Re_delta2_(i-1) = U(i-1) .* delta2(i-1) * (rho/mu);
cfx(i-1) = 0.246*10^(-0.678*H_(i-1)) * (Re_delta2_(i-1))^-0.268;
delta2_by_dx = cfx(i-1)/2 - (delta2(i-1) / U(i-1)) * U_d(i-1);
delta2(i) = delta2(i-1) + delta2_by_dx * (X(i) - X(i-1));
H_1(i) = (0.306e-1 * U(i) * ((H_1(i - 1) - 3) ^ (-0.6169e0)) + (U(i) * delta2(i) * H_1(i - 1) / (X(i) - X(i - 1)))) / ((U(i) * delta2(i) - U(i - 1) * delta2(i - 1)) / (X(i) - X(i - 1)) + U(i) * delta2(i) / (X(i) - X(i - 1)));
if (H_1(i) <= 3.3)
H_(i) = 3;
elseif (H_1(i) > 5.3)
H_(i) = 1.1+0.86*(H_1(i)-3.3)^-0.777;
else
H_(i) = 0.6778 + 1.1536*(H_1(i) - 3.3 )^-0.326;
end
end
% Delta2 vs X
figure
plot(X, delta2)
xlim([0 1])
xlabel('$X$','interpreter','latex','FontSize',14);
ylabel('$\delta_{2}$','interpreter','latex','FontSize',14);
title('$\delta_{2}$ $vs$ $X$ $with Transition$','interpreter','latex','FontSize',14);
% Cfx vs X
figure
plot(X,cfx)
xlabel('$X$','interpreter','latex','FontSize',14);
ylabel('$C{fx}$','interpreter','latex','FontSize',14);
title('$C_{fx}$ $vs$ $X$ $with Transition$','interpreter','latex','FontSize',14);
% tau_w vs x
tau_w = cfx * 0.5 * rho;
plot(X,tau_w)
xlabel('$X$','interpreter','latex','FontSize',14);
ylabel('$\tau_{w}$','interpreter','latex','FontSize',14);
title('$\tau_{w}$ $vs$ $X$ $Transition$','interpreter','latex','FontSize',14);