The purpose of this program is to simulate the motion of Brownian particles (in arbitrary dimension) interacting via a soft-sphere potential, some of the particles being driven by an external force.
The stochastic differential equation that is simulated is
∂txi(t) = I(i is tracer)f -
∑ j≠i∇ xi
V(xi(t) - xj(t)) + ξi(t)
where xi is the position of particle i, f is the external
force, V is a soft-sphere potential and ξi is a Gaussian
white noise with correlation proportional to the temperature T.
V(r) = ½ θ(1 - r) (1 - r)2 [θ is the Heaviside
function]
⟨ ξia(t) ξjb(t')
⟩ = 2T δij δab δ(t - t')
See [Poncet and al., 2016] for an example of application of this program.
- Boost for program options and gzip compression
- SFML for on-the-fly visualization of particles in 2d (can be disabled)
For compiling the source code, your compiler should support C++11 (both g++ and clang++ do).
The compilation was only tested on Linux. It should in theory also work on Windows and MacOS.
If the source code is compiled with the Makefile
provided (and all the
dependancies are met), three executable files are created:
brownianTracers-2d
for simulations in dimension 2brownianTracers-2d-visu
same as the previous one with on-the-fly visualization of the systembrownianTracers-3d
for simulations in dimension 3
At the Makefile
level, this behavior is enabled by compilation flags:
-DDIM=d
(withd
any striclty positive integer) is a mandatory flag to indicate the dimension of the system-DVISU2D
is an optional flag that enables visualization in dimension 2.
Arguments to the program can be defined either via the command-line or
via a configuration file.
The configuration file is defined via --config
and should be made of lines of the type arg=value
(e.g. particles=40000
or
gzip=
).
--particles
Number of particles of the system--tracers
Number of tracers (i.e. particles driven by the external force)--density
Density of the system (1 means on average 1 particle per cube of unit size)--temperature
Temperature (the mobility being set to 1)--force
External force (the mobility being set to 1)--timestep
Time step of the simulation--iters
Number of iterations of the simulation
If the visualization is disabled, it is mandatory to provide at least one of the following arguments:
--mobility
Export data for mobility--correl
Export data for correlations--livepos
Export positions every given number of iterations
--thermalization
Number of iterations of thermalization (i.e. without recording any observable) (default=0
)--resolution
Resolution for the correlations (default=0.25
)--path
Directory in which the files are saved (default=Results/
)--fileMobility
(resp.--fileCorrel
) File name (without directory) for data for mobility (resp. correlations). If undefined the file name will beBT<dimension>d-<day>-<time>-<6randomCharacters>-<mobility|correl>.dat
(e.g.BT2d-20150320-102714-sUfrH-mobility.dat
)--filePos
File name (without directory and extension) for positions (default format if not defined)--gzip
Compress output with gzip format (useful for the correlation file if the resolution is small)
--config
Configuration file in which the previous arguments can be read (if an argument is both in the command-line and in the file, the priority goes to the command-line)--verbose
Verbose mode--help
Display help message and exit
The code belongs to ESPCI Paris and is released under CeCILL 2.1 license, a French license similar to and compatible with GNU GPL. Feel free to modify the code and redistribute it under either CeCILL or GPL.
- Boost is released under Boost Software License.
- SFML is released by Laurent Gomila under zlib/png licence.
- This repository includes the font Ubuntu Mono Regular (
font.ttf
) released under Ubuntu Font Licence.