-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOSCILOS_opt.m
109 lines (93 loc) · 3.51 KB
/
OSCILOS_opt.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% OSCILOS_opt v1.0
%
% This program is the optimising version of OSCILOS_lite - the program
% optimises the shape of a thermoacoustically unstable combustor using a
% genetic algorithm (GA) and determines an improved geometry for further
% analysis.
%
% Please update the input files before running this script. More
% information about the required inputs is included in the User Guide.
%
% Last update : 25/05/2021
%
% Authors: H. Jones, R. Gaudron and previous contributors (see full list on
% the OSCILOS website).
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% INITIALISATION
%
% This subroutine loads the 'Init.txt' file and initialises OSCILOS_opt
addpath('./SubFunctions')
run Init_subfc
%% Optimisation
%
% This subroutine initiates the shape optimisation in OSCILOS_opt
if RUN_OPTIM
run Optimisation_subfc
end
%% GEOMETRY
%
% This subroutine loads the geometry from the file 'Geometry.txt', plots it
% and saves it in the output folder.
run Geometry_subfc
%% MEAN FLOW
%
% This subroutine loads the mean flow parameters at the inlet of the
% geometry from the file 'Mean_flow.txt'. The mean conservation equations
% are then solved and the mean flow variables are obtained throughout the
% geometry. The mean velocity and mean temperature across the geometry are
% then plotted and saved in the output folder.
run Mean_flow_subfc
%% FLAME MODEL
%
% This subroutine loads the flame model from the file 'Flame.txt'. The gain
% and phase of the corresponding Flame Model are then plotted and saved in
% the output folder. If heat perturbations are not present inside the
% domain, this step has no impact on the final result.
run Flame_subfc
%% BOUNDARY CONDITIONS
%
% This subroutine loads the acoustic boundary conditions at the inlet and
% outlet of the geometry from files 'Inlet.txt' and 'Outlet.txt'
% respectively. The acoustic reflection coefficient at the inlet and outlet
% are then plotted and saved in the output folder.
run BC_subfc
%% FREQUENCY-DOMAIN SOLVER
%
% This subroutine loads the scan range and number of initialisations - fed
% to the frequency-domain solver - from the file 'Scan_range.txt'. The
% solver then finds the eigenvalues of the system, and the corresponding
% eigenmodes. The eigenvalues are saved as an output file called
% 'Eigenvalues.txt'. A map of the eigenvalues in the range of interest is
% then plotted and saved in the output folder. A number of eigenmodes,
% represented as the modulus of the acoustic pressure and velocity, are
% also plotted and saved in the output folder.
run Solver_subfc
%% MESSAGE BOX
time=toc;
time_final=num2str(sprintf('%.2f',time));
if RUN_OPTIM
if data_num(:,2) <= 0
text=['Optimisation completed in ',time_final,' seconds'];
else
text=['Optimisation routine completed in ',time_final,' seconds without finding a stable geometry.'];
end
else
text=['Calculation completed in ',time_final,' seconds'];
end
cltext = " Close Plots ";
f = questdlg(text,'OSCILOS_opt','OK', cltext, 'OK');
if f==cltext
close all
end
if RUN_OPTIM
if data_num(:,2) <= 0
fprintf("\n Optimisation completed in %s seconds.\n",time_final)
else
fprintf("\n Optimisation routine completed in %s seconds without finding a stable geometry.\n",time_final)
end
else
fprintf("\n Calculation completed in %s seconds.\n",time_final)
end