Calculations/MOT-Simulator/+Plotter/plotAngularDistributionForDifferentBeta.m

74 lines
2.2 KiB
Mathematica
Raw Normal View History

2024-06-18 19:01:35 +02:00
function plotAngularDistributionForDifferentBeta(obj, Beta)
f_h = Helper.getFigureByTag('AngDistForBeta');
set(groot,'CurrentFigure',f_h);
a_h = get(f_h, 'CurrentAxes');
if ~isempty(get(a_h, 'Children'))
clf(f_h);
end
f_h.Name = 'Beta dependence';
f_h.Units = 'pixels';
set(0,'units','pixels');
screensize = get(0,'ScreenSize');
f_h.Position = [[screensize(3)/3.5 screensize(4)/3.5] 750 600];
hold on
SimulationBeta = obj.Beta;
if ~ismember(SimulationBeta, Beta)
theta = linspace(0.0001,pi/2,1000);
J = zeros(1,length(theta));
for j=1:length(theta)
J(j) = obj.angularDistributionFunction(theta(j));
end
Norm = 0;
for j=1:length(J)
Norm = Norm+J(j)*sin(theta(j))*(theta(2)-theta(1));
end
J = J ./Norm*2;
J = J ./max(J);
plot([-flip(theta),theta], [flip(J),J],'DisplayName', ['\beta = ',num2str(SimulationBeta, '%.3f')], 'Linewidth',1.5)
end
for i=1:length(Beta)
theta = linspace(0.0001,pi/2,1000);
J = zeros(1,length(theta));
obj.NozzleLength = (2 * obj.NozzleRadius) / Beta(i);
for j=1:length(theta)
J(j) = obj.angularDistributionFunction(theta(j));
end
Norm = 0;
for j=1:length(J)
Norm = Norm+J(j)*sin(theta(j))*(theta(2)-theta(1));
end
J = J ./Norm*2;
J = J ./max(J);
if Beta(i) ~= SimulationBeta
plot([-flip(theta),theta], [flip(J),J],'DisplayName',['\beta = ',num2str(Beta(i))], 'LineStyle', '--', 'Linewidth',1.5)
else
plot([-flip(theta),theta], [flip(J),J],'DisplayName',['\beta = ',num2str(Beta(i))], 'Linewidth',1.5)
end
end
hold off
leg = legend;
hXLabel = xlabel('\theta (rad)');
hYLabel = ylabel('J(\theta)');
hTitle = sgtitle('Angular Distribution (Transition Flow)');
set([hXLabel, hYLabel, leg] , ...
'FontSize' , 14 );
set( hTitle , ...
'FontSize' , 18 );
grid on
Helper.bringFiguresWithTagInForeground();
end