~jon-hill/spud/mac_port

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
This directory provides a working example of a rather trivial
simulation program which employs Spud as its options system.

Ballistics
==========

Ballistics is a program which simulates projectiles moving under
Newtonian mechanics. The only external forcing is gravity so the
projectiles follow parabolic trajectories. This program has no
scientific use of itself and no attempt has been made to use
sophisticated numerics, error handling or any of the other features
which would form a part of a functional simulation package. The
intention is merely to provide a program with a small number of
configurable options which illustrates each component of the Spud
system.

Directory contents
------------------

* ballistics.F90 - Fortran source of the ballistics simulation.
* ballistics.rnc, ballistics.rng - compact and xml versions of the 
                                   ballistics schema file.
* ballistics.xml - sample ballistics options file generated using 
                   diamond and the spud schema. 
* show_ballistics - Python script providing a plot of the 
                    ballistic tracks generated.

Compiling and running
---------------------

Having configured and built libspud, it should be sufficient to type
"make" in the current directory. The resulting executable will be
called "ballistics" and can be run as:

ballistics ballistics.xml

where ballistics.xml can obviously be replaced by any xml file
conforming to the ballistics.rng schema.

Specifying model options
------------------------

Ballistics has a number of configurable options: the problem name
(used for the output files) can be specified as can the time step,
total simulation time and the acceleration due to gravity. To set any
of these options, run diamond on the xml options file ballistics.xml:

diamond -s ballistics.rng ballistics.xml

If you have not installed diamond in your path (see the manual for
installation instructions) then you can run diamond directly from the
source directory with:

../diamond/bin/diamond -s ballistics.rng ballistics.xml


Output
------

Ballistics outputs a file called foo.csv where foo is the simulation
name specified in diamond. This file contains the time and the
position of each projectile at each timestep in plain text, comma
separated format. The script "show_ballistics" will plot the
results. This script depends on Python and the Python libraries numpy
and matplotlib. Users who do not wish to install these packages can
examine the output file in any spreadsheet or even in a text editor.