1 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 (Ansari et al. 2019; 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, 2021) or organic compounds (Ansari et al. 2019; 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 Mašić and 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. (2019, 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 (Ansari et al. 2019; Abouhend et al. 2018, 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.

2 Mathematical Model

The mathematical model simulates the biosorption process of metals within a granular-based sequencing batch reactor (SBR) with a multiscale approach. The SBR system is modelled as a batch bioreactor having a cyclic configuration, in which \(N_\textrm{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.

2.1 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_\textrm{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 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.

Fig. 1
figure 1

(Color figure online) 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

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_{\theta _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 \(\rho \) and the same density of binding sites \(\rho _{\theta }\). By dividing sessile species concentrations \(X_i(r,t)\) by \(\rho \) and the free binding sites concentrations \(X_{\theta _i}(r,t)\) by \(\rho _{\theta }\), biofilm volume fractions \(f_i(r,t)\) and free binding sites volume fractions \(\theta _i(r,t)\) are achieved. Notably, both \(f_i(r,t)\) and \(\theta _i(r,t)\) (in the absence of metals adsorption) are constrained to add up to unity at each location and time (\(\sum _{i=1}^n f_i =1, \sum _{i=1}^n \theta _i=1, \ 0 \le r \le R(t), \ t > 0\)) (Rahman et al. 2015).

In summary, the model components describing the granular biofilm mesoscale are:

$$\begin{aligned}{} & {} X_i, \ i=1,...,n, \ {\textbf {X}}=(X_1,...,X_n) \end{aligned}$$
(1)
$$\begin{aligned}{} & {} f_i = \frac{X_i}{\rho }, \ i=1,...,n, \ {\textbf {f}}=(f_1,...,f_n) \end{aligned}$$
(2)
$$\begin{aligned}{} & {} S_j, \ j=1,...,m_1, \ {\textbf {S}}=(S_1,...,S_{m_1}) \end{aligned}$$
(3)
$$\begin{aligned}{} & {} X_{\theta _i}, \ i=1,...,n, \ \varvec{X_{\theta }}=(X_{\theta _1},...,X_{\theta _n}) \end{aligned}$$
(4)
$$\begin{aligned}{} & {} \theta _i = \frac{X_{\theta _i}}{\rho _{\theta }}, \ i=1,...,n, \ \varvec{\theta }=(\theta _1,...,\theta _n) \end{aligned}$$
(5)
$$\begin{aligned}{} & {} M_j, \ j=1,...,m_2, \ {\textbf {M}}=(M_{1},...,M_{m_2}) \end{aligned}$$
(6)

Based on the continuum approach introduced in Wanner and Gujer (1986) for one-dimensional 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:

$$\begin{aligned}{} & {} \frac{\partial f_i(r,t)}{\partial t} + u(r,t)\frac{\partial f_i(r,t)}{\partial r}=r_{M,i}(r,t,\textbf{f},\textbf{S},\textbf{M})- f_i(r,t)\sum _{i=1}^n r_{M,i}(r,t,\textbf{f},\textbf{S},\textbf{M}), \nonumber \\{} & {} i=1,...,n, 0 \le r \le R(t),\ t>0, \end{aligned}$$
(7)

where \(r_{M,i}(r,t,\textbf{f},\textbf{S},\textbf{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(rt) is the biomass velocity.

The velocity u(rt) is governed by the following equation:

$$\begin{aligned} \frac{\partial u(r,t)}{\partial r} = -\frac{2 u(r,t)}{r} +\sum _{i=1}^n r_{M,i}(r,t,\textbf{f},\textbf{S},\textbf{M}), \ 0 < r \le R(t),\ t>0. \end{aligned}$$
(8)

The evolution of the free boundary domain is described by the following equation derived from global mass balances considerations on the granule volume:

$$\begin{aligned} {\dot{R}}(t) = u(R(t),t) + \sigma _a(t) - \sigma _d(t),\; t>0, \end{aligned}$$
(9)

where \(\sigma _a(t)\) and \(\sigma _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:

$$\begin{aligned}{} & {} \frac{\partial X_{\theta _i}(r,t)}{\partial t} +\frac{1}{r^2} \frac{\partial }{\partial r}(r^2 u(r,t) X_{\theta _i}(r,t)) = \rho _{\theta } r_{\theta ,i}(r,t,\textbf{f},\textbf{S},{\varvec{\theta }},\textbf{M}), \nonumber \\{} & {} i=1,...,n, \ 0 \le r \le R(t),\ t>0, \end{aligned}$$
(10)

where \(r_{\theta ,i}(r,t,\textbf{f},\textbf{S},{\varvec{\theta }},\textbf{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(rt) which regulates biofilm expansion as the sorption sites can be seen as an intrinsic characteristic of the biofilm components.

Dividing Eq. (10) by \(\rho _{\theta }\) and considering Eqs. (2) and (5) yields:

$$\begin{aligned}{} & {} \frac{\partial \theta _i(r,t)}{\partial t} + \theta _i(r,t) \frac{\partial u(r,t)}{\partial r} + \frac{2 u(r,t) \theta _i(r,t)}{r} + u(r,t) \frac{\partial \theta _i(r,t)}{\partial r} \nonumber \\{} & {} \!=\! r_{\theta ,i}(r,t,\textbf{f},\textbf{S},{\varvec{\theta }},\textbf{M}), \quad i=1,...,n, \ 0 \le r \le R(t),\ t>0. \end{aligned}$$
(11)

Substituting Eq. (8) into Eq. (11) yields:

$$\begin{aligned}{} & {} \frac{\partial \theta _i(r,t)}{\partial t} {+} u(r,t)\frac{\partial \theta _i(r,t)}{\partial r}{=} r_{\theta ,i}(r,t,\textbf{f},\textbf{S},{\varvec{\theta }},\textbf{M}) {-} \theta _i(r,t)\sum _{i=1}^nr_{M,i}(r,t,\textbf{f},\textbf{S},\textbf{M}),\nonumber \\{} & {} i=1,...,n, \ 0 \le r \le R(t),\ t>0. \end{aligned}$$
(12)

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:

$$\begin{aligned}{} & {} \frac{\partial M_j(r,t)}{\partial t}-D_{M,j}\frac{\partial ^2 M_j(r,t)}{\partial r^2} - \frac{2 D_{M,j}}{r} \frac{\partial M_j(r,t)}{\partial r}= r_{A,j}(r,t,{\varvec{\theta }},\textbf{M}),\nonumber \\{} & {} j=1,...,m_2, \ 0< r < R(t),\ t>0, \end{aligned}$$
(13)

where \(r_{A,j}(r,t,{\varvec{\theta }},\textbf{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:

$$\begin{aligned}{} & {} \frac{\partial S_j(r,t)}{\partial t}-D_{S,j}\frac{\partial ^2 S_j(r,t)}{\partial r^2} - \frac{2 D_{S,j}}{r} \frac{\partial S_j(r,t)}{\partial r}= r_{S,j}(r,t,\textbf{f},\textbf{S},\textbf{M}),\nonumber \\{} & {} j=1,...,m_1, \ 0< r < R(t),\ t>0, \end{aligned}$$
(14)

where \(r_{S,j}(r,t,\textbf{f},\textbf{S},\textbf{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 \(\sigma _{a,i}(t)\) of the planktonic microbial species present in the liquid phase. The term \(\sigma _{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, 2021):

$$\begin{aligned} \sigma _a(t) = \sum _{i=1}^n \sigma _{a,i}(t)=\sum _{i=1}^n \frac{v_{a,i}\psi ^*_i(t)}{\rho }, \end{aligned}$$
(15)

where \(v_{a,i}\) is the attachment velocity of the ith planktonic species, and \(\psi ^*_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):

$$\begin{aligned} \sigma _d(t) = \sum _{i=1}^n \sigma _{d,i}(t)=\sum _{i=1}^n \lambda R^2(t) f_i(R(t),t)=\lambda R^2(t), \end{aligned}$$
(16)

where \(\lambda \) 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.

2.2 Bioreactor Macroscale Model

The reactor is modelled as a sequencing batch reactor in which \(N_\textrm{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 \(\psi ^*_i(t)\), n microbial species deriving from the detachment process \(\psi ^*_{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:

$$\begin{aligned}{} & {} \psi ^*_i, \ i=1,...,n, \ \varvec{\psi }^*=(\psi ^*_1,...,\psi ^*_n), \end{aligned}$$
(17)
$$\begin{aligned}{} & {} \psi ^*_{d_i}, \ i=1,...,n, \ \varvec{\psi _{d}}^*=(\psi ^*_{d_1},...,\psi ^*_{d_n}), \end{aligned}$$
(18)
$$\begin{aligned}{} & {} S^*_j, \ j=1,...,m_1, \ {\textbf {S}}^*=(S^*_1,...,S^*_{m_1}), \end{aligned}$$
(19)
$$\begin{aligned}{} & {} M^*_j, \ j=1,...,m_2, \ {\textbf {M}}^*=(M^*_{1},...,M^*_{m_2}), \end{aligned}$$
(20)

while the system of IDEs is the following:

$$\begin{aligned}{} & {} V \dot{\psi }^*_i(t)= -\sigma _{a,i}(t) \rho A(t)N_\textrm{G} + V r^*_{\psi ,i}(t,{\varvec{\psi }^*},\mathbf{S^*},\mathbf{M^*}) +V r^*_{C,i}(t,{\varvec{\psi }^*_{d}}),\nonumber \\{} & {} t \in [0,T], \ t \ne t_k,i=1,...,n\,\ t>0, \end{aligned}$$
(21)
$$\begin{aligned}{} & {} V \dot{\psi }^*_{d_i}(t)= \sigma _{d,i}(t)\rho A(t)N_\textrm{G} + V r^*_{\psi _{d},i}(t,{\varvec{\psi }^*_{d}},\mathbf{S^*},\mathbf{M^*}) - V r^*_{C,i}(t,{\varvec{\psi }^*_{d}}),\nonumber \\{} & {} t \in [0,T], \ t \ne t_k,i=1,...,n\,\ t>0, \end{aligned}$$
(22)
$$\begin{aligned}{} & {} V \dot{S}^*_j(t)=- A(t) N_\textrm{G} D_{S,j} \frac{\partial S_j(R(t),t)}{\partial r} +V r^*_{S,j}(t,{\varvec{\psi }^*},{\varvec{\psi }^*_{d}},\mathbf{S^*},\mathbf{M^*}),\nonumber \\{} & {} t \in [0,T], \ t \ne t_k, \ j=1,...,m_1,\,\ t>0, \end{aligned}$$
(23)
$$\begin{aligned}{} & {} V \dot{M}^*_j(t)=- A(t) N_\textrm{G} D_{M,j} \frac{\partial M_j(R(t),t)}{\partial r},\nonumber \\{} & {} t \in [0,T], \ t \ne t_k, j=1,...,m_2,\,\ t>0, \end{aligned}$$
(24)

where V is the volume of the bulk liquid; A(t) is the area of the spherical granule and is equal to \(4 \pi R^2(t)\); \(r^*_{\psi ,i}(t,{\varvec{\psi }^*},\mathbf{S^*},\mathbf{M^*})\) and \(r^*_{\psi _{d},i}(t,{\varvec{\psi }^*_{d}},\mathbf{S^*},\mathbf{M^*})\) are the growth rates for the ith planktonic and detached biomass, respectively; \(r^*_{S,j}(t,{\varvec{\psi }^*},{\varvec{\psi }^*_{d}},\mathbf{S^*},\mathbf{M^*})\) is the conversion rate for the jth soluble substrates; and \(r^*_{C,i}(t,{\varvec{\psi }^*_{d}})\) is the reconversion rate of the ith detached biomasses into planktonic form.

The jump functions associated with Eqs. (21)–(24) are:

$$\begin{aligned}{} & {} \Delta \psi ^*_i(t_k)=\psi ^*_i(t^+_k)-\psi ^*_i(t^-_k)= - \gamma \psi ^*_i(t^-_k), \ k=1,...,h, \ i=1,...,n, \end{aligned}$$
(25)
$$\begin{aligned}{} & {} \Delta \psi ^*_{d_i}(t_k)=\psi ^*_{d_i}(t^+_k)-\psi ^*_{d_i}(t^-_k)= - \gamma \psi ^*_{d_i}(t^-_k), \ k=1,...,h, \ i=1,...,n, \end{aligned}$$
(26)
$$\begin{aligned}{} & {} \Delta S^*_j(t_k)=S^*_j(t^+_k)-S^*_j(t^-_k)= - \omega S^*_j(t^-_k) + \omega S^{in}_j, \ k=1,...,h, \ j=1,...,m_1, \nonumber \\\end{aligned}$$
(27)
$$\begin{aligned}{} & {} \Delta M^*_j(t_k)=M^*_j(t^+_k)-M^*_j(t^-_k)\!=\! - \omega M^*_j(t^-_k) + \omega M^{in}_j, \ k=1,...,h, \ j=1,...,m_2,\nonumber \\ \end{aligned}$$
(28)

where \(\gamma \) is the fraction of suspended biomass removed during the emptying phase; \(\omega \) 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; \(0 = t_0< t_1<\cdots< t_h < t_{h+1} = T\), \(t_{k+1} - t_k = \tau \); \(\tau \) is the duration of the cycle; \(\psi ^*_i(t^+_k)\), \(\psi ^*_{d_i}(t^+_k)\), \(S^*_j(t^+_k)\), \(M^*_j(t^+_k)\), \(\psi ^*_i(t^-_k)\),\(\psi ^*_{d_i}(t^-_k)\), \(S^*_j(t^-_k)\), and \(M^*_j(t^-_k)\) are the right and left limits of \(\psi ^*_i\), \(\psi ^*_{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.

2.3 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):

$$\begin{aligned} \ R(0)= 0. \end{aligned}$$
(29)

The boundary condition for Eq. (8) is given by:

$$\begin{aligned} u(0,t)=0,\ t>0. \end{aligned}$$
(30)

The granule radius R(t) represents the free boundary of the mathematical problem. Its variation, governed by Eq. (9), depends on attachment \(\sigma _a\) and detachment \(\sigma _d\) velocity. In the initial phase, the granule radius is small, and consequently, attachment prevails on detachment. Therefore, it is \(\sigma _a-\sigma _d > 0\) and the free boundary is a space-like line. During maturation, the granule dimension increases, and the detachment is the prevailing process. Thus, it is \(\sigma _a-\sigma _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:

$$\begin{aligned} f_i(R(t),t) = \frac{v_{a,i}\psi ^*_i(t)}{\sum _{i=1}^{n}v_{a,i}\psi ^*_i(t)}, \ i=1,...,n,\ t>0, \ \sigma _{a}(t)-\sigma _{d}(t)>0, \end{aligned}$$
(31)

while the volume fractions of the free binding sites are fixed equal to the biofilm volume fractions at the granule-bulk liquid interface:

$$\begin{aligned} \theta _i(R(t),t) = f_i(R(t),t), \ i=1,...,n,\ t>0, \ \sigma _{a}(t)-\sigma _{d}(t)>0. \end{aligned}$$
(32)

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)\)):

$$\begin{aligned}{} & {} \frac{\partial S_j}{\partial r}(0,t)=0,\ S_j(R(t),t))=S^*_j(t),\ j=1,...,m_1,\ t>0, \end{aligned}$$
(33)
$$\begin{aligned}{} & {} \frac{\partial M_j}{\partial r}(0,t)=0,\ M_j(R(t),t))=M^*_j(t),\ j=1,...,m_2,\ t>0. \end{aligned}$$
(34)

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):

$$\begin{aligned}{} & {} \psi ^*_i(0)=\psi ^*_{i,0}, \ i=1,...,n, \end{aligned}$$
(35)
$$\begin{aligned}{} & {} \psi ^*_{d_i}(0)=\psi ^*_{d_{i,0}}, \ i=1,...,n, \end{aligned}$$
(36)
$$\begin{aligned}{} & {} S^*_j(0)=S^*_{j,0},\ j=1,...,m_1, \end{aligned}$$
(37)
$$\begin{aligned}{} & {} M^*_j(0)=M^*_{j,0},\ j=1,...,m_2, \end{aligned}$$
(38)

where \(\psi ^*_{i,0}\), \(\psi ^*_{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.

3 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_\textrm{PH}(r,t)\), heterotrophic bacteria \(f_{H}(r,t)\), nitrifying bacteria \(f_{N}(r,t)\), EPS \(f_\textrm{EPS}(r,t)\), and inactive biomass \(f_{I}(r,t)\).

    • Five soluble compounds: inorganic carbon \(S_\textrm{IC}(r,t)\), organic carbon \(S_\textrm{DOC}(r,t)\), nitrate \(S_{\textrm{NO}_3}(r,t)\), ammonia \(S_{\textrm{NH}_3}(r,t)\), and dissolved oxygen \(S_{\textrm{O}_2}(r,t)\).

    • Five fractions of free binding sites related to: phototrophs \(\theta _\textrm{PH}(r,t)\), heterotrophic bacteria \(\theta _{H}(r,t)\), nitrifying bacteria \(\theta _{N}(r,t)\), EPS \(\theta _\textrm{EPS}(r,t)\), and inactive biomass \(\theta _{I}(r,t)\).

    • One metal: M(rt).

  • SBR variables:

    • Three planktonic microbial species: phototrophs \(\psi ^*_\textrm{PH}(t)\), heterotrophic bacteria \(\psi ^*_{H}(t)\), and nitrifying bacteria \(\psi ^*_{N}(t)\).

    • Three microbial species deriving from biofilm detachment: phototrophs \(\psi ^*_{d_\textrm{PH}}(t)\), heterotrophic bacteria \(\psi ^*_{d_H}(t)\), and nitrifying bacteria \(\psi ^*_{d_N}(t)\).

    • Five soluble compounds: inorganic carbon \(S^*_\textrm{IC}(t)\), organic carbon \(S^*_\textrm{DOC}(t)\), nitrate \(S^*_{\textrm{NO}_3}(t)\), ammonia \(S^*_{\textrm{NH}_3}(t)\), and dissolved oxygen \(S^*_{\textrm{O}_2}(t)\).

    • One metal: \(M^*(t)\).

3.1 Adsorption Process

Compared to conventional physical/chemical technologies, biosorption is effective and less expensive when the metal concentration is less than \(100 \ \textrm{mg} \ \textrm{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:

$$\begin{aligned}{} & {} r_{\theta ,i} = - (k_{\textrm{ads},i} M+k_{d,i}) \theta _{i} + \sum _k \alpha _{i,k} \ \nu _{k}, \ i \in \{\textrm{PH}, H, N \}, \ k=1,...,\bar{m}, \end{aligned}$$
(39)
$$\begin{aligned}{} & {} r_{\theta ,\textrm{EPS}} = - k_{\textrm{ads,EPS}} M \theta _\textrm{EPS} + \sum _k \alpha _{\textrm{EPS},k} \ \nu _{k}, \ k=1,...,\bar{m}, \end{aligned}$$
(40)
$$\begin{aligned}{} & {} r_{\theta ,I} = - k_{\textrm{ads},I} M \theta _{I} + \sum _i k_{d,i} \theta _{i}, \ i \in \{\textrm{PH}, H, N \}, \end{aligned}$$
(41)
$$\begin{aligned}{} & {} r_{A} = - \sum _i Y_{\textrm{ads},i}\rho _{\theta } k_{\textrm{ads},i} M \theta _{i}, \ i \in \{\textrm{PH}, H, N, \textrm{EPS}, I \}, \end{aligned}$$
(42)

where \(\bar{m}\) 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_{\textrm{ads},i}\) and \(k_{\textrm{ads},i}\) represent the biosorption yield and the adsorption kinetic constant of the ith microbial species; \(\rho _{\theta }\) is the density of the binding sites; \(\alpha _{i,k}\) is the biochemical rate coefficient of the kth growth process of the microbial sessile species i; \(\nu _{k}\) represents the kinetic rate of the kth growth process within the biofilm. All model parameters are reported in Table 1.

Table 1 Kinetic, stoichiometric and operating parameters used for numerical simulations

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:

$$\begin{aligned} k_{E,i}= \tilde{K}_{\textrm{EPS},i} \ \Big (1+ \frac{M}{K_{s,i}+M}\Big ), \end{aligned}$$
(43)

where \(\tilde{K}_{\textrm{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:

$$\begin{aligned} I_M= \frac{K^{in}_{M}}{K^{in}_{M}+M}, \end{aligned}$$
(44)

where \(K^{in}_{M}\) is the inhibition coefficient for the generic heavy metal, and its value is reported in “Appendix”.

3.2 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 \(\textrm{NO}_3\), ammonia \(\textrm{NH}_3\), and dissolved oxygen \(\textrm{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 \(\textrm{NH}_3\), phototrophs carry out photosynthesis, consuming IC and \(\textrm{NH}_3\) and producing \(\textrm{O}_2\) and DOC. In the absence or shortage of ammonia, phototrophs can grow by using \(\textrm{NO}_3\) as nitrogen source. Furthermore, the model takes into account the inhibition induced by the presence of \(\textrm{O}_2\) on the photosynthetic activity. In the absence of light, DOC, \(\textrm{O}_2\), and \(\textrm{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 \(\textrm{O}_2\), as well as anoxic condition using \(\textrm{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 \(\textrm{NH}_3\) conversion into \(\textrm{NO}_2\), and the subsequent \(\textrm{NO}_2\) conversion into \(\textrm{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”.

3.3 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). Experimental 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:

$$\begin{aligned} r^*_{C,i} = K_C\psi _{d_i}^*(t), \end{aligned}$$
(45)

where \(K_C\) is the conversion constant from detached to planktonic form, and its value is reported in “Appendix”.

4 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 \(\psi ^*_{i}\), \(\psi ^*_{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_\textrm{G}\) has been selected through an iterative procedure varying the detachment coefficient \(\lambda \) (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. 2018, 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 \(\omega =50\)%). As explained above, the reaction phase is supposed to be the same as the duration of the cycle \(\tau \), and it consists of 3 hours of darkness and 3 hours of light (\(t_\textrm{dark}=t_\textrm{light}=0.125 \ d\) and \(\tau =0.25 \ d\)) (Tenore et al. 2021c; Abouhend et al. 2018). In the light phase, the reactor is supposed to be homogeneously illuminated and the incident light intensity \(I_0\) is fixed at \(0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\) (Tenore et al. 2021c).

The same wastewater influent composition is considered for each treatment cycle. It is characterized by \(S^{in}_\textrm{IC} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_\textrm{DOC} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{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 (\(\psi ^{in}_i=0\) and \(\psi ^{in}_{d_i}=0\)), while phototrophic inoculum of suspended phototrophs is considered, where planktonic heterotrophic and nitrifying bacteria are present in smaller amounts: \(\psi ^*_{\textrm{PH},0} = 600 \ \textrm{g} \ \textrm{m}^{-3}\), \(\psi ^*_{H,0} = \psi ^*_{N,0} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (Tenore et al. 2021c). The initial concentration of detached species \(\psi ^*_{d_i,0}\) in the bulk liquid has been set equal to zero (\(\psi ^*_{d_i,0} =0\)). Note that no addition of oxygen is considered (\(S^{in}_{\textrm{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 (\(\tilde{K}_{\textrm{EPS},H} = 0.18\), Merkey et al. 2009) and nitrifiers (\(\tilde{K}_{\textrm{EPS},N} = 0.075\), Merkey et al. 2009) and is fixed at \(\tilde{K}_{\textrm{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_\textrm{ads,EPS}\), \(k_\textrm{ads,PH}\) and \(k_{\textrm{ads},I}\) are supposed to be much higher than \(k_{\textrm{ads},H}\) and \(k_{\textrm{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 \ \textrm{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 \(\psi ^*_{i}\), and detached biomasses \(\psi ^*_{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 \(\theta _i\); and concentration of free metal M within the biofilm.

4.1 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 \ \textrm{g} \ \textrm{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.

Fig. 2
figure 2

(Color figure online) SET1—Evolution of biofilm radius and mass of sessile species over time. Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen), \(M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\) (metal). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

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 \(\textrm{O}_2\) and DOC consuming IC and \(\textrm{NH}_3\) (or \(\textrm{NO}_3\)), and consequently they promote the heterotrophs and nitrifiers growth. Indeed, heterotrophic bacteria require \(\textrm{O}_2\) (or \(\textrm{NO}_3\) in anoxic condition) and DOC for their metabolic activities. While \(\textrm{NH}_3\) and \(\textrm{O}_2\) are necessary for nitrifying bacteria, which compete with phototrophs for IC. However, nitrifiers produce \(\textrm{NO}_3\) necessary for heterotrophs in anoxic condition and for phototrophs in lack or shortage of \(\textrm{NH}_3\). Under dark conditions, phototrophs compete with heterotrophs and nitrifiers for \(\textrm{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 \ \upmu \textrm{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 \ \upmu \textrm{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 \(\textrm{O}_2\) in the presence of DOC.

Fig. 3
figure 3

(Color figure online) SET1—Active microbial species distribution and concentration of free metal within the diametrical section of the granule, at \(T = 20 \ \textrm{d}\), \(T = 30 \ \textrm{d}\), \(T = 40 \ \textrm{d}\), \(T = 50 \ \textrm{d}\), \(T = 80 \ \textrm{d}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2}= 0\) (oxygen), \(M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\) (metal). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

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 \ \textrm{d}\) to \(T=40 \ \textrm{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 \ \textrm{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.

Fig. 4
figure 4

(Color figure online) SET1—Distribution of microbial species and free binding sites across the radius of the granule, at \(T = 20 \ \textrm{d}\), \(T = 40 \ \textrm{d}\), \(T = 60 \ \textrm{d}\), \(T = 80 \ \textrm{d}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen), \(M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\) (metal). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

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 \ \upmu \textrm{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 \ \textrm{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 \ \textrm{d}\) to \(T=60 \ \textrm{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 algal–bacterial granules containing in the SBR are perfectly able to remove the metal present in the influent wastewater.

Fig. 5
figure 5

(Color figure online) SET1—Evolution of soluble substrates and metal concentrations within the reactor. Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen), \(M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\) (metal). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

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 \(\textrm{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 \(\textrm{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 \(\textrm{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 \(\textrm{NH}_3\) and DOC degradation, IC consumption, and M adsorption after \(t=60 \ \textrm{d}\).

Fig. 6
figure 6

(Color figure online) SET1—Evolution of soluble substrates and metal concentrations within the reactor, from 199 to \(200 \ \textrm{d}\) (four consecutive six-hours treatment cycles). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen), \(M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\) (metal). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \) (grey portions indicate the dark phases, white portions indicate the light phases)

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), \(\textrm{NO}_3\) (yellow), \(\textrm{NH}_3\) (cyan), \(\textrm{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 \(\textrm{O}_2\) (produced in the previous cycle), DOC and \(\textrm{NH}_3\) producing IC. Contextually, a small amount of nitrifiers contributes to the conversion of \(\textrm{O}_2\), IC and \(\textrm{NH}_3\) into \(\textrm{NO}_3\). When oxygen is completely consumed, anoxic heterotrophs grow consuming DOC and \(\textrm{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 \(\textrm{NH}_3\) and IC, and producing large amount of \(\textrm{O}_2\) necessary for heterotrophs and nitrifiers. Nevertheless, heterotrophic bacteria are more competitive in the use of \(\textrm{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, \(\textrm{NH}_3\) and IC concentrations decreases, and \(\textrm{NO}_3\) concentration increases. When also \(\textrm{NH}_3\) is completely consumed, phototrophs grow on \(\textrm{NO}_3\). At the end of the cycle, \(\textrm{NH}_3\) and DOC have been completely removed, and a very low concentrations of \(\textrm{NO}_3\) (less than \(5 \ \textrm{g} \ \textrm{m}^{-3}\)) and a concentration of about \(30 \ \textrm{g} \ \textrm{m}^{-3}\) of \(\textrm{O}_2\) are observed. Indeed, the biomass of nitrifying bacteria within the granule and their growth rate are very low; therefore, the production of \(\textrm{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 \ \textrm{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.

4.2 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 SET2, 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 \ \textrm{g} \ \textrm{m}^{-3}\). The concentration of soluble substrates in the influent wastewater \(S^{in}_j\) and initial concentration of planktonic biomasses within the reactor \(\psi ^*_{i,0}\) set for this numerical study are the same as in SET1. Numerical results are summarized in Figs. 8, 9, 10, 11, 12 and 13.

Fig. 7
figure 7

(Color figure online) SET1—Evolution of planktonic and detached biomasses concentrations within the reactor over time. Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen), \(M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\) (metal). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

Fig. 8
figure 8

(Color figure online) SET2—Phototrophs distribution within the granule (diametrical section) at \(T = 20 \ \textrm{d}\), \(T = 40 \ \textrm{d}\), \(T = 60 \ \textrm{d}\), \(T = 180 \ \textrm{d}\), \(T = 200 \ \textrm{d}\) for different metal concentrations in the influent \(M^{in}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_\textrm{DOC} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S4: M^{in}=40 \ \textrm{g} \ \textrm{m}^{-3}\), \(S6: M^{in}=80 \ \textrm{g} \ \textrm{m}^{-3}\), \(S7: M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\), \(S8: M^{in}=120 \ \textrm{g} \ \textrm{m}^{-3}\), \(S10: M^{in}=160 \ \textrm{g} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

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: S4 (\(M^{in}=40 \ \textrm{g} \ \textrm{m}^{-3}\)), S6 (\(M^{in}=80 \ \textrm{g} \ \textrm{m}^{-3}\)), S7 (\(M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\)), S8 (\(M^{in}=120 \ \textrm{g} \ \textrm{m}^{-3}\)), S10 (\(M^{in}=160 \ \textrm{g} \ \textrm{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 \ \textrm{g} \ \textrm{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.

Fig. 9
figure 9

(Color figure online) SET2—Mass of microbial species within the granule at \(T = 20 \ \textrm{d}\), \(T = 30 \ \textrm{d}\), \(T = 40 \ \textrm{d}\), \(T = 50 \ \textrm{d}\), \(T = 60 \ \textrm{d}\), \(T = 200 \ \textrm{d}\) for different metal concentrations in the influent \(M^{in}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S2: M^{in}=0\), \(S3: M^{in}=20 \ \textrm{g} \ \textrm{m}^{-3}\), \(S4: M^{in}=40 \ \textrm{g} \ \textrm{m}^{-3}\), \(S5: M^{in}=60 \ \textrm{g} \ \textrm{m}^{-3}\), \(S6: M^{in}=80 \ \textrm{g} \ \textrm{m}^{-3}\), \(S7: M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\), \(S8: M^{in}=120 \ \textrm{g} \ \textrm{m}^{-3}\), \(S9: M^{in}=140 \ \textrm{g} \ \textrm{m}^{-3}\), \(S10: M^{in}=160 \ \textrm{g} \ \textrm{m}^{-3}\), \(S11: M^{in}=180 \ \textrm{g} \ \textrm{m}^{-3}\), \(S12: M^{in}=200 \ \textrm{g} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

Fig. 10
figure 10

(Color figure online) SET2—Biofilm radius evolution over time for different influent metal concentrations \(M^{in}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S2: M^{in}=0\), \(S3: M^{in}=20 \ \textrm{g} \ \textrm{m}^{-3}\), \(S4: M^{in}=40 \ \textrm{g} \ \textrm{m}^{-3}\), \(S5: M^{in}=60 \ \textrm{g} \ \textrm{m}^{-3}\), \(S6: M^{in}=80 \ \textrm{g} \ \textrm{m}^{-3}\), \(S7: M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\), \(S8: M^{in}=120 \ \textrm{g} \ \textrm{m}^{-3}\), \(S9: M^{in}=140 \ \textrm{g} \ \textrm{m}^{-3}\), \(S10: M^{in}=160 \ \textrm{g} \ \textrm{m}^{-3}\), \(S11: M^{in}=180 \ \textrm{g} \ \textrm{m}^{-3}\), \(S12: M^{in}=200 \ \textrm{g} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

Fig. 11
figure 11

(Color figure online) SET2—Metal concentration evolution within the reactor for different metal concentrations in the influent \(M^{in}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S2: M^{in}=0\), \(S3: M^{in}=20 \ \textrm{g} \ \textrm{m}^{-3}\), \(S4: M^{in}=40 \ \textrm{g} \ \textrm{m}^{-3}\), \(S5: M^{in}=60 \ \textrm{g} \ \textrm{m}^{-3}\), \(S6: M^{in}=80 \ \textrm{g} \ \textrm{m}^{-3}\), \(S7: M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\), \(S8: M^{in}=120 \ \textrm{g} \ \textrm{m}^{-3}\), \(S9: M^{in}=140 \ \textrm{g} \ \textrm{m}^{-3}\), \(S10: M^{in}=160 \ \textrm{g} \ \textrm{m}^{-3}\), \(S11: M^{in}=180 \ \textrm{g} \ \textrm{m}^{-3}\), \(S12: M^{in}=200 \ \textrm{g} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

Fig. 12
figure 12

(Color figure online) SET2—Evolution of soluble substrates concentration within the reactor for different metal concentrations in the influent \(M^{in}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0 \ \textrm{g} \ \textrm{m}^{-3}\) (oxygen). \(S2: M^{in}=0\), \(S3: M^{in}=20 \ \textrm{g} \ \textrm{m}^{-3}\), \(S4: M^{in}=40 \ \textrm{g} \ \textrm{m}^{-3}\), \(S5: M^{in}=60 \ \textrm{g} \ \textrm{m}^{-3}\), \(S6: M^{in}=80 \ \textrm{g} \ \textrm{m}^{-3}\), \(S7: M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\), \(S8: M^{in}=120 \ \textrm{g} \ \textrm{m}^{-3}\), \(S9: M^{in}=140 \ \textrm{g} \ \textrm{m}^{-3}\), \(S10: M^{in}=160 \ \textrm{g} \ \textrm{m}^{-3}\), \(S11: M^{in}=180 \ \textrm{g} \ \textrm{m}^{-3}\), \(S12: M^{in}=200 \ \textrm{g} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

Fig. 13
figure 13

(Color figure online) SET2—Distribution of the residual free binding site across the radius of the granule for different metal concentrations in the influent \(M^{in}\) at \(T=200 \ \textrm{d}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S2: M^{in}=0\), \(S3: M^{in}=20 \ \textrm{g} \ \textrm{m}^{-3}\), \(S4: M^{in}=40 \ \textrm{g} \ \textrm{m}^{-3}\), \(S5: M^{in}=60 \ \textrm{g} \ \textrm{m}^{-3}\), \(S6: M^{in}=80 \ \textrm{g} \ \textrm{m}^{-3}\), \(S7: M^{in}=100 \ \textrm{g} \ \textrm{m}^{-3}\), \(S8: M^{in}=120 \ \textrm{g} \ \textrm{m}^{-3}\), \(S9: M^{in}=140 \ \textrm{g} \ \textrm{m}^{-3}\), \(S10: M^{in}=160 \ \textrm{g} \ \textrm{m}^{-3}\), \(S11: M^{in}=180 \ \textrm{g} \ \textrm{m}^{-3}\), \(S12: M^{in}=200 \ \textrm{g} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

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 \ \textrm{g} \ \textrm{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 \ \textrm{g} \ \textrm{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 \ \textrm{g} \ \textrm{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 \ \textrm{g} \ \textrm{m}^{-3}\), the removal process slows down at \(T=20 \ \textrm{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 \ \textrm{g} \ \textrm{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 \(\textrm{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 \(\textrm{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 \(\textrm{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 \ \textrm{g} \ \textrm{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. The numerical results show that, for values of \(M^{in}\) between 20 and \(120 \ \textrm{g} \ \textrm{m}^{-3}\), 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.

4.3 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 \(\rho _{\theta }\).

Fig. 14
figure 14

(Color figure online) SET3—Biofilm radius evolution over time for different densities of binding sites \(\rho _{\theta }\). Wastewater influent composition: \(S^{in}_\textrm{IC} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_\textrm{DOC} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S13: \rho _{\theta }=10 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S14: \rho _{\theta }=30 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S15: \rho _{\theta }=40 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S16: \rho _{\theta }=50 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

The four values of \(\rho _{\theta }\) used are: 10, 30, 40, 50 \(\textrm{kg} \ sites \ \textrm{m}^{-3}\). The concentration of soluble substrates in the influent wastewater \(S^{in}_j\) and initial concentration of planktonic biomasses within the reactor \(\psi ^*_{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.

Fig. 15
figure 15

(Color figure online) SET3—Mass of microbial species within the granule at \(T = 20 \ \textrm{d}\), \(T = 30 \ \textrm{d}\), \(T = 40 \ \textrm{d}\), \(T = 50 \ \textrm{d}\), \(T = 60 \ \textrm{d}\), \(T = 200 \ \textrm{d}\) for different densities of binding sites \(\rho _{\theta }\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S13: \rho _{\theta }=10 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S14: \rho _{\theta }=30 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S15: \rho _{\theta }=40 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S16: \rho _{\theta }=50 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

The time evolution of the granule radius R(t) is shown in Fig. 14. It is clear that different densities of binding sites \(\rho _{\theta }\) 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 \(\rho _{\theta }\) 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 \(\rho _{\theta }=10 \ \textrm{kg} \ \textrm{sites} \ \textrm{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.

Fig. 16
figure 16

(Color figure online) SET3—Phototrophs distribution within the granule (diametrical section) at \(T = 20 \ \textrm{d}\), \(T = 30 \ \textrm{d}\), \(T = 40 \ \textrm{d}\), \(T = 50 \ \textrm{d}\), \(T = 200 \ \textrm{d}\) for different densities of binding sites \(\rho _{\theta }\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_{\textrm{DOC}} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S13: \rho _{\theta }=10 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S14: \rho _{\theta }=30 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S15: \rho _{\theta }=40 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S16: \rho _{\theta }=50 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_{\textrm{light}} = 50\)% \(\tau \)

Fig. 17
figure 17

(Color figure online) SET3—Distribution of the residual free binding site across the radius of the granule for different densities of binding sites \(\rho _{\theta }\) at \(T=200 \ \textrm{d}\). Wastewater influent composition: \(S^{in}_{\textrm{IC}} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_\textrm{DOC} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S13: \rho _{\theta }=10 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S14: \rho _{\theta }=30 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S15: \rho _{\theta }=40 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S16: \rho _{\theta }=50 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_\textrm{light} = 50\)% \(\tau \)

Fig. 18
figure 18

(Color figure online) SET3—Soluble substrates concentration evolution within the reactor for different densities of binding sites \(\rho _{\theta }\). Wastewater influent composition: \(S^{in}_\textrm{IC} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_\textrm{DOC} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S13: \rho _{\theta }=10 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S14: \rho _{\theta }=30 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S15: \rho _{\theta }=40 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S16: \rho _{\theta }=50 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_\textrm{light} = 50\)% \(\tau \)

Fig. 19
figure 19

(Color figure online) SET3—Evolution of metal concentration within the reactor for different densities of binding sites \(\rho _{\theta }\). Wastewater influent composition: \(S^{in}_\textrm{IC} = 180 \ \textrm{g} \ \textrm{m}^{-3}\) (inorganic carbon), \(S^{in}_\textrm{DOC} = 500 \ \textrm{g} \ \textrm{m}^{-3}\) (organic carbon), \(S^{in}_{\textrm{NH}_3} = 50 \ \textrm{g} \ \textrm{m}^{-3}\) (ammonia), \(S^{in}_{\textrm{NO}_3} = 0\) (nitrate), \(S^{in}_{\textrm{O}_2} = 0\) (oxygen). \(S13: \rho _{\theta }=10 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S14: \rho _{\theta }=30 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S15: \rho _{\theta }=40 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\), \(S16: \rho _{\theta }=50 \ \textrm{kg} \ \textrm{sites} \ \textrm{m}^{-3}\). Incident light intensity: \(I_0= 0.008 \ \textrm{kmol} \ \textrm{m}^{-2} \ \textrm{d}^{-1}\). Duration of the cycle: \(\tau =6 \ \textrm{h}\). Time of light exposure: \(t_\textrm{light} = 50\)% \(\tau \)

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 \(\rho _{\theta }\), phototrophic sessile biomass grows 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 \(\rho _{\theta }\) equal to \(10 \ \textrm{kg} \ \textrm{sites} \ \textrm{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 \(\rho _{\theta }\), 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 sensitive to \(\rho _{\theta }\). For high values of \(\rho _{\theta }\), 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 \(\rho _{\theta }=10 \ \textrm{kg} \ \textrm{sites} \ \textrm{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 \(\rho _{\theta }\) 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 \(\rho _{\theta }\) above a critical value.

5 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 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 granular-based sequencing batch reactor and describes the adsorption process of metals on 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, 2020, 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.