File: diffusion.xmds

package info (click to toggle)
xmds 1.6.6-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,752 kB
  • ctags: 1,571
  • sloc: cpp: 35,402; sh: 7,408; ansic: 1,029; makefile: 244
file content (119 lines) | stat: -rw-r--r-- 3,954 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?xml version="1.0"?>
<!-- Example simulation: Diffusion Equation -->

<!-- $Id: diffusion.xmds 1526 2007-08-21 17:30:14Z paultcochrane $ -->

<!--  Copyright (C) 2000-2007                                           -->
<!--                                                                    -->
<!--  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., 51 Franklin St, Fifth Floor, Boston,            -->
<!--  MA  02110-1301, USA.                                              -->

<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.
    Part 1 of 2: This simulation propagates the solution for 1 time unit,
    and then saves the state of the field. The simulation can then be 
    continued in part 2.
  </description>

  <prop_dim>t</prop_dim>
  <error_check>no</error_check>
  <runtime_limit> 3 </runtime_limit>
  <stochastic>no</stochastic>
  <benchmark>yes</benchmark>
  <use_wisdom>yes</use_wisdom>  <!-- Default is no -->

  <!-- Global variables for the simulation -->
  <globals>
  <![CDATA[
    const double sigma = 0.1;
    const double kappa = 0.1;
    const double x0 = 0.0;
  ]]>
  </globals>

  <!-- Field to be integrated over -->
  <field>
    <name>main</name>
    <dimensions>  x   </dimensions>
    <lattice>    128  </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>ARK89EX</algorithm>
      <interval>50</interval>
      <lattice>10000</lattice>
      <samples>50</samples>
      <tolerance>1e-5</tolerance>
      <k_operators>
        <constant>yes</constant>
        <operator_names>L</operator_names>
        <![CDATA[
          L = -kappa*kx*kx;
        ]]>
      </k_operators>
      <vectors>main</vectors>
        <![CDATA[
          dT_dt =  L[T];
        ]]>
    </integrate>
    <breakpoint>
      <filename>diffusion_break.xsil</filename>
      <fourier_space> no </fourier_space>
      <vectors> main </vectors>
    </breakpoint>
  </sequence>

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

</simulation>