Multi-scale modelling of bioreactoreseparator system for wastewater treatment with two-dimensional activated sludge floc dynamics

Irina D. Ofit‚eru *, Micol Bellucci , Cristian Picioreanu , Vasile Lavric , Thomas P. Curtis b University Politehnica of Bucharest, Chemical Engineering Department, Polizu 1-7, Bucharest 011061, Romania Newcastle University, School of Civil Engineering and Geosciences, Cassie Building, Newcastle upon Tyne NE1 7RU, United Kingdom Delft University of Technology, Department of Biotechnology, Julianalaan 67, 2628 BC Delft, The Netherlands


Introduction
Microbial communities play a vital role in the geochemical cycling both in the natural environment and engineered biological systems. Their enormous power emerges from the actions of very large numbers of individual bacteria (estimated to be on average 10 29 in the seas and 10 18 in a single wastewater treatment plant), divided between hundreds or thousands of species. However, most design and modelling approaches use macro-scale models that can consider the effect of micro-scale changed on performance. Bridging the gap between the macro and micro-scales would give engineers new tools that would enable them to better understand, design and optimize the novel and extant technologies. Of all existing biotechnologies, arguably the most important biological processes are those being used for the treatment of municipal and industrial wastewaters. Of these, one of the most common is the activated sludge process. The floc, an aggregate of microorganisms and abiotic particles that comprise more than 70% of the bacterial biomass in such systems (Morgan-Sagastume et al., 2008), is central to this vital technology. The bacterial community composition, diversity and ecology of the activated sludge were extensively studied. Lately, the ecological processes that generate generic patterns in the community structure in lab scale bioreactors have also been addressed (Ayarza and Erijman, 2011).
However, most of the models in use describe only the onedimensional layering of microbial communities within a floc and how these communities evolve and perform and, as a consequence, can predict in a limited extent how the environment affects the flocs characteristics and their dynamics. Spatial organization within the floc, as well as the floc size and morphology strongly influences the energy demands of activated sludge plant (Wilen et al., 2004) together with the removal efficiency of the bioreactoreseparator system and quite possibly other properties as well. It is correspondingly desirable to construct mathematical models able to capture the multispecies interactions and to simulate the influence the floc morphology has on the activated sludge system (Ayarza and Erijman, 2011;Takacs and Fleit, 1995).
With few exceptions (for example, the studies of competition between floc-formers and filamentous microorganisms of Takacs and Fleit (1995) and Martins et al. (2004)), the models developed for the activated sludge floc consider the floc as an homogenous sphere (Abasaeed, 1999;Li and Bishop, 2003;Stenstrom and Song, 1991), some of them also consider the size distribution of flocs in the bioreactor (Biggs and Lant, 2002). The connection between the floc formation at microscale and the bioreactoreseparator performance was not the aim of the previous models. Understanding the connections between these scales is an important and fundamental challenge. For the macro-scale characteristics of microbial systems are the emergent properties of micro-scale activities of hundreds, maybe thousands, of differing taxa.
Nevertheless, it is not clear what properties at the microscale (e.g., colony formation, microbial distribution, local interspecies interactions, floc shape, the extent of filamentous microorganisms, floc density and porosity distribution, solute transport properties, etc.) are important at the macro-scale, or how macro-scale changes in environment will affect microscale behaviour. This is however, strategically important information which would help us understand and predict how changes in the environment will affect microbial communities and how the communities themselves will impinge on the environment that could affect everything from global sinks and sources of green house gasses, other geochemical cycles, soil function or the sea, diseases and engineered biological systems.
Individual based modelling (IbM), developed initially for planar microbial colonies (Kreft et al., 1998), then extended to biofilms (Alpkvist et al., 2006;Kreft et al., 2001;Picioreanu et al., 2004) and granular sludge , is well suited to capturing the dynamics of flocs. The IbM methodology allows a geometrically more realistic representation of the floc and this approach also permits the study of the growth of morphologically problematic filamentous bacteria (Martins et al., 2004). Moreover, IbM can facilitate the connection between the micro-scale of the floc phenomena and the macro-scale of the bioreactor performance, as shown in the model operating at different time scales (as well) in another "first generation multi-scale model" for granular sludge development by Xavier et al. (2007).
The goal of this study was to generate a relatively simple first generation multi-scale model of the activated sludge process to: (i) model the dynamics of the observed microbial structure and geometry of activated sludge flocs, in their interdependency with the bioreactor state variable and system operating conditions; (ii) integrate the faster micro-scale floc changes with the slower macro-scale bioreactoreseparator system behaviour.

2.
Materials and methods

Experimental
The microbial community structure within activated sludge flocs was analyzed in samples from a municipal wastewater treatment plant (Spennymoor, County Durham, UK) and from laboratory reactors, operated as described elsewhere , by the combined use of fluorescence in situ hybridization (FISH) and confocal laser scanning microscopy (CLSM). Samples (250 ml) were fixed within 4 h with 4% paraformaldehyde fixative solution (Hori and  and stored at À20 C. Hybridization was performed according to the methodology described in , with probes targeting the whole bacterial community (specific probes: Eub338i, Eub338ii, Eub338iii) (Daims et al., 1999), ammonia oxidizing bacteria (specific probes and competitors: Nso1225, Neu, CTE, 6a192, c6a192) (Wanner et al., 2006), and nitrite oxidizing bacteria (specific probes and competitors: Nit3, CNit3, Ntspa662, CNtspa662) (Daims et al., 2001). The hybridized biomass was then visualized by CLSM (Leica Microsystems Ltd., Milton Keynes, UK).

Model description
The overall scheme of the process considered for modelling is presented in Fig. 1. The system comprises a bioreactor in which the flocs are developing, a separator and a purge. Two parameters were defined for characterizing the bioreactoreseparator system: hydraulic retention time (HRT e defined as the ratio between the reactor volume and the volumetric flow rate, V R /Q) and solid dilution time (SDT e the average time spent by a floc inside the system before being eliminated through the purge). As defined here, SDT is related to HRT and the recycle and purge ratios, a and b, through the relationship (1): For no recycle at all (a ¼ 0), SDT ¼ HRT irrespective of the purge ratio b and the purge loses its meaning, becoming a simple outlet from the system. When a / N, SDT ¼ HRT/b and the flocs will stay in the bioreactor the longest possible period for a constant b, which increases as b decreases. Thus, the difference between SDT and the traditionally used SRT (solids retention time) is that the SDT accounts for the number of flocs while SRT represents the total biomass.
The present model considers that the biomass in the bioreactor is formed only by flocs (all of them having the same geometry within one simulation, species composition and internal distribution), disregarding the contribution of free planktonic bacteria to the biological removal of pollutants. The flocs are all undergoing the same processes. The floc population dynamics will influence and be influenced by the way substrate concentrations vary in the bioreactoreseparator system. To describe the floc morphology observed at the micro-scale, the two-dimensional (2D) IbM paradigm was used, which considers each microorganism as a separate entity (Kreft et al., 2001). This approach accounts for inter-(between the functional groups) and intra-(within the same functional group) population segregation, tagging each individual with specific attributes, e.g. specifying the functional group to which it belongs or the physical coordinates of its particular position within the floc. The intra-population segregation accounts for the different positions individuals belonging to the same functional group might have in the cellcycle between two successive divisions.

Time and space scales
The mathematical model acknowledges that the performance of the activated sludge bioreactoreseparator system is a consequence of the interdependencies of three time-scales at which the different processes take place. The fastest time-scale is of the order of seconds and governs species diffusion and metabolic activities. The middle time-scale is of the order of tens of minutes to several hours, is given by the doubling time of bacteria, and can be modified by changing the substrates concentrations within the bioreactor. The longest time scale is a function of the plant operational parameters, determines the time spent in the bioreactoreseparator system by the wastewater and the bacterial population e HRT and SDT e and is typically measured in hours and days, respectively. Taking into account the difference in magnitude between the diffusion time-scale and the microbial growth/retention times, it is safe to assume, in the first instance, that the latter is ratecontrolling. Thus, although we take into account the diffusion in flocs, responsible for internal concentration gradients of the substrates, we disregard its dynamics and consider the process fast enough to ensure an "instantaneous" thermodynamic equilibrium between the floc and its surroundings. Nevertheless, this pseudo steady-state is attained taking into consideration both the external and internal resistances to the mass transfer, as given by the boundary layer surrounding the floc (for external resistance), or the porous structure of the floc (for internal resistance). The result of the superposition of the processes governed by these two rate-controlling time-scales is a special kind of dynamics of the bioreactoreseparator system; although the state variables move on a quasi-periodic trajectory with rather small amplitudes, the time-average of this trajectory is fairly stationary, and could be seen as a pseudosteady state (Menniti and Morgenroth, 2010). The same dynamics characterizes the bacterial population behaviour, although the amplitude of the deviations from the pseudosteady state is significantly larger (Graham et al., 2007).

Micro-scale (floc) model
The main groups of microorganisms involved in the biological process and considered in the generic floc are: heterotrophs (HET, consuming organic carbon source and oxygen or nitrate in anoxic denitrifying conditions), ammonia oxidizers (AOB, which use ammonia and oxygen to produce nitrite) and nitrite oxidizers (NOB, which use nitrite and oxygen to produce nitrate). The floc is thus seen as a structured community of populations of cells, which interact through competition and commensalism. To these, the solid debris that results from cell lysis and the extracellular polymeric substances (EPSs) excreted by HET were added, the EPSs seen as solid particles slowly degrading into carbon substrate in the liquid phase. The processes considered manifest themselves at the individual cell or at floc level, and can be classified into continuous or discrete events. Microbial processes, characteristic for each functional group of microorganisms as detailed in Table 1, are driven by the local concentrations of soluble components: carbon source S S , ammonium S NH4 , nitrite S NO2 , nitrate S NO3 and oxygen S O2 .
2.2.2.1. Soluble components. The two-dimensional (2D) floc develops starting from the middle of a square computational domain U of size L. In order to take into account the external and internal mass transfer resistances, the domain U is split in three distinct sub-domains: (1) the floc, U F ; (2) the mass transfer boundary layer, U B ; and (3) the bulk liquid, U R , as shown in Fig. 1.
Pseudo-steady state was assumed for the domains U F and U B , where diffusion is the only mass transporting mechanism, since they have the lowest time-scale: diffusion and metabolic processes in the floc are much faster compared with processes determining the floc morphology, such as microbial growth or EPS production (Martins et al., 2004;Picioreanu et al., 2004). In order to describe the perfectly mixed environment surrounding the floc, the diffusion coefficient for the bulk liquid, U R , was assumed several orders of magnitude higher than that for the other two sub-domains. Within the floc (sub-domain U F ), the diffusion coefficient is affected by the presence of the cells, being lower than the value within the boundary layer, sub-domain U B .
The effective diffusion for the sub-domain U F was calculated as the product between an effective diffusion factor (d f ) and the diffusion in water, the factor being related to the mass concentration of the solid occupying the grid position (x,y) in sub-domain U F by the relationship (Fan et al., 1990): The local concentrations of soluble components within the floc sub-domain, U F , S i,F (x,y), are found by solving stationary diffusion-reaction mass balances, eq. (3), for each soluble substrate and product: The net reaction term, r i , is the sum of the rates of the particular processes in which the soluble component S i,F (x,y) is involved, weighted by corresponding yield factors. The rate expressions and yields are presented in Table 2. Each individual process rate takes into account the particular microbial type, its mass and substrate concentrations at the coordinates of that individual (bacterium) .
The mass transfer boundary layer, U B , has constant thickness and develops around the floc edge at each moment in time. No biological transformation is considered within U B and the mass transport is by diffusion only. The mass balances for soluble components are according to eq. (3), but without the reaction term. Concentration and flux continuity conditions apply at the interface between floc and mass transfer boundary layer (U F X U B ). Outside the boundary layer in the bulk sub-domain, U R , the fluid is assumed perfectly mixed, having all concentrations as in the bulk liquid within the bioreactor. Consequently, the solute concentrations are set to the values in the reactor at the interface between mass transfer boundary layer and bulk sub-domains (U B X U R ). This is the first connection between the two scales of the process, generic floc and bioreactoreseparator system.

Particulate components
-Microbial growth, with the corresponding conversion of substrates into products, an attribute of each individual cell, is a Table 1 e Stoichiometric matrix for particulate and soluble components considered in the model.

Particulate components
Soluble components Decay of EPS À1 1 continuous process between two successive divisions. During growth, the heterotrophs are also producing EPS, which surrounds and separates these cells (Subramanian et al., 2010). Two types of polymers were assumed: degradable EPS particles and non-degradable EPS bound to the cells (Subramanian et al., 2010). The degradable EPS stays in between the cells and is assumed to be of particulate nature, hydrolyzing at a constant rate. The non-degradable EPS remains strongly attached to the HET cells. Although heterotrophic cells are producing EPS continuously, its excretion as particulate entity (the degradable EPS) is a discrete event in the IbM approach . During division, the strongly adhered EPS is distributed between the two resultant cells. The main components of the soluble EPS were identified to be carbohydrates and proteins (Park and Novak, 2007), so that by the decay of the EPS they will add to the pool of carbon source. By contrast, the AOB and NOB do not produce EPS; therefore they grow in distinct clusters, easily identifiable in the floc as in the model of Alpkvist et al. (2006). Each bacterium changes its mass continuously, according to the individual biological processing rates, as presented in Tables 1 and 2, which depend upon the local substrate concentrations. When the mass of a cell exceeds a critical value, a division event takes place. In order to avoid synchronized divisions, the mass of the dividing cell is not equally distributed between the resulting cells, but uniformly distributed around the mean, with 20% standard deviation. The EPS attached to HET cells is excreted as a separate particle once its volume exceeds a critical value; here, too, the fraction of the excreted EPS is uniformly distributed around the mean, with 20% standard deviation. Once excreted as a particle, the EPS starts decaying into soluble substrate according to a first order kinetics (Tables 1 and 2). The mass balance for the particulate components bacteria and EPS reads: where r i,X is the net production rate and includes processes specific for each particle, as presented in Tables 1 and 2. The parameters for microbial growth in activated sludge, decay and EPS production kinetics reported in literature vary across a very wide range (Munz et al., 2011), even in apparently similar experimental conditions. Consequently, it is not possible to use a group of parameters which would result in a floc structure generally valid in any conditions. Values of yields and kinetic parameters were taken from the established activated sludge and biofilm models (Henze et al., 1999;Rittmann and McCarty, 2001;Wanner et al., 2006), while those for EPS (yield and decay rate) are from Ni et al. (2009), as presented in Table 3.
-Microbial division and death affect all individuals at certain time moments and they are seen as discrete events structuring the floc. After division, the floc morphology changes to accommodate the newly formed cells, which push the existing cells till they make the space to fit (Kreft et al., 2001).
A new model feature is that the AOB and NOB newborn cells have to accommodate themselves inside clusters of cells of the same type. Therefore, shoving of individual cells inside the cluster leads to an increased cluster volume, and pushing of whole clusters and cells outside clusters leads to increased floc size. The movement of the clusters is weighted inversely proportional with their aggregate mass (e.g., when a cluster is overlapping with a single cell, the shoving process will move more the single cell). As such, as a cluster becomes bigger, its relative position in the floc changes less. After cell death, lysis of particulate components produces carbon-based substrate and solid debris, taken into account as inert particles.
The attachment of individual cells (either HET, AOB or NOB) with mass m c happens at certain time intervals, s c , generating a sequence of discrete events at times t i ¼ d(t À i , s c ), i ¼ 1,2.N. The discreteness of attachment events is described by the Dirac function d(s). s c is the mean time between two efficient collisions between the floc and an individual cell. As the mass of the floc increases in time due to bacterial growth and division, the attachment of individual cells will have less affect on the overall floc mass. However, attachment of new cells remains an important source of new AOB and NOB colonies.
A pool of micro-flocs was generated in the same simulation conditions and used subsequently in large scale attachment events. The attachment of micro-flocs happens also as discrete events at times t j ¼ d(t À j , s mf ), with j ¼ 1,2,.,N,where s mf is the mean time between two efficient collisions between the micro-flocs and the main floc. The floc mass increases with the mass m mf of a randomly selected micro-floc from the pool. The position for cell and micro-floc attachment is randomly generated in places next to the floc surface. Because of the biomass conservation at bioreactor level, the individual cells and micro-flocs attached to the generic floc can originate only from other flocs, which accordingly implies that the number of flocs in the reactor after each attachment event must be adjusted.
-Detachment of a group of cells and EPS, arbitrarily extracted as a chunk from the outer part of the floc is also a random process happening at time intervals s D , creating also a The number of cells to be detached in one event was set not to exceed 25% of the current total number of cells constituting the floc. A higher probability of detachment is equivalent in this model to higher shear stresses in the bioreactor/separator, implying a shorter time between successive detachment events, s D . Like attachment, the detached biomass obeyed the need for biomass conservation and the number of flocs at the bioreactor level increased after detachment events. -Decay of biomass and EPS in every particle is a generic process through which the loss of cell activity and EPS dissolution are considered. Both decay rates are first order with respect to the biomass or EPS concentration. The decrease in active biomass (i.e., the biomass decay) is accounted for at functional groups level. The amount of decayed biomass in a certain time interval is divided by the corresponding mass of an average cell belonging to the functional group, thus computing the number of cells of HET, AOB or NOB which disappear (i.e. die) in that time interval. Then, the cells which die are selected randomly and their attributes changed to inert solids, while a part of the dead cells mass is returned to the liquid phase as carbon-based soluble substrate (see Table 1).

Macro-scale (bioreactor) model
At the macro-scale (bioreactoreseparator system e see Fig. 1), the mass balance for each soluble component i having the concentration S i,R considers the bioreactor as perfectly mixed.
The whole biomass growing inside the system is assumed to made of replicates of the generic floc, therefore the rate of consumption/production of a soluble component r i,R is calculated by multiplying the rates in one floc by the number of flocs in the reactor. The generic soluble component balance in the bioreactor is: The net process rate, r i,R , considers all processes in which the soluble component S i,R occurs (see Table 1). In equation (5) S i,in is the concentration of the soluble component i in the reactor inlet. For oxygen, a supplementary term taking into account the aeration is included, O 2 is the oxygen saturation concentration and q O 2 the specific aeration flow.
The balance of biomass over the reactor, expressed as the total number of flocs, is based on the assumption that there is only one generic type of floc which undertakes cells growth, attachment and detachment: where N(t) is the current number of flocs in the reactor. The mass of the total initial cells inoculated was 0.06 kg, resulting in N 0 ¼ 10 14 flocs at the beginning of the bioreactor operation.
The right hand side of equation (6) contains two factors. The first factor is continuous, representing the dilution effect of the purge, i.e., there is a constant loss of flocs related to the operating conditions, with SDT as the time-scale of the bioreactoreseparator system. The second part of equation (6) is discrete, taking into account the combined effects of  . Green e heterotrophic bacteria (HET); blue e ammonia oxidizing bacteria (AOB); yellow e nitrite oxidizing bacteria (NOB).
attachment and detachment on the number of flocs present in the reactor. After each discrete event, the number of flocs is suddenly changed with a ratio higher than unity if detachment occurred (increasing the number of flocs), or lower than unity in the case of attachment (decreasing N).
The assumption was made that only some individuals from the floc population are either destroyed in order to generate the micro-flocs or formed by the micro-flocs detached. Therefore, when a smaller group of bacteria, drawn from the pool of micro-flocs created previously, is attached to the generic floc increasing its mass, the total number of flocs in the bioreactor decreases. When detachment takes place decreasing the mass of the generic floc, the overall number of flocs should be increased accordingly. The balance over the purge is done in a similar manner. A fraction b of the biomass is eliminated and the remaining number of flocs is calculated with respect to the generic floc. Thus, the biomass conservation equation (6) represents the second important connection between the two scales, the generic floc and the bioreactoreseparator system.

The continuous pseudo-homogenous reactoreseparator system
The performance of the heterogeneous bioreactoreseparator system at two scales was compared with the homogenous case in which the biomass does not form flocs. The same processes and their corresponding rates are applied, but the floc formation is disregarded. The biomass is considered suspended in the liquid medium forming together a pseudohomogenous phase. Also in this case, different mass balances for the continuous bioreactor were applied. For soluble matter, equation (5) is used, while for the biomass, the generic equation considering the ideal separator unit is: where j stands for HET, AOB, NOB, EPS and inert solid debris, while r j,R represents the rate of overall change of j species (according to Tables 1 and 2). The same initial concentrations for substrate and biomass were considered for the homogenous reactor model, as for the heterogeneous case.

Solution method
The model was implemented in a combination of MATLAB code (ver. 2010a, MathWorks, Natick, MA) as the main algorithm driver, COMSOL Multiphysics (ver. 3.5a, Comsol Inc., Burlington, MA), which implements the finite element method for solving the diffusion-reaction equations, and Java code for the individual-based floc model. The general algorithm follows the principles explained in detail in Martin et al. (2013).
The system develops iteratively in time steps of Dt ¼ 0.1 day. The floc forms on a square domain of 500 Â 500 mm 2 . First, all needed initial conditions are set: five biomass particles are placed in the centre of the 2D domain (one of each type: HET, AOB, NOB, EPS and inert) and solute concentrations in reactor and 2D domain are specified. Then, in each time step, a sequence of operations is performed: (1) calculate 2D solute distributions (COMSOL); (2) growth, decay, division (MATLAB); (3) attachment and detachment of biomass to/from the floc (MATLAB); (4) re-distribution of biomass particles to minimize overlaps (Java); (4) solute and floc balances at bioreactor level (COMSOL). After each time step, the floc is repositioned with its mass centre in the centre of the 2D domain.
For the homogenous reactor case, the system of differential equations was solved with RungeeKutta method ode15s in MATLAB.

Floc imaging
A typical result of imaging samples of flocs from the municipal wastewater treatment plant and from laboratory reactors is presented in Fig. 2 (A e wastewater treatment bioreactor; B e lab bioreactor). All the images obtained by FISH/CLSM showed different shapes and dimensions of the flocs, but all having common characteristics. Ammonia oxidizing bacteria (AOB) and nitrite oxidizing bacteria (NOB) were forming compact and almost spherical micro-colonies with well-defined boundaries, while the other bacteria were uniformly dispersed in the whole floc.

Model simulations
The numerical model was run in 17 replicates, with the parameters from Table 2. Each run produced slightly different results because of the randomness of the attachment/ detachment processes, which affects not only the relative proportions of the functional groups, but also their spatial distribution in the floc. The system was simulated for a maximum period of 15 days. The results presented here are averaged over the replicate runs. For assessing the influence of the system operation parameters (the recycle and purge ratios, a and b, which determine the SDT values as in equation (1)) over the flocs developed in the bioreactor, simulations were made for different pairs of values, as presented in Table 4.
The homogenous reactor was simulated using the same inlet and operating conditions.

Micro-scale (floc) results
The development of a floc over a period of 10 days is presented in Fig. 3. As the biomass grows, the clusters of AOB and NOB become bigger, their tendency being to remain in the inner region of the floc, since the shoving tends to move the individual cells towards margins. Larger AOB or NOB clusters can still appear near the floc surface when the detachment removed portions of the floc in their neighbourhood (e.g., in Fig. 3 at Day 10 the two big AOB clusters on the upper side of the floc). The simulated results qualitatively resemble the microscopy images from Fig. 2, having compact and distinct AOB and NOB micro-colonies kept within the HET and EPS matrix. Micro-flocs attachment and the rearrangement of cells after division/attachment/detachment result in irregular floc shape. The simulated flocs obtained at Day 10 had around 200 mm on the longest diagonal, which is in the middle range of floc sizes found in wastewater treatment. However, due to the irregular shape, a comparison between runs can be done only by using an averaged measure. Therefore, an equivalent diameter was calculated for each run, defined as the diameter of a circle having the same area as the total floc area. The change of the mean equivalent floc diameter in time is depicted in Fig. 4(A) and shows a linear increase in time. This indicates that a steady state is not achieved in ten days, because the total microbial growth rate within the floc and cells attachment were not yet balanced by the detachment rate. In time, the variation of the mean equivalent floc diameter between replicate runs increases, due to the dominance of the detachment effect e the bigger the floc, the larger the amount of cells that could be randomly detached from the floc (up to 25% of the whole floc), affecting its size and composition. The overall mean number of AOB and NOB clusters variation in time is presented in Fig. 4(B), showing the same tendency of asymptotic growth. In a mature floc, in a system that reached the steady state it is expected that the number of AOB and NOB clusters would fluctuate around a mean, given the combined effects of growth, attachment, detachment and decay. In this model, attachment is the only way a floc could increase its number of clusters, while detachment and decay decrease it.
A mean colony size was calculated as the number of cells contained in each AOB and NOB colony at different times, averaged over the 17 simulation runs. The variation of the AOB colony mean size distribution in time is presented in Fig. 5(A), as percentage of colonies of a certain size from the total number of AOB colonies. As expected, taking into account the difference in the growth rates in favour of AOB cells, after 10 days the floc has rather large AOB colonies, with more than 20 cells (see also Fig. 3 for a visual distribution), although their percentage from the total number of colonies remains small. As the floc grows older, an increasing number of microcolonies are larger. The same behaviour is observed for the NOB clusters (Fig. 5(B)), but with a time delay due to the slower growth (i.e., their main substrate, nitrite, accumulates when the floc contains more AOB cells). The NOB clusters are smaller than the AOB colonies, maximum 8 cells in the cluster after 10 days. In the older flocs, although the smallest cell clusters still dominate the distribution, the mean colony size distribution develops a tail of bigger clusters.
The population distribution in time (represented by the fraction of each biomass type in the population) is presented in Fig. 6. Although the floc formation started from one individual from each biomass type, the faster growth rate of HET combined with the attachment of small flocs occasioned an initial increase in the HET fraction, followed by a steady decrease due to decay and detachment (Fig. 6(A)). There is a clear tendency of the floc composition to stabilize to a rather constant fraction distribution of the microbial guilds, faster for AOB, NOB and EPS (Fig. 6(B)) than for the HET and inert. This behaviour is consistent with the faster growth rate of HET (and, consequently, the faster production rate of EPS) compared to AOB and NOB, implying a higher dependency upon the random events. EPS stabilises more rapidly, though, since it suffers a continuous decay.
The spatial distribution of the micro-organisms in the floc permanently changes the heterogeneous 2D distribution of substrates in the floc (Fig. 7). The nitrite concentration field differs according to the microbial distribution, being higher where AOB clusters are present, and lower where NOB clusters are active; also, the effects of the boundary layer upon the nitrite concentration are evident. A closer look to the floc edge (the insert in Fig. 7) shows the effects of the detachment of a group of cells, revealing a small gradient of nitrite due to the localized activity of AOB. Conversely, where NOB dominate, nitrite is consumed, lowering its concentration with respect to the bulk (i.e., the south-east region of the floc, with high nitrite concentration in the vicinity of NOB clusters).

Macro-scale (bioreactor) results
The concentrations of each substrate in the reactor bulk averaged over 17 simulation runs are presented in Fig. 8. The dominant time scale of the reactoreseparator system (an SDT of  5 days) determines the time needed to attain the pseudo-steady state, Fig. 8(A), which is around six days. After 10 days a pseudo steady-state establishes, with COD and ammonia at lower concentrations than in the influent, with an associated increase in nitrite and nitrate concentrations. Oxygen concentration inside the flocs was not a limiting factor and denitrification was not significant, therefore nitrate accumulated in the reactor. The substrate consumed by the heterotrophs was converted into biomass and EPS, leading to a fast decrease in the COD concentration. The peak and then decline in the heterotrophs fraction was reflected in the concentration of the carbon source in the reactor which declined initially and then increased slowly but steadily. When the pseudo-steady state was attained, the amplitude of the oscillations of concentrations at the reactor level became very small.
The change in the number of flocs in the reactor in time is shown in Fig. 8(B), together with the standard variation among    the 17 simulation runs. During the early stage of the reactor operation, the number of attachment events significantly reduced the number of flocs in the reactor because sometimes the mass of the attached community was comparable with the mass of the original floc community. However, the overall biomass is conserved at reactor level, resulting in fewer larger flocs with higher mass. This is also reflected in the changes of the microbial composition, since the morphology of the attached community could be very different from the preceding distribution microorganisms in the reference floc. However, gradually, the detachment process became dominant; as the floc size increases, the number of individuals which can be simultaneously detached increases, while the pool from where the attached micro-flocs are selected has the largest member with 95 individuals. The effect should be an  increase of the number of flocs at the bioreactor level. On the other hand, the sludge wastage (or purge) diminishes the number of flocs and decreases the total biomass in the bioreactor leading to an asymptotic stabilization of the number of flocs to the level where the biomass growth and the increase of the floc number due to dominance of detachment compensate this loss.

Importance of heterogeneous floc modelling
To evaluate the importance of taking into account the detailed formation of floc morphology and microbial composition on the performance of a water treatment reactor, an analogous pseudo-homogenous system was simulated for the same period of 10 days (Fig. 9). In general, a similar evolution of substrate concentrations was observed also for the pseudohomogenous case. However, without the heterogeneity introduces by the floc, the removal of COD and ammonia is substantially overestimated in the simulated conditions.
The recycle and purge ratios, and the SDT, have a significant influence on the equivalent diameter of the flocs (Fig. 10), but the irregularity of the floc is preserved (Fig. 11). The increase of a, the recycle ratio, caused a decrease in the equivalent diameter of the flocs, for the same purge ratio, b (Fig. 11, a ¼ 0.2 and a ¼ 0.3, for b ¼ 0.01, for example), due to the increase of SDT (see equation (1) and the following discussion). The longer the flocs stay in the bioreactor, the fewer flocs there remain.

Conclusions
The macro-scale properties of any wastewater treatment system are the emergent properties of micro-scale properties of large numbers of individual cells that form the biomass. We should, ideally, predict and understand these properties using multi-scale models. This paper describes a simple first generation multi-scale model of the bioreactoreseparator system. It captured, qualitatively at least, the known architecture of the floc and accounts for: the relationships between the dynamics of both the reactor (macro-scale model) and the generic activated sludge floc (micro-scale IbM approach); high frequency biomass attachment, and detachment at the floc level and the damped dynamics of the bioreactoreseparator performance and the different time scales of mass transport, biomass. The bioreactoreseparator system tends asymptotically to a pseudosteady state, where the state variables vary between same finite upper and lower limits. However, this work is only a small and early step towards multi-scale modelling of biological treatment systems. Improved models will require improved and coordinated parameterisation and corroboration of the physical and biological processes at all the relevant scales. Meeting this challenge will require a step change in the resource devoted to the modelling of such systems but could deliver transformative insights that can be used in design management and research.