-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruninverse.m
112 lines (76 loc) · 1.75 KB
/
runinverse.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
clear all
format compact
close all
% Freestream velocity
W = 1.0;
Sref = 1.0;
xlim = [-0.5 2];
rlim = [0 1.5];
nsurvey = 51;
nsl = 23;
drawplots = false;
ntstep = 1;
% Default to no kutta condition, turn on inside runcase setup.
kutta = false;
jtelow = -1;
jteup = -1;
% Construct example body
ncirc = 10*10;
nstraight = 23*2;
% ncirc = 5;
% nstraight = 11;
rad = 0.16;
len1 = 0.61;
len2 = rad / tan(15*pi/180);
xnose = 0.0;
% [xep, rep, rad, Vex] = setupbody( ncirc, nstraight, rad, len1, len2, xnose );
[xep, rep, rad, Vex] = setupsphere( ncirc, 1.0, 1.0 );
rep(1) = 0;
rep(end) = 0;
name = 'Body';
names{1} = name;
xepts{1} = xep;
repts{1} = rep;
kuttas{1} = kutta;
props{1} = false;
deltaCP{1} = 0.0;
jtels{1} = jtelow;
jteus{1} = jteup;
rads{1}=rad;
Vexs{1}=Vex;
% Execute script
run('bor')
xsol = xcp;
rsol = rcp;
gammasol = gammas{1};
clear gammas;
ncirc = length( xepts{1} );
% Construct an ellipse as starting point
rada = max( xepts{1} ) * 0.5;
radb = max( repts{1} );
radb = rada * 0.1;
xcen = rada;
%[xep, rep, ~, ~] = setupbody( ncirc, nstraight, 0.32, 0.3, 0.5, xnose );
%[xep, rep, ~, ~] = setupellipsoid( ncirc, rada, radb, xcen );
% reverse engineer matching ellipsoid points from body of revolution
% xep = rada * cos( thetacirc ) + xcen;
thetacirc = acos((xep - xcen)./rada);
rep = radb * sin( thetacirc );
rad = inf( 1, ncirc - 1 );
xcen = ( xep(2:end) + xep(1:end-1) ) * 0.5;
name = 'Designed';
%gammatgt{1} = interp1( xsol{1}./max(xsol{1}), gammasol, xcen./max(xcen), 'linear', 'extrap' );
gammatgt{1} = gammasol;
drawplots = true;
names{1} = name;
xepts{1} = xep;
repts{1} = rep;
kuttas{1} = kutta;
props{1} = false;
deltaCP{1} = 0.0;
jtels{1} = jtelow;
jteus{1} = jteup;
rads{1}=rad;
Vexs{1}=gammatgt{1};
% Execute script
run('bor_inv')