GRAMSES: a new route to general relativistic $N$-body simulations in
  cosmology. Part I. Methodology and code description
  We present GRAMSES, a new pipeline for nonlinear cosmological $N$-body
simulations in General Relativity (GR). This code adopts the
Arnowitt-Deser-Misner (ADM) formalism of GR, with constant mean curvature and
minimum distortion gauge fixings, which provides a fully nonlinear and
background independent framework for relativistic cosmology. Employing a fully
constrained formulation, the Einstein equations are reduced to a set of ten
elliptical equations which are solved using multigrid relaxation with adaptive
mesh refinements (AMR), and three hyperbolic equations for the evolution of
tensor degrees of freedom. The current version of GRAMSES neglects the latter
by using the conformal flatness approximation, which allows it to compute the
two scalar and two vector degrees of freedom of the metric. In this paper we
describe the methodology, implementation, code tests and first results for
cosmological simulations in a $\Lambda$CDM universe, while the generation of
initial conditions and physical results will be discussed elsewhere. Inheriting
the efficient AMR and massive parallelisation infrastructure from the
publicly-available $N$-body and hydrodynamic simulation code RAMSES, GRAMSES is
ideal for studying the detailed behaviour of spacetime inside virialised cosmic
structures and hence accurately quantifying the impact of backreaction effects
on the cosmic expansion, as well as for investigating GR effects on
cosmological observables using cosmic-volume simulations.
