-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathzfindstall.m
42 lines (31 loc) · 976 Bytes
/
zfindstall.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
function [results,state]=zfindstall(geo,state,ref,results,stallCL)
solvertype=1;
dalpha=0.01;
[lattice,ref]=fLattice_setup2(geo,state,solvertype);
[results]=solver9(results,state,geo,lattice,ref);
[results]=coeff_create3(results,lattice,state,ref,geo);
[I(1) J(1)]=max(results.CL_local(:,1));
state.alpha=state.alpha+dalpha;
converged=0;
k=1;
while converged==0
k=k+1;
[lattice,ref]=fLattice_setup2(geo,state,solvertype);
[results]=solver9(results,state,geo,lattice,ref);
[results]=coeff_create3(results,lattice,state,ref,geo);
[I(k) J(k)]=max(results.CL_local(:,1));
%plot(results.ystation(:,1),results.CL_local(:,1));
%hold on
dI=diff(I);
a(k)=dI(k-1)/dalpha(k-1);
dalpha(k)=(stallCL-I(k))/a(k);
if abs(dalpha(k))<=0.0001
tdisp('Converged')
return
end
if k>9
tdisp('Not converged.')
return
end
state.alpha=state.alpha+dalpha(k);
end