|
vibstring.xmds
Script source: vibstring.xmds.gz
<?xml version="1.0"?>
<!-- Example simulation: Waves on a vibrating string -->
<!-- $Id: vibstring_body.part 999 2004-08-03 05:42:47Z cochrane $ -->
<!-- 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. -->
<!-- Adapted from the example in -->
<!-- "A first course in computational physics" -->
<!-- Paul L. DeVries, pg 348 -->
<simulation>
<name>vibstring</name>
<author>Paul Cochrane</author>
<description>
Example simulation of waves on a vibrating string. Adapted from
the example in "A first course in computational physics" by Paul
L. Devries, page 348.
</description>
<!-- Global system parameters and functionality -->
<prop_dim>t</prop_dim>
<error_check>yes</error_check>
<stochastic>no</stochastic>
<!-- Global variables for the simulation -->
<globals>
<![CDATA[
const double length = 1.0; // 1 metre
const double mass = 1e-3; // 1 gram
const double T = 10.0; // (Tension) 10 Newtons
const double mu = mass/length; // mass density
const double c = sqrt(T/mu); // speed of wave propagation
]]>
</globals>
<!-- Field to be integrated over -->
<field>
<name>main</name>
<dimensions> x </dimensions>
<lattice> 100 </lattice>
<domains> (0,1) </domains>
<samples>1</samples>
<vector>
<name>main</name>
<type>complex</type>
<components>u uDot</components>
<fourier_space>no</fourier_space>
<![CDATA[
/* supposed to be 0 at the boundaries x=0 and x=1, but can't do this in xmds-1.2 */
u = rcomplex(exp(-100.0*(x-0.5)*(x-0.5)),0.0);
uDot = 0.0;
]]>
</vector>
</field>
<!-- The sequence of integrations to perform -->
<sequence>
<integrate>
<algorithm>RK4EX</algorithm>
<interval>0.002</interval>
<lattice>1000</lattice>
<samples>20</samples>
<k_operators>
<constant>yes</constant>
<operator_names>L</operator_names>
<![CDATA[
L = -T*kx*kx/mu;
]]>
</k_operators>
<vectors>main</vectors>
<![CDATA[
du_dt = uDot;
duDot_dt = L[u];
]]>
</integrate>
</sequence>
<!-- The output to generate -->
<output format="ascii">
<filename>vibstring.xsil</filename>
<group>
<sampling>
<fourier_space> no </fourier_space>
<lattice> 50 </lattice>
<moments>amp</moments>
<![CDATA[
amp=u;
]]>
</sampling>
</group>
</output>
</simulation>
Generated by GNU enscript 1.6.3.
|