<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">AJCM</journal-id><journal-title-group><journal-title>American Journal of Computational Mathematics</journal-title></journal-title-group><issn pub-type="epub">2161-1203</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/ajcm.2016.64031</article-id><article-id pub-id-type="publisher-id">AJCM-71941</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Physics&amp;Mathematics</subject></subj-group></article-categories><title-group><article-title>
 
 
  An Adaptive Time-Step Backward Differentiation Algorithm to Solve Stiff Ordinary Differential Equations: Application to Solve Activated Sludge Models
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Jamal</surname><given-names>Alikhani</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Bahareh</surname><given-names>Shoghli</given-names></name><xref ref-type="aff" rid="aff2"><sup>2</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Ujjal</surname><given-names>Kumar Bhowmik</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Arash</surname><given-names>Massoudieh</given-names></name><xref ref-type="aff" rid="aff3"><sup>3</sup></xref></contrib></contrib-group><aff id="aff3"><addr-line>Department of Civil Engineering, The Catholic University of America, Washington DC, USA</addr-line></aff><aff id="aff1"><addr-line>Department of Electrical Engineering and Computer Science, The Catholic University of America, Washington DC, USA</addr-line></aff><aff id="aff2"><addr-line>Department of Civil Engineering, University of North Dakota, Grand Forks, ND, USA</addr-line></aff><pub-date pub-type="epub"><day>11</day><month>11</month><year>2016</year></pub-date><volume>06</volume><issue>04</issue><fpage>298</fpage><lpage>312</lpage><history><date date-type="received"><day>September</day>	<month>27,</month>	<year>2016</year></date><date date-type="rev-recd"><day>Accepted:</day>	<month>November</month>	<year>8,</year>	</date><date date-type="accepted"><day>November</day>	<month>11,</month>	<year>2016</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  A backward differentiation formula (BDF) has been shown to be an effective way to solve a system of ordinary differential equations (ODEs) that have some degree of stiffness. However, sometimes, due to high-frequency variations in the external time series of boundary conditions, a small time-step is required to solve the ODE system throughout the entire simulation period, which can lead to a high computational cost, slower response, and need for more memory resources. One possible strategy to overcome this problem is to dynamically adjust the time-step with respect to the system’s stiffness. Therefore, small time-steps can be applied when needed, and larger time-steps can be used when allowable. This paper presents a new algorithm for adjusting the dynamic time-step based on a BDF discretization method. The parameters used to dynamically adjust the size of the time-step can be optimally specified to result in a minimum computation time and reasonable accuracy for a particular case of ODEs. The proposed algorithm was applied to solve the system of ODEs obtained from an activated sludge model (ASM) for biological wastewater treatment processes. The algorithm was tested for various solver parameters, and the optimum set of three adjustable parameters that represented minimum computation time was identified. In addition, the accuracy of the algorithm was evaluated for various sets of solver parameters.
 
</p></abstract><kwd-group><kwd>Adaptive Time-Step</kwd><kwd> Backward Differentiation Formula</kwd><kwd> Activated Sludge Model</kwd><kwd> Ordinary Differential Equation</kwd><kwd> Stiffness</kwd><kwd> Computation Time</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>The use of suspended microorganisms to remove undesired components, including organic carbon, nitrogen, and phosphorus species, is referred to as activated sludge processes and is widely used around the world in municipal wastewater treatment plants (WWTPs) [<xref ref-type="bibr" rid="scirp.71941-ref1">1</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref2">2</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref3">3</xref>] . Mathematical models of activated sludge processes, referred to as Activate Sludge Models (ASMs), provide a cost-effective way to evaluate design, control, and optimization of the processes and have been used extensively in practical applications and academic research [<xref ref-type="bibr" rid="scirp.71941-ref4">4</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref5">5</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref6">6</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref7">7</xref>] . Henze et al. [<xref ref-type="bibr" rid="scirp.71941-ref8">8</xref>] proposed the first ASM (ASM1), and since then, several other versions of ASMs have been proposed [<xref ref-type="bibr" rid="scirp.71941-ref9">9</xref>] . ASM1 represents wastewater composition using 13 constituents, where each constituent may interact with each other through 8 reactions in which the general mass balance of each variable results in a system of ordinary differential equations (ODEs) describing the change in concentrations over time. Non-linear reaction rates based on Monod Kinetic cause a system of highly nonlinear ODEs. In some applications, the computation time of the ASM is critical due to a long simulation period, the need for online simulation [<xref ref-type="bibr" rid="scirp.71941-ref10">10</xref>] , and the use of parameter estimation algorithms that require numerous simulations. For example, Alikhani et al. [<xref ref-type="bibr" rid="scirp.71941-ref11">11</xref>] modeled a large scale WWTP with an ASM by using Markov-Chain Monte Carlo (MCMC) sampling and solved a large system of ODEs for 500,000 times to obtain the ASM’s parameter posterior probability distribution. Therefore, applying a fast algorithm to solve ASMs that can significantly decrease the computation time of such applications would be highly desired. In addition to the non-linearity of the system of ODEs comprising ASMs, they typically cover a wide range of biochemical reaction rate scales, ranging from seconds (for example, oxygen transfer rate) to days (for example, microbial growth rates) and result in a mixed (stiff/nonstiff) system of ODEs [<xref ref-type="bibr" rid="scirp.71941-ref12">12</xref>] that generally requires small time-steps when conventional ODE solver algorithms are used. Furthermore, due to the inherent fluctuating behavior of the external forcing vectors, including variation in the time series of the influent rate and the characteristics in wastewater treatment streams, the optimal time-step size can vary greatly during the course of a simulation.</p><p>Explicit and semi-explicit ODE solvers have been shown not to perform well for systems of ODEs with high degrees of stiffness, while backward differentiation formulas (BDFs) have been shown to be much more suitable [<xref ref-type="bibr" rid="scirp.71941-ref13">13</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref14">14</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref15">15</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref16">16</xref>] . In addition, because the degree of stiffness during the course of the simulation can vary, using a fixed but small time-step can translate to a heavy computational burden. A dynamically adaptive time-step algorithm can automatically adjust the time-step according to the degree of stiffness, resulting in a more optimal use of computational resources. For example, Celaya et al. [<xref ref-type="bibr" rid="scirp.71941-ref17">17</xref>] proposed a method to select or reject a proposed time-step in adaptive algorithms by evaluating the local truncation error at each time-step to maintain the error below a given threshold.</p><p>The goal of this study is to propose a fast, adaptive algorithm based on BDFs that can be implemented in any ASM solver package and in other large, non-linear systems of ODEs. The proposed adaptive algorithm can be optimized for specific problems by properly adjusting the solver parameters and can be used in other numerical method applications such as advection-dispersion-diffusion equations solution [<xref ref-type="bibr" rid="scirp.71941-ref18">18</xref>] , Bayesian parameter estimation framework [<xref ref-type="bibr" rid="scirp.71941-ref19">19</xref>] , and other application of numerical methods (e.g. [<xref ref-type="bibr" rid="scirp.71941-ref20">20</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref21">21</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref22">22</xref>] ). The proposed adaptive BDF algorithm in this study contains three adjustable parameters that can be manipulated to achieve the minimum computation time for a given system of ODEs. In addition, a sensitivity analysis is conducted to identify the optimally adjustable parameters of the adaptive algorithm for a system of ODEs obtained for a sample ASM problem.</p></sec><sec id="s2"><title>2. Methods</title><sec id="s2_1"><title>2.1. Adaptive Backward Differentiation Algorithm</title><p>The system of ODEs can be written in the following general form [<xref ref-type="bibr" rid="scirp.71941-ref23">23</xref>] :</p><disp-formula id="scirp.71941-formula144"><label>(1)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x2.png"  xlink:type="simple"/></disp-formula><disp-formula id="scirp.71941-formula145"><graphic  xlink:href="http://html.scirp.org/file/2-1100555x3.png"  xlink:type="simple"/></disp-formula><p>where, t is the time, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x4.png" xlink:type="simple"/></inline-formula>is the state variables vector, and <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x5.png" xlink:type="simple"/></inline-formula> is the initial condition. <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x6.png" xlink:type="simple"/></inline-formula>is the boundary condition or the external forcing vector given for the entire simulation period. The first and second order BDFs can be represented considering a variable time-step <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x7.png" xlink:type="simple"/></inline-formula> in a given time-step (i) as [<xref ref-type="bibr" rid="scirp.71941-ref17">17</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref24">24</xref>] :</p><disp-formula id="scirp.71941-formula146"><label>(2)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x8.png"  xlink:type="simple"/></disp-formula><disp-formula id="scirp.71941-formula147"><label>(3)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x9.png"  xlink:type="simple"/></disp-formula><p>where i indicates the time-step with non-constant step size<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x10.png" xlink:type="simple"/></inline-formula>, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x11.png" xlink:type="simple"/></inline-formula>represents the discretized form of Equation (1) when <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x12.png" xlink:type="simple"/></inline-formula> and<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x13.png" xlink:type="simple"/></inline-formula>. In Equations (2) and (3), <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x14.png" xlink:type="simple"/></inline-formula>and <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x15.png" xlink:type="simple"/></inline-formula> are the first and second order BDFs considering non-constant step size at each time-step, respectively, which will be henceforth denoted as <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x16.png" xlink:type="simple"/></inline-formula> for the sake of generality. The conventional Newton-Raphson (NR) method for solving the system of non-linear <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x17.png" xlink:type="simple"/></inline-formula> to find <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x18.png" xlink:type="simple"/></inline-formula> can be formulated as:</p><disp-formula id="scirp.71941-formula148"><label>(4)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x19.png"  xlink:type="simple"/></disp-formula><p>where k is the iteration index beginning from 0, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x20.png" xlink:type="simple"/></inline-formula>is the inverse of Jacobian matrix (Equations (5) and (6)). Due to the fact that inverting the Jacobian matrix is computationally intensive, especially as the size of the matrix grows, it is beneficial if the inverse of the Jacobian matrix can be reused and is recalculated only when necessary. Therefore, in the proposed method, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x20.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x21.png" xlink:type="simple"/></inline-formula>in Equation (4) is a recycled Jacobian matrix evaluated at some previous time<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x20.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x21.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x22.png" xlink:type="simple"/></inline-formula>.</p><disp-formula id="scirp.71941-formula149"><label>(5)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x23.png"  xlink:type="simple"/></disp-formula><disp-formula id="scirp.71941-formula150"><label>(6)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x24.png"  xlink:type="simple"/></disp-formula><p>where n is the size of the ODEs, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula>is the Kronecker Delta, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x26.png" xlink:type="simple"/></inline-formula>and <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x27.png" xlink:type="simple"/></inline-formula> denote the Jacobian matrix for the first and second order<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x28.png" xlink:type="simple"/></inline-formula>, respectively, where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x28.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x29.png" xlink:type="simple"/></inline-formula> is the K<sup>th</sup> element of vector<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x28.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x29.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x30.png" xlink:type="simple"/></inline-formula>, and similarly, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x28.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x29.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x30.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x31.png" xlink:type="simple"/></inline-formula>is the I<sup>th</sup> element of vector <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x28.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x29.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x30.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x31.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x32.png" xlink:type="simple"/></inline-formula> at<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x25.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x28.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x29.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x30.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x31.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x32.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x33.png" xlink:type="simple"/></inline-formula>. In addition, to further speed up the NR convergence, the following initial guess of the state variables is used at the first iteration (initial guess) of the NR [<xref ref-type="bibr" rid="scirp.71941-ref25">25</xref>] :</p><disp-formula id="scirp.71941-formula151"><label>(7)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x34.png"  xlink:type="simple"/></disp-formula><p>where<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x35.png" xlink:type="simple"/></inline-formula>.</p><p>The adaptive time interval scheme adjusts the size of time-steps based on monitoring the convergence of the NR method [<xref ref-type="bibr" rid="scirp.71941-ref25">25</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref26">26</xref>] . The time-step size keeps growing by the factor of 1 + ρ (ρ ≥ 0) until the NR’s iteration k in Equation (4) remains smaller than a threshold k<sub>max</sub>, and this inverse of Jacobian matrix (<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x36.png" xlink:type="simple"/></inline-formula>) will be used in Equation (4). The iteration continues until the number of iterations to achieve convergence in the NR method exceeds k<sub>max</sub>. At this time, a new Jacobian matrix will be computed and/or the</p><p>time-step size will be reduced by the factor of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x37.png" xlink:type="simple"/></inline-formula> (<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x37.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x38.png" xlink:type="simple"/></inline-formula>). <xref ref-type="fig" rid="fig1">Figure 1</xref> depicts a de-</p><p>tailed flowchart of this algorithm, in which ρ, γ, and k<sub>max</sub> are, respectively, the time-step inflation factor, the time-step depression factor, and the desired maximum iteration number of NR method that can be manipulated for each particular case of ODEs to achieve the minimum computation time.</p></sec><sec id="s2_2"><title>2.2. Activated Sludge Model</title><p>The proposed algorithm was applied to solve an ASM based on a real, full-scale WWTP. Influent flow and its composition data were collected from nitrification-denitrification reactors at the Blue Plains wastewater treatment plant in Washington, DC over a period of 120 days. This system was modeled as three reactors in a series based on mass balance equation (Equation (8)) with a modified ASM1 reaction network consisting of 11 reactions and 15 constituents, as shown in <xref ref-type="table" rid="table1">Table 1</xref> [<xref ref-type="bibr" rid="scirp.71941-ref11">11</xref>] . The total volume of the reactor was 17,500 m<sup>3</sup>, divided into three tanks in a series, as depicted in <xref ref-type="fig" rid="fig2">Figure 2</xref>. <xref ref-type="fig" rid="fig3">Figure 3</xref> shows the influent flow and its ammonia concentration with return activated sludge (RAS) and waste activated sludge (WAS) flow. In addition, an alternative, hypothetical influent was created by applying a moving average filter with a seven-day mask to reduce noise and a high-order frequency to evaluate the effect of temporal fluctuations on the choice of the solver’s adjustable parameters. The time-series vector of flows and concentrations and the temperature (partly shown in <xref ref-type="fig" rid="fig3">Figure 3</xref>) represent the <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x39.png" xlink:type="simple"/></inline-formula> in Equation (1). Significant fluctuation can be observed in the input data, especially in the inflow rate, mainly because the Blue Plains WWTP receives combined sewer flow, and storm events can generate unpredictable fluctuations in both rate and composition of influent into the plant.</p><fig id="fig1"  position="float"><label><xref ref-type="fig" rid="fig1">Figure 1</xref></label><caption><title> Adaptive time-step BDF algorithm with adjustable parameters of ρ, γ, and k<sub>max</sub></title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/2-1100555x40.png"/></fig><fig id="fig2"  position="float"><label><xref ref-type="fig" rid="fig2">Figure 2</xref></label><caption><title> Activated sludge process containing three tanks in series with aeration in tank 1 and external loading rate in tank 3. The mixed liquor inside the bio-reactors contains both soluble and particulate constituents which are shown with S and X sign in <xref ref-type="table" rid="table1">Table 1</xref>, respectively</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/2-1100555x41.png"/></fig><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> Process reaction rates (R) and constituents stoichiometeries ( )</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >j</th><th align="center" valign="middle"  colspan="6"  >Process</th><th align="center" valign="middle"  colspan="6"  >Rate</th></tr></thead><tr><td align="center" valign="middle" >1</td><td align="center" valign="middle"  colspan="6"  >Aerobic growth of heterotrophs</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x42.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >2</td><td align="center" valign="middle"  colspan="6"  >Aerobic growth of heterotrophs on methanol</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x43.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >3</td><td align="center" valign="middle"  colspan="6"  >Anoxic growth of heterotrophs</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x44.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >4</td><td align="center" valign="middle"  colspan="6"  >Anoxic growth of methylotrophs</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x45.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >5</td><td align="center" valign="middle"  colspan="6"  >Aerobic growth of autotrophs</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x46.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >6</td><td align="center" valign="middle"  colspan="6"  >Decay of heterotrophs</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x47.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >7</td><td align="center" valign="middle"  colspan="6"  >Decay of methylotrophs</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x48.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >8</td><td align="center" valign="middle"  colspan="6"  >Decay of autotrophs</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x49.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >9</td><td align="center" valign="middle"  colspan="6"  >Ammonification of soluble organic nitrogen</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x50.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >10</td><td align="center" valign="middle"  colspan="6"  >Hydrolysis of entrapped organics</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x51.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >11</td><td align="center" valign="middle"  colspan="6"  >Hydrolysis of entrapped organic nitrogen</td><td align="center" valign="middle"  colspan="6"  ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x52.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >j</td><td align="center" valign="middle" >S<sub>S</sub></td><td align="center" valign="middle" >S<sub>M</sub></td><td align="center" valign="middle" >X<sub>S</sub></td><td align="center" valign="middle" >X<sub>B</sub><sub>,H</sub></td><td align="center" valign="middle" >X<sub>B</sub><sub>,M</sub></td><td align="center" valign="middle" >X<sub>B</sub><sub>,A</sub></td><td align="center" valign="middle" >X<sub>P</sub></td><td align="center" valign="middle" >S<sub>O</sub></td><td align="center" valign="middle" >S<sub>NO</sub></td><td align="center" valign="middle" >S<sub>NH</sub></td><td align="center" valign="middle" >S<sub>ND</sub></td><td align="center" valign="middle" >X<sub>ND</sub></td></tr><tr><td align="center" valign="middle" >1</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x53.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x54.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x55.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td></tr><tr><td align="center" valign="middle" >2</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x56.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x57.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x58.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td></tr><tr><td align="center" valign="middle" >3</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x59.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x60.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x61.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td></tr><tr><td align="center" valign="middle" >4</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x62.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x63.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x64.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td></tr><tr><td align="center" valign="middle" >5</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x65.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x66.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x67.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td></tr><tr><td align="center" valign="middle" >6</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x68.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" >−1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x69.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x70.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >7</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x71.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >−1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x72.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x73.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >8</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x74.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >−1</td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x75.png" xlink:type="simple"/></inline-formula></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x76.png" xlink:type="simple"/></inline-formula></td></tr><tr><td align="center" valign="middle" >9</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >1</td><td align="center" valign="middle" >−1</td><td align="center" valign="middle" ></td></tr><tr><td align="center" valign="middle" >10</td><td align="center" valign="middle" >1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" >−1</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td></tr><tr><td align="center" valign="middle" >11</td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" ></td><td align="center" valign="middle" >1</td><td align="center" valign="middle" >−1</td></tr></tbody></table></table-wrap><fig id="fig3"  position="float"><label><xref ref-type="fig" rid="fig3">Figure 3</xref></label><caption><title> Influent flow and ammonia concentration, RAS and WAS over time: (Left) Unfiltered; (Right) Filtered using moving average technique over a 7-day span</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/2-1100555x77.png"/></fig>Governing ODEs<p>In ASMs, the activated sludge process is commonly represented as a series of attached, mixed reactors. These reactors hold a series of processes that can occur simultaneously, resulting in changes in the concentration of constituents. <xref ref-type="fig" rid="fig2">Figure 2</xref> depicts a schematic of the activated sludge process of this study in the WWTP. A transient mass balance can be mathematically performed for each state’s variables, consisting of the concentration of each model constituent, resulting in a system of ODEs, as expressed in Equation (8). Therefore, Equation (8) expresses the changes in constituents’ concentrations over time as controlled by influents, effluents, reactions, and various mass-transfer processes [<xref ref-type="bibr" rid="scirp.71941-ref9">9</xref>] [<xref ref-type="bibr" rid="scirp.71941-ref23">23</xref>] :</p><disp-formula id="scirp.71941-formula152"><label>(8)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x78.png"  xlink:type="simple"/></disp-formula><p>where V (L<sup>3</sup>), C (M∙L<sup>−1</sup>), Q (L<sup>3</sup>∙T<sup>−1</sup>), and ω indicate the volume, concentration, flow, and flow-fraction factor (determining how much of the inflow and return flow enters each tank in a step-feed system), respectively, H is the Heaviside (unit step) function, R (M∙T<sup>−1</sup>) is the reaction rate (<xref ref-type="table" rid="table1">Table 1</xref>), ∅ is the stoichiometric coefficient (<xref ref-type="table" rid="table1">Table 1</xref>), F (T<sup>−1</sup>) is the mass transfer rate, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x79.png" xlink:type="simple"/></inline-formula>(M∙L<sup>−1</sup>) is the saturated concentration, and <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x79.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x80.png" xlink:type="simple"/></inline-formula> (M∙L<sup>−1</sup>) is the external mass flow rate. And as for the indices, j indicates a constituent, m represents a tank, “ret” indicates a return flow, “in” shows conditions in influent, and r indicates the reaction. In addition, N<sub>m</sub> is the total number of tanks, and N<sub>r</sub> is the total number of reactions. <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x79.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x80.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x81.png" xlink:type="simple"/></inline-formula>is the flow rate from tank m' to tank m, due either to sequential stages or through feedback or bypass (a positive <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x79.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x80.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x81.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x82.png" xlink:type="simple"/></inline-formula> value means to flow into tank m). In Equation (8), the term on the left side is the rate of change in the total mass of the constituents j in tank m. The first term on the right side of Equation (8) is the mass inflow due to return flow; the second term is the mass inflow of the influent; the third term represents inflow from the preceding stage or feedback flow if it is present; the fourth term is the outflow of constituents; the fifth term is the production or disappearance of constituents due to reactions; the sixth term is the effect of rate-limited mass transfer (for example, aeration); and the last term is the direct addition of the constituents (for example, the addition of a carbon source for denitrification). To obtain solid-particle concentrations in the return flow (<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x79.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x80.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x81.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x82.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x83.png" xlink:type="simple"/></inline-formula>), a dynamic clarifier model [<xref ref-type="bibr" rid="scirp.71941-ref27">27</xref>] or a quasi-steady-state approximation (that is, performing mass balance while ignoring the solid storage changes in the clarifier) can be applied. The study described in this paper used the former approach.</p></sec></sec><sec id="s3"><title>3. Results and Discussion</title><p>The resulting system of ODEs, consisting of 15 state variables and 45 ODEs, was solved with a range of adjustable parameters for both unfiltered and filtered external vectors, and the running time for each set of solver’s parameters was recorded. The solver algorithm was implemented into the BioEst program, which was developed using the C++ language. The results presented in the next section were obtained by running the executive version of the C++ code on a desktop computer with a quad-core Intel&#174; 2.67 GHz Xenon&#174; CPU and 8 Gb RAM.</p><p><xref ref-type="fig" rid="fig4">Figure 4</xref> shows the results of the simulation for soluble chemical oxygen demand (sCOD), dissolved oxygen (DO), ammonia, and heterotroph biomass concentrations based on unfiltered influent obtained using the solver parameters ρ = 0.01, γ = 0.01, and k<sub>max</sub> = 10.</p><sec id="s3_1"><title>3.1. Optimum Adjustable Parameters</title><p>To get the minimum computation time (running time) and acceptable accuracy, the user can assign the three adjustable parameters, including the inflation growth rate of the time-step (ρ), the depression rate of the time-step (γ), and the maximum NR’s iteration (k<sub>max</sub>). A small initial time-step of h<sub>0</sub> = 10<sup>−</sup><sup>5</sup> day is chosen for all the cases. First, the effect of changing ρ and γ is investigated by varying ρ between 0.0001 and 0.1 and γ between 0.0001 and 1 at the fixed k<sub>max</sub> of 4. <xref ref-type="fig" rid="fig5">Figure 5</xref> shows the results for effect of ρ and γ on running time. In both scenarios, filtered and unfiltered<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x84.png" xlink:type="simple"/></inline-formula>, the running time is very sensitive to ρ, and the minimum running time occurs at ρ = 0.01. <xref ref-type="fig" rid="fig5">Figure 5</xref> also shows that the sensitivity of the algorithm to γ is lower than to ρ in both the filtered and</p><fig id="fig4"  position="float"><label><xref ref-type="fig" rid="fig4">Figure 4</xref></label><caption><title> Results obtained for 120 days by using adaptive BDF method in a 3 tanks in series scheme with solver parameters of ρ = 0.01, γ = 0.01, and k<sub>max</sub> = 10</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/2-1100555x85.png"/></fig><p>unfiltered scenarios. For example, at ρ = 0.01, in the case of unfiltered influent, γ = 0.01 gives a minimal running time and γ = 0.1 gives a similar running time, showing the low sensitivity of the algorithm to γ. The effect of the maximum number of iteration k<sub>max</sub> is examined by assigning the values of 4, 10, 40, and 100. <xref ref-type="fig" rid="fig6">Figure 6</xref> shows the effect of k<sub>max</sub> on the running time for two sets of inflation-depression parameters. In both scenarios, the algorithm shows a reasonably high sensitivity to k<sub>max</sub>, and a minimum running time occurs at k<sub>max</sub> = 10. In conclusion, for the selected system of ODEs, the minimum computation time is achieved at ρ = 0.01, γ = 0.01, and k<sub>max</sub> = 10.</p><p>For a given set of ρ, γ, and k<sub>max</sub>, the run-time is always smaller for the filtered <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x86.png" xlink:type="simple"/></inline-formula> than for the unfiltered<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x86.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x87.png" xlink:type="simple"/></inline-formula>, as expected, because the algorithm needs smaller time- steps to resolve the higher disturbance in the unfiltered<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x86.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x87.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x88.png" xlink:type="simple"/></inline-formula>. Nevertheless, the difference in the running time is not significant.</p><fig id="fig5"  position="float"><label><xref ref-type="fig" rid="fig5">Figure 5</xref></label><caption><title> Effect of ρ and γ in a constant k<sub>max</sub> = 4 in run-time for solving the system of 45 ODEs during 120 days. (Left) Unfiltered (t); (Right) Filtered U(t)</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/2-1100555x89.png"/></fig><fig id="fig6"  position="float"><label><xref ref-type="fig" rid="fig6">Figure 6</xref></label><caption><title> Effect of k<sub>max</sub> in run-time for solving the system of 45 ODEs during 120 days. (Left) Unfiltered (t); (Right) Filtered U(t)</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/2-1100555x90.png"/></fig></sec><sec id="s3_2"><title>3.2. Variable Time-Step Pattern</title><p>The adaptive time-step algorithm increases the size of the time-step in the case when the NR algorithm continues converging and decreases the size of the time-step when the NR fails to converge. This pattern can be seen in <xref ref-type="fig" rid="fig7">Figure 7</xref>, which shows the variation of the accepted time-steps during the course of the simulation for four sets of adjustable parameters. The results show that the pattern of variation in the time-step is substantially affected by different sets of adjustable parameters. For example, as <xref ref-type="fig" rid="fig7">Figure 7</xref> shows, at k<sub>max</sub> = 10, the time-step can reach a maximum value of 0.35 days, whereas, at k<sub>max</sub> = 4, the maximum value is 0.14 days. In other words, a higher k<sub>max</sub> allows larger time-steps and further reuse of the Jacobian matrix at the price of a higher number of NR iterations at each time-step. This indicates that the optimal value of k<sub>max</sub> depends on</p><fig id="fig7"  position="float"><label><xref ref-type="fig" rid="fig7">Figure 7</xref></label><caption><title> Adaptive time-step (dt) variation for 120 days of applying adaptive BDF method on unfiltered U(t) for different adjustable parameters</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/2-1100555x91.png"/></fig><p>the effort needed in the Jacobian inverting process relative to the computational cost of NR iterations, which are mainly matrix-vector multiplications. Therefore, the optimal k<sub>max</sub> can also depend on the size of the Jacobian matrix (that is, the number of state variables) and how well-posed the Jacobian matrix is.</p><p>As <xref ref-type="fig" rid="fig7">Figure 7</xref> shows, at any given k<sub>max</sub>, when γ is varied from 0.1 to 0.01, the pattern of the time-step variation differs significantly and shows more fluctuation at a lower γ. This indicates that the solver parameters ρ and γ essentially control how much the time-step is increased or decreased. A smaller ρ and γ lead to more conservative increases or decreases of the time-step and a larger ρ and γ lead to less conservative increases or decreases.</p></sec><sec id="s3_3"><title>3.3. Error Assessment</title><p>One way to evaluate the accuracy of the method is to compare the solution with the exact solution. However, the system of ODEs represented in Equation (1) cannot be solved using analytical mathematical methods to find the exact solution so that the</p><table-wrap id="table2" ><label><xref ref-type="table" rid="table2">Table 2</xref></label><caption><title> Maximum and the average error of the ABDF algorithm using various parameter selections as compared with RK4</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Parameters</th><th align="center" valign="middle" >e<sub>max</sub></th><th align="center" valign="middle" >e<sub>avg</sub></th></tr></thead><tr><td align="center" valign="middle" >ρ = 0.01, γ = 0.01, k<sub>max</sub> = 10</td><td align="center" valign="middle" >2.10 &#215; 10<sup>−</sup><sup>2</sup></td><td align="center" valign="middle" >9.61 &#215; 10<sup>−</sup><sup>4</sup></td></tr><tr><td align="center" valign="middle" >ρ = 0.01, γ = 0.01, k<sub>max</sub> = 4</td><td align="center" valign="middle" >1.33 &#215; 10<sup>−</sup><sup>2</sup></td><td align="center" valign="middle" >7.35 &#215; 10<sup>−</sup><sup>4</sup></td></tr><tr><td align="center" valign="middle" >ρ = 0.1, γ = 0.1, k<sub>max</sub> = 4</td><td align="center" valign="middle" >1.78 &#215; 10<sup>−</sup><sup>2</sup></td><td align="center" valign="middle" >2.60 &#215; 10<sup>−</sup><sup>3</sup></td></tr><tr><td align="center" valign="middle" >ρ = 0.1, γ = 0.01, k<sub>max</sub> = 4</td><td align="center" valign="middle" >1.45 &#215; 10<sup>−</sup><sup>2</sup></td><td align="center" valign="middle" >1.60 &#215; 10<sup>−</sup><sup>3</sup></td></tr></tbody></table></table-wrap><p>numerical error of the proposed adaptive BDF method can be evaluated. For this reason, to evaluate the accuracy of the method, the well-known Runge-Kutta 4<sup>th</sup> order (RK4) method is used to solve the presented system of ODEs with a small constant time-step size. The selected time-step size is small enough that the truncation error remains below 10<sup>−8</sup> [<xref ref-type="bibr" rid="scirp.71941-ref26">26</xref>] . Then, the numerical results obtained from the RK4 method are used as a reference to assess the maximum and average error of the proposed adaptive BDF algorithm.</p><p>Since the oxygen mass transfer rate in Tank 1 is set at <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x92.png" xlink:type="simple"/></inline-formula> = 190 day<sup>−1</sup> (Equation (8)), resulting in the highest order of stiffness in the system of ODEs, the dissolved oxygen concentration in Tank 1 is susceptible to showing higher sensitivity to the applied numerical method. Therefore, relative error is calculated based on the following equation:</p><disp-formula id="scirp.71941-formula153"><label>(9)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/2-1100555x93.png"  xlink:type="simple"/></disp-formula><p>where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x94.png" xlink:type="simple"/></inline-formula> and <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x94.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x95.png" xlink:type="simple"/></inline-formula> show oxygen concentrations at Tank 1, obtained by the proposed algorithm and RK4, respectively. <xref ref-type="table" rid="table2">Table 2</xref> lists the relative maximum (e<sub>max</sub>) and average (e<sub>avg</sub>) of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x94.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x95.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/2-1100555x96.png" xlink:type="simple"/></inline-formula> for four sets of adjustable parameters. The accuracy assessment results show acceptable accuracy for the proposed algorithm. Specifically, for the four cases, the maximum and average errors contain less than 2 and 0.3 percent error, respectively.</p></sec></sec><sec id="s4"><title>4. Conclusion</title><p>In many applications, it is important to enhance the computational efficiency of ASM solvers. This paper presents a novel adaptive BDF algorithm to solve the system of ODEs arising from ASM models. The proposed method uses the partial evaluation of inverse Jacobian matrix in the BDFs and monitoring the convergence of the NR method to select the size of the time intervals. The method contains three adjustable parameters, including inflation and depression rates of the time-step and the maximum allowable number of iterations for the NR method, to control how time-step size varies through the course of the numerical solution. These three adjustable parameters can be optimized to reduce the computation time while maintaining acceptable accuracy. The algorithm is applied to solve a system of 45 ODEs representing an activated sludge model containing 15 constituents in each of 3 reactors. The sensitivity analysis is conducted, and the optimum adjustable parameters of the adaptive algorithm are identified. The accuracy analysis shows an acceptable level of accuracy for the proposed algorithm.</p></sec><sec id="s5"><title>Acknowledgements</title><p>The authors would like to thank the Innovation section of the DC Water and Sewer Authority (DCWASA) for providing the data and financially support the research.</p></sec><sec id="s6"><title>Cite this paper</title><p>Alikhani, J., Shoghli, B., Bhowmik, U.K. and Massoudieh, A. (2016) An Adaptive Time-Step Backward Differentiation Algorithm to Solve Stiff Ordinary Differential Equations: Application to Solve Activated Sludge Models. American Journal of Computational Mathematics, 6, 298-312. http://dx.doi.org/10.4236/ajcm.2016.64031</p></sec></body><back><ref-list><title>References</title><ref id="scirp.71941-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Takács, I., Patry, G.G. and Nolasco, D. (1991) A Dynamic Model of the Clarification-Thickening Process. Water Research, 25, 1263-1271. http://dx.doi.org/10.1016/0043-1354(91)90066-Y</mixed-citation></ref><ref id="scirp.71941-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Metzger, M. (2000) A Comparative Evaluation of DRE Integration Algorithms for Real-Time Simulation of Biologically Activated Sludge Process. Simulation Practice and Theory, 7, 629-643. http://dx.doi.org/10.1016/S0928-4869(99)00015-4</mixed-citation></ref><ref id="scirp.71941-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Shampine, L.F. and Reichelt, M.W. (1997) The Matlab ODE Suite. SIAM Journal on Scientific Computing, 18, 1-22. http://dx.doi.org/10.1137/S1064827594276424</mixed-citation></ref><ref id="scirp.71941-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Ashino, R., Nagase, M. and Vaillancourt, R. (2000) Behind and beyond the Matlab ODE Suite. Computers &amp; Mathematics with Applications, 40, 491-512. http://dx.doi.org/10.1016/S0898-1221(00)00175-9</mixed-citation></ref><ref id="scirp.71941-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Sharifi, S., Murthy, S., Takács, I. and Massoudieh, A. (2014) Probabilistic Parameter Estimation of Activated Sludge Processes Using Markov Chain Monte Carlo. Water Research, 50, 254-266. http://dx.doi.org/10.1016/j.watres.2013.12.010</mixed-citation></ref><ref id="scirp.71941-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Zhang, X., Scheving, B., Shoghli, B., Zygarlicke, C. and Wocken, C. (2015). Quantifying Gas Flaring CH4 Consumption Using VIIRS. Remote Sensing, 7, 9529-9541. http://dx.doi.org/10.3390/rs70809529</mixed-citation></ref><ref id="scirp.71941-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Shoghli, B., Lim, Y.H. and Alikhani, J. (2016) Evaluating the Effect of Climate Change on the Design Parameters of Embankment Dams: Case Studies Using Remote Sensing Data. World Environmental and Water Resources Congress, West Palm Beach, 22-26 May 2016, 575-585. http://dx.doi.org/10.1061/9780784479872.059</mixed-citation></ref><ref id="scirp.71941-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Shoghli, B. and Lim, Y.H. (2015) Predictive Scheme for Failures of Embankment Dams with High Overtopping Potential: Case Studies Using Remote Sensing Data. World Environmental and Water Resources Congress, Austin, 17-21 May 2015, 1332-1340. http://dx.doi.org/10.1061/9780784479162.131</mixed-citation></ref><ref id="scirp.71941-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Alikhani, J., Deinhart, A., Visser, A., Bibby, R., Purtschert, R., Moran, J., Massoudieh, A. and Esser, B. (2016) Nitrate Vulnerability Projections from Bayesian Inference of Multiple Groundwater Age Tracers. Journal of Hydrology, In Press. http://dx.doi.org/10.1016/j.jhydrol.2016.04.028</mixed-citation></ref><ref id="scirp.71941-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Alikhani, J., Shayegan, J. and Akbari, A. (2015) Risk Assessment of Hydrocarbon Contaminant Transport in Vadose Zone as It Travels to Groundwater Table: A Case Study. Advances in Environmental Technology, 2, 77-84.</mixed-citation></ref><ref id="scirp.71941-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Alikhani, J., Al-Omari, A., Clippeleir, H.D., Murthy, S., Takacs, I. and Massoudieh, A. (2016) Assessment of the Endogenous Respiration Rate and the Observed Biomass Yield for Methanol-Fed Denitrifying Bacteria under Anoxic and Aerobic Conditions. Water Science and Technology, In Press. http://dx.doi.org/10.2166/wst.2016.486</mixed-citation></ref><ref id="scirp.71941-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Hauduc, H., Rieger, L., Ohtsuki, T., Shaw, A., Takacs, I., Winkler, S., Heduit, A., Vanrolleghem, P.A. and Gillot, S. (2011) Activated Sludge Modelling: Development and Potential Use of a Practical Applications Database. Water Science &amp; Technology, 63, 2164-2182. http://dx.doi.org/10.2166/wst.2011.368</mixed-citation></ref><ref id="scirp.71941-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Gernaey, K.V., van Loosdrecht, M.C.M., Henze, M., Lind, M. and J&amp;oslash;rgensen, S.B. (2004) Activated Sludge Wastewater Treatment Plant Modelling and Simulation: State of the Art. Environmental Modelling &amp; Software, 19, 763-783. http://dx.doi.org/10.1016/j.envsoft.2003.03.005</mixed-citation></ref><ref id="scirp.71941-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">Celaya, E.A., Aguirrezabala, J.J.A. and Chatzipantelidis, P. (2014) Implementation of an Adaptive BDF2 Formula and Comparison with the MATLAB Ode15s. Procedia Computer Science, 29, 1014-1026. http://dx.doi.org/10.1016/j.procs.2014.05.091</mixed-citation></ref><ref id="scirp.71941-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Akinfenwa, O.A., Jator, S.N. and Yao, N.M. (2013) Continuous Block Backward Differentiation Formula for Solving Stiff Ordinary Differential Equations. Computers &amp; Mathematics with Applications, 65, 996-1005. http://dx.doi.org/10.1016/j.camwa.2012.03.111</mixed-citation></ref><ref id="scirp.71941-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">Jannelli, A. and Fazio, R. (2006) Adaptive Stiff Solvers at Low Accuracy and Complexity. Journal of Computational and Applied Mathematics, 191, 246-258. http://dx.doi.org/10.1016/j.cam.2005.06.041</mixed-citation></ref><ref id="scirp.71941-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">Hojjati, G., Rahimi Ardabili, M.Y. and Hosseini, S.M. (2004) A-EBDF: An Adaptive Method for Numerical Solution of Stiff Systems of ODEs. Mathematics and Computers in Simulation, 66, 33-41. http://dx.doi.org/10.1016/j.matcom.2004.02.019</mixed-citation></ref><ref id="scirp.71941-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">Cash, J.R. (2000) Modified Extended Backward Differentiation Formulae for the Numerical Solution of Stiff Initial Value Problems in ODEs and DAEs. Journal of Computational and Applied Mathematics, 125, 117-130. http://dx.doi.org/10.1016/S0377-0427(00)00463-5</mixed-citation></ref><ref id="scirp.71941-ref19"><label>19</label><mixed-citation publication-type="other" xlink:type="simple">Lindberg, C.-F. and Carlsson, B. (1996) Adaptive Control of External Carbon Flow Rate in an Activated Sludge Process. Water Science and Technology, 34, 173-180. http://dx.doi.org/10.1016/0273-1223(96)84212-0</mixed-citation></ref><ref id="scirp.71941-ref20"><label>20</label><mixed-citation publication-type="other" xlink:type="simple">Alikhani, J., Takacs, I., Omari, A.A., Murthy, S., Mokhayeri, Y. and Massoudieh, A. (2014) Inverse Modeling of Nitrification-Denitrification Processes: A Case Study on the Blue Plains Wastewater Treatment Plant in Washington, DC. Proceedings of the Water Environment Federation, 19, 4556-4567. http://dx.doi.org/10.2175/193864714815942620</mixed-citation></ref><ref id="scirp.71941-ref21"><label>21</label><mixed-citation publication-type="other" xlink:type="simple">Alikhani, J., Takacs, I., Al-Omari, A., Murthy, S., Mokhayeri, Y. and Massoudieh, A. (2015) Time Series Analysis for Uncertainty Evaluation of Performance of Biological Wastewater Treatment. Proceedings of the Water Environment Federation, 15, 3519-3526.</mixed-citation></ref><ref id="scirp.71941-ref22"><label>22</label><mixed-citation publication-type="other" xlink:type="simple">Henze, M., Gujer, W., Mino, T. and van Loosdrecht, M. (2000) Activated Sludge Models ASM1, ASM2, ASM2d and ASM3. IWA Publishing, London.</mixed-citation></ref><ref id="scirp.71941-ref23"><label>23</label><mixed-citation publication-type="other" xlink:type="simple">Henze, M., Leslie Grady Jr, C.P., Gujer, W., Marais, G.V.R., Matsuo, T., Henze, M., Leslie Grady Jr, C.P., Gujer, W., Marais, G.V.R. and Matsuo, T. (1987) A General Model for Single-Sludge Wastewater Treatment Systems. Water Research, 21, 505-515. http://dx.doi.org/10.1016/0043-1354(87)90058-3</mixed-citation></ref><ref id="scirp.71941-ref24"><label>24</label><mixed-citation publication-type="other" xlink:type="simple">Han, H.-G., Qian, H.-H. and Qiao, J.-F. (2014) Nonlinear Multiobjective Model-Predictive Control Scheme for Wastewater Treatment Process. Journal of Process Control, 24, 47-59. http://dx.doi.org/10.1016/j.jprocont.2013.12.010</mixed-citation></ref><ref id="scirp.71941-ref25"><label>25</label><mixed-citation publication-type="other" xlink:type="simple">Hauduc, H., Rieger, L., Oehmen, A., van Loosdrecht, M.C., Comeau, Y., Heduit, A., Vanrolleghem, P.A. and Gillot, S. (2013) Critical Review of Activated Sludge Modeling: State of Process Knowledge, Modeling Concepts, and Limitations. Biotechnology and Bioengineering, 110, 24-46. http://dx.doi.org/10.1002/bit.24624</mixed-citation></ref><ref id="scirp.71941-ref26"><label>26</label><mixed-citation publication-type="other" xlink:type="simple">Busch, J., Elixmann, D., Kühl, P., Gerkens, C., Schl&amp;ouml;der, J.P., Bock, H.G. and Marquardt, W. (2013) State Estimation for Large-Scale Wastewater Treatment Plants. Water Research, 47, 4774-4787. http://dx.doi.org/10.1016/j.watres.2013.04.007</mixed-citation></ref><ref id="scirp.71941-ref27"><label>27</label><mixed-citation publication-type="other" xlink:type="simple">Le Moullec, Y., Potier, O., Gentric, C. and Leclerc, J.P. (2011) Activated Sludge Pilot Plant: Comparison between Experimental and Predicted Concentration Profiles Using Three Different Modelling Approaches. Water Research, 45, 3085-3097. http://dx.doi.org/10.1016/j.watres.2011.03.019</mixed-citation></ref></ref-list></back></article>