A framework for modelling in-sewer thermal-hydraulic dynamic anomalies driven by stormwater runoff and seasonal effects

Rain-induced surface runoff and seasons lead to short-to medium-term anomalies in combined storm-and wastewater flows and temperatures, and influence treatment processes in wastewater resource recovery facilities (WRRF). Additionally, the implementation of decentralized heat recovery (HR) technologies for energy reuse in buildings affect energy-related processes across the urban water cycle and WRRFs heat inflows. However, quantitative insights on thermal-hydraulic dynamics in sewers at network scale and across different scales are very rare. To enhance the understanding of thermal-hydraulic dynamics and the water-energy nexus across the urban water cycle we present a modular framework that couples thermal-hydraulic processes: i) on the surface, ii) in the public sewer network, iii) in households (including in-building HR systems), and iv) in lateral connections. We validate the proposed framework using field measurements at full network scale, present modelling results of extended time periods to illustrate the effect of seasons and precipitation events simultaneously, and quantify the impact of decentralized HR devices on thermal-hydraulics. Simulation results suggest that the presented framework can predict temperature dynamics consistently all year long including short-to long-term variability of in-sewer temperature. The study provides quantitative evidence that the impact of household HR technologies on WRRF inflow heat budgets is reduced by approximately 20% during wet-weather periods in comparison to dry-weather conditions. The presented framework has potential to support multiple research initiatives that will improve the understanding of the water-energy nexus, pollutant dispersion and degradation, and support maintenance campaigns at


Introduction
Rain-induced surface runoff and seasons significantly influence the hydraulic loading but also water temperature dynamics in combined sewers, treatment processes in wastewater resource recovery facilities (WRRFs), and consequently the water-energy nexus across the urban water cycle. Therefore, it is important to improve the understanding of thermal-hydraulic dynamics across seasonsincluding weather events such as precipitationin order to inform state authorities and support (i) common practices towards carbon-neutral wastewater treatment (90% of wastewater contained energy is thermal energy (Hao et al., 2019)), (ii) the reuse of energy for building heating (e.g. with the implementation of decentralized heat recovery technologies) and, (iii) consequently, a reduction of energy consumption across the urban water cycle (Frijns et al., 2013;Elías-Maxil et al., 2014).
Rainwater lead to fluctuations in the temperature of combined storm-and wastewater flows caused by stormwater discharges in sewers (Montserrat et al., 2013). These occasionally abrupt changes in temperature, i.e. "thermal shocks", propagate through the sewer system, and in case of sewer overflows may considerably affect receiving streams and their aquatic organisms (Caissie, 2006;Herb et al., 2008;Cao et al., 2016;Ketabchy et al., 2019;Tsang et al., 2021). In addition, temperature fluctuations can affect pollutant dispersion of heavy metals (Li et al., 2013) and illicit drug degradation (Thai et al., 2014) in sewer systems. In order to predict thermal shocks in sewer and drainage systems, a model that couples thermal-hydraulic processes on the surface and subsurface is required. (Ketabchy et al., 2018; proposed an approach to model the routing of stormwater and heat load through urbanized watersheds. However, the main drawback of the coupling approach presented by Ketabchy et al. is that it does not maintain heat load balances across urbanized watersheds. Other available models for modelling thermal loading of stormwater runoff are TRMPAVE (Van Buren et al., 2000) and the Thermal Urban Heat Export Tool (Roa-Espinosa et al., 2003); however, these models have not been extensively validated.
Decentralized heat recovery (HR) technologies are an inexpensive and easy to implement solution for energy reuse in buildings (Hadengue et al., 2022c). They include systems such as vertical and horizontal water heat exchangers in showers or sinks, and heat pumps amongst other systems (Nagpal et al., 2021;Hadengue et al.,. 2022), and their performance can be affected by climate conditions and seasons (Hadengue et al., 2022c). For instance, during warm seasons there are less hot showerswhich are events with a large energy consumption share in households (Hadengue et al., 2020) -compared against cold seasons The implementation of decentralized HR devices impact not only energy-related processes across the urban water cycle (such as the efficiency of heat pumps installed in precincts or subcatchments (Golzar and Silveira, 2021)), but also WRRF heat inflows (Sitzenfrei et al., 2017). In their research, the authors developed modelling tools based on data-driven algorithms, stochastic demand approaches and mathematical modelling to quantify the effect of heat recovery technologies. These studies concluded that there are competitive interactions between in-building and urban-level heat recovery systems and shared their growing concern about these practices and the impact on WRRFs, and suggested that further legislation is needed to achieve improved energy efficiency at the city level. However, the authors did not consider important elements such as private lateral connectionspipes connecting buildings to the public sewersand topographic conditions. A different approach has been presented by Hadengue et al. (2021), where physical and stochastic processes were coupled to estimate the thermal-hydraulic dynamics of coupled sewer networks, households and lateral connections. Hadengue et al. (2021) identified thermal damping mechanisms due to the existence of lateral connections and hypothesized about the impact of decentralized heat recovery strategies on WRRF heat inflows across seasons. However, it remains unclear how, during wet weather periods, in-building heat recovery systems affect the wastewater temperature at the WRRF.
Furthermore, there is a lack of investigations on the simultaneous effect of stormwater, seasons and decentralized HR technologies on WRRF inflow heat budgets. Lower temperatures in sewers imply potential nitrification deficiencies (Wanner et al., 2005) and temperature layering in the sludge settling (Winkler et al., 2012;Liao et al., 2011). In addition, seasonal characteristics such as ambient and soil temperature influence domestic wastewater treatment as well, for instance, Gruber et al. (2020) detected a strong seasonal profile of nitrous oxide (N 2 O) emission from wastewater treatment at WRRFs. Furthermore, Arora & Kazmi (2015) concluded that the highest biochemical oxygen demand (BOD), chemical oxygen demand (COD) removal efficiency and the best performance of pathogen removal indicators were accomplished during seasons with high temperature. Therefore, the accurate prediction of influent temperature dynamics -coupled with WRRF-wide energy modelling concepts (Arnell et al., 2021)-would thus enable WRRF operators to optimize treatment capacity management.
In the present study we aim at quantifying the simultaneous effect of precipitation, seasons and decentralized heat recovery technologies on combined storm-, wastewater temperatures across sewer networks, up to the inflow into the WRRF. Therefore, we present a framework that models the complex coupling of thermal-hydraulic processes on the surface (across pervious and impervious surfaces), the subsurface (sewer networks), households (including in-building heat recovery systems) and lateral connections (linking households to the public sewer network). The novelty of this framework lies in the technical integration of surface/subsurface thermal-hydraulic processes with stochastic water consumption models and domestic hot water systems (Kenway et al., 2013;Hadengue et al., 2020), to simulate extended periods (i.e. more than a few days) and illustrate the combined effect of seasons and precipitation events on in-sewer temperatures. In addition, we validate the proposed framework against field measurements at full network scale, present modelling results of extended time periods (including precipitation events), and investigate the thermal-hydraulic influence of decentralized heat recovery devices in sewer networks under both wetand dry-weather conditions.
The manuscript is structured as follows: _ Section 2 describes the proposed framework including details on each modelling module and how the different components of the framework are coupled. _ Section 3 details the validation case, the specifics of the validation method and how the impact of heat recovery during wet weather has been evaluated. The section also provides details on reference measurements and performance indicators utilized. _ Section 4 presents the validation results and a critical discussion of the limitations of the proposed modelling framework. _ Section 5 encompasses the results and discussion of the performed analysis on the impact of decentralized heat recovery devices on WRRF heat inflows during wet weather. _ Section 6 includes detailed references for potential uses and future work of the modelling framework.

Model framework
With the aim of modelling thermal shocks on wastewater from stormwater runoff and seasonal variations with high spatiotemporal discretization, we developed a Python/Matlab based modelling framework that computes thermal-hydraulics of stormwater runoff, wastewater produced in domestic hot water systems, wastewater transported in lateral connections and routed through main sewers. The Masterfile of the framework is written in Python and launches all the different modelling tools and Matlab executable files required to perform simulations. The framework integrates several calculation modules: MINU-HET, WaterHub and SWMM-HEAT. MINUHET is a FORTRAN computational tool designed with the purpose of simulating flow and heat content of stormwater surface runoff through a watershed and drainage networks (Herb et al., 2008a, b;Janke et al., 2009;. WaterHub is a stochastic water demand model and thermal-hydraulic simulation tool of domestic hot water systems (Hadengue et al., 2019(Hadengue et al., , 2020 written in Python and the Modelica language (Mattsson and Elmqvist, 1997). SWMM-HEAT is an open-source code that enhances the EPA-SWMM model with the necessary thermal components to simulate the evolution of temperature in drainage networks during dry and wet weather conditions . The Matlab executable files developed for this framework perform tasks related to synchronization of time series, mixing of flows and temperature, and post processing of I/O files.

The WaterHub /MINUHET/SWMM-heat framework
The established framework couples automatic modelling of household water consumption time series, household lateral connections, and thermal-hydraulic processes of stormwater runoff and routing across combined sewer systems. The framework can simulate various scenarios at households or sewer level, including the implementation ofdecentralized or centralizedheat recovery devices. Fig. 1 shows how the modelling of various compartments of the water urban cyclefrom households to the inflow into the WRRFare coupled in the framework. In the next subsections we detail the processes in each of the framework's modules and how they are connected as part of a larger simulation workflow.

Modelling household thermal-hydrographsthe WaterHub framework
We use the WaterHub modelling framework (Hadengue et al., 2019(Hadengue et al., , 2020, to obtain thermal-hydrographs of household water consumption behaviours, i.e. wastewater temperature and flow-resolved time series of single households. The coupling between WaterHub and SWMM-HEAT is already validated in Hadengue et al. (2021) as part of a study aiming at assessing the thermal impact of private lateral connections and the implementation of decentralized heat recovery strategies at catchment scale. The main limitation of WaterHub is the inability to adapt water demand patterns depending on the season and day of the week (i.e. weekdays and weekends). In previous studies, the maximum time period studied was five days; in the present investigation, we extend the temporal scope of thermal-hydraulic simulations to one month.
In Hadengue et al. (2021), the modelling of hot water systems within households was simulated using stochastic water demand patterns as input to a first-principle thermodynamic model. The longer simulation time periods of the present study, though, do not allow repeating the procedure due to the much larger overall computation time. In order to generate monthly flow and temperature time series for a large number of households, we implemented a new procedure: original five-day simulations, from Hadengue et al. (2021), were split and merged into a dataset of daily time series. Monthly time series are then produced by "stitching" together daily time series randomly selected from the dataset, thereby largely reducing the computation time. Further details about the implementation and reproducibility of the results obtained with this approach are described in the Supplementary Information (SI) -Section A and in the framework validation section (Section 3.3).

From a SWMM-heat input file to surface thermal runoff simulations with MINUHET
Aiming at minimal parametrization work for future users, we developed a Matlab routine, which performs automatic set-up and execution of MINUHET simulations based on a typical SWMM/SWMM-HEAT input file (.INP file). Here we summarize the main steps implemented in the Matlab routine: 1) Information regarding subcatchment properties (e.g. area, width, percentage of pervious and impervious surfaces, slope, land use, and outlet node) is collected from the SWMM/SWMM-HEAT input file. 2) The extracted information is processed and individual files representing pervious and impervious areas (with .dat format required by MINUHET) are created for each subcatchment. 3) Air temperature, relative humidity, solar radiation, wind speed, precipitation and cloud cover fraction datasets are collected and synchronized and a 'storm' file utilized by MINUHET for the simulations is generated (Herb et al., 2010). 4) A batch file is created for each subcatchment to automatically launch MINUHET pervious, impervious and mixing simulations. The batch file is then executed and runoff flow and temperature information of each subcatchment is stored in individual files. 5) Simultaneously, a "runoff-only" simulation is performed with SWMM-HEAT in order to obtain the outflows of each subcatchment during precipitation events. 6) Once all simulations are finished, a final step merges thermalhydraulic flows from MINUHET and SWMM-HEAT. Since different subcatchments could have the same outlet node, it is necessary to combine flows (SWMM-HEAT) and temperature (MINUHET) datasets generated in the previous steps into a unique flowtemperature time-series for each node.
The process above generates two files for each subcatchment outlet containing flow and temperature time series. These files represent the surface runoff compartment in the final catchment simulation with SWMM-HEAT. A detailed representation of the framework folder structure is shown in SI - Fig. 3.

Merging water and heat flows from surface runoff and households
The last step before the final routing simulation includes the synchronization and aggregation of previously generated temperature and flow time series of household / lateral connections with surface runoff, based on the information provided in the SWMM-HEAT input file. Consequently, two time-series files are obtained that represent total heat flow (temperature and flow) that enters the sewer network at each inflow node. In addition, SWMM-HEAT has the ability to include groundwater heat flow infiltration into the system as time patterns. The mixing process of different inflows (i.e. time series and time patterns) at the network node scale is handled internally by SWMM-HEAT.

The Fehraltorf SWMM-heat model
In this investigation, we focus on the reproduction of wastewater temperature dynamics along the main collector in the sewer network of the Swiss municipality of Fehraltorf, located 12 km Northeast of Zurich, Switzerland, which comprises 27.1 km of sewer pipes. In this network system, the wastewater from Fehraltorf and two neighbouring municipalities is conveyed to the central WRRF (design capacity: 12,000 PE). For more information regarding the implementation of the infrastructure data in SWMM-HEAT, inflows from neighbouring municipalities, groundwater infiltration and industrial wastewater inflows we refer to Hadengue et al. (2021) and Figueroa et al. (2021). During dry weather conditions, transfer flows from the two adjacent municipalities account for 36% of the total wastewater inflow at the treatment plant. Groundwater infiltration contributes up to 15% -not considering seasonal fluctuations-, industrial wastewater to about 21% and residential wastewater from households located within the municipality of Fehraltorf up to 28%.

Field measurements and climate data
Reference data were collected during a long-term monitoring campaign that operates measurement stations with dual in-sewer sensors for the simultaneous recording of wastewater and sewer headspace temperature at multiple locations across the Fehraltorf catchment. Fig. 1. From households to the inflow into the WRRF. A Python Master Script automatically handles the simulation workflow including: calling all the different simulation modules and Matlab executable files for the analysis, synchronization and preparation of I/O files. The WaterHub modelling tool (WH) provides flow and temperature time series of wastewater produced by households using a stitching procedure. Households are aggregated and flows transported to the sewer network via lateral connections using SWMM-HEAT. During precipitation events, flow dynamics are modelled with SWMM-HEAT, while temperature dynamics are estimated with MINUHET. Afterwards, flow and temperature time series from surface runoff and lateral connections are synchronized and aggregated at the inflow nodes of the sewer network. In addition, groundwater infiltration is defined in SWMM-HEAT with monthly flow and temperature patterns. In this figure, flow time series/patterns are in blue and temperature time series/patterns are in red. Recommended temporal resolutions of the different simulation modules are included.
Further details, including sensor distribution within the network, are described in Blumensaat et al. (2021) and Figueroa et al. (2021). MIN-UHET and SWMM-HEAT coupled simulations require information regarding solar radiation, relative humidity, cloud cover, wind speed, atmospheric temperature and precipitation. These data are collected from sensors deployed in the subcatchment and in the surrounding areas. Precipitation measurements with a frequency report of one minute are collected using a weight-based all-weather precipitation gauge (Fa. OTT, Pluvio II), that measures the amount and intensity of rain. Solar radiation, wind speed, air temperature and relative humidity data are recorded with a one minute resolution employing a compact weather station (Fa. LUFTT, WS-700), that allows measuring multiple parameters. Cloud cover information is provided by MeteoSwiss and collected with a ten minutes resolution from the surrounding area of Kloten, Zurich, app. 10 km West of Fehraltorf. After collecting the data, the data are aggregated and synchronized with a one minute resolution, and all inconsistencies are filtered with a Hampel filter (SI - Fig. 4). A 'storm' data file (required by MINUHET) is then automatically generated and utilized to perform thermal-hydraulic runoff simulations.

Soil characteristics and soil temperature
Month-long simulations require adequate soil temperatures values reflecting seasonal dynamics throughout the year. Since SWMM-HEAT requires a monthly soil temperature pattern, we determined average monthly soil temperature from soil temperature measurements and simulation studies from a location near Fehraltorf (SI - Fig. 6). The soil type is sandy clay loam and soil thermal-hydraulic properties values required by SWMM-HEAT and MINUHET are presented in Table 1. The Green-Ampt infiltration method (Rossman and Huber, 2016) was used in the SWMM-HEAT and MINUHET simulations.

Performance indicators
The modelling results considered for the comparison with field measurements are the bulk liquid temperature and the flow at different locations in the main sewer. The metrics used for the assessment of the simulation results include the maximum, average, root mean square error (RMSE) and the ratio of the RMSE to the standard deviation of measured data, also named "RMSE-observations standard deviation ratio" (RSR).

RSR
RSR is a metric proposed by Moriasi et al. (2007) for hydrologic simulations that incorporates the benefits of RMSE error index statistics and includes a normalization factor.

Framework validation
The validation study focused on four different periods of 20-30 days in 2019 (see Table 2). The selection of these periods is distinct and motivated to reflect both, different seasonal characteristics and representative rainfall events. We compare modelling results with stationary measurements at five different locations (see sensor location in SI- Fig. 7). In addition, three analyses are performed to provide insights regarding, i) the impact of weekdays and weekends on RSR and RSME metrics, ii) the effect of short-and long-term precipitation events on combined waste-and stormwater temperature in sewers, and iii) the spatial distribution of temperatures in sewers during wet weather.
In addition, in order to accurately estimate monthly flow and temperature time series for all households in Fehraltorf we implemented the stitching procedure described in Section 2.2. For each simulated scenario (detailed in Hadengue et al. (2021)), we produced a dataset of around 20 ′ 000 different daily time series (32 ′ 000 for the reference scenario). To account for the number of inhabitants in a single household, each dataset was further split into five separate categories of ascending total flow volumes representing systems from one-person up to five-people households. Each of the 4046 households in Fehraltorf was then simulated by selecting a number of inhabitants based on the Swiss household distribution (Bundesamt für Statistik, 2018) and randomly selecting daily time series from the corresponding category in the dataset. In this study, we selected a time resolution of three seconds for the household / lateral connection system, a value found as a good compromise to minimize computation time while retaining information from high-frequency, short water draw-offs. MINUHET simulations are performed with a time resolution of 1 min during wet conditions and 5 min during dry conditions. SWMM-HEAT simulations of the Fehraltorf sewer network are conducted with a time step of 15 s.
We tested the new procedure thoroughly to guarantee the statistical significance of the generated time series with data from Hadengue et al. (2021). We studied the convergence of the 95% interval and median of the heat budget curve for various dataset sizes (250, 500, 1000 and 2000 available daily time series). Full results are shown in SI -Section A. Even with a low number of available daily time series (250 time series), convergence was acceptable compared to larger datasets. We thus conclude that the size of our datasets are adequate to represent the thermodynamics of single households over monthly time periods.

Wet weather implications on heat recovery
Following the framework validation concept, we study the impact of decentralized heat recovery (HR) technologies during wet weather. This investigation aims to evaluate the influence of different household market penetration of HR technologies on temperatures and heat budgets at the WRRF. The HR device included in our analyses is a shower drain heat exchanger that is modelled as a spatially discretized counterflow heat exchanger, and behaves relatively similarly to commercial heat exchangers, with a power of around 7.5 kW . Two consecutive weekday periods of 5 days and market penetration shares of 0% (Reference Scenario), 25% (HR 25%), 50% (HR 50%), 75% (HR 75%) and 100% (HR 100%) of all households located in Fehraltorf are studied. The first weekday period encompasses the "dry" days between 4 March 2019 and 9 March 2019, where a small number of precipitation events are detected, and the second period includes the "wet" days between 11 March 2019 and 16 March 2019 that has numerous precipitation occurrences. The study includes the analysis of inflow temperatures at the WRRF for the different market penetration scenarios of HR systems installed in households. In addition, we compare results with available guidelines for the introduction of centralized heat recovery systems as a reference. Maximum temperature reduction due to the introduction of centralized HR devices

SWMM-HEAT
A. Figueroa et al. recommended by the literature is defined as reference temperature minus 1 K (Müller et al., 2009) and additionally, temperatures are not allowed to fall below 10 ⁰C as required by authorities in Switzerland (AWEL, 2010). Lastly, in order to quantify the thermal dampening effect of wet weather conditions, we compute the difference in heat budgets received by WRRF for all heat recovery scenarios during dry and wet days. In this study, heat budget (HB) is calculated as, With ṁ the mass flux (kg/s), T the fluid temperature at the inflow of the WRRF ( ∘ K), T ref the reference temperature (273.15 ∘ K), C p the water heat capacity (kJ/(kg ∘ K)) and t the time (secs).

Modelling the impact of rain and seasonal soil temperatures on insewer temperature dynamics
Four periods described in Table 2 are simulated and their performance indicators calculated. Fig. 2 shows the observed and modelled temperature dynamics across several locations during Period 1, with weekends and precipitation events clearly identified. Simulation results show that the model adequately reproduces observed in-sewer temperature dynamics during the months of February 2019 and March 2019, and captures the notable temperatures changes generated by precipitation events. Further comparisons between field measurements and simulated flows and temperatures in additional periods are presented in SI- Figures (8-14). RSR and RMSE values are similar in all periods analysed, suggesting that the proposed network enables the simultaneous modelling of seasonal soil temperatures and thermal shocks.
In order to enhance our understanding of the main sources of discrepancies between measurements and simulation results, we differentiate between weekend and weekdays. Table 3 presents the obtained RSR and RMSE values for temperature values during weekdays (WD), weekends (WE) and overall for Period 1 across five distinct locations in the catchment. Results suggest that the simulation framework represents temperatures dynamics during weekdays with higher precision than during weekends. Tables with the same characteristic (i.e. better performance of the model for weekdays compared with weekends) for flow and temperature for the three remaining periods are presented in SI -Table 2-8.
One of the main characteristics of the proposed framework is its ability to estimate thermal shocks at the WRRF due to precipitation events across sewer networks, as exemplified by two "wet" periods shown in Fig. 3. The figure shows how short-and long-term precipitations episodes influence WRRF inflow temperatures: i) during 13 March 2019 several short-term rainfalls reduce inflow temperatures at the WRRF rapidly by several degrees while returning to "normal" temperatures in approximately 1 hour; ii) long-term precipitations are observed through 15 March 2019 and 8 May 2019 reducing temperatures across the network for several hours when compared with dry weekdays. While daily dry-weather patterns are very similar for the two periods, the globally different temperature levels reflect seasonal differences (lower in March, higher in May).
In order to capture the spatial distribution of thermal-hydraulic   processes during a dry and wet day at similar times we introduce the network heat maps in Fig. 4. It represents the hourly average of temperature and flow at 12pm for two close weekdays: i) 12 March 2019, a typical dry day, and ii) 15 March 2019, a weekday that includes a rainfall event. We notice that large amounts of cold surface runoff is routed through the network. It increases the flow across the sewer network (line thickness) but reduces the temperature considerably (colour coding). This representation exemplifies that, next to increase of hydraulic loading, a drop in inflow temperatures at the WRRF can be expected.

Discussion
The validation study presented in the Section 4.1 allows for the identification of the main assets and limitations of the developed framework while comparing with field measurements in a real-world setting. Simulated flow and temperature dynamics in sewers were in good agreement with reference measurements in Fehraltorf during weekdays. In addition, similar performance indicator values were obtained across all studied periods suggesting that the modelling framework can predict temperature dynamics consistently all year long. Furthermore, the effects of short-and long-term precipitation events in temperature dynamics in sewer networks are well captured as shown in Fig. 3. Lastly, since SWMM-HEAT is a distributed heat transfer model for sewer networks, the prospect of obtaining "heat maps" (e.g. Fig. 4) during all seasons and weather events could be of large interest for utility managers to optimize the operation and maintenance of the sewer infrastructure and treatment performance at the WRRF.
The results of the validation study also assist in the identification of the main limitations of the presented framework. The detected main sources of discrepancies between simulated and observed thermal dynamics and their potential solutions are: _ Weekends and national/local holidays: Water consumption behaviours during weekends and holidays is significantly different from 'working days'. Weekends/holidays measurements exhibit an increased deviation and a shift in time of morning peak values (i.e. people take morning showers later and the peak is more diffuse) in comparison with weekdays, which is in agreement with the literature (Butler, 1993;Friedler et al., 1996). In addition, WaterHub does not adapt water demand patterns depending on the season (e.g. it does not take in account that there are less "hot" showers in summer compared with winter). Since WaterHub does not differentiate between workings days, weekends and national/local holidays, it is recommended that future implementations include algorithms that adjust consumption behaviours depending on the day of the week and the season. _ Soil temperature: Soil temperatures in SWMM-HEAT are defined as monthly patterns, i.e. soil temperatures are the same across the whole month. This is somehow coarse and does not account for intramonthly variations of soil temperatures which could result in lowflow (e.g. during night time) temperatures being considerable different across the same month. For instance, soil temperatures in February varies from 6⁰C to 7.8⁰C, increasing considerably towards the end of the month (SI- Fig. 6). Afterwards, during the month of March soil temperatures are updated and a much better agreement is obtained between simulation and observations values of nigh time temperatures. Future developments in SWMM-HEAT will include the option to define soil temperatures as time series. _ Morning peaks: during the morning, large differences between measured and simulated temperatures are observed. This artefact can be explained by an underestimation of the number of lateral connections and the use of showering habits of a different spatio-temporal context, and its potential solutions have been discussed in depth in Hadengue et al. (2021). Fig. 5 shows temperature dynamics at the WRRF inlet for different market penetration of decentralized heat recovery technologies of the two five-day periods previously selected. Results reveal that temperature differences between the HR scenarios analysed are larger during the morning peak and negligible during overnight time periods. There are no clear differences on combined waste-and stormwater temperature amidst the "dry" and "wet" periods suggesting that a more detailed analysis is required in order to quantify their impact on temperatures and heat budgets at the WRRF, which we present hereafter.

Impact of decentralized heat recovery technologies on WRRF heat budgets during wet weather conditions
Average inflow temperatures at the WRRF during the selected "dry" and "wet" weekdays were clustered in four daily time periods (Overnight (12am-6am), Morning (6am-12pm), Afternoon (12pm-6pm) and Evening (6pm-12am)) and market penetration of household HR technologies, as displayed in Fig. 6. In this figure, we observe that there exist larger temperature reductions between the Reference scenario and HR Scenarios during the Morning and Overnight periods than in the Afternoon and Evening periods. A "Temperature Limit" line is used as a reference and illustrates the maximum temperature reduction allowed by literature recommendations and governmental policies for centralized HR technologies. Even in the 100% market penetration scenario, average temperatures are never below the "Temperature Limit" threshold during dry and wet periods. A similar figure that considers maximum inflow temperature values, instead of average values, is displayed in SI - Figure 15, and shows that maximum temperatures, in certain HR scenarios and specific daily time periods, are below the recommended "Temperature Limit". However, it is important to note that the "Temperature Limit" threshold usually refers to average temperature, not to instantaneous temperature, and maximum temperatures are always well above the 10⁰C limit .
Considering that average temperatures are, in all situations, above the "Temperature Limit" threshold, we proceed to quantify the impact on the total heat budget received by the WRRF during selected "dry" and "wet" weekdays. We expect that the effect of decentralised HR devices on the inflow heat budget at WRRFs will be attenuated during wet weather conditions in contrast with dry weather periods, due to the large volume of stormwater introduced into the drainage system. In this analysis, we compute the difference in total heat budget at the WRRF between the reference scenario and each HR scenario across the two time periods considered (Fig. 7). Results suggest that during wet weather conditions, the impact of household HR technologies is reduced by approximately 20% in comparison with dry weather conditions for each scenario analysed. For a more comprehensive analysis of heat losses across households, lateral connections and sewer networks (during dry conditions) see Hadengue et al. (2021).

Discussion
Stormwater in combined sewers dampens the thermal effect of household HR technologies at the inlet of the WRRF. Daily average temperature values show that during the Afternoon and Evening periods and wet weather, no significant temperatures differences between the HR and Reference scenarios are detected, therefore no negative effect on water treatment processes at the WRRF is expected. Overnight and Morning periods display larger temperature differences at the WRRF due to the introduction of decentralized HR devices in comparison with the Reference scenario. However, these drops are less noticeable during wet weather than during dry weather, due to the dampening effect of stormwater in the system. Despite this dampening effect is expected, it has not been quantified in the literature, and the results obtained shed some light on this very important aspect. Overall, our study shows that the implementation of decentralized heat recovery technologies have a lower influence on the WRRF heat budget inflows during wet weather in comparison with dry weather. However, further studies investigating different network topography characteristics, seasons, climates, combination of decentralized heat recovery technologies and consumption habits should be performed to extend the validity of the previous statement.

Potential applications and future work
The coupled framework between WaterHub/MINUHET/SWMM-HEAT enables deeper and long-term investigations of thermalhydraulic dynamics in sewers. In the following examples, we foster synergies between this framework and additional areas of application: _ High temperatures increase the release rates of heavy metals (e.g. Zinc, Copper, Chromium, Lead) from stormwater sediments (Li et al., 2013). The proposed simulation framework has the ability to predict thermal-hydraulic dynamics of sewers systems during precipitation events, for instance simulation results can enhance pollutant dispersion modelling of heavy metals from storm sewer sediment across the sewer network. In addition, the framework offers a strong support for the investigation of illicit drug degradation in sewers due to temperature (Thai et al., 2014;McCall et al., 2016) and the degradation of wastewater compounds (Warith et al., 1998). _ The presented framework has the potential to support detection campaigns of infiltration and inflow (I/I) of extraneous water in sewer systems. (Beheshti & Saegrov, 2018; 2019) performed fibre-optic distributed temperature sensing (DTS) to identify I/I sources in Trondheim, Norway. In the study the authors observed the effect of rainfall-derived I/I during warm and cold days. Since DTS requires high initial costs, and installation and operation performed by highly qualified worker, we suggest to complement DTS with Fig. 6. Average temperature input temperatures at the WRRF during dry (Left) and wet (Right) weekdays and clustered on specific daily time periods: Overnight (12am-6am), Morning (6am-12pm), Afternoon (12pm-6pm) and Evening (6pm-12am).

Fig. 7.
Relative impact of household HR technologies on the total heat budget received at the WRRF during dry and wet weather.
thermal-hydraulic simulations performed by SWMM-HEAT. Comparing temperature data from sensors with simulation results will support and offer robust evidence for I/I detection. In addition, the WaterHub/MINUHET/SWMM-HEAT framework will assist in the assessment of rainfall derived I/I effects and inform stakeholders prior to develop future sewer rehabilitation plans. Furthermore, SWMM-HEAT has the ability to model thermal shocks in sewer systems and, in consequence, enables practitioners to design adequate campaigns towards mitigations of biofilm growth and biofilm thermal resistance. Thermal shocks have been identified as a successful technique to prevent biofilm formation and their adverse effect on plate heat exchanges of treated sewage source heat pump systems (Chang et al., 2017). _ The WaterHub/MINUHET/SWMM-HEAT framework reproduces consistently temperatures throughout seasons and weather events and offers a strong platform to pursue optimization studies for heat recovery placement in networks. Optimal placement of heat recovery systems in the sewer network requires a detailed examination of heat losses across the sewer network (surrounding soil of a sewer pipe and headspace temperature are two major sources of heat loss for sewer wastewater (Nagpal et al., 2021;Figueroa et al., 2021;Hadengue et al., 2021)), and of the impact of local wastewater heat recovery using heat exchangers across different seasons (Golzar and Silveira, 2021;Saagi et al., 2022). The proposed simulation framework can assists stakeholders and practitioners to make inform decisions regarding optimal investment planning strategies since it allows the creation of scenarios to determine financial feasibility depending on the market penetration of decentralized HR systems. _ Simulation results obtained with the proposed framework could update WRRF-wide energy modelling concepts (Arnell et al., 2021) with influent heat fluxes in order to quantify the effect of wastewater heat recovery systems, precipitation events and seasons in nitrogen removal processes (and N 2 O emissions (Hanaki et al., 1992)), aeration requirements and operative costs. Furthermore, in combination with strategies to increase the process performance during low wastewater temperature periods (e.g. regulation of operational parameters, bioaugmentation, biofilm technology, chemical phosphorus precipitation and novel process technologies (Zhou et al., 2018)), negative impacts of cold thermal shocks on wastewater treatment processes could be attenuated.
Pursuing these investigations requires close collaborative research between different sectors of the urban water cycle, energy, urban infrastructure and policy makers. The WaterHub/MINUHET/SWMM-HEAT framework has the capacity to inform these sectors with details regarding the thermal-hydraulic processes in the subsurface and surface of the built environment, however further advancements are needed. For instance, modelling the influence of low impact developments on the temperature in urban drainage systems or the introduction of soil temperatures as time series, is not possible with the presented framework in the current status. Further developments include the addition of a surface thermal model in SWMM-HEAT that maintains heat budget and a simplification of the simulation framework (i.e. MINUHET will not be needed). In addition, economical aspects of heat recovery are outside the scope of this investigation, but will be the subject of future research initiatives.

Conclusions
The main findings can be summarized as follows: _ A framework for automatic modelling of stochastic household water consumption time series, household private lateral connections, and thermal-hydraulic processes of stormwater runoff and routing across combined sewer systems is presented. The framework couples three modelling tools (WaterHub/MINUHET/SWMM-HEAT) embedded in a hybrid Python/Matlab environment. Thus, it enables the simulation of various management scenarios at households and sewer level, including the implementation ofdecentralized or centralizedheat recovery devices. _ The validation shows a similarly high model performance across all seasons suggesting that the presented framework can predict temperature dynamics consistently all year long. The effects of short-and long-term precipitation events on thermal-hydraulic dynamics in the sewer network are well captured. _ A study of the impact of household HR technologies on thermalhydraulic inflows at WRRFs during dry and wet weather is presented. Results suggest that the burden of household HR technologies on WRRF heat budget inflows is reduced by approximately 20% during wet weather periods in comparison with dry weather conditions. _ The presented framework exhibits potential for pursuing multiple research initiatives that will improve the understating of the waterenergy nexus, pollutant dispersion and support maintenance campaigns at network scale.

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Data availability
Supplementary data can be found online at https://doi.xxxxx.xxxxx