  Cosmological simulations of structure formation follow the collisionless
evolution of dark matter starting from a nearly homogeneous field at early
times down to the highly clustered configuration at redshift zero. The density
field is sampled by a number of particles in number infinitely smaller than
those believed to be its actual components and this limits the mass and spatial
scales over which we can trust the results of a simulation. Softening of the
gravitational force is introduced in collisionless simulations to limit the
importance of close encounters between these particles. The scale of softening
is generally fixed and chosen as a compromise between the need for high spatial
resolution and the need to limit the particle noise. In the scenario of
cosmological simulations, where the density field evolves to a highly
inhomogeneous state, this compromise results in an appropriate choice only for
a certain class of objects, the others being subject to either a biased or a
noisy dynamical description. We have implemented adaptive gravitational
softening lengths in the cosmological simulation code GADGET; the formalism
allows the softening scale to vary in space and time according to the density
of the environment, at the price of modifying the equation of motion for the
particles in order to be consistent with the new dependencies introduced in the
system's Lagrangian. We have applied the technique to a number of test cases
and to a set of cosmological simulations of structure formation. We conclude
that the use of adaptive softening enhances the clustering of particles at
small scales, a result visible in the amplitude of the correlation function and
in the inner profile of massive objects, thereby anticipating the results
expected from much higher resolution simulations.
