paraxial_wave.xmds
来自「XMDS is a code generator that integrates」· XMDS 代码 · 共 120 行
XMDS
120 行
<?xml version="1.0"?><simulation> <!-- $Id: paraxial_wave.xmds,v 1.3 2004/06/05 05:40:08 paultcochrane Exp $ --><!-- Copyright (C) 2000-2004 --><!-- --><!-- Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane --><!-- --><!-- This file is part of xmds. --><!-- --><!-- This program is free software; you can redistribute it and/or --><!-- modify it under the terms of the GNU General Public License --><!-- as published by the Free Software Foundation; either version 2 --><!-- of the License, or (at your option) any later version. --><!-- --><!-- This program is distributed in the hope that it will be useful, --><!-- but WITHOUT ANY WARRANTY; without even the implied warranty of --><!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --><!-- GNU General Public License for more details. --><!-- --><!-- You should have received a copy of the GNU General Public License --><!-- along with this program; if not, write to the Free Software --><!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, --><!-- MA 02111-1307, USA. --> <name> paraxial_wave </name> <!-- the name of the simulation --> <author> Paul Cochrane </author> <!-- the author of the simulation --> <description> Solves the paraxial wave equation for various input fields using one transverse dimension. This is an example of double slit interference. Script adapted from equation in "Fundamentals of Photonics", B.E.A. Saleh and M.C. Teich (1991) </description> <!-- Global system parameters and functionality --> <prop_dim> z </prop_dim> <!-- name of main propagation dim --> <error_check> no </error_check> <!-- defaults to yes --> <use_wisdom> yes </use_wisdom> <!-- defaults to no --> <benchmark> yes </benchmark> <!-- defaults to no --> <use_prefs> yes </use_prefs> <!-- defaults to yes --> <!-- Global variables for the simulation --> <globals> <![CDATA[ const double lambda = 628e-9; // red He-Ne laser const double k = 2*M_PI/lambda; // double slit const double d = 0.5e-3; // slit separation const double w = 0.1e-3; // slit width // single slit //const double d = 0.0; //const double w = 0.5e-3; // slit width ]]> </globals> <!-- Field to be integrated over --> <field> <name> main </name> <dimensions> x </dimensions> <!-- transverse dims --> <lattice> 10000 </lattice> <!-- no. of points for each dim --> <domains> (-5e-2,5e-2) </domains> <!-- domain of each dimension --> <samples> 1 </samples> <!-- sample 1st point of dim? --> <vector> <name> main </name> <type> complex </type> <!-- data type of vector --> <components> A </components> <!-- names of components --> <fourier_space> no </fourier_space> <!-- defined in k-space? --> <![CDATA[ A = fabs(x) > d ? ((fabs(x)-d) > w ? 0.0 : 1.0) : 0.0; // double slit //A = fabs(x) < w ? 1.0 : 0.0; // single slit ]]> </vector> </field> <!-- The sequence of integrations to perform --> <sequence> <integrate> <algorithm> RK4IP </algorithm> <!-- RK4EX, RK4IP, SIEX, SIIP --> <interval> 1.0 </interval> <!-- how far in main dim? --> <lattice> 1 </lattice> <!-- no. points in main dim --> <samples> 1 </samples> <!-- no. pts in output moment group --> <k_operators> <constant> yes </constant> <!-- yes/no --> <operator_names> L </operator_names> <![CDATA[ L = rcomplex(0.0,kx*kx/(k*2.0)); ]]> </k_operators> <vectors> main </vectors> <!-- vector names --> <![CDATA[ dA_dz = L[A]; ]]> </integrate> </sequence> <!-- The output to generate --> <output format="ascii"> <filename>paraxial_wave.xsil</filename> <group> <sampling> <fourier_space> no </fourier_space> <!-- sample in k-space? --> <lattice> 10000 </lattice> <!-- no. points to sample --> <moments> A2 </moments> <!-- names of moments --> <![CDATA[ A2 = mod2(A); // find the modulus squared ]]> </sampling> </group> </output> </simulation>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?