|
1 | | -%% \file Main_compare.m |
2 | | -% \brief Main function for SU2-Nastran postprocessing |
3 | | -% \authors Nicola Fonzi, Vittorio Cavalieri |
4 | | -% \version 7.0.8 "Blackbird" |
5 | | -% |
6 | | -% SU2 Project Website: https://su2code.github.io |
7 | | -% |
8 | | -% The SU2 Project is maintained by the SU2 Foundation |
9 | | -% (http://su2foundation.org) |
10 | | -% |
11 | | -% Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) |
12 | | -% |
13 | | -% SU2 is free software; you can redistribute it and/or |
14 | | -% modify it under the terms of the GNU Lesser General Public |
15 | | -% License as published by the Free Software Foundation; either |
16 | | -% version 2.1 of the License, or (at your option) any later version. |
17 | | -% |
18 | | -% SU2 is distributed in the hope that it will be useful, |
19 | | -% but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | | -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21 | | -% Lesser General Public License for more details. |
22 | | -% |
23 | | -% You should have received a copy of the GNU Lesser General Public |
24 | | -% License along with SU2. If not, see <http://www.gnu.org/licenses/>. |
25 | | - |
26 | | -clear all; close all; clc |
27 | | - |
28 | | -ObtainTheoResults |
29 | | - |
30 | | -ObtainSU2Results |
31 | | - |
32 | | -save_flag = true; |
33 | | - |
34 | | -U_su2 = [su2.U]; |
35 | | -U_theo = [theo.U]; |
36 | | -if any(U_su2 ~= U_theo) |
37 | | - error('Velocities not coincident'); |
38 | | -end |
39 | | - |
40 | | -Folders = {'Ma01','Ma02','Ma03','Ma0357','Ma0364'}; |
41 | | -Ma = [0.1,0.2,0.3,0.357,0.364]; |
42 | | - |
43 | | -for i = 1:length(U_su2) |
44 | | - |
45 | | -h = figure; |
46 | | -title(strcat('Mach = ',num2str(Ma(i)))); |
47 | | -hold on; |
48 | | -plot(theo(i).t,theo(i).alpha*180/pi,'LineWidth',1); |
49 | | -plot(su2(i).t,su2(i).alpha*180/pi,'r','LineWidth',1); |
50 | | -xlim([0,4]); |
51 | | -xlabel('Time [s]'); |
52 | | -ylabel('\alpha [deg]'); |
53 | | -legend('Theodorsen','SU2'); |
54 | | -if save_flag |
55 | | - saveas(h,strcat('alpha_Ma=',num2str(Ma(i)),'.png')); |
56 | | -end |
57 | | - |
58 | | -h = figure; |
59 | | -title(strcat('Mach = ',num2str(Ma(i)))); |
60 | | -hold on; |
61 | | -plot(theo(i).t,theo(i).h,'LineWidth',1); |
62 | | -xlim([0,4]); |
63 | | -xlabel('Time [s]'); |
64 | | -ylabel('Plunge [m]'); |
65 | | -plot(su2(i).t,su2(i).h,'r','LineWidth',1); |
66 | | -legend('Theodorsen','SU2'); |
67 | | -if save_flag |
68 | | - saveas(h,strcat('h_Ma=',num2str(Ma(i)),'.png')); |
69 | | -end |
70 | | - |
71 | | -h = figure(1000); |
72 | | -legend('Pitch mode Theodorsen','Plunge mode Theodorsen','Pitch mode SU2','Plunge mode SU2','Location','southeast'); |
73 | | -ylim([0 1.2]) |
74 | | -xlabel('Mach number'); |
75 | | -ylabel('\omega/\omega_{\alpha}'); |
76 | | -if save_flag |
77 | | - saveas(h,'Freq.png'); |
78 | | -end |
79 | | -end |
80 | | - |
| 1 | +% \file Main_compare.m |
| 2 | +% \brief Main function for SU2-Nastran postprocessing |
| 3 | +% \authors Nicola Fonzi, Vittorio Cavalieri |
| 4 | +% \version 7.0.8 "Blackbird" |
| 5 | +% |
| 6 | +% SU2 Project Website: https://su2code.github.io |
| 7 | +% |
| 8 | +% The SU2 Project is maintained by the SU2 Foundation |
| 9 | +% (http://su2foundation.org) |
| 10 | +% |
| 11 | +% Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md) |
| 12 | +% |
| 13 | +% SU2 is free software; you can redistribute it and/or |
| 14 | +% modify it under the terms of the GNU Lesser General Public |
| 15 | +% License as published by the Free Software Foundation; either |
| 16 | +% version 2.1 of the License, or (at your option) any later version. |
| 17 | +% |
| 18 | +% SU2 is distributed in the hope that it will be useful, |
| 19 | +% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | +% Lesser General Public License for more details. |
| 22 | +% |
| 23 | +% You should have received a copy of the GNU Lesser General Public |
| 24 | +% License along with SU2. If not, see <http://www.gnu.org/licenses/>. |
| 25 | + |
| 26 | +clear all; close all; clc |
| 27 | + |
| 28 | +% This script uses Theodorsen theory to compute the analytic response of |
| 29 | +% the profile as a function of the Mach number |
| 30 | +ObtainTheoResults |
| 31 | + |
| 32 | +% This script simply postprocess the results from SU2 |
| 33 | +ObtainSU2Results |
| 34 | + |
| 35 | +save_flag = true; |
| 36 | + |
| 37 | +U_su2 = [su2.U]; |
| 38 | +U_theo = [theo.U]; |
| 39 | +if any(U_su2 ~= U_theo) |
| 40 | + error('Velocities not coincident'); |
| 41 | +end |
| 42 | + |
| 43 | +Folders = {'Ma01','Ma02','Ma03','Ma0357','Ma0364'}; |
| 44 | +Ma = [0.1,0.2,0.3,0.357,0.364]; |
| 45 | + |
| 46 | +for i = 1:length(U_su2) |
| 47 | + |
| 48 | +h = figure; |
| 49 | +title(strcat('Mach = ',num2str(Ma(i)))); |
| 50 | +hold on; |
| 51 | +plot(theo(i).t,theo(i).alpha*180/pi,'LineWidth',1); |
| 52 | +plot(su2(i).t,su2(i).alpha*180/pi,'r','LineWidth',1); |
| 53 | +xlim([0,4]); |
| 54 | +xlabel('Time [s]'); |
| 55 | +ylabel('\alpha [deg]'); |
| 56 | +legend('Theodorsen','SU2'); |
| 57 | +if save_flag |
| 58 | + saveas(h,strcat('alpha_Ma=',num2str(Ma(i)),'.png')); |
| 59 | +end |
| 60 | + |
| 61 | +h = figure; |
| 62 | +title(strcat('Mach = ',num2str(Ma(i)))); |
| 63 | +hold on; |
| 64 | +plot(theo(i).t,theo(i).h,'LineWidth',1); |
| 65 | +xlim([0,4]); |
| 66 | +xlabel('Time [s]'); |
| 67 | +ylabel('Plunge [m]'); |
| 68 | +plot(su2(i).t,su2(i).h,'r','LineWidth',1); |
| 69 | +legend('Theodorsen','SU2'); |
| 70 | +if save_flag |
| 71 | + saveas(h,strcat('h_Ma=',num2str(Ma(i)),'.png')); |
| 72 | +end |
| 73 | + |
| 74 | +h = figure(1000); |
| 75 | +legend('Pitch mode Theodorsen','Plunge mode Theodorsen','Pitch mode SU2','Plunge mode SU2','Location','southeast'); |
| 76 | +ylim([0 1.2]) |
| 77 | +xlabel('Mach number'); |
| 78 | +ylabel('\omega/\omega_{\alpha}'); |
| 79 | +if save_flag |
| 80 | + saveas(h,'Freq.png'); |
| 81 | +end |
| 82 | +end |
| 83 | + |
0 commit comments