Modelling temperature dynamics in sewer systems – comparing mechanistic and conceptual modelling approaches

The vast majority of the energy consumed for urban water services is used to heat tap water. Heat recovery from wastewater is consequently an area of rapidly growing concern, both in research and by commercial interest, promoting the path towards a circular economy. To facilitate a system-wide evaluation of heat recovery from wastewater, this paper compares two one-dimensional models (mechanistic and conceptual) that can describe wastewater temperature dynamics in sewer pipe systems. The models are applied to successfully predict downstream wastewater temperature for sewer stretches in two Swedish cities (Linköping and Malmö). The root mean squared errors for the mechanistic model (Linköping Dataset1 – 0.33 °C; Linköping Dataset2 – 0.28 °C; Malmö – 0.40 °C) and the conceptual model (Linköping Dataset1 – 0.32 °C; Linköping Dataset2 – 0.20 °C; Malmö – 0.44 °C) indicate that both models have similar predictive capabilities, encouraging the use of conceptual models to reduce data requirements and model calibration efforts. Both models are freely distributed and can be easily integrated with wastewater generation and treatment models to facilitate system-wide wastewater temperature dynamics analysis.

• Modelling tools to study energy recovery possibilities from wastewater are needed.
• Mechanistic and conceptual models for temperature dynamics in sewer system are developed.
• The models are applied for sewer pipes in two Swedish cities -Linköping and Malmö.
• Both models offer similar prediction capabilities.
• Further studies should include case studies outside Sweden and longer time periods.This is an Open Access article distributed under the terms of the Creative Commons Attribution Licence (CC BY 4.0), which permits copying, adaptation and redistribution, provided the original work is properly cited (http://creativecommons.org/licenses/by/4.0/).

INTRODUCTION
A staggering 90% of the total energy used for urban water services (drinking water treatment, water supply, wastewater transport through sewer system and treatment) is spent on heating tap water for domestic needs (Olsson 2012).A large percentage of this heat energy is discharged into the sewer system and lost to the environment (soil, sewer pipes, in-sewer air, etc.) before reaching the wastewater treatment plant (WWTP) (Somogyi et al. 2018).Several possibilities are already available to reduce this dramatic energy loss.Heat recovery installations and equipment are commercially available in various scales ranging from localized heat recovery (Tomlinson et al. 2012;Mazhar et al. 2018) at the appliance level (showers, dishwashers etc.) to centralized heat pumps at the WWTP effluent (Sitzenfrei et al. 2017;Vestberg 2017).While recovering energy from wastewater at various locations (households, building level, sewer system) is an attractive option, it can adversely affect the performance of the wastewater treatment plant as lower temperatures reduce microbial activity, particularly nitrification (Wanner et al. 2005).Especially in colder climates, this effect may have a severe negative impact on the nitrogen removal capacity of the WWTP.Another possibility is heat recovery at the WWTP effluent.This is currently implemented at several large WWTPs in Sweden.While it eliminates the risk to WWTP operation, a large fraction of the wastewater heat content is already lost to the surrounding environment in the sewers, WWTP etc. by the time it reaches the WWTP effluent (Arnell et al. 2017).Hence, heat recovery possibilities should be evaluated at an integrated level where energy recovery, WWTP performance, impact on in-sewer processes etc. are considered in an integrated manner (Abdel-Aal et al. 2019).Model-based evaluation is an excellent approach to evaluate various objectives in an integrated city-wide heat recovery study.Such a model-based evaluation requires tools to describe: (i) generation of wastewater from households; (ii) wastewater temperature dynamics in the sewer system (such as the one presented in this paper); (iii) effects of wastewater temperature reduction on WWTP performance; (iv) heat recovery equipment; and finally (v) criteria for evaluation.It is also important that these tools can be easily integrated with one another to perform an integrated urban wastewater system-wide analysis.There are currently tools available only at a sub-system level that can take into consideration such temperature variations.For example, influent generator models (Gernaey et al. 2011;Talebizadeh et al. 2016) can simulate the temperature variation in the WWTP inlet due to rainfall, infiltration etc.Similarly, process models (Gabaldón et al. 1998;Khiewwijit et al. 2015) for WWTPs also include the effect of temperature on biological processes.However, it is currently difficult to integrate these sub-models with the existing sewer heat transfer models as the sub-models often contain different sets of state variables (for example, the currently available sewer heat transfer models do not contain all the pollutant state variables to integrate with WWTP models) and all the sub-models are not easily available in the same simulation platform.
In this paper, a heat transfer model for sewer systems is presented that can be easily integrated with other models available in the literature (upstream wastewater generation models from households (Wärff et al. 2020), standard WWTP models (Henze et al. 2000) and heat recovery equipment models describing the energy recovery, temperature variation etc. in heat exchangers and heat pumps (Geankoplis 1993;Arnell & Saagi 2020)) that can eventually promote system-wide studies (Arnell et al. 2017).Detailed two-dimensional heat transfer models for sewer networks already exist (Dürrenmatt & Wanner 2014;Elías-Maxil et al. 2017).However, such models need extensive information about the sewer pipe characteristics, surrounding environment, etc., which is often lacking in practice.A more simplified approach is described by Abdel-Aal et al. (2014) where temperature dynamics in the sewer network are described using a one-dimensional model.Such one-dimensional models still require information about sewer pipe characteristics, soil temperature and in-sewer air temperature.However, the simulation time is significantly reduced owing to the one-dimensional approach (compared to the two-dimensional models) The use of black-box models to describe temperature variations in the sewer system has also been explored (Abdel-Aal et al. 2015;Golzar et al. 2020).Golzar et al. (2020) estimated the heat recovery potential and WWTP inlet temperature based on several parameters (e.g.temperature at the inlet to the sewer system, ambient temperature, time of the day etc.).However, the model cannot be used to simulate temperature variations and heat recovery at other locations (between the sewer inlet and WWTP inlet) in the sewer system.Hence, such approaches may not be suitable for scenario analysis where historic data are not readily available and for configurations that differ significantly from the existing ones.
Currently, there are no model toolboxes that can address all the below points simultaneously.The model toolbox described here addresses several shortcomings in the existing sewer heat transfer models: i. Ease of integration between the temperature and hydraulic models -The existing one-dimensional heat transfer models (Abdel-Aal 2015) describe the hydraulics separately, the information from which is then applied to the temperature model.While the two-dimensional models describe the wastewater temperature and flow rate dynamics in the same model, they are computationally demanding and need extensive information for model development and calibration.A one-dimensional heat transfer model as well as the hydraulic model (for both gravity and pumped systems) to describe the sewer system are developed within the same simulation software (Matlab) in this study.ii.Applicability to city-wide studies -Developing a detailed hydraulic model at city-scale is time consuming and needs extensive information about the sewer pipe characteristics.Instead, a conceptual model that only needs limited information can be quickly developed and used for model-based analysis.With the availability of both a mechanistic and a conceptual model, it is now possible to choose the approach needed for city-wide modelling based on the available data.Such a comprehensive modelling toolbox which includes both temperature and flow rate dynamics in the same simulation software with the possibility to choose between mechanistic and conceptual models is currently not available.iii.Availability of other sub-systems models in the same simulation platform -While it is possible to integrate a hydraulic model with a heat transfer model either directly in the hydraulic model software (Figueroa et al. 2021) or by interfacing (Abdel-Aal et al. 2018), it can still be challenging to evaluate city-wide studies that also include the WWTP as well as any feedback loops for control strategies etc.In such cases, the availability of the entire model toolbox in the same simulation software is advantageous.In this study, a wastewater generation model (Wärff et al. 2020), WWTP model (Arnell et al. 2021) and heat transfer equipment models (Arnell & Saagi 2020) are developed using the same simulation platform (Matlab/Simulink) and can be easily integrated with both the mechanistic and conceptual sewer heat transfer models.This can significantly improve the possibilities for city-wide heat recovery studies with a wider scope.
Additionally, all of these models are packaged and shared as an open-source (applies to the source code for the presented models, a Matlab license is required for running the models), freely distributed toolbox.Model toolboxes are generally developed using several programming languages and interfaced together (Jansson & Moon 2001).These can be difficult to maintain in the long term due to future compatibility issues etc.The toolbox presented in this paper is primarily developed in Matlab to overcome such issues.(https://github.com/wwtmodels/Wastewater-Heat-Recovery-Models).
This paper extends the heat transfer phenomena described in Abdel-Aal et al. (2014) and Abdel-Aal (2015) by including: (i) additional components (sewer pipe temperature is considered as a state variables in addition to the wastewater temperature) to develop an improved one-dimensional heat transfer model for sewer pipes; and (ii) integrating the heat transfer model with a hydraulic flow rate model within the same simulation software.Additionally, a conceptual model based on a reduced set of model parameters and less data requirements is also developed.The model is calibrated and the performance is demonstrated (using the calibration dataset) for small sewer stretches (1.5 km-2.1 km) at two different locations (Malmö, Linköping) in Sweden.Another highlight is that the models are developed with a view towards integrated heat recovery analysis at system-wide scale.Hence, they can be easily integrated with both upstream (wastewater generation) and downstream (WWTP) models as state variables for pollutants are also included in the model.Model performance is evaluated using data for a section of the sewer network from two different cities in Sweden (Linköping and Malmö) with different sewer characteristics and ambient environmental conditions.A detailed comparison of the model results for the mechanistic and conceptual models is made in terms of model performance, model calibration efforts and input data requirements.

Model description
Variations in wastewater temperature and flow rate are described using: (i) a mechanistic model; and (ii) a conceptual model.The models are developed in Matlab ® /Simulink ® .They describe both gravity and pressurized sewer networks.Each model is divided into two sub-models for describing the dynamics of: (i) temperature; and (ii) hydraulics/flow rate.

Mechanistic modelling approach
Temperature sub-model.Temperature dynamics are modelled for the wastewater (T w ) and the sewer concrete pipe (T p ). Figure 1 provides an overview of the state variables and major heat fluxes considered in the model.Sewer concrete pipe temperature is also included as a state variable in the model while only wastewater temperature is described in the existing one-dimensional models (Abdel-Aal 2015).The key processes affecting concrete pipe temperature are based on Dürrenmatt & Wanner (2014)  1. Convective heat transfer between sewer wastewater and in-sewer air in gravity sewers (q wa ) [W] q wa ¼ a wa w ww l p (T w À T sewer-air ) (1) where, α wa [W/m 2 .K] is the heat transfer coefficient between wastewater and in-sewer air, w ww [m] is the width of the wastewater surface in the pipe, l p [m] is the length of the pipe, T w [K] and T sewer-air [K] are the wastewater and in-sewer air temperature, respectively.
2. Heat transfer between wastewater and sewer pipe (q wp,w ) [W] through: (i) forced convection between wastewater and inner sewer pipe wall; and (ii) conduction from wastewater near the inner sewer pipe wall to the centre of the sewer pipe: where, α wp [W/m 2 •K] is the overall heat transfer coefficient between wastewater and centre of the sewer pipe wall, α ww [W/m 2 •K] is the heat transfer coefficient for forced convection due to turbulent flow of wastewater, W p [m] is the wetted perimeter of the pipe, T p [K] is the sewer pipe temperature, k p [W/m.K] is the heat conductivity of the sewer pipe, w t [m] is the sewer pipe thickness, Re w (-) is the Reynolds number and Pr w (-) is the Prandtl number for wastewater flow, λ w [W/m•K] is the thermal conductivity of wastewater and R h,w [m] is the hydraulic radius of the sewer pipe.Equation (4) represents the heat transfer coefficient for turbulent flow with Re w .10,000 and 0.7, Pr w , 160 (Incropera & Dewitt 2002;Dürrenmatt & Wanner 2014).3. Heat flux due to biological activity (modelled using chemical oxygen demand (COD) degradation) (q cod ) [W]: where, r cod [kgCOD/m 3 •s] is the reaction rate, e cod [J/kgCOD] is the reaction enthalpy and V w [m 3 ] is the volume of wastewater in the sewer pipe.
The overall energy balance equation (Incropera & Dewitt 2002) for wastewater at each sewer section is: where, ρ w [kg/m 3 ] is the density of wastewater, V w [m 3 ] is the volume of wastewater, c p [J/kg•K] is the heat capacity of wastewater, Q [m 3 /d] is the wastewater flow rate, T w,in [K] and T w [K] are the input and output wastewater temperatures, respectively.Time (t) is in days.The factor t conv [-] (86,400) transforms the heat fluxes from J/s (W) to J/d to be consistent with the simulation time unit (days).For pumped sewer systems, q wa is set to zero as the pipe is completely filled and no heat transfer takes place between wastewater and in-sewer air.The right-hand side of Equation ( 6) represents the change in heat energy which is given by the difference between incoming and outgoing heat flux and change in heat energy due to heat exchange between wastewaterin-sewer air, wastewatersewer pipe wall and biochemical degradation of COD.
Figure 1 | Overview of the mechanistic temperature sub-model for the sewer system.Key state variables (T w , T p and T s ) and measurements (T sewer-air ) are marked.Major heat fluxes (q wa , q wp , q ps and q cod ) considered in the temperature model are highlighted.For the sewer pipe temperature model (T p ), the main processes considered are: 1. Heat transfer between wastewater and sewer pipe (q wp,p ) [W] through: (i) forced convection between wastewater and inner sewer pipe wall; and (ii) conduction from wastewater near the inner sewer pipe wall to the centre of the sewer pipe: 2. Conductive heat transfer (q ps ) [W] from: (i) centre of the sewer pipe wall to the outer sewer pipe wall; and (ii) outer sewer pipe wall to the soil: where, α ps [W/m 2 •K] is the overall heat transfer coefficient between the centre of the sewer pipe and soil, T s [K] is the soil temperature, k s [W/m•K] is the thermal conductivity of soil and d s [m] is the soil depth considered for heat transfer.
The overall heat balance (Incropera & Dewitt 2002) for the pipe material at each sewer section is: where, M p [kg] is the mass of the concrete pipe and c p,p [J/kg•K] is the heat capacity of concrete.As there is no incoming or outgoing mass flux to the sewer pipe wall, the change in energy is determined by the heat exchange between wastewatersewer pipe and sewer pipesoil.While the density of concrete is directly used in the model, it is possible to modify this into a model parameter to expand the usage of the model for other pipe materials.
Hydraulics sub-model.Wastewater flow rate is modelled using a kinematic wave approximation of the standard St. Venant's Equation (Saint-Venant 1870).The model uses detailed sewer characteristics (pipe diameter, length, slope, etc.) and input data (upstream flow rate, infiltration flow rate).In addition to the flow rate at the outlet of each sewer pipe, the model can also predict other sewer variables (e.g.water height, wetted perimeter, surface area, etc.).These variables are essential to simulate heat transfer phenomena in the sewer system.The volume balance for each pipe is described as: where, V w is the volume of the wastewater in the sewer pipe.Q in [m 3 /d] and Q [m 3 /d] are the input and output flow rates, respectively.
Manning's formula is used to compute outflow based on sewer system characteristics as: where, A [m 2 ] is the cross-sectional area of the flow, R h,w [m] is the hydraulic radius, S o [m/m] is the horizontal slope and η [s•m À1/3 ] is the Manning's coefficient.t conv is used to convert the flow rate units from m 3 /s to m 3 /d.Equation ( 13) can be re-written as: where, Ψ is the section factor [m 8/3 ] (Chow 1959) that is dependent on flow area and pipe geometry.Lookup tables are defined in Rossman (2017) based on Chow (1959) that relate A/A full to Ψ/Ψ full .The value of A can be computed based on Equation ( 12).
A full and Ψ full can be computed based on pipe geometry.The lookup tables are used to identify the value of Ψ and determine the flow rate Q.Similarly, lookup tables also exist that relate A/A full with h/h full that can be used to compute the depth of wastewater in the sewer pipe.
For pumped sewer pipes, input and output flow rates are assumed to be the same and the pipe is assumed to be always full.Consequently, the change in volume dV w dt is zero as the pipe is completely filled and the volume remains constant.Hence, Q(t) is the same as the incoming flow rate Q in .

Conceptual modelling approach
Temperature sub-model.Various major processes considered for describing the energy balance in the sewer system (Equation ( 6)) are lumped into a single heat flux, q sewer [W].
For gravity sewers, the driving force for heat transfer is derived from the difference in the temperature of the wastewater and ambient air temperature T air [K].h sewer,total [W/K] is the heat transfer coefficient: For pumped sewers, the heat transfer is mainly to the sewer pipe and the soil surrounding the pipe.Hence, the driving force for q sewer , is considered as the temperature difference between T w and T s : h sewer,total is considered to be varying based on the flow rate from the sewer section using a Hill function (Hill 1913).Due to its ease of use, such expressions have been used in the urban wastewater modelling as well (Gernaey et al. 2011) to represent complex non-linear processes.It can be considered as an empirical representation that can be used to mimic the process but does not necessarily describe the underlying processes.With a value of 1 for n hill , it is similar to a Monod-like function (Monod 1949), which can represent non-linear behaviour for various biochemical processes.This conceptualization is used to reduce the need for extensive data and model calibration while still being able to maintain reasonable predictive capability (compared to the mechanistic models) for wastewater temperature variations in sewer systems: where, h sewer [W/K] is the maximum heat transfer coefficient, K h [m 3 /d] is the half-saturation coefficient for heat transfer and Q is the flow rate from the sewer section.In order to estimate K h , a correlation between K h and average flow rate (Q avg ) [m 3 /d] is considered.The parameter n flow [-] is more intuitive to calibrate than K h directly, as the latter largely depends on the flow rate for a particular section: The energy balance for a sewer stretch (Incropera & Dewitt 2002) is now described as: where, V res is the volume of the sewer section.
Flow rate sub-model.The hydraulic model described in the mechanistic model is replaced with a conceptual linear reservoir model that can describe the variation in output flow rate of a reservoir as a function of its volume.The volume balance is described as: where, K res [d À1 ] is the model parameter that defines the residence time of the sewer section and V res [m 3 ] is the volume of wastewater in the particular section.As in the case of the hydraulic flow model, for the pumped system, Q(t) equals Q in and no volume balance is required.A series of reservoirs is used to represent a sewer system.The number of reservoirs in series is a model calibration parameter.
In both approaches, the model combines both flow rate and temperature dynamics in the same simulation software allowing for easy integration with wastewater generation and treatment plant models that will allow for a city-wide evaluation of heat recovery possibilities.

Case study details
Both models are evaluated for sewer sections in two different Swedish cities (Linköping and Malmö).
In Linköping, data are collected from an isolated (no additional connections along the stretch) sewer pipe of 2.1 km between two pumping stations.The first 200 m is a pumped system with a pipe diameter of 225 mm and the rest is a gravity system with a pipe diameter of 400 mm (Table 1).Temperature sensors are installed at the upstream and downstream pumping stations.Flow measurements already exist for these locations.
For the city of Malmö, a 1.5 km stretch is chosen.Temperature and flow rate measurement equipment already exists at the downstream sewer point.Sensors for wastewater and in-sewer air temperature are installed at the upstream point.No infiltration flow is assumed.Also, no additional connections are assumed between the upstream and downstream points as a model simplification.The upstream flow rate is much higher than the combined flow rate arising from connections in between the two pipes and hence the assumption is considered to reduce model complexity and additional data requirements.
The location for data collection in both the cities is determined based on practical aspects like ease of sensor installation and maintenance, limited cross-connections and pre-existing sensor availability (flow rate and temperature).The measurement campaigns are planned so that data are collected during the relatively colder periods of the year when heat recovery is of greater interest, heat transfer is higher due to the larger difference between wastewater and in-sewer air temperatures and WWTP processes are more sensitive to changes in wastewater temperature.The model performance was evaluated from 10 March to 26 March 2019 for the Malmö case study.Two evaluations periods are considered for the Linköping case study, 28 November to 4 December 2019 and 13 February to 23 February 2020.For the temperature measurements, encapsulated thermistor probes (Figure 2(a)) with a 10-meter cable (PB-5015-10M), which can record temperatures from À40 °C to þ105 °C + 0.2 °C, are used.While this is a broad measurement range, the accuracy of + 0.2 °C is sufficient for the case studies.These probes are connected to waterproof (IP68) data loggers (Tinytag Plus 2 TGP-4020) (Figure 2(b)), which store the measurements at 5-minute intervals.The sensors and loggers used in Linköping were verified against a calibrated reference thermometer for quality control.Field visits are made to procure data using a custom software (EasyView) from the manufacturer.The temperature probes are installed to ensure that they are always submerged in the wastewater but do not touch the sewer pipe.The sensors have provided reliable data.Occasionally, data quality issues are noticed due to debris attaching to the sensors mainly during wet weather events.Overall, the maintenance and data quality issues are not considered to be very high.

Evaluation criteria
Three different evaluation criteria were used to summarize the model performance.Sewer wastewater temperature at the downstream location of the sewer stretch from the model output and data are represented by y and d, respectively.N is the number of observations.These metrics are widely used in the environmental modelling field for model evaluation (Bennett et al. 2013).The metrics together capture both large errors (RMSE, MAE) as well as indicate the average model performance (MeAE), all in the same units as the model outputwastewater temperature, making it easy to interpret the results: 1. Root mean squared error (RMSE)

Linköping
Two different datasets from Linköping are presented here.The first dataset is from November 2019 and the second from February 2020.The model uses upstream flow rate and sewer wastewater temperature as inputs.A constant (assumed) in-sewer air temperature of 10.5 °C is used for the first dataset.Measured in-sewer air temperature is used for the second dataset.The constant in-sewer air temperature for the first dataset is determined in three steps: 1. the difference between the mean ambient air temperatures for the two datasets is measured; 2: this value is subtracted from the mean in-sewer air temperature (measurements available) for the second dataset; and finally; three.the value is finally fine tuned based on simulation results.As no soil temperature measurements are available in the region, soil temperature is considered as a calibration parameter and assumed to be 5 °C and 4 °C for the first and second datasets, respectively.These values are within the range noticed in other studies from Sweden (Forsberg et al. 2012;Kjellander 2015).Other model parameters remain the same for both datasets (Table 2).Sewer characteristics (pipe diameter, slope, Manning's coefficient) are used for the hydraulic model and no further calibration is performed.A direct comparison of modelled and actual downstream flow rates is difficult as the downstream flow measurement is from a pumping station which is turned on/off intermittently.Hence, only a general trend can be observed.For the temperature sub-model calibration, the starting values for the model parameters are assumed from existing literature (Table 2).While the parameters h wa , k p , k s , w t and d s have all been further calibrated in a heuristic manner, the COD degradation parameters (e cod , r cod ) are left at their default values as changes to these parameters did not offer any improvements in the overall model prediction.This also confirms results from other studies (Elías-Maxil et al. 2017), which conclude that the COD degradation processes are not significant contributors to wastewater temperature variation in the sewer system.
For both datasets, the mechanistic model provided good predictions of the variations in wastewater temperature at the downstream sewer section (Figure 3; Table 3).For the first dataset, downstream wastewater temperature data from day 1 is very noisy.This could be due to accumulation of dirt on the temperature sensor or its placement in the wastewater and is corrected by the subsequent maintenance.Hence, the maximum prediction error is higher at 2.30 °C compared to 1.11 °C for Dataset2.Major model discrepancy for Dataset2 occurs during the end of the evaluation period for MAE (1.11 °C) where the downstream wastewater temperature predictions are much lower than the measurements.During this  The conceptual model is also calibrated for the two datasets described above.The flow rate sub-model is first calibrated followed by the temperature sub-model.As the downstream flow rate data cannot be used directly for calibration (as it is from a pumping station with intermittent on/off pumping), the flow rate prediction from the hydraulic sub-model is used for calibration of the residence time and the number of reservoirs in series.This is followed by calibration of the temperature   The heat transfer rate for the two datasets is different in order to compensate for the varying environmental conditions in November and January.
The flow rate prediction from the conceptual model is almost identical to that of the mechanistic model (Figures 5(a) and 5(c)).As this paper mainly describes dry weather scenarios in sewer systems without any significant backwater effects, flooding etc. the conceptual model is expected to perform very well as confirmed from several other studies (Fischer et al. 2009).
In spite of the major simplifications, the temperature model does offer a good predictive capability for the downstream sewer wastewater temperature.The MAE (2.43 °C, 0.94 °C) is higher for both datasets mainly due to noisy data for Dataset1 (Figure 5(b)) and the in-sewer air temperature discrepancy in Dataset2 (Figure 5(d)).RMSE and MeAE are low for both datasets (Dataset1 -0.32 °C, 0.15 °C; Dataset2 -0.20 °C, 0.16 °C).This confirms that the conceptual model is able to capture all the major heat transfer phenomena.While the use of in-sewer air temperature data is possible in this case due to availability of measurements, an alternative approach could be to use the outside air temperature.In such a case, it is expected that the prediction capability of the model will go down slightly as the correlation between in-sewer air temperature and downstream wastewater temperature is higher than that between ambient air temperature and downstream wastewater temperature in the sewer system (Figure 4(b)).

Malmö
Sewer wastewater temperature and flow rate measurements from March 8 to March 26 2019 are used for model calibration.Soil temperature is assumed to be 8 °C.As there are limited data on soil temperature, it is treated as a model calibration parameter.However, it is ensured that these values are within the range noticed in other studies from Sweden (Forsberg et al. 2012;Kjellander 2015).As the flow rate measurement is only available at the downstream point, the downstream flow rate information is used as model input (representing the upstream flow rate).As it is a fairly short sewer stretch, it is concluded that this minor inaccuracy in flow rate predictions will not significantly affect the wastewater temperature predictions.Figure 6(a) confirms that the flow rate variation between the upstream and downstream points is not significant and supports the assumption made during model calibration.A similar calibration approach as described for the Linköping case study is applied.The variations in model parameters between Linköping and Malmö can be attributed to various aspects like soil properties, pipe conditions, incoming flow rate, pipe dimensions and other environmental factors.However, these variations are within reasonable ranges based on existing literature (Table 2).Variation in thermal conductivity of concrete (Asadi et al. 2018) and soil (Sundberg 1988) are within the range of the calibrated values.
The results show that variations between upstream and downstream sewer wastewater temperature measurements are reasonably well predicted by the model (Figure 6(b)).The MAE is 1.16 °C, which is a result of poor prediction during night-times.RMSE and MeAE are 0.40 °C and 0.31 °C, respectively (Table 3).The higher values for these two evaluation criteria compared to the Linköping case study are also mainly due to the lower predictive capability during night-times.The sewer wastewater temperature prediction deteriorates during night-time as shown in Figure 6(b).Several factors are hypothesized to explain this discrepancy: (i) model deficiency in describing the soil heat transfer dynamics; (ii) additional flows that are connected to the sewer stretch used in the case studyit was noted that additional flows reached the downstream manhole during the data collection period but it was unfortunately not possible to ascertain the extent of these flows.
For the conceptual model, the flow rate prediction from the hydraulic model is used for flow rate sub-model calibration (Figure 7(a)).The flow rate model is first calibrated using the parameter K res and number of reservoirs in series using a trial-and-error approach method.The temperature model is then calibrated.The n flow value is kept the same as in the Linköping case and h sewer is varied.A good initial estimate of h sewer can be derived by using the h wa value from the mechanistic model.Assuming that the total heat transfer coefficient (which is h sewer ) equals h wa Â diameter Â length gives a good initial estimate of h sewer which can be further refined.The model results from the conceptual model are also quite similar to those of the detailed model (Figure 7(b)).The MAE is 1.30 °C while RMSE and MeAE are 0.44 °C and 0.34 °C, respectively.The discrepancies with the model prediction for downstream sewer wastewater temperature during night-times are also observed in the conceptual model.However, it is important to note that the accuracy of the temperature sensors is + 0.2 °C.Several factors affect the extent of sewer wastewater temperature loss (ambient air temperature, flow rate, pipe characteristics, infiltration flow, etc.).In neither case infiltration flow is included.It is assumed that the contribution from infiltration will be marginal (for the short distances considered here) in comparison to the wastewater flow rate from the upstream sewer network.The model naturally includes components to describe such extraneous flows, if required.

Comparison between the detailed and conceptual modelling approaches
In terms of data requirements, both models need upstream and downstream sewer wastewater temperature as well as flow rate data.While only upstream measurements are sufficient for simulations, downstream measurements are needed for model calibration.For smaller sewer stretches, flow rate data at either one of the ends can also be sufficient (when there are no major additive flows in between).The mechanistic model requires in-sewer air temperature while the conceptual model can either use in-sewer air temperature or outside air temperature data.The mechanistic model and the conceptual model for pumped sewer systems also need soil temperature.However, this temperature is difficult to obtain and has been used as a model parameter instead.A constant soil temperature is assumed, as the variation in soil temperature is not significant (Abdel-Aal et al. 2019) for the short simulation durations and sewer pipe depths (2-3 m below ground) used in this study.In addition, the mechanistic model needs information about the sewer pipes (diameter, lengths, slope etc.) while the conceptual model uses model parameters instead and no extensive sewer characteristics data are needed.The mechanistic model includes seven model parameters (the starting point for several of these parameters can be obtained from existing literature) while the conceptual model only has three parameters that need to be estimated.Two for the temperature sub-model and one for the flow rate sub-model.
In terms of predictive capability, no major drop in predictive capability is observed in the conceptual model vis-à-vis the mechanistic model (Figure 8).In principle, the evaluation criteria are marginally better for the conceptual model when compared to the mechanistic model for the Linköping data and vice-versa for the Malmö data.It can be concluded that the conceptual model can offer the same predictive capability as the mechanistic model despite the reduced model complexity, lower input data requirements and fewer model parameters.

Model application for heat recovery studies
Both models have demonstrated the ability to successfully describe wastewater temperature dynamics in a sewer network.During the model development, ease of integration with other modelling tools used for urban city-wide heat recovery studies is taken into consideration.The model can be directly integrated with models generating household wastewater flow rate and temperature profiles with varying levels of complexity (Sitzenfrei et al. 2017;Wärff et al. 2020) and heat recovery models.The model outputs from the sewer network can be easily integrated with standard wastewater treatment process models (which is essential to study the effect of heat recovery at household or sewer network level on the wastewater treatment plant performance).Work is currently in progress towards integrating all the sub-models (wastewater generation, sewer heat transfer, WWTP and heat recovery equipment) for a city-wide study of Linköping.The model also includes several pollutant state variables that are transported through the sewer network.Currently, only transport of pollutant state variables is considered.A simplified COD degradation (first-order kinetics) is used in the mechanistic model and no biological degradation is considered in the conceptual model.However, the model framework provides the possibility to expand the sewer network model to include biological transformations as well.

Model limitations
The soil temperature data are not available and a constant value is used as a calibration parameter.Such an approach is only justified for shorter simulation periods when soil temperature does not vary significantly.For long-term simulations, more information about the soil temperature variation will be required.Furthermore, both case studies are mainly gravity sewer systems (only a small pumped sewer system in the Linköping case study), hence the model predictions for the pumped system model should be further examined.In addition, the model predictions should be evaluated for a longer time series as well as for a larger sewer network in the future to demonstrate the model capability for city-wide studies.This will also allow us to use separate datasets for model calibration and validation.In the current study, the model performance is evaluated only for the calibration period due to limited data availability.Lastly, both case studies are selected for predominantly dry weather periods.The model does not include the influence of rainwater inflow/infiltration on sewer wastewater temperature (although it is possible to extend it, if required).In terms of application for heat recovery studies, the model cannot directly use energy recovery values as inputs.It is, however, possible to compute energy recovery by coupling the model with heat exchanger models (Arnell & Saagi 2020).Application of both models for several other case studies will throw more light on the model capability, calibration efforts and limitations.

CONCLUSIONS
Two one-dimensional models (mechanistic and conceptual) describing wastewater temperature and flow rate dynamics in sewer systems are developed.The model toolbox offers the choice of either using a conceptual or mechanistic approach to describe both flow rate and wastewater temperature in the same simulation software and can be easily integrated with other upstream and downstream models (Wärff et al. 2020;Arnell et al. 2021) in the urban wastewater system for analysing heat recovery potential and other aspects where the temperature dynamics of the wastewater is of specific importance.The models are applied to describe wastewater flow rate and temperature dynamics for two sewer stretches from different cities in Sweden (Linköping and Malmö).Model performance determined by the root mean squared error is good for both the case studies while using the mechanistic (Linköping Dataset1 -0.33 °C; Linköping Dataset2 -0.28 °C; Malmö -0.40 °C) as well as the conceptual (Linköping Dataset1 -0.32 °C; Linköping Dataset2 -0.20 °C; Malmö -0.44 °C) modelling approach.The slightly lower performance in the Malmö case study is due to the lower ability of that model to describe night-time wastewater temperature variation.The performance of the mechanistic and conceptual model is virtually identical.This is encouraging and makes a strong case for further research on the application of the conceptual model for city-wide case studies.A freely distributed, open-source toolbox containing all the models is available for interested users.The next step will be to evaluate the model for several other scenarios (long time series, different geographical locations, pumped sewer systems) to produce an even more comprehensive evaluation of the model performance and its limitations. ABBREVIATIONS and are simplified for a one-dimensional representation.Major phenomena describing temperature dynamics for wastewater in the sewer system are Abdel-Aal et al. (2014); Dürrenmatt & Wanner (2014); and Elías-Maxil et al. (2017):

Figure 2
Figure 2 | (a) Thermistor probes for temperature with a weight attached to it for submerging in water.(b) Data logger connected to the thermistor probe recording temperature measurements at a pre-defined interval of 5 minutes.Please refer to the online version of this paper to see this figure in colour: http://dx.doi.org/10.2166/wst.2021.425.
period, there is a drop in the in-sewer air temperature (which results in lower downstream wastewater temperature prediction) while there is no noticeable change in the upstream and downstream wastewater temperature measurements (Figure4(a)).It is unclear from the available data (flow rate measurements, wastewater temperature) if the drop in the insewer air temperature is a measurement error or due to some other factors, e.g.disturbances that are not captured by the model or the data.The overall model predictions captured through RMSE and MeAE are very similar for Dataset1 (0.33 °C, 0.22 °C) and Dataset2 (0.28 °C, 0.21 °C).

Figure 3 |
Figure 3 | Comparison between measured data and simulation results (mechanistic model) for downstream wastewater temperature from a sewer pipe for a 5-day period from two different datasets that are used for model calibration (a.Dataset1 and b.Dataset2) from Linköping, Sweden.Please refer to the online version of this paper to see this figure in colour: http://dx.doi.org/10.2166/wst.2021.425.

Figure 4
Figure 4 | (a) Measured in-sewer air temperature variation compared to the measured downstream sewer wastewater temperature for Linköping Dataset2.(b) Comparison of the measured downstream sewer wastewater temperature with the measured in-sewer air temperature and ambient air temperature.Please refer to the online version of this paper to see this figure in colour: http://dx.doi.org/10.2166/wst.2021.425.

Figure 5 |
Figure 5 | Conceptual model performance for a 5-day period for the flow rate sub-model (Dataset1a; Dataset2c) compared with wastewater flow rate predictions from the hydraulic model and temperature sub-model in terms of sewer wastewater temperature (Dataset1 b; Dataset2d) for the Linköping case study.Model calibration is done separately for both datasets.Please refer to the online version of this paper to see this figure in colour: http://dx.doi.org/10.2166/wst.2021.425.

Figure 6
Figure 6 | (a) Comparison between downstream flow rate data (used as upstream flow rate measurement for the model) vs. the predicted model flow rate from the mechanistic model.(b) Comparison between measurements (upstream and downstream sewer wastewater temperature) and mechanistic model results (5-day period) for the 1.5 km sewer stretch in Malmö.Please refer to the online version of this paper to see this figure in colour: http://dx.doi.org/10.2166/wst.2021.425.

Figure 7 |
Figure 7 | Conceptual model performance for the flow rate sub-model (compared with the flow rate prediction from the hydraulic model) (a) and temperature sub-model (compared with sewer wastewater temperature measurements) (b) for the Malmö case study for a 5-day interval.Please refer to the online version of this paper to see this figure in colour: http://dx.doi.org/10.2166/wst.2021.425.

Figure 8 |
Figure 8 | Comparison between mechanistic and conceptual models for predicting downstream sewer wastewater temperature in Linköping Dataset2 (a) and Malmö (b).Please refer to the online version of this paper to see this figure in colour: http://dx.doi.org/10.2166/wst.2021.425.
Please refer to the online version of this paper to see this figure in colour: http://dx.doi.org/10.2166/wst.2021.425.

Table 1 |
Overview of the sewer system characteristics for measurement locations in the cities of Linköping and Malmö in Sweden

Table 2 |
Major calibration parameters for both mechanistic and conceptual sewer heat transfer models.

Table 3 |
Model performance evaluation for the different case studies in terms of root mean squared error, maximum absolute error and mean absolute error for the downstream sewer wastewater temperature