diffusion.xmds

Script source:
diffusion.xmds.gz

<?xml version="1.0"?>
<!-- Example simulation: Diffusion Equation -->

<simulation>

  <!-- Global system parameters and functionality -->
  <name>diffusion</name>
  <author> Paul Cochrane </author>
  <description>
    Solves the one-dimensional diffusion equation for an initial
    Gaussian pulse.
  </description>
  <prop_dim>t</prop_dim>

  <!-- Command line arguments -->
  <argv>
    <arg>
      <name> kappa </name>
      <type> double </type>
      <default_value> 0.1 </default_value>
    </arg>
  </argv>

  <!-- Global variables for the simulation -->
  <globals>
  <![CDATA[
    // const double kappa = 0.1;  // diffusion coefficient
    const double sigma = 0.1;  // standard deviation of initial Gaussian
    const double x0 = 0.0;     // mean position of initial Gaussian
  ]]>
  </globals>

  <!-- Field to be integrated over -->
  <field>
    <name>main</name>
    <dimensions>  x   </dimensions>
    <lattice>    100  </lattice>
    <domains>  (-1,1) </domains>

    <samples>1</samples>
    <vector>
      <name>main</name>
      <type>complex</type>
      <components>T</components>
      <fourier_space>no</fourier_space>
      <![CDATA[
        T = rcomplex(exp(-(x - x0)*(x - x0)/(2.0*sigma*sigma))/(sigma*sqrt(2.0*M_PI)),0.0);
      ]]>
    </vector>
  </field>

  <!-- The sequence of integrations to perform -->
  <sequence>
    <integrate>

      <algorithm>RK4EX</algorithm>
      <interval>1</interval>
      <lattice>1000</lattice>
      <samples>50</samples>
      <k_operators>
        <constant>yes</constant>
        <operator_names>L</operator_names>
        <![CDATA[
          L = -kappa*kx*kx;
        ]]>
      </k_operators>
      <![CDATA[
          dT_dt =  L[T];
      ]]>
    </integrate>
  </sequence>

  <!-- The output to generate -->
  <output>
    <filename>diffusion.xsil</filename>
    <group>
      <sampling>
        <fourier_space> no </fourier_space>
        <lattice>       50 </lattice>
        <moments>temperature</moments>
	<![CDATA[
	  temperature = T;
	]]>
      </sampling>
    </group>
  </output>

</simulation>

Generated by GNU enscript 1.6.3.



Introduction | Examples | Downloads | Documentation | Archives | Script Repository | FAQ | News | Links | Contacts