


{"id":235766,"date":"2022-09-20T08:37:20","date_gmt":"2022-09-20T08:37:20","guid":{"rendered":"\/forum\/forums\/topic\/how-to-set-the-oam-parameters-of-incident-light-in-lumerical-fdtd\/"},"modified":"2022-09-20T08:37:20","modified_gmt":"2022-09-20T08:37:20","slug":"how-to-set-the-oam-parameters-of-incident-light-in-lumerical-fdtd","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-set-the-oam-parameters-of-incident-light-in-lumerical-fdtd\/","title":{"rendered":"How to set the OAM parameters of incident light in Lumerical FDTD?"},"content":{"rendered":"<p>Hi Everyone,<\/p>\n<p>Right now, I want to set up the orbital angular momentum (OAM) modes of the incident light in Lumerical FDTD. Does anyone know how to set the OAM mode of incident light?<\/p>\n<p>It looks like that we can&#8217;t set up this in the software itself, but we might be able to set it up in the lumerical script section. Below is an example of setting some parameters of the incident light, which I got online. It might a hint\/reference to you.<\/p>\n<p>Really hope someone can tackle this issue. Thanks.<\/p>\n<div># scriptfile:usr_custom_source.lsf<\/div>\n<div>&nbsp;<\/div>\n<div># define position vectors<\/div>\n<div>&nbsp;<\/div>\n<div>x=linspace(-10e-6,10e-6,401);<\/div>\n<div>y=linspace(-10e-6,10e-6,401);<\/div>\n<div>z=0; #this is z z-normal source<\/div>\n<div>&nbsp;<\/div>\n<div>X=meshgridx(x,y);<\/div>\n<div>Y=meshgridx(x,y);<\/div>\n<div>&nbsp;<\/div>\n<div>lambda0=0.5e-6;<\/div>\n<div>f=c\/lambda0;<\/div>\n<div>w=2*pi*f;<\/div>\n<div>k=2*pi\/lambda0;<\/div>\n<div>&nbsp;<\/div>\n<div>#calculate k-space field profiles<\/div>\n<div>NA=0.2;<\/div>\n<div>&nbsp;<\/div>\n<div>kx=linspace(-k,k,200);<\/div>\n<div>ky=linspace(-k,k,200);<\/div>\n<div>Kx=meshgridx(kx,ky);<\/div>\n<div>Ky=meshgridy(kx,ky);<\/div>\n<div>phi=atan2(Ky,Kx);<\/div>\n<div>theta=real(acos(sqrt(1-Kx^2\/k^2-Ky^2\/k^2)));<\/div>\n<div>envelope=exp(-0.5*(Kx^2+Ky^2)\/(NA*k)^2);<\/div>\n<div>&nbsp;<\/div>\n<div>Exk=cos(phi)*cos(theta)*envelope;<\/div>\n<div>&nbsp;<\/div>\n<div>Eyk=sin(phi)*cos(theta)*envelope;<\/div>\n<div>&nbsp;<\/div>\n<div>Ezk=sin(theta)*envelope;<\/div>\n<div>&nbsp;<\/div>\n<div>Ex=-1i*czt(Exk,kx,ky,x,y);<\/div>\n<div>&nbsp;<\/div>\n<div>Ey=-1i*czt(Eyk,kx,ky,x,y);<\/div>\n<div>&nbsp;<\/div>\n<div>Ez=-1i*czt(Ezk,kx,ky,x,y);<\/div>\n<div>&nbsp;<\/div>\n<div>Hxk=-sqrt(eps0\/mu0)*sin(phi)*envelope;<\/div>\n<div>Hyk=sqrt(eps0\/mu0)*cos(phi)*envelope;<\/div>\n<div>Hx=-1i*czt(Hxk,kx,ky,x,y);<\/div>\n<div>Hy=-1i*czt(Hyk,kx,ky,x,y);<\/div>\n<div>Hz=0*Ex;<\/div>\n<div>&nbsp;<\/div>\n<div># sacle fild so E^2=1<\/div>\n<div>&nbsp;<\/div>\n<div>E2=abs(Ex)^2+abs(Ey)^2+abs(Ez)^2;<\/div>\n<div>scaleFactor=sqrt(max(E2));<\/div>\n<div>Ex=Ex\/scaleFactor;<\/div>\n<div>Ey=Ey\/scaleFactor;<\/div>\n<div>Ez=Ez\/scaleFactor;<\/div>\n<div>Hx=Hx\/scaleFactor;<\/div>\n<div>Hy=Hy\/scaleFactor;<\/div>\n<div>Hz=Hz\/scaleFactor;<\/div>\n<div>&nbsp;<\/div>\n<div># package field data into the EM fields dataset<\/div>\n<div>&nbsp;<\/div>\n<div>EM=rectilineardataset(&#8220;EM fields&#8221;,x,y,z);<\/div>\n<div>EM.addparameter(&#8220;lambda&#8221;,c\/f,&#8221;f&#8221;,f);<\/div>\n<div>EM.addattribute(&#8220;E&#8221;,Ex,Ey,Ez);<\/div>\n<div>EM.addattribute(&#8220;H&#8221;,Hx,Hy,Hz);<\/div>\n<div>&nbsp;<\/div>\n<div># save dataset to .mat file<\/div>\n<div>matlabsave(&#8220;import_data.mat&#8221;,EM);<\/div>\n","protected":false},"template":"","class_list":["post-235766","topic","type-topic","status-closed","hentry","topic-tag-define-source","topic-tag-LumericalFDTD-1","topic-tag-photonics","topic-tag-source-setting-1"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["263442","2592","39090"],"_bbp_author_ip":["23.220.96.180"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["1248"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["235766"],"_bbp_forum_id":["27833"],"_bbp_engagement":["2592","39090","263442"],"_bbp_voice_count":["3"],"_bbp_reply_count":["3"],"_bbp_last_reply_id":["287750"],"_bbp_last_active_id":["287750"],"_bbp_last_active_time":["2023-06-08 14:29:13"]},"test":"jingyangpeng2022163-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/235766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/235766\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=235766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}