# The rise and fall of stellar across the peak of cosmic star formation history: effects of mergers versus diffuse stellar mass acquisition

Charlotte Welker, Yohan Dubois, Julien Devriendt, Christophe Pichon, Sugata Kaviraj, Sebastien Peirani

<figure><img src="image_1.png" /></figure>

## To cite this version:

Charlotte Welker, Yohan Dubois, Julien Devriendt, Christophe Pichon, Sugata Kaviraj, et al. The rise and fall of stellar across the peak of cosmic star formation history: effects of mergers versus diffuse stellar mass acquisition. Monthly Notices of the Royal Astronomical Society, 2017, 465 (1), pp.1241-1258. 10.1093/mnras/stw2778. hal-01554065

HAL Id: hal-01554065

https://hal.science/hal-01554065v1

Submitted on 27 Aug 2025

HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# The rise and fall of stellar across the peak of cosmic star formation history: effects of mergers versus diffuse stellar mass acquisition

C. Welker,<fnref n="1" />,<fnref n="2" />,<fnref n="3" />* Y. Dubois,<fnref n="1" /> J. Devriendt,<fnref n="3" />,<fnref n="4" /> C. Pichon,<fnref n="1" />,<fnref n="5" />,<fnref n="6" /> S. Kaviraj<fnref n="7" /> and S. Peirani<fnref n="1" />

Accepted 2016 October 26. Received 2016 October 26; in original form 2015 February 17

## ABSTRACT

Building galaxy merger trees from a state-of-the-art cosmological hydrodynamical simulation, Horizon-AGN, we perform a statistical study of how mergers and diffuse stellar mass acquisition processes drive galaxy morphologic properties above $z > 1$. By diffuse mass acquisition here, we mean both accretion of stars by unresolved mergers (relative stellar mass growth smaller than 4.5 per cent) as well as *in situ* star formation when no resolved mergers are detected along the main progenitor branch of a galaxy. We investigate how stellar densities, galaxy sizes and galaxy morphologies (defined via shape parameters derived from the inertia tensor of the stellar density) depend on mergers of different mass ratios. We investigate how stellar densities, effective radii and shape parameters derived from the inertia tensor depend on mergers of different mass ratios. We find strong evidence that diffuse stellar accretion and *in situ* formation tend to flatten small galaxies over cosmic time, leading to the formation of discs. On the other hand, mergers, and not only the major ones, exhibit a propensity to puff up and destroy stellar discs, confirming the origin of elliptical galaxies. We confirm that mergers grow galaxy sizes more efficiently than diffuse processes ($r_{0.5} \propto M_s^{0.85}$ and $r_{0.5} \propto M_s^{0.1}$ on average, respectively) and we also find that elliptical galaxies are more susceptible to grow in size through mergers than disc galaxies with a size-mass evolution $r_{0.5} \propto M_s^{1.2}$ instead of $r_{0.5} \propto M_s^{-0.5} - M_s^{0.5}$ for discs depending on the merger mass ratio. The gas content drives the size-mass evolution due to merger with a faster size growth for gas-poor galaxies $r_{0.5} \propto M_s^2$ than for gas-rich galaxies $r_{0.5} \propto M_s$.

**Key words:** methods: numerical – galaxies: evolution – galaxies: formation – galaxies: interactions – galaxies: kinematics and dynamics.

## 1 INTRODUCTION

While our present understanding of galaxy evolution derives mainly from the nearby ($z < 1$) Universe, the bulk of today's stellar mass formed around the broad peak of cosmic star formation history at $z \sim 2$ (e.g. Madau, Pozzetti & Dickinson 1998; Hopkins & Beacom 2006). Although it represents a significant epoch in the evolution of the observable Universe, the properties of galaxies remain largely unexplored at this epoch, as it has only recently become accessible by current observational facilities (CANDELS,

GOODS, Herschel, ALMA; Lin et al. 2010; Cooper et al. 2012; López-Sanjuan et al. 2013; Chen et al. 2014).

As a result, what constitutes arguably the most important aspect of hierarchical galaxy formation and evolution is still being debated. To what extent, mergers, as opposed to secular evolution driven by (cold) gas inflows, explain the diversity of galaxies? The significance of mergers, considered a cornerstone of the bottom-up growth of galaxies, has been heavily debated in recent work. They are certainly capable of inducing star formation, BH growth and morphological transformations (e.g. Springel, Di Matteo & Hernquist 2005), but it is not obvious that at $z > 1$, mergers drive the evolution of galaxy properties like stellar mass, size and morphology (Shankar et al. 2004; Law 2009; Kaviraj et al. 2013b) considering the steady input of accreted streams of gas (Kereš et al. 2005;

<footnote n="1">¹CNRS and UPMC Univ. Paris 06, UMR 7095, Institut d'Astrophysique de Paris, 98 bis Boulevard Arago, F-75014 Paris, France</footnote>

<footnote n="2">²ICRAR, University of Western Australia, Crawley, Perth, 6009, WA, Australia</footnote>

<footnote n="3">³Sub-department of Astrophysics, University of Oxford, Keble Road, Oxford OX1 3RH, UK</footnote>

<footnote n="4">⁴Observatoire de Lyon, UMR 5574, 9 avenue Charles André, Saint Genis Laval, F-69561, France</footnote>

<footnote n="5">⁵Institute of Astronomy, University of Cambridge, Madingley Road, Cambridge CB3 0HA, UK</footnote>

<footnote n="6">⁶Korea Institute of Advanced Studies (KIAS) 85 Hoegiro, Dongdaemun-gu, Seoul, 02455, Republic of Korea</footnote>

<footnote n="7">⁷Centre for Astrophysics Research, University of Hertfordshire, College Lane, Hatfield, Herts AL10 9AB, UK</footnote>

<footnote>* E-mail: charlotte.welker@uwa.edu.au</footnote>
Ocvirk, Pichon & Teyssier 2008; Dekel et al. 2009) and the gas-rich nature of galaxies (Tacconi et al. 2010; Santini et al. 2014).

Observational studies suggest that large fractions of star-forming galaxies around $z \sim 2$ are not merging objects but show kinematics and visual morphologies that are more consistent with systems dominated by turbulent discs (e.g. Forster Schreiber, Genzel & Lehnert 2006; Genzel et al. 2008; Shapiro et al. 2008; Mancini et al. 2011; Kaviraj et al. 2013b). In addition, many primordial spheroids that are forming the bulk of their stellar mass at $z \sim 2$ do not show the tidal features that would be expected from recent major mergers (Kaviraj et al. 2013a). Notwithstanding these advances, large statistical studies remain difficult, both due to the fact that observational efforts rely on pencil-beam surveys that are susceptible to low-number statistics and cosmic variance but also that they are based on techniques that can differ significantly from study to study. Moreover, studies of galaxy merging at these redshifts are further complicated by the fact that non-merging star-forming discs becomes more turbulent and asymmetric at earlier times, making them difficult to separate from genuine mergers (Huertas-Company et al. 2014; Kaviraj et al. 2014).

On the other hand, semi-analytical models and numerical simulations propose that mergers can account for the size increase of local early-type galaxies if they are mostly dry (gas poor) and minor (Boylan-Kolchin, Ma & Quataert 2006; Khochfar & Silk 2006; Maller et al. 2006; Naab, Khochfar & Burkert 2006; Bournaud, Jog & Combes 2007; De Lucia 2007; Naab et al. 2007; Guo & White 2008; Hopkins et al. 2009; Nipoti et al. 2009; Feldmann et al. 2010; Bédorf & Portegies Zwart 2013; Shankar et al. 2013). Dry minor mergers are also thought to be responsible (at least in part; see Wellons et al. 2016) for the loss of compactness of massive ellipticals at $z < 2$, where they are thought to take over *in situ* star formation in terms of stellar mass accretion rates (Oser et al. 2010; Hirschmann et al. 2012; Lackner et al. 2012; Dubois et al. 2013; Lee & Yi 2013; Rodriguez-Gomez et al. 2016). The dryness of low-redshift galaxies is ensured either by the environment (for satellites infalling in groups and clusters) or by the presence of a supermassive black hole (BH) at the centre of massive galaxies which powers feedback from the active galactic nuclei (AGN; Di Matteo et al. 2008; Booth & Schaye 2009; Dubois et al. 2012). Together, these mechanisms allow for the formation of extended elliptical galaxies that would otherwise remain compact discs (Dubois et al. 2013; Choi et al. 2014).

Multiple numerical studies also focused on a few idealized high-resolution merger events to determine their impact on the morphology of the stellar component of galaxies (Bournaud, Combes & Jog 2004; Bournaud, Jog & Combes 2005; Naab & Trujillo 2006; Peirani et al. 2010). They found that while major mergers or multiple minor mergers of stellar discs tend to produce elliptical-like remnants, either discy or boxy depending on the amount of gas available (Cretton et al. 2001; Naab & Burkert 2003; Naab, Jesseit & Burkert 2006; Qu et al. 2011), single minor mergers do not systematically destroy the primary disc but only thicken it (Quinn, Hernquist & Fullagar 1993; Walker, Mihos & Hernquist 1996; Velazquez & White 1999; Younger et al. 2007). On the other hand, the steady input of cosmological gas accretion is able to rebuild the disc of galaxies (Agertz, Teyssier & Moore 2009; Brooks et al. 2009; Pichon et al. 2011). Hence, one needs to assess the relative importance of mergers versus more diffuse stellar acquisition processes such as smooth accretion and *in situ* formation driven by the cosmic environment and to study its induced morphological diversity. Moreover, while it is now well established that mergers have a significant impact on $z < 1$ early-type galaxy sizes and kinematics,

it is not yet clear whether (i) this extends to the galaxy population at high redshift and (ii) over which time-scale they are of importance, as many galaxies may not merge at all for long periods of time. Observations of local galaxies not only suggest that early-type galaxies increased their size by 3–5 from $z \sim 2$, but also that while most massive ones ($M_s > 1.5 \times 10^{11}$ M$_\odot$) roughly doubled their size from $z \sim 1$, smaller ones underwent a more limited growth between $z \sim 1$ and $z = 0$ (by a factor of 1.1–1.3; Huertas-Company et al. 2013). From these results, we expect a growth by at least a factor of 2–2.5 between $z \sim 2–3$ and $z = 1$ (Nipoti et al. 2012).

With the advent of large-scale albeit fairly well-resolved cosmological hydrodynamical simulations such as Horizon-AGN (Dubois et al. 2014, see as well Devriendt et al. 2010; Khandai et al. 2014; Vogelsberger et al. 2014; Schaye et al. 2015 for similar simulations performed with different numerical techniques), it has recently become feasible to investigate these different physical processes in detail and with sufficient statistics, a necessary requirement to truly unravel the impact of galaxy environment on their properties.

Following up on Welker et al. (2014) which explored the fundamental role of mergers and diffuse stellar acquisition processes on the evolution of the galactic spin and its orientation with respect to the cosmic web, we investigate here the effects that mergers – as opposed to *in situ* star formation – have on defining and modifying the size and morphology of galaxies (see Fig. 12). Throughout the paper, and unless specified otherwise, we will refer to ‘diffuse stellar mass acquisition’ to include both accretion of stars by unresolved mergers (relative stellar mass growth smaller than 4.5 per cent) as well as *in situ* star formation when no resolved mergers are detected along the main progenitor branch of a galaxy, as we duly specify in the next section. In Section 2, we describe the main features of the simulation. In Section 3, we evaluate the accretion rates of different types of mergers over cosmic history. In Section 4, we analyse the impact of both processes – mergers and diffuse stellar acquisition– on the growth of galaxies in the cosmic web, with specific emphasis on the different role played by gas- and star-dominated mergers (equivalent to the dry/wet dichotomy used in lower $z$ studies). In Section 5, we explore the competitive effects of diffuse stellar acquisition and mergers on the morphology of galaxies and their correlation to the disc and spheroid abundances over the duration of the peak of cosmic star formation. Our results are further discussed and interpreted in Section 6 and eventually summed up in Section 7.

## 2 NUMERICAL METHODS AND DEFINITIONS

We briefly describe the cosmological hydrodynamical simulation used for analysis in this paper, Horizon-AGN, which is already described in more details in Dubois et al. (2014). The Horizon-AGN simulation (http://www.horizon-simulation.org/) is run with a $\Lambda$ cold dark matter cosmology with total matter density $\Omega_m = 0.272$, dark energy density $\Omega_\Lambda = 0.728$, amplitude of the matter power spectrum $\sigma_8 = 0.81$, baryon density $\Omega_b = 0.045$, Hubble constant $H_0 = 70.4$ km s$^{-1}$ Mpc$^{-1}$, and $n_s = 0.967$ compatible with the Wilkinson Microwave Anisotropy Probe-7 data (Komatsu et al. 2011). The size of the simulation box is $L_{\text{box}} = 100$ h$^{-1}$ Mpc on a side and the volume contains $1024^3$ dark matter (DM) particles, corresponding to a DM mass resolution of $M_{\text{DM, res}} = 8 \times 10^7$ M$_\odot$. The simulation is run with the RAMSES code (Teyssier 2002) and the initially coarse $1024^3$ grid is adaptively refined down to $\Delta x = 1$ proper kiloparsec, with refinement triggered in a quasi-Lagrangian manner: if the number of DM particles becomes greater than eight or the total baryonic mass reaches eight times the initial DM mass resolution in a cell. It leads to a typical number of $6.5 \times 10^9$ gas
resolution elements (leaf cells) in the Horizon-AGN simulation at $z=1$. Heating of the gas from a uniform UV background takes place after redshift $z_{\text{reion}} = 10$ following Haardt & Madau (1996). Gas can cool down to $10^4$ K through H and He collisions with a contribution from metals using rates tabulated by Sutherland & Doppita (1993). Star formation occurs in regions of gas number density above $n_0 = 0.1$ H cm$^{-3}$ following a Schmidt law: $\dot{\rho}_* = \epsilon_* \rho_g / t_{\text{ff}}$, where $\dot{\rho}_*$ is the star formation rate mass density, $\rho_g$ the gas mass density, $\epsilon_* = 0.02$ the constant star formation efficiency and $t_{\text{ff}}$ the local free-fall time of the gas. We adopt a resolution so that the typical mass of a stellar particle is $M_* = 2 \times 10^6$ M$_\odot$. Feedback from stellar winds, supernovae Type Ia and Type II are included into the simulation with mass, energy and metal release. The simulation also follow the formation of BHs, which can grow by gas accretion at a Bondi-capped-at-Eddington rate and coalesce when they form a tight enough binary. BHs release energy in a quasar/radio (heating/jet) mode when the accretion rate is respectively above and below one per cent of Eddington, with efficiencies tuned to match the BH-galaxy scaling relations at $z=0$ (see Dubois et al. 2012, for details). With this elaborate implementation, Horizon-AGN reproduces a wide diversity of galaxy types in terms of mass (from $10^{8.5}$ M$_\odot$ and up to $10^{13}$ M$_\odot$ at $z=0$), angular momentum, morphology (discs, irregulars, ellipticals, compact spheroids), star formation rates and colours consistent with the bimodality established in observations, across a wide range of realistic environments (voids, walls, filaments, groups, clusters of mass up to $10^{15}$ M$_\odot$ at $z=0$; see Dubois et al. 2014, for details).

## 2.1 Galaxy identification and merger trees

Galaxies are identified with the most massive sub-node method (Tweed et al. 2009) of the ADAPTAHOP halo finder (Aubert, Pichon & Colombi 2004) operating on the distribution of star particles only (DM particles are not taken into account) with the same parameters than in Dubois et al. (2014): a total of 20 neighbours are used to compute the local density of each particle, a local threshold of 178 times the average total matter density is applied to select relevant densities. Unless specified otherwise, only structures with a minimum of $N_{\text{min}} = 100$ stellar particles are considered, which typically selects objects with stellar masses larger than $2 \times 10^8$ M$_\odot$ (i.e. haloes larger than $2 \times 10^{10}$ M$_\odot$). Throughout the paper, we define $M_s$ the stellar mass of each galaxy, as the sum of the mass of all the stellar particles identified as part of the galaxy by the halo finder. We further use the notation $M_{0.5}$ when focusing on the properties of the stellar material contained in the half-mass radius $r_{0.5}$, defined as the radius of the sphere that encloses half the stellar mass of the galaxy. Catalogues containing up to ~150 000 galaxies are produced for each redshift output analysed in this paper ($1.2 < z < 5.2$). Note that although sub-structures (i.e. galaxies in an advanced stage of merging into a bigger galactic host but still detected as individual structures) may remain, these populations of galaxies are largely dominated by main structures (i.e. central galaxies, not part of a more massive galaxy).

The galaxy catalogues are then used as an input to build galaxy merger trees with TREEMAKER (Tweed et al. 2009), set to operate on the previously identified stellar particles. Any galaxy at redshift $z_n$ is connected to its progenitors at redshift $z_{n-1}$ and its child at redshift $z_{n+1}$. We build galaxy merger trees for 22 outputs from $z=1.2$ to $5.2$ equally spaced in redshift. On average, the redshift difference between outputs corresponds to a time difference of 200 Myr (range between 100 and 300 Myr). We reconstruct the merger history of each galaxy (halo) starting from the lowest redshift $z$ and identifying

the most massive progenitor at each time step as the galaxy or main progenitor and the other progenitors as satellites. Moreover, we check that the mass of any child contains at least half the mass of its main progenitor to prevent misidentifications.

## 2.2 Identification of mergers and definition of diffuse stellar acquisition

In the following analysis, we focus on understanding the evolution of the stellar component of galaxies. However, given the cosmological volume of the simulation, stellar particles are not tracked individually across cosmic time but only accounted for through their assignment to galaxies by the halo finder and through the consecutive analysis of merger trees, that is to say, through the comparison of the main progenitors and galaxies stellar masses when mergers occur or not. Indeed, our study focuses on the distinction between:

(i) stars acquired through mergers of various mass ratios, either through direct accretion of pre-existing stars from a secondary progenitor or through starbursts (occurring in any of the progenitors) triggered by the merger itself.

(ii) Stars resulting from diffuse stellar acquisition processes, i.e. when no merger occurs. This includes in situ stellar formation from cold gas – either from recent gas accretion from cold flows on to the galaxy or from gas accreted at earlier times that has since undergone cooling – but also stripping from orbiting satellites. As will be developed hereafter, unresolved mergers in our simulation are also de facto absorbed in this category.

Such categories can be easily tracked adopting an heuristic approach that exploits merger trees: for any galaxy, the stellar mass assembly is inspected along the tree branches between any given redshifts $z_n$ and $z_{n-1}$. In this process, three quantities are systematically recorded:

(i) the number of progenitors $n_{\text{prog}}$;

(ii) the total stellar mass growth rate $\delta m_{\text{stars}} = \Delta m / M_s = [m(z_n) - m(z_{n-1})] / M_s(z_n)$ with $M_s(z_n)$ the stellar mass of the galaxy at $z_n$;

(iii) the integrated merger mass ratio $\delta m = m_{\text{mergers}}(z_{n-1} \rightarrow n) / M_s(z_n)$ if $n_{\text{prog}} > 1$, where $m_{\text{mergers}}(z_{n-1} \rightarrow n)$ is the stellar mass accreted through mergers between $z_{n-1}$ and $z_n$ (the sum of the masses of its progenitors except for the main). Note that if $n_{\text{prog}} > 2$, we also record $m_{\text{progenitor}}(z_{n-1}) / M_s(z_n)$ for each progenitor to further allow for the distinction between multiple ‘synchronous’ minor mergers and single major mergers.

Note that such a definition implies $\delta m < \delta m_{\text{stars}}$.

We then adopt the following classification:

(i) a galaxy with one single progenitor is listed as having undergone only diffuse stellar acquisition processes. $\delta m_{\text{stars}}$ is fully attributed to in situ star formation.

(ii) a galaxy with more than one progenitor is listed as having undergone at least one merger.

It is important to remember that the resolution threshold of the halo finder induces a detection threshold on merger events, hence an important limitation on the precision of the first category. The smallest bound stellar structures that go undetected by the halo finder do not increase the number of progenitors hence contribute to the diffuse stellar acquisition category. We further detail the method adopted to control this threshold in the next sections.
### 2.2.1 Merger sub-categories

We then sort galaxy mergers depending on the merger mass ratio $\delta m = m_{\text{mergers}}(z_{n-1} \rightarrow n)/M_{\text{s}}(z_n)$.

(i) Major mergers are defined as mergers with $\delta m > 20$ per cent,

(ii) minor mergers as mergers with 9 per cent $< \delta m < 20$ per cent and

(iii) very minor mergers with $4.5$ per cent $< \delta m < 9$ per cent,

(iv) mergers with $\delta m < 4.5$ per cent are discarded from the merger category.

These bins are defined so as to be consistent with observational definitions of mergers using pairs of interacting galaxies, for which the observed mass ratio *R* is defined as $R = M_{\text{sat}}/M_{\text{main}}$ and where the subscripts indicate secondary $M_{\text{sat}}$ and main $M_{\text{main}}$ progenitors, respectively, as defined in the previous paragraph of this section. Our bins thus correspond to merger mass ratios $R = 1:4, 1:10$ and $1:20$.

The reader should note that with our methodology, in the events identified as mergers, still a non-negligible fraction of the stellar mass can be formed via star formation, either because of secular conversion of gas into stars or because triggered by the merger event itself (see Kaviraj et al. 2014). However, this amount of *in situ* stellar mass is not explicitly tracked in the following steps of the analysis. When evaluating the effects that mergers have on the sizes and morphologies of galaxies, the underlying assumption is that the transformations induced to the galaxies by the bursts of stellar formation triggered by mergers should be fully attributed to the merger-induced growth budget and that synchronous diffuse stellar mass acquisition purely due to secular evolution is negligible or else that the effects of the mergers overcome the effects of the secular diffuse stellar mass growth.

Furthermore, one could argue that this definition allows no distinction between one major merger and multiple minor mergers occurring within the same time lapse. As mentioned before, we therefore track the number of progenitors at $z_{n-1}$ for each galaxy at $z_n$ and restrict our merger samples to galaxies with at least one satellite identified in the previous output that would alone classify the event as belonging to the specific merger category. Note, however, that neither results obtained with the stronger restriction where we only keep galaxies with exactly two progenitors, nor the results obtained with the full sample are affected, apart for an increased scatter in the second case. Indeed, with our choice of time step, we find that multiple minor mergers falsely appearing as one major merger between consecutive outputs are not statistically significant in our sample: with slight variations in redshift, around 60 per cent of the sample defined simply with $\delta m > 20$ per cent do correspond to one single major merger event and 25 per cent to one well-identified major merger and an additional minor or very minor merger. Less than 10 per cent correspond solely to a collection of minor mergers with $\delta m < 15$ per cent, which could be falsely identified as a major merger. Those latter are systematically discarded in our analysis. The same applies to collections of only very minor mergers mimicking a minor merger.

Any merger with $\delta m < 4.5$ per cent is discarded and counted as ‘diffuse stellar acquisition’ for both numerical and physical reasons that we develop now.

### 2.2.2 Diffuse stellar acquisition sub-categories

As mentioned before, in our analysis, we oppose mergers to a unique category that we call ‘diffuse stellar accretion’. This refers not only

to the smooth accretion of gas on to galaxies and consecutive *in situ* star formation but also to the stripping of orbiting satellites, as well as the stochastic ‘clumpy’ stellar accretion due to unresolved mergers.

We could, in principle, limit the contribution of unresolved mergers by restricting this latter sample to galaxies with $\delta m = 0$ (i.e. which grows stellar mass without being subjected to any detected merger event). However, the numerical methods used render such a straightforward assumption misleading. Indeed, the galaxy finder can only detect structures above a given minimum number of particles, which is set prior to the detection. This is set to $N_{\text{min}} = 100$ in our analysis, so as to detect sufficiently resolved, realistically gravitationally bound structures. This leads to a strong limitation when tracking galaxies that do not undergo mergers: one can only define an upper bound for $\delta m$ to characterize smoothly accreted and *in situ* formed material, as all progenitors under this detection threshold are not accounted for in the merger tree. Therefore, at the very least, we are restricted to use this threshold as an upper bound when defining non-mergers. This is hardly a wise choice as such an absolute satellite mass limit leads to very different merger mass ratios depending on the mass of the main progenitor.

We therefore impose a relative threshold $\delta m_{\text{min}} = 4.5$ per cent. The value is set to comply with the following constraints.

(i) In order to preserve completeness (i.e. in order to resolve the full merger history down to $\delta m_{\text{min}}$ even for the smallest galaxies), we need to define a second mass threshold so as to exclude structures of lower mass from the galaxy sample used in our analysis (as opposed to the satellite sample, for which this constraint is relaxed: they are allowed to be less massive, in order to capture the whole range of merger ratios for the smallest of our galaxies).

(ii) Such a mass threshold must be low enough so that the analysis covers a wide range of galactic masses well below the transition mass identified in Dubois et al. (2014) around $M_{\text{trans}} \propto 1-5 \times 10^{10} M_{\odot}$, believed to be critical to understand the anisotropy and relative impact of diffuse accretion and mergers.

(iii) $\delta m_{\text{min}}$ must be small enough so that such extremely small mergers which do not contribute significantly to the mass budget of the ‘diffuse accretion + *in situ* formation’ sample do not affect the trends.

For this purpose, we consider only main progenitors with $M_s > 5 \times 10^9 M_{\odot}$. With this prescription, our galaxy finder resolves all the progenitors down to $\delta m = 4.5$ per cent for the lowest mass range.

To check that this threshold leads to include only a sub-dominant clumpy stellar accretion component to the ‘diffuse stellar acquisition’ budget and do not impact the overall trends, we define a control sample as follows.

(i) We run the galaxy finder with $N_{\text{min}} = 20$ (chosen to equate the number of neighbours used to compute local density), with no further consideration on the resolution of such structures and build the corresponding merger trees for the set of 22 outputs previously mentioned.

(ii) We maintain the threshold $M_s > 5 \times 10^9 M_{\odot}$ to define the galaxy sample (i.e. structures with typically more than 2500 particles).

(iii) We restrict the non-merger galaxy sample to galaxies with $\delta m = 0$ according to this new merger tree, i.e. with $\delta m_{\text{min}} < 0.08$ per cent.

This sub-sample which is, in good approximation, only subjected to purely diffuse accretion and *in situ* star formation is referred to as *in situ* star formation for non-mergers or pure *in situ* formation. The
evolution of its size and stellar mass budget is then systematically compared to the one obtained for the sample subjected to diffuse stellar acquisition to check for consistency, as will be developed in relevant sections.

To summarize this classification, diffuse stellar acquisition category is tracked using two operational categories:

(i) the general ‘diffuse stellar acquisition’ category, which contains the sum of *in situ* star formation and stellar accretion for non-mergers and unresolved mergers ($\delta m < 4.5$ per cent),

(ii) the *in situ* star formation control sample for non-mergers ($\delta m < 0.08$ per cent). Note that this latter is, by construction, a sub-sample of the general diffuse category.

To better justify the use of the first category threshold, recall that when a merger is detected, *in situ* star formation from secular evolution is still likely to increase the stellar mass, along with the stellar formation triggered by the merger and direct accretion. If part of the *in situ* stellar formation can indeed be directly attributed to the ongoing merger, recent studies in HORIZON-AGN within the same redshift range suggest that it remains limited to a 20–40 per cent star formation enhancement at best for major mergers (Kaviraj et al. 2014). Moreover, we cannot distinguish between the two forms of *in situ* formation for an individual event. Therefore, it is important to check whether the mass intake between two consecutive outputs is indeed dominated by the merger accretion before attributing such an event to the merger category, so as to strongly limit the transformations mostly due to secular evolution that are wrongly attributed to mergers.

We do find that the mass intake due to diffuse acquisition of stars remains sub-dominant/irrelevant for mergers with high-mass ratios (above 75 per cent of the mass brought by the satellite for $\delta m > 9$ per cent), but it is a coarser approximation for minor mergers and no longer true for mergers with $d_m < 4 - 5$ per cent. In fact, for mergers with $\delta m < 4.5$ per cent, the mass of the stellar material brought by the satellite falls sharp under 20 per cent of the total stellar mass increase between two time steps: while it is still around 55 per cent, on average, for the mass ratio range $4.5 \text{ per cent} < \delta m < 9 \text{ per cent}$ (very minor mergers), it drops sharply to 30 per cent for 3 per cent $< \delta m < 6$ per cent and less than 15 per cent, on average, for 0.08 per cent $< \delta m < 4.5$ per cent. Thus, *in situ* formation strongly dominates the stellar mass intake in this case. This provides further physical justification to the inclusion of remnants of such extremely small mergers in the ‘diffuse stellar acquisition’ sample rather than in a distinct merger category that would be poorly defined (and not complete).

Conversely, the amount of mass that we identify as formed *in situ* when no resolved merger is detected is only a lower limit to the actual, total *in situ* contribution to the stellar mass growth of galaxies: here the only estimate of *in situ* star formation comes when no resolved mergers are detected, while, in fact, *in situ* star formation (and therefore galaxy mass growth) can happen also in between two subsequent snapshots when resolved mergers are detected. The gas which sources such star formation could have been accreted into the star-forming galaxy via cold flows, smooth accretion at earlier times with subsequent cooling via mergers or because of tidal and ram pressure stripping of gas from other galaxies, e.g. incoming satellites. Our methods do not allow us to distinguish among these gas accretion channels and therefore in what follows, we will exclusively refer to unique category of diffuse stellar acquisition which encompasses all processes.

## 2.3 Gas content of galaxies

The gas content of each galaxy and its properties (density, metallicity, pressure, temperature) are extracted from the AMR grid, considering all cells within (or which intersect) an effective radius. For each galaxy in the sample, we define the maximum radius $r_{max}$ as the distance between the galactic centre of mass (COM) and the furthest star particle, the effective radius $r_{0.5}$ as the half-stellar mass radius and $\Delta r_{cell} = r_{0.5}/10$. AMR cells with a size $d_{cell}$ larger than $\Delta r_{cell}$ are subdivided in $2^{3n_c}$ sub-cells with $n_c$, such that $d_{sub-cell} < \Delta r_{cell}$. AMR cells counted as belonging to the galaxy are: (1) AMR cells with a size $d_{cell} < \Delta r_{cell}$ and a centre within the sphere of radius $r_{0.5}$ centred on the COM, (2) sub-cells of larger AMR cells with a length $d_{cell} < \Delta r_{cell}$ and a centre within the sphere of radius $r_{0.5}$ centred on the galaxy COM. This procedure is illustrated on Fig. 1, left-hand panel, which shows a 2D sketch of the cell selection process on a face on projected gas density map for a galaxy from Horizon-AGN with a post-merger sub-structure at $z = 3$.

Note that we do not track the gas inflows on to each galaxy, as our statistical analysis of stellar material already requires an important numerical effort and the detailed analysis of the geometry and rate of the gas accretion is beyond the scope of this paper.

Since the gas needs to be cold and dense enough to be eligible to form stars, we define ‘cold’ gas (in the sense of star-forming gas) the cells with a gas density higher than $n > 0.1 \text{ H cm}^{-3}$ and a temperature $T \le 10^4 \text{ K}$. We also define the gas fraction $f_{gas}$ of a galaxy as $f_{gas} = M_{gas}^{\text{cold}}/(M_{0.5} + M_{gas}^{\text{cold}})$ with $M_{gas}^{\text{cold}}$ the mass of cold gas and $M_{0.5}$ the mass of stars, both enclosed within the sphere of radius $r_{0.5}$.

Fig. 1, right-hand panel, shows the resulting evolution of the average gas fraction across the peak of cosmic star formation history for galaxies of different masses. This quantity decreases with stellar mass and redshift due to star formation and feedback; older galaxies becoming more massive after they used the gas available to form stars and/or after it has been blown out of them by AGN/supernova feedback. This evolution is consistent with previous numerical studies (e.g. Dubois et al. 2012; Popping et al. 2014).

## 2.4 Galaxy morphological classification

The morphology of all galaxies in the sample is characterized through the computation of their stellar inertia tensor.

The inertia tensor $I_{ij}$ of a galaxy is computed from its star particle distribution (indexed by $l$) and calculated at the centre of mass of the galaxy, according to the definition: $I_{ij} = \sum_l m^l (\delta_{ij}(x_k^l x_k^l) - x_k^l x_k^l)$, where $\delta_{ij}$ is the Kronecker symbol, $m^l$ is the mass of star particle $l$ and $x_k^l$ its position in the barycentric coordinate system of the galaxy. As a $3 \times 3$ real symmetric matrix, the inertia tensor can be diagonalized, with its eigenvalues $\lambda_1 > \lambda_2 > \lambda_3$ being the moments of inertia relative to the basis of principal axes $e_1, e_2$ and $e_3$. Modelling galaxies as ellipsoids, the lengths of the semiprincipal axes $a, b$ and $c$ (with $a > b > c$) are straightforwardly derived from the moments of inertia:

$$a = (5/M_{0.5})\sqrt{\lambda_1 + \lambda_2 - \lambda_3}, \text{ along } e_3,$$

$$b = (5/M_{0.5})\sqrt{\lambda_1 + \lambda_3 - \lambda_2}, \text{ along } e_2,$$

$$c = (5/M_{0.5})\sqrt{\lambda_3 + \lambda_2 - \lambda_1}, \text{ along } e_1.$$

Therefore, the morphology of a galaxy can be easily interpreted using its axis ratios: $\xi_1 = c/a$, $\xi_2 = c/b$ and $\xi_3 = b/a$. A perfectly round and infinitely thin disc has $\xi_1 = 0$, $\xi_2 = 0$ and $\xi_3 = 1$. For a Milky Way-like galaxy (including stars from the thin disc, bulge
<figure><img src="image_3.png" /><figcaption>**Figure 1.** Left-hand panel: 2D sketch of the gas cell assignment procedure for one galaxy from Horizon-AGN (shown as a face-on projected gas density map). The thick red circle represents the effective radius $r_{0.5}$ around the galactic centre of mass and the white squares the AMR grid with different levels of refinement. The green tick indicates when a cell or sub-cell is counted as belonging to the galaxy (see the text for detail). Right-hand panel: evolution of the gas fraction $f_{\text{gas}}$ in the redshift range $1.8 < z < 4.5$ for different mass bins, where $M_{0.5}$ is the stellar mass enclosed within the half-mass sphere and $M_{\text{sun}}$ the mass of the sun. Results are consistent with previous simulations (e.g. Popping, Somerville & Trager 2014). $f_{\text{gas}}$ decreases with redshift as star formation consumes the available gas and/or feedback blows it out of the galaxies</figcaption></figure>

and bar), one gets $\xi_1 = 0.06$, $\xi_2 = 0.07$ and $\xi_3 = 0.98$. The limited spatial resolution (1 kpc) of the Horizon-AGN simulation prevents us from obtaining discs as thin as these. We therefore identify discs with our most flattened ellipsoids. Fig. 12 displays rest-frame colour images (u, g and i filters) of a sample of such disc galaxies in Horizon-AGN caught during their pre-merger phase at $z = 2.2$ (two leftmost columns) and their post-merger spheroid phase at $z = 1.9$ (two rightmost columns). The first and third columns are edge-on views and the second and fourth columns are face-on views.

More specifically, we adopt the following classification:

(i) discs are defined as galaxies with $\xi_1 < 0.45$ and $\xi_2 < 0.55$.

(ii) Spheroids have $\xi_1 > 0.7$ and $\xi_2 > 0.8$.

Though these cuts may appear a crude approximation, they are actually consistent with 3D axis ratios reconstructed from observations (Lambas, Maddox & Loveday 1992). Note that we also define the morphology of our galaxies using star particles enclosed within their half-mass radius sphere. We found that this is more robust than using all the star particles identified by our halo finder, especially for post-merger remnants, as these can exhibit elongated tidal features which persist for a considerable amount of time.

## 2.5 Adopted sample of galaxies and merger events

This section provides a short summary of the main definitions constructed and justified in details in the previous sections.

In this paper, we study how galaxies grow and transform around the peak of the cosmic star formation activity, by considering all galaxies of the Horizon-AGN simulation with $M_s > 5 \times 10^9 M_{\odot}$ within 2 Gyr from $z \approx 2$, namely in the redshift range between $z = 5.2$ and $1.2$. When explicitly specified, we increase this threshold up to $M_s > 1 \times 10^{10} M_{\odot}$ to focus on galactic populations that can reasonably be identified in observations at $z < 1$ with significant statistics and hence allow for more straightforward comparison with available observations. This is especially the case when looking at integrated effects over time down to $z = 1.2$ and when focusing

on the effect of mergers only. However, in this case, we further check that results remain qualitatively the same when lowering the threshold down to $M_s > 5 \times 10^9 M_{\odot}$.

This galaxy threshold is identified as the green vertical line in Fig. 2, which displays the mass function for all the structures identified in the simulation (for comparison, we have also plotted the mass function of the Horizon-noAGN simulation, which is the same simulation performed without BHs and therefore AGN feedback). As can be seen in the figure, our sample is complete down to our strict selection threshold of $M_s = 2 \times 10^8 M_{\odot}$, corresponding to galaxies with 100 star particles. Thus, the smallest mergers detectable for galaxies at the $M_s < 5 \times 10^9 M_{\odot}$ threshold correspond to a mass ratio of $\delta m = 4.5$ per cent, which means that our merger history is complete for our galaxy sample down to this mass ratio.

Fig. 3 shows the evolution of the average stellar mass of galaxies with $M_s > 10^{10} M_{\odot}$ at $z = 1.2$, across the peak of cosmic star formation history. The knee at redshift $z = 1.5$ corresponds to a peak in the merger rate and diffuse accretion observed at the same redshift, which is due to the extra level of refinement added at this particular redshift.

Fig. 4 summarizes the five operational categories – two main categories sub-divided into three and two sub-categories, respectively – adopted to classify the processes responsible for this stellar mass growth over cosmic time. They will be used throughout the paper to understand the build-up of stellar mass highlighted in Fig. 3 and quantify the effect of such stellar mass acquisition processes on the size and morphology of galaxies.

## 3 MERGERS ACROSS THE PEAK OF COSMIC STAR FORMATION HISTORY

To quantify the relative contribution of mergers and diffuse processes on to the total mass budget of galaxies over the range of redshifts corresponding to the peak of cosmic star formation history down to $z = 1$, we compute the rates of galaxies having undergone at least a merger within our galaxy sample between $z = 5.2$ and $1.2$.
<figure><img src="image_4.png" /><figcaption>**Figure 2.** Galaxy stellar mass function in Horizon-AGN, for $z = 4–1.3$. $N$ is the number density of galaxies, $M_s$ the stellar mass (together with Horizon-noAGN for comparison). The sharp cut-off at $M_s = 10^8 M_{\odot}$ corresponds to our completeness detection threshold. Observational points from CANDELS-UDS and GOOD-S surveys are rescaled from best fits in Mornlock et al. (2015) and Grazian et al. (2014) and overplotted. While mass functions are consistent at the high-mass end, Horizon-AGN overshoots the low-mass end by about a factor of 3 in this redshift range. The vertical green line shows the selection threshold for our main progenitors candidates, chosen to enable us to completely track their mergers with galaxies up to 20 times smaller.</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>**Figure 3.** Evolution of the average stellar mass of galaxies with $M_s > 10^{10} M_{\odot}$ at $z = 1.2$. The knee corresponds to the triggering of a new level of refinement for the grid.</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>**Figure 4.** Illustration of the five operational categories (in colours, lower boxes) used to describe the physical processes (upper boxes) responsible for the total relative stellar mass growth $\delta m_*$ between redshifts $z_{n-1}$ and $z_n$. $\delta m$ is the merger mass ratio. $n_{prog}$ is the number of progenitors identified between the same redshifts.</figcaption></figure>

We find that at $z = 1.2$, around 35 per cent of galaxies with $M_s > 10^{10} M_{\odot}$ have undergone at least one major merger, 80 per cent a minor merger and 85 per cent a very minor merger. These results are consistent with findings by Kaviraj et al. (2014), (our minor merger rates are slightly inferior due to a coarser redshift sampling). More precisely, in Fig. 5 (left-hand panel), we present the evolution as a function of cosmic time of the probability for a galaxy at $z = 1.2$ not to have undergone any merger of any given type (major, minor, very minor). We focus here on a sub-sample of galaxies in this mass range who possess a progenitor at $z = 5.2$ (sub-sample of 15 000 galaxies). We find that over this 4 Gyr period, ~50 per cent of the sample undergoes a major merger and therefore mergers, especially minor ones, are quite frequent over the whole redshift range. The sample is affected by mergers at an average rate around $1–2 \times 10^{-3}$ and $3–5 \times 10^{-4}$ Gyr$^{-1}$ h$^3$ Mpc$^{-3}$ for all mergers and major mergers, respectively. Note that these values are completely consistent with observations by Lotz et al. (2011) and in good agreement with the cumulative merger rates per galaxy derived from the Illustris simulation (Rodriguez-Gomez et al. 2015).

The right-hand panel of Fig. 5 focuses on galaxies which have had at least a merger between $z = 5.2$ and $1.2$. It shows the probability distribution function (PDF) $P(n, >\delta m)$ for these galaxies to have undergone a number $n$ of mergers of a given mass ratio, $\delta m$, between $z = 5.2$ and $1.2$. This PDF indicates that while most of these galaxies underwent at most a single major merger, on average, they undergo two to three merger events.

Conversely, Fig. 6 shows the evolution of the average mass budget that cannot be attributed to mergers $M_{\text{diffuse}}/M_s$ (average over all galaxies with $M_s > 10^{10} M_{\odot}$ at $z = 1.2$) over cosmic time from $z = 5.2$ to $1.2$, where $M_{\text{diffuse}}$ is the time-integrated mass of stars produced during pure in situ star formation events – when
<figure><img src="image_7.png" /><figcaption>**Figure 5.** Left-hand panel: evolution of a sub-sample of galaxies identified at $z = 1.2$ with $M_s > 10^{10} M_{\odot}$ and which can be tracked to $z = 5.2$. This panel shows the probability for galaxies not to undergo a major or minor merger during the redshift interval. Right-hand panel: PDF of the number $n_m$ of galaxy mergers of a given mass ratio, $\delta m$, undergone between redshifts $5.2 \ge z \ge 1.2$. This PDF is restricted to galaxies with at least one very minor merger. Vertical lines show the average value for each sample. It illustrates the paucity of major mergers: most galaxies which merged have had at most one major merger across this cosmic time interval, while they go through, on average, two to three mergers. Note the large variations from one galaxy to another.</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>**Figure 6.** Evolution of the non-merger related mass ratio $M_{\text{diffuse}}/M_s$ (average over all galaxies with $M_s > 10^{10} M_{\odot}$ at $z = 1.2$) over cosmic time from $z = 5.2$ to $1.2$, where $M_{\text{diffuse}}$ is the time-integrated mass of stars produced during pure *in situ* star formation events – when no merger occurs – (green curve) or during diffuse stellar acquisition events, i.e. when no or only unresolved mergers occur (red curve). At $z = 1.2$, about half of the stellar mass of these galaxies comes from such diffuse acquisition processes.</figcaption></figure>

no merger occurs – (green curve) or during diffuse stellar acquisition events, i.e. when no or only unresolved mergers occur (red curve). At $z = 1.2$, about half of the stellar mass of these galaxies was built during such pure diffuse acquisition phases. Recall that

merger-related stellar mass acquisition encompasses both the stars accreted from progenitors and the stars formed through starbursts triggered the merger (in addition to a sub-dominant secular component), although we checked that with our merger categories and mass ratio threshold, the accreted mass budget is systematically dominant. This highlights, however, the importance of both mergers and diffuse stellar acquisition processes on the build-up of the galaxy stellar mass.

In conclusion, one needs to account for the possibility that mergers and diffuse stellar acquisition processes might both play a role in driving galaxies evolution, at least as far as the mass build-up is concerned. In the next sections, we explore whether their impact on the size and morphology of galaxies compare or show very distinct features.

# 4 GROWTH OF GALAXY SIZES

## 4.1 Preamble on stellar density

Fig. 7 shows the evolution of the stellar density, obtained by adding the masses of all star particles enclosed within the half-mass radius of the galaxy. Since the shape of galaxies can vary significantly over the cosmic time interval spanned by our study, especially when galaxies merge, we take anisotropy into account. More specifically, the density $\rho$ is defined as $\rho = 3M_{0.5}/(4\pi abc)$, with $a > b > c$ the lengths of the semiprincipal axes of the galaxy derived from the eigenvalues of the inertia tensor and $M_{0.5}$ is the sum of all the masses of the star particles contained within its half-mass radius. The left-hand panel of the figure shows the PDF of the relative density growth $\mu = 2(\rho_{n+1} - \rho_n)/(\rho_n + \rho_{n+1})$, where $\rho_n$ is the average density of the galaxy within its half-mass radius at time step $n$, stacked for each time output of the simulation between $1.2 \le z \le 5.2$. Note how mergers tend to widen the distribution, populating the high-compactions and high-dilatation tails of the
<figure><img src="image_9.png" /><figcaption>**Figure 7.** Left-hand panel: PDF of the density growth ratio $\mu = 2(\rho_{n+1} - \rho_n)/(\rho_n + \rho_{n+1})$, where $\rho_n$ is the density of the galaxy within its half-mass radius at time step $n$, for different merger mass ratios. This ratio is calculated for galaxies with $M_s > 5 \times 10^9 M_{\odot}$ over each time step within the range $1.2 \le z \le 5.2$ and all these time steps are then stacked. Each vertical dashed line shows the average value for the merger mass ratio bin of the corresponding colour. Mergers have a tendency to widen the distribution and increase the stellar density, especially major mergers (vertical dashed line on the positive side of $\mu$ values). However, this behaviour is actually different for galaxies which are discs prior to the merger (for which the stellar density rises: middle panel) and for those which are originally spheroids (for which the stellar density decreases: right-hand panel).</figcaption></figure>

distribution. Looking at this panel, one might think that diffuse stellar intake and very minor mergers tend to lower the density of the merger remnant on average, while minor and major mergers tend to increase it, but it is actually highly dependent on the initial morphology of the galaxy. This can be seen on the middle and right-hand panels of Fig. 7. Galaxies that are initially discs show an increased stellar density after mergers, the effect being stronger the higher the mass ratio of the merger. On the other hand, galaxies which begin as spheroids tend to have their stellar density decreased by mergers, the effect being statistically stronger for minor mergers. 55 per cent of spheroids which merge betray a decrease in stellar density after ~200 Myr and only 40 per cent of the non-merger galaxies do the same. It is interesting to note that, in both cases, this increase/decrease in average density is related to how skewed the distribution becomes and not only to a global drift towards positive/negative values. As a result, minor and major mergers of spheroids are much more likely to trigger important decreases in stellar density (by more than a factor of 2) than diffuse processes: 16 per cent of cases versus 5 per cent, respectively, and even as low as 3 per cent if events where stars are accreted below our galaxy mass threshold are discarded. Around 8 per cent of major mergers and even fewer minor mergers trigger dilatations by more than a factor of 5.

Similarly, 73 per cent of disc galaxies increase their density after merging (against 63 per cent for non-mergers). However, and more importantly, 30 per cent of these mergers increase it by at least a factor of 2 as compared to only 9 per cent for diffuse stellar acquisition. Finally, only 10 per cent of the major mergers and the minor mergers lead to compactions by more than a factor of 5.

These results statistically support the claim that mergers turn discs into denser structures while they tend to lower the density of spheroids. Moreover, although major mergers are found to be quite rare, the ability of the more frequent minor mergers to trigger effects of comparable amplitude points towards an important role of multiminor mergers in driving the size-mass relationship of early-type galaxies (Kaviraj 2014).

## 4.2 Effects on galaxy sizes

We further analyse the role of mergers in driving galaxy stellar density evolution in Fig. 8, by looking at the relation between growth in stellar mass and growth in stellar half-mass radius.

The top panels show the evolution of the average half-mass radius $r_{0.5}$ as a function of redshift when we split our galaxy sample in bins of ‘final’ mass (i.e. galaxy masses at redshift $z = 1.2$; top left panel) and in bins of constant stellar mass (i.e. independent of redshift; bottom right panel). These results are consistent with the overall evolution of the size-mass relationship from observations such as Huertas-Company et al. (2013) (though our simulated galaxies are a factor of ~2 larger): galaxies of a given stellar mass display much larger radii at $z = 1.2$ than their counterparts of similar stellar mass at $z = 5.2$; most of the growth taking place between $z = 3$ and 1.2. More specifically, at $z = 1.2$, galaxies with $M_s > 10^{10.5} M_{\odot}$ display an average half-mass radius two to three times bigger than their counterparts at $z = 3$ (see bottom right panel), while one can see on the bottom left panel that galaxies reaching $M_s > 10^{10.5} M_{\odot}$ at $z = 1.2$ have also seen their half-mass radius grow by a factor of 2 to 3 since $z = 3$ and by a factor of 4 since $z = 5.2$.

To better investigate the role of different stellar acquisition processes in growing the size of galaxies, we compute the logarithmic derivative of the half-mass radius $r_{0.5}$ with respect to $M_s$ as a function of the merger mass ratio $\delta m$ for post-merger structures (bottom left panel, blue curve) and the mass increase ratio $\delta m_* = \Delta m/M_s \propto \Delta \log_{10} M_s$, where $\Delta m$ is the stellar mass accreted between two consecutive outputs, for galaxies only subjected to diffuse stellar accretion (green curve for pure in situ formation and red curve when including possibly unresolved mergers). This is computed for all galaxies and all time outputs between $z = 5.2$ and $1.2$ with $M_s > 5 \times 10^9 M_{\odot}$. Note that $M_s$ or $M_{0.5}$ are equivalent for the purpose of this comparison so we use them interchangeably. The result is shown in the top left panel of Fig. 8. Note the similarity between results for the pure star formation sample (in green) and the full sample of galaxies undergoing diffuse stellar accretion with
<figure><img src="image_10.png" /><figcaption>**Figure 8.** Top left panel: evolution of the half-mass radius as a function of redshift for galaxies split into bins of different mass at redshift $z = 1.2$. Top right panel: same plot as in the bottom left panel but for galaxies split into redshift-independent mass bins. Bottom left panel: evolution of the logarithmic derivative of the half-mass radius $r_{0.5}$ with respect to the mass ratio $\delta m_* = \Delta m / M_s$ ($\Delta m$ is the stellar mass gained between two consecutive outputs) for non-mergers or $\delta m$ the mass ratio of the merger, for all galaxies with $M_s > 5 \times 10^9 M_{\odot}$ and all time outputs between $z = 5.2$ and 1.2. Filled blue symbols indicate resolved mergers, red and light green ones represent non-merger diffuse mass acquisition, with unresolved mergers (in red) or not (in green). Whilst the evolution is linear in each case, the dependence of radius growth on the mass ratio is found to be much steeper for mergers. Bottom right panel: same plot as the top left panel, except that we have split the merger sample according to different pre-merger morphologies: discs (light blue) and spheroids (red). The steepness of the radius versus $\delta m$ relation appears mainly caused by minor merger disruption of the discs.</figcaption></figure>

$\delta m < 4.5$ per cent (in red). At fixed amount of stellar mass, mergers are much more efficient drivers of galaxy size growth. Ignoring the very shallow dependence on $\delta m$, diffuse mass acquisition processes lead to an average radius–mass relation $r_{0.5} \propto M_s^\alpha$ with $\alpha = 0.1 \pm 0.05$. Slightly higher values of $\alpha$ are reached for higher $\delta m$ (see left-hand panel of Fig. 8), but always remain within a factor of 2, i.e. $\alpha \le 0.2$, with an average evolution $r_{0.5} = M_s^{0.3\delta m_*}$.

For mergers, we obtain $r_{0.5} \propto M_s^\beta$ with $\beta = 0.85 \pm 0.3$ (average on unbinned data). Taking into consideration the shallow evolution with $\delta m$, $\beta$ also increases with $\delta m$ as $r_{0.5} = M_s^{0.65+\delta m}$ up to values $\sim 1.2$ for major mergers (linear regression on binned data). These values are consistent with observations (e.g. Cimatti, Nipoti & Cas-sata 2012; Newman et al. 2012; Huertas-Company et al. 2013; van der Wel et al. 2014, who found a value of $\beta$ around $\simeq 0.6–0.8$.
<figure><img src="image_11.png" /><figcaption>**Figure 9.** Left-hand panel: average mass ratio versus relative variation of the half-mass radius $\Delta r_{0.5}/r_{0.5}$ for mergers with gas fraction $f_{\text{gas}} < 0.6$ (yellow) and $f_{\text{gas}} > 0.6$ (blue). Horizontal dashed lines show major/minor/diffuse intake separation thresholds in $\delta m$. The vertical dashed line indicates the border between expansion (positive values) and contraction (negative values). Note how radius contraction is confined to wet minor mergers. Right-hand panel: evolution of the relative variation of the half-mass radius as a function of the merger mass ratio for all galaxies which undergo a merger between $z = 5.2$ and $1.2$ and for different pre-merger gas fractions: $f_{\text{gas}} < 0.2$ (pink symbols), $f_{\text{gas}} < 0.6$ (yellow symbols) and $f_{\text{gas}} > 0.6$ (blue symbols). The error bars plotted correspond to $1\sigma$ errors. Horizontal dashed lines represent $r_{0.5} \propto M_s^\gamma$, with $\gamma = 1$ and $2$ which are predicted size-mass relations for (dry) major and minor mergers using the virial theorem (Hilz et al. 2012; Dubois et al. 2013). Note how the presence of gas limits the radius growth.</figcaption></figure>

for early-type galaxies) and together with the smaller values of $\alpha$, support the idea that the size growth of galaxies is mostly driven by mergers (Boylan-Kolchin et al. 2006; Nipoti et al. 2009; Feldmann et al. 2010; Dubois et al. 2013).

Focusing on the bottom right panel of Fig. 8, we see that the dependence of the size-mass relationship on merger mass ratio can be interpreted as a morphological effect: galaxies that are spheroids prior to the merger (red data points) systematically grow in size almost indistinctively with mass ratio (except for the most extreme major mergers), whilst discs (blue data points) exhibit a size growth proportional to the accreted mass ratio over the same range in $\delta m$. Note that van der Wel et al. (2014) find a different size-mass evolution for early-type and late-type galaxies with $\beta \simeq 0.75$ and $0.22$, respectively, with negligible evolution with redshift. In our simulation, we find that spheroids (i.e. early-type galaxies) have $\beta = 1.2$ on average and discs (i.e. late-type galaxies) have $\beta \simeq -0.5$ for low values of $\delta m$ and $\beta \simeq 0.5$ for large values of $\delta m$, which shows a similar discrepancy of the size-mass evolution between different galaxy morphologies to that observed in van der Wel et al. (2014). This stresses the need to study the morphology of our galaxies in further detail, which we do in the next section.

## 4.3 Galaxy sizes and wet versus dry mergers

However, Fig. 8 does not distinguish gas-rich and gas-poor mergers. This could be potentially important as gas-poor mergers are known to trigger intense size growth of local early-type galaxies (e.g. Naab et al. 2007; Feldmann et al. 2010), whereas accretion of gas (by gas-rich mergers or smooth accretion) is thought not to be able to drive such growth since their gas shocks radiatively and loses angular momentum, therefore piling up in the central region of the galaxy where it rapidly turns into stars and causes size contraction. The left-hand panel of Fig. 9 lends statistical support to this claim.

It shows the average value of the merger mass ratio $\delta m$ which leads to a given relative variation of the half-mass radius $\Delta r_{0.5}/r_{0.5}$, for mergers with $f_{\text{gas}} > 0.6$ (blue data points) and $f_{\text{gas}} < 0.6$ (yellow data points). From these data, one can see that radius contraction (negative values of $\Delta r_{0.5}/r_{0.5}$) is confined to gas-rich minor mergers (blue data points with $0.09 < \delta m < 0.2$). The corresponding yellow data points for gas poor mergers are below – or very close to – the merger resolution threshold (lower horizontal dashed line), indicating that diffuse stellar acquisition processes are, in fact, the leading advection processes in those cases. Interestingly enough, major mergers with $\delta m > 0.2$ statistically never lead to a compactification of galaxies, regardless of whether they are gas rich or not: the violent disruption that they trigger does not translate into a funelling of material to the central region as it does for minor mergers, but as an extended redistribution of it. Note that the threshold of $f_{\text{gas}} = 0.6$ is chosen high compared to the values traditionally used to define wet and dry mergers at low redshift because galaxies are more gas-rich, on average, in the redshift range of this study. One can get an idea of how much smaller the sample gets when this threshold is lowered to $f_{\text{gas}} = 0.2$ by looking at the right-hand panel of Fig. 9.

This panel presents the dependence of the logarithmic derivative of the half-mass radius $r_{0.5}$ on the mass ratio $\delta m$ for our sample of galaxies split into different pre-merger gas fraction bins. One can see that star-rich mergers with $f_{\text{gas}} < 0.6$ (in yellow), especially minor ones ($0.09 < \delta m < 0.2$), induce a more efficient radius growth than their gas-dominated counterparts of similar mass ratio (in blue). Gas-deprived mergers with $f_{\text{gas}} < 0.2$ (pink curve), whether major or minor, lead to a rapid growth of the effective radius compatible with $r_{0.5} \propto M_s^\gamma$, where $\gamma = 2 \pm 0.5$. This power-law index is in excellent agreement with predictions from Hilz et al. (2012) and consistent with previous numerical studies (Boylan-Kolchin et al. 2006; Nipoti et al. 2009; Feldmann et al. 2010), although slightly higher, which
therefore lends extra support to the scenario involving multiple dry
mergers to explain the loss of compacity of massive early-type
galaxies at low redshifts.

5 IMPACT ON GALAXY MORPHOLOGIES

Let us now focus on the morphology transformations of galaxies.
We describe them computing the principal semi-axis ratios $\xi_1 = c/a$,
$\xi_2 = c/b$ and $\xi_3 = b/a$ with $a > b > c$ of the inner half-mass stellar
component, derived by calculating the inertia tensor of the galaxy.

This morphological transformation strongly depends on the mass
and morphology of galaxies. Let us recall that we define spheroids
as galaxies with $\xi_1 > 0.7$ and $\xi_2 > 0.8$ and discs as galaxies with
$\xi_1 < 0.45$ and $\xi_2 < 0.55$.

**5.1 Diffuse stellar mass growth processes.**

In what follows, we study separately the effects on galaxy mor-
phologies of diffuse stellar acquisition processes. Fig. 10 displays
the time evolution of the principal semi-axis ratio cumulative proba-
bility density functions for galaxies only subjected to diffuse stellar
acquisition ($\delta m < 4.5$ per cent) for the full sample of galaxies ir-
respective of initial morphology (upper panels, purple curves) and
for galaxies initially classified as spheroids (red curves and sym-
bols) or discs (blue curves and symbols) on the middle and bottom
panels. The middle panels focus on galaxies with a stellar mass
comprised between $5 \times 10^9$ and $10^{10.5} M_{\odot}$, the lower panel on
more massive galaxies with $M_s > 10^{10.5} M_{\odot}$. This mass threshold
corresponds to the transition mass above which galaxies embedded
in filaments decouple from their vorticity quadrant and display a
spin perpendicular to their closest filament (see Dubois et al. 2014;
Laigle et al. 2015) and also to the transition in gas accreted on to the
galaxy between cold and hot mode (e.g. Dekel & Birnboim 2006;
Ocvirk et al. 2008).

On the upper panels, one can see that while $\xi_3$ tends to remain
constant over cosmic time, with a value strongly peaked at 1 (large
axis equals to intermediate axis), both average values of $\xi_1$ and
$\xi_2$ decrease at an average rate of almost 10 per cent per Gyr, from
0.64 and 0.74 down to 0.54 and 0.64, respectively, in the 4 Gyr
which separate $z=5.2$ and 1.2. For reference, note that an infinitely
thin and homogeneous disc has $\xi_1 = \xi_2 = 0$ and $\xi_3 = 1$, while
a perfect sphere has $\xi_1 = \xi_2 = \xi_3 = 1$. Our result indicates that
diffuse stellar acquisition processes tend to flatten galaxies over time
along the minor axis, which coincides with the spin axis. However,
this stellar acquisition has no significant effect on the circularity of
galaxy discs.

This behaviour is qualitatively similar to that observed for the sub-
sample of spheroids, highlighting the high statistical significance of
the flattening of spheroids on the evolution of the full sample mor-
phologies. Indeed, focusing now on the initially spheroid population
in the lower mass range (middle panels), one can see that ξ₃ tends
to remain constant over cosmic time, with a value strongly peaked
at 1 (large axis equals to intermediate axis), while both average
values of ξ₁ and ξ₂ also decrease in that case, with similar conclu-
sions than for the full sample analysis. The decrease rate in ξ₁ and
ξ₂ is, however, found to be greater, around 20 per cent per Gyr for
spheroids with masses below the transition mass (or from average
values of ξ₁ = 0.7 and ξ₂ = 0.8–0.56 and 0.66, respectively).

On the other hand, discs tend to thicken slightly on average (go-
ing from $\xi_1 = 0.46$ and $\xi_2 = 0.56$ to 0.5 and 0.64, respectively).
This behaviour for the discs at least partially arises from the limited
maximum spatial resolution of the simulation (1 kpc). By definition,

discs with scaleheights below this value are artificially ‘puffed up’
to 1 kpc and any accretion of new material, no matter how dynam-
ically cold, can only result in increasing this minimal numerical
scaleheight. This especially alters the shape of small galaxies, for
which the scalelength is also poorly resolved.

The same analysis restricted to the pure in situ formation sub-
sample presented on Fig. A1 in Appendix A suggests, however, that
clumpy accretion might be directly responsible for the ‘puffing-
up’ of discs as this effect is strongly damped when imposing
$\delta m < 0.08$ per cent. For galaxies with masses above the transition
mass (bottom panels of Fig. 10), we do not observe any significant
impact of diffuse processes on the morphology indicators which
remain constant on average.

**5.2 Effects of mergers.**

Let us now investigate the effect of mergers on these morphological
parameters. In Fig. 11, upper panels display the cumulative PDFs of
the $\xi_i$ indicators of post-merger structures (i.e. structures at time step
$z_{n+1}$ with a merger identified between $z_{n-1}$ and $z_n$) for different
merger mass ratios and for galaxies with $M_s > 10^{10} M_{\odot}$ identified
as discs prior to merging. For comparison, the bottom panels show
the cumulative PDF $\xi_1 = c/a$ (as for discs, $\xi_1$ and $\xi_2 = b/a$ were
found to vary likewise and $\xi_3 = c/b$ to show very little variation
with $\delta m$) over one time step for galaxies identified as spheroids (left-
hand panel) and for all galaxies with $M_s > 10^{10} M_{\odot}$ regardless of
their morphology (right-hand panel).

As can be seen on the upper panels of Fig. 11, mergers trigger
an evolution that is very different from diffuse stellar acquisition
processes for initially discy galaxies. This figure showcases a qual-
itative difference: contrary to diffuse accretion, both minor and ma-
jor mergers strongly affect the disc morphology, leading to much
more spheroidal/elliptical structures over ≈200–400 Myr. There
are, however, quantitative differences between minor and major
mergers. Whilst major mergers clearly destroy discs (the average
value of the PDF of $\xi_1 = c/a$ shifts from 0.45 to 0.62, red and dark
blue curves, respectively), minor mergers have a more limited ef-
fect ($\xi_1$ PDF average value shifted from 0.45 to 0.52 only). Finally,
the effect of very minor mergers (light orange curve) is closer to a
thickening of the discs than their actual destruction and a change in
morphology. It is important to note that all mergers also trigger an
increase in the scatter of the distribution of galactic discs morphol-
ogy indicators $\xi_i$, as the slope of the PDFs becomes shallower for
mergers than diffuse stellar acquisition. This effect is stronger for
higher merger mass ratios.

However, this transformation into rounder structures holds true
mostly for discs. As can be seen in Fig. 11, on the bottom left panel,
for galaxies initially identified as spheroids, minor mergers display
a behaviour closer to the one expected from diffuse acquisition
processes. They tend to flatten the galaxy. Only major mergers
tend to create more spheroidal structures, although this effect is
expectedly less striking than for initial discs. This flattening of
spheroids through minor mergers is explained by the accretion of
small satellites with high orbital momentum. Further analysis of
such mergers with high gas fractions at $z < 1$ may be useful to
determine if this effect can contribute significantly to the re-building
of discs at low redshift.

Expectedly, the bottom right panel of Fig. 11 – where the full
sample is taken into account irrespective of initial morphology –
displays an intermediate evolution between the two previously
analysed specific populations.
<figure><img src="image_12.png" /><figcaption>**Figure 10.** Cumulative PDFs of the principal semi-axis ratios $\xi_i$ for galaxies which do not merge. Upper panels: full sample evolution. Colours evolve with cosmic time from dark purple ($z = 5.2$) to light lilac ($z = 1.2$) with an average time step of ~200 Myr. Middle panels: galaxies with $9.7 < \log(M_s/M_\odot) < 10.5$. Colours evolve with cosmic time from navy blue ($z = 5.2$) to light blue ($z = 1.2$) for discs and dark red ($z = 5.2$) to light pink ($z = 1.2$) for spheroids. The $1\sigma$ Poissonian error bars are overplotted for all bins that have a non-zero probability. Bottom panel: galaxies with $\log(M_s/M_\odot) > 10.5$ with same colour coding as previously mentioned (spin flip and cold/hot mode for accretion transition mass: see the text for detail). Diffuse processes of mass acquisition have little impact on the morphology of galaxies above the transition mass but clearly flatten galaxies below it.</figcaption></figure>

These findings corroborate the view that major and multiple minor mergers can lead to galaxies with similar morphologies, destroying discs and turning them into spheroids (e.g. Bournaud et al. 2007). This allows us to overcome the tension occasioned by the paucity

of major mergers: minor mergers are much more frequent events, allowing for the formation of a much larger spheroid population. An illustration of this phenomenon is given in Fig. 12 which depicts rest-frame synthetic colour images of a sample of disc galaxies in
<figure><img src="image_13.png" /><figcaption>**Figure 11.** Effects of mergers on galaxies identified as pre-merger discs (top three panels), pre-merger spheroids (bottom left panel) or with any morphology (bottom right panel). Top panels: cumulative PDFs of the morphology indicators $\xi_i$ for different merger mass ratios and for galaxies with $M_s > 10^{10} M_{\odot}$ identified as pre-merger discs. The Poissonian $1\sigma$ error bars are indicated for all bins with more than 10 galaxies. The results are stacked for each time output between $z = 5.2$ and $1.2$. Mergers broaden the morphology distribution and quantitatively destroy discs. This effect strengthens with increasing merger mass ratios. Bottom left panel: cumulative PDF of $\xi_1 = c/a$ over one time step, with all time steps between $z = 5.2$ and $1.2$ stacked, for different merger mass ratios and for galaxies with $M_s > 10^{10} M_{\odot}$ classified as spheroids before they merge. Bottom right panel: same plot for all galaxies with $M_s > 10^{10} M_{\odot}$</figcaption></figure>

the Horizon-AGN simulation before and after major/minor merging observed through the *u*, *g* and *i* filters. In particular, it displays three examples of initial discs with masses ranging from $M_s = 10^{9.7}$ to $10^{10.5}$ destroyed and turned into spheroids after a minor merger. They produce remnants very similar to the one observed for the disc destroyed by a major merger, presented in the lower panel.

## 6 DISCUSSION

Interpreting our results in the light of the scenario described by Pichon et al. (2011), Codis et al. (2012) and Laigle et al. (2015), whereby small galaxies acquire their spin through angular momentum transfer from coherent accretion from the vorticity quadrant they are embedded in, the ‘flattening’ effect of galaxies and, in particular, spheroids with $M_s < 10^{10.5} M_{\odot}$, can be understood as the (re)-formation of discs in high-vorticity regions at the heart of cosmic web filaments. In other words, diffuse stellar acquisition (noticeably including *in situ* formation from cold flows) tends to (re)-align galaxies with their nearest filament (Tillson et al. 2012; Danovich et al. 2014; Welker et al. 2014) where the dominant component in this process, for galaxies below the transition mass, is coherent gas feeding from cold flows. At the opposite end of the mass spectrum, galaxies above the transition mass accrete material from multiple quadrants and/or smaller amounts of material along

a unique filament. The angular momentum streamed to the core of these massive galaxies from multiple directions is more likely to cancel out, which results in little to no effect of diffuse accretion on the morphology of the galaxy. It is, in particular, encouraging that the stellar transition mass above which diffuse stellar acquisition ceases to impact galactic morphologies in our study (around $10^{10.5} M_{\odot}$) is completely comparable to the one previously measured for spin orientation transition in Dubois et al. (2014) and fully consistent with measurements of the corresponding halo mass by Codis et al. (2012). These results reinforce earlier findings that the underlying cosmic web plays a major role in shaping galaxy properties.

Similarly, the shallow dependence on $\delta m_*$ of the mass–size relationship established for galaxies undergoing only diffuse stellar acquisition processes can be explained by the fact that higher relative mass growth values most often correspond to lower stellar masses, for which cold flows bring in more specific angular momentum than hot phase accretion in more massive galaxies (Kimm et al. 2011).

## 7 CONCLUSION

Understanding the evolution in mass, size and morphology of galaxies across cosmic time remains a great challenge of modern
<figure><img src="image_14.png" /><figcaption>**Figure 12.** Rest-frame colour images (u, g and i filters) of a sample of Horizon-AGN disc galaxies caught during their pre-merger phase at $z = 2.2$ (two leftmost columns) and their post-merger phase at $z = 1.9$ (two rightmost columns). The first and third columns are edge-on views and the second and fourth columns are face-on views. Extinction by dust is not taken into account. Each frame is 100 kpc on a side. $M_s$ is the stellar mass of the main progenitor in $M_{\odot}$ units and $\delta m$ is the mass ratio of the merger (see the text for exact definition). This figure illustrates the ability of mergers (major but also minor) to turn disc-like galaxies into spheroids.</figcaption></figure>

astrophysics. Observations of galactic kinematics, morphologies and colours are progressively becoming available beyond $z > 1$, unravelling a wide range of galactic types and numerous dynamical models are being developed to reproduce this diversity. However, identifying statistically relevant progenitors of given galactic populations observed at $z = 0$ – in particular, the massive spheroid population – proves extremely complex. Without such a reliable identification, the quality and relevance of evolutionary models remains hard to assess. In this context, modern hydrodynamical cosmological simulations provide a unique opportunity to trace back in time the progenitors of large samples of galaxies, hence allowing us for a rigorous statistical analysis of their successive transformations. In this study, we used the Horizon-AGN simulation in the redshift range $5 > z > 1$, which constitutes the peak of cosmic star formation history, to investigate galactic evolution in a realistic context that includes feedback and environmental effects. This simulation was indeed found to recover the wide diversity of observed galaxies in terms of mass, colour and shape (Dubois et al. 2014). By adopting the results of halo finder and merger tree techniques to the output-simulated data, we identified two classes of events/galaxies

between all the available pairs of subsequent snapshots (average $\delta t$ of 200 Myr): (1) galaxies which have undergone at least one resolved mergers ($\delta m > 4.5$ per cent); (2) galaxies which have experienced diffuse stellar acquisition ($\delta m < 4.5$ per cent, including $\delta m = 0$) We were able to identify their relative impact, either re-enforcing or competing, on specific galactic properties (size and morphology) that allow for the description of distinct galactic populations. Our findings are the following.

(i) While diffuse stellar acquisition processes (smooth accretion, in situ formation,...) are steady processes with regular impact on stellar mass over cosmic history, mergers are violent processes which occur on average twice in the history of a galaxy over this epoch.

(ii) Mergers and diffuse processes augment galaxy sizes across the peak of cosmic star formation history, especially major mergers, but this growth strongly depends on redshift and gas fraction. We also found that while mass is accreted, the mean density also rises for galaxies which are pre-merger discs, suggesting a gravitational contraction during the merger phase, while the inverse is true for pre-merger spheroids which, on average, expand after merging.
(iii) For mergers of mass ratio $\delta m$, the relative increase in radius is found to evolve as a power law of the stellar mass $r_{0.5} = M_s^{0.65+\delta m}$ (average $\beta = 0.85$), while the material of comparable mass ratio $\delta m_*$ produced *in situ* proves much less efficient in growing galaxy radii $r_{0.5} = M_s^{0.35m_*}$ (average $\alpha = 0.1$). Moreover, while the growth of spheroid sizes shows little dependence on $\delta m$ ($r_{0.5} \propto M_s^{1.2}$), discs show a stronger dependence on $\delta m$ and even display a contracting trend when subjected to minor mergers ($r_{0.5} \propto M_s^{-0.5/0.5}$).

(iv) Gas fraction also plays an important part in determining the size growth consecutive to mass accretion. As expected, gas-dominated mergers induce a much more limited growth in size than star-dominated ones. In such gas-rich mergers, the remnant appears to be more compact. We interpret this as the result of gas shocking, losing angular momentum and being transported to the central parts of the galaxy where it forms stars, seemingly triggering a gravitational contraction of the galaxy. In contrast, star-dominated mergers (with $f_{gas} < 0.2$) induce an increased growth in radius with no significant dependence on merger mass fraction, but the steepest dependence on stellar mass that we measure ($r_{0.5} = M_s^2$).

(v) These accretion processes are found to have a strong impact on galaxy morphologies. Diffuse stellar acquisition processes tend to flatten small galaxies long their minor axis. This is the case for galaxies in the mass range $10^{0.7}M_{\odot} < M_s < 10^{10.5}M_{\odot}$, consistently with the idea that those galaxies are embedded in vorticity quadrants around a cosmic filament which feed them angular momentum coherently along the filament direction. This effect is even clearer for the sub-sample of spheroids fed only by these diffuse stellar acquisition processes which evolve to resemble the disc population in just over 2 Gyr. In contrast, mergers tend to destroy discs and form spheroids, except for very minor mergers – which only thicken them – in agreement with the idea that in this case, the satellite is slowly stripped from its gas and stars in the galactic plane of the main progenitor. But our main result is that minor mergers are responsible for a comparable amount of disc destruction than major mergers, coupled with a strong contraction effect when the minor merger happens to be a gas-dominated ($f_{gas} > 0.6$) galaxy.

These results altogether statistically favour a scenario whereby galaxies grow their stellar mass by diffuse stellar acquisition processes (smooth accretion of gas, *in situ* formation, stripping) and mergers, but grow in size mostly through merging: disc (gas-dominated) galaxies merge to become more compact spheroids while spheroids lose their compactness through these same minor mergers. Occasionally, dramatic growth in size through rare major mergers and multiple, gas-deprived minor mergers happens. Non-merging spheroids with masses up to a transition mass around $10^{10.5}M_{\odot}$ then rebuild discs from coherent smooth accretion. Above this mass, the coherence of streams is lost and morphology is preserved.

Though this first study supports – in a full cosmological context using the Horizon-AGN simulation – the consistent galaxy growth model that has emerged from previous numerical studies of different types of mergers, further investigation is required to extend these results down to $z=0$ and to specify in detail the role played by galactic physics – more specifically supernovae and AGN feedback – in shaping these results. Analysing more specific merger parameters such as the impact parameter and the orbital-to-intrinsic angular momentum transfer rate will also be necessary to understand the scattering of the morphology and size distributions induced by mergers and understand their overall impact on observed galaxies in the local Universe. Finally, the internal kinematics of the galaxy population also need to be examined more closely.

## ACKNOWLEDGEMENTS

This work was granted access to the HPC resources of CINES (Jade) under the allocation 2013047012 and c2014047012 made by GENCI. This research is part of the Spin(e) (ANR-13-BS05-0005, http://cosmicorigin.org) and Horizon-UK projects. Let us thank D. Munro for freely distributing his YORICK programming language and opengl interface (available at http://yorick.sourceforge.net/). We warmly thank S. Rouberol for running the Horizon cluster on which the simulation was post-processed. Part of the analysis was also performed using the DiRAC facility jointly funded by BIS and STFC. The research of JD is supported by Adrian Beecroft, The Oxford Martin School and STFC. CP thanks Churchill college Cambridge and KIAS, Seoul, for hospitality while this work was finalized.

## REFERENCES

Agertz O., Teyssier R., Moore B., 2009, MNRAS, 397, L64

Aubert D., Pichon C., Colombi S., 2004, MNRAS, 352, 376

Bédorf J., Portegies Zwart S., 2013, MNRAS, 431, 767

Booth C. M., Schaye J., 2009, MNRAS, 398, 53

Bournaud F., Combes F., Jog C. J., 2004, A&A, 418, L27

Bournaud F., Jog C. J., Combes F., 2005, A&A, 437, 69

Bournaud F., Jog C., Combes F., 2007, A&A, 476, 1179

Boylan-Kolchin M., Ma C.-P., Quataert E., 2006, MNRAS, 369, 1081

Brooks A. M., Governato F., Quinn T., Brook C. B., Wadsley J., 2009, ApJ, 694, 396

Chen C. et al., 2014, preprint (arXiv:e-prints)

Choi E., Ostriker J. P., Naab T., Oser L., Moster B. P., 2014, preprint (arXiv:e-prints)

Cimatti A., Nipoti C., Cassata P., 2012, MNRAS, 422, L62

Codis S., Pichon C., Devriendt J., Slyz A., Pogosyan D., Dubois Y., Sousbie T., 2012, MNRAS, 427, 3320

Cooper M. C. et al., 2012, MNRAS, 419, 3018

Cretton N., Naab T., Rix H.-W., Burkert A., 2001, ApJ, 554, 291

Danovich M., Dekel A., Hahn O., Ceverino D., Primack J., 2014, preprint (arXiv:e-prints)

De Lucia G., 2007, in Metcalfe N., Shanks T., eds, ASP Conf. Ser. Vol. 379, Cosmic Frontiers. Astron. Soc. Pac., San Francisco, p. 257

Dekel A., Birnboim Y., 2006, MNRAS, 368, 2

Dekel A. et al., 2009, Nature, 457, 451

Devriendt J. et al., 2010, MNRAS, 403, L84

Di Matteo T., Colberg J., Springel V., Hernquist L., Sijacki D., 2008, ApJ, 676, 33

Dubois Y., Devriendt J., Slyz A., Teyssier R., 2012, MNRAS, 420, 2662

Dubois Y., Gavazzi R., Peirani S., Silk J., 2013, MNRAS, 433, 3297

Dubois Y. et al., 2014, MNRAS, 444, 1453

Feldmann R., Carollo C. M., Mayer L., Renzini A., Lake G., Quinn T., Stinson G. S., Yepes G., 2010, ApJ, 709, 218

Forster Schreiber N. M. et al., 2006, ApJ, 645, 1062

Genzel R. et al., 2008, ApJ, 687, 59

Grazian A., Fontana A., Santini P., Dunlop J. S., Ferguson H. C. et al., 2014, preprint (arXiv:e-prints)

Guo Q., White S., 2008, MNRAS, 384, 2

Haardt F., Madau P., 1996, ApJ, 461, 20

Hilz M., Naab T., Ostriker J. P., Thomas J., Burkert A., Jesseit R., 2012, MNRAS, 425, 3119

Hirschmann M., Naab T., Somerville R. S., Burkert A., Oser L., 2012, MNRAS, 419, 3200

Hopkins A. M., Beacom J. F., 2006, ApJ, 651, 142

Hopkins P. F., Bundy K., Murray N., Quataert E., Lauer T. R., Ma C.-P., 2009, MNRAS, 398, 898

Huertas-Company M. et al., 2013, MNRAS, 428, 1715

Huertas-Company M. et al., 2014, preprint (arXiv:e-prints)

Kaviraj S., 2014, MNRAS, 440, 2944
Kaviraj S. et al., 2013a, MNRAS, 428, 925

Kaviraj S. et al., 2013b, MNRAS, 429, L40

Kaviraj S., Devriendt J., Dubois Y., Slyz A., Welker C., Pichon C., Peirani S., Le Borgne D., 2014, preprint (arXiv:e-prints)

Kaviraj S. et al., 2014, MNRAS, 443, 1861

Kereš D., Katz N., Weinberg D. H., Davé R., 2005, MNRAS, 363, 2

Khandai N., Di Matteo T., Croft R., Wilkins S. M., Feng Y., Tucker E., DeGraf C., Liu M.-S., 2014, preprint (arXiv:e-prints)

Khochfar S., Silk J., 2006, AJ, 648, L21

Kimm T., Devriendt J., Slyz A., Pichon C., Kassin S. A., Dubois Y., 2011, preprint (arXiv:e-prints)

Komatsu E. et al., 2011, ApJS, 192, 18

Lackner C. N., Cen R., Ostriker J. P., Joung M. R., 2012, MNRAS, 425, 641

Laigle C. et al., 2015, MNRAS, 446, 2744

Lambas D. G., Maddox S. J., Loveday J., 1992, MNRAS, 258, 404

Law D. R., 2009, PhD thesis, California Institute of Technology

Lee J., Yi S. K., 2013, ApJ, 766, 38

Lin L. et al., 2010, ApJ, 718, 1158

López-Sanjuan C. et al., 2013, A&A, 553, A78

Lotz J. M., Jonsson P., Cox T. J., Croton D., Primack J. R., Somerville R. S., Stewart K., 2011, ApJ, 742, 103

Madau P., Pozzetti L., Dickinson M., 1998, ApJ, 498, 106

Maller A., Katz N., Keres D., Davé R., Weinberg D., 2006, ApJ, 647, 763

Mancini C., Forster Schreiber N. M., Renzini A., Cresci G. E., 2011, ApJ, 743, 86

Mortlock A. et al., 2015, MNRAS, 447, 2

Naab T., Burkert A., 2003, ApJ, 597, 893

Naab T., Trujillo I., 2006, MNRAS, 369, 625

Naab T., Jesseit R., Burkert A., 2006, MNRAS, 372, 839

Naab T., Khochfar S., Burkert A., 2006, ApJ, 636, L81

Naab T., Johansson P., Jeremiah P., Efstathiou G., 2007, ApJ, 658, 710

Newman A. B., Ellis R. S., Bundy K., Treu T., 2012, ApJ, 746, 162

Nipoti C., Treu T., Auger M. W., Bolton A. S., 2009, ApJ, 706, L86

Nipoti C., Treu T., Leauthaud A., Bundy K., Newman A. B., Auger M. W., 2012, MNRAS, 422, 1714

Ocvirk P., Pichon C., Teyssier R., 2008, MNRAS, 390, 1326

Oser L., Ostriker J. P., Naab T., Johansson P. H., Burkert A., 2010, ApJ, 725, 2312

Peirani S., Crockett R. M., Geen S., Khochfar S., Kaviraj S., Silk J., 2010, MNRAS, 405, 2327

Pichon C., Pogosyan D., Kimm T., Slyz A., Devriendt J., Dubois Y., 2011, MNRAS, 418, 2493

Popping G., Somerville R. S., Trager S. C., 2014, MNRAS, 442, 2398

Qu Y., Di Matteo P., Lehnert M. D., van Driel W., 2011, A&A, 530, A10

Quinn P. J., Hernquist L., Fullagar D. P., 1993, ApJ, 403, 74

Rodriguez-Gomez V. et al., 2015, preprint (arXiv:e-prints)

Rodriguez-Gomez V. et al., 2016, MNRAS, 458, 2371

Santini Pet al., 2014, A&A, 562, A30

Schaye J. et al., 2015, MNRAS, 446, 521

Shankar F., Salucci P., Granato G. L., De Zotti G., Danese L., 2004, MNRAS, 354, 1020

Shankar F., Marulli F., Bernardi M., Mei S., Meert A., Vikram V., 2013, MNRAS, 428, 109

Shapiro K. L. et al., 2008, ApJ, 682, 231

Springel V., Di Matteo T., Hernquist L., 2005, ApJ, 620, L79

Sutherland R. S., Dopita M. A., 1993, ApJS, 88, 253

Tacconi L. J. et al., 2010, Nature, 463, 781

Teyssier R., 2002, A&A, 385, 337

Tillson H., Devriendt J., Slyz A., Miller L., Pichon C., 2012, preprint (arXiv:e-prints)

Tweed D., Devriendt J., Blaizot J., Colombi S., Slyz A., 2009, A&A, 506, 647

van der Wel A. et al., 2014, ApJ, 788, 28

Velazquez H., White S. D. M., 1999, MNRAS, 304, 254

Vogelsberger M. et al., 2014, MNRAS, 444, 1518

Walker I. R., Mihos J. C., Hernquist L., 1996, ApJ, 460, 121

Welker C., Devriendt J., Dubois Y., Pichon C., Peirani S., 2014, MNRAS, 445, L46

Wellons S. et al., 2016, MNRAS, 456, 1030

Younger J. D., Cox T. J., Seth A. C., Hernquist L., 2007, ApJ, 670, 269

## APPENDIX A: MORPHOLOGY OF NON-MERGERS: PURE IN SITU FORMATION SUB-SAMPLE

This section presents the cumulative PDFs of the principal semi-axis ratios $\xi_i$ for galaxies with $5 \times 10^9 M_{\odot} < M_s < 10^{10.5} M_{\odot}$ in the pure in situ stellar formation sample ($\delta m < 0.08$ per cent) separated in initial spheroids (in blue shades) and discs (in red shades).

Focusing on this sample in Fig. A1 (i.e. galaxies with $\delta m < 0.08$ per cent), the decomposition into initial spheroids and initial discs leads to very similar trends to the ones observed in Fig. 11 with $\delta m < 4.5$ per cent. Diffuse processes tend to flatten spheroids over time in rates similar to those of Fig. 11, while no such trend is observed for discs which are either preserved or slightly thickened over time in the absence of mergers. Noticeably, the slight thickening of discs is strongly reduced when ignoring unresolved mergers with $0.08$ per cent $< \delta m < 4.5$ per cent, consistently with the idea that clumpy accretion may be responsible for such a thickening effect.
<figure><img src="image_15.png" /></figure>

**Figure A1.** Cumulative PDFs of the principal semi-axis ratios $\xi_i$ for galaxies with $5 \times 10^9 \text{ M}_\odot < M_s < 10^{10.5} \text{ M}_\odot$ in the G0 sample ($\delta m < 0.08$ per cent) separated in initial spheroids (in red shades) and discs (in blue shades). Shades from dark to light represent evolution with cosmic time from $z = 5.2$ to 1.2 with an average time step of ~ 400 Myr (doubled compared to Fig. 11). The $1\sigma$ Poissonian error bars are overplotted for all bins that have a non-zero probability. Diffuse stellar acquisition processes tend to flatten galaxies over time.

This paper has been typeset from a TeX/LATEX file prepared by the author.