Table of Contents
CGS, runCGS- Collisionless Galactic Simulator N-body code
CGS
runCGS [parameter=value]
CGS (Collisionless Galactic Simulator)
is a spherical harmonics Particle-Mesh code originally presented by van
Albada (1982), and recently partially rewritten and improved by Michele
Trenti. The radial grid is adaptive, and keeps constant mass shells. The
angular dependance of the force is expressed in terms of Legendre polynomials.
The code is highly suitable to evolve quasi-spherical smooth initial condition.
The code computes the potential on an (adaptive) grid, by expanding the
density in spherical harmonics. Forces are then computed by numerical differentiation,
and particles are advanced by a global but variable time-step using a leap-frog
scheme.
The code consists of an original (fortran based) executable, CGS,
plus a NEMO style wrapper, named runCGS. Since the fortran executable
assumes files with a fixed name, it can be somewhat cumbersome to run multiple
sets of simulations with different input parameters. A simple frontend organizes
a directories structure and places their output in these run directories,
as well as optionally handles I/O to/from NEMO snapshot(5NEMO)
files.
A
detailed code description can be found in Trenti M. (2005), PhD Thesis,
Scuola Normale Superiore Pisa (Italy) [mainly Chapter 3]. A copy of the
thesis is in $NEMO/usr/trenti/CGS/doc/.
There are the NEMO command
line parameters for runCGS:
- out=directory
- Output directory. Must not exist
yet. In this directory a number of files will be produced by the code. See
below. No Default.
- nbody=
- Number of bodies. Only needed if a model from scratch
when for flag=1 (see below). This parameter is limited by the compiled NPMAX
parameter in the fortran code (see below). [Default: 40000]
- nrad=
- Number
of radial zones. This number is limited by the compiled NRGMAX parameter
(see below). ??? what about angular, not as parameter ??? [Default: 80]
- maxstep=
- Maximum number of integration steps. [Default: 1000]
- dt=
- Initial
integration step. [Default: 0.025]
- tstart=
- Start time of integration. [Default:
0.0]
- tstop=
- Stop time of integration. [Default: 4.0]
- dtmin=
- Minimum allowed
integration step. [Default: 0.001]
- dtmax=
- Maximum allowed integration step.
[Default: 0.01]
- flag=
- Input Creation flag. 1=Plummer sphere from scratch
(needs nbody=). 2=clumpy homogeneous from scratch (needs virial=) 3=initial
conditions from a POS and VEL file. [Default: 1]
- mass=
- Total mass of the
system. [Default: 1.0]
- virial=
- Initial virial ratio for flag=2. [Default:
1.0]
- ndtcmss=
- Number of timesteps between CMSS (center of mass of bound
particles adjustment) call. For simulations where the coordinates of the
center of mass of bound particles are not expected to change (e.g. for simulations
starting from quasi-equilibrium configurations) consider setting ndtcmss
>= maxstep. In this case a frequent recentering of the center of expansion
of the potential might in fact introduce artificial stochastic heating.
If starting from out of equilibrium conditions, e.g. for simulating a cold
collapse, then it is recommended to set ndtcmss to a number sufficiently
small that several recenterings are performed in a dynamical time. [Default:
2000]
- ndtdiag=
- Number of timesteps between diagnostics call. Note that each
diagnostics call has some overhead associated with it. [Default: 50]
- ndtout=
- Number of time steps between writing snapshots. Note that each call has
some overhead associated with it if the potential is selected for output
[Default: 10]
- in=file
- Input data is read from file, which must be a structured
binary file. If left blank, it is assumed that the (plummer) flag parameter
is set to 1 or 2. Note that masses are ignored. Files must be given in an
absolute directory notation, no relative patchs.
- exe=executable
- Name of
the (fortran) executable. Needs to be in your search $PATH, or else the
full absolute path needs to be supplied here. [Default: CGS.exe]
- nemo=t|f
- Should the snapshot data be converted to NEMO format? If so, the ASCII
snapshot is removed. NOTE: Using this option requires extra diskspace. Default:
[t]
PARAMETER.DAT basic input parameters (see below for details)
initPOS.dat input positions if flag=3
initVEL.dat input velocities if flag=3
init_virial.dat input virial ratio if flag=2
fort.2 various diagnostics output (heritage from the original van Albada
1982 version)
fort.11 inner lagrangian radii vs time
fort.12 outer lagrangian radii vs time
fort.13 radial and tangential velocity dispersions
fort.14 total radial and tangential kinetic energy
fort.16 inertia tensor eigenvalues vs. time
fort.17 ellipticity ratios b/a and c/a vs. time
fort.18 density computed over the radial grid vs. time
fort.19 time, angular momentum components, and mean shape parameter or orbits
fort.20 time, total energy, virial ratio -2K/W, total angular momentum
fort.28 same as fort.18, but for bound particles
fort.33 same as fort.13, but for bound particles
fort.34 same as fort.14, but for bound particles
fort.90 one or more snapshots (one line header plus index,pc/os,vel data
in a table)
snap.out Output snapshots, in NEMO’s snapshot(5NEMO) format. Note no masses
present!
Sample PARAMETER.DAT initialization file (the default benchmark):
80 !RADIAL GRID NUMBER
40000 !NUMBER OF PARTICLES
1000 !NUMBER OF STEPS (MAX)
2000 !NUMBER OF TIME STEPS FOR CMSS CALL
50 !NUMBER OF TIME STEPS FOR DIAGNOSTIC CALL
10 !NUMBER OF TIME STEPS FOR WRITING SNAPSHOTS
0.0025 !TIME STEP OF INTEGRATION
0. !START TIME OF SIMULATION
4. !END TIME OF SIMULATION
1. !TOTAL MASS OF SYSTEM
1 !PLUMMER INIT CONDITION FLAG (1=true)
0.01 !MAX ALLOWED DT --> MDT
0.001 !MIN ALLOWED DT
The following example uses runCGS to run the standard benchmark:
% runCGS out=bench1
Note that various parameters (maximum grid size, maximum number
of particles) are hardcoded during compilation, though easily changed in
the right file:
common.blk: parameter(NPMAX=2000000) Max number of particles
common.blk: parameter(NRGMAX=501) Max number of radial grids
common.blk: parameter(NHAR=4) Number of harmonics used [NHAR <= LMAX-1]
common.blk: parameter(LMAX=7) Legendre Polynomials (do not modify)
common.blk: parameter(NCE=28) Max number of Spherical Harmonics Coefficients
(do not modify)
The standard benchmark is 40000 particles and runs for 832 steps.
The user CPU is listed (in sec) in the 2nd column.
P4/1.6 325.9 (g77 3.2.3)
P4/1.6 292.7 (gfortran 4.0.1)
P4/1.6 195.9 (intel 8.1)
G5/1.6 218.5 (g77 3.5.0)
AMD64/ 130.3 (g77 3.4.2)
Xeon-X5660@2.80GHz 79.4 (gfortran_4.4.7 -O3) - gaia
i7-8550U @ 1.80GHz 43.4 (gfortran_7.3.0 -O3) - T480
i7-3820 CPU @ 3.60GHz 52.5 (gfortran_4.4.7 -O3) - dante
i7-3820 CPU @ 3.60GHz 31.7 (ifort_12.1.0 -O3) - dante
You can run the command either as:
% time runCGS out=bench1 nemo=f
or
% time CGS
If output snapshot(5NEMO)
are requested, CGS will create
a file fort.90, which can be converted to NEMO’s snapshot(5NEMO)
, viz.
tabtos $old/fort.90 snap90 nbody,time skip,pos,vel,acc,phi
Although all particles are equally massive (by the nature of the
code), the total mass of the system can be choosen as an input parameter.
The gravitation constant is 4.4971, which is appropriate for a galactic
scale system where the units (see also units(5NEMO)
) are 10^11 solar mass,
10 kpc and 10^8 years. This gives a unit of velocity of about 97.8 km/s.
scfm(1NEMO)
, quadcode(1NEMO)
, snapshot(5NEMO)
, units(1NEMO)
, units(5NEMO)
Trenti, M. (2005), PhD Thesis, Pisa (see Chapter 3 for many details on the
code)
Trenti, M. Bertin, G. and van Albada, T.S. (2005) A&A 433, 57
van Albada, T.S. (1982), MNRAS, 201, 939. Dissipationless galaxy formation
and the R to the 1/4-power law
van Albada, T.S. & van Gorkum, J.H. (1977) A&A,54,121. Experimental Stellar Dynamics
for Systems with Axial Symmetry
Michele Trenti & Tjeerd van Albada (NEMO adaptation: Peter Teuben)
Any scientific publication or presentation which has benefited from
using CGS should quote the paper
Trenti, M. Bertin, G. and van Albada, T.S. (2005) A&A 433, 57
(please find this paper and the PhDthesis.pdf file in the subdirectory CGS/doc).
2003 original version M. Trenti & T.van Albada
3-nov-05 V0.1 alpha release testing PJT
12-dec-05 V0.2 writing simple pos/vel snapshots using freqout= MT/PJT
22-mar-06 V0.5 writing potential and forces to output MT
22-may-06 V1.0 released within NEMO MT/PJT
Table of Contents