HTML automatically generated with rman
Table of Contents

Name

mkspiral - uniform-density test disk plus spiral in spherical potential

Synopsis

mkspiral out=snapshot [parameters=values ...]

Description

mkspiral sets up a cold disk of test particles orbiting clockwise in the gravitational potential of a user-supplied potential (in potential(5NEMO) format). In addition a spiral is added with constant width in degrees along a galactic circle. For given ratio of spiral/disk perturbation a and width w (now measured in radians) the fraction of particles in the disk will be about pi / (pi + a.w.sqrt(2.pi)) for not too large w. The inverse wavelenght of the spiral (related to the pitch angle) will be positive for a trailing spiral pattern.

snapmass(1NEMO) and snapcenter(1NEMO) have to be used if for some reason the user want finite mass particles and a perfectly centered set of particles.

Note this particle distribution is only useful for display, e.g. spiral structure in a Longitude-Velocity diagram, and should not be integrated with programs like hackcode3(1NEMO) .

mkspiral is also used in the standard benchmark as to measure disk I/O speed on a file just over 2GB.

Parameters

The following parameters are recognized in any order if the keyword is also given:
out=out_file
The data are written to this file in SnapShot(5NEMO) format [no default].
nbody=num_bodies
Number of disk particles [default: 2048]
potname=potential_name
name of the potential, see $NEMO/obj/potential for the current repository. The user can supply his own, see potential(5NEMO) . [default: plummer].
potpars=pot_pars
Paramaters to the user supplied potential. The number of parameters depends on the potential supplied, the first parameter is reserved for a pattern speed in future implementation. [default: not supplied, parameters as defined by potential(5) ].
potfile=pot_file
Data_file(s) to the user supplied potential. The number of files depends on the potential supplied. [default: not supplied, datafile(s) defined by potential(5) ].
rmin=min_disk_radius
Inner cutoff radius of test-particle disk. [Default: 0.0].
rmax=max_disk_radius
Outer cutoff radius of test-particle disk. [Default: 1.0].
mass=
Total mass of the disk. [Default: 0]
a=ratio
Ratio of maximum spiral perturbation w.r.t. base disk. [default: 1].
k=inv_rad
Wavenumber of the spiral pattern, such that 2.pi.k.r is the phase of the spiral density maximum. Positive means trailing spiral pattern. (note that this is defined in term of sign=, see below) [default: 1].
w=width
Width of the spiral arm along a galactic circle. Depending on the next keyword this width is either is degrees along a galactic circle if that is to be constant, or in length units if the width of the spiral is to be constant. [default: 15].
angular=t|f
Is the width of the spiral defined in angular terms, in which case the physical real width linearly increases with distance from the galactic center, or is is constant as a function of radius. [default: t, i.e. defined in angular terms].
seed=random_seed
Use random number seed. A zero seed will generate a system-time dependant seed. [default: 0].
sign=-1|+1
Sign of the angular moment vector. Positive means counter-clock wise rotation. Not
sigma=s1,s2,s3
Velocity dispersion (isotropic) in the X-Y plane, plus optionally an offset and exponential dropoff: s = s1 + s2 * exp(-r/s3). Default: 0
sigmator=
The ratio of the tangential to radial velocity dispersion. By default 1, but if you need realistic values, our local solar neighbor measures about 0.5 but the best self-consistent (despite these models are NOT) estimate can be set by using the value -1, in which case 0.5*kappa/omega is used. Default: 1
nmodel=n_models
Number of output models. [Default: 1].
headline=message
Text headline for output file [default: not used].
linear=t|f
Should the spiral be linear or logarithmic. Although spiral galaxies are mostly logarithmic, for historic reasons the default here is linear. [Default: t]
test=test-mode
The mode for testing. test=0 gives the normal test disk; test=1 the 2D coordinates are uniform random (-1,1); test=2 the 2D coordinates are all set to 1.0; test=3 no initialization (everything 0) [0]

Benchmark

This program has been used as benchmark to test writing >2GB files (40 models of 1,000,000 particles creates a file just over this magic limit):
    % time mkspiral s000 1000000 nmodel=40
Here is a sample on some 2002-class machines:
  U-sparc IIi/440 MHz:  161.30u 42.59s 5:04.85 66.8%  
  PentiumIV 2.2 GHz:    29.54u 10.68s 2:40.14 25.1% 
  PentiumIV 2.4 GHz:    26.46u 10.14s 1:37.71 37.4%  
  G5 2.0GHz:            28.400u 24.660s 1:05.41 81.1% (at no load of 0.0)
                        33.460u 44.950s 13:01.31 10.0%  (at full load of 2.0)
  P4/1.6 GHz:           69.940u 18.470s 4:50.64 30.4% (laptop)
  P4/2.6 GHz + SATA     27.400u 16.320s 0:52.13 83.8%   0+0k 0+0io 300pf+0w
(at no load of 0.0)
                        27.790u 20.020s 1:52.22 42.6%   0+0k 0+0io 300pf+0w
sum: 79.35u  3.72s 2:17.64 60.3%   P2400
tsf:  0.00u  7.59s 1:59.46  6.3%   P2400
sum: 13.610u 4.130s 1:10.12 25.2%  P2600/SATA
tsf:  0.010u 7.800s 1:09.74 11.1%  P2600/SATA
sum: 13.334u 2.915s 0:57.67 28.1%  P2800/SATA (Peter’s asus )
tsf:  0.003u 4.696s 0:44.36 10.5%  P2800/SATA
sum: 68.63u 22.34s 2:31.54 60.0%  U440
tsf: 21.85u 30.73s 2:32.06 34.5%  U440
And here a more modern benchmark on a i7-8550U CPU processor with different modes:
   % time mkspiral $out 1000000 nmodel=40 seed=123 test=$test
   $test  $out  cpu:
   0      .     3.05u 1.09           i5-1135G7
   0      .     4.15u 1.56           i5-10xxx
   0      s0    6.21u 2.16s 0:08.38  full computation on a  i7-8550U CPU
   0      .     6.40u 0.69s 0:07.10   
   1      .     3.49u 0.68s 0:04.17  only using 4 xrandom’s calls
   2      .     2.32u 0.71s 0:03.03  constant initialization
   2      .     1.43u 0.68s 0:02.12  - same , but with better caching barebody.h
   3      .     0.65u 0.56s 0:01.22  no initialization (using calloc)

See Also

mkdisk(1NEMO) , snapmass(1NEMO) , snapcenter(1NEMO) , hackcode3(1NEM0)

Update History


13-mar-89    V1.0  created                       PJT
6-apr-89    V1.1 seed=0 implemented              PJT
7-apr-89    V1.2 angular keyword introduced      PJT
26-feb-93    V1.4 new potential keywrds    PJT
16-sep-95    V1.5 added nmodel=, sign= ; radii now random    PJT
26-may-02    added benchmark data for >2GB files    PJT
3-aug-09    V1.8 and documented forgotten stuff        PJT
11-aug-09    V1.9 added sigmator=    PJT
24-oct-2020    V1.10 added test=    PJT


Table of Contents