nlse.xmds
来自「XMDS is a code generator that integrates」· XMDS 代码 · 共 129 行
XMDS
129 行
<?xml version="1.0"?><!--Example simulation: Non-Linear Schroedinger Equation--><!-- $Id: nlse.xmds,v 1.11 2004/07/14 06:37:05 joehope 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. --><simulation> <!-- Global system parameters and functionality --> <name>nlse</name> <author>Unknown Author</author> <description> Example simulation of the nonlinear Schroedinger equation </description> <prop_dim>z</prop_dim> <error_check>yes</error_check> <stochastic>no</stochastic> <!-- Command line arguments --> <argv> <arg> <name>energy</name> <type>double</type> <default_value>4.0</default_value> </arg> </argv> <!-- Global variables for the simulation --> <globals> <![CDATA[ // const double energy = 4.0; // is now an argument const double vel = 0.0; const double hwhm = 1.0; ]]> </globals> <!-- Field to be integrated over --> <field> <name>main</name> <dimensions> t </dimensions> <lattice> 100 </lattice> <domains> (-5,5) </domains> <samples>1</samples> <vector> <name>main</name> <type>complex</type> <components>phi</components> <fourier_space>no</fourier_space> <![CDATA[ const double w0 = hwhm*sqrt(2/log(2.0)); const double amp = sqrt(energy/w0/sqrt(M_PI/2)); phi = pcomplex(amp*exp(-t*t/w0/w0),vel*t); ]]> </vector> <vector> <name>vc1</name> <type>double</type> <components>damping</components> <fourier_space>no</fourier_space> <![CDATA[ damping=1.0*(1-exp(-pow(t*t/4/4,10))); ]]> </vector> </field> <!-- The sequence of integrations to perform --> <sequence> <integrate> <algorithm>RK4IP</algorithm> <interval>20</interval> <lattice>1000</lattice> <samples>50</samples> <k_operators> <constant>yes</constant> <operator_names>L</operator_names> <![CDATA[ L = rcomplex(0,-kt*kt/2); ]]> </k_operators> <vectors>main vc1</vectors> <![CDATA[ dphi_dz = L[phi] + i*~phi*phi*phi - phi*damping; ]]> </integrate> </sequence> <!-- The output to generate --> <output format="ascii" precision="double"> <filename>nlse.xsil</filename> <group> <sampling> <fourier_space> no </fourier_space> <lattice> 50 </lattice> <moments>pow_dens</moments> <![CDATA[ pow_dens=~phi*phi; ]]> </sampling> </group> </output></simulation>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?