A Mathematical Study of Metal Biosorption on Algal–Bacterial Granular Biofilms

A multiscale mathematical model describing the metals biosorption on algal–bacterial photogranules within a sequencing batch reactor (SBR) is presented. The model is based on systems of partial differential equations (PDEs) derived from mass conservation principles on a spherical free boundary domain with radial symmetry. Hyperbolic PDEs account for the dynamics of sessile species and their free sorption sites, where metals are adsorbed. Parabolic PDEs govern the diffusion, conversion and adsorption of nutrients and metals. The dual effect of metals on photogranule ecology is also modelled: metal stimulates the production of EPS by sessile species and negatively affects the metabolic activities of microbial species. Accordingly, a stimulation term for EPS production and an inhibition term for metal are included in all microbial kinetics. The formation and evolution of the granule domain are governed by an ordinary differential equation with a vanishing initial value, accounting for microbial growth, attachment and detachment phenomena. The model is completed with systems of impulsive differential equations describing the evolution of dissolved substrates, metals, and planktonic and detached biomasses within the granular-based SBR. The model is integrated numerically to examine the role of the microbial species and EPS in the adsorption process, and the effect of metal concentration and adsorption properties of biofilm components on the metal removal. Numerical results show an accurate description of the photogranules evolution and ecology and confirm the applicability of algal–bacterial photogranule technology for metal-rich wastewater treatment.


Introduction
Increased use of metals in process industries has resulted in the production of large quantities of wastewater effluents containing high level of toxic heavy metals (Ahluwalia and Goyal 2007). Due to their non-degradable and persistent nature, tendency to accumulate, and hazardous effects on living organisms and environment, heavy metals removal represents a great challenge in the wastewater treatment field (Yang et al. 2015;Ahluwalia and Goyal 2007;Chojnacka 2010;Abbas et al. 2014). The relevance of these topics in the environmental engineering has led to the development of new technologies for heavy metals removal. Methods for removing metal ions from aqueous solutions include physical, chemical and biological processes (Fomina and Gadd 2014). Nevertheless, conventional physical/chemical technologies, such as chemical precipitation, ion exchange, activated carbon adsorption and membrane processes, are often ineffective or expensive in the case of very low metals concentrations (Chojnacka 2010;Abbas et al. 2014;Anjana et al. 2007). A promising alternative technology for removal of heavy metals from wastewater is represented by the adsorption process and, particularly, biosorption process. Indeed, compared with conventional metal removal methods, biosorption has several advantages: use of renewable biomaterials; possibility to treat large volumes of wastewater; high selectivity; recovery of bound heavy metals from the biomass; no supplementation of expensive chemical reagents; low production of hazardous waste (Abbas et al. 2014).
Biosorption is a complex combination of processes, consisting of the physical adherence or bonding of ions and molecules (sorbate), dissolved or suspended in a liquid phase (solvent), onto a solid surface (adsorbent) (Abbas et al. 2014;Fomina and Gadd 2014;D'Acunto et al. 2018;Gadd 2009;Papirio et al. 2017). Until now, a variety of biomaterials and microorganisms have been used as biosorbent for the removal of metals, such as algae, bacteria, fungi and yeast (Abbas et al. 2014). Such living or dead organisms are able to bind and concentrate metals, metalloids, radionuclides and other toxic pollutants from even very dilute aqueous solutions (Abbas et al. 2014;Fomina and Gadd 2014;Papirio et al. 2017;Park et al. 2010). Several factors can affect the mechanism of metals biosorption: properties of the biomass (living or non-living, type of biomass, phenotype), presence of other competing ions and environmental conditions (pH, temperature, etc.) (Chojnacka 2010;Abbas et al. 2014). Specifically, the biomass phenotype may be considered one of the most important factors. Indeed, the use of freely suspended microbial biosorbents has some disadvantages, including small particle size, low density, poor mechanical strength, low rigidity, difficulty in separating biomass and effluent, and poor biomass regeneration (Abbas et al. 2014;Fomina and Gadd 2014;Gadd 2009). For this reason, in recent years immobilized biomass has been regarded as an interesting alternative. In addition, cell agglomeration promotes the secretion of extracellular polymeric substances (EPSs), which further contribute to microorganisms protection and metals biosorption (Flemming and Wingender 2001;Comte et al. 2008;Liu and Fang 2002).
The simultaneous removal of organic substances and heavy metals from wastewater is still a major engineering target. Algal-bacterial systems are expected to have a great potential in removing organic and inorganic compounds in a single treatment step, combining high adsorption capacities of microalgae and cyanobacteria with low process costs (Muñoz et al. 2006). Indeed, microalgae and cyanobacteria show great tendency to produce EPS and high metal binding affinity. Moreover, the photosynthetic activity leads to the production of oxygen and allows the oxidation of carbon and nitrogen compounds by heterotrophic and nitrifying bacteria without external supplementation of oxygen Abouhend et al. 2019). In this context, self-immobilized algal-bacterial consortia in granular form, known as oxygenic photogranules (OPGs), are considered as an effective and promising technology for biosorption of inorganic pollutants and degradation of organic compounds (Ajiboye et al. 2021;Yang et al. 2015). In the last years, great attention has been devoted to individual removal of heavy metals (Yang et al. 2020(Yang et al. , 2021 or organic compounds Milferstedt et al. 2017) in OPG-based systems. Nevertheless, there is knowledge lack regarding their contextual removal, although these pollutants usually co-exist in industrial wastewater.
In this framework, mathematical modelling represents a useful tool to explore the granulation process of OPGs and the metals adsorption on biofilm granules. Biosorption is usually described through isotherms, which represent the equilibrium relationship between the adsorbate concentration in the liquid phase and the adsorbate concentration onto the adsorbent phase at a given temperature. For the adsorption of a single component, the most widely used isotherm is the Langmuir-Freundlich model, which is the combination of Langmuir and Freundlich models (Abbas et al. 2014). Although biosorption isotherm models have been widely recognized as efficient tools to provide a suitable description of the experimental behaviour, kinetic modelling is typically preferred for practical applications and process design. Pseudo-first-and pseudo-second-order kinetic equations are the most widely used rate equations for the adsorption process (Abbas et al. 2014). Nevertheless, more comprehensive and accurate models need to be developed to better explore the complex relationships which establish between biosorbent and sorbate. A mathematical model accounting for the biosorption process of heavy metals on the different components of a multispecies biofilm has been presented by D' Acunto et al. (2018) in the case of planar biofilms. This mono-dimensional biofilm model is conceived in the framework of continuum mathematical modelling of biofilm growth and explicitly accounts for the diffusion and adsorption of heavy metals on the biofilm matrix. Nevertheless, none of the existing models addresses the evolution and dynamics of granular biofilms formation and the adsorption processes on their solid matrix.
In this work, we propose a mathematical model to investigate the mutual interactions between the formation of oxygenic photogranules (biosorbents) and the adsorption of heavy metals (sorbates) on their solid matrix. The de novo granulation process of OPGs in a granular-based sequencing batch reactor (SBR) has been addressed by Tenore et al. (2021c). It examines all the main factors influencing the granulation process of algal-bacterial photogranules for the treatment of typical municipal wastewater. The OPGs model has been extended to explicitly account for metals diffusion from bulk liquid to biofilm and their adsorption on the matrix of biofilm granules. Following the approach proposed by Eberl (2012, 2014) in the case of one-dimensional planar biofilms, the mesoscopic granular biofilm model has been coupled to the mass balances within the macroscopic bioreactor. This multiscale approach leads to model the formation and ecology of the biofilm granules and the performances of the SBR system, considering the interaction between the granules and bulk liquid. The granular biofilm model, derived in Tenore et al. (2021a), is formulated as a spherical free boundary value problem under the assumption of radial symmetry. Processes of microbial growth, attachment, and detachment are included to describe the formation and expansion of granules. The de novo granulation process is modelled by assuming that all biomass initially present in the bioreactor is in planktonic form. Mathematically, this corresponds to consider a vanishing initial value of the granule radius, using the approach introduced by D' Acunto et al. (2019Acunto et al. ( , 2021 in the case of planar biofilm. Attachment is modelled as a continuous flux (from the bulk liquid to the biofilm) of planktonic species, which aggregate, switch their phenotype from planktonic to sessile and initiate the granulation process. Detachment is modelled as a continuous flux (from the biofilm to the bulk liquid) proportional to the square of the granule radius. The model accounts for the first time the dynamics of the detached biomass and its influence on the biological process. Specifically, detached microbial species are modelled as a new set of variables and are supposed to grow on soluble substrates and switch to planktonic form. Furthermore, the model includes the diffusion and consumption/production of soluble substrates, due to the metabolic activity of sessile, planktonic and detached biomasses.
The model considers the adsorption of heavy metals on the granular solid matrix. Experimental observations show that each biofilm component is characterized by the presence of specific number of adsorption sites, which are able to adsorb the contaminants present in the wastewater. For this purpose, model equations describing the variation of free binding sites, and diffusion and adsorption of metals have been here derived for the first time in the case of granular biofilm, by following the approach proposed by Tenore et al. (2021a). The variation of free binding sites is assumed to depend on the biofilm growth and adsorption process and is modelled by a system of hyperbolic partial differential equations (PDEs) (D'Acunto et al. 2018), while the diffusion and consumption of the sorbates are described by a system of parabolic PDEs (D'Acunto et al. 2018).
All the main components of the OPGs are accounted in the model in sessile and suspended (planktonic and detached) form: phototrophs, facultative heterotrophic bacteria, nitrifying bacteria, EPS and inactive material (EPS and inactive material are accounted only as sessile biomass). Since cyanobacteria (included among phototrophs) play a predominant role in the granulation of oxygenic photogranules due to their filamentous morphology Abouhend et al. 2018Abouhend et al. , 2019, phototrophs are assumed to have better attachment properties and to enhance the attachment of other species (Tenore et al. 2021c). Moreover, the model accounts the diffusion and conversion of inorganic and organic carbon, nitrate, ammonia, oxygen and metal. The soluble substrates are involved in the metabolism of microbial species, while metal adsorbs on matrix of biofilm granules. Notably, the presence of metals in a such biological system results in a dual effect: it enhances the production of EPS by sessile species (Naveed et al. 2019) and negatively affects the microbial metabolic activities (Muñoz et al. 2006). This is modelled including a stimulation term for EPS production and an inhibition term for metal in all microbial kinetics. Light is included in the model to consider its effects on the metabolic activity of phototrophs. Specifically, light intensity is modelled in the bulk liquid as a piecewise function to reproduce the dark-light cycle characteristic of this reactor. Also, light intensity varies within the granules due to attenuation phenomena. Various numerical studies have been performed to investigate how the metal concentration and the adsorption properties of the biofilm components may affect the evolution of the process.
The paper is organized as follows: The mathematical model is introduced and described in Sect. 2, while the biological context is described in Sect. 3. Numerical studies and results are reported in Sect. 4 and discussed in Sect. 5.

Mathematical Model
The mathematical model simulates the biosorption process of metals within a granularbased sequencing batch reactor (SBR) with a multiscale approach. The SBR system is modelled as a batch bioreactor having a cyclic configuration, in which N G identical granules are immersed. For this purpose, two different compartments can be identified: the granule mesoscale and the bioreactor macroscale (Fig. 1). The model is able to contextually describe the de novo granulation process of granular biofilms, SBR performances and biosorption process. The interactions between the mesoscale and macroscale are accounted in the model, by considering exchange fluxes (from/to bulk liquid and to/from biofilm) of dissolved substances (substrates, products and metals) and biomasses (in sessile and suspended form). All main phenomena involved in the de novo granulation process are accounted in the model: attachment process by planktonic cells; growth and decay of sessile, planktonic and detached biomasses; EPS secretion; diffusion of dissolved substrates within the granule; conversion of dissolved substrates within the granules and the bulk liquid; detachment process; conversion of detached biomass into planktonic biomass. Moreover, the biosorption process of heavy metals on granule matrix is included in the model, by considering the diffusion and bioconversion of metals, and the variation of free adsorption sites.

Granule Mesoscale Model
The mathematical model describing the de novo granulation process derived by Tenore et al. (2021a) has been here extended to model the biosorption process of heavy metals on granular biofilms matrix. The granule mesoscale consists of a fixed number of biofilm granules (N G ) immersed within the bulk liquid and assumed to be identical at each instant. Specifically, each granule is assumed as constituted by various particulate components (including active microbial species, extracellular polymeric substances, and inactive biomass). Each component has a specific adsorption capacity and is Representation of a granular-based SBR system. Reactor macroscale is reported at left, where a single SBR treatment cycle is depicted, consisting of filling, reaction, settling and emptying phases. The granule mesoscale is reported at right along with all biochemical and physical processes occurring in the granule, in the bulk liquid and at the interface granule-bulk liquid characterized by the presence of a certain number of free binding sites, quantified as volume fractions. The metals (sorbates) are modelled as dissolved substances, which diffuse across the granules and are subjected to adsorption phenomena on the various biofilm components. The granule expansion depends on growth and decay processes of the various species, attachment flux from the bulk liquid to the biofilm, and detachment flux from the biofilm to the bulk liquid. The growth of microbial species depends on the presence of nutrients necessary for their metabolic activities. The nutrients are modelled as soluble substrates able to diffuse within the granules. Granulation process is initiated by attachment of pioneering planktonic cells, while detachment phenomena lead to the loss of sessile biomass, induced by external shear forces, substrates depletion and biomass decay.
The granular biofilm is modelled as a spherical free boundary domain under the assumption of radial symmetry. The evolution of the free boundary domain is described by the variation of the granule radius R(t). A vanishing initial domain (R(0) = 0) is considered to fully model the de novo granulation process. The centre of the granule is located at r = 0, where r denotes the radial coordinate. The granule model includes n microbial species in sessile form X i (r , t), m 1 dissolved substrates S j (r , t), n free binding sites X θ i (r , t), m 2 heavy metals M j (r , t). All these variables are expressed in terms of concentration and modelled as functions of time t and space r . Each microbial species is supposed to have the same biomass density ρ and the same density of binding sites ρ θ . By dividing sessile species concentrations X i (r , t) by ρ and the free binding sites concentrations X θ i (r , t) by ρ θ , biofilm volume fractions f i (r , t) and free binding sites volume fractions θ i (r , t) are achieved. Notably, both f i (r , t) and θ i (r , t) (in the absence of metals adsorption) are constrained to add up to unity at each location and (Rahman et al. 2015). In summary, the model components describing the granular biofilm mesoscale are: (1) Based on the continuum approach introduced in Wanner and Gujer (1986) for onedimensional planar biofilms, the model equations for granular biofilms were derived in Tenore et al. (2021a) from mass balance considerations.
The growth and the transport of sessile species within the granular biofilm are governed by the following system of nonlinear hyperbolic partial differential equations: where r M,i (r , t, f, S, M) is the net growth rate of the ith sessile microbial species, accounting for both the positive metabolic growth and the negative microbial decay, and u(r , t) is the biomass velocity. The velocity u(r , t) is governed by the following equation: The evolution of the free boundary domain is described by the following equation derived from global mass balances considerations on the granule volume: where σ a (t) and σ d (t) represent the attachment and detachment fluxes. New systems of PDEs have been derived here to model the variation of free binding sites and diffusion and adsorption of metals. As in the case of sessile species, the transport of free binding sites is modelled as an advective process (D'Acunto et al. 2018). Thus, the model equations governing the dynamics of the free binding sites take the following form: where r θ,i (r , t, f, S, θ , M) represents the variation of the ith sessile species adsorption sites due to the metal adsorption, growth and decay, and will be discussed later. Note that the displacement velocity for the free sites is the same as the advective velocity u(r , t) which regulates biofilm expansion as the sorption sites can be seen as an intrinsic characteristic of the biofilm components. Dividing Eq. (10) by ρ θ and considering Eqs.
(2) and (5) yields: Substituting Eq. (8) into Eq. (11) yields: The transport of heavy metals is modelled as a diffusive process (D'Acunto et al. 2018), and it is governed by the following system of parabolic PDEs: where r A, j (r , t, θ , M) and D M, j denote the adsorption rate and diffusion coefficient of the jth dissolved metal within the biofilm. Similarly, the diffusion and conversion of soluble substrates are expressed as follows: where r S, j (r , t, f, S, M) represents the conversion rate of the jth substrate and D S, j denotes the diffusion coefficient in biofilm for the jth dissolved substrate. The attachment flux is modelled as a continuous mass flux from the bulk liquid to the granule, given by the sum of the attachment fluxes σ a,i (t) of the planktonic microbial species present in the liquid phase. The term σ a,i (t) is modelled as a linear function of the concentration of the ith planktonic species in the bulk liquid (D'Acunto et al. 2019(D'Acunto et al. , 2021: where v a,i is the attachment velocity of the ith planktonic species, and ψ * i (t) is the concentration of the ith planktonic species within the bulk liquid.
The detachment flux is modelled as a quadratic function of the granule radius, according to the literature (Abbas et al. 2012): where λ is the detachment coefficient and is supposed to be equal for all microbial species.
Notably, attachment phenomena prevail on detachment phenomena in the initial stage of the de novo granulation process, while detachment phenomena become predominant as the granule dimension increases.

Bioreactor Macroscale Model
The reactor is modelled as a sequencing batch reactor in which N G granules having the same properties are immersed. Besides the sessile biomass (granules), also planktonic and detached biomasses are considered in the bulk liquid. Planktonic species contribute to the genesis of the granules, while detached biomass is formed as a result of the detachment process. The modelling choice to include planktonic and detached biomass as two different variables derives from the experimental experience that the newly detached biomass has different properties from both sessile and planktonic biomass (Rollet et al. 2009;Berlanga et al. 2014;Rumbaugh and Sauer 2020). Both planktonic and detached biomasses (suspended biomasses) contribute to the conversion of soluble substrates in the bulk liquid. Reconversion of detached biomass into planktonic biomass is also modelled. The bioreactor model is formulated for n microbial species in planktonic form ψ * i (t), n microbial species deriving from the detachment process ψ * d i (t), m 1 dissolved substrates S * j (t), and m 2 heavy metals M * j (t). All these variables are expressed in terms of concentration and modelled as functions of time and not of space, since the reactor is modelled as a completely mixed reactor. An SBR is based on a sequence of treatment cycles constituted by four phases: • Filling phase, in which the reactor is fed with a fixed volume of wastewater; • Reaction phase, in which the wastewater volume is biologically treated through the biomass present in the system; • Settling phase, which consists in the solid-liquid separation; • Emptying phase, in which the clarified supernatant is partially removed from the reactor.
The filling, settling and emptying phases are supposed to be instantaneous, and the duration of the reaction phase is supposed to be the same as the cycle duration. 100% settling efficiency is assumed for biofilm granules, while the suspended biomass has a partial settling efficiency. Moreover, since the volume occupied by the biomass in granular and suspended form is neglected, the reactor volume is assumed to be the same as the liquid volume. The cyclic configuration of the SBR is modelled with a system of first-order impulsive ordinary differential equations (IDEs) (Tenore et al. 2021c;Ferrentino et al. 2018). An IDE is described by three components: the continuous-time differential equation, which governs the state of the system between impulses; the impulse equation, which describes an impulsive jump and is defined by a jump function at the instant the impulse occurs; and the jump criterion, which defines a set of jump events in which the impulse equation is active.
In summary, the model components describing the bulk liquid are: while the system of IDEs is the following: where V is the volume of the bulk liquid; A(t) is the area of the spherical granule and is equal to 4π R 2 (t); r * ψ,i (t, ψ * , S * , M * ) and r * ψ d ,i (t, ψ * d , S * , M * ) are the growth rates for the ith planktonic and detached biomass, respectively; r * S, j (t, ψ * , ψ * d , S * , M * ) is the conversion rate for the jth soluble substrates; and r * C,i (t, ψ * d ) is the reconversion rate of the ith detached biomasses into planktonic form.
The jump functions associated with Eqs. (21)-(24) are: where γ is the fraction of suspended biomass removed during the emptying phase; ω is the emptying/refilling ratio; S in j and M in j are the concentrations of the jth substrate and jth metal in the influent; are the right and left limits of ψ * i , ψ * d i , S * j and M * j at time t k . Such systems of IDEs are derived from mass balance considerations and describe the dynamics of planktonic and detached biomasses, soluble substrates, and heavy metals within the bulk liquid. Specifically, the planktonic species concentration varies due to the attachment process, the metabolic activities and the conversion of the detached biomass. The detached species concentration varies as a result of the detachment process, the metabolic activities and the conversion into planktonic form. Soluble substrates diffuse across the granules and are consumed and/or produced by planktonic and detached biomasses. Finally, diffusion phenomena of heavy metals across the granules are accounted. Planktonic and detached biomasses do not contribute to the adsorption process.

Initial and Boundary Conditions
To integrate Eqs. (7)-(9), (12)- (14), (21)-(24), it is necessary to specify initial and boundary conditions. The de novo granulation process is modelled by coupling a vanishing initial condition to Eq. (9): The boundary condition for Eq. (8) is given by: The granule radius R(t) represents the free boundary of the mathematical problem. Its variation, governed by Eq. (9), depends on attachment σ a and detachment σ d velocity. In the initial phase, the granule radius is small, and consequently, attachment prevails on detachment. Therefore, it is σ a − σ d > 0 and the free boundary is a spacelike line. During maturation, the granule dimension increases, and the detachment is the prevailing process. Thus, it is σ a − σ d < 0, and the free boundary is a time-like line. When the free boundary is a space-like line, there is a mass flux from bulk liquid to granule, and the biofilm volume fractions at the granule-bulk liquid interface are dependent on characteristics of the bulk liquid. In particular, the volume fractions of sessile biomass depend on the concentration of planktonic biomass in the bulk liquid: while the volume fractions of the free binding sites are fixed equal to the biofilm volume fractions at the granule-bulk liquid interface: When the free boundary is a time-like line, there is a mass flux from the granule to the bulk liquid. Thus, the volume fractions at the interface are regulated exclusively by the internal points of the biofilm domain and conditions (31) and (32) are not required.
For what concerns substrates and metals diffusion (Eqs. (14) and (13)), a no-flux condition is fixed at the granule centre (r = 0), and a Dirichlet condition is considered at the granule-bulk liquid interface (r = R(t)): Note that S * j (t) and M * j (t) are the solutions of Eqs. (23) and (24), respectively. Equations (7), (14), (12), and (13) refer to the biofilm domain and do not require initial conditions, since the extension of the biofilm domain is zero at t = 0.
Lastly, the following initial conditions are considered for Eqs. (21)- (24): where ψ * i,0 , ψ * d i ,0 , S * j,0 , and M * j,0 are the initial concentrations of the ith planktonic and detached biomass, and the jth soluble substrate and dissolved metal within the bulk liquid, respectively.

Biochemical Framework: OPGs Granulation and Adsorption Processes
The mathematical model presented above simulates the biosorption process of metals on the matrix of biofilm granules, occurring in a granular-based SBR system, and is able to contextually describe granules genesis and ecology, bioreactor performances and adsorption process of inorganic compounds. In this work, the model is applied to study the ecology of OPGs and the adsorption process of a generic metal on their solid matrix. In this regard, the following variables are included in the model: • Granule variables: -Five sessile microbial species: phototrophs f PH (r , t), heterotrophic bacteria f H (r , t), nitrifying bacteria f N (r , t), EPS f EPS (r , t), and inactive biomass f I (r , t). -Five soluble compounds: inorganic carbon S IC (r , t), organic carbon S DOC (r , t), nitrate S NO 3 (r , t), ammonia S NH 3 (r , t), and dissolved oxygen S O 2 (r , t).

Adsorption Process
Compared to conventional physical/chemical technologies, biosorption is effective and less expensive when the metal concentration is less than 100 mg L −1 (Ahluwalia and Goyal 2007;Yang et al. 2015;Chojnacka 2010;Abbas et al. 2014;Anjana et al. 2007). Both living and dead (metabolically inactive) biological materials are able to adsorb toxic heavy metals, as various functional groups are found on their cell wall offering strong attraction forces for the metal ions and providing high metal removal efficiency (Abbas et al. 2014). Specifically, extracellular substances produced by microorganisms have a crucial role in biosorption of metals (Liu and Fang 2002) and are considered the major potential agents in biosorption processes (Naveed et al. 2019). In metal-stressed conditions, microorganisms are induced to produce a higher amount of EPS, increasing the adsorption potential of the microbial consortium (Naveed et al. 2019;Singh et al. 2006). Moreover, microorganisms do not only regulate the synthesis of EPS in response to toxic elements, but also increase EPS adsorption capacities (Naveed et al. 2019). These aspects are included in the model by adopting a higher adsorption constant for EPS and considering a stimulation term for EPS production in all microbial kinetics. Also phototrophs and inactive material play an important role in adsorption processes, as they show high metals removal efficiency and can achieve more effective biosorption of metals than bacteria and fungi (Singh et al. 2006). Indeed, metal accumulation capacity of phototrophs is comparable or sometimes higher than chemical sorbents (Mehta and Gaur 2005), and, in addition, as mentioned before they are the main EPS producers (Naveed et al. 2019). The use of dead biomass could be a preferred alternative, as it offers high metals adsorption capacity, easy recovery of biosorbed metals, absence of toxicity limitations and nutrients requirements for growth (Abbas et al. 2014;Fomina and Gadd 2014). However, in the case in which the solvent consists of industrial wastewater rich in metals, organic and nitrogen compounds, the problem related to the nutrients requirement is overcome and the utilization of algal-bacterial biomass allows to combine the advantages of EPS, microalgae and inactive material. Lastly, metals adsorption by suspended biomasses is neglected. Indeed, populations of planktonic and biofilm cells adsorb metals in different ways (Harrison et al. 2007), and it is experimentally proved that immobilized bacterial cells have much higher biosorption capacities than suspended cells (Rani et al. 2010). Moreover, the use of freely suspended microbial biosorbents has further disadvantages including small particle size, low density, poor mechanical strength, and little rigidity, while the use of biofilms minimizes these disadvantages (Fomina and Gadd 2014).
The adsorption process is accounted in the model through the reaction terms present in Eqs. (12) and (13). In particular, the variation rate of the sessile species adsorption sites and the metal concentration are modelled as follows: wherem denotes the number of growth processes occurring in the biofilm and accounted in the mathematical model; k d,i is the decay-inactivation rate for the ith microbial species; Y ads,i and k ads,i represent the biosorption yield and the adsorption kinetic constant of the ith microbial species; ρ θ is the density of the binding sites; α i,k is the biochemical rate coefficient of the kth growth process of the microbial sessile species i; ν k represents the kinetic rate of the kth growth process within the biofilm. All model parameters are reported in Table 1.
In these formulations, the consumption of free binding sites due to biosorption and the formation of new free binding sites due to the sessile biomass growth are considered. Moreover, decay processes of active species lead to a proportional decrease of the corresponding free binding sites and a consequent increase of free sites in the inert material.
As mentioned above, in metal-stressed conditions microorganisms regulate the synthesis of EPS and are induced to produce more. To include this aspect in the model, EPS fraction produced by each the microbial species is modelled as function of the metal concentration: whereK EPS,i and K s,i are the EPS fraction produced by the ith microbial species in the absence of toxic pollutants and the stimulation constant for EPS of the ith microbial species, and their values are reported in "Appendix". The model also takes into account the toxic effect of metals on microbial metabolic processes, by considering  an inhibition term in all microbial growth kinetics: where K in M is the inhibition coefficient for the generic heavy metal, and its value is reported in "Appendix".

Metabolic Activities of OPGs
All main biological processes involved in the OPGs lifecycle are included in the mathematical model. For this purpose, phototrophs PH, heterotrophic bacteria H , and nitrifying bacteria N are taken into account as active microbial species. The following soluble substrates are considered: inorganic carbon IC, organic carbon DOC, nitrate NO 3 , ammonia NH 3 , and dissolved oxygen O 2 .
The growth metabolism of phototrophs is affected by light. Two different processes of phototrophic growth in the presence of light are taken into account, based on the available nitrogen source. In the presence of NH 3 , phototrophs carry out photosynthesis, consuming IC and NH 3 and producing O 2 and DOC. In the absence or shortage of ammonia, phototrophs can grow by using NO 3 as nitrogen source. Furthermore, the model takes into account the inhibition induced by the presence of O 2 on the photosynthetic activity. In the absence of light, DOC, O 2 , and NH 3 are consumed by the phototrophs, which produce IC. Heterotrophic bacteria use DOC as a source of carbon and energy, and produce inorganic carbon IC. They are assumed to grow under aerobic condition directly using O 2 , as well as anoxic condition using NO 3 as oxygen source (denitrification process). As in the previous case, this aspect is modelled using an inhibition term for oxygen in the nitrate-based heterotrophic growth kinetic (Wolf et al. 2007). Nitrifying bacteria include ammonia-oxidizing bacteria and nitrite-oxidizing bacteria. For this reason, they are responsible for NH 3 conversion into NO 2 , and the subsequent NO 2 conversion into NO 3 . The same biological processes are supposed to occur in the bulk liquid, where planktonic and detached biomasses consume or produce the jth soluble substrate. The mathematical model considers the production of EPS and inactive material only in sessile form. Indeed, the EPS production by suspended biomass has been neglected because it is much lower than sessile production (Tenore et al. 2021c), as well as the production of suspended inactive biomass that does not play any role in the biological process. Moreover, phototrophs are regarded as the main EPS contributors (Naveed et al. 2019), and this aspect has been considered in the model by adopting different values of EPS fraction produced by the microbial species. The biochemical kinetic expressions and the attachment formulations are taken from Tenore et al. (2021c) and are reported and discussed in "Appendix".

Conversion from Detached to Planktonic Biomass
Detached biomass has different characteristics from both sessile and planktonic biomasses (Rollet et al. 2009;Berlanga et al. 2014;Rumbaugh and Sauer 2020). Exper-imental observations suggest that the surface properties of detached cells clearly differ from those of planktonic and sessile cells for at least the first 48 h after detachment (Berlanga et al. 2014). For this reason, the reconversion rate of the ith detached species into planktonic form, reported in Eqs. (21) and (22), is modelled as follows: where K C is the conversion constant from detached to planktonic form, and its value is reported in "Appendix".

Numerical Studies and Results
The model has been integrated numerically by developing an original code in MatLab platform. Hyperbolic PDEs (7) and (12) have been integrated by using the method of characteristics, applied for the first time to the planar case by D'Acunto and Frunzo (2011). The method of lines has been used to solve the diffusion-reaction PDEs (14) and (13). The ODEs for ψ * i , ψ * d i , S * j , and M * j (Eqs. (21)- (24)) have been integrated by using the MatLab routine ode45. Numerical simulations have been performed to investigate the genesis and evolution of oxygenic photogranules, the microbial species stratification and interaction between the functional trophic groups, and to study the SBR performances in terms of substrates removal and metal adsorption. Specifically, the first study (SET1) investigates the treatment process of a typical industrial wastewater containing a low concentration of a generic metal. Both the granules ecology and the process evolution have been investigated, focusing on metal effects on biofilm formation and its removal process. The second study (SET2) investigates how the metal concentration affects the OPGs formation and adsorption processes in terms of microbial growth and removal efficiency. Finally, the third study (SET3) explores the role of the adsorption capacities of all the microbial species in the adsorption process.
The wastewater influent is supposed to be fed discontinuously in the SBR. As mentioned before, in each cycle the reactor is filled with a fixed volume V of wastewater, and the substrates are biologically degraded in batch conditions. The bioreactor volume V is assumed constant and equal to 1 L. The number of granules N G has been selected through an iterative procedure varying the detachment coefficient λ (Tenore et al. 2021a), with the aim to obtain a 25% filling ratio by considering granules with a steady-state radius of about 1 mm (an average size representative of OPGs Abouhend et al. 2018Abouhend et al. , 2019. After the reaction phase, the solid-liquid separation occurs in the reactor, whereby perfect settling has been considered for granules (no granule is removed from the reactor during the emptying phase). While the fraction of suspended biomass lost during the emptying phase has been set equal to 20%. At the end of each cycle, the reactor is only partially emptied and refilled with a new liquid volume to be treated (emptying/refilling ratio ω = 50%). As explained above, the reaction phase is supposed to be the same as the duration of the cycle τ , and it consists of 3 hours of darkness and 3 hours of light (t dark = t light = 0.125 d and τ = 0.25 d) (Tenore et al. 2021c;Abouhend et al. 2018). In the light phase, the reactor is supposed to be homoge-neously illuminated and the incident light intensity I 0 is fixed at 0.008 kmol m −2 d −1 (Tenore et al. 2021c).
The same wastewater influent composition is considered for each treatment cycle. It is characterized by S in IC = 180 g m −3 (inorganic carbon), S in DOC = 500 g m −3 (organic carbon), S in NH 3 = 50 g m −3 (ammonia), S in NO 3 = 0 (nitrate), S in O 2 = 0 (oxygen). Such concentrations reflect the typical wastewater composition (Brockmann et al. 2021;Yang et al. 2020). The concentration of the heavy metal in the influent M in is varied in the numerical studies, and its values will be provided below, case to case. The initial concentrations of soluble substrates S * j,0 and metal M * 0 in the bulk liquid have been set equal to the concentration within the wastewater influent (S in j and M in ). On the contrary, no suspended biomass is supposed to be present in the influent (ψ in i = 0 and ψ in d i = 0), while phototrophic inoculum of suspended phototrophs is considered, where planktonic heterotrophic and nitrifying bacteria are present in smaller amounts: ψ * PH,0 = 600 g m −3 , ψ * H ,0 = ψ * N ,0 = 50 g m −3 (Tenore et al. 2021c). The initial concentration of detached species ψ * d i ,0 in the bulk liquid has been set equal to zero (ψ * d i ,0 = 0). Note that no addition of oxygen is considered (S in O 2 = 0), since it is provided by photosynthesis of phototrophs.
Since the phototrophs are the major EPS producers in algal-bacterial biofilm, the EPS fraction produced in the absence of toxic pollutants is assumed to be higher than heterotrophs (K EPS,H = 0.18, Merkey et al. 2009) and nitrifiers (K EPS,N = 0.075, Merkey et al. 2009) and is fixed atK EPS,PH = 0.23. Such value is within the range of typical EPS fraction values of phototrophic biomass (Wolf et al. 2007). Regarding the adsorption kinetic constants of the biofilm components, k ads,EPS , k ads,PH and k ads,I are supposed to be much higher than k ads,H and k ads,N , since the adsorption process is predominantly governed by EPS, phototrophs and inactive material. Finally, as mentioned above, attachment velocity of phototrophs is assumed to be a constant value and it is set equal to the average value of attachment velocities of microalgae and cyanobacteria used by Tenore et al. (2021c). All parameters used in this model are reported in Table 1.
The simulation time T is fixed to 200 d for all simulations. This time interval guarantees to achieve the steady-state configuration in terms of: performance of SBR cycles (including soluble substrates S * j , metal M * , planktonic species ψ * i , and detached biomasses ψ * d i ), granule size R(t); microbial composition and distribution within the granules (in terms of fraction f i and mass m i ); volume fractions of free binding sites θ i ; and concentration of free metal M within the biofilm.

SET1: Evaluation of Metal Removal from Industrial Wastewater in OPG-based System
The first set SET1 describes the treatment process of a typical industrial wastewater with a low concentration of metal (M in = 100 g m −3 ), occurring in a granular-based sequencing batch reactor (simulation S1). The microbial stratification of oxygenic photogranules, nutrients degradation and metal adsorption are investigated. The SET1 results are shown in Figs. 2, 3, 4 and 5.  Figure 2 reports the evolution of the overall mass of sessile species m i (t) (top) and photogranule radius R(t) (bottom) over time. The active sessile biomasses constituting the biofilm matrix (phototrophs, heterotrophs and nitrifiers) grow by converting the nutrients, and decay producing inert material. Such biomasses can interact with each other, cooperating and/or competing. In the presence of light, phototrophs produce O 2 and DOC consuming IC and NH 3 (or NO 3 ), and consequently they promote the heterotrophs and nitrifiers growth. Indeed, heterotrophic bacteria require O 2 (or NO 3 in anoxic condition) and DOC for their metabolic activities. While NH 3 and O 2 are necessary for nitrifying bacteria, which compete with phototrophs for IC. However, nitrifiers produce NO 3 necessary for heterotrophs in anoxic condition and for phototrophs in lack or shortage of NH 3 . Under dark conditions, phototrophs compete with heterotrophs and nitrifiers for O 2 and with all heterotrophs for DOC. In return, heterotrophic bacteria produce IC necessary for the metabolism of phototrophs in light conditions and nitrifiers. In the initial days, the intense attachment process leads to the formation of photogranules mainly composed by phototrophs. Oxygen production during the photosynthesis promotes the growth of heterotrophic bacteria. Thus, the heterotrophic biomass rapidly increases with respect to the other microbial species, thanks to their high growth rates in the presence of elevate availability of DOC. It should be noted that the metabolism of all biomasses is initially inhibited, due to the presence of free metal. In this phase, the photogranule slowly increases, achieving a radius of about 600 µm (Fig. 2-bottom). After 40 days, when a relevant amount of metal is already adsorbed on biofilm matrix, a more rapid phototrophs (blue) growth is observed. As a consequence, heterotrophs (red) metabolism and production of EPS (magenta) and inert material (black) are favoured. This, in turn, leads to a faster increase of the granule radius. Subsequently, the detachment process becomes more relevant and limits the granule expansion leading to a steady-state dimension of about 920 µm. A very low mass of nitrifying bacteria (yellow) is observed throughout the process, because they have lower maximum growth rates than heterotrophic bacteria, which are more competitive in the use of O 2 in the presence of DOC. Figure 3 shows the microbial stratification within the granule (from first row to fourth row) and the free metal concentration (fifth row) at different times. After 20 and 30 days, significant fractions of phototrophs (blue) and heterotrophs (red) can be observed throughout the granule. Indeed, phototrophs are responsible for the genesis of the photogranules due to their granulation properties, while heterotrophic bacteria have the highest growth rate. Obviously, in the initial stage of the process the concentration of free metal (black) is still elevate and the metal diffuses throughout the granule inhibiting the microorganisms growth. From T = 30 d to T = 40 d, the concentration of free metal significantly reduces thanks to the growth of phototrophs (see Fig. 5). Indeed, phototrophs have a tendency to secrete EPS higher than other microbial species, and both phototrophs and EPS have higher adsorption capabilities than heterotrophs and nitrifiers. Thanks to the metal consumption, phototrophs are in turn less inhibited and continue to grow. The steady state of microbial species distribution and free metal concentration is achieved at T = 80 d. Note that phototrophs and EPS are present in relevant amounts and a clear microbial species stratification can be observed: phototrophic biomass accumulates in the outermost layers, where optimal light conditions are guaranteed; heterotrophic bacteria predominantly populate the external part of the granule; EPS (magenta) is homogeneously distributed throughout the granule. In addition, as observed in Fig. 2, nitrifying bacteria (yellow) are almost absent. As regard the free metal diffusion, after the complete evolution of the granule, the adsorption process is completed, and a gradient of free metal concentration can be observed across the granule: the free metal concentration goes from low values in a thin external layer to zero in the internal part. Biofilm volume fractions and free binding sites volume fractions along the granule radius at different times are reported in Fig. 4. As shown in Fig. 2, after 20 days the granule has achieved a radius of about 500 µm and the binding sites of each biofilm component are almost completely consumed. This is ascribed to the combination of different factors: high concentration of metal in the influent wastewater, which is rapidly adsorbed on the granule matrix, granules not completely developed and overall characterized by a small number of binding sites; low fraction of phototrophs throughout the granule. As shown in Fig. 3, when the phototrophs and EPS fractions start to be relevant (T = 40 d), the adsorption process is favoured, microorganisms are less inhibited and the granule radius increases. As a consequence, new free binding sites are formed and immediately occupied. From T = 40 d to T = 60 d, the granule radius undergoes a further significant increase (Fig. 2), and the residual metal concentration is completely adsorbed (see Fig. 5) thanks to the high volume fractions of free binding sites. After 80 days, the granule radius, microbial species distribution and volume fractions of free binding sites have achieved the steady-state configuration. Confirming what has been observed in Fig. 3, the granule is mainly composed by EPS, phototrophs, inert material, and heterotrophs. The residual binding sites still free indicate the algalbacterial granules containing in the SBR are perfectly able to remove the metal present in the influent wastewater. Figure 5 reports the concentration of soluble substrates and metal within the reactor over time. The observation period includes the process start-up until the achievement of a periodic trend for all model variables, representative of the working configuration of the reactor. It should be noted that such concentrations have a discontinuous trend, due to the SBR configuration. In the initial phase, the biofilm granules are small, and the consumption and production of soluble substrates are governed by planktonic biomass (see Fig. 7). Heterotrophic bacteria and phototrophs have higher growth rates than other microbial species. Thus, DOC (red) and NH 3 (cyan) consumption and IC (blue) production can be observed. When photogranules dimension increases, biological processes start to be governed by sessile species. After 10 days, the oxygen (magenta) produced by phototrophs in the presence of light is not sufficient for heterotrophs and nitrifiers, and no NO 3 (yellow) is present in the reactor. Thus, a temporary equilibrium in terms of soluble substrates characterizes the system from 10 to 40 days. In this time frame, the metal (black) is slowly adsorbed on granules matrix and the metal inhibition effect on metabolic microbial activities reduces over time. As observed in Fig. 3, this favours phototrophs growth. Consequently, thanks to O 2 production (magenta), heterotrophic bacteria growth is promoted. Moreover, in this phase phototrophs are in turn responsible for more rapid metal adsorption, thanks to their elevate EPS productions and high adsorption capabilities. Metabolic activities of phototrophs and heterotrophs result in the complete NH 3 and DOC degradation, IC consumption, and M adsorption after t = 60 d. Once the photogranules have reached a steady-state dimension and microbial stratification, the trend of the substrates and metal concentrations are repeated identically in each cycle. Figure 6 shows the evolution of the substrates and metal concentrations over time in the reactor in the period between 199 and 200 days. Note that each cycle identically repeats four times in a single day, and, for this reason, it is representative of the operating conditions of the system, while the substrates and metal concentrations at the end of each cycle are representative of the effluent composition. Solid lines represent the trends of IC (blue), DOC (red), NO 3 (yellow), NH 3 (cyan), O 2 (magenta), M (black) concentrations during the cycles. Each cycle is constituted by three hours of dark phase (grey parts of the graphs) and three hours of light phase (white parts of the graphs). While the circle and cross markers represent the concentrations of substrates and metal in the effluent and influent, respectively. Due to the absence of light, in the first part of each cycle phototrophs and heterotrophs compete for O 2 (produced in the previous cycle), DOC and NH 3 producing IC. Contextually, a small amount of nitrifiers contributes to the conversion of O 2 , IC and NH 3 into NO 3 . When oxygen is completely consumed, anoxic heterotrophs grow consuming DOC and NO 3 . When the concentration of nitrate reaches zero as well, the trend of substrate concentrations does not show significant variations until the end of the dark period. In light conditions, phototrophs carry out photosynthesis, consuming NH 3 and IC, and producing large amount of O 2 necessary for heterotrophs and nitrifiers. Nevertheless, heterotrophic bacteria are more competitive in the use of O 2 in the presence of DOC. As a result, the DOC concentration reduces and IC concentration increases. When the organic carbon ends, oxygen produced by phototrophs is used by nitrifying bacteria. For this reason, NH 3 and IC concentrations decreases, and NO 3 concentration increases. When also NH 3 is completely consumed, phototrophs grow on NO 3 . At the end of the cycle, NH 3 and DOC have been completely removed, and a very low concentrations of NO 3 (less than 5 g m −3 ) and a concentration of about 30 g m −3 of O 2 are observed. Indeed, the biomass of nitrifying bacteria within the granule and their growth rate are very low; therefore, the production of NO 3 is limited. Regarding the metal adsorption, as already observed in Fig. 2 (top) at the steady state the granule is mainly composed by phototrophs, EPS and inert material which are the major responsible for the adsorption process. Thus, during the day/night cycle the metal is completely adsorbed on granule matrix.
The concentration of planktonic and detached biomasses within the reactor over time is shown in Fig. 7. As for soluble substrates and metal (Fig. 5), the observation period includes the process start-up until the achievement of a periodic trend for all model variables. Several factors can affect the suspended biomasses evolution over time. Attachment phenomena contribute to decrease the concentrations of planktonic species, while detachment phenomena promote the growth of detached biomasses. Both types of biomasses grow on soluble substrates and decay. Moreover, their concentration reduces during the emptying phase due to their non-perfect settling properties. Lastly, detached biomasses reconvert into the planktonic cells after 48 h from the detachment. In the initial stage of the process, granules have still small dimension and there is high nutrients availability. As a consequence, the substrates dynamics within the reactor are governed by planktonic biomass. Heterotrophic bacteria have higher growth rate than other microbial species, and their concentration rapidly increases. When the photogranules dimension increases, biological processes are governed by sessile species. Since then, the amount of substrates available for suspended biomass reduces and the concentration of heterotrophs in planktonic form decreases over time. Other species have low growth rates, and their concentrations decrease over time from the beginning of the process, due to the wash-out and attachment process. After 20 days, photogranules are already formed and the detachment process becomes relevant. This results in the increase of the concentration of heterotrophic detached biomass. Indeed, as shown in Fig. 3 the granule is initially composed by large amount of heterotrophs. After 40 days, sessile phototrophs grow within the granule and, consequently, the concentration of phototrophic detached biomass increases due to the detachment process. The conversion of heterotrophic and phototrophic detached biomasses into planktonic form induces a further increase of planktonic species. Subsequently, due to the shortage of DOC (Fig. 5), a slight reduction of planktonic species concentration within the bulk liquid can be observed again. Overall, after 60 days all suspended species within the reactor achieve a steady-state value.

SET2: Effects of Metal Concentration on OPGs Formation and Adsorption Processes
Metals in wastewater may increase the sessile production of EPS, and, at the same time, may be the cause of stress conditions responsible for the death of microbial cells. More studies are necessary to identify a concentration range that allows microorganisms to grow and secrete EPS maximizing the removal efficiency of metals from wastewater. In this numerical study S E T 2, the efficiency of metal adsorption on the matrix of biofilm granules and the inhibiting effect on OPGs formation are investigated by considering different metal concentrations. For this purpose, eleven simulations (S2-S12) have been carried out by setting the concentration of metal in the influent M in equal to 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200 g m −3 . The concentration of soluble substrates in the influent wastewater S in j and initial concentration of planktonic biomasses within the reactor ψ * i,0 set for this numerical study are the same as in S E T 1. Numerical results are summarized in Figs. 8,9,10,11,12 and 13. The concentration of metal in the influent affects the adsorption process as well as the microbial species stratification of OPGs. The distribution of the phototrophic sessile biomass at different times is reported in Fig. 8 for the following simulations: , S10 (M in = 160 g m −3 ). When the metal concentration present in the bioreactor is very low (S4), phototrophs are less inhibited and grow faster within the granule. Conversely, a higher concentration of free metal results in a higher inhibition effect and leads to a slower growth of phototrophs. It means that for wastewater richer in metal the growth of phototrophic species and the adsorption process occur in a longer time. Thus, the maximum fraction of phototrophs is observed later going from S4 to S8. However, after long times the phototrophs distribution is no longer affected by M in and all simulations achieve the same steady-state configuration after 200 days, except for M in = 160 g m −3 . Indeed, in this case (S10) the metal concentration is too high, and the biomasses growth and the granule formation are strongly inhibited by the presence of free metal. As a result, the photogranule does not completely develop and the absence of phototrophs is observed throughout the granule at 200 days. This is visible also in Fig. 9, where the mass of sessile microbial species within the granule is shown at different times. Relevant differences concern the initial phase of the process when the total sessile mass is higher for low metal concentrations. However, after long times (when the adsorption process is completed) the sessile mass of the individual microbial species within the granule is no longer affected by the presence of metal for M in lower than 140 g m −3 .
The evolution of the granule radius R(t) over time is shown in Fig. 10. M in affects the granule evolution in the initial stage of the process. For low concentrations of metal, the granule radius increases earlier, small inhibiting effects are observed during the granulation process, and the adsorption process is faster completed. When M in is higher or equal to 100 g m −3 , the granule partially grows, and a further radius increment associated to phototrophs growth can be observed later. Note that passing from S6 to S8 the phototrophs growth and the subsequent further increment of the granule radius are increasingly slowed down by the presence of free metal, as observed in Fig. 8. Instead, when M in is equal to 140, 160, 180 and 200 g m −3 the phototrophic biomass growth is totally inhibited. Hence, the absence of phototrophs observed in Figs. 8 and 9 is confirmed by the incomplete development of the granule. The metal and substrates concentrations in the effluent after each SBR cycle are displayed in Figs. 11 and 12. Each point represents the concentrations of metal and substrates in the effluent at the end of each cycle. Figure 11 shows that for low metal concentration in the influent wastewater, the adsorption process is rapid and almost linear. When M in is equal to 100 and 120 g m −3 , the removal process slows down at T = 20 d. The phototrophic biomass is characterized by lower growth rate than heterotrophs, and the inhibiting effect related to the presence of free metal further limits their growth process. Later, after 30 days, a considerable growth of phototrophs allows to successfully complete the adsorption process. Specifically, higher is the metal concentration in the influent and slower is the adsorption process. This is related to two aspects: the amount of free metal to adsorb is larger, and the phototrophs growth is slower due to the stronger metal inhibition effect. As shown in Fig. 9, for M in higher or equal to 140 g m −3 the granule is not completely developed, and a small amount of EPS and a not visible fraction of phototrophs are present in the granule. Consequently, the adsorption process is not yet completed after 200 days. The effluent concentration of soluble substrates is reported in Fig. 12. The initial phase of the process, in which DOC and NH 3 are consumed and IC is produced, is faster when the metal concentration in the influent is lower. Indeed, the inhibiting effect delays the granulation process and, as a consequence, the substrates consumption/production. The subsequent phase is governed by phototrophs, which promote the metabolic activities of the heterotrophic bacteria producing O 2 . When M in is higher, phototrophs growth is slower, and oxygen is less rapidly produced. As a result, time necessary to reach the complete degradation of DOC and NH 3 and the maximum IC reduction increases. Specifically, the same effluent composition both in terms of metal (Fig. 11) and substrates (Fig. 12) is achieved at the steady state for M in lower than 140 g m −3 . In the other cases, the degradation of nutrients and metal adsorption only partially occur.
The steady-state configuration of the residual free binding sites within the biofilm granule is reported in Fig. 13. Obviously, when no metal is present in the influent wastewater (S2), no adsorption site is occupied during the granulation process and the sum of all free binding sites volume fractions returns 1 at each location and time. = 0 (oxygen). S13 : ρ θ = 10 kg sites m −3 , S14 : ρ θ = 30 kg sites m −3 , S15 : ρ θ = 40 kg sites m −3 , S16 : ρ θ = 50 kg sites m −3 . Incident light intensity: I 0 = 0.008 kmol m −2 d −1 . Duration of the cycle: τ = 6 h. Time of light exposure: t light = 50% τ the adsorption process requires a growing number of binding sites. Consequently, a decreasing residual amount of adsorption sites can be observed, although the granule achieves the same steady-state dimension. Lastly, when the metal concentration is too high, the adsorption process is not completed (from S9 to S12), the granule does not completely develop due to the stronger inhibiting effect.

SET3: Effects of Metal Adsorption Capabilities on OPGs Formation and Adsorption Processes
Experimental works show that heat or acid pretreatments enhance the metal adsorption potential of algal-bacterial biomass (Mehta and Gaur 2005). Metal affinity to the biomass could be manipulated by pretreating the biomass with alkalies, acids, detergents and heat, which may increase the amount of adsorbed metal and reduce the time necessary for the adsorption process (Ahalya et al. 2003). Indeed, a physical/chemical pretreatment affects the permeability and surface charge of the biomass and increases the amount of adsorption sites accessible for metal biosorption (Abbas et al. 2014).
In this context, a numerical study (SET3) is performed to investigate the pretreatment effect on the evolution of biofilm granules and metal removal. Four simulations (S13-S16) have been carried out using different values of binding sites densities ρ θ .
The four values of ρ θ used are: 10, 30, 40, 50 kg sites m −3 . The concentration of soluble substrates in the influent wastewater S in j and initial concentration of planktonic = 0 (oxygen). S13 : ρ θ = 10 kg sites m −3 , S14 : ρ θ = 30 kg sites m −3 , S15 : ρ θ = 40 kg sites m −3 , S16 : ρ θ = 50 kg sites m −3 . Incident light intensity: I 0 = 0.008 kmol m −2 d −1 . Duration of the cycle: τ = 6 h. Time of light exposure: t light = 50% τ biomasses within the reactor ψ * i,0 set for this numerical study are the same as in SET1. Numerical results are summarized in Figs. 14,15,16,17,18 and 19. The time evolution of the granule radius R(t) is shown in Fig. 14. It is clear that different densities of binding sites ρ θ affect the granule evolution in the second stage of the process, since the further radius increment around 20-50 days is associated with the phototrophs growth and phototrophs and EPS have better adsorption capabilities. Indeed, when ρ θ increases, the granulation process occurs rapidly and the granule reaches the steady-state size quickly. However, such steady-state size is not dependent on the binding sites density. Indeed, the profiles of R(t) get closer over time and reach the same steady-state value, except for ρ θ = 10 kg sites m −3 . It leads to conclude that with very low densities of binding sites the granulation and adsorption process do not completely evolve. Figure 15 reports the sessile mass of the different microbial species within the granule. Again, relevant differences concern phototrophs growth. The phototrophs mass increases faster when the algal-bacterial consortium has higher binding sites densities. Metal removal and phototrophs growth positively influence each other. A faster metal adsorption enhances the phototrophic growth rate, and phototrophs contribute to accelerate the metal removal process thanks to their high adsorption properties. This is visible also in Fig. 16, where the phototrophic sessile biomass within the granule is shown at different times. Again, relevant differences concern the time frame which goes from 20 to 50 days. By increasing ρ θ , phototrophic sessile biomass grows = 0 (oxygen). S13 : ρ θ = 10 kg sites m −3 , S14 : ρ θ = 30 kg sites m −3 , S15 : ρ θ = 40 kg sites m −3 , S16 : ρ θ = 50 kg sites m −3 . Incident light intensity: I 0 = 0.008 kmol m −2 d −1 . Duration of the cycle: τ = 6 h. Time of light exposure: t light = 50% τ faster and the steady-state microbial distribution is reached earlier. However, the steady-state distribution is the same for all values of densities, except for the simulation S13, in which no phototrophic biomass is detected throughout the granule. Figure 17 presents the steady-state configuration of the residual free binding sites within the biofilm granule. Obviously, for ρ θ equal to 10 kg sites m −3 the adsorption process is not completed (S13), the granule does not completely develop due to the stronger inhibiting effect, and the binding sites are almost occupied. On the contrary, for higher values of binding sites density an increasing residual fraction of adsorption sites can be observed (S14-S16). Figures 18 and 19 show the trend of soluble substrates and metal concentrations in the SBR effluent, respectively. Each point represents the concentrations of substrates and metal in the effluent at the end of each cycle. As mentioned before, in the initial stage of the process the consumption and production of soluble substrates mainly depend on the metabolic activity of heterotrophic biomass. Consequently, the trends of soluble substrates are not affected by the variation of ρ θ , since the role of heterotrophic bacteria in the adsorption process is marginal. For later times, phototrophic biomass starts to grow, and the trend of substrates (Fig. 18) and metal (Fig. 19) becomes more = 0 (oxygen). S13 : ρ θ = 10 kg sites m −3 , S14 : ρ θ = 30 kg sites m −3 , S15 : ρ θ = 40 kg sites m −3 , S16 : ρ θ = 50 kg sites m −3 . Incident light intensity: I 0 = 0.008 kmol m −2 d −1 . Duration of the cycle: τ = 6 h. Time of light exposure: t light = 50% τ sensitive to ρ θ . For high values of ρ θ , the concentrations of soluble substrates and metal achieve the steady-state values earlier and the time required to completely adsorb the residual metal decreases. For ρ θ = 10 kg sites m −3 , the metal adsorption process is not complete, due to the absence of phototrophs and the small amount of EPS observed throughout the granule. From the numerical results, it is clear that the density of binding sites ρ θ influences the adsorption process rate of the free metal and, therefore, the time necessary to achieve metal removal. Anyway, it can be concluded that the steady-state configuration in terms of biofilm dimension, microbial species stratification, and metal removal efficiency of the process are not affected by ρ θ above a critical value.

Discussion and Conclusions
Biosorption is proving to be a promising alternative to conventional methods for the removal of metals from municipal and industrial effluents, as microorganisms and their derived products have high biosorption capabilities for inorganic compounds. Indeed, conventional physicochemical methods for metals removal are expensive and inefficient for very low metal concentrations (Abbas et al. 2014;Ahluwalia and Goyal 2007;Anjana et al. 2007;Chojnacka 2010). Biosorption offers several advantages including cost-effectiveness, high efficiency, minimization of chemical compounds utilization, and regeneration of biosorbents (Abbas et al. 2014). Nevertheless, there = 0 (oxygen). S13 : ρ θ = 10 kg sites m −3 , S14 : ρ θ = 30 kg sites m −3 , S15 : ρ θ = 40 kg sites m −3 , S16 : ρ θ = 50 kg sites m −3 . Incident light intensity: I 0 = 0.008 kmol m −2 d −1 . Duration of the cycle: τ = 6 h. Time of light exposure: t light = 50% τ are practical limitations as living biomass is very sensitive to high metal concentrations (Muñoz et al. 2006). A deeper understanding of metal toxicity effects in biofilms is crucial to the successfully design of bioreactors for the contextual removal of organic contaminants and metals. The mathematical model proposed in this work allows to simulate the formation and evolution of oxygenic photogranules within a granularbased sequencing batch reactor and describes the adsorption process of metals on = 0 (oxygen). S13 : ρ θ = 10 kg sites m −3 , S14 : ρ θ = 30 kg sites m −3 , S15 : ρ θ = 40 kg sites m −3 , S16 : ρ θ = 50 kg sites m −3 . Incident light intensity: I 0 = 0.008 kmol m −2 d −1 . Duration of the cycle: τ = 6 h. Time of light exposure: t light = 50% τ the biofilm granules. The most interesting observations resulting from the numerical studies are summarized below: • The adsorption process on oxygenic photogranules matrix shows high removal efficiency. These numerical results are in accordance with experimental works in which more than 99% of metal present in aqueous solutions is adsorbed using algal-bacterial granules, thanks to their excellent adsorption capacities (Yang et al. 2015(Yang et al. , 2020(Yang et al. , 2021. • The results outline the key role of phototrophs and EPS in the metal removal process, as phototrophs are good biosorbents and metals stimulate the production of EPS in greater amount and with higher adsorption capabilities. These results reflect what has been observed in Yang et al. (2020), where a comparison between conventional bacterial granules and algal-bacterial photogranules is performed, demonstrating that algal-bacterial granular biofilms show advantages in both biosorption capacity and granular stability. • Furthermore, the model confirms that the performances of the adsorption process can be significantly affected by the metals concentration present in the wastewater. The highest removal efficiencies are achieved for low concentrations of metal in the influent (Abbas et al. 2014). Indeed, higher is the metal concentration in the influent stronger will be the inhibiting effect on the microbial growth. Although EPS content significantly increases in presence of metals (Yang et al. 2015), numerical results show that it is not sufficient in case of very high metal concentration. Moreover, as shown by Yang et al. (2015), biomass growth is not or is little inhibited by certain concentrations of heavy metals, confirming that algal biomass could efficiently remove them through intracellular accumulation and extracellular immobilization. • Lastly, the model results show how a higher density of binding sites, induced by heat or acids pretreatments, may enhance the adsorption process and reduce the time required for the complete degradation of substrates and removal of metals (Ahalya et al. 2003).
The results are qualitatively in accordance with the experimental evidence reported in the literature, showing that the model is able to correctly simulate both the formation and maturation of oxygenic photogranules and removal process of toxic metals. From an engineering point of view, this model can represent a useful tool in studying the removal processes of both organic and inorganic compounds in granular-based sequencing batch reactor systems.
The present work also suggests the potential applicability of the algal-bacterial granules for a multicomponent heavy metal adsorption. Nevertheless, the treatment of a multicomponent system could be not as easy as the removal of a single contaminant. Indeed, the simultaneous presence of more metals could lead to antagonistic effects reducing the removal efficiency. Looking forward, research activities should be geared towards ways to minimize the antagonistic effects between contaminants.
Finally, with a view to future works further relevant aspects of this biological system could be addressed and incorporated in the model, such as the electrodiffusive transport of metals deriving from the self-induced generation of an electric field, the pH effect on microalgal metabolism and inorganic carbon availability as well as the pH dependence of the binding sites availability. Furthermore, trace metals usually have a Hormesis effect on biochemical processes, that is they stimulate the microbial activity at low dose while inhibiting at high dose. In this perspective, such mechanism could be incorporated in the model to optimize the metabolic growth process based on the metal concentration. and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.   Table 4 Kinetic rate expressions (ν k ) of the biological processes within the biofilm  Table 6 Biochemical rate coefficients (β * i,k ) of the biological processes within the bulk liquid  Table 7 Kinetic rate expressions (ν * k ) of the biological processes within the bulk liquid coefficient and the oxygen saturation concentration in the bulk liquid, respectively; α * i,k is the stoichiometric coefficient of the ith planktonic species referred to the kth biological process within the bulk liquid (Table 5);ᾱ * i,k is the stoichiometric coefficient of the ith detached species referred to the kth biological process within the bulk liquid (Table 5); β * j,k is the stoichiometric coefficient of the jth soluble substrate referred for the kth biological process within the bulk liquid (Table 6); ν * k represents the kinetic rate of the kth biological process within the bulk liquid (Table 7). Gas-liquid transfer has been only included in the oxygen mass balance (Eq. (S.11)), in agreement with Muñoz Sierra et al. (2014), as gas-liquid transfer of the other compounds appears to be negligible at pH characteristic of wastewater (Table 1).