I am studying a flow going through an orifice.
I am aimed at overlapping the plots for the speed distribution over the vertical width profile (which is 0.015 m long; highlighted in red) for two downstream, horizontal distances [w.r.t. the orifice]: 0.01 m and 0.03 m.
The result should look as follows (the highest peak corresponds to 0.01m width profile)
Let me create two tables, first related to 0.01m data and second to 0.03 m. For the sake of simplicity I only include three row data. The columns labeled - contain irrelevant data for this particular problem.
Let's draw our attention to how to code this in MATLAB. The algorithm I have in mind is:
0) Optimize the given table: eliminate first and last rows (the velocity there is zero due to no-slip condition on the walls)
1) Read the velocity data from the csv table and compute the speed ##U = \sqrt{U_0^2 + U_1^2 + U_2^2}## for each data row.
2) Store the speed and width values in variables.
3) Repeat 2) and 3) for the other csv file.
4) Ready to plot.
I managed to write a code that works for the three-rows-of-data tables above
Ai = readtable("sampleData10mm.csv");
Bi = readtable("sampleData30mm.csv");
Ur1 = sqrt(fComr1^2 + sComr1^2 + tComr1^2);
Ur2 = sqrt(fComr2^2 + sComr2^2 + tComr2^2);
Ur3 = sqrt(fComr3^2 + sComr3^2 + tComr3^2);
width = [0;A{1:1,"Points_2"}+0.0075;A{2:2,"Points_2"}+0.0075;A{3:3,"Points_2"}+0.0075];
fComr1_30mm = B{1:1,"U_0"};
sComr1_30mm = B{1:1,"U_1"};
tComr1_30mm = B{1:1,"U_2"};
fComr2_30mm = B{2:2,"U_0"};
sComr2_30mm = B{2:2,"U_1"};
tComr2_30mm = B{2:2,"U_2"};
fComr3_30mm = B{3:3,"U_0"};
sComr3_30mm = B{3:3,"U_1"};
tComr3_30mm = B{3:3,"U_2"};
Ur1_30mm = sqrt(fComr1_30mm^2 + sComr1_30mm^2 + tComr1_30mm^2);
Ur2_30mm = sqrt(fComr2_30mm^2 + sComr2_30mm^2 + tComr2_30mm^2);
Ur3_30mm = sqrt(fComr3_30mm^2 + sComr3_30mm^2 + tComr3_30mm^2);
speed_30mm = [0;Ur1_30mm;Ur2_30mm;Ur3_30mm];
width_30mm = [0;B{1:1,"Points_2"}+0.0075;B{2:2,"Points_2"}+0.0075;B{3:3,"Points_2"}+0.0075];
plot(width,width_30mm,speed,speed_30mm)
legend({'0.01 m', '0.03 m'},'Location','northwest')
ylabel('U magnitude [m/s]')
The issue I have is that I do not see how to write a code that does it for the 1000 rows. I guess there has to be a way of automatizing the whole process...
Thank you in advance! :)