forked from mananth2/2PJIT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtwoPJIT.m
346 lines (302 loc) · 13.3 KB
/
twoPJIT.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
%% %%%%%%%%%%%%%%%%% %%
%%%%% twoPJIT.m %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
% twoPJIT.m is the Main code that will be run by the user in order to
% obtain the dispersion plots and the perturbation quantities. The
% properties of the jet are entered in this script. This script calls
% Cylindrical_3D_Solution.m to descretize the system and solve for the
% eigenvalues. This script also calls perturbation.m in order to evaluate
% the perturbation quantities at the most unstable point.
%% %%%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% List of variables %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Ujet = liquid jet velocity (scalar) (m/s)
% R = Radius of the jet (scalar) (m)
% H = Gas domain boundary (scalar) (m)
% rho_L = density of the liquid jet (scalar) (kg/m^3)
% rho_G = density of the gas (scalar) (kg/m^3)
% nu_L = kinematic viscosity of liquid (scalar) (m^2/s)
% nu_G = kinematic viscosity of gas (scalar) (m^2/s)
% delta_L = liquid shear layer thickness (scalar) (m)
% delta_G = gas shear layer thickness (scalar) (m)
% gamma = surface tension coefficient (scalar) (N/m)
% m_theta = azimuthal wavenumber (0 for axisymmetric and 1 for asymmetric) (scalar)
% omegaArray = set of input non-dimensional frequency (=omega*R/Ujet) where
% omega (rad/s) is the dimensional frequency (vector)
% N_L = number of Gauss-Lobatto (G-L) points in liquid (scalar)
% N_G = number of G-L points in gas (scalar)
% Wavenumber = non-dimensional wavenumber obtained after calling
% Cylindrical_3D_solution (vector)
% GrowthRate = non-dimensional spatial growth rate obtained after calling
% Cylindrcal_3D_solution (vector)
% Cheb_coeff = eigenvector containing the chebyshev coefficients of
% perturbed velocities and pressure (2D-array)
% dominant_Grate = maximum non-dimensional growth rate obtained for the
% given set of input frequencies (scalar)
% dominant_wavenumber = non-dimensional wavenumber corresponding to the
% maximum growth rate (scalar)
% dominant_wavenumber = non-dimensional frequency corresponding to the
% maximum growth rate (scalar)
% ur_pert = perturbation velocity in radial direction obtained after
% calling perturbation.m (vector) (m/s)
% utheta_pert = perturbation velocity in azimuthal direction obtained after
% calling perturbation.m (vector) (m/s)
% uz_pert = perturbation velocity in axial direction after calling
% perturbation.m (vector) (m/s)
% r = radial distance (vector) (m)
% x, y and z = coordinates in 3D (vectors) (m)
% X, Y and Z = coordinates in a 3D mesh (3D-arrays) (m)
% interface = interface location for the given coordinates (scalar) (m)
% radial = radial coordinates obtained from X and Y (scalar) (m)
% alphaLiq = liquid volume fraction values in the 3D-mesh (3D-array)
clear all;
close all;
clc;
set(0,'defaultaxeslinewidth',3)
set(0,'defaultlinelinewidth',3)
set(0,'defaultlinemarkersize',10)
set(0,'defaultaxeslinewidth',3)
set(0,'defaultpatchlinewidth',3)
set(0,'defaultaxesfontsize',24)
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% Properties of the jet %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The properties of the jet are entered here
% The following values are default values which can be changed by the user
Ujet = 200;
R = 45e-6;
H = 5*R;
rho_L = 666.7;
rho_G = 50;
nu_L = 6.947e-7;
nu_G = 3.76e-7;
delta_L = R/5;
delta_G = R;
gamma = 0.02;
disp('Jet properties:');
disp(['Jet velocity, Ujet = ', num2str(Ujet) ' m/s']);
disp(['Jet radius, R = ', num2str(R) ' m']);
disp(['Gas boundary, H = ', num2str(H) ' m']);
disp(['Density of the jet, rho_L = ', num2str(rho_L) ' kg/m^3']);
disp(['Density of the surrounding gas, rho_G = ', num2str(rho_G) ' kg/m^3']);
disp(['Kinematic viscosity of the jet, nu_L = ', num2str(nu_L) ' m^2/s']);
disp(['Kinematic viscosity of the surrounding gas, nu_G = ', num2str(nu_G) ' m^2/s']);
disp(['Liquid shear layer thickness, delta_L = ', num2str(delta_L) ' m']);
disp(['Gas shear layer thickness, delta_G = ', num2str(delta_G) ' m']);
disp(['Surface tension coefficient, gamma = ', num2str(gamma) ' N/m']);
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% Prompt for the mode of instability (Axisymmetric or Asymmetric) %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m_theta = input(['\nEnter the mode of disturbance:'...
'\n 0 - Axisymmetric mode'...
'\n 1 - Asymmetric mode \n']);
if (m_theta==0 || m_theta==1)
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% Prompt for input frequency values %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% omegaArray here is the non-dimensional frequency given by:
% \tilde{omega}_R=omega_R*Ujet/R
% The prompt asks to enter values of the input frequencies which is entered
% as 'linspace' or 'logspace'. A default set 'linspace(0,10,40)' will be
% used. If the peak for the growth rate is observed well before
% end value of omegaArray, the end value of omegaArray can be reduced.
% Otherwise, if the peak for growth rate is not observed for a given
% omegaArray, the end value of omegaArray can be increased.
omegaArray=input(['\nInput an array of non-dimensional frequency values \n'...
'Hit return to use a default value (linspace(0,15,40) will be used as default value) \n'...
'Otherwise enter the values (usually linspace or logspace can be used) \n']);
if isempty(omegaArray)
omegaArray = linspace(0,15,40);
end
if (omegaArray(end)>100)
disp('Warning: the frequency range is large');
end
omegaArray = omegaArray';
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% Prompt for the number of Gauss-Lobatto points %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% In this section, number of Gauss-Lobatto (G-L) points in liquid and gas domains
% will be entered separately. Default number of points in liquid (Nl=40)
% and default number of points in gas (Ng=70) will be used. The code can
% be run for different values of Nl and Ng. It should be ensure that
% sufficient number of G-L points are used such that the dispersion curves
% converge as Nl and Ng are increased.
%% Number of G-L points in liquid
N_L=input(['\nEnter the number of Gauss-Lobatto points in liquid domain: \n'...
'Hit return to use a default value (40 number of G-L points in liquid will be used as default value) \n'...
'Otherwise enter the value \n']);
if isempty(N_L)
N_L = 40;
end
if (N_L>100)
disp('Warning: Number of G-L points in liquid is high');
end
%% Number of G-L points in gas
N_G=input(['\nEnter the number of Gauss-Lobatto points in gas domain: \n'...
'Hit return to use a default value (70 number of G-L points in gas will be used as default value) \n'...
'Otherwise enter the value \n']);
if isempty(N_G)
N_G = 70;
end
if (N_G>150)
disp('Warning: Number of G-L points in gas is high');
end
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% Solving the instability by calling 'Cylindrical_3D_solution' function %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[Wavenumber,GrowthRate,Cheb_coeff]=Cylindrical_3D_solution(Ujet,R,delta_L,delta_G,rho_L,rho_G,nu_L,nu_G,gamma,m_theta,omegaArray,H,N_L,N_G);
[M,I] = max(GrowthRate); % M is the maxmimum growth rate value obtained for the given set of input frequencies. I is the corresponding index.
%% Most unstable gowth rate, wavenumber and the corresponding input frequency for the given set of input frequencies
dominant_Grate = GrowthRate(I,1);
dominant_wavenumber = Wavenumber(I,1);
dominant_frequency = omegaArray(I,1);
%% %%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% Dispersion plots %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Disp = input(['\nSelect whether to plot non-dimensional or dimensional dispersion plot:'...
'\n 0 - Non-dimensional'...
'\n 1 - Dimensional \n']);
if (Disp == 0) % Non-dimensional plots
% Dispersion plot-1 (frequency, \omega_R vs growth rate, -k_I)
f1=figure(1);
movegui(f1,'north')
plot(omegaArray,GrowthRate,'o--')
xlabel('$Frequency, \hspace{0.2cm} \tilde{\omega}_R$','Interpreter','Latex')
ylabel('$Growth \hspace{0.1cm} rate, \hspace{0.2cm} -\tilde{k}_I$','Interpreter','Latex')
grid on
box on
hold on
% Dispersion plot-2 (wavenumber, k_R vs growth rate, -k_I)
f2=figure(2);
movegui(f2,'north')
plot(Wavenumber,GrowthRate,'o--')
xlabel('$Wavenumber, \hspace{0.2cm} \tilde{k}_R$','Interpreter','Latex')
ylabel('$Growth \hspace{0.1cm} rate, \hspace{0.2cm} -\tilde{k}_I$','Interpreter','Latex')
grid on
box on
hold on
elseif (Disp == 1) % Dimensional plots
% Dispersion plot-1 (frequency, \omega_R in rad/s vs growth rate, -k_I in m^{-1})
f1=figure(1);
movegui(f1,'north')
plot(omegaArray*Ujet/R,GrowthRate/R,'o--')
xlabel('$Frequency, \hspace{0.2cm} \omega_R \hspace{0.2cm} (s^{-1})$','Interpreter','Latex')
ylabel('$Growth \hspace{0.1cm} rate, \hspace{0.2cm} -k_I \hspace{0.2cm} (m^{-1})$','Interpreter','Latex')
grid on
box on
hold on
% Dispersion plot-2 (wavenumber, k_R in m^{-1} vs growth rate, -k_I in m^{-1})
f2=figure(2);
movegui(f2,'north')
plot(Wavenumber/R,GrowthRate/R,'o--')
xlabel('$Wavenumber, \hspace{0.2cm} k_R \hspace{0.2cm} (m^{-1})$','Interpreter','Latex')
ylabel('$Growth \hspace{0.1cm} rate, \hspace{0.2cm} -k_I \hspace{0.2cm} (m^{-1})$','Interpreter','Latex')
grid on
box on
hold on
else
disp('Invalid input');
end
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
disp(['Frequency of the most unstable mode=', num2str(dominant_frequency*Ujet/R) ' rad/s']);
disp(['Wavenumber of the most unstable mode=', num2str(dominant_wavenumber/R) ' m^{-1}']);
disp(['Growth rate of the most unstable mode=', num2str(dominant_Grate/R) ' m^{-1}']);
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% Plots for profiles of perturbation quantties for highest growth rate mode %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 'perturbation.m' is called to extract the perturbation quantities. These
% quantities are extracted for the omegaArray value for which the growth
% rate is the highest
[ur_pert,utheta_pert,uz_pert,p_pert,r]=perturbation(Ujet,R,delta_L,delta_G,rho_L,rho_G,nu_L,nu_G,gamma,m_theta,dominant_frequency,H,N_L,N_G);
% perturbation velocity in radial direction
f3=figure(3);
movegui(f3,'north')
plot(r,abs(ur_pert),'o--')
hold on
plot(R*ones(1,10),linspace(min(abs(ur_pert)),max(abs(ur_pert)),10),'k--')
ylabel('$|\hat{u}_r|, \hspace{0.2cm} (ms^{-1})$','Interpreter','Latex')
xlabel('$r \hspace{0.2cm} (m)$','Interpreter','Latex')
leg1 = legend(['$|\hat{u}_r|$'],['Unperturbed interface' char(10) ' location, $R$']);
set(leg1,'Interpreter','latex');
grid on
box on
% perturbation velocity in azimuthal direction
f4=figure(4);
movegui(f4,'north')
plot(r,abs(utheta_pert),'o--')
hold on
plot(R*ones(1,10),linspace(min(abs(utheta_pert)),max(abs(utheta_pert)),10),'k--')
ylabel('$|\hat{u}_{\theta}|, \hspace{0.2cm} (ms^{-1})$','Interpreter','Latex')
xlabel('$r \hspace{0.2cm} (m)$','Interpreter','Latex')
leg1 = legend(['$|\hat{u}_{\theta}|$'],['Unperturbed interface' char(10) ' location, $R$']);
set(leg1,'Interpreter','latex');
grid on
box on
% perturbation velocity in axial direction
f5=figure(5);
movegui(f5,'north')
plot(r,abs(uz_pert),'o--')
hold on
plot(R*ones(1,10),linspace(min(abs(uz_pert)),max(abs(uz_pert)),10),'k--')
ylabel('$|\hat{u}_z|, \hspace{0.2cm} (ms^{-1})$','Interpreter','Latex')
xlabel('$r \hspace{0.2cm} (m)$','Interpreter','Latex')
leg1 = legend(['$|\hat{u}_z|$'],['Unperturbed interface' char(10) ' location, $R$']);
set(leg1,'Interpreter','latex');
grid on
box on
% perturbation pressure
f6=figure(6);
movegui(f6,'north')
plot(r,abs(p_pert),'o--')
hold on
plot(R*ones(1,10),linspace(min(abs(p_pert)),max(abs(p_pert)),10),'k--')
ylabel('$|\hat{p}|, \hspace{0.2cm} (Nm^{-2})$','Interpreter','Latex')
xlabel('$r \hspace{0.2cm} (m)$','Interpreter','Latex')
leg1 = legend(['$|\hat{p}|$'],['Unperturbed interface' char(10) ' location, $R$']);
set(leg1,'Interpreter','latex');
grid on
box on
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
%%%%% Visual representation of the dominant mode %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This section is to plot the cylindrical jet with the dominant mode of
% perturbation obtained for the given set of input frequencies.
x=linspace(-2*R,2*R,100);
y=linspace(-2*R,2*R,100);
z=linspace(0,20*R,200);
[Z,X,Y]=meshgrid(z,x,y);
for i=1:size(Z,1)
for j=1:size(Z,2)
for k=1:size(Z,3)
if (X(i,j,k)>=0)
interface(i,j,k)=R+0.05*R*exp(dominant_Grate*Z(i,j,k)/R)*cos(dominant_wavenumber*Z(i,j,k)/R+m_theta*atan((Y(i,j,k)/X(i,j,k))));
else
interface(i,j,k)=R+0.05*R*exp(dominant_Grate*Z(i,j,k)/R)*cos(dominant_wavenumber*Z(i,j,k)/R+m_theta*(atan((Y(i,j,k)/X(i,j,k)))+pi));
end
radial(i,j,k)=sqrt((X(i,j,k))^2+(Y(i,j,k))^2);
if((radial(i,j,k))>(interface(i,j,k)))
alphaLiq(i,j,k)=0;
else
alphaLiq(i,j,k)=1;
end
end
end
end
alphaLiq_smooth = smooth3(alphaLiq);
figure(7)
p = patch(isosurface(Z,X,Y,alphaLiq_smooth,0.5));
isonormals(Z,X,Y,alphaLiq_smooth,p)
p.FaceColor = '[0 0.5 1]';
p.EdgeColor = 'none';
daspect([1 1 1])
view(37.5,30);
axis tight
camlight
lighting gouraud
xlabel('$z$','Interpreter','Latex')
ylabel('$x$','Interpreter','Latex')
zlabel('$y$','Interpreter','Latex')
else
disp('Invalid input');
end