Computational hydrological models and simulations are fundamental pieces of the workflow of contemporary hydroscience research, education, and professional engineering activities. In support of hydrological modelling efforts, web-enabled tools for data processing, storage, computation, and visualization have proliferated. Most of these efforts rely on server resources for computation and data tasks and client-side resources for visualization. However, continued advancements of in-browser, client-side compute performance present an opportunity to further leverage client-side resources. Towards this end, we present an operational rainfall-runoff model and simulation engine running entirely on the client side using the JavaScript programming language. To demonstrate potential uses, we also present an easy-to-use in-browser interface designed for hydroscience education. Although the use case presented here is self-contained, the core technologies can extend to leverage multi-core processing on single machines and parallelization capabilities of multiple clients or JavaScript-enabled servers. These possibilities suggest that client-side hydrological simulation can play a central role in a dynamic, interconnected ecosystem of web-ready hydrological tools.

  • We present the Hillslope Link Model (HLM)-Web, a simulation engine for rainfall-runoff modelling in JavaScript.

  • The simulation engine runs full-scale, physically based rainfall-runoff models.

  • All computations are performed on the client side within the browser.

  • HLM-Web is demonstrated with a use case for hydroscience education.

  • The use case facilitates hydrological education and research ‘sandboxing’.

Graphical Abstract

Graphical Abstract
Graphical Abstract

Computational models allow scientists and engineers to simulate the complex relationships that exist in real-world systems. In water resources, computational hydrological models are fundamental pieces of the workflow of contemporary research, education, and professional practice. These models are used to support a broad range of tasks, including engineering design (e.g., Gironás et al. 2010; U.S. Army Corps of Engineers 2018), flood forecasting (e.g., Beven et al. 1984; Krajewski et al. 2017), flood inundation mapping (Li & Demir 2022), sedimentation forecasting (Xu et al. 2019a, 2019b), water quality research (Jha et al. 2007), and water resources management (Sulis & Sechi 2013), among others.

From a practical perspective, using physically based models presents many challenges. Data appropriateness, preparation, scale, sparsity, and errors are significant obstacles that prohibit the use and confidence of models. Users must also contend with learning a standalone graphical user interface – or lack thereof – to access and deploy the modelling software. Likewise, the coupled challenge of access to computational resources, and the expertise to manage them, can be a significant burden to run a model fit for its intended purpose. These difficulties set a high training level threshold that stakeholders must meet if they want to use these tools and models. Finally, challenges of model reputation, adoption among stakeholders, and lack of benchmark datasets (Ebert-Uphoff et al. 2017) for comparative analysis present limitations to the reproducibility and impact of model findings.

Many of these practical challenges are associated with desktop-based, or offline, modelling workflows. In response, hydroscience computational architectures have advanced alongside cyber and computing technologies. The most recent advances fall within Web-based simulation (WBS), or the use of the Internet to separate modelling tasks among networked machines. A key criterion of WBS is that a web browser plays an active role in modelling and simulation sub-tasks, such as simulation, visualization, data storage, or documentation (Byrne et al. 2010).

Arguably, the two primary goals of WBS are simulation and visualization. In a client-server model, either of these tasks can be completed locally, in a browser on the client's local machine, or remotely, on a server. There are numerous examples of server-side simulation for hydrology and water resources studies, such as streamflow forecasting (Castronova et al. 2013), ecosystem services (Feng et al. 2011), hydrology and climate change (Goodall et al. 2013; Zhang et al. 2019), watershed management (Demir & Beck 2009), mountainous snow-water resources (Wu et al. 2018), environmental decision support (Sun 2013), and urban watershed hydrology (Zeng et al. 2021).

Likewise, there are equally many examples of client-side implementations of data exploration and visualization tools ranging from pure client-side architectures (Jadidoleslam et al. 2020; Walker et al. 2020) to architectures that offer client-side visualizations and some server-side data analytics (Booth et al. 2011; Brendel et al. 2019; Rottler et al. 2021). Furthermore, other efforts have sought to integrate server-side computation and data storage with client-side visualization to support web-based hydrologic workflows (Peckham et al. 2013; Delipetrev et al. 2014; Swain et al. 2015, 2016; Yildirim & Demir 2021). Taken together, these efforts demonstrate a focus on, and the viability of, modelling as a web service for hydrological applications. Notably, this design places computation and simulation predominantly on server resources.

Client-side simulation, however, should not be ruled out as a viable option as it offers many usability advantages. First, all modern browsers comply with the ECMAScript specification (ECMA International 2021), i.e., JavaScript, meaning that JavaScript code is interoperable across any browser on any device, no matter the browser or machine. Second, recent advances in JavaScript interpreters have resulted in significant increases in computational speeds, with one-to-one tests showing JavaScript performance on the order of magnitude of C ++ code (Hinkelmann 2019). When considering a computationally intensive task, JavaScript no longer holds a severe performance disadvantage, while still maintaining its usability and interoperability advantages as a native web language.

Client-side computational resources have been used to perform various tasks, including modelling, in environmental and water resources applications. Prior to the cross-browser standardization of JavaScript, Java language applets were used to perform client-side tasks, such as calculations for decision support tools in watershed management (Voinov & Costanza 1999; Mustajoki et al. 2004). More recent examples show the potential to leverage client-side compute resources for much of a WBS workflow. A client-side simulation engine was implemented to calculate biochemical oxygen demand and dissolved oxygen along a river reach (Walker & Chapra 2014). The simulation engine was complemented by client-side visualization and a user interface, which allowed for the rapid iteration of simulation inputs. The same authors also implemented a client-side version of the ABCD Water Balance model, a simple lumped hydrological model to simulate streamflow at a daily scale (Walker 2014). In another example, a web-based analysis and scenario tool for the eutrophication of inland waters perform all necessary computations in the web browser (Strömbäck et al. 2019). The authors, however, report that they simplified the original model to make the browser implementation more performant. Finally, a numerical engine has been developed to simulate tsunami wave generation and propagation, and its visualization, as a JavaScript-WebGL library (Galaz et al. 2022). The simulation engine was tightly coupled with other web elements, data sources, and sensors to support a web platform for public education and tsunami awareness.

Environmental web applications have demonstrated the potential to leverage client-side computational resources for flood mitigation (Alabbad et al. 2022), well forecasting (Sit et al. 2021), sedimentation forecasting (Xu et al. 2019a, 2019b), and decision support systems (Ewing & Demir 2021). Furthermore, other client-side tools have been developed for hydrological studies focusing on participatory decision support (Teague et al. 2021), watershed delineation (Sit et al. 2019), and flood map generation (Hu & Demir 2021). Taken together, an ecosystem of web-ready, hydrological tools has emerged in the last decade. Implementing a hydrological model in JavaScript, the lingua franca of the web provides many opportunities for extensions in this dynamic, interconnected ecosystem.

One potential application area for web-based rainfall-runoff models is in hydroscience education. Although models are fundamental to various professional workflows, there are many challenges to a model's successful integration into hydroscience curricula. First, the educational focus in hydroscience curricula is (or should be) on core hydroscience concepts and not a particular vocational tool, such as a model. Equally, there is no single model (i.e., vocational tool) that is universally used professionally, which would justify its instruction over all others, always.

If indeed a model is selected for classroom use, instructors face barriers to its successful educational application. Many barriers, if not all, stem from the most essential and precious resource – time. For example, data acquisition and preparation are fundamental modelling tasks. Yet, they can be the most time-consuming. Various surveys of professionals across data science and scientific modelling disciplines show that data acquisition and data preparation account for a majority of the time spent on a modelling workflow (Jackson 2014; Lohr 2014; CrowdFlower 2016; Anaconda 2020). Furthermore, using models often requires specific, standalone software and other Information Technology (IT) knowledge to operate. These technologies often have steep learning curves, especially for beginners. Learning and executing these parts of a model workflow take much more time than the time for computation and analysis of results, especially in the case of classroom examples. Thus, there is tension for the instructor between teaching the fundamentals of the subject matter and teaching the model workflow as a conduit to explore the subject matter; in short, teaching the science vs. teaching the tool. This reality describes the challenge to teach contemporary hydroscience topics in a manner, which recognizes the state-of-the-science tools, without obscuring the subject fundamentals behind the technical/vocational knowledge of specific software or tool chains.

The aim of this paper is twofold. First, we seek to understand the capability of client-side technologies, i.e., JavaScript, to perform computationally intensive hydrological modelling, such as full-scale, physically based rainfall-runoff models. Second, we seek to explore potential application areas that browser-based hydrological modelling can support. Towards these aims, we implement and test the performance of a JavaScript version of a rainfall-runoff model currently used for both operational flood forecasting and research. Furthermore, we present a fast and interactive in-browser interface designed for hydroscience education. In the Materials and Methods section, we detail the hydrological model used, a previous implementation of the same model in the C Programming Language, and subsequently the current implementation of the model in the JavaScript language. In the Results section, we first confirm the proper implementation of the model via a comparison of benchmarking results. We then detail the use of the client-side model and simulation engine as part of an educational use case. In the Discussion section, we examine further the performance and discuss the benefits of client-side simulation for research, education, and operation. We conclude with a look into future work and the general benefits of client-side computation for water and environmental modelling.

In this section, we first describe the hydrological model, the Hillslope Link Model (HLM), implemented in JavaScript. Next, we describe the original implementation of HLM in the C programming language. Finally, we describe the current methodology to implement the hydrological model as a native client-side simulation engine.

Hillslope Link Model

The nature of how rainfall is transformed on and through the landscape to generate runoff and streamflow is a complex physical process, and accurate estimation of this process is important for flood forecasting, disaster relief, engineering design, etc. To address these needs, mathematical models to estimate runoff generation from rainfall have proliferated. One such model is the HLM (Mantilla 2022). The HLM uses the concept of landscape decomposition into just two elements: hillslopes and channel links. Hillslopes are irregular-shaped polygons where the conversion of rainfall to runoff takes place. This process depends on the hillslope attributes such as size, shape, slope, exposure, soil type, and land use. Each hillslope is uniquely associated with a channel link. A hillslope's runoff, both surface and subsurface, drains to the corresponding link and the links make the river network. Runoff that finds its way to the channel is transported downstream and aggregated as the small streams come together to form larger ones that then become rivers, first small then larger. Channel links also have certain attributes that control water transport. These include length, slope, and roughness, as well as other aspects of hydraulic geometry (e.g., channel cross-sectional shape). The typical size of a hillslope is on the order of 0.01 km2 and the typical length of a link is on the order of 0.1 km.

The construction of the modelling domain (also called ‘hydrofabric’) requires the use of digital topography data, better known as the digital elevation model (DEM). Such data are widely available at very high spatial resolution, as high or higher than 10 m. From the DEM data, one can extract the drainage (river) network and its basic attributes and the associated outline of the hillslopes with some of the key attributes (Mantilla & Gupta 2005). From other available public sources, such as land surveys, one can obtain information regarding land use and soil types as well as the geometry of the channel cross-sections.

Mathematically, the physical processes involved in runoff generation and transport can be described as a set of ordinary differential equations. There is a good deal of flexibility on how detailed a description is desired. For example, a simple model can be based on a constant runoff coefficient (fractions of rainfall) and constant channel velocity. This results in a linear system of equations and thus is easy to solve. A more realistic description could be based on a non-linear concept of storage at a hillslope and non-linear channel velocity. The resulting system requires a numerical algorithm to solve. Refer to Appendix 2 in Supplementary Material for a description of the mathematical formulations of the constant and variable runoff models. Likewise, the formulation of both the constant and variable runoff models can also be found in Small & Debionne (2016).

The HLM has several attractive properties. First, it respects the scaling (fractal) properties of real river networks (e.g., Horton laws). This allows the model to mimic the correct temporal response for a given size upstream drainage area. Second, it avoids the challenge of properly estimating the lateral fluxes necessary for other regular grid-based models. Each hillslope drains to one channel link and there is no other ‘communication’ between the adjacent hillslopes (this is true, ignoring the saturated groundwater contribution to streamflow). Third, as we just briefly discussed above, the model structure (hydrofabric) and the mathematical description of the physical process are independent. This allows for a consistent study of the importance of different models of certain processes. Fourth, the numerical solvers of ordinary differential equations are much more efficient and easier to implement. The model structure is also amenable to parallelization. Note that the computations of runoff at the hillslopes are independent of each other and that it is the transport of water in the river network that is coupled but in a rather weak way (computations at a link require the availability of streamflow at the two nodes upstream). Five, the model does not require intensive calibration. With a reasonable selection of the parameters, which all have some physical interpretation, the model demonstrates an acceptable level of skill out-of-the-box.

From an educational perspective, HLM's concept of landscape decomposition and the resultant mathematical description are well suited for educational applications. In fact, one can organize an entire undergraduate engineering hydrology course using it. First, it is undisputable that the concept faithfully describes surface (including near subsurface or unsaturated zone) water flow in the environment. This facilitates subsequent discussion of the relevant physical processes of rainfall, evapotranspiration, infiltration, runoff, and open channel flow. Because the concept naturally covers a wide range of spatial and temporal scales, it provides background for discussion of space–time variability, land–atmosphere mass and energy exchange, the concept of storage and water balance, and water transport. As the model use requires data, this provides an opportunity to discuss different measurement and sensing technologies, from radar-rainfall to satellite-based soil moisture to in situ techniques of water evaporation, infiltration, and flow. With the above-mentioned elements in place, one can illustrate the key engineering practice methods of the rational method, curve number, unit hydrograph, and flood frequency estimation.

High-performance computing (HPC) implementation

The distinction should be made between the HLM framework, which is the mathematical model by which to describe the physical processes, and the machinery needed to generate a solution based on the mathematical model. To solve these equations, i.e., simulate the rainfall-runoff response of a network, a numerical solver is required. One advantage of the HLM framework is that its river network has a directed graph topology, such that the solution at a hillslope only requires information at the hillslope itself and its direct ‘parents’. Because of this structure, a numerical solution to the rainfall-runoff response at each hillslope link can be found asynchronously. One such numerical solver has been developed to solve systems of ODEs linked by a directed tree structure, as in the case of the HLM river network topology (Small et al. 2013). This solver was written in the C programming language and uses an adaptive step-size Runge–Kutta method with dense output interpolant capabilities. The authors also present a network-partitioning scheme and the scheduler routine that enable distributed and parallel workflows to support massive simulations with high-performance computing (HPC) resources. A version of this implementation provides operational hydrological forecasts for the entire domain of Iowa (Krajewski et al. 2017) and is also used for research applications (e.g., Jadidoleslam et al. 2019). Currently, it supports a variety of input and output types such as databases, binaries, text files, and hierarchical data formats.

From an educational perspective, however, the current workflow for the C Programming Language implementation of the HLM model has many characteristics that hinder its use as an educational tool. The first issue is that of access. This implementation is best suited for HPC environments, where the codebase, its dependencies, and the networked computing resources are maintained by IT professionals. Lack of access to HPC environments limits its use. The alternative to using an established HPC environment would require students to install and maintain a version – and all its dependencies – on one's personal machine. This also presents a significant burden to use. Second, this implementation lacks a graphical user interface. This requires users to alter input files manually, usually in a command line interface. Finally, the C Programming Language implementation lacks even a simple visualization tool. This means that a user would need to interpret simulation results in yet another software. Thus, the current C code implementation significantly limits any possibility of HLM's use in a classroom environment.

Client-side implementation

This section details the methodology of the client-side (i.e., JavaScript) web application for simulating the rainfall-runoff response of a river network using the HLM family of models. First, we chose to use the HLM because of its flexibility to describe varying levels of complexity in the physical processes; it is open source and well-documented; it has proven its performance in advanced operational forecasting and research applications; and, finally, we have significant experience with it.

To develop HLM-Web as a JavaScript application, we used the object-oriented programming paradigm. As stated previously, DEM data are processed to generate discrete hillslope link sections with distinct physical properties, such as channel length, area of the hillslope, and total upstream area. As such, the hillslope link unit was used as the basis for the object model. Each hillslope link object contains object methods and properties. In general, these methods and properties can be categorized into three groups: physical attributes, model structure (equations), and numerical solver. All necessary properties and methods are added at object instantiation but can also be altered prior to simulation execution.

Physical attributes of the hillslope link object are either direct inputs from the discretization of the river network to be simulated or were calculated using both the hillslope-specific physical attributes and global variables that apply to all hillslope link objects. Refer to Appendix 2 in Supplementary Material for the definition and use of the physical attributes in the model equations. The HLM-Web Educational Hydrology Tool section contains more information about setting global variables.

HLM-Web uses the Runge–Kutta method (fourth order) as a numerical solver. This method is used with an adaptive step-size routine that compares the truncation errors of derivative approximations to user-defined error thresholds to adapt the step size of the integration (Press et al. 1986). Furthermore, a dense output interpolation scheme was used in the solver (Hairer et al. 1993). Dense output schemes allow for higher-order interpolation between step sizes. This is an important feature of the solver because the integration at a hillslope link requires the discharge from upstream links as an input. Due to the adaptive step-size routine, it is unlikely that the upstream links will have a solution at the exact time required for the downstream link. As such, the dense method is used to interpolate the discharge from upstream links as necessary to solve for a hillslope link.

At each hillslope link, the hydrologic model is described as a set of ordinary differential equations. These equations vary depending on the model (e.g., constant vs. variable runoff). Refer to Appendix 2 in Supplementary Material for a mathematical comparison between the constant and variable runoff models. At the instantiation of a Link object, a function is assigned to the object as a method (dydt). No matter the internal structure of the derivatives themselves, the method takes the same inputs: an array, Y, of states of the link; the current simulation time, t; and an array, f, for the forcing (evaporation, precipitation, etc.) at the current simulation time. The function returns the calculated derivatives in an array of equal length to that of array Y.

A complete HLM-Web simulation work cycle can be found in Figure 1. On initiation of a simulation, the numerical solver configuration data are accessed from the set-up file and used, along with the parametric, forcing, and model data, to instantiate the links to be solved. Next, a Link object is instantiated for every hillslope link in the simulation, the order of their solution is collected, and then is used to step all links to the end of the simulation time. The procedure to step the solution at a link forward in time is an iterative process. First, the subroutine estimates the solution at a step forward in time. If the estimated truncation error is too large for the solution, a smaller step size is calculated and then used to advance the solution. This procedure is done until the solution for the link has reached the end of simulation time.
Figure 1

A complete workflow diagram of an HLM-Web simulation.

Figure 1

A complete workflow diagram of an HLM-Web simulation.

Close modal

The order by which the Link objects will be stepped can be generated on the fly using the function (getOrder) or supplied in an input file. Our current methodology is to provide an input file where the order of hillslopes to be processed is generated by a post-order traversal listing of link ids from a depth-first search of the river network as a directed graph. Because solving a link only requires information from the link itself and the link(s) immediately upstream of it, all data held in the upstream link objects can be scrubbed once the simulation of the downstream link is complete. Thus, the post-order traversal is a memory-efficient order used to solve for the links. Only simulation data from preselected links are stored after they are used for the solution of links immediately downstream. Once all link objects have stepped to the end of simulation time, the simulation runtime is reported. Simulation results can be exported as comma-separated values (CSV) or viewed in a figure within the browser window.

It is important to note that this workflow is essentially the same, whether the core HLM-Web simulation engine is used alone or with a graphical user interface (such as the educational user interface presented in Results.) Input data can either be edited within the files prior to the browser parsing them or after.

In this section, we present two case studies of the HLM-Web simulation engine. First, we validate the results from the HLM-Web solver. Next, we detail how HLM-Web's simulation engine can be integrated with other web technologies to create an interactive educational tool to support hydrology education.

Simulation benchmark and time performance

As noted in Section 2.2, a numerical solver written in the C Programming Language is used operationally to perform HLM simulations. Thus, comparing the simulation results from the C and the JavaScript implementations provides a means to validate the JavaScript solver's results. We compared results from two benchmarking tests – which use the constant and variable runoff models, respectively – provided with HLM's C Programming Language implementation (Iowa Flood Center (IFC) 2018). Simulation results show that the outputs from the JavaScript and C Programming Language code are completely coincident (Figure 2), meaning we have successfully implemented the solver and properly constructed each model.
Figure 2

Benchmarking tests for the implementation of the HLM-Web compared to the C Programming Language implementation of HLM. The test network (left) compares the results of the JavaScript and C code implementations of the constant runoff model at the network's outlet. Clear creek (right) compares the results of the variable runoff model at its outlet.

Figure 2

Benchmarking tests for the implementation of the HLM-Web compared to the C Programming Language implementation of HLM. The test network (left) compares the results of the JavaScript and C code implementations of the constant runoff model at the network's outlet. Clear creek (right) compares the results of the variable runoff model at its outlet.

Close modal

HLM-Web Educational Hydrology Tool

The second demonstration of the HLM-Web simulation engine is an interactive educational tool to teach hydrology. Using the simulation engine for a real-world use case provides insight into how interactive WBS may improve the broader modelling workflow beyond the narrow focus of computational time. Synergistically, extending the HLM-Web simulation engine with an easy-to-use interface makes this model more accessible for use in education.

In our design process, we sought to clearly separate the model preparation sub-tasks, e.g., building a simulation ‘recipe’. Each recipe sub-task – domain selection, model selection, parameter selection, and rainfall input – has its own tab within the webpage (Figure 3). For model selection, users choose between five different river networks to simulate. These networks range in size of 101–104 km2. Importantly, all input files required to simulate the river networks are already prepared for students. Users then choose between two mathematical models, the Constant Runoff Model or the Variable Runoff Model, to describe the runoff generation and streamflow processes. Next, in the parameter selection tab, users have the option to alter global variables that are used in the model calculations. Parameter values are toggled via HTML slider inputs. Slider ranges are predefined by the course instructor and are based on a reasonable physical range of each parameter. Next, users define rainfall input for the simulation in the rainfall input tab. On this tab, users select between three different rainfall event types: a single, constant event; a repeated, constant event; and a custom event. In a panel, users can track the current simulation recipe as it changes given inputs. Once the user has reviewed the simulation recipe, they can trigger the simulation execution. When the simulation is complete, the webpage automatically displays the visualization of the results.
Figure 3

A step-by-step demonstration of the education web tool for hydrology courses using HLM-Web as a simulation engine. The six-step process was designed with the consultation of hydrology instructors with the objective to simplify and streamline the modelling and simulation process.

Figure 3

A step-by-step demonstration of the education web tool for hydrology courses using HLM-Web as a simulation engine. The six-step process was designed with the consultation of hydrology instructors with the objective to simplify and streamline the modelling and simulation process.

Close modal

Simulation results are shown at preselected hillslope links within the network. Hillslope links where results are shown (or output) can be readily altered via a configuration file. For this educational application, hillslope link results were selected for visualization by their approximate stream order with respect to the contributing area of the network outlet. Without needing to refresh the current webpage or navigate to a new page, users can easily change the simulation set-up and run the simulation again. Simulation results (i.e., hydrographs) and metadata can also be exported in CSV format for further analysis and visualization. Notably, the codebase allows for any state variable used in a model formulation to be saved and exported. However, the current educational web tool only allows the export of link discharges (i.e., hydrographs.)

All features of the educational tool are based on client-side technologies. The tool was developed with iterative feedback from course instructors with the objective that it would supplement the hydrology courses at the University of Iowa, Department of Civil and Environmental Engineering and the University of Manitoba, Department of Civil Engineering.

HLM-Web demonstrates that it is possible to implement a full-scale distributed rainfall-runoff model and simulation engine using only modern web standards. To the best of our knowledge, a full-scale hydrological model running completely as a client-side application has not yet been presented in the literature. Furthermore, we demonstrate that this technology can be applied to provide an accessible educational tool to the undergraduate hydroscience curriculum. In implementing a distributed rainfall-runoff model on the web, the technology becomes available for use alongside the many web-based applications that comprise the dynamic and interconnected ecosystem of web-ready hydrologic tools.

We begin this section with a brief discussion of benchmarking results. Next, we discuss the computational performance of HLM-Web and the potential strategies to improve it. Next, we discuss the benefits of client-side simulation via the strengths of our HLM-Web educational tool. Finally, we conclude with a discussion of how the technology may be leveraged beyond education in outreach, research, and operations.

Benchmark and performance results

Via the direct comparison of benchmark results provided in the HLM documentation (Figure 2), we show that the JavaScript-based HLM-Web provides identical results for both the constant and variable runoff models. This verifies two important criteria. The first is that we have accurately formulated the mathematical models. The second is that we have demonstrated the ability of our numerical solver to return equivalent solutions to that of the solver of the current, operational version.

As expected, the HLM-Web – written in JavaScript for client-side web computing – is slower than the original C code implementation (Hinkelmann 2019). In part, this can be explained by the fact that many of the JavaScript engines are themselves written in C, meaning that there is a practical performance ceiling considering the overhead to interpret and then execute the code.

Nonetheless, the computational speed of the HLM-Web could be increased and, indeed, is part of intended future work. Generally, there are two complementary approaches to increase the computational speeds of the HLM-Web. The first strategy would be to continue to improve the existing codebase. We observe that there remain opportunities for speed improvements in this regard, specifically with respect to the interplay between the scheduler logic and the search algorithms used for the dense interpolant scheme.

The second strategy to increase compute speeds would be to apply new web technologies. In this regard, two current web standards, Web Assembly and Web Workers, offer means to improve compute speeds. First, the Web Assembly is a standard, which allows the execution of portable binary code to be run on web pages (Haas et al. 2017). In practical terms, leveraging this technology would allow for the entire simulation engine, or portions of it, to be run at speeds approaching native C code (Mozilla 2013). Second, Web Worker technology allows JavaScript code to be executed in the background without blocking the function of the webpage it is running in (MDN 2022). A characteristic feature of Web Worker technology is that it can more effectively use multi-core CPUs. Thus, another avenue to improve computational speeds is to parallelize the simulation task across a client's CPU cores via a Web Worker.

HLM-Web Educational Hydrology Tool

As we demonstrate with the educational use case, a client-side simulation workflow can mitigate some of the challenges of offline workflows for users. First, the client-side architecture of HLM-Web allows for interoperable, no install, no set-up hydrological applications. This means that users can perform simulations on any device that has a browser, even on simple machines such as mobile phones or browser-only devices like Chromebooks. Likewise, when the HLW-Web simulation engine is combined with an easy-to-use web interface, modelling and simulation can be done without writing any code. Here, HLM-Web has a major advantage to other options available to educators. Although engineering students are expected to have some skill in programming, developing a full-scale model (code) within a single semester is clearly beyond their level of proficiency.

For users, the time and burden of data preparation and handling are all but eliminated with the HLM-Web educational tool. Likewise, the instructor can calibrate the amount of exposure to the data preparation and handling tasks needed without it being a critical lynchpin within a course. Taken together, HLM-Web and the easy-to-use web interface provide a ‘flat’ learning curve for users to focus on hydrology. Instructors have used the tool for in-class demonstrations, homework, and final examinations. The HLM–Web education tool has been used to teach a variety of hydrological concepts, including simulating watershed response at a range of spatial scales (which, in the process, demonstrates the role of the river network on flow aggregation); the role of rainfall intermittency on peak flow magnitude; the role of soil moisutre as a system memory; unit hydrograph theory; and more. Refer to Appendix 3 in Supplementary Material for sample problems that use the HLW-Web Educational Hydrology Tool.

Other application areas

There are many benefits to a distributed rainfall-runoff model implemented completely in modern, client-side web standards. While many of these benefits are exhibited in the educational tool presented here, they can also be leveraged in application areas such as operations, outreach, and research. First, a curated and simplified interface creates the scaffolding for rapid simulation without writing any code or manual alteration of inputs or parameterization. This can significantly lower barriers to the time-sensitive use of simulation and models. For example, with improvements to compute speeds, either via more computational power or parallelization, HLM-Web could serve as a research sandbox to rapidly test different model formulations or parameter combinations.

The model application can also be coupled with online data products for seamless data preparation and integration. For example, the river network input data could be served to the browser dynamically based on latitude and longitude coordinates supplied via a map interface. Rainfall products, either historical or forecasts, could be queried from a web service (e.g., Seo et al. 2019) and served to the browser for direct integration with the simulation engine. These input data could then be used to generate custom forecasts for a region of interest or design flows for a proposed project. This streamflow data could then be used for dynamic flood inundation mapping. Furthermore, the flood inundation maps could then be used directly as outputs or inputs to generate real-time estimates of flood damage. A workflow such as described would provide value to first responders, disaster planning, and floodplain managers. The automated data preparation and integration opportunities could significantly improve some of modelling's most tedious and time-consuming tasks and, as such, increase access to advanced modelling tools.

A client-side simulation engine also offers some advantages over WBS with server-side compute. First, because HLM-Web does not itself use any server-side compute, it can be hosted on a simple web host for static files. Static hosting presents a significant cost-saving compared to a server environment running compute-intensive tasks, such as simulation. A second advantage to using JavaScript and client-side architectures is that it is inherently an open source because the server passes the written code to the browser and then interprets it on the client machine. This is in contrast with the server-side compute model, where users do not necessarily have access to the source code used. In this manner, the codebase is more available for inspection and development by the community. These advancements lower barriers to access and increases ease-of-use of rainfall-runoff modelling and simulation for a range of applications. In effect, it provides a wide range of stakeholders the means to use and engage in the subject matter within a self-contained, ubiquitous platform.

In this work, we sought to understand the capability of client-side technologies for computational tasks in hydrology. Furthermore, we sought to explore potential application areas that browser-based hydrological modelling can support. First, we presented HLM-Web, a simulation engine for distributed rainfall-runoff modelling in JavaScript, which can run full-scale, physically based models on the client side using a browser. We show that the simulation engine provides equivalent results compared to benchmarks from the previous implementation of the same model in the C Programming Language. We then demonstrate how the core simulation engine can integrate with an easy-to-use in-browser interface designed for hydroscience education. Browser-based simulation, thus, can improve the overall modelling and simulation workflow. These findings suggest that client-side browser-based simulation can support application areas where interactive and iterative simulations are desired.

Previous work in the literature has demonstrated the possibility of in-browser, client-side modelling with simplified models of environmental phenomena. This work moves the field beyond the current state-of-the-science and shows the potential benefits of simulation using native web technologies. Namely, these benefits increased integration with other web-based tools for hydrological modelling, such as integration of the input data and results pipelines; the inherit open-source nature of JavaScript applications; the write once, run everywhere characteristic of JavaScript, allowing for users to always access the most current version of the software; and the potential application pipelines it can service in education, outreach, and research.

Future work will focus on improving the computational performance of the simulation engine and extending its modelling capabilities. Overall performance can be improved through improvement on single machines – via better scheduler and memory management; converting all or part of the engine to Web Assembly; leveraging parallelization of simulations with Web Workers – and developing distributed (Agliamzanov et al. 2020), peer-to-peer compute capabilities. Extending modelling capabilities entails incorporating other environmental processes alongside the hydrologic models presented here and streamlining input and output data with other web-ready hydrologic tools. Together, with the possible extensions, the current implementation suggests that client-side hydrologic modelling and simulation can play a central role in a dynamic, interconnected ecosystem of web-ready hydrologic tools.

All relevant data are included in the paper or its Supplementary Information.

The authors declare there is no conflict.

Agliamzanov
R.
,
Sit
M.
&
Demir
I.
2020
Hydrology@Home: a distributed volunteer computing framework for hydrological research and applications
.
Journal of Hydroinformatics
.
https://doi.org/10.2166/hydro.2019.170
.
Alabbad
Y.
,
Yildirim
E.
&
Demir
I.
2022
Flood mitigation data analytics and decision support framework: Iowa middle cedar watershed case study
.
Science of the Total Environment
814
,
152768
.
https://doi.org/10.1016/j.scitotenv.2021.152768
.
Anaconda
2020
State of Data Science
.
Anaconda Inc
, Austin, TX.
Beven
K. J.
,
Kirkby
M. J.
,
Schofield
N.
&
Tagg
A. F.
1984
Testing a physically-based flood forecasting model (TOPMODEL) for three U.K. catchments
.
Journal of Hydrology
.
https://doi.org/10.1016/0022-1694(84)90159-8
.
Booth
N. L.
,
Everman
E. J.
,
Kuo
I. L.
,
Sprague
L.
&
Murphy
L.
2011
A web-based decision support system for assessing regional water-quality conditions and management actions
.
Journal of the American Water Resources Association
.
https://doi.org/10.1111/j.1752-1688.2011.00573.x
.
Brendel
C. E.
,
Dymond
R. L.
&
Aguilar
M. F.
2019
An interactive web app for retrieval, visualization, and analysis of hydrologic and meteorological time series data
.
Environmental Modelling and Software
.
https://doi.org/10.1016/j.envsoft.2019.03.003
.
Byrne
J.
,
Heavey
C.
&
Byrne
P.
2010
A review of web-based simulation and supporting tools
.
Simulation Modelling Practice and Theory
253
276
.
https://doi.org/10.1016/j.simpat.2009.09.013
.
Castronova
A. M.
,
Goodall
J. L.
&
Elag
M. M.
2013
Models as web services using the Open Geospatial Consortium (OGC) Web Processing Service (WPS) standard
.
Environmental Modelling and Software
.
https://doi.org/10.1016/j.envsoft.2012.11.010
.
CrowdFlower
2016
Data Science Report
.
Delipetrev
B.
,
Jonoski
A.
&
Solomatine
D. P.
2014
Development of a web application for water resources based on open source software
.
Computers and Geosciences
.
https://doi.org/10.1016/j.cageo.2013.09.012
.
Demir
I.
&
Beck
M. B.
2009
GWIS: a prototype information system for Georgia watersheds
. In
Proceedings of the 2009 Georgia Water Resources Conference: Regional Water Management Opportunities
,
Athens, GA, USA
.
Ebert-Uphoff
I.
,
Thompson
D. R.
,
Demir
I.
,
Gel
Y. R.
,
Karpatne
A.
,
Guereque
M.
,
Kumar
V.
,
Cabral-Cano
E.
&
Smyth
P.
2017
A vision for the development of benchmarks to bridge geoscience and data science
. In
17th International Workshop on Climate Informatics
.
https://doi.org/10.5065/D6222SH7
.
Ewing
G.
&
Demir
I.
2021
An ethical decision-making framework with serious gaming: a smart water case study on flooding
.
Journal of Hydroinformatics
23
(
3
),
466
482
.
https://doi.org/10.2166/hydro.2021.097
.
Feng
M.
,
Liu
S.
,
Euliss
N. H.
,
Young
C.
&
Mushet
D. M.
2011
Prototyping an online wetland ecosystem services model using open model sharing standards
.
Environmental Modelling and Software
.
https://doi.org/10.1016/j.envsoft.2010.10.008
.
Galaz
J.
,
Cienfuegos
R.
,
Echeverría
A.
,
Pereira
S.
,
Bertín
C.
,
Prato
G.
&
Karich
J. C.
2022
Integrating tsunami simulations in web applications using BROWNI, an open source client-side GPU-powered tsunami simulation library
.
Computers & Geosciences
159
,
104976
.
https://doi.org/10.1016/j.cageo.2021.104976
.
Gironás
J.
,
Roesner
L. A.
,
Rossman
L. A.
&
Davis
J.
2010
A new applications manual for the storm water management model (SWMM)
.
Environmental Modelling and Software
.
https://doi.org/10.1016/j.envsoft.2009.11.009
.
Goodall
J. L.
,
Saint
K. D.
,
Ercan
M. B.
,
Briley
L. J.
,
Murphy
S.
,
You
H.
,
DeLuca
C.
&
Rood
R. B.
2013
Coupling climate and hydrological models: interoperability through web services
.
Environmental Modelling and Software
.
https://doi.org/10.1016/j.envsoft.2013.03.019
.
Haas
A.
,
Rossberg
A.
,
Schuff
D. L.
,
Titzer
B. L.
,
Holman
M.
,
Gohman
D.
,
Wagner
L.
,
Zakai
A.
&
Bastien
J. F.
2017
Bringing the web up to speed with WebAssembly
.
ACM SIGPLAN Notices
52
(
6
),
185
200
.
https://doi.org/10.1145/3062341.3062363
.
Hairer
E.
,
Nørsett
S. P.
&
Wanner
G.
1993
Solving Ordinary Differential Equations I
, 2nd edn, Vol.
8
.
Springer
,
Berlin, Heidelberg
.
https://doi.org/10.1007/978-3-540-78862-1
.
Hinkelmann
F.
2019
Speed, speed, speed: JavaScript vs C ++ vs WebAssembly
. In:
International JavaScript Conference
,
New York, NY, USA
.
Hu
A.
&
Demir
I.
2021
Real-time flood mapping on client-side web systems using hand model
.
Hydrology
8
(
2
).
https://doi.org/10.3390/hydrology8020065
.
ECMA International
.
2021
ECMAScript 2021 Language Specification
.
Geneva
.
Iowa Flood Center (IFC)
2018
Iowa-Flood-Center/asynch: A Numerical Library for Solving Differential Equations with a Tree Structure
.
Emphasis is given to hillslope-link river basin models. Available from: https://github.com/Iowa-Flood-Center/asynch (retrieved 7 July 2021)
.
Jackson
C.
2014
Average Time Spent on Each Step in the Simulation Process
. .
Jadidoleslam
N.
,
Mantilla
R.
,
Krajewski
W. F.
&
Goska
R.
2019
Investigating the role of antecedent SMAP satellite soil moisture, radar rainfall and MODIS vegetation on runoff production in an agricultural region
.
Journal of Hydrology
.
https://doi.org/10.1016/j.jhydrol.2019.124210
.
Jadidoleslam
N.
,
Goska
R.
,
Mantilla
R.
&
Krajewski
W. F.
2020
Hydrovise: a non-proprietary open-source software for hydrologic model and data visualization and evaluation
.
Environmental Modelling and Software
134
,
104853
.
https://doi.org/10.1016/j.envsoft.2020.104853
.
Jha
M. K.
,
Gassman
P. W.
&
Arnold
J. G.
2007
Water quality modeling for the raccoon river watershed using SWAT
.
Transactions of the ASABE
50
(
2
),
479
493
.
https://doi.org/10.13031/2013.22660
.
Krajewski
W. F.
,
Ceynar
D.
,
Demir
I.
,
Goska
R.
,
Kruger
A.
,
Langel
C.
,
Mantilla
R.
,
Niemeier
J.
,
Quintero
F.
,
Seo
B.
,
Small
S.
,
Weber
L.
&
Young
N. C.
2017
Real-time flood forecasting and information system for the state of Iowa
.
Bulletin of the American Meteorological Society
.
https://doi.org/10.1175/BAMS-D-15-00243.1
.
Li
Z.
&
Demir
I.
2022
A comprehensive web-based system for flood inundation map generation and comparative analysis based on height above nearest drainage
.
Science of The Total Environment
828
,
154420
.
https://doi.org/10.1016/j.scitotenv.2022.154420
.
Lohr
S.
2014
For big-data scientists, ‘Janitor Work’ is key hurdle to insights. New York Times. Available from: https://www.nytimes.com/2014/08/18/technology/for-big-data-scientists-hurdle-to-insights-is-janitor-work.html.
Mantilla
R.
,
2022
The hydrological hillslope-link model for space-time prediction of streamflow: insights and applications at the Iowa Flood Center
. In:
Extreme Weather Forecasting
, 1st edn (
Astitha
M.
&
Nikolopoulous
E.
eds.).
Elsevier
.
Mantilla
R.
&
Gupta
V. K.
2005
A GIS numerical framework to study the process basis of scaling statistics in river networks
.
IEEE Geoscience and Remote Sensing Letters
.
https://doi.org/10.1109/LGRS.2005.853571
.
MDN
2022
Using Web Workers. Available from: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API (retrieved 1 April 2022
).
Mozilla
K. V.
2013
Starting at the Sun: Dalvik vs. ASM.js vs. Native
. .
Mustajoki
J.
,
Hämäläinen
R. P.
&
Marttunen
M.
2004
Participatory multicriteria decision analysis with Web-HIPRE: a case of lake regulation policy
.
Environmental Modelling and Software
19
(
6
),
537
547
.
https://doi.org/10.1016/j.envsoft.2003.07.002
.
Peckham
S. D.
,
Hutton
E. W. H.
&
Norris
B.
2013
A component-based approach to integrated modeling in the geosciences: the design of CSDMS
.
Computers and Geosciences
.
https://doi.org/10.1016/j.cageo.2012.04.002
.
Press
W. H.
,
Flannery
B. P.
,
Teukolsky
S. A.
&
Vetterling
W. T.
1986
Numerical Recipes – The Art of Scientific Computing
, 1st ed.
Cambridge University Press
,
New York
.
Rottler
E.
,
Vormoor
K.
,
Francke
T.
&
Bronstert
A.
2021
Hydro explorer: an interactive web app to investigate changes in runoff timing and runoff seasonality all over the world
.
River Research and Applications
.
https://doi.org/10.1002/rra.3772
.
Seo
B. C.
,
Keem
M.
,
Hammond
R.
,
Demir
I.
&
Krajewski
W. F.
2019
A pilot infrastructure for searching rainfall metadata and generating rainfall product using the big data of NEXRAD
.
Environmental Modelling and Software
117
,
69
75
.
https://doi.org/10.1016/j.envsoft.2019.03.008
.
Sit
M.
,
Sermet
Y.
&
Demir
I.
2019
Optimized watershed delineation library for server-side and client-side web applications
.
Open Geospatial Data, Software and Standards
4
(
1
).
https://doi.org/10.1186/s40965-019-0068-9
.
Sit
M.
,
Langel
R. J.
,
Thompson
D.
,
Cwiertny
D. M.
&
Demir
I.
2021
Web-based data analytics framework for well forecasting and groundwater quality
.
Science of the Total Environment
.
https://doi.org/10.1016/j.scitotenv.2020.144121
.
Small
S. J.
&
Debionne
S. H. P.
2016
Built-in Models – Asynch 1.0 Documentation
.
Available from: https://asynch.readthedocs.io/en/latest/builtin_models.html (retrieved 7 July 2021)
.
Small
S. J.
,
Jay
L. O.
,
Mantilla
R.
,
Curtu
R.
,
Cunha
L. K.
,
Fonley
M.
&
Krajewski
W. F.
2013
An asynchronous solver for systems of ODEs linked by a directed tree structure
.
Advances in Water Resources
53
,
23
32
.
https://doi.org/10.1016/j.advwatres.2012.10.011
.
Strömbäck
L.
,
Pers
C.
,
Strömqvist
J.
,
Lindström
G.
&
Gustavsson
J.
2019
A web based analysis and scenario tool for eutrophication of inland waters for Sweden and Europe
.
Environmental Modelling and Software
111
,
259
267
.
https://doi.org/10.1016/j.envsoft.2018.07.012
.
Sulis
A.
&
Sechi
G. M.
2013
Comparison of generic simulation models for water resource systems
.
Environmental Modelling and Software
.
https://doi.org/10.1016/j.envsoft.2012.09.012
.
Sun
A.
2013
Enabling collaborative decision-making in watershed management using cloud-computing services
.
Environmental Modelling and Software
.
https://doi.org/10.1016/j.envsoft.2012.11.008
.
Swain
N. R.
,
Latu
K.
,
Christensen
S. D.
,
Jones
N. L.
,
Nelson
E. J.
,
Ames
D. P.
&
Williams
G. P.
2015
A review of open source software solutions for developing water resources web applications
.
Environmental Modelling and Software
67
,
108
117
.
https://doi.org/10.1016/j.envsoft.2015.01.014
.
Swain
N. R.
,
Christensen
S. D.
,
Snow
A. D.
,
Dolder
H.
,
Espinoza-Dávalos
G.
,
Goharian
E.
,
Jones
N.
,
Nelson
E.
,
Ames
D.
&
Burian
S. J.
2016
A new open source platform for lowering the barrier for environmental web app development
.
Environmental Modelling and Software
.
https://doi.org/10.1016/j.envsoft.2016.08.003
.
Teague
A.
,
Sermet
Y.
,
Demir
I.
&
Muste
M.
2021
A collaborative serious game for water resources planning and hazard mitigation
.
International Journal of Disaster Risk Reduction
53
,
101977
.
https://doi.org/10.1016/j.ijdrr.2020.101977
.
U.S. Army Corps of Engineers
.
2018
Hydrologic Modeling System HEC-HMS. User's Manual. Version 4.3
.
Hydrologic Engineering Centre
, Davis, CA.
Voinov
A.
&
Costanza
R.
1999
Watershed management and the Web
.
Journal of Environmental Management
56
(
4
),
231
245
.
https://doi.org/10.1006/jema.1999.0281
.
Walker
J. D.
2014
ABCD Model. Available from: https://abcd.walkerenvres.com/ (retrieved 30 March 2022
).
Walker
J. D.
&
Chapra
S. C.
2014
A client-side web application for interactive environmental simulation modeling
.
Environmental Modelling and Software
55
,
49
60
.
https://doi.org/10.1016/j.envsoft.2014.01.023
.
Walker
J. D.
,
Letcher
B. H.
,
Rodgers
K. D.
,
Muhlfeld
C. C.
&
D'angelo
V. S.
2020
An interactive data visualization framework for exploring geospatial environmental datasets and model predictions
.
Water (Switzerland)
.
https://doi.org/10.3390/w12102928
.
Wu
R.
,
Scully-Allison
C.
,
Rifat
M. H.
,
Painumkal
J.
,
Dascalu
S.
&
Harris
F. C.
2018
Virtual watershed system: a web-service-based software package for environmental modeling
.
Advances in Science, Technology and Engineering Systems
3
(
5
),
382
393
.
https://doi.org/10.25046/aj030544
.
Xu
H.
,
Muste
M.
&
Demir
I.
2019a
Web-based geospatial platform for the analysis and forecasting of sedimentation at culverts
.
Journal of Hydroinformatics
.
https://doi.org/10.2166/hydro.2019.068
.
Xu
H.
,
Demir
I.
,
Koylu
C.
&
Muste
M.
2019b
A web-based geovisual analytics platform for identifying potential contributors to culvert sedimentation
.
Science of the Total Environment
692
,
806
817
.
https://doi.org/10.1016/j.scitotenv.2019.07.157
.
Yildirim
E.
&
Demir
I.
2021
An integrated flood risk assessment and mitigation framework: a case study for Middle Cedar River Basin, Iowa, US
.
International Journal of Disaster Risk Reduction
56
,
102113
.
https://doi.org/10.1016/j.ijdrr.2021.102113
.
Zeng
Z.
,
Yuan
X.
,
Liang
J.
&
Li
Y.
2021
Designing and implementing an SWMM-based web service framework to provide decision support for real-time urban stormwater management
.
Environmental Modelling and Software
135
,
104887
.
https://doi.org/10.1016/j.envsoft.2020.104887
.
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/).

Supplementary data