<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing with OASIS Tables v3.0 20080202//EN" "journalpub-oasis3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:oasis="http://docs.oasis-open.org/ns/oasis-exchange/table" xml:lang="en" dtd-version="3.0">
  <front>
    <journal-meta><journal-id journal-id-type="publisher">DWES</journal-id><journal-title-group>
    <journal-title>Drinking Water Engineering and Science</journal-title>
    <abbrev-journal-title abbrev-type="publisher">DWES</abbrev-journal-title><abbrev-journal-title abbrev-type="nlm-ta">Drink. Water Eng. Sci.</abbrev-journal-title>
  </journal-title-group><issn pub-type="epub">1996-9465</issn><publisher>
    <publisher-name>Copernicus Publications</publisher-name>
    <publisher-loc>Göttingen, Germany</publisher-loc>
  </publisher></journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.5194/dwes-11-25-2018</article-id><title-group><article-title>Mass imbalances in EPANET water-quality simulations</article-title><alt-title>Mass imbalances in EPANET</alt-title>
      </title-group><?xmltex \runningtitle{Mass imbalances in EPANET}?><?xmltex \runningauthor{M. J. Davis et al.}?>
      <contrib-group>
        <contrib contrib-type="author" corresp="yes" rid="aff1">
          <name><surname>Davis</surname><given-names>Michael J.</given-names></name>
          <email>mike_davis@anl.gov</email>
        </contrib>
        <contrib contrib-type="author" corresp="yes" rid="aff2">
          <name><surname>Janke</surname><given-names>Robert</given-names></name>
          <email>janke.robert@epa.gov</email>
        </contrib>
        <contrib contrib-type="author" corresp="no" rid="aff3">
          <name><surname>Taxon</surname><given-names>Thomas N.</given-names></name>
          
        </contrib>
        <aff id="aff1"><label>1</label><institution>Argonne Associate of Seville, Environmental Science Division, Argonne National Laboratory, <?xmltex \hack{\break}?>Argonne, Illinois, USA</institution>
        </aff>
        <aff id="aff2"><label>2</label><institution>National Homeland Security Research Center, US Environmental Protection Agency, Cincinnati, Ohio, USA</institution>
        </aff>
        <aff id="aff3"><label>3</label><institution>Global Security Sciences Division, Argonne National Laboratory, Argonne, Illinois, USA</institution>
        </aff>
      </contrib-group>
      <author-notes><corresp id="corr1">Michael J. Davis (mike_davis@anl.gov) and Robert Janke (janke.robert@epa.gov)</corresp></author-notes><pub-date><day>6</day><month>April</month><year>2018</year></pub-date>
      
      <volume>11</volume>
      <issue>1</issue>
      <fpage>25</fpage><lpage>47</lpage>
      <history>
        <date date-type="received"><day>2</day><month>September</month><year>2017</year></date>
           <date date-type="rev-request"><day>26</day><month>September</month><year>2017</year></date>
           <date date-type="rev-recd"><day>22</day><month>February</month><year>2018</year></date>
           <date date-type="accepted"><day>4</day><month>March</month><year>2018</year></date>
      </history>
      <permissions>
        
        
      <license license-type="open-access"><license-p>This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this licence, visit <ext-link ext-link-type="uri" xlink:href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</ext-link></license-p></license></permissions><self-uri xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018.html">This article is available from https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018.html</self-uri><self-uri xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018.pdf">The full text article is available as a PDF file from https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018.pdf</self-uri>
      <abstract>
    <p id="d1e115">EPANET is widely employed to simulate water quality in water distribution
systems. However, in general, the time-driven simulation approach used to
determine concentrations of water-quality constituents provides accurate
results only for short water-quality time steps. Overly long time steps can
yield errors in concentration estimates and can result in situations in which
constituent mass is not conserved. The use of a time step that is
sufficiently short to avoid these problems may not always be feasible. The
absence of EPANET errors or warnings does not ensure conservation of mass.
This paper provides examples illustrating mass imbalances and explains how
such imbalances can occur because of fundamental limitations in the
water-quality routing algorithm used in EPANET. In general, these limitations
cannot be overcome by the use of improved water-quality modeling practices.
This paper also presents a preliminary event-driven approach that conserves
mass with a water-quality time step that is as long as the hydraulic time
step. Results obtained using the current approach converge, or tend to
converge, toward those obtained using the preliminary event-driven approach as
the water-quality time step decreases. Improving the water-quality routing
algorithm used in EPANET could eliminate mass imbalances and related errors
in estimated concentrations. The results presented in this paper should be of
value to those who perform water-quality simulations using EPANET or use the
results of such simulations, including utility managers and engineers.</p>
  </abstract>
    </article-meta>
  <notes notes-type="copyrightstatement">
  
      <p id="d1e125">Copyright for this publication of authors  Michael J. Davis and  Thomas N. Taxon is
transferred to UChicago Argonne, LLC, as operator of Argonne National
Laboratory, and is subject to reserved government use rights.</p>
</notes></front>
<body>
      


<sec id="Ch1.S1" sec-type="intro">
  <title>Introduction</title>
      <p id="d1e134">EPANET <xref ref-type="bibr" rid="bib1.bibx15 bib1.bibx17" id="paren.1"/> is the standard software used for
simulating water quality in a water distribution system (WDS). It has been
widely and successfully applied for many years. The software includes a
hydraulic model that determines water flow and direction throughout a network
model that is used to represent a WDS. The network model consists of links
(pipes) and nodes (junctions). The water-quality simulation is piggybacked on
the hydraulic simulation. EPANET has commonly been used in situations in
which water quality does not change rapidly during the simulation. However,
in some cases involving simulations of contaminant injections into a WDS it
has been found that the mass of the constituent added to the network is not
conserved <xref ref-type="bibr" rid="bib1.bibx4 bib1.bibx6" id="paren.2"/>. That is, at a time <inline-formula><mml:math id="M1" display="inline"><mml:mi>t</mml:mi></mml:math></inline-formula> in a simulation, the
mass of the constituent in the network's pipes, <inline-formula><mml:math id="M2" display="inline"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mi mathvariant="normal">P</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, and tanks,
<inline-formula><mml:math id="M3" display="inline"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, plus the cumulative mass of the constituent removed from the
network by nodal demands, <inline-formula><mml:math id="M4" display="inline"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mi mathvariant="normal">CR</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, does not equal the cumulative mass of
the constituent injected into the network, <inline-formula><mml:math id="M5" display="inline"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mi mathvariant="normal">CI</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. (The mass of the
constituent in the system before the injection is zero and there is no loss
of the constituent due to chemical reactions.) The mass imbalance can be
large. For example, defining a mass-balance ratio (MBR) as <inline-formula><mml:math id="M6" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:msub><mml:mi>M</mml:mi><mml:mi mathvariant="normal">P</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>+</mml:mo><mml:msub><mml:mi>M</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>+</mml:mo><mml:msub><mml:mi>M</mml:mi><mml:mi mathvariant="normal">CR</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:msub><mml:mi>M</mml:mi><mml:mi mathvariant="normal">CI</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, the MBR can exceed 10 or be less than 0.1 in some cases
for some network models at the end of a simulation. There<?pagebreak page26?> can be cases in
which constituent mass is gained during a simulation (MBR <inline-formula><mml:math id="M7" display="inline"><mml:mo>&gt;</mml:mo></mml:math></inline-formula> 1), cases in
which constituent mass is lost (MBR <inline-formula><mml:math id="M8" display="inline"><mml:mo>&lt;</mml:mo></mml:math></inline-formula> 1), as well as cases in which mass is
conserved (MBR <inline-formula><mml:math id="M9" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 1). A failure to conserve constituent mass indicates that
there are errors in the estimated constituent concentrations, which
potentially could be a concern for any application that considers water
quality in a distribution system. When poor-quality network models are used,
the lack of conservation of constituent mass can be exacerbated.</p>
      <p id="d1e301">EPANET is available in two forms: (1) a Microsoft
Windows<sup>®</sup> version with a user interface and
(2) a programmer's toolkit version. The latter consists of a dynamic link
library of functions that allows software developers to customize their
EPANET applications. The last major release of EPANET, including both
versions, occurred in 2000 (EPANET 2.0). The last minor release of EPANET
occurred in 2008 (2.00.12). In 2012, the US EPA initiated a collaborative,
community-based open-source effort for EPANET, the “Water Distribution
Network Model” project <xref ref-type="bibr" rid="bib1.bibx18" id="paren.3"/>. In June 2015, an independent
water-community-organized, open-source project began <xref ref-type="bibr" rid="bib1.bibx11" id="paren.4"/>; an
open-source-project version of the EPANET programmer's toolkit (2.1) was
produced in July 2016. Also in July 2016, Lewis Rossman, the original
developer of EPANET, contributed a development version (EPANET 3) of the
programmer's toolkit <xref ref-type="bibr" rid="bib1.bibx12" id="paren.5"/>, which can provide mass-balance
information in a status report after a water-quality simulation. None of the
earlier versions of the software provides this information.</p>
      <p id="d1e316">Although versions 2.00.12 and 2.1 of EPANET do not track the mass of a
water-quality constituent and its location in a network during a simulation,
both mass and its location can be determined using the concentrations of the
constituent provided by the water-quality simulation. EPANET Example Network
3 <xref ref-type="bibr" rid="bib1.bibx17" id="paren.6"/> is a simple network with 97 nodes; it is called Network N1
in this paper. Considering independent contaminant injections at each of the
nodes in the network, Fig. <xref ref-type="fig" rid="Ch1.F1"/> shows how MBRs determined for
these injections are distributed after a 24 <inline-formula><mml:math id="M10" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulation. (Details on
the method used to obtain these results are provided below.) The figure shows
that sizable imbalances can occur in this network, unless quite small
water-quality time steps are used. (EPANET's default water-quality time step
is 300 <inline-formula><mml:math id="M11" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>.) These imbalances are the result of errors in the
concentrations of the constituent determined by EPANET. The water-quality
routing algorithm used in EPANET does not ensure conservation of mass and
large imbalances can occur because of fundamental limitations in the
algorithm. Good modeling practice requires use of a water-quality time step
that is less than or equal to one-tenth of the hydraulic time step, which was
3600 <inline-formula><mml:math id="M12" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> for the example shown in Fig. <xref ref-type="fig" rid="Ch1.F1"/>. Although mass
imbalances for all injection nodes for Network N1 can be minimized, but not
eliminated, by using a water-quality time step of 60 <inline-formula><mml:math id="M13" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> (one-sixtieth
of the hydraulic time step), simply reducing the time step will not, in
general, ensure mass conservation. In general, mass conservation cannot be
ensured with the use of a nonzero water-quality time step.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F1"><caption><p id="d1e357"> Distribution of mass-balance ratios for EPANET Example Network 3 after 24 h simulations
of independent contaminant injections at each network node. The horizontal black lines in the box plots give the median,
the box extends from the lower to the upper quartile, and the whiskers extend to the smaller of 1.5 times the interquartile
range or the most extreme data point. The hydraulic time step was 3600 s. <inline-formula><mml:math id="M14" display="inline"><mml:mi>N</mml:mi></mml:math></inline-formula> <inline-formula><mml:math id="M15" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 94. Three nodes were excluded because
there was no flow at the time the injection occurred.</p></caption>
        <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f01.pdf"/>

      </fig>

      <p id="d1e381">This paper provides examples in which mass imbalances occur, discusses why
they occur, and presents a preliminary approach to water-quality modeling,
currently under development for use in EPANET, which can eliminate such
imbalances. Both the approach currently used in EPANET and the preliminary
approach included in this paper use Lagrangian water-quality models: they
follow individual parcels of water as they move through the network. However,
the current EPANET approach uses a time-driven simulation model, while the
preliminary approach presented here uses an event-driven one. The nature of
time-driven and event-driven models is discussed later in this paper.</p>
      <p id="d1e384">The next section discusses the methods used in our analysis. The nature of
the problems encountered when using the current version of EPANET is then
described, followed by a section that (1) presents an event-driven simulation
method for water-quality routing for EPANET that eliminates these problems
and (2) compares results obtained using the two methods. Finally, the major
conclusions of the paper are presented, followed by some recommendations.
Details on the time-driven and event-driven models are presented in
appendices. Although the term “contaminant” is often used in this paper to
refer to a water-quality constituent intentionally added to the water in a
WDS, the results presented here apply to any water-quality constituent
present in a WDS.</p>
</sec>
<?pagebreak page27?><sec id="Ch1.S2">
  <title>Methods</title>
      <p id="d1e393">The analysis for this paper was done with TEVA-SPOT <xref ref-type="bibr" rid="bib1.bibx19" id="paren.7"/>, which
uses a modified version of the EPANET programmer's toolkit (2.00.12) for
hydraulic and water-quality simulations in a WDS <xref ref-type="bibr" rid="bib1.bibx17" id="paren.8"/>. The version
of TEVA-SPOT used was TEVA-SPOTInstaller-2.3.2-MSXb-20170110-DEV. TEVA-SPOT
was developed by US EPA's National Homeland Security Research Center to
provide an ability to evaluate the consequences of intentional and
unintentional releases of a contaminant into a WDS and to design
contamination warning systems for a WDS. It is the only program that we are
aware of that can be used easily and efficiently to evaluate the consequences
of injections at any or all nodes in a network model. The ability to track
contaminant mass using the concentration results provided by EPANET was
included in TEVA-SPOT to allow a better understanding of the distribution of
a contaminant in a network following injection and to improve quality control
for simulations. Without this capability, the failure to conserve constituent
mass that can occur during EPANET simulations would not have been identified.
The only significant modification made to the EPANET 2.00.12 code to support
its use in TEVA-SPOT is the inclusion of the ability to allow the direct
addition of contaminant mass to tanks. Any mass imbalances identified are the
result of errors in constituent concentrations provided by EPANET, not the
accounting done by TEVA-SPOT.</p>
      <p id="d1e402">Water-quality simulations were carried out with the time-driven water-quality
model included in EPANET using four network models. Independent injection of
a contaminant was simulated at all nodes in a network model (using the MASS
source type in EPANET) and concentrations were determined at all downstream
nodes for a 168 <inline-formula><mml:math id="M16" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulation (unless noted otherwise). All simulations
used 0.5 <inline-formula><mml:math id="M17" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula> of contaminant injected uniformly at a rate of
8.33 g min<inline-formula><mml:math id="M18" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> over the period from 00:00 to 01:00 local time
(LT), at the beginning of the simulation (again, unless noted otherwise). In
addition, the contaminant mass in pipes and tanks and the cumulative mass of
contaminant withdrawn from the network were determined at each reporting step
in the simulation and MBRs were calculated. Contaminants were assumed to
behave as conservative tracers, with concentrations averaged over reporting
intervals. Statistics on mass imbalances were determined for each network and
specific injection nodes for which notable imbalances were observed were
selected for evaluation of contaminant concentrations at downstream nodes.
For comparison, simulations also were done for the selected injection nodes
using the preliminary event-driven simulation model described here, with the
same injection scenario as used with the time-driven method. The time and
duration used for injections are arbitrary; however, a consistent injection
scenario is necessary to ensure consistent hydraulic conditions for
water-quality simulations.</p>
      <p id="d1e431">Except as noted, all simulations used a hydraulic time step of 3600 <inline-formula><mml:math id="M19" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>.
Various water-quality time steps were used for time-driven simulations to
determine the influence of the time step on the MBR and the constituent
concentrations. The default water-quality time step in EPANET is
300 <inline-formula><mml:math id="M20" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, as noted above; however, some studies, e.g., <xref ref-type="bibr" rid="bib1.bibx7" id="text.9"/>,
<xref ref-type="bibr" rid="bib1.bibx10" id="text.10"/>, and <xref ref-type="bibr" rid="bib1.bibx20" id="text.11"/>, use substantially longer time steps. Therefore, in our
analysis we include water-quality time steps longer than the default value. A
reporting time step of 3600 <inline-formula><mml:math id="M21" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> was used in all simulations.
Event-driven simulations used a water-quality time step of 3600 <inline-formula><mml:math id="M22" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. A
quality tolerance of 0.01 mg L<inline-formula><mml:math id="M23" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> was used for all simulations,
except as noted.</p>
      <p id="d1e484">The network models used are summarized in Table <xref ref-type="table" rid="Ch1.T1"/>. Network N1 is
EPANET Example Network 3 <xref ref-type="bibr" rid="bib1.bibx17" id="paren.12"/>. Network N2 is a synthetic network
called Micropolis <xref ref-type="bibr" rid="bib1.bibx3" id="paren.13"/>. Network N3 is a model for an actual
distribution system that has been used in previous studies, e.g.,
<xref ref-type="bibr" rid="bib1.bibx5" id="normal.14"/>. Finally, Network N4 is Network 2 in the paper “The battle of
the water sensor networks (BWSN)” by <xref ref-type="bibr" rid="bib1.bibx13" id="normal.15"/>. The version of Network N4
used in this study is available; see the section below on code and data
availability. No warnings or errors occurred while using EPANET with the
network models and cases considered in this paper. Network schematics are
provided in Appendix A.</p>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T1"><caption><p id="d1e505"> Network descriptions.</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="5">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="right"/>
     <oasis:colspec colnum="3" colname="col3" align="right"/>
     <oasis:colspec colnum="4" colname="col4" align="right"/>
     <oasis:colspec colnum="5" colname="col5" align="right"/>
     <oasis:thead>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry rowsep="1" namest="col2" nameend="col5" align="center">Network </oasis:entry>
       </oasis:row>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">Quantity</oasis:entry>
         <oasis:entry colname="col2">N1</oasis:entry>
         <oasis:entry colname="col3">N2</oasis:entry>
         <oasis:entry colname="col4">N3</oasis:entry>
         <oasis:entry colname="col5">N4</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">Population (10<inline-formula><mml:math id="M24" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>)</oasis:entry>
         <oasis:entry colname="col2">79</oasis:entry>
         <oasis:entry colname="col3">5</oasis:entry>
         <oasis:entry colname="col4">130</oasis:entry>
         <oasis:entry colname="col5">250</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Mean water use (m<inline-formula><mml:math id="M25" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> s<inline-formula><mml:math id="M26" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>)</oasis:entry>
         <oasis:entry colname="col2">0.7</oasis:entry>
         <oasis:entry colname="col3">0.07</oasis:entry>
         <oasis:entry colname="col4">0.4</oasis:entry>
         <oasis:entry colname="col5">1.4</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Per capita use (L d<inline-formula><mml:math id="M27" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>)</oasis:entry>
         <oasis:entry colname="col2">760</oasis:entry>
         <oasis:entry colname="col3">1200</oasis:entry>
         <oasis:entry colname="col4">280</oasis:entry>
         <oasis:entry colname="col5">480</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Nodes (10<inline-formula><mml:math id="M28" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>)</oasis:entry>
         <oasis:entry colname="col2">0.097</oasis:entry>
         <oasis:entry colname="col3">1.6</oasis:entry>
         <oasis:entry colname="col4">6.8</oasis:entry>
         <oasis:entry colname="col5">13</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">NZD nodes (10<inline-formula><mml:math id="M29" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>)</oasis:entry>
         <oasis:entry colname="col2">0.059</oasis:entry>
         <oasis:entry colname="col3">0.69</oasis:entry>
         <oasis:entry colname="col4">6.7</oasis:entry>
         <oasis:entry colname="col5">11</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Pipes (10<inline-formula><mml:math id="M30" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>)</oasis:entry>
         <oasis:entry colname="col2">0.12</oasis:entry>
         <oasis:entry colname="col3">1.4</oasis:entry>
         <oasis:entry colname="col4">8.0</oasis:entry>
         <oasis:entry colname="col5">15</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Tanks</oasis:entry>
         <oasis:entry colname="col2">3</oasis:entry>
         <oasis:entry colname="col3">1</oasis:entry>
         <oasis:entry colname="col4">5</oasis:entry>
         <oasis:entry colname="col5">2</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Reservoirs</oasis:entry>
         <oasis:entry colname="col2">2</oasis:entry>
         <oasis:entry colname="col3">2</oasis:entry>
         <oasis:entry colname="col4">1</oasis:entry>
         <oasis:entry colname="col5">2</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Pumps</oasis:entry>
         <oasis:entry colname="col2">2</oasis:entry>
         <oasis:entry colname="col3">8</oasis:entry>
         <oasis:entry colname="col4">20</oasis:entry>
         <oasis:entry colname="col5">4</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Valves</oasis:entry>
         <oasis:entry colname="col2">0</oasis:entry>
         <oasis:entry colname="col3">200</oasis:entry>
         <oasis:entry colname="col4">16</oasis:entry>
         <oasis:entry colname="col5">5</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table><table-wrap-foot><p id="d1e508">Note that all numbers are rounded independently to two significant figures. NZD: nonzero demand.</p></table-wrap-foot></table-wrap>

</sec>
<sec id="Ch1.S3">
  <title>Simulations with EPANET's time-driven approach</title>
      <p id="d1e815">The time-driven approach used in EPANET is discussed and examples are
provided of cases in which the approach does not conserve constituent mass.</p>
<sec id="Ch1.S3.SS1">
  <title>Background</title>
      <p id="d1e823">EPANET uses the Lagrangian time-driven simulation method for water-quality
routing in a network discussed in <xref ref-type="bibr" rid="bib1.bibx16" id="normal.16"/>. In general, the method<?pagebreak page28?> may
not always provide exact results. In particular, if the water-quality time
step is too long, concentration errors can occur; time steps should be less
than the time required for a water parcel to move through the network pipe
segment (link) having the shortest travel time for the simulation. In
principle, errors can be avoided if a sufficiently short time step is used.
However, such time steps may not be practical or feasible from a
computational perspective. For example, pumps and valves have zero length in
EPANET. Also, EPANET allows a minimum time step of only 1 <inline-formula><mml:math id="M31" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, which in
some cases may not be sufficiently short. Finally, water parcels can move
through only one link in a water-quality time step. Although relevant
improvements, for example the use of parallel processing and graphics
processing units <xref ref-type="bibr" rid="bib1.bibx21" id="paren.17"/>, can be expected, the approach currently used
in EPANET can be, and will likely remain, computationally challenging because
of the possibility of a large number of links in a network and the need to
use a short time step to minimize concentration errors.</p>
      <p id="d1e839">The algorithm used in EPANET to route water quality through a network can
result in situations in which constituent mass is gained or lost. These
imbalances can occur because of the manner in which water volume and
constituent mass are accumulated at nodes and the manner in which volume and
concentration are determined for subsequent releases to downstream links.
Constituent mass can be generated during the accumulation step and lost
during the release step at locations for which the volume of water being
moved during a water-quality time step exceeds the volume of the link in
which the water is being moved. When there is a spatial gradient in
constituent concentration at such locations, the mass generated during the
accumulation step and lost during the release step will not be the same and a
net generation or loss of constituent mass can occur. A detailed example is
provided in Appendix B illustrating how the time-driven algorithm used in
EPANET can fail to conserve constituent mass in such situations.</p>
      <p id="d1e842">Restricting the movement of water parcels to only one link per water-quality
time step means that, when longer time steps are used, a longer time is
required for a parcel to reach a particular downstream location. For example,
the arrival time of a contaminant pulse at some location following an
upstream injection will be delayed if a longer time step is used. This
results in concentration errors even if the shape of the pulse is unaffected.
If delays are sufficiently long, the potential exists for changes in
hydraulic conditions, which could also affect concentrations. Errors in
concentrations due to the effects associated with allowing water parcels to
move through only one link per water-quality time step can occur even if mass
is conserved.</p>
</sec>
<sec id="Ch1.S3.SS2">
  <title>Examples illustrating mass imbalances</title>
      <p id="d1e851">The examples presented in this section were obtained using EPANET's
time-driven water-quality routing algorithm; they demonstrate that large mass
imbalances can occur, that mass-balance and concentration results can be
sensitive to the water-quality time step used, and that a very short time
step may be necessary to avoid significant mass imbalances and to minimize
concentration errors. These results indicate that to model contaminant
intrusion events more accurately a more robust algorithm is needed for use
with EPANET that can ensure conservation of mass during water-quality
simulations.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F2" specific-use="star"><caption><p id="d1e856"> Influence of the water-quality time step on the components of mass
balance for an injection at Node 100 in Network N3.</p></caption>
          <?xmltex \igopts{width=341.433071pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f02.pdf"/>

        </fig>

      <p id="d1e865">For a contaminant injection at a selected node in Network N3, Fig. <xref ref-type="fig" rid="Ch1.F2"/>
shows how the various components of mass-balance change as the water-quality
time step is varied using the time-driven simulation method in EPANET. Note
that different vertical scales are used in each plot in the figure. The mass
that is injected or removed is a <italic>cumulative</italic> mass; the mass in pipes
and tanks is the mass in those locations at each time in the simulation. For
an injection at Node 100 in Network N3, a significant mass imbalance can
occur for water-quality time steps of 60 <inline-formula><mml:math id="M32" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> or longer. At the end of
the 168 <inline-formula><mml:math id="M33" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulations, the MBRs are 7.11, 4.88, 1.38, and 1 for
water-quality time steps of 900, 300, 60, and 1 <inline-formula><mml:math id="M34" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, respectively. For
the time steps equal to or longer than 60 s, considerably more mass was
removed from the network than was injected. A time step less than 60 <inline-formula><mml:math id="M35" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>
is necessary to conserve mass in this case.</p>
      <p id="d1e902">Changes in MBRs following injections at Node IN1029 in Network N2
(Micropolis) are shown in Fig. <xref ref-type="fig" rid="Ch1.F3"/> for the time-driven simulation
method and four different water-quality time steps. Considerable time is
required before the ratios stabilize for the longer time steps. Only for a
time step of 1 <inline-formula><mml:math id="M36" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> does the MBR approximately equal 1.0. This network
contains 196 valves, which, as noted, have zero length in EPANET, and,
therefore, zero travel time, which likely contributes to the large MBR values
shown in the figure. Note in Fig. <xref ref-type="fig" rid="Ch1.F3"/> that the mass imbalances are
larger for a time step of 300 <inline-formula><mml:math id="M37" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> than for a time step of 900 <inline-formula><mml:math id="M38" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>.
The location of Node IN1029 is shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F3"/>.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F3"><caption><p id="d1e936"> Mass-balance ratios for injections at Node IN1029 in Network N2 during
simulations with different water-quality time steps. The location of Node IN1029 is shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F3"/>.</p></caption>
          <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f03.pdf"/>

        </fig>

      <?xmltex \floatpos{t}?><fig id="Ch1.F4" specific-use="star"><caption><p id="d1e949"> Examples of how the mass-balance ratio can vary during simulations.
Results are for an injection at Node JUNCTION-3064 in Network N4. The location of Node JUNCTION-3064 is shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F4"/>.</p></caption>
          <?xmltex \igopts{width=341.433071pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f04.pdf"/>

        </fig>

      <p id="d1e960">Using two different water-quality time steps, Fig. <xref ref-type="fig" rid="Ch1.F4"/> shows
how the MBR varies during simulations for an injection at Node JUNCTION-3064
in Network N4 (BWSN), again using the time-driven method. Although the ratio
stabilizes after about 20 <inline-formula><mml:math id="M39" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> at 1.006 for a time step of 300 <inline-formula><mml:math id="M40" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>
and at about 1.000 for a time step of 60 <inline-formula><mml:math id="M41" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, the ratio can be
significantly different from 1.0 during the early portion of the simulations,
even with a water-quality time step of 60 s. Mass is first lost from the
system, then gained, then lost again, before the ratio approximately
stabilizes. Note that the vertical scales on the two plots in Fig. <xref ref-type="fig" rid="Ch1.F4"/> are different.</p>
      <?pagebreak page29?><p id="d1e988">Figure <xref ref-type="fig" rid="Ch1.F5"/> compares contaminant concentrations obtained using
the time-driven method for Node 247 in Network N1 (EPANET Example Network 3)
following an injection at Node 101, for different water-quality time steps.
As the water-quality time step decreases, the magnitude and timing of the
contaminant pulses at the downstream node change. The concentrations appear
to stabilize when the time step is reduced to 60 <inline-formula><mml:math id="M42" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. The MBRs given in
the figure are values at the end of a 24 <inline-formula><mml:math id="M43" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulation.</p>
      <p id="d1e1007">Contaminant concentrations at Node TN1810 in Network N2 following an
injection at Node IN1029 were determined using the time-driven method and are
compared in Fig. <xref ref-type="fig" rid="Ch1.F6"/> for different water-quality time
steps. Again, the magnitude and timing of the contaminant pulses vary with
the time step used. However, in this case, rather than generally decreasing
as the time step decreases, the concentration of the pulse increases
substantially in magnitude as the time step is reduced from 900 to
300 <inline-formula><mml:math id="M44" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, consistent with the MBRs determined for this injection node and
shown in Fig. <xref ref-type="fig" rid="Ch1.F3"/>. The maximum concentration then decreases by over
99 % going from a time step of 300 <inline-formula><mml:math id="M45" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> to a time step of 1 <inline-formula><mml:math id="M46" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. The
MBRs given in the figure are values at the end of a 168 <inline-formula><mml:math id="M47" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulation.</p>
      <?pagebreak page30?><p id="d1e1044">Using the time-driven method, contaminant concentrations were obtained at
Node 200 in Network N3 after an injection at Node 100; they are compared in
Fig. <xref ref-type="fig" rid="Ch1.F7"/> for different water-quality time steps. Again, the
timing and magnitude of the contaminant pulse change as the time step is
reduced to 1 <inline-formula><mml:math id="M48" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, as is the case in the examples presented for Networks
N1 and N2. The MBRs given in the figure are values at the end of a
168 <inline-formula><mml:math id="M49" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulation. Figure <xref ref-type="fig" rid="Ch1.F2"/> shows how the components of mass
balance vary following an injection at Node 100 for the same time steps used
in Fig. <xref ref-type="fig" rid="Ch1.F7"/>.</p>
      <p id="d1e1067">Figure <xref ref-type="fig" rid="Ch1.F8"/> compares contaminant concentrations obtained for a
receptor node, TANK-12525, in Network N4 following an injection at Node
JUNCTION-2514, using different water-quality time steps. Again, the
simulations used the time-driven method. In this case, the timing of changes
in concentration is similar for all the time steps used and there is a high
degree of correlation between the results for the different time steps.
However, concentration increases consistently as the time step decreases,
unlike the trends in the previous examples. Concentrations appear to have
approximately stabilized by a time step of 60 <inline-formula><mml:math id="M50" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, with little increase
in concentrations occurring when the time step is reduced to 1 <inline-formula><mml:math id="M51" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. The
MBRs given in the figure were determined at the end of a 168 <inline-formula><mml:math id="M52" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula>
simulation. Note that the MBR is less than 1.0 for time steps greater than
1 <inline-formula><mml:math id="M53" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. Substantial losses of contaminant mass can occur for longer time
steps.</p>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T2" specific-use="star"><caption><p id="d1e1103"> Statistics for mass imbalances.</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="8">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="right"/>
     <oasis:colspec colnum="3" colname="col3" align="right"/>
     <oasis:colspec colnum="4" colname="col4" align="right" colsep="1"/>
     <oasis:colspec colnum="5" colname="col5" align="right"/>
     <oasis:colspec colnum="6" colname="col6" align="right"/>
     <oasis:colspec colnum="7" colname="col7" align="right"/>
     <oasis:colspec colnum="8" colname="col8" align="right"/>
     <oasis:thead>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry rowsep="1" namest="col3" nameend="col4" align="center" colsep="1">MBR </oasis:entry>
         <oasis:entry rowsep="1" namest="col5" nameend="col8" align="center">Injection nodes (%) with imbalances </oasis:entry>
       </oasis:row>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">Network</oasis:entry>
         <oasis:entry colname="col2">WQTS (<inline-formula><mml:math id="M60" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>)</oasis:entry>
         <oasis:entry colname="col3">Max.</oasis:entry>
         <oasis:entry colname="col4">Min.</oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M61" display="inline"><mml:mo>&gt;</mml:mo></mml:math></inline-formula> 1 %</oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M62" display="inline"><mml:mo>&gt;</mml:mo></mml:math></inline-formula> 5 %</oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M63" display="inline"><mml:mo>&gt;</mml:mo></mml:math></inline-formula> 10 %</oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M64" display="inline"><mml:mo>&gt;</mml:mo></mml:math></inline-formula> 50 %</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">N1</oasis:entry>
         <oasis:entry colname="col2">1</oasis:entry>
         <oasis:entry colname="col3">1.00</oasis:entry>
         <oasis:entry colname="col4">1.00</oasis:entry>
         <oasis:entry colname="col5">0</oasis:entry>
         <oasis:entry colname="col6">0</oasis:entry>
         <oasis:entry colname="col7">0</oasis:entry>
         <oasis:entry colname="col8">0</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">60</oasis:entry>
         <oasis:entry colname="col3">1.02</oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M65" display="inline"><mml:mo>&gt;</mml:mo></mml:math></inline-formula> 0.99</oasis:entry>
         <oasis:entry colname="col5">2</oasis:entry>
         <oasis:entry colname="col6">0</oasis:entry>
         <oasis:entry colname="col7">0</oasis:entry>
         <oasis:entry colname="col8">0</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">300</oasis:entry>
         <oasis:entry colname="col3">1.15</oasis:entry>
         <oasis:entry colname="col4">0.97</oasis:entry>
         <oasis:entry colname="col5">38</oasis:entry>
         <oasis:entry colname="col6">6</oasis:entry>
         <oasis:entry colname="col7">1</oasis:entry>
         <oasis:entry colname="col8">0</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">900</oasis:entry>
         <oasis:entry colname="col3">1.77</oasis:entry>
         <oasis:entry colname="col4">0.83</oasis:entry>
         <oasis:entry colname="col5">65</oasis:entry>
         <oasis:entry colname="col6">46</oasis:entry>
         <oasis:entry colname="col7">31</oasis:entry>
         <oasis:entry colname="col8">5</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N2</oasis:entry>
         <oasis:entry colname="col2">1</oasis:entry>
         <oasis:entry colname="col3">1.05</oasis:entry>
         <oasis:entry colname="col4">0.08</oasis:entry>
         <oasis:entry colname="col5">2</oasis:entry>
         <oasis:entry colname="col6">1</oasis:entry>
         <oasis:entry colname="col7">1</oasis:entry>
         <oasis:entry colname="col8">1</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">60</oasis:entry>
         <oasis:entry colname="col3">6.49</oasis:entry>
         <oasis:entry colname="col4">0.06</oasis:entry>
         <oasis:entry colname="col5">39</oasis:entry>
         <oasis:entry colname="col6">29</oasis:entry>
         <oasis:entry colname="col7">18</oasis:entry>
         <oasis:entry colname="col8">5</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">300</oasis:entry>
         <oasis:entry colname="col3">23.45</oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M66" display="inline"><mml:mo>&lt;</mml:mo></mml:math></inline-formula> 0.01</oasis:entry>
         <oasis:entry colname="col5">47</oasis:entry>
         <oasis:entry colname="col6">39</oasis:entry>
         <oasis:entry colname="col7">32</oasis:entry>
         <oasis:entry colname="col8">17</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">900</oasis:entry>
         <oasis:entry colname="col3">31.16</oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M67" display="inline"><mml:mo>&lt;</mml:mo></mml:math></inline-formula> 0.01</oasis:entry>
         <oasis:entry colname="col5">52</oasis:entry>
         <oasis:entry colname="col6">49</oasis:entry>
         <oasis:entry colname="col7">44</oasis:entry>
         <oasis:entry colname="col8">24</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N3</oasis:entry>
         <oasis:entry colname="col2">1</oasis:entry>
         <oasis:entry colname="col3">1.03</oasis:entry>
         <oasis:entry colname="col4">0.99</oasis:entry>
         <oasis:entry colname="col5">1</oasis:entry>
         <oasis:entry colname="col6">0</oasis:entry>
         <oasis:entry colname="col7">0</oasis:entry>
         <oasis:entry colname="col8">0</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">60</oasis:entry>
         <oasis:entry colname="col3">1.39</oasis:entry>
         <oasis:entry colname="col4">0.92</oasis:entry>
         <oasis:entry colname="col5">7</oasis:entry>
         <oasis:entry colname="col6">1</oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M68" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">a</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8">0</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">300</oasis:entry>
         <oasis:entry colname="col3">4.88</oasis:entry>
         <oasis:entry colname="col4">0.22</oasis:entry>
         <oasis:entry colname="col5">35</oasis:entry>
         <oasis:entry colname="col6">15</oasis:entry>
         <oasis:entry colname="col7">8</oasis:entry>
         <oasis:entry colname="col8">1</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">900</oasis:entry>
         <oasis:entry colname="col3">15.74</oasis:entry>
         <oasis:entry colname="col4">0.08</oasis:entry>
         <oasis:entry colname="col5">57</oasis:entry>
         <oasis:entry colname="col6">36</oasis:entry>
         <oasis:entry colname="col7">25</oasis:entry>
         <oasis:entry colname="col8">6</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N4</oasis:entry>
         <oasis:entry colname="col2">1</oasis:entry>
         <oasis:entry colname="col3">1.01</oasis:entry>
         <oasis:entry colname="col4">0.83</oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M69" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">b</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M70" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">c</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M71" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">d</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8">0</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">60</oasis:entry>
         <oasis:entry colname="col3">1.04</oasis:entry>
         <oasis:entry colname="col4">0.67</oasis:entry>
         <oasis:entry colname="col5">1</oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M72" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">e</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M73" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">c</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8">0</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">300</oasis:entry>
         <oasis:entry colname="col3">1.21</oasis:entry>
         <oasis:entry colname="col4">0.61</oasis:entry>
         <oasis:entry colname="col5">21</oasis:entry>
         <oasis:entry colname="col6">4</oasis:entry>
         <oasis:entry colname="col7">2</oasis:entry>
         <oasis:entry colname="col8">0</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">900</oasis:entry>
         <oasis:entry colname="col3">2.60</oasis:entry>
         <oasis:entry colname="col4">0.09</oasis:entry>
         <oasis:entry colname="col5">44</oasis:entry>
         <oasis:entry colname="col6">28</oasis:entry>
         <oasis:entry colname="col7">19</oasis:entry>
         <oasis:entry colname="col8">1</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table><table-wrap-foot><p id="d1e1106">WQTS: water-quality time step; MBR: mass-balance ratio. Results do not include cases with MBR <inline-formula><mml:math id="M54" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 0, which
occurs for nodes with no flow at the time of injection. In addition, for Network N4, two nodes also are excluded that are in dead-end
areas with no demands, but that have small flows at the beginning of the simulation. A total of three nodes are excluded for Network N1
(3 %), 92 or 93 for Network N2 (6 %), depending on the time step, 55 or 56 for Network N3 (1 %), again depending on the time step, and
404 for network N4 (3 %). See text for discussion. <inline-formula><mml:math id="M55" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">a</mml:mi></mml:msup></mml:math></inline-formula> 13 nodes. <inline-formula><mml:math id="M56" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">b</mml:mi></mml:msup></mml:math></inline-formula> 11 nodes. <inline-formula><mml:math id="M57" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">c</mml:mi></mml:msup></mml:math></inline-formula> 2 nodes.
<inline-formula><mml:math id="M58" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">d</mml:mi></mml:msup></mml:math></inline-formula> 1 node. <inline-formula><mml:math id="M59" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">e</mml:mi></mml:msup></mml:math></inline-formula> 3 nodes.</p></table-wrap-foot></table-wrap>

      <p id="d1e1760">Statistics on the extent of mass imbalance at the end of simulations that
used the time-driven method are provided in Table <xref ref-type="table" rid="Ch1.T2"/> for the
four networks considered. The results in the table are based on independent
injections at most nodes for each of the networks. For example, the
statistics for Network N4 are based on independent simulations of injections
done for most of the 12 523 nodes in the network; a small fraction of the
nodes were excluded, as discussed in the next paragraph. The table provides
the range in MBRs determined for each network for each of four water-quality
time steps and the fraction of injection nodes for which there were
imbalances above some thresholds (e.g., 1, 5, 10 %).</p>
      <p id="d1e1765">MBRs equal to zero were obtained for injections at some nodes: the numerator
in the MBR was zero because no mass was present in the pipes or tanks at the
end of the simulation and no mass was removed during the simulation. Such
cases can occur when there is no flow at the time of injection (e.g.,
zero-demand nodes). When there is no flow at the time of injection, no
contaminant mass is added to the water in the WDS and the injected mass is
effectively lost, although the accounting process considers it to be mass
injected when determining an MBR. Injection nodes for which an MBR was equal
to zero at the end of a simulation were not included when determining the
statistics shown in Table <xref ref-type="table" rid="Ch1.T2"/>. For Network N4, two additional
nodes (JUNCTION-9097 and JUNCTION-12348) also were excluded. These two nodes are in
dead-end areas with no demands. Therefore, there should be no flows in these
areas. However, the network model had a small initial flow at these nodes,
inconsistent with a lack of demands in the dead-end areas. (EPANET determines
concentrations of constituents in outflows from a node using the
flow-weighted sum of inflow concentrations. If other inflows are very small,
such anomalous flows could be significant in relative terms and result in
concentration anomalies as well.) For Network N3, five nodes had MBRs near
0.2 for all water-quality time steps; however, when the hydraulic and
reporting time steps were changed to 1 min, the MBRs for the 1 min
and 1 s
water-quality time steps were near 1. MBRs near 1 were used for the five
nodes when determining the statistics for Network N3 shown in Table <xref ref-type="table" rid="Ch1.T2"/>.</p>
      <p id="d1e1773">Table <xref ref-type="table" rid="Ch1.T2"/> shows that as the water-quality time step decreases,
the maximum MBRs for each network decrease towards 1.0 and the minimum MBRs
generally increase. However, for Network N2 the minimum MBR increased only to
0.08 for the 1 <inline-formula><mml:math id="M74" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> time step and for Network N4 it reached only 0.83.
For all four networks considered, the fraction of injection nodes with
imbalances above the thresholds listed in the table decreases consistently as
the time step decreases. For a time step of 1 <inline-formula><mml:math id="M75" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, only about 2, 1, and
<inline-formula><mml:math id="M76" display="inline"><mml:mo>&lt;</mml:mo></mml:math></inline-formula> 1 % of the nodes had imbalances greater than 1 % for Networks N2, N3, and
N4, respectively. There were no mass imbalances greater than 0.01 % for this
time step for Network N1 (excluding three nodes for which the MBR was zero).
This is in contrast to<?pagebreak page31?> the sizable fraction of nodes in all the networks that
have imbalances for a time step of 300 <inline-formula><mml:math id="M77" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, although the imbalances for
Networks N1 and N4 are relatively minor for this time step, with only about 1
and 2 % of nodes in these networks, respectively, having an imbalance greater
than 10 %.</p>
      <p id="d1e1806">For a small fraction of the injection nodes in Networks N2, N3, and N4, about
0.8, 0.5, and 0.2 % of all nodes, respectively, the MBR did not change as the
water-quality time step decreased or did not change so that the MBR converged
toward 1.0. The lack of convergence of the MBR for these nodes had limited
influence on the statistics in Table <xref ref-type="table" rid="Ch1.T2"/>; it did influence the
values shown for the minimum MBR for Network N2, particularly for a time step of
1 <inline-formula><mml:math id="M78" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. The non-convergence can be the result of several factors,
including cases involving nodes in dead-end areas, as noted above. In
addition, some cases had flows at the time of injection that were unexpected,
given a lack of demands; the flows disappeared for subsequent time steps.
Some problems appear to be related to the hydraulic solution; these were
eliminated if a short (60 <inline-formula><mml:math id="M79" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>) hydraulic time step was used.</p>
      <p id="d1e1825">Mass balances are sensitive to the injection time used. An acceptable mass
balance for a particular application for a given injection node does not
guarantee an acceptable mass balance if hydraulic conditions are changed. As
an example of the extreme changes that can occur when hydraulic conditions
change, consider an injection at Node VN1263 in Network N2 (see location in
Fig. <xref ref-type="fig" rid="App1.Ch1.F3"/>), a 168 <inline-formula><mml:math id="M80" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulation, and a 900 <inline-formula><mml:math id="M81" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>
water-quality time step. For a 1 <inline-formula><mml:math id="M82" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> injection starting at 06:00,
the MBR at the end of the simulation was 467. For a 1 <inline-formula><mml:math id="M83" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> injection
starting at 00:00, the MBR at the end of the simulation was 0.007. In
the first case, much more mass was removed from the network by nodal demands
during the simulation than was injected; in the second case, very little mass
remained in the system at the end of the simulation or was removed from the
system by nodal demands during the simulation. In both cases the extreme
values for the MBR are the result of errors in the estimated concentrations
downstream from the injection location, too high in the first case and too low
in the second. These errors resulted in the erroneous numerical generation or
loss of constituent mass in the system.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F5"><caption><p id="d1e1860"> Influence of the water-quality time step on estimated contaminant
concentrations at Node 247 in Network N1 following an injection at Node 101 at 00:00 LT.
Locations of the nodes are shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F1"/>.</p></caption>
          <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f05.pdf"/>

        </fig>

      <p id="d1e1871">The cases considered to this point used relatively short, 1 <inline-formula><mml:math id="M84" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula>
injections. However, major mass imbalances also occur for injections with
long durations. For example, with a 300 <inline-formula><mml:math id="M85" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> water-quality time step, the
largest MBR for any injection node in Network N2 for a 1 <inline-formula><mml:math id="M86" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> injection
at 00:00 is about 23; for 6 and 12 <inline-formula><mml:math id="M87" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> injections at that time the
largest MBRs are 1495 and 971, respectively. About 17, 22, and 22 % of
injection nodes have mass imbalances greater than 50 % for the 1, 6, and
12 <inline-formula><mml:math id="M88" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> injections, respectively. About 32, 39, and 35 % have imbalances
greater than 10 %. The statistics for mass imbalance are relatively
insensitive to injection duration for this network. However, mass balances
for a particular injection node can be sensitive to the injection duration.
For example, for Node VN1263 in Network N2 the MBRs are 3.3, 1495, and 971
for injections at 00:00 with durations of 1, 6, and 12 <inline-formula><mml:math id="M89" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula>,
respectively.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F6"><caption><p id="d1e1920"> Influence of the water-quality time step on estimated contaminant
concentrations at Node TN1810 in Network N2 following an injection at Node IN1029 at 00:00 LT.
Locations of the nodes are shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F3"/>.</p></caption>
          <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f06.pdf"/>

        </fig>

      <p id="d1e1931">EPANET 3, the development version of EPANET <xref ref-type="bibr" rid="bib1.bibx12" id="paren.18"/>, also yields
results with mass<?pagebreak page32?> imbalances. Consider a case involving chlorine decay with
both bulk and wall reactions and EPANET Example Network 1 <xref ref-type="bibr" rid="bib1.bibx17" id="paren.19"/> with
default input parameters, except for the water-quality time step. No
water-quality sources were used; however, initial chlorine concentrations
were specified. The network is very simple, with only 9 junctions and 12
pipes. A chlorine mass imbalance of 0.85 % (<inline-formula><mml:math id="M90" display="inline"><mml:mo lspace="0mm">&lt;</mml:mo></mml:math></inline-formula> 1 %) was obtained for a
water-quality time step of 900 <inline-formula><mml:math id="M91" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> and a 24 <inline-formula><mml:math id="M92" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulation. For
time steps of 300, 60, and 1 <inline-formula><mml:math id="M93" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, the imbalances were 0.77, 0.58, and
0.49 %, respectively. Mass imbalance was determined in EPANET 3 in the same
manner as discussed in this paper except that the initial mass of chlorine in
the system also was considered, as was the mass of chlorine lost due to
chemical reactions. Execution time increased from about 0.02 <inline-formula><mml:math id="M94" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> to
about 0.03, 0.04, and 1 <inline-formula><mml:math id="M95" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> when the time step was decreased from
900 <inline-formula><mml:math id="M96" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> to 300, 60, and 1 <inline-formula><mml:math id="M97" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, respectively, an overall increase in
execution time of about 50 fold. To obtain mass imbalances well below 0.1 %,
a time step well below 1 <inline-formula><mml:math id="M98" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> may be needed, along with additional
increases in execution time. This is an extremely small, simple network and
large imbalances are not expected. For this example, the EPANET 3 code
<xref ref-type="bibr" rid="bib1.bibx12" id="paren.20"/> was compiled using the GNU Compiler Collection
<xref ref-type="bibr" rid="bib1.bibx9" id="paren.21"/>.</p>
      <p id="d1e2011">EPANET allows four source types to be used to define locations of sources of
constituents <xref ref-type="bibr" rid="bib1.bibx15" id="paren.22"/>. As noted above, the simulations in this study
used the MASS source type, which allows a source strength to be specified in
terms of mass added per unit time. The other source types (CONCEN, FLOWPACED,
and SETPOINT) all specify source strength in terms of concentration. All are
similar in that they allow the addition of the mass of some constituent to
the system. EPANET's failure to conserve constituent mass is not related to
how the mass is added to the system. Therefore, the findings presented here
related to a failure to conserve mass apply independently of the source type
used in the simulation. As the example discussed in the preceding paragraph
demonstrates, failure to conserve mass can occur in situations in which no
sources are used and the only mass present in the system is the result of the
initial water quality specified.</p>
</sec>
</sec>
<sec id="Ch1.S4">
  <title>Simulations with the preliminary event-driven approach</title>
      <p id="d1e2025">The preliminary event-driven approach is discussed and results obtained using
this approach are compared to those obtained using the time-driven approach.</p>
<sec id="Ch1.S4.SS1">
  <title>Background</title>
      <p id="d1e2033">Changes in a WDS do not occur at regular time intervals. For example, the
time required for a water parcel to move from node to node in the system
varies from pipe to pipe and also within a pipe as conditions change. In
addition, some pipes can be short, have a high flow rate, and require only a
short time for a water parcel to move through them. This transit time can be
too small to be practical for use as a water-quality time step in a
simulation. A situation in which events (changes) occur at irregular
intervals suggests use of an event-driven simulation.</p>
      <p id="d1e2036">A preliminary event-driven algorithm is outlined here and used to obtain
results for comparison with those provided by<?pagebreak page33?> EPANET using the current
time-driven approach. The event-driven approach used is conceptually similar
to, but was developed independently of, the Lagrangian event-driven
simulation method discussed in <xref ref-type="bibr" rid="bib1.bibx16" id="normal.23"/>. An event-driven method updates
the state of water quality in the system only when a change (an event) occurs
during the simulation, in contrast to the current time-driven method in
EPANET, which updates water quality across the entire network at fixed time
steps. Numerous events can occur during a time step, as water moves through
the network. Various event-driven approaches have been presented previously,
for example by <xref ref-type="bibr" rid="bib1.bibx1 bib1.bibx2" id="text.24"/>. The preliminary event-driven algorithm
discussed here is included as an option in the current version of TEVA-SPOT
(TEVA-SPOTInstaller-2.3.2-MSXb-20170110-DEV) and is being made available to
EPANET developers to obtain community support and assistance with improving
and evaluating the algorithm.</p>
      <p id="d1e2045">The event-based, water-quality routing algorithm used here moves homogeneous
volumes of water (water parcels with a uniform concentration of a
water-quality constituent) through a network. Initially, water parcels are
accumulated at all nodes where water enters the system. Nodes with
accumulated water parcels from all inflow links are processed in an arbitrary
order. Mixing or combining of water parcels occurs at nodes based on the
inflow rates of the links flowing into the nodes. Water parcels are combined
if the absolute difference between their concentrations is less than some
specified amount (the quality tolerance), consistent with the approach used
in EPANET 2. After parcels are combined at a node, any nodal demand is
removed; the remaining water parcels then are split based on the flow rates
of the links flowing from the nodes. These parcels are added to lists of
parcels for the downstream links. Any volume in excess of the volume of a
link is removed from the leading parcels and placed at the downstream node
for further processing. That node is then added to the set of nodes with
accumulated water parcels waiting to be processed. Due to recirculating
flows, situations can occur in which none of the nodes waiting to be
processed has accumulated water parcels on all inflow links. In such cases,
an incomplete parcel with the volume that will be moved, but an unspecified
concentration, is created for each inflow link that does not have an
accumulated inflow. These incomplete parcels are moved, combined, and split
in the same manner as parcels for which constituent concentration has been
determined; however, internal references are maintained that allow
concentrations to be updated when parcels for which concentrations have been
determined arrive at a node for which incomplete parcels were created. Flow
reversals between hydraulic time steps are accommodated in the same manner as
in EPANET 2. The event-driven simulation method provides results that do not
depend on the water-quality time step if it is equal to or shorter than the
hydraulic time step. The method actually does not require an independent
water-quality time step: the simulation is event-driven as long as the
hydraulic conditions do not change. Because by construction the method
accounts for every individual water parcel, its resulting MBR will always be
1.0. An example illustrating the operation of the algorithm using a case with
recirculating flow is provided in Appendix C. Working through the example
provided in the appendix will provide a better understanding of the approach
outlined in this paragraph.</p>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T3" specific-use="star"><caption><p id="d1e2051"> Least-squares fits of concentration results.</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="7">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="right"/>
     <oasis:colspec colnum="3" colname="col3" align="left"/>
     <oasis:colspec colnum="4" colname="col4" align="right"/>
     <oasis:colspec colnum="5" colname="col5" align="right"/>
     <oasis:colspec colnum="6" colname="col6" align="right"/>
     <oasis:colspec colnum="7" colname="col7" align="right"/>
     <oasis:thead>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">Network</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M106" display="inline"><mml:mi>N</mml:mi></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3">Case</oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M107" display="inline"><mml:mi>a</mml:mi></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M108" display="inline"><mml:mi>b</mml:mi></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6">adj-<inline-formula><mml:math id="M109" display="inline"><mml:mrow><mml:msup><mml:mi>R</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7">Residual SD</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">N1</oasis:entry>
         <oasis:entry colname="col2">24</oasis:entry>
         <oasis:entry colname="col3">TD300</oasis:entry>
         <oasis:entry colname="col4">0.2547</oasis:entry>
         <oasis:entry colname="col5">0.0074</oasis:entry>
         <oasis:entry colname="col6">0.0478</oasis:entry>
         <oasis:entry colname="col7">0.0273</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry colname="col3">TD60</oasis:entry>
         <oasis:entry colname="col4">0.9985</oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M110" display="inline"><mml:mo>-</mml:mo></mml:math></inline-formula>1 <inline-formula><mml:math id="M111" display="inline"><mml:mo>×</mml:mo></mml:math></inline-formula> 10<inline-formula><mml:math id="M112" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">6</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6">0.9999</oasis:entry>
         <oasis:entry colname="col7">0.0003</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry colname="col3">ED3600</oasis:entry>
         <oasis:entry colname="col4">0.9995</oasis:entry>
         <oasis:entry colname="col5">0.00001</oasis:entry>
         <oasis:entry colname="col6">1</oasis:entry>
         <oasis:entry colname="col7">0.0001</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N2</oasis:entry>
         <oasis:entry colname="col2">60</oasis:entry>
         <oasis:entry colname="col3">TD300</oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M113" display="inline"><mml:mo>-</mml:mo></mml:math></inline-formula>24.68</oasis:entry>
         <oasis:entry colname="col5">2.14</oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M114" display="inline"><mml:mo>-</mml:mo></mml:math></inline-formula>0.0169</oasis:entry>
         <oasis:entry colname="col7">3.385</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry colname="col3">TD60</oasis:entry>
         <oasis:entry colname="col4">52.42</oasis:entry>
         <oasis:entry colname="col5">0.0334</oasis:entry>
         <oasis:entry colname="col6">0.3196</oasis:entry>
         <oasis:entry colname="col7">0.0911</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry colname="col3">ED3600</oasis:entry>
         <oasis:entry colname="col4">0.944</oasis:entry>
         <oasis:entry colname="col5">0.0003</oasis:entry>
         <oasis:entry colname="col6">0.7657</oasis:entry>
         <oasis:entry colname="col7">0.0006</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N3</oasis:entry>
         <oasis:entry colname="col2">39</oasis:entry>
         <oasis:entry colname="col3">TD300</oasis:entry>
         <oasis:entry colname="col4">6.159</oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M115" display="inline"><mml:mo>-</mml:mo></mml:math></inline-formula>0.0115</oasis:entry>
         <oasis:entry colname="col6">0.8866</oasis:entry>
         <oasis:entry colname="col7">0.1398</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry colname="col3">TD60</oasis:entry>
         <oasis:entry colname="col4">1.515</oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M116" display="inline"><mml:mo>-</mml:mo></mml:math></inline-formula>0.00351</oasis:entry>
         <oasis:entry colname="col6">0.9866</oasis:entry>
         <oasis:entry colname="col7">0.0112</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry colname="col3">ED3600</oasis:entry>
         <oasis:entry colname="col4">0.9997</oasis:entry>
         <oasis:entry colname="col5">0.0001</oasis:entry>
         <oasis:entry colname="col6">0.9999</oasis:entry>
         <oasis:entry colname="col7">0.0005</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N4</oasis:entry>
         <oasis:entry colname="col2">168</oasis:entry>
         <oasis:entry colname="col3">TD300</oasis:entry>
         <oasis:entry colname="col4">0.7250</oasis:entry>
         <oasis:entry colname="col5">0.0016</oasis:entry>
         <oasis:entry colname="col6">0.9956</oasis:entry>
         <oasis:entry colname="col7">0.0011</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry colname="col3">TD60</oasis:entry>
         <oasis:entry colname="col4">0.9840</oasis:entry>
         <oasis:entry colname="col5">0.0001</oasis:entry>
         <oasis:entry colname="col6">1</oasis:entry>
         <oasis:entry colname="col7">0.0001</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry colname="col3">ED3600</oasis:entry>
         <oasis:entry colname="col4">0.9791</oasis:entry>
         <oasis:entry colname="col5">0.0018</oasis:entry>
         <oasis:entry colname="col6">0.9762</oasis:entry>
         <oasis:entry colname="col7">0.0035</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table><table-wrap-foot><p id="d1e2054">This table gives the parameters of a least-squares fit of the concentrations for the cases  shown to
the concentrations obtained using the time-driven algorithm with a water-quality time step of 1 <inline-formula><mml:math id="M99" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. Quantities <inline-formula><mml:math id="M100" display="inline"><mml:mi>a</mml:mi></mml:math></inline-formula>
and <inline-formula><mml:math id="M101" display="inline"><mml:mi>b</mml:mi></mml:math></inline-formula> are the slope and intercept, respectively, of the least-squares line. Cases are TD300, the time-driven algorithm with a 300 <inline-formula><mml:math id="M102" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>
time step; TD60, the time-driven algorithm with a 60 <inline-formula><mml:math id="M103" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> time step; and ED3600, the event-driven algorithm with a 3600 <inline-formula><mml:math id="M104" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> time step.
<inline-formula><mml:math id="M105" display="inline"><mml:mi>N</mml:mi></mml:math></inline-formula>: number of hourly concentration values used. SD: standard deviation.</p></table-wrap-foot></table-wrap>

</sec>
<sec id="Ch1.S4.SS2">
  <title>Discussion</title>
      <p id="d1e2523">Concentrations obtained using EPANET's time-driven algorithm tend to converge
toward those obtained using the event-driven algorithm as the water-quality time
step used in the time-driven algorithm decreases. For short water-quality
time steps (e.g., 1 <inline-formula><mml:math id="M117" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>) with the time-driven approach, the results for
the two methods can be very similar and differences can be difficult to see
in the plots used in this paper. Therefore, to better examine this
convergence, least-squares fits were determined relating (1) the
concentrations obtained using the time-driven approach with a water-quality
time step of 1 <inline-formula><mml:math id="M118" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> (TD1) and the concentrations obtained using the same
approach with a 60 <inline-formula><mml:math id="M119" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> time step (TD60), (2) TD1 and the concentrations
obtained using the time-driven approach with a 300 <inline-formula><mml:math id="M120" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> time step
(TD300), and (3) TD1 and the concentrations obtained using the event-driven
approach with a 3600 <inline-formula><mml:math id="M121" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> time step (ED3600). These least-squares lines
have the form <inline-formula><mml:math id="M122" display="inline"><mml:mrow><mml:mover accent="true"><mml:mi>y</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mo>=</mml:mo><mml:mi>a</mml:mi><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>b</mml:mi></mml:mrow></mml:math></inline-formula>, where <inline-formula><mml:math id="M123" display="inline"><mml:mi>a</mml:mi></mml:math></inline-formula> and <inline-formula><mml:math id="M124" display="inline"><mml:mi>b</mml:mi></mml:math></inline-formula> are the slope and
intercept of the fitted least-squares line, <inline-formula><mml:math id="M125" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> is the value of TD1, and
<inline-formula><mml:math id="M126" display="inline"><mml:mover accent="true"><mml:mi>y</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover></mml:math></inline-formula> is the fitted value of TD60, TD300, or ED3600, depending on which
is being used. The results of fitting least-squares lines are shown in
Table <xref ref-type="table" rid="Ch1.T3"/> for the four cases examined in Figs. <xref ref-type="fig" rid="Ch1.F5"/> to <xref ref-type="fig" rid="Ch1.F8"/>.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F7"><caption><p id="d1e2623"> Influence of the water-quality time step on estimated contaminant
concentrations at Node 200 in Network N3 following an injection at Node 100 at 00:00 LT.</p></caption>
          <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f07.pdf"/>

        </fig>

      <p id="d1e2632">The number (<inline-formula><mml:math id="M127" display="inline"><mml:mi>N</mml:mi></mml:math></inline-formula>) of hourly concentration values used to obtain the results
shown in the Table <xref ref-type="table" rid="Ch1.T3"/> corresponds approximately to the number
of hourly concentration values shown in the figures for the different
networks. For Network N1, <inline-formula><mml:math id="M128" display="inline"><mml:mi>N</mml:mi></mml:math></inline-formula> was 24, covering the entire length of the
simulation. For Network N2, it was 60, the length of the middle portion of
the plot in Fig. <xref ref-type="fig" rid="Ch1.F6"/>. For Network N3, <inline-formula><mml:math id="M129" display="inline"><mml:mi>N</mml:mi></mml:math></inline-formula> was 39, the length
of the period from hour 1 in the simulation to hour 40 (see Fig.  <xref ref-type="fig" rid="Ch1.F7"/>). For Network N4, results for the entire 168 <inline-formula><mml:math id="M130" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula>
simulation were used. The water-quality tolerance in the simulations used to
obtain the concentrations needed for the analysis presented in the table was
0.01, except for the event-driven simulations for Network N4, for which 0.1
was used.</p>
      <p id="d1e2670">If the concentrations obtained using the time-driven method with a 1 <inline-formula><mml:math id="M131" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>
water-quality time step are identical to those obtained for one of the other
cases, the slope of the least-squares line relating the concentrations will
be 1, the intercept will be 0, the adjusted <inline-formula><mml:math id="M132" display="inline"><mml:mrow><mml:msup><mml:mi>R</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> will be 1, and the
residuals for the fit will all be 0. From Table <xref ref-type="table" rid="Ch1.T3"/>, the
results for Networks N1, N2, and N3 show that of the three cases considered,
the concentrations for TD1 are closest to those for ED3600. Also, the
agreement improves going from TD300 to TD60 to ED3600. This improvement is
what would be expected if the<?pagebreak page34?> results for the time-driven approach are
converging to those for the event-driven approach as the water-quality time
step used for the time-driven approach decreases. For Network N4 there is a
high degree of correlation between the concentrations obtained using the
time-driven method with different time steps (cf. Fig. <xref ref-type="fig" rid="Ch1.F8"/>) and
the quality of the fit is similar for all three cases considered. However,
because the magnitude of the concentrations increases as the time step
decreases, the slope of the least-squares line increases going from TD300 to
TD60.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F8"><caption><p id="d1e2698"> Influence of the water-quality time step on estimated contaminant
concentrations at Node TANK-12525 in Network N4 following an injection at Node JUNCTION-2514
at 00:00 LT. Locations of the nodes are shown in Figs. <xref ref-type="fig" rid="App1.Ch1.F4"/> and <xref ref-type="fig" rid="App1.Ch1.F5"/>.</p></caption>
          <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f08.pdf"/>

        </fig>

      <?pagebreak page35?><p id="d1e2711">The results in Table <xref ref-type="table" rid="Ch1.T3"/> for Network N2 indicate a
less-than-perfect correlation between the concentrations obtained using the
time-driven algorithm used in EPANET and a water-quality time step of
1 <inline-formula><mml:math id="M133" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> and those obtained using the event-driven algorithm and a time step
of 3600 <inline-formula><mml:math id="M134" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. The concentrations obtained using the two approaches are
compared in Fig. <xref ref-type="fig" rid="Ch1.F9"/> (which uses an expanded vertical
scale compared to the one used in Fig. <xref ref-type="fig" rid="Ch1.F6"/>). The results
obtained for the two simulations are noticeably different. However, compared
to the differences between the results obtained using the time-driven approach
using a 1 <inline-formula><mml:math id="M135" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> time step and those obtained using longer time steps, the
differences are quite minor, as can be seen from a comparison of
Figs. <xref ref-type="fig" rid="Ch1.F6"/> and <xref ref-type="fig" rid="Ch1.F9"/>.</p>
      <p id="d1e2746">Overall, the results presented here demonstrate that substantial mass
imbalances can occur during EPANET water-quality simulations. Such mass
imbalances tend to disappear and significant changes in constituent
concentrations can occur as the water-quality time step becomes small. Also,
these constituent concentrations tend to converge toward those obtained using the
event-driven simulation method, which conserves constituent mass.</p>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T4"><caption><p id="d1e2752"> Comparison of execution times for the time-driven and event-driven algorithms.</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="4">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="left"/>
     <oasis:colspec colnum="3" colname="col3" align="right"/>
     <oasis:colspec colnum="4" colname="col4" align="right"/>
     <oasis:thead>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2"/>
         <oasis:entry rowsep="1" namest="col3" nameend="col4" align="center">Execution time (<inline-formula><mml:math id="M145" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>) </oasis:entry>
       </oasis:row>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">Network</oasis:entry>
         <oasis:entry colname="col2">Injection location</oasis:entry>
         <oasis:entry colname="col3">TD<inline-formula><mml:math id="M146" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">a</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4">ED<inline-formula><mml:math id="M147" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">b</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">N1</oasis:entry>
         <oasis:entry colname="col2">All 97 nodes</oasis:entry>
         <oasis:entry colname="col3">259</oasis:entry>
         <oasis:entry colname="col4">24</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N2</oasis:entry>
         <oasis:entry colname="col2">Node IN1029</oasis:entry>
         <oasis:entry colname="col3">970</oasis:entry>
         <oasis:entry colname="col4">294</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">Node VN1263<inline-formula><mml:math id="M148" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">c</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3">326</oasis:entry>
         <oasis:entry colname="col4">670</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N3</oasis:entry>
         <oasis:entry colname="col2">Node 100</oasis:entry>
         <oasis:entry colname="col3">2990</oasis:entry>
         <oasis:entry colname="col4">220</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">Node 300</oasis:entry>
         <oasis:entry colname="col3">1440</oasis:entry>
         <oasis:entry colname="col4">17</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">N4</oasis:entry>
         <oasis:entry colname="col2">Node JUNCTION-2514</oasis:entry>
         <oasis:entry colname="col3">1780</oasis:entry>
         <oasis:entry colname="col4">15</oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry colname="col2">Node JUNCTION-3064</oasis:entry>
         <oasis:entry colname="col3">1760</oasis:entry>
         <oasis:entry colname="col4">17</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table><table-wrap-foot><p id="d1e2755">Note that all simulations were done using a 2.8 <inline-formula><mml:math id="M136" display="inline"><mml:mi mathvariant="normal">GHz</mml:mi></mml:math></inline-formula> processor. The simulation durations were 168 <inline-formula><mml:math id="M137" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula>,
except for Network N1, for which they were 24 <inline-formula><mml:math id="M138" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula>. All times are rounded to three significant figures or to the nearest whole second.
TD: time-driven; ED: event-driven. <inline-formula><mml:math id="M139" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">a</mml:mi></mml:msup></mml:math></inline-formula> Water-quality time step is 1 <inline-formula><mml:math id="M140" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>. <inline-formula><mml:math id="M141" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">b</mml:mi></mml:msup></mml:math></inline-formula> Water-quality time step is 3600 <inline-formula><mml:math id="M142" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>.
<inline-formula><mml:math id="M143" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">c</mml:mi></mml:msup></mml:math></inline-formula> Quality tolerance is 1.0 mg L<inline-formula><mml:math id="M144" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>.</p></table-wrap-foot></table-wrap>

      <?xmltex \floatpos{t}?><fig id="Ch1.F9"><caption><p id="d1e3014"> Estimated contaminant concentrations at Node TN1810 in
Network N2  following an injection at Node IN1029 obtained using the time-driven (TD) and
event-driven (ED) water-quality algorithms. Locations of the nodes are shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F3"/>.</p></caption>
          <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f09.pdf"/>

        </fig>

      <p id="d1e3026">The preliminary event-driven algorithm discussed here currently addresses
only those constituents that behave as tracers. The algorithm needs to be
expanded to consider constituent decay. The algorithm also needs to be
evaluated using a wider range of networks and cases. The accuracy, storage
requirements, and computation time for other types of water-quality modeling
problems, such as source tracing, water age, and chlorine decay need to be
examined. Preliminary results are presented here to help motivate additional
efforts to improve water-quality simulations in EPANET.</p>
      <p id="d1e3029">The results presented here indicate that, in general, a water-quality time
step of 1 <inline-formula><mml:math id="M149" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> may be necessary to obtain acceptable mass-balance results
when using the time-driven approach in EPANET. For large networks, such a
time step can require considerable computational effort. Statistics for
execution times for TEVA-SPOT, using EPANET and the time-driven algorithm,
are provided in <xref ref-type="bibr" rid="bib1.bibx6" id="normal.25"/> for several network models, including Network N4
(BWSN, called Network E3 in the reference) for a 1 <inline-formula><mml:math id="M150" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> water-quality
time step. Results in the reference are for a subset of the nodes considered
here, only those with a nonzero demand, and include some additional
computations beyond those used for this paper but demonstrate substantial
execution times. For a single injection, execution times were about
70 <inline-formula><mml:math id="M151" display="inline"><mml:mi mathvariant="normal">min</mml:mi></mml:math></inline-formula> using a 2.3 <inline-formula><mml:math id="M152" display="inline"><mml:mi mathvariant="normal">GHz</mml:mi></mml:math></inline-formula> processor. For injections at all
nonzero demand nodes for the network, the execution time was about 16 days
for a server with four such processors using 32 cores, with 32 simultaneous
simulations being performed. The event-driven algorithm is not fully
developed; however, because a water-quality time step as long as the
hydraulic time step can be used, it is expected to generally require less
computational effort than the time-driven algorithm if conservation of mass
is required. Table <xref ref-type="table" rid="Ch1.T4"/> compares execution times for the
time-driven and event-driven algorithms for examples used in this paper. As
noted above, these examples were selected to demonstrate mass imbalances. A
time step of 1 <inline-formula><mml:math id="M153" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> was used for the time-driven algorithm and
3600 <inline-formula><mml:math id="M154" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> was used for the event-driven one. To provide a second
injection location for Network N3, Node 300 is included, although no example
is presented using this node. The execution times were obtained using a
single 2.8 <inline-formula><mml:math id="M155" display="inline"><mml:mi mathvariant="normal">GHz</mml:mi></mml:math></inline-formula> processor. In general, for the cases considered here,
the event-driven approach requires substantially shorter execution times than
the time-driven approach in EPANET when a 1 <inline-formula><mml:math id="M156" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> water-quality time step
is used.</p>
</sec>
</sec>
<sec id="Ch1.S5" sec-type="conclusions">
  <title>Conclusions</title>
      <p id="d1e3101">As the examples presented here illustrate, the current version of EPANET can
produce results for which the mass of a water-quality constituent is not
conserved. Significant mass<?pagebreak page36?> imbalances can occur when modeling water quality,
even for water-quality time steps considerably shorter than those commonly
used with EPANET and that are consistent with good modeling practices. These
mass balances are associated with inaccurate estimated constituent
concentrations.</p>
      <p id="d1e3104">Substantial mass imbalances can occur at the beginning of a simulation, but
be reduced or eliminated as the simulation proceeds. Therefore, if
unacceptable mass imbalances occur for a short simulation, a longer
simulation time may be needed.</p>
      <p id="d1e3107">Although mass imbalances can be reduced or eliminated by decreasing the size
of the water-quality time step, sufficient reductions may not be practical.
As noted above, the default water-quality time step in EPANET is 300 <inline-formula><mml:math id="M157" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>
and longer time steps are used in some applications. However, in some cases,
as shown here, use of a time step as short as 60 <inline-formula><mml:math id="M158" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> can result in
significant errors; a time step less than 60 <inline-formula><mml:math id="M159" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> may be necessary to
obtain acceptable results and in some cases a time step of 1 <inline-formula><mml:math id="M160" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> does
not eliminate mass imbalances.</p>
      <p id="d1e3138">Failure to conserve constituent mass is the result of fundamental limitations
in the water-quality routing algorithm used in EPANET. The algorithm does not
ensure mass conservation.</p>
      <p id="d1e3142">Results from the current version of EPANET tend to converge toward those obtained
using our preliminary event-driven water-quality algorithm as the
water-quality time step used with the current version of EPANET is reduced.
The event-based algorithm for water-quality routing provides results that
conserve constituent mass and that are independent of the water-quality time
step if it is less than or equal to the hydraulic time step. Given this
independence of the size of the water-quality time step, the new algorithm
may not only be more accurate, but also more economical to use than the one
currently included in EPANET if mass conservation is required.</p>
      <p id="d1e3145">The event-driven algorithm used here is under development. It is available as
an option for water-quality modeling in TEVA-SPOT. Additional refinement of
the approach is needed; in particular, it needs to be modified to consider
non-conservative constituent behavior.</p>
      <p id="d1e3148">EPANET water-quality simulations are widely used by water utilities. The
results presented here should be of value to utility managers and engineers;
they allow users of such simulations to better understand an important
potential limitation of these simulations. The results also allow them to
understand how these simulations can be improved.</p><?xmltex \hack{\newpage}?>
</sec>
<sec id="Ch1.S6">
  <title>Recommendations</title>
      <p id="d1e3158">On the basis of the results presented here, we recommend that the
water-quality algorithm used in EPANET be replaced with one that conserves
mass and provides accurate concentration estimates. Until such a change can
be accomplished, we recommend the following.</p>
      <p id="d1e3161"><list list-type="order">
          <list-item>

      <p id="d1e3166">Capabilities should be added to EPANET to produce reports on the mass balance of water-quality constituents and to
provide warning or error statements when conditions are present that could result in a failure to conserve constituent
mass or when such a failure actually occurs.</p>
          </list-item>
          <list-item>

      <p id="d1e3172">When a capability to obtain an evaluation of mass balance is available, the water-quality time step should be
selected so that acceptable mass balances are obtained.</p>
          </list-item>
          <list-item>

      <p id="d1e3178">As long as a time-driven algorithm is used, some value for a default water-quality time step is needed. To
reduce opportunities for mass imbalances to occur, the current default value of 300 <inline-formula><mml:math id="M161" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> should be reduced.</p>
          </list-item>
        </list></p>
</sec>

      
      </body>
    <back><notes notes-type="codedataavailability">

      <p id="d1e3194">Models for Networks N1, N2, and N4 are available at <ext-link xlink:href="https://doi.org/10.23719/1375314" ext-link-type="DOI">10.23719/1375314</ext-link> (US EPA, 2018a). The model for Network N3
is proprietary and cannot be shared. The preliminary, Lagrangian event-driven algorithm discussed
in the paper is available for inspection and (hopefully) collaboration  at <uri>https://github.com/ttaxon/EPANET/tree/flow-transport-model</uri> (Taxon, 2018).
The algorithm
has been incorporated into TEVA-SPOT and an executable version is available at <ext-link xlink:href="https://doi.org/10.23719/1375315" ext-link-type="DOI">10.23719/1375315</ext-link> (US EPA, 2018b).</p>
  </notes><?xmltex \hack{\clearpage}?><app-group>

<?pagebreak page37?><app id="App1.Ch1.S1">
  <title>Network maps</title>
      <p id="d1e3215">Schematics of Networks N1, N2, and N4 are shown in Figs. <xref ref-type="fig" rid="App1.Ch1.F1"/>,
<xref ref-type="fig" rid="App1.Ch1.F3"/>, and <xref ref-type="fig" rid="App1.Ch1.F4"/>, respectively. Additional detail for Network
N1 is shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F2"/> and for Network N4 in Fig. <xref ref-type="fig" rid="App1.Ch1.F5"/>. Because it contains confidential information, the
schematic for Network N3 cannot be provided. The nodes identified in the
figures are used in examples discussed in this paper.</p>

      <?xmltex \floatpos{h!}?><fig id="App1.Ch1.F1"><caption><p id="d1e3230"> Network N1.</p></caption>
        <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f10.pdf"/>

      </fig>

      <?xmltex \floatpos{h!}?><fig id="App1.Ch1.F2"><caption><p id="d1e3241"> Detail in Network N1.</p></caption>
        <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f11.pdf"/>

      </fig>

      <?xmltex \floatpos{h!}?><fig id="App1.Ch1.F3"><caption><p id="d1e3253"> Network N2.</p></caption>
        <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f12.pdf"/>

      </fig>

      <?xmltex \floatpos{h!}?><fig id="App1.Ch1.F4"><caption><p id="d1e3264"> Network N4.  See Fig. <xref ref-type="fig" rid="App1.Ch1.F5"/> for an enlargement showing detail in the highlighted area.</p></caption>
        <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f13.pdf"/>

      </fig>

      <?xmltex \floatpos{h!}?><fig id="App1.Ch1.F5"><caption><p id="d1e3277"> Detail in Network N4.</p></caption>
        <?xmltex \igopts{width=199.169291pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f14.pdf"/>

      </fig>

</app>

<app id="App1.Ch1.S2">
  <title>Example using the time-driven approach</title>
      <p id="d1e3292">This appendix presents an example illustrating the operation of the
time-driven algorithm used in EPANET and, in particular, shows how the
algorithm can fail to conserve constituent mass. The example uses the portion
of Network N1 shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F2"/>. The example presented here is
designed to demonstrate how mass imbalance can occur and is not a suggestion
that the parameters used in the example would actually be used.</p>
<sec id="App1.Ch1.S2.SS1">
  <title>Water-quality routing with the time-driven approach</title>
      <p id="d1e3302">Water-quality routing in EPANET uses the function transport(), which in turn
uses several other functions to accumulate constituent mass and water volume
at nodes and to create new water parcels in outflow links. Accumulating,
releasing, and updating are each done at the same time at all nodes in a
network (a time-driven approach). The functions listed below are used in the
order shown:</p>
      <p id="d1e3305"><list list-type="bullet">
            <list-item>

      <p id="d1e3310"><bold>accumulate()</bold>.  This function accumulates constituent mass (MassIn) and inflow volume (VolIn) at nodes and computes nodal
constituent concentrations, which are stored for later use.</p>
            </list-item>
            <list-item>

      <?pagebreak page38?><p id="d1e3318"><bold>updatenodes()</bold>. This function updates concentrations at all nodes. It does not consider additions from any sources of
water-quality constituents at nodes.</p>
            </list-item>
            <list-item>

      <p id="d1e3326"><bold>sourceinput()</bold>. If appropriate, this function accounts for any contributions of constituent mass from sources.
(No sources are used in the example presented here.)</p>
            </list-item>
            <list-item>

      <p id="d1e3334"><bold>release()</bold>. This function creates new parcels in outflow links for all
nodes.</p>
            </list-item>
            <list-item>

      <p id="d1e3342"><bold>updatesourcenodes()</bold>.  This function updates water quality at source nodes using results from sourceinput()
(not relevant for this example).</p>
            </list-item>
          </list></p>
      <p id="d1e3349">The next section illustrates the application of the relevant functions using
an example based on Network N1.</p>
</sec>
<sec id="App1.Ch1.S2.SS2">
  <title>Example</title>
      <p id="d1e3358">For the example presented in this appendix a total of 0.5 <inline-formula><mml:math id="M162" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula> of a
water-quality constituent was added at a constant rate at Node 249 of Network
N1 during the first hour of a 24 <inline-formula><mml:math id="M163" display="inline"><mml:mi mathvariant="normal">h</mml:mi></mml:math></inline-formula> simulation. Water-quality and
hydraulic time steps of 3600 <inline-formula><mml:math id="M164" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula> were used along with constant nodal
demands. The quality tolerance was 0.01 mg L<inline-formula><mml:math id="M165" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>.</p>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.F6" specific-use="star"><caption><p id="d1e3396"> Example: initial conditions.</p></caption>
          <?xmltex \igopts{width=312.980315pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f15.pdf"/>

        </fig>

      <p id="d1e3405">The initial conditions in the portion of Network N1 (Fig. <xref ref-type="fig" rid="App1.Ch1.F2"/>)
used in this example are shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F6"/>. They correspond to
those at hour two in the simulation. The example uses seven nodes (237, 239,
241, and so on). The italicized numbers below or to the right of the links
connecting nodes are the link numbers (273, 275, etc.). There are demands at
Nodes 239 and 247. The volumes of water moved during a water-quality time
step are shown above or to the left of the links; the arrows indicate the
direction of flow for the time step shown. For example, 5.941 m<inline-formula><mml:math id="M166" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>
of water are moved from Link 281 to Node 247 during the time step and
15.985 m<inline-formula><mml:math id="M167" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water are removed by demands at Node 247 during the
time step. The volumes of water parcels and the concentrations of a
water-quality constituent present in parcels are shown. For example, Link 281
has one water parcel with a volume of 6.873 m<inline-formula><mml:math id="M168" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and a
concentration of zero (shown as <inline-formula><mml:math id="M169" display="inline"><mml:mrow><mml:mn mathvariant="normal">6.873</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>). Link 283 has two parcels; the
leading parcel has a volume of 6.146 m<inline-formula><mml:math id="M170" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and a concentration of
78.084 mg L<inline-formula><mml:math id="M171" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> (<inline-formula><mml:math id="M172" display="inline"><mml:mrow><mml:mn mathvariant="normal">6.146</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">78.084</mml:mn></mml:mrow></mml:math></inline-formula>) and the trailing parcel has a
volume of 3.417 m<inline-formula><mml:math id="M173" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and a concentration of zero (<inline-formula><mml:math id="M174" display="inline"><mml:mrow><mml:mn mathvariant="normal">3.417</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>). The
link volume is equal to the sum of volumes of the water parcels in the link;
Link 283 has a volume of <inline-formula><mml:math id="M175" display="inline"><mml:mrow><mml:mn mathvariant="normal">6.146</mml:mn><mml:mo>+</mml:mo><mml:mn mathvariant="normal">3.417</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M176" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 9.563 m<inline-formula><mml:math id="M177" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>. The small
tables in the figure provide initial values of MassIn, VolIn, and constituent
concentrations for Nodes 239, 247, and 249. In these tables the units for
MassIn, VolIn, and concentration are <inline-formula><mml:math id="M178" display="inline"><mml:mi mathvariant="normal">mg</mml:mi></mml:math></inline-formula>, m<inline-formula><mml:math id="M179" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>, and
mg L<inline-formula><mml:math id="M180" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>, respectively.</p>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.F7" specific-use="star"><caption><p id="d1e3566"> Example: conditions after accumulate().</p></caption>
          <?xmltex \igopts{width=312.980315pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f16.pdf"/>

        </fig>

      <p id="d1e3575">Conditions after <bold>accumulate()</bold> has been called are shown in
Fig. <xref ref-type="fig" rid="App1.Ch1.F7"/>. The volumes and concentrations of parcels remaining
after nodal inflows have been removed from links are shown. For some links
the volume removed exceeds the volume of the link and no parcels remain in
the links. These links are shaded in the figure. When the volume being moved
exceeds the volume of a link, the contribution from the link to VolIn for the
downstream node is determined using the volume moved. For example, VolIn for
Node 239 is 26.998 m<inline-formula><mml:math id="M181" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>, the volume being moved on Link 273, not
the volume of the link, which is 11.343 m<inline-formula><mml:math id="M182" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>. Values of MassIn for
downstream nodes are determined by the volume moved in a time step, not the
volume of the water parcels in the links providing inflows. When the volume
moved is greater than the link volume, the extra volume that is moved to the
downstream node has the same concentration as the trailing water parcel in
the link. For example, for Node 247 the constituent mass coming from Link 285
is determined using the volume moved (6.854 m<inline-formula><mml:math id="M183" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>) and the
concentration (78.084 mg L<inline-formula><mml:math id="M184" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>) of the water parcel in the link
(the only parcel in the link and, therefore, also the trailing parcel), which
gives a contribution to MassIn for the node of about 0.535 <inline-formula><mml:math id="M185" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>. The
concentrations of the water parcels in Links 281 and 287 are zero and the
links do not contribute any mass to MassIn for Node 247. The value of MassIn
in the table for Node 247 (535 159 <inline-formula><mml:math id="M186" display="inline"><mml:mi mathvariant="normal">mg</mml:mi></mml:math></inline-formula>) is slightly different from the
product of VolIn and the concentration due to rounding. Note that the value
for MassIn for Node 247 (0.535 <inline-formula><mml:math id="M187" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>) is larger than the constituent mass
added to the network (0.5 <inline-formula><mml:math id="M188" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>). Excess mass has been generated at the
node; a mass gain of about 0.518 <inline-formula><mml:math id="M189" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula> has occurred, given that about
0.535 <inline-formula><mml:math id="M190" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula> has been added to MassIn for Node 247 and not
0.017 <inline-formula><mml:math id="M191" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>, the mass of constituent in the parcel in Link 285, which has
a volume of 0.222 m<inline-formula><mml:math id="M192" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and a concentration of
78.084 mg L<inline-formula><mml:math id="M193" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>. Note that the value of VolIn for Node 247 is the
sum of the water volumes moved from the three inflow links (281, 285, and
287).</p>
      <?pagebreak page39?><p id="d1e3694">For Link 283 the link volume is also less than the volume of water being
moved in the time step (9.563 vs. 9.939 m<inline-formula><mml:math id="M194" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>). The leading water
parcel flows into Node 249, contributing a constituent mass of about
0.480 <inline-formula><mml:math id="M195" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula> (6.146 m<inline-formula><mml:math id="M196" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> multiplied by
78.084 mg L<inline-formula><mml:math id="M197" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>). To provide the necessary volume being moved to
the node, an extra 0.376 m<inline-formula><mml:math id="M198" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> is added to the trailing parcel and
given a concentration of zero, the same as concentration of the trailing
parcel. The second parcel adds no constituent mass to Node 249; the value for
MassIn for the node is about 0.480 <inline-formula><mml:math id="M199" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>, coming entirely from the
leading water parcel on the link.</p>
      <p id="d1e3751">No constituent mass is accumulated at Node 239. Although the volume of water
being moved in Link 273 is larger than the volume of the link, the
concentration of the added volume is zero.</p>
      <p id="d1e3754">When the accumulate step is completed, values for MassIn and VolIn are
computed for all nodes in the network. Values for these quantities are shown
in Fig. <xref ref-type="fig" rid="App1.Ch1.F7"/> for Nodes 239, 247, and 249. MassIn is zero for all
other nodes. The initial conditions show that the water-quality constituent
was present only in Links 283 and 285.</p>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.F8" specific-use="star"><caption><p id="d1e3762"> Example: conditions after updatenodes().</p></caption>
          <?xmltex \igopts{width=312.980315pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f17.pdf"/>

        </fig>

      <p id="d1e3771">In the next step in the water-quality routing process, <bold>updatenodes()</bold> is called to update nodal concentrations. The updated
concentrations for Nodes 239, 247, and 249 are shown in the tables in
Fig. <xref ref-type="fig" rid="App1.Ch1.F8"/>. The concentrations are determined using MassIn and
VolIn for each node. For example, the concentration for Node 249 is
48.289 mg L<inline-formula><mml:math id="M200" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>, obtained by dividing 479 925 <inline-formula><mml:math id="M201" display="inline"><mml:mi mathvariant="normal">mg</mml:mi></mml:math></inline-formula> by 1000 <inline-formula><mml:math id="M202" display="inline"><mml:mo>×</mml:mo></mml:math></inline-formula> 9.939 m<inline-formula><mml:math id="M203" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>.</p>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.F9" specific-use="star"><caption><p id="d1e3817"> Example: conditions after release().</p></caption>
          <?xmltex \igopts{width=312.980315pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f18.pdf"/>

        </fig>

      <?pagebreak page40?><p id="d1e3826">In the final step in this example, a call to <bold>release()</bold> creates
new water parcels on the outflow links for all nodes. Conditions after these
parcels are created are shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F9"/>. New parcels are
combined with parcels already present if the difference between their
concentrations is less than the quality tolerance (0.01 mg L<inline-formula><mml:math id="M204" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>).
For example, a new parcel with a volume of 5.941 m<inline-formula><mml:math id="M205" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> was added to
Link 281 and combined with the 0.931 m<inline-formula><mml:math id="M206" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> parcel already on the
link because both parcels have a concentration of zero. New parcels with
concentrations of 48.289 mg L<inline-formula><mml:math id="M207" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> are added to Links 285 and 295,
using the concentration for Node 249. The volume of the parcel for Link 285
is 0.222 m<inline-formula><mml:math id="M208" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>, the volume of the link. However, the volume released
to the link is 6.854 m<inline-formula><mml:math id="M209" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>; the difference between this volume and
the volume of the link (<inline-formula><mml:math id="M210" display="inline"><mml:mrow><mml:mn mathvariant="normal">6.854</mml:mn><mml:mo>-</mml:mo><mml:mn mathvariant="normal">0.222</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M211" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 6.632 m<inline-formula><mml:math id="M212" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>) is effectively
lost. Because the concentration associated with this volume is
48.289 mg L<inline-formula><mml:math id="M213" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>, a mass loss of about 0.320 <inline-formula><mml:math id="M214" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>
(48.289 <inline-formula><mml:math id="M215" display="inline"><mml:mo>×</mml:mo></mml:math></inline-formula> 6.632 divided by 1000) occurs. Adding the mass gain of 0.518 <inline-formula><mml:math id="M216" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula> in the
accumulate step, there is a net mass gain at this point in the simulation
equal to about 0.2 <inline-formula><mml:math id="M217" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>. Given the constituent mass removed by demands
from Node 247 (about 0.54 <inline-formula><mml:math id="M218" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>, 15.985 m<inline-formula><mml:math id="M219" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water with a
constituent concentration of 33.479 mg L<inline-formula><mml:math id="M220" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>) and the mass in Links
285 and 295 (about 0.16 <inline-formula><mml:math id="M221" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>), the MBR for the network at this point is
about 1.4 (0.54 plus 0.16 divided by 0.5). The values for MassIn and VolIn
shown in the tables in Fig. <xref ref-type="fig" rid="App1.Ch1.F9"/> are retained from the updatenodes
step; they have no meaning at this point and are reset to zero at the
beginning of the next time step.</p>
</sec>
<sec id="App1.Ch1.S2.SS3">
  <title>Discussion</title>
      <p id="d1e4008">As the example presented here illustrates, the accumulate step can result in
the generation of constituent mass and the release step can result in the
loss of mass. The condition necessary (but not sufficient) for generating or
losing mass is a link with a volume less than the volume of water being moved
in a water-quality time step. If the concentration of a water-quality
constituent present in the network does not vary spatially, the mass
generated in the accumulate step will equal the mass lost in the release step
and there will be no net change in mass. However, if there is a spatial
gradient in concentration so that the concentration of the excess volume
generated during the accumulate step is different from the concentration
associated with the volume of water lost in the release step, a net change in
mass can occur. The net change can be either positive or negative: net mass
can be generated or lost.</p>
      <p id="d1e4011">Let <inline-formula><mml:math id="M222" display="inline"><mml:mrow><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">L</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> be the volume of a link, <inline-formula><mml:math id="M223" display="inline"><mml:mrow><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">M</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> be the volume of water moved in the
link during a water-quality time step, and <inline-formula><mml:math id="M224" display="inline"><mml:mrow><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">M</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> be greater than <inline-formula><mml:math id="M225" display="inline"><mml:mrow><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">L</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>. Let
<inline-formula><mml:math id="M226" display="inline"><mml:mrow><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> be the concentration of a constituent used for the extra volume for
this link added in the accumulate step and <inline-formula><mml:math id="M227" display="inline"><mml:mrow><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> be the concentration of the
constituent used for the lost volume for this link in the release step. Then
the net change in constituent mass (<inline-formula><mml:math id="M228" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>M</mml:mi></mml:mrow></mml:math></inline-formula>) for the link for the time
step is given by</p>
      <p id="d1e4091"><disp-formula specific-use="align" content-type="numbered"><mml:math id="M229" display="block"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>M</mml:mi></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>=</mml:mo><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">M</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">L</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">M</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">L</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mlabeledtr id="App1.Ch1.E1"><mml:mtd/><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">M</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">L</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            Note that this relationship applies only when <inline-formula><mml:math id="M230" display="inline"><mml:mrow><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">M</mml:mi></mml:msub><mml:mo>&gt;</mml:mo><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">L</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>.  The volume of water being moved in a time step is <inline-formula><mml:math id="M231" display="inline"><mml:mrow><mml:mi>Q</mml:mi><mml:mi>T</mml:mi></mml:mrow></mml:math></inline-formula>, where <inline-formula><mml:math id="M232" display="inline"><mml:mi>Q</mml:mi></mml:math></inline-formula> is
the flow rate on the link for the time step and <inline-formula><mml:math id="M233" display="inline"><mml:mi>T</mml:mi></mml:math></inline-formula> is the length of the water-quality time step. Then,</p>
      <?pagebreak page41?><p id="d1e4243"><disp-formula id="App1.Ch1.E2" content-type="numbered"><mml:math id="M234" display="block"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>M</mml:mi><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>(</mml:mo><mml:mi>Q</mml:mi><mml:mi>T</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">L</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula></p>
      <p id="d1e4291">The volume of a link can be small; for a valve or pump it is zero. When the
link volume is very small relative to <inline-formula><mml:math id="M235" display="inline"><mml:mrow><mml:msub><mml:mi>V</mml:mi><mml:mi mathvariant="normal">M</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> the mass change for the link for
the time step is proportional to the difference between the concentrations
for the accumulate and release steps, the flow rate, and the water-quality
time step. As the water-quality time step becomes small, the net mass change
also become small.</p>
      <p id="d1e4305">For the example presented in this appendix, <inline-formula><mml:math id="M236" display="inline"><mml:mrow><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">78.084</mml:mn></mml:mrow></mml:math></inline-formula> mg L<inline-formula><mml:math id="M237" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>
and <inline-formula><mml:math id="M238" display="inline"><mml:mrow><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M239" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 48.289 mg L<inline-formula><mml:math id="M240" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>. The difference between the volume
moved in Link 285 and the link volume is 6.854 m<inline-formula><mml:math id="M241" display="inline"><mml:mrow><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup><mml:mo>-</mml:mo><mml:mn mathvariant="normal">0.222</mml:mn></mml:mrow></mml:math></inline-formula> m<inline-formula><mml:math id="M242" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> <inline-formula><mml:math id="M243" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 6.632 m<inline-formula><mml:math id="M244" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>. Therefore, using Eq. (B1), the
value for <inline-formula><mml:math id="M245" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>M</mml:mi></mml:mrow></mml:math></inline-formula> is <inline-formula><mml:math id="M246" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mn mathvariant="normal">78.084</mml:mn><mml:mo>-</mml:mo><mml:mn mathvariant="normal">48.289</mml:mn><mml:mo>)</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">6.632</mml:mn><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:mn mathvariant="normal">1000</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M247" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 0.198 <inline-formula><mml:math id="M248" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula>. For
a net mass gain of this amount the MBR is about 1.4, as noted above. The flow
rate on Link 285 is small, 6.685 m<inline-formula><mml:math id="M249" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> per hour or about
0.002 m<inline-formula><mml:math id="M250" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> s<inline-formula><mml:math id="M251" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>. If the flow rate were an order of magnitude
larger, the net mass gain would about 2 <inline-formula><mml:math id="M252" display="inline"><mml:mi mathvariant="normal">kg</mml:mi></mml:math></inline-formula> and the MBR would be about
5. Substantial net mass changes are possible for a single link for a single
water-quality time step. Note that when <inline-formula><mml:math id="M253" display="inline"><mml:mrow><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">R</mml:mi></mml:msub><mml:mo>&gt;</mml:mo><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, net mass losses will
occur and the MBR will be less than 1.</p>
</sec>
</app>

<app id="App1.Ch1.S3">
  <title>Example using the event-driven approach</title>
      <?pagebreak page42?><p id="d1e4519">This appendix presents a simple example to illustrate the application of the
event-driven algorithm. The example also illustrates how the algorithm
addresses cases with recirculating flows. The network used in the example is
shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F10"/>. It has five nodes (A to E) with connecting links
(labeled A–B, for example); Link D–E is a pump. Details of the network
downstream (to the right) of Node D are not shown in the figure. There are
demands at Nodes B, C, and E. The volumes shown above the links are the
volumes of water moved during a water-quality time step; the arrows show the
direction of flow. For example, 76 m<inline-formula><mml:math id="M254" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water are moved from
Link A–B to Node B and 20 m<inline-formula><mml:math id="M255" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water are removed by demands at
Node B during the time step. Each link can have one or more water parcels,
which are volumes of water with uniform concentrations. The volumes of the
parcels and the concentrations of a water-quality constituent present in the
parcels are shown; for example, in Link E–B there are two parcels, one has a
volume of 1700 m<inline-formula><mml:math id="M256" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and a concentration of zero (labeled as <inline-formula><mml:math id="M257" display="inline"><mml:mrow><mml:mn mathvariant="normal">1700</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>)
and the second has a volume of 100 m<inline-formula><mml:math id="M258" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and a concentration of
10 mg L<inline-formula><mml:math id="M259" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> (labeled as <inline-formula><mml:math id="M260" display="inline"><mml:mrow><mml:mn mathvariant="normal">100</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula>). The volume of a link equals the
sum of the volumes of water parcels in the link. For example, Link E–B has a
volume of 1800 m<inline-formula><mml:math id="M261" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>, equal to the sum of 100 m<inline-formula><mml:math id="M262" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> plus
1700 m<inline-formula><mml:math id="M263" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>. Note that the volume of Link D–E, a pump, is zero. The
quality tolerance is 0.01 mg L<inline-formula><mml:math id="M264" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>; adjacent water parcels whose
concentrations differ by less than this amount are combined.</p>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.F10" specific-use="star"><caption><p id="d1e4639"> Example: network at the beginning of the time step.
(The 36 m<inline-formula><mml:math id="M265" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water leaving Node D goes to a downstream portion
of the network not shown in the figure.)</p></caption>
        <?xmltex \igopts{width=341.433071pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f19.pdf"/>

      </fig>

      <?xmltex \floatpos{t}?><fig id="App1.Ch1.F11" specific-use="star"><caption><p id="d1e4659"> Example: creation of incomplete water parcels.</p></caption>
        <?xmltex \igopts{width=341.433071pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f20.pdf"/>

      </fig>

      <p id="d1e4669">As shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F10"/>, there is an inflow to Node B from Link A–B
with a concentration of zero. There is also an inflow from Link E–B; however,
the concentration for that inflow has not yet been determined and the inflow
cannot be processed. Consequently, the state of the inflow from Link E–B is
labeled as 4/? in the small table in the figure, indicating that the
concentration has not yet been determined. It may seem obvious that the
concentration of the inflow from Link E–B should be 10 mg L<inline-formula><mml:math id="M266" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>,
given that this is the concentration of the leading parcel in the link.
However, in general, the concentration of the inflow from Link E–B will be
affected by the volume of the inflow. More than one water parcel might need
to be combined to provide the needed inflow volume, and the operations
required to determine if any combining of parcels is necessary and to
determine the resulting concentration have not yet been carried out.
Therefore, to accommodate this situation, an incomplete parcel representing
the merging of inflows from Links A–B and E–B is created that has an
unspecified concentration but a known volume. This incomplete parcel
maintains references to the parcels that merged to form it. The parcel
(called Seg1) is then moved through Node B with the result shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F11"/>, which illustrates how water parcels from Links A–B and E–B are
combined at Node B to form Parcel Seg1, which is then split into Parcels Seg2
and Seg3 to satisfy the nodal demand and the outflow from the node. Node
B's demand list has a reference to Parcel Seg2, which shows that of the
parcel's total volume of 20 m<inline-formula><mml:math id="M267" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>, the parcel from Link A–B
contributed 19 m<inline-formula><mml:math id="M268" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and the parcel from Link E–B contributed
1 m<inline-formula><mml:math id="M269" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>; the ratio of the contributions to Parcel Seg2 (and Seg3) is
<inline-formula><mml:math id="M270" display="inline"><mml:mrow><mml:mn mathvariant="normal">19</mml:mn><mml:mo>:</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>, the same as the ratio of inflows from Links A–B and E–B. Parcel Seg4 is
created and added as the trailing segment in Link B–C. After Parcel Seg4 is
added to Link B–C, 60 m<inline-formula><mml:math id="M271" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water are removed from the leading
water parcel in the link; the leading parcel in the link then has a volume of
740 m<inline-formula><mml:math id="M272" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> (and a concentration of zero, shown as <inline-formula><mml:math id="M273" display="inline"><mml:mrow><mml:mn mathvariant="normal">740</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> in Fig. <xref ref-type="fig" rid="App1.Ch1.F11"/>), maintaining the total volume of the parcels in the link equal
to the link's volume, namely 800 m<inline-formula><mml:math id="M274" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>.</p>

      <?xmltex \floatpos{p}?><fig id="App1.Ch1.F12" specific-use="star"><caption><p id="d1e4772"> Example: interim status of the network.</p></caption>
        <?xmltex \igopts{width=312.980315pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f21.pdf"/>

      </fig>

      <?xmltex \floatpos{p}?><fig id="App1.Ch1.F13" specific-use="star"><caption><p id="d1e4783"> Example: completion of incomplete water parcels.</p></caption>
        <?xmltex \igopts{width=312.980315pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f22.pdf"/>

      </fig>

      <?xmltex \floatpos{p}?><fig id="App1.Ch1.F14" specific-use="star"><caption><p id="d1e4794"> Example: network at the end of the time step.</p></caption>
        <?xmltex \igopts{width=312.980315pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/11/25/2018/dwes-11-25-2018-f23.pdf"/>

      </fig>

      <?pagebreak page43?><p id="d1e4804">At this point Parcel Seg1 is no longer referenced directly by any link or
node. However, it has internal references so that when the concentration of
the water parcel arriving at Node B from Link E–B has been determined, the
parcel can be completed. When the parcel is completed, the result will
cascade to its children, namely Seg2 and Seg3.</p>
      <p id="d1e4807">Adding Parcel Seg4 with a volume of 60 m<inline-formula><mml:math id="M275" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> to Link B–C results in
the same volume of water being moved to Node C from the leading parcel on
Link B–C. An amount of 12 m<inline-formula><mml:math id="M276" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water are removed from that parcel and
placed on Node C's demand list; the remaining 48 m<inline-formula><mml:math id="M277" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water
from the parcel are added to Link C–D. At Node D, 48 m<inline-formula><mml:math id="M278" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water
are removed from the link, with the parcel that is removed being split:
36 m<inline-formula><mml:math id="M279" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> leave Node D to be moved through the rest of the network
(not shown) and 12 m<inline-formula><mml:math id="M280" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> are placed on the trailing end of Link D–E.
At Node E, 8 m<inline-formula><mml:math id="M281" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water are removed and placed on Node E's
demand list. A parcel with a volume of 4 m<inline-formula><mml:math id="M282" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> is added at the
trailing end of Link E–B, which causes 4 m<inline-formula><mml:math id="M283" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of the leading parcel
in Link E–B (with a concentration of 10 mg L<inline-formula><mml:math id="M284" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>) to be sent to
Node B. Because the concentration of the 4 m<inline-formula><mml:math id="M285" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> parcel added to
Link E–B is the same (zero) as the concentration of the trailing
1700 m<inline-formula><mml:math id="M286" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> parcel, the two are combined to yield a parcel with a
volume of 1704 m<inline-formula><mml:math id="M287" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and a concentration of zero. The situation at
this point is shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F12"/>.</p>

<?xmltex \floatpos{t}?><table-wrap id="App1.Ch1.T1" specific-use="star"><caption><p id="d1e4937"> Water-quality routing for the example using the event-driven approach. Entries in the table describe water
parcels, giving their volume and concentration (volume/concentration). Results are shown for one water-quality time step.
The last row in the table gives the volume of water moved in a time step.</p></caption><oasis:table frame="topbot"><?xmltex \begin{scaleboxenv}{.97}[.97]?><oasis:tgroup cols="9">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="right"/>
     <oasis:colspec colnum="3" colname="col3" align="right"/>
     <oasis:colspec colnum="4" colname="col4" align="right"/>
     <oasis:colspec colnum="5" colname="col5" align="right"/>
     <oasis:colspec colnum="6" colname="col6" align="right"/>
     <oasis:colspec colnum="7" colname="col7" align="right"/>
     <oasis:colspec colnum="8" colname="col8" align="right"/>
     <oasis:colspec colnum="9" colname="col9" align="right"/>
     <oasis:thead>
       <oasis:row>
         <oasis:entry colname="col1"/>
         <oasis:entry rowsep="1" namest="col2" nameend="col9" align="center">Location<inline-formula><mml:math id="M293" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mi mathvariant="normal">a</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="normal">b</mml:mi></mml:mrow></mml:msup></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row rowsep="1">
         <oasis:entry colname="col1">Time or volume</oasis:entry>
         <oasis:entry colname="col2">A–B</oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M294" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi mathvariant="normal">B</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4">B–C</oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M295" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi mathvariant="normal">C</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6">C–D</oasis:entry>
         <oasis:entry colname="col7">D–E</oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M296" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi mathvariant="normal">E</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9">E–B</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>
         <oasis:entry colname="col1">Time <inline-formula><mml:math id="M297" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 0</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M298" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M299" display="inline"><mml:mrow><mml:mn mathvariant="normal">20</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M300" display="inline"><mml:mrow><mml:mn mathvariant="normal">800</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M301" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M302" display="inline"><mml:mrow><mml:mn mathvariant="normal">600</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M303" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M304" display="inline"><mml:mrow><mml:mn mathvariant="normal">8</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9"><inline-formula><mml:math id="M305" display="inline"><mml:mrow><mml:mn mathvariant="normal">1700</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M306" display="inline"><mml:mrow><mml:mn mathvariant="normal">100</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Step 1</oasis:entry>
         <oasis:entry colname="col2">76/0, <inline-formula><mml:math id="M307" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M308" display="inline"><mml:mrow><mml:mn mathvariant="normal">20</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M309" display="inline"><mml:mrow><mml:mn mathvariant="normal">800</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M310" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M311" display="inline"><mml:mrow><mml:mn mathvariant="normal">600</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M312" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M313" display="inline"><mml:mrow><mml:mn mathvariant="normal">8</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9"><inline-formula><mml:math id="M314" display="inline"><mml:mrow><mml:mn mathvariant="normal">1700</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M315" display="inline"><mml:mrow><mml:mn mathvariant="normal">100</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Step 2<inline-formula><mml:math id="M316" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">c</mml:mi></mml:msup></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M317" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M318" display="inline"><mml:mrow><mml:mn mathvariant="normal">19</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M319" display="inline"><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M320" display="inline"><mml:mrow><mml:mn mathvariant="normal">57</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M321" display="inline"><mml:mrow><mml:mn mathvariant="normal">3</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M322" display="inline"><mml:mrow><mml:mn mathvariant="normal">800</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M323" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M324" display="inline"><mml:mrow><mml:mn mathvariant="normal">600</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M325" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M326" display="inline"><mml:mrow><mml:mn mathvariant="normal">8</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9"><inline-formula><mml:math id="M327" display="inline"><mml:mrow><mml:mn mathvariant="normal">1700</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M328" display="inline"><mml:mrow><mml:mn mathvariant="normal">100</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Step 3</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M329" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M330" display="inline"><mml:mrow><mml:mn mathvariant="normal">19</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M331" display="inline"><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M332" display="inline"><mml:mrow><mml:mn mathvariant="normal">57</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M333" display="inline"><mml:mrow><mml:mn mathvariant="normal">3</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M334" display="inline"><mml:mrow><mml:mn mathvariant="normal">740</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M335" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M336" display="inline"><mml:mrow><mml:mn mathvariant="normal">48</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M337" display="inline"><mml:mrow><mml:mn mathvariant="normal">600</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M338" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M339" display="inline"><mml:mrow><mml:mn mathvariant="normal">8</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9"><inline-formula><mml:math id="M340" display="inline"><mml:mrow><mml:mn mathvariant="normal">1700</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M341" display="inline"><mml:mrow><mml:mn mathvariant="normal">100</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Step 4</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M342" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M343" display="inline"><mml:mrow><mml:mn mathvariant="normal">19</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M344" display="inline"><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M345" display="inline"><mml:mrow><mml:mn mathvariant="normal">57</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M346" display="inline"><mml:mrow><mml:mn mathvariant="normal">3</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M347" display="inline"><mml:mrow><mml:mn mathvariant="normal">740</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M348" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M349" display="inline"><mml:mrow><mml:mn mathvariant="normal">600</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M350" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M351" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M352" display="inline"><mml:mrow><mml:mn mathvariant="normal">8</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9"><inline-formula><mml:math id="M353" display="inline"><mml:mrow><mml:mn mathvariant="normal">1700</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M354" display="inline"><mml:mrow><mml:mn mathvariant="normal">100</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Step 5</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M355" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M356" display="inline"><mml:mrow><mml:mn mathvariant="normal">19</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M357" display="inline"><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M358" display="inline"><mml:mrow><mml:mn mathvariant="normal">57</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M359" display="inline"><mml:mrow><mml:mn mathvariant="normal">3</mml:mn><mml:mo>/</mml:mo><mml:mi mathvariant="normal">?</mml:mi></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M360" display="inline"><mml:mrow><mml:mn mathvariant="normal">740</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M361" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M362" display="inline"><mml:mrow><mml:mn mathvariant="normal">600</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M363" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M364" display="inline"><mml:mrow><mml:mn mathvariant="normal">8</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9"><inline-formula><mml:math id="M365" display="inline"><mml:mrow><mml:mn mathvariant="normal">4</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M366" display="inline"><mml:mrow><mml:mn mathvariant="normal">1700</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M367" display="inline"><mml:mrow><mml:mn mathvariant="normal">100</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Step 6</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M368" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M369" display="inline"><mml:mrow><mml:mn mathvariant="normal">19</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, 1/10</oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M370" display="inline"><mml:mrow><mml:mn mathvariant="normal">57</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M371" display="inline"><mml:mrow><mml:mn mathvariant="normal">3</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M372" display="inline"><mml:mrow><mml:mn mathvariant="normal">740</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M373" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M374" display="inline"><mml:mrow><mml:mn mathvariant="normal">600</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M375" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M376" display="inline"><mml:mrow><mml:mn mathvariant="normal">8</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9"><inline-formula><mml:math id="M377" display="inline"><mml:mrow><mml:mn mathvariant="normal">1704</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M378" display="inline"><mml:mrow><mml:mn mathvariant="normal">96</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Time <inline-formula><mml:math id="M379" display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> a time step</oasis:entry>
         <oasis:entry colname="col2"><inline-formula><mml:math id="M380" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col3"><inline-formula><mml:math id="M381" display="inline"><mml:mrow><mml:mn mathvariant="normal">20</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0.5</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col4"><inline-formula><mml:math id="M382" display="inline"><mml:mrow><mml:mn mathvariant="normal">60</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0.5</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M383" display="inline"><mml:mrow><mml:mn mathvariant="normal">740</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col5"><inline-formula><mml:math id="M384" display="inline"><mml:mrow><mml:mn mathvariant="normal">12</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col6"><inline-formula><mml:math id="M385" display="inline"><mml:mrow><mml:mn mathvariant="normal">600</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col7"><inline-formula><mml:math id="M386" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col8"><inline-formula><mml:math id="M387" display="inline"><mml:mrow><mml:mn mathvariant="normal">8</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
         <oasis:entry colname="col9"><inline-formula><mml:math id="M388" display="inline"><mml:mrow><mml:mn mathvariant="normal">1704</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M389" display="inline"><mml:mrow><mml:mn mathvariant="normal">96</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>
         <oasis:entry colname="col1">Vol. moved (m<inline-formula><mml:math id="M390" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula>)</oasis:entry>
         <oasis:entry colname="col2">76</oasis:entry>
         <oasis:entry colname="col3">20</oasis:entry>
         <oasis:entry colname="col4">60</oasis:entry>
         <oasis:entry colname="col5">12</oasis:entry>
         <oasis:entry colname="col6">48</oasis:entry>
         <oasis:entry colname="col7">12</oasis:entry>
         <oasis:entry colname="col8">8</oasis:entry>
         <oasis:entry colname="col9">4</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup><?xmltex \end{scaleboxenv}?></oasis:table><?xmltex \begin{scaleboxenv}{.97}[.97]?><table-wrap-foot><p id="d1e4940"><inline-formula><mml:math id="M288" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">a</mml:mi></mml:msup></mml:math></inline-formula> A–B, etc are links. <inline-formula><mml:math id="M289" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi mathvariant="normal">B</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, etc are nodal demands.
<inline-formula><mml:math id="M290" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">b</mml:mi></mml:msup></mml:math></inline-formula> A question mark (?) means that the concentration has not yet been determined.
<inline-formula><mml:math id="M291" display="inline"><mml:msup><mml:mi/><mml:mi mathvariant="normal">c</mml:mi></mml:msup></mml:math></inline-formula> The two parcels in <inline-formula><mml:math id="M292" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi mathvariant="normal">B</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> correspond to Seg2 in Fig. <xref ref-type="fig" rid="App1.Ch1.F11"/> and the two trailing parcels in
B–C correspond to Seg3 in the same figure. Seg1 in the figure corresponds to an intermediate step before the creation of Seg2 and
Seg3. It is not associated with any link or demand and therefore is not included in this
table.</p></table-wrap-foot><?xmltex \end{scaleboxenv}?></table-wrap>

      <p id="d1e6368">When the leading parcel from Link E–B arrives at Node B, incomplete Parcel
Seg1 can be completed because its concentration can now be determined. The
concentrations of all the other incomplete parcels shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F11"/>
also can be determined and updated values for these concentrations are shown
in Fig. <xref ref-type="fig" rid="App1.Ch1.F13"/>. The concentration of Parcel Seg1
(0.5 mg L<inline-formula><mml:math id="M391" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>) is the concentration of the blended parcels coming
from Link A–B (76 m<inline-formula><mml:math id="M392" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> with a concentration of 0) and Link E–B
(4 m<inline-formula><mml:math id="M393" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> with a concentration of 10 mg L<inline-formula><mml:math id="M394" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>). Parcels
Seg2, Seg3, and Seg4 have the same concentration. The status of the network
at the end of the time step is shown in Fig. <xref ref-type="fig" rid="App1.Ch1.F14"/>.</p>
      <?pagebreak page45?><p id="d1e6420">In general, in applications using the event-driven algorithm there are
multiple interim steps within each water-quality time step. Each of these
steps corresponds to an event in the simulation. The preceding discussion
mentions the various interim steps included in the time step considered, but
emphasizes the method used to address situations involving a recirculating
flow. It does not focus explicitly on the various interim steps
themselves. The interim steps in the example are provided explicitly in Table <xref ref-type="table" rid="App1.Ch1.T1"/>, which shows event by event the changes that take place during the
time step considered in the example.</p>
      <p id="d1e6426">The columns in Table <xref ref-type="table" rid="App1.Ch1.T1"/> correspond to either a link in the network used
in the example or to a demand at one of its nodes. The rows correspond to the
steps used in the algorithm to route water quality through the network. In
this example there are six interim steps between the beginning and end of the
water-quality time step. The entries in the table correspond to water
parcels. The same notation used above to describe a water parcel is used in
the table. For example, <inline-formula><mml:math id="M395" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> in the first row of the first column indicates
that there is a water parcel with a volume of 250 m<inline-formula><mml:math id="M396" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> and a
concentration of zero in Link A–B at the beginning of the time step. More
than one entry indicates that there is more than one water parcel associated
with the link or demand at that specific step in the process. The leading
parcel in each entry is the rightmost one.</p>
      <p id="d1e6452"><?xmltex \hack{\newpage}?>In Step 1, a water parcel (<inline-formula><mml:math id="M397" display="inline"><mml:mrow><mml:mn mathvariant="normal">76</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>) is added to Link A–B due to the inflow of
76 m<inline-formula><mml:math id="M398" display="inline"><mml:msup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:math></inline-formula> of water to the link from Node A. The concentration of the
new parcel is the same (zero) as the concentration of the parcel already in
the link (<inline-formula><mml:math id="M399" display="inline"><mml:mrow><mml:mn mathvariant="normal">250</mml:mn><mml:mo>/</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>) and the two parcels are combined. Because the combined
volume of the parcels now exceeds the volume of the link, the excess volume
is moved (Step 2) to Node B, where it is combined with a water parcel from
Link E–B (4/?) and then split to accommodate the demand for Node B
(<inline-formula><mml:math id="M400" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi mathvariant="normal">B</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> in the table) and outflow for the node. As discussed
above, the concentration for the parcel arriving from Link E–B has not yet
been determined, so incomplete parcels must now be used. Excess water is
moved step by step through the network until it is removed by downstream
nodes (at Node <inline-formula><mml:math id="M401" display="inline"><mml:mi>D</mml:mi></mml:math></inline-formula>) or by demands. By Step 5 the concentration of the inflow
from Link E–B can be determined and the incomplete parcels can be completed
(Step 6). By the end of the time step the water added at the beginning of the
time step has moved through the network and volumes and concentrations of all
water parcels and demands have been determined. The conditions at the
beginning of the time step correspond to those in Fig. <xref ref-type="fig" rid="App1.Ch1.F10"/> and those
at the end of the time step correspond to those in Fig. <xref ref-type="fig" rid="App1.Ch1.F14"/>. The
conditions in Step 2 correspond to those in Fig. <xref ref-type="fig" rid="App1.Ch1.F11"/> and those in
Step 6 correspond to those in Fig. <xref ref-type="fig" rid="App1.Ch1.F13"/>.</p><?xmltex \hack{\clearpage}?>
</app>
  </app-group><notes notes-type="competinginterests">

      <p id="d1e6521">The authors declare that they have no conflict of
interest.</p>
  </notes><notes notes-type="disclaimer">

      <p id="d1e6527">This paper has been subjected to EPA's review and has been
approved for publication. The views expressed in this paper are those of the
authors and approval does not signify that the contents necessarily reflect
the views of the Agency. Mention of trade names, products, or services does
not convey official EPA approval, endorsement, or recommendation. Because of
the confidentiality of the information, the identity of the real WDSs used in
this paper and any information that could be used to identify the systems
cannot be disclosed.</p>

      <p id="d1e6530">The submitted manuscript has been created by UChicago Argonne, LLC, operator
of Argonne National Laboratory (“Argonne”). Argonne, a US Department of
Energy Office of Science laboratory, is operated under contract no.
DE-AC02-06CH11357. The US government retains for itself, and others acting
on its behalf, a paid-up nonexclusive, irrevocable worldwide license in said
article to reproduce, prepare derivative works, distribute copies to the
public, and perform publicly and display publicly, by or on behalf of the
government. The Department of Energy will provide public access to these
results of federally sponsored research in accordance with the DOE Public
Access Plan (<uri>http://energy.gov/downloads/doe-public-access-plan</uri>).</p>
  </notes><ack><title>Acknowledgements</title><p id="d1e6540">The US Environmental Protection Agency's (EPA) Office of Research and
Development funded, managed, and participated in the research described here
under an interagency agreement. Work at Argonne National Laboratory was
sponsored by the EPA under an interagency agreement through US Department
of Energy Contract DE-AC02-06CH11357. All post-simulation data analysis and
preparation of graphics for this paper were done using R <xref ref-type="bibr" rid="bib1.bibx14" id="paren.26"/>.
Network plots were produced in R using epanetReader <xref ref-type="bibr" rid="bib1.bibx8" id="paren.27"/>. Four
internal reviewers provided helpful comments on a draft version of this
paper. We also appreciate the helpful comments provided by Patrick Moore and
Sam Hatchett during the interactive discussion and the helpful comments from
two anonymous referees.
<?xmltex \hack{\newline}?><?xmltex \hack{\newline}?>
Edited by: Ran Shang<?xmltex \hack{\newline}?>
Reviewed by:  two anonymous referees</p></ack><ref-list>
    <title>References</title>

      <ref id="bib1.bibx1"><label>Boulos et al.(1994)</label><mixed-citation>Boulos, P. F., Altman, T., Jarrige, P.-A., and Collevati, F.: An event-driven method for modelling contaminant
propagation in water networks, Appl. Math. Model., 18, 84–92, <ext-link xlink:href="https://doi.org/10.1016/0307-904X(94)90163-5" ext-link-type="DOI">10.1016/0307-904X(94)90163-5</ext-link>, 1994.</mixed-citation></ref>
      <ref id="bib1.bibx2"><label>Boulos et al.(1995)</label><mixed-citation>Boulos, P. F., Altman, T., Jarrige, P.-A., and Collevati, F.: Discrete simulation approach for network-water-quality
models, J. Water Res. Pl.-ASCE, 121, 49–60, <ext-link xlink:href="https://doi.org/10.1061/(ASCE)0733-9496(1995)121:1(49)" ext-link-type="DOI">10.1061/(ASCE)0733-9496(1995)121:1(49)</ext-link>, 1995.</mixed-citation></ref>
      <ref id="bib1.bibx3"><label>Brumbelow et al.(2007)</label><mixed-citation>Brumbelow, K., Torres, J., Guikema, S., Bristow, E., and Kanta, L.: Virtual cities for water distribution and
infrastructure system research, Proc. World Environ. and Water Res. Congress 2007, ASCE, Reston, VA, <ext-link xlink:href="https://doi.org/10.1061/40927(243)469" ext-link-type="DOI">10.1061/40927(243)469</ext-link>, 2007.</mixed-citation></ref>
      <ref id="bib1.bibx4"><label>Davis and Janke(2014)</label><mixed-citation>Davis, M. J. and Janke, R.: Influence of network model detail on estimated health effects of drinking water
contamination events, J. Water Res. Pl.-ASCE, 141, <ext-link xlink:href="https://doi.org/10.1061/(ASCE)WR.1943-5452.0000436" ext-link-type="DOI">10.1061/(ASCE)WR.1943-5452.0000436</ext-link>, 2014.</mixed-citation></ref>
      <ref id="bib1.bibx5"><label>Davis et al.(2014)</label><mixed-citation>Davis, M. J., Janke, R., and Magnuson, M. L.: A framework for estimating the adverse health effects of contamination
events in water distribution systems and its application, Risk Anal., 34, 498–513, <ext-link xlink:href="https://doi.org/10.1111/risa.12107" ext-link-type="DOI">10.1111/risa.12107</ext-link>, 2014.</mixed-citation></ref>
      <ref id="bib1.bibx6"><label>Davis et al.(2016)</label><mixed-citation>Davis, M. J., Janke, R., and Taxon, T. N.: Assessing inhalation exposures associated with contamination events in
water distribution systems, PLoS ONE, 11, e0168051, <ext-link xlink:href="https://doi.org/10.1371/journal.pone.0168051" ext-link-type="DOI">10.1371/journal.pone.0168051</ext-link>, 2016.</mixed-citation></ref>
      <ref id="bib1.bibx7"><label>Diao et al.(2016)</label><mixed-citation>Diao, K., Sweetapple, C., Farmani, R., Fu, G., Ward, S., and Butler, D.: Global resilience analysis of water
distribution systems, Water Res., 106, 383–393, <ext-link xlink:href="https://doi.org/10.1016/j.watres.2016.10.011" ext-link-type="DOI">10.1016/j.watres.2016.10.011</ext-link>, 2016.</mixed-citation></ref>
      <ref id="bib1.bibx8"><label>Eck(2016)</label><mixed-citation>Eck, B. J.: An R package for reading EPANET files, Environ. Modell. Softw., 84, 149–154,
<ext-link xlink:href="https://doi.org/10.1016/j.envsoft.2016.06.027" ext-link-type="DOI">10.1016/j.envsoft.2016.06.027</ext-link>, 2016.</mixed-citation></ref>
      <ref id="bib1.bibx9"><label>GCC(2017)</label><mixed-citation>GCC: GCC, the GNU compiler collection, available at: <uri>https://gcc.gnu.org</uri>, last access: 19 April 2017.</mixed-citation></ref>
      <ref id="bib1.bibx10"><label>Helbling and VanBriesen(2009)</label><mixed-citation>Helbling, D. E. and VanBriesen, J. M.: Propagation of chlorine signals induced by microbial contaminants
in a drinking water distribution system, Proc. World Environ. and Water Res. Congress 2009: Great Rivers, ASCE, Kansas City,
MO, 515–524, <ext-link xlink:href="https://doi.org/10.1061/41036(342)50" ext-link-type="DOI">10.1061/41036(342)50</ext-link>, 2009.</mixed-citation></ref>
      <ref id="bib1.bibx11"><label>OpenWaterAnalytics(2017a)</label><mixed-citation>OpenWaterAnalytics: EPANET, available at: <uri>https://github.com/OpenWaterAnalytics/EPANET</uri>, last access: 16 August 2017a.</mixed-citation></ref>
      <ref id="bib1.bibx12"><label>OpenWaterAnalytics(2017b)</label><mixed-citation>OpenWaterAnalytics: epanet-dev, available at: <uri>https://github.com/OpenWaterAnalytics/epanet-dev</uri>, last access: 16 August 2017b.</mixed-citation></ref>
      <ref id="bib1.bibx13"><label>Ostfeld et al.(2008)</label><mixed-citation>Ostfeld, A., Uber, J. G., Salomons, E., Berry, J. W., Hart, W. E., Phillips, C. A., Watson, J-P., Dorini, G.,
Jonkergouw, P., Kapelan, Z., di Pierro, F., Khu, S-T., Savic, D., Eliades, D., Polycarpou, M., Ghimire, S. R., Barkdoll, B. D.,
Gueli, R., Huang, J. J., McBean, E. A., James, W., Krause, A., Leskovec, J., Isovitsch, S., Xu, J., Guestrin, C., VanBriesen, J.,
Small, M., Fischbeck, P., Preis, A., Propato, M.,  Piller, O., Trachtman, G. B., Wu, Z. Y., and Walski, T.: The battle
of the water sensor networks (BWSN): A design challenge for engineers and algorithms, J. Water Res. Pl.-ASCE, 134,
556–568, <ext-link xlink:href="https://doi.org/10.1061/(ASCE)0733-9496(2008)134:6(556)" ext-link-type="DOI">10.1061/(ASCE)0733-9496(2008)134:6(556)</ext-link>, 2008.</mixed-citation></ref>
      <ref id="bib1.bibx14"><label>R Core Team(2017)</label><mixed-citation>R Core Team: R: A language and environment for statistical computing,  R Foundation for Statistical Computing, Vienna,
Austria, available at: <uri>https://www.R-project.org</uri>, last access: 3 August 2017.</mixed-citation></ref>
      <ref id="bib1.bibx15"><label>Rossman(2000)</label><mixed-citation>
Rossman, L. A.: EPANET 2 users manual, US Environmental Protection Agency (EPA), Office of Research and Development,
National Risk Management Research Laboratory, Cincinnati, Ohio, EPA/600/R-00/057, 2000.</mixed-citation></ref>
      <ref id="bib1.bibx16"><label>Rossman and Boulos(1996)</label><mixed-citation>Rossman, L. A. and Boulos, P. F.: Numerical methods for modeling water quality in distribution systems:
A comparison, J. Water Res. Pl.-ASCE, 122, 137–146, <ext-link xlink:href="https://doi.org/10.1061/(ASCE)0733-9496(1996)122:2(137)" ext-link-type="DOI">10.1061/(ASCE)0733-9496(1996)122:2(137)</ext-link>, 1996.</mixed-citation></ref>
      <ref id="bib1.bib1"><label>1</label><mixed-citation>Taxon, T.: Flow method for water quality transport, available at:
<uri>https://github.com/ttaxon/EPANET/tree/flow-transport-model</uri>, last access: 26 March 2018.</mixed-citation></ref>
      <?pagebreak page47?><ref id="bib1.bibx17"><label>US EPA(2017a)</label><mixed-citation>US EPA: EPANET: Software that models the hydraulic and water quality behavior of water distribution
piping systems, available at: <uri>https://www.epa.gov/water-research/epanet</uri>, last access: 16 August 2017a.</mixed-citation></ref>
      <ref id="bib1.bibx18"><label>US EPA(2017b)</label><mixed-citation>US EPA: Water-distribution-network-model, available at: <uri>https://github.com/USEPA/Water-Distribution-Network-Model</uri>, last access: 16 August 2017b.</mixed-citation></ref>
      <ref id="bib1.bibx19"><label>US EPA(2017c)</label><mixed-citation>US EPA: Models, tools and applications for homeland security research,
available at: <uri>https://www.epa.gov/homeland-security-research/models-tools-and-applications-homeland-security-research</uri>, last access: 16 August 2017c.</mixed-citation></ref>
      <ref id="bib1.bib2"><label>2</label><mixed-citation>US EPA: EPANET INP files used in paper,
<ext-link xlink:href="https://doi.org/10.23719/1375314" ext-link-type="DOI">10.23719/1375314</ext-link>,  2018a.
</mixed-citation></ref><?xmltex \hack{\newpage}?>
      <ref id="bib1.bib3"><label>3</label><mixed-citation>US EPA: TEVA-SPOT-GUI – Containing preliminary flow model,  <ext-link xlink:href="https://doi.org/10.23719/1375315" ext-link-type="DOI">10.23719/1375315</ext-link>,
2018b.</mixed-citation></ref>
      <ref id="bib1.bibx20"><label>Wang and Harrison(2014)</label><mixed-citation>Wang, H. and Harrison, K. W.: Improving efficiency of the Bayesian approach to water distribution contaminant
source characterization with support vector regression, J. Water Res. Pl.-ASCE, 140, 3–11, <ext-link xlink:href="https://doi.org/10.1061/(ASCE)WR.1943-5452.0000323" ext-link-type="DOI">10.1061/(ASCE)WR.1943-5452.0000323</ext-link>, 2014.</mixed-citation></ref>
      <ref id="bib1.bibx21"><label>Wu(2014)</label><mixed-citation>Wu, Z. Y.: Heterogeneous computing paradigm for parallel water distribution system analysis,  CUNY Academic
Works, available at: <uri>http://academicworks.cuny.edu/cc_conf_hic/91</uri> (last access: 15 February 2018), 2014.</mixed-citation></ref>

  </ref-list></back>
    <!--<article-title-html>Mass imbalances in EPANET water-quality simulations</article-title-html>
<abstract-html><p>EPANET is widely employed to simulate water quality in water distribution
systems. However, in general, the time-driven simulation approach used to
determine concentrations of water-quality constituents provides accurate
results only for short water-quality time steps. Overly long time steps can
yield errors in concentration estimates and can result in situations in which
constituent mass is not conserved. The use of a time step that is
sufficiently short to avoid these problems may not always be feasible. The
absence of EPANET errors or warnings does not ensure conservation of mass.
This paper provides examples illustrating mass imbalances and explains how
such imbalances can occur because of fundamental limitations in the
water-quality routing algorithm used in EPANET. In general, these limitations
cannot be overcome by the use of improved water-quality modeling practices.
This paper also presents a preliminary event-driven approach that conserves
mass with a water-quality time step that is as long as the hydraulic time
step. Results obtained using the current approach converge, or tend to
converge, toward those obtained using the preliminary event-driven approach as
the water-quality time step decreases. Improving the water-quality routing
algorithm used in EPANET could eliminate mass imbalances and related errors
in estimated concentrations. The results presented in this paper should be of
value to those who perform water-quality simulations using EPANET or use the
results of such simulations, including utility managers and engineers.</p></abstract-html>
<ref-html id="bib1.bib1"><label>Boulos et al.(1994)</label><mixed-citation>
Boulos, P. F., Altman, T., Jarrige, P.-A., and Collevati, F.: An event-driven method for modelling contaminant
propagation in water networks, Appl. Math. Model., 18, 84–92, <a href="https://doi.org/10.1016/0307-904X(94)90163-5" target="_blank">https://doi.org/10.1016/0307-904X(94)90163-5</a>, 1994.
</mixed-citation></ref-html>
<ref-html id="bib1.bib2"><label>Boulos et al.(1995)</label><mixed-citation>
Boulos, P. F., Altman, T., Jarrige, P.-A., and Collevati, F.: Discrete simulation approach for network-water-quality
models, J. Water Res. Pl.-ASCE, 121, 49–60, <a href="https://doi.org/10.1061/(ASCE)0733-9496(1995)121:1(49)" target="_blank">https://doi.org/10.1061/(ASCE)0733-9496(1995)121:1(49)</a>, 1995.
</mixed-citation></ref-html>
<ref-html id="bib1.bib3"><label>Brumbelow et al.(2007)</label><mixed-citation>
Brumbelow, K., Torres, J., Guikema, S., Bristow, E., and Kanta, L.: Virtual cities for water distribution and
infrastructure system research, Proc. World Environ. and Water Res. Congress 2007, ASCE, Reston, VA, <a href="https://doi.org/10.1061/40927(243)469" target="_blank">https://doi.org/10.1061/40927(243)469</a>, 2007.
</mixed-citation></ref-html>
<ref-html id="bib1.bib4"><label>Davis and Janke(2014)</label><mixed-citation>
Davis, M. J. and Janke, R.: Influence of network model detail on estimated health effects of drinking water
contamination events, J. Water Res. Pl.-ASCE, 141, <a href="https://doi.org/10.1061/(ASCE)WR.1943-5452.0000436" target="_blank">https://doi.org/10.1061/(ASCE)WR.1943-5452.0000436</a>, 2014.
</mixed-citation></ref-html>
<ref-html id="bib1.bib5"><label>Davis et al.(2014)</label><mixed-citation>
Davis, M. J., Janke, R., and Magnuson, M. L.: A framework for estimating the adverse health effects of contamination
events in water distribution systems and its application, Risk Anal., 34, 498–513, <a href="https://doi.org/10.1111/risa.12107" target="_blank">https://doi.org/10.1111/risa.12107</a>, 2014.
</mixed-citation></ref-html>
<ref-html id="bib1.bib6"><label>Davis et al.(2016)</label><mixed-citation>
Davis, M. J., Janke, R., and Taxon, T. N.: Assessing inhalation exposures associated with contamination events in
water distribution systems, PLoS ONE, 11, e0168051, <a href="https://doi.org/10.1371/journal.pone.0168051" target="_blank">https://doi.org/10.1371/journal.pone.0168051</a>, 2016.
</mixed-citation></ref-html>
<ref-html id="bib1.bib7"><label>Diao et al.(2016)</label><mixed-citation>
Diao, K., Sweetapple, C., Farmani, R., Fu, G., Ward, S., and Butler, D.: Global resilience analysis of water
distribution systems, Water Res., 106, 383–393, <a href="https://doi.org/10.1016/j.watres.2016.10.011" target="_blank">https://doi.org/10.1016/j.watres.2016.10.011</a>, 2016.
</mixed-citation></ref-html>
<ref-html id="bib1.bib8"><label>Eck(2016)</label><mixed-citation>
Eck, B. J.: An R package for reading EPANET files, Environ. Modell. Softw., 84, 149–154,
<a href="https://doi.org/10.1016/j.envsoft.2016.06.027" target="_blank">https://doi.org/10.1016/j.envsoft.2016.06.027</a>, 2016.
</mixed-citation></ref-html>
<ref-html id="bib1.bib9"><label>GCC(2017)</label><mixed-citation>
GCC: GCC, the GNU compiler collection, available at: <a href="https://gcc.gnu.org" target="_blank">https://gcc.gnu.org</a>, last access: 19 April 2017.
</mixed-citation></ref-html>
<ref-html id="bib1.bib10"><label>Helbling and VanBriesen(2009)</label><mixed-citation>
Helbling, D. E. and VanBriesen, J. M.: Propagation of chlorine signals induced by microbial contaminants
in a drinking water distribution system, Proc. World Environ. and Water Res. Congress 2009: Great Rivers, ASCE, Kansas City,
MO, 515–524, <a href="https://doi.org/10.1061/41036(342)50" target="_blank">https://doi.org/10.1061/41036(342)50</a>, 2009.
</mixed-citation></ref-html>
<ref-html id="bib1.bib11"><label>OpenWaterAnalytics(2017a)</label><mixed-citation>
OpenWaterAnalytics: EPANET, available at: <a href="https://github.com/OpenWaterAnalytics/EPANET" target="_blank">https://github.com/OpenWaterAnalytics/EPANET</a>, last access: 16 August 2017a.
</mixed-citation></ref-html>
<ref-html id="bib1.bib12"><label>OpenWaterAnalytics(2017b)</label><mixed-citation>
OpenWaterAnalytics: epanet-dev, available at: <a href="https://github.com/OpenWaterAnalytics/epanet-dev" target="_blank">https://github.com/OpenWaterAnalytics/epanet-dev</a>, last access: 16 August 2017b.
</mixed-citation></ref-html>
<ref-html id="bib1.bib13"><label>Ostfeld et al.(2008)</label><mixed-citation>
Ostfeld, A., Uber, J. G., Salomons, E., Berry, J. W., Hart, W. E., Phillips, C. A., Watson, J-P., Dorini, G.,
Jonkergouw, P., Kapelan, Z., di Pierro, F., Khu, S-T., Savic, D., Eliades, D., Polycarpou, M., Ghimire, S. R., Barkdoll, B. D.,
Gueli, R., Huang, J. J., McBean, E. A., James, W., Krause, A., Leskovec, J., Isovitsch, S., Xu, J., Guestrin, C., VanBriesen, J.,
Small, M., Fischbeck, P., Preis, A., Propato, M.,  Piller, O., Trachtman, G. B., Wu, Z. Y., and Walski, T.: The battle
of the water sensor networks (BWSN): A design challenge for engineers and algorithms, J. Water Res. Pl.-ASCE, 134,
556–568, <a href="https://doi.org/10.1061/(ASCE)0733-9496(2008)134:6(556)" target="_blank">https://doi.org/10.1061/(ASCE)0733-9496(2008)134:6(556)</a>, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib14"><label>R Core Team(2017)</label><mixed-citation>
R Core Team: R: A language and environment for statistical computing,  R Foundation for Statistical Computing, Vienna,
Austria, available at: <a href="https://www.R-project.org" target="_blank">https://www.R-project.org</a>, last access: 3 August 2017.
</mixed-citation></ref-html>
<ref-html id="bib1.bib15"><label>Rossman(2000)</label><mixed-citation>
Rossman, L. A.: EPANET 2 users manual, US Environmental Protection Agency (EPA), Office of Research and Development,
National Risk Management Research Laboratory, Cincinnati, Ohio, EPA/600/R-00/057, 2000.
</mixed-citation></ref-html>
<ref-html id="bib1.bib16"><label>Rossman and Boulos(1996)</label><mixed-citation>
Rossman, L. A. and Boulos, P. F.: Numerical methods for modeling water quality in distribution systems:
A comparison, J. Water Res. Pl.-ASCE, 122, 137–146, <a href="https://doi.org/10.1061/(ASCE)0733-9496(1996)122:2(137)" target="_blank">https://doi.org/10.1061/(ASCE)0733-9496(1996)122:2(137)</a>, 1996.
</mixed-citation></ref-html>
<ref-html id="bib1.bib17"><label>1</label><mixed-citation>
Taxon, T.: Flow method for water quality transport, available at:
<a href="https://github.com/ttaxon/EPANET/tree/flow-transport-model" target="_blank">https://github.com/ttaxon/EPANET/tree/flow-transport-model</a>, last access: 26 March 2018.
</mixed-citation></ref-html>
<ref-html id="bib1.bib18"><label>US EPA(2017a)</label><mixed-citation>
US EPA: EPANET: Software that models the hydraulic and water quality behavior of water distribution
piping systems, available at: <a href="https://www.epa.gov/water-research/epanet" target="_blank">https://www.epa.gov/water-research/epanet</a>, last access: 16 August 2017a.
</mixed-citation></ref-html>
<ref-html id="bib1.bib19"><label>US EPA(2017b)</label><mixed-citation>
US EPA: Water-distribution-network-model, available at: <a href="https://github.com/USEPA/Water-Distribution-Network-Model" target="_blank">https://github.com/USEPA/Water-Distribution-Network-Model</a>, last access: 16 August 2017b.
</mixed-citation></ref-html>
<ref-html id="bib1.bib20"><label>US EPA(2017c)</label><mixed-citation>
US EPA: Models, tools and applications for homeland security research,
available at: <a href="https://www.epa.gov/homeland-security-research/models-tools-and-applications-homeland-security-research" target="_blank">https://www.epa.gov/homeland-security-research/models-tools-and-applications-homeland-security-research</a>, last access: 16 August 2017c.
</mixed-citation></ref-html>
<ref-html id="bib1.bib21"><label>2</label><mixed-citation>
US EPA: EPANET INP files used in paper,
<a href="https://doi.org/10.23719/1375314" target="_blank">https://doi.org/10.23719/1375314</a>,  2018a.

</mixed-citation></ref-html>
<ref-html id="bib1.bib22"><label>3</label><mixed-citation>
US EPA: TEVA-SPOT-GUI – Containing preliminary flow model,  <a href="https://doi.org/10.23719/1375315" target="_blank">https://doi.org/10.23719/1375315</a>,
2018b.
</mixed-citation></ref-html>
<ref-html id="bib1.bib23"><label>Wang and Harrison(2014)</label><mixed-citation>
Wang, H. and Harrison, K. W.: Improving efficiency of the Bayesian approach to water distribution contaminant
source characterization with support vector regression, J. Water Res. Pl.-ASCE, 140, 3–11, <a href="https://doi.org/10.1061/(ASCE)WR.1943-5452.0000323" target="_blank">https://doi.org/10.1061/(ASCE)WR.1943-5452.0000323</a>, 2014.
</mixed-citation></ref-html>
<ref-html id="bib1.bib24"><label>Wu(2014)</label><mixed-citation>
Wu, Z. Y.: Heterogeneous computing paradigm for parallel water distribution system analysis,  CUNY Academic
Works, available at: <a href="http://academicworks.cuny.edu/cc_conf_hic/91" target="_blank">http://academicworks.cuny.edu/cc_conf_hic/91</a> (last access: 15 February 2018), 2014.
</mixed-citation></ref-html>--></article>
