Table of Contents


flowcode - evolve an N-body system based on a given flow (2D only)


flowcode [parameter=value] ...


flowcode is an equal-timestep N-body integrator which evolves the particles based on the computed flow (currently only in 2D) at their current position. The flow is obtained from a standard potential descriptor, given by the three keywords potname=,potpars=,potfile= (See also potential(3,5NEMO)), except that flow velocity must be returned instead of forces. The potential returns the density, if this is meaningful for that flow-potential.

In addition to integrating the equations of motion, the particles are allowed to loose some (eta) of their random energy (smoothed over a certain ‘‘box’’ size (cell)), and turn it into mean orbital motion. (NOT IMPLEMENTED - see potcode(1NEMO) .

Orbits can also be diffused: at regular intervals the velocity vector can be rotated over a randomly gaussian distributed angle (sigma).


The following parameters are recognized; they may be given in any order.
Initial conditions will be read from in-file in snapshot format [default: none - but is required].
If given, results are written to out-file in snapshot format [default: empty, no snapshot output file produced].
name of file of potential(5NEMO) descriptor [no default].
List of parameters to the potential descriptor. The first parameter must be the pattern speed in the x-y plane (rotating frames of reference are not supported for all integration modes). The remaining parameters are used by the inipotential() routine in the potential descriptor. [default: none - let them be defined by routine itself].
name of an optional datafile to the potential descriptor. This might be an N-body snapshot or list of spline fit coefficients etc. [default: none].
Inverse time-step, to be used with the time integrator. [Default: 64.0 (64 steps per unit time)].
Integration mode number: 0=Euler, 1=PC (Predictor Corrector), 2=modified PC, 3=Runge-Kutta (JEB modified), 4=4th order Runge-Kutta, 5=LeapFrog. [default: 4].
Time to stop integration in N-body model units. Default is 2.0.
Frequency of major N-body data outputs. Default is 4.0 (4 frames per unit time).
Frequency of minor diagnostic outputs. Default is 32.0 (32 diagnostic measurements per unit time).
Miscellaneous control options, specified as a comma-separated list of keywords. Currently recognized keywords are: reset_time: when reading initial data, set tnow to zero; new_tout: when restarting, set new output times; mass, phi, acc, aux: output mass, potential (density really) acceleration data and auxilliary (the deflection angle from diffusion is stored here) with major data outputs.
*** Fraction of random energy that is dissipated [Default: 0.0].
*** Cell size in which dissipation is performed after every timestep. Dissipation is current performed on a cartesian grid, in which cells are square (2D) or a cube (3D) . [Default: 0.1].
*** Maximum size of the "box" (actually cube) within which dissipation is performed. If a negative number is given, the box is allow to grow as large as is needed, though this may consume a lot of memory. Default: -1, i.e. box can grow indefinite.
*** The ratio of diffusion angle to rms velocity dispersion in a cell. If fheat>0, each time dissipation is applied, the rms velocity dispersion in a cell is computed, and a diffusion angle computed. The velocity vector of each particle is then rotated with a gaussian distributed value with rms fheat*velsig. This in effect gives a dissipation dependant heating source. See also sigma=, which is position independant. [Default: 0].
Diffusion angle, gaussian distributed with this sigma, about which each velocity vector is rotated after each timestep. Diffusion is used only when sigma > 0. [Default: 0].
Frequency of diffusion. Currently the same diffusion angle is used between changes, instead of during a single integration step Default is the same as the integration frequency (freq=).
Random number seed, only used when diffusion (sigma=) is used. 0 must be used to get the random seed from the time of the day. [Default: 0].
Identifying text for this run. Default: not used.


RK, PC and PC1 don’t work in rotating potentials - use EULER or RK4.

Since cell is a fixed number throughout the execution, is doesn’t deal well with systems who’s lenght-scale changes, in particular, expanding systems will allocate more and more space to hold the dissipation grid.


Normally a distinction is made between a streamline and streakline. A streamline is what we compute here: with a "frozen" field we compute how a tracer particle would have flown through space. A streamline also takes into account that the flow could be a function of time, and now it computes how a tracer particle would have streamed through space in the fluid that changed its flow.


Various schemes of dissipation can be invoked. Here’s one, see also Lin & Pringle (1974):

For each cell the relative position and velocity for each particle within that cell is computed:

        R   =  r  - <r >
         i      i     i
        V   =  v  - <v >
         i      i     i
after which the dimensionless viscosity parameter ’alpha’ controls the new velocity for each particle after a timestep:
                                 < R  x  V >
                                    j     j
        u  =  <v>  - alpha  R  x ------------   +  (1-alpha) V
         i      i            i                                i
                                 < R  .  R >
                                    j     j  

See Also

mkflowdisk(1NEMO) , potcode(1NEMO)


Peter Teuben

Update History

10-apr-96    V0.1 cloned of potcode    PJT
7-feb-04    V0.6 implemented diffusion for modes 0,1,4    PJT

Table of Contents