{"id":163,"date":"2025-07-29T15:08:35","date_gmt":"2025-07-29T13:08:35","guid":{"rendered":"https:\/\/logbooks.ifosim.org\/oscar\/?p=163"},"modified":"2025-07-29T15:08:35","modified_gmt":"2025-07-29T13:08:35","slug":"simulating-a-mach-zehnder-interferometer","status":"publish","type":"post","link":"https:\/\/logbooks.ifosim.org\/oscar\/2025\/07\/29\/simulating-a-mach-zehnder-interferometer\/","title":{"rendered":"Simulating a Mach-Zehnder interferometer"},"content":{"rendered":"\n<p>For the first time, I tried to simulate a Mach-Zhender. It should work in theory since we have all the elementary bricks (mirror, propagation) but the devil is in the details. The implementation was rather simple, the default phase is such that all the power is transmitted toward the node called E_CCD (top figure):<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"814\" src=\"https:\/\/logbooks.ifosim.org\/oscar\/wp-content\/uploads\/sites\/6\/2025\/07\/Sketch-1024x814.png\" alt=\"\" class=\"wp-image-164\" style=\"width:426px;height:auto\" srcset=\"https:\/\/logbooks.ifosim.org\/oscar\/wp-content\/uploads\/sites\/6\/2025\/07\/Sketch-1024x814.png 1024w, https:\/\/logbooks.ifosim.org\/oscar\/wp-content\/uploads\/sites\/6\/2025\/07\/Sketch-300x239.png 300w, https:\/\/logbooks.ifosim.org\/oscar\/wp-content\/uploads\/sites\/6\/2025\/07\/Sketch-768x611.png 768w, https:\/\/logbooks.ifosim.org\/oscar\/wp-content\/uploads\/sites\/6\/2025\/07\/Sketch-1536x1221.png 1536w, https:\/\/logbooks.ifosim.org\/oscar\/wp-content\/uploads\/sites\/6\/2025\/07\/Sketch.png 1581w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p>More interestingly is to misalign one of the mirror, for example M2 (bottom figure) and see one advantage of FFT codes with the possibility to ray-trace the beams. Of course, once the interferometer is misaligned, the interferences disappear and both outputs are equal and correspond to half the input power. Here a small animation showing that:<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"766\" style=\"aspect-ratio: 546 \/ 766;\" width=\"546\" controls muted src=\"https:\/\/logbooks.ifosim.org\/oscar\/wp-content\/uploads\/sites\/6\/2025\/07\/Mz_Tilt2-1.mp4\"><\/video><\/figure>\n\n\n\n<p>(if someone knows how to resize the video displayed in the page, I am interested)<\/p>\n\n\n\n<p>The code to produce the above results is shown here<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>clearvars; close all;\naddpath(genpath('Classes'));\n\ndisp('---------------------------------------------------------------------------')\ndisp('                  OSCAR V3.30                                   ')\ndisp('  ')\n\n\n% Define the grid for the simulation: 256 X 256, 40 cm X 40 cm\nG1 = Grid(512,0.02);\n\nE_input = E_Field(G1,'w0',2E-3);\n\n% Let's say, define the components, first BS\n\nBS1_HR = Interface(G1,'RoC',inf,'CA',0.045,'T',0.5);\nBS1_AR = Interface(G1,'RoC',inf,'CA',0.045,'T',1);\nBS1_M = Mirror(BS1_HR,BS1_AR,0.06);\n\nBS2_HR = Interface(G1,'RoC',inf,'CA',0.045,'T',0.5);\nBS2_AR = Interface(G1,'RoC',inf,'CA',0.045,'T',1);\nBS2_M = Mirror(BS1_HR,BS1_AR,0.06);\n\n% Then the 2 mirrors\nM1 = Interface(G1,'RoC',inf,'CA',0.045,'T',5E-6);\nM2 = Interface(G1,'RoC',inf,'CA',0.045,'T',5E-6);\n\n%% tilt one mirror\n\n\n\nTilt_vec = linspace(0,4E-3,51);   % Tilt range in rad\nP_trans = zeros(1,length(Tilt_vec));\n\nfor ii = 1:length(Tilt_vec)\n    \n    M2 = Interface(G1,'RoC',inf,'CA',0.045,'T',5E-6);\n    M2 = Add_Tilt(M2,Tilt_vec(ii));\n    \n    E_input = E_Field(G1,'w0',1E-3);\n\n    \n    E1 = Propagate_E(E_input,0.2);\n    \n    % Calculated the transmited and reflected beams from BS1\n    &#091;E1_t,E1_r] = Transmit_Reflect_Mirror(E1,BS1_M,'HR');\n    \n    % propagate to the mirrors\n    E2 = Propagate_E(E1_t,0.432); % toward M1\n    E3 = Propagate_E(E1_r,0.254); % toward M2\n    \n    % reflect on the mirrors\n    &#091;~,E2r] = Transmit_Reflect_Interface(E2,M1);\n    &#091;~,E3r] = Transmit_Reflect_Interface(E3,M2);\n    \n    % propagate to BS2\n    E4 = Propagate_E(E2r,0.254); % from M1\n    E5 = Propagate_E(E3r,0.432); % from M2\n        \n    % Calculated the transmited and reflected beams from BS2 from the 2 beams\n    &#091;E4_t,E4_r] = Transmit_Reflect_Mirror(E4,BS2_M,'HR');\n    &#091;E5_t,E5_r] = Transmit_Reflect_Mirror(E5,BS2_M,'AR');\n    \n    E_CCD = E4_r + E5_t;\n    E_dump = E4_t + E5_r;\n    \n    P_trans(ii) = Calculate_Power(E_CCD);\n    \n    E_Plot(E_CCD);\n    title(&#091;'Iteration: ' num2str(ii)])\n    pause(0.02)\nend\n\nplot(Tilt_vec,P_trans)\nbox on; grid on\nxlabel('Tilt angle &#091;rad]')\nylabel('Transmitted power &#091;W]')\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>For the first time, I tried to simulate a Mach-Zhender. It should work in theory since we have all the elementary bricks (mirror, propagation) but the devil is in the details. The implementation was rather simple, the default phase is such that all the power is transmitted toward the node called E_CCD (top figure): More [&hellip;]<\/p>\n","protected":false},"author":67,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ssl_alp_hide_revisions":false,"footnotes":"","ssl_alp_hide_crossreferences_to":false},"categories":[87],"tags":[19],"ssl-alp-inventory-item":[],"ssl-alp-coauthor":[12],"class_list":["post-163","post","type-post","status-publish","format-standard","hentry","category-for-fun","tag-howto","ssl-alp-unread-flag-ssl-alp-unread-flag-aaron-jonesligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-agreennikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-alexander-adamligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-andreas-freiseligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-anna-greenligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-antoine-amyligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-bas-swinkelsligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-camilla-derossiligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-catalina-ana-miritesculigo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-daniela-pascucciligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-davidgnikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-eleonora-capocasaligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-enzo-tapialigo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-enzotnikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-hiro-yamamotoligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-jacques-dingligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-jonathan-perryligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-jperrynikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-kenny-mocligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-kevin-kunsligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-maddalena-mantovaniligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-michele-valentiniligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-mischa-salleligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-mkolknikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-monica-seglar-arroyoligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-msalle","ssl-alp-unread-flag-ssl-alp-unread-flag-mvalentinikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-nikhil-mukundligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-p70081609unimaas-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-paul-stevensligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-paulvalentin-hapkeligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-riccardo-maggioreligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-sebastslnikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-stopic","ssl-alp-unread-flag-ssl-alp-unread-flag-tschoonnikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-vaishali-adyaligo-org","ssl-alp-unread-flag-ssl-alp-unread-flag-yuefangnikhef-nl","ssl-alp-unread-flag-ssl-alp-unread-flag-yuhang-zhao1ligo-org"],"_links":{"self":[{"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/posts\/163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/comments?post=163"}],"version-history":[{"count":3,"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/posts\/163\/revisions"}],"predecessor-version":[{"id":171,"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/posts\/163\/revisions\/171"}],"wp:attachment":[{"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/media?parent=163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/categories?post=163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/tags?post=163"},{"taxonomy":"ssl-alp-inventory-item","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/ssl-alp-inventory-item?post=163"},{"taxonomy":"ssl-alp-coauthor","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/oscar\/wp-json\/wp\/v2\/ssl-alp-coauthor?post=163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}