1 Introduction

The water hammer event is a significant problem that usually occurs in hydraulic systems, such as water distribution pipelines or penstocks in hydroelectric power plants (HPP), and it is caused by transient flow. Transient flow is the type of flow that is observed during the period when the steady flow turns into an unsteady flow as a result of changes in the flow rates due to some boundary conditions and returns to a steady flow again after a relatively short duration. Sudden closure of a valve or a gate, failure of turbine flow regulation equipment, load rejection by a turbine, pump trip due to pump power loss, sudden changes in reservoir water level due to waves on the surface, etc. are all considered as changes in boundary conditions that result in the transient event. These changes can create dangerously high- or low-pressure waves that fluctuate back and forth in the pipeline. For this reason, it is crucial to check the likelihood of a water hammer event during the design stage in order to prevent its harmful effects. Otherwise, this issue may result in significant loss of life and property.

In the past, there have been major accidents due to harmful consequences caused by fluid transient phenomena. For instance, five people died in a significant disaster that Adamkowski [1] claims happened at the Bartlett Dam and Oneida Hydroelectric Power Plant in the USA due to improper operation of turbine valves. A further example is the accident that occurred in 1950 at the Oigawa HPP in Japan. According to Lupa et al. [2], this accident, known as a penstock burst, was brought on by an abrupt butterfly valve closing and resulted in the loss of three lives and $500 million in damage. Additionally, Sayano-Shushenkaya HPP in Russia experienced a severe accident in 2009. An abrupt closure of a turbine unit by a log was the initial culprit for the accident. This disaster resulted in severe damage and the deaths of 75 people [3].

From the past to the present, fluid transients and its impact on hydraulic systems have been important research area. Various studies have been conducted throughout history to observe the analysis and simulation of the transient flow or water hammer.

Wylie and Streeter [4, 5] developed an approach called the characteristics method to solve transient flow equations. Additionally, they developed computer codes written in the FORTRAN language that applied the characteristics method to hydraulic systems with a variety of boundary conditions. Similarly, Chaudhry [6] explains the basic principles of the method of characteristics and applications. Moreover, he provided FORTRAN codes and descriptions of various boundary conditions.

Karney [7] developed a computer program to analyze rapid transient events for large water distribution systems. The accuracy of the program is provided by comparing the results with experimental data. In a similar way, Izquierdo and Iglesias [8] created a program called "DYAGATS" that uses mathematical modeling to observe and simulate the water hammer phenomenon in simple hydraulic systems. In both of these programs, the method of characteristics was used to solve unsteady flow equations, which are momentum and continuity equations.

Koç [9] created a computer program using MATLAB 7.1 to examine transient events in hydraulic pipeline systems. Subsequently, this code was recreated in the C# programming language to provide a user-friendly program with a graphical interface for users. In this program, the method of characteristics is used to solve momentum and continuity equations in order to analyze transient events in pipeline systems with various boundary conditions.

Bozkuş [10] applied the method of characteristics for a water hammer investigation of pipelines between the Çamlıdere Dam and the Ivedik Treatment Plant. In this research, the characteristics method equations with interpolation features are used since the pipelines comprise numerous connected pipes with various characteristics. For the simulations of transient events that could occur in valve closure scenarios, a modified FORTRAN code is used. In order to ensure safe operations, the correct valve closure times were obtained.

Calamak and Bozkuş [11] studied protective measurements to prevent undesirable effects of water hammer that occur in the penstock of run-of-river hydropower plants. In this research, water hammer events that occurred by sudden load rejection in a small hydroelectric power plant were investigated with a commercial computer program called HAMMER, which uses the method of characteristics to solve nonlinear partial differential equations. They simulated some case studies with a pressure-reduced valve (PRV), flywheel, and safety membrane separately.

Dinçer [12] investigated the water hammer event in pumped storage hydropower plants. For Yahyalı Hybrid Power Plant, he used HAMMER software to simulate different water hammer cases, such as turbine load rejection, pump start-up, and shutdown. He examined these cases with and without surge tank devices to compare the results. The results obtained are also presented in another study by Dinçer and Bozkuş [13].

Dalgıç [14] developed a code called H-Hammer that can simulate transient flow in hydraulic pipeline systems. This program uses the method of characteristics to solve unsteady flow equations, and it can analyze hydraulic systems with various boundary conditions. However, it works with significant system requirements, such as the existence of AutoCAD, Visual Basic, and MS Excel programs. He validated the program with reliable benchmarks in the literature.

Another study in this research area is a computer software called S-Hammer, which was developed by Topraghghaleh [15] to use in the simulation of the transient event. This software is coded with C# programming language in the Visual Studio platform. In this software, the characteristics method is selected to use for solving the transient flow equations, as in previous studies, with various boundary conditions. In his study, by comparing the results with those found in the literature, the validity of the program was ensured.

In the local literature, it is observed that there is no software which is comprehensive to use and develop further easily, user-friendly, and has professionalism in visualization aspects. The main purpose of the present study by Uyanık [16] is to develop new, more user-friendly, and comprehensive domestic software that can analyze and simulate transient flow problems in pressurized pipeline systems with various boundary conditions. Also, this software has a proper code layout and infrastructure that can be easily improved with new additions in the future. It simulates successfully how pressure and flow in hydraulic systems vary over time. Accordingly, it is intended that users can identify potential problems and damage that may result from water hammer phenomenon and take preventative measures. In the newly developed software, the method of characteristics is used to solve nonlinear partial differential equations of transient flow.

The other objective of the study is to create software with more features compared to previous studies. Connecting the components in hydraulic systems with junctions, being able to enter local losses that may occur at the junctions, steady-state solution of the systems, increasing the variety of boundary conditions, are the technical improvements or rearrangements that can be mentioned. In addition, this developed software is more qualified and professional in terms of visuality and program interface than previous applications. The program has a drawing area to use in designing hydraulic systems as well as text fields for entering pertinent data. It is intended to utilize the software practically without the need for additional programs in this direction. This software takes the pipe chainage data at very small scale. As it is known, pipe chainage typically refers to the distance along the pipeline route or the location of a point along the pipeline, and in the context of fluid transients or simulations, the small scale generally refers to the level of detail or resolution in the presentations of the system. It is about how finely the simulation or model captures the features or variations in the system. In this study, these would be changes in diameter, roughness, or other localized features. This is important when small-scale variations have a notable effect on the fluid dynamics, such as pressure drops, turbulence, or other transient phenomena. The time scale is also a consideration. Fine-scale simulations may capture transient events or changes in the flow over very short time intervals. This is crucial for understanding dynamic behaviors in the fluid, especially during rapid changes in flow conditions. It was made sure in the software that each pipe having different characteristics (length, roughness, diameter, etc.) and connected with one another has “the same time interval” during the computations. This is crucial for satisfying the Courant condition which is required for converging to accurate results. This was accomplished with some interpolation techniques between pipes which is readily available in the literature. Small or fine scale in computational fluid dynamics implies a higher numerical resolution as well. This means using a finer grid or mesh to represent the geometry, allowing for a more accurate representation of the fluid behavior. However, this increased resolution comes at the cost of higher computational resources. It is believed the software captures transient phenomena in fine detail since “the same time interval” requirement is satisfied by the properly computed “space intervals” in each pipe and corresponding wave-speeds. The software also offers animations, tables, and graphs for displaying simulation results. The program can also show users the system's steady-state solution prior to the transient analysis. Additionally, this software includes a library window that lists the characteristics of the many fluid or pipe material types frequently used in the literature as well as auxiliary windows for calculating wave speed, friction factor, and Reynolds numbers. As an innovation, the order of the components in the drawn hydraulic model can be easily determined by the software. It must be mentioned that the essential goal of this study is to develop domestic software that is affordable, dependable, and an alternative to currently available expensive commercial software programs, to use for education and research purpose.

2 Transient Flow and Method of Characteristics

Flows can be divided into steady or unsteady flows. Flow characteristics, such as the discharge, pressure, and velocity observed at a certain location, are not time dependent for steady flows. However, in unsteady flows, these characteristics may change over time. The flow that is observed between the initial steady state and the next steady state is referred to as transient flow. It is an unsteady flow as well. Known data from the steady-state phase of the system can be used as initial values in the analysis of a transient flow event.

It is crucial to observe the fluid behavior during the transient event at a specific location in a certain time interval while conducting a transient flow analysis. In this way, the laws of conservation of mass and momentum must be applied to a defined control volume at first. The continuity and momentum equations are derived in terms of nonlinear partial differential equations of unsteady flow, as expressed in Eqs. (1 and 2), respectively, where P and V are the dependent variables and x and t are the independent variables.

$$\frac{\partial P}{{\partial t}} + V\frac{\partial P}{{\partial x}} + \rho a^{2} \frac{\partial V}{{\partial x}} = 0$$
(1)
$$V\frac{\partial V}{{\partial x}} + \frac{\partial V}{{\partial t}} + \frac{1}{\rho }\frac{\partial P}{{\partial x}} + \left( {g\sin \theta + \frac{{4\tau_{{\text{w}}} }}{\rho D}} \right) = 0$$
(2)

where D = pipe diameter (m), \(P\)= pressure (N/m2), \(\rho\)= fluid density (kg/m3), g = gravitational acceleration (m/s2), V = velocity of the fluid (m/s), a = acoustic wave speed (m/s), \({\tau }_{{\text{w}}}\)= wall shear stress (N/m2), x = distance along the pipe (m), t = time (s).

In the next step, the method of characteristics (MOC) is used to get four ordinary differential equations converted from momentum and continuity equations. It is important to mention that the system is assumed to have a quasi-steady friction model; then, the shear stress defined by Darcy–Weisbach can be applied in the simplifications. The transformation and simplification steps are detailed by Wylie & Streeter [5] and Chaudhry [6]. After the simplifications, C+ and C equations can be obtained as Eqs. (3 and 4). The upper parts of these equations are known as compatibility equations, and they are valid along the characteristic lines whose equations are provided in the lower parts.

$$C^{ + } \left\{ {\begin{array}{*{20}c} { + \frac{g}{a}\frac{{{\text{d}}H}}{{{\text{d}}t}} + \frac{{{\text{d}}V}}{{{\text{d}}t}} + f\frac{V\left| V \right|}{{2D}} = 0} \\ {\frac{{{\text{d}}x}}{{{\text{d}}t}} = a} \\ \end{array} } \right.$$
(3)
$$C^{ - } \left\{ {\begin{array}{*{20}c} { - \frac{g}{a}\frac{{{\text{d}}H}}{{{\text{d}}t}} + \frac{{{\text{d}}V}}{{{\text{d}}t}} + f\frac{V\left| V \right|}{{2D}} = 0} \\ {\frac{{{\text{d}}x}}{{{\text{d}}t}} = - a} \\ \end{array} } \right.$$
(4)

in which \(f=g{\text{sin}}\theta + fV\left|V\right|/2D\) and piezometric head = H = z + (P/γ).

In Eqs. (3 and 4), velocity (V) and piezometric head (H) are unknown variables. Solving the characteristic equations for each node and time in the pipeline is the main purpose. So, the finite difference approximation is used to discretize the compatibility equations in xt domain. The pipeline must first be separated into N number of segments, and their lengths are represented with \(\Delta x\) and the time steps are represented with \(\Delta t,\) as shown in Fig. 1. As a result, NS = N + 1 is used to denote the node number of the downstream end of the pipeline. In addition, it must be mentioned that in order to ensure convergence and obtain accurate findings, Courant condition (\(\Delta x/\Delta t\le a\)) must be satisfied. In general, setting \(\Delta t=\Delta x/a\) is desirable after deciding on \(\Delta x\).

Fig. 1
figure 1

Characteristics lines and notations for the nodal solution on x–t domain

In Fig. 1, AP and BP lines represent the C+ and C characteristics lines, respectively. The compatibility equations in Eqs. (3 and 4) are integrated along the AP and BP lines, respectively. Then, the expressions are written in terms of discharge (Q) instead of velocity. After some simplification, the general equations can be written as:

$$C^{ + } : H_{{P_{i} }} = C_{P} - {\text{BQ}}_{{P_{i} }} \;{\text{Where}}\;C_{P} = H_{i - 1} + {\text{BQ}}_{i - 1} - {\text{RQ}}_{i - 1} \left| {Q_{i - 1} } \right|$$
(5)
$$C^{ - } : H_{{P_{i} }} = C_{M} + {\text{BQ}}_{{P_{i} }} \;{\text{where}}\;C_{M} = H_{i + 1} - {\text{BQ}}_{i + 1} + {\text{RQ}}_{i + 1} \left| {Q_{i + 1} } \right|$$
(6)

R and B variables were defined to shorten the equations as:

$$B = \frac{a}{gA} R = \frac{f\Delta x}{{2gDA^{2} }}$$
(7)

The unknown H and Q values at each interior node in the pipeline can then be determined by simultaneously solving these compatibility equations. By removing the Q parameters from Eqs. (5 and 6) as indicated in Eq. (8), the H variable at point P can be identified; then, the Q variable at point P can be determined as in Eq. (9). For each interior node in a pipeline, this process can be repeated. If the beginning time is denoted by the notation t = t0, the determined H and Q values at t0 are used as new initial values in the following iteration, that is, t + ∆t.

$$H_{{P_{i} }} = \frac{{C_{P} + C_{M} }}{2}$$
(8)
$$Q_{{P_{i} }} = \frac{{C_{P} - H_{{P_{i} }} }}{B} = \frac{{H_{{P_{i} }} - C_{M} }}{B}$$
(9)

If the hydraulic system consists of pipes connected in series with different characteristics such as thickness, diameter, or material type (i.e., friction), as shown in Fig. 2, the transient solution must be computed separately. Due to this, a double subscription is utilized in the equations that contain both pipe name and node number.

Fig. 2
figure 2

Example of notations for pipes connected in series

Equations (10 and 11) can be expressed utilizing the continuity expression and the logic of the common piezometric head at the junction, provided that minor losses at the junction are ignored. The first and second subscripts stand for the pipe name and node numbers, respectively.

$$H_{{P_{{1,{\text{NS}}}} }} = H_{{P_{2,1} }}$$
(10)
$$Q_{{P_{{1,{\text{NS}}}} }} = Q_{{P_{2,1} }}$$
(11)

Now, with Eqs. (10 and 11), it is possible to simultaneously solve the compatibility equations, Eqs. (5 and 6) on C+ and C characteristics lines. Then, the value of \({Q}_{{P}_{\mathrm{2,1}}}\) can be computed by Eq. (12). Lastly, the unknown piezometric head value, HP, can be determined by Eqs. (5 or 6).

$$Q_{{P_{2,1} }} = Q_{{P_{{1,{\text{NS}}}} }} = \frac{{C_{{P_{1} }} - C_{{M_{2} }} }}{{B_{1} + B_{2} }}$$
(12)

where \(B_{1} = a_{1} /\left( {gA_{1} } \right) {\text{and}} B_{2} = a_{2} /(gA_{2} )\).

Additionally, only one characteristic line may be valid at some points, such as the downstream and upstream ends of the hydraulic system. At these boundaries, one compatibility equation with two unknowns cannot be solved. For this reason, an auxiliary equation at a boundary, or a value for one of the unknowns, may also be required to solve the equation and analyze the transient event.

3 The Software Program

In this study, a software program was developed to analyze fluid transients or water hammer occurring in pipelines. This program is coded with the C# programming language on the Visual Studio platform. This programming language was chosen for the study because Windows Forms applications make it possible to create computer programs with graphical or visual user interfaces.

When the program is opened, the main user interface appears first. There are four main sections on the main user interface of the program. These sections can be listed as (1) tab area, which presents different menus; (2) properties panel area where the input data can be entered for the objects in the hydraulic system; (3) message box section, which summarizes the actions taken by the user on the program; and (4) canvas drawing area where the user can visually design the hydraulic system. The locations of these sections and the main interface that appears at the beginning are shown in Fig. 3.

Fig. 3
figure 3

View of main user interface

There are six tabs in the interface of the program. They are File, Design, Analysis, Calculators, View, and Help. These tabs have various buttons and settings that can be used for a variety of functions. When the program is run, the 'File' tab is automatically presented to the user on the opening screen, as shown in Fig. 3.

The File tab contains 'New Project,' 'Load,' 'Save,' and 'Save as' buttons that allow you to create and save a new project or access an existing one. The Design tab includes valve closure settings, pump settings, an engineering library, initial conditions, analysis options buttons, and design component buttons such as Pipe, Reservoir, Valve, and Dead-End, Pump, Turbine, Junction, Air Chamber, and Surge Tank, as shown in Fig. 4. In the Analysis tabs, there are two types of button sets: run selection buttons, such as Start and Stop analysis buttons, and Simulation Results buttons, which are Steady-State Results, Tables, Animation Charts, Time Charts, Surge Tank Solution and Air Chamber Solution buttons. The Calculator tab contains Reynolds number, friction factor, wave speed calculators, and surge tank simulator buttons. The View tab contains visual settings and other function buttons for the drawing canvas area. This tab is divided into four sections: Grid Options, Draw Objects, Text Choices, and Canvas View options. Lastly, the Help tab includes the contact information and a button that opens the user guide document.

Fig. 4
figure 4

Design components and the drawings on the canvas area

This software can be used to analyze and simulate the transient event in hydraulic systems which contain single pipe or pipes connected in series. The method of characteristics and quasi-steady friction model were used for the transient analysis in the software. Before the transient analysis, steady-state analysis calculations can be observed and simulated. The program can do the calculations by correctly ordering the components of the analyzed hydraulic system. Analysis results can be observed in tabular, graphical, or live charts with various buttons on the analysis tab as shown in Fig. 5. Moreover, in the program, users can also determine some properties, such as the type of liquid flowing in the pipeline and the material type of the pipes in hydraulic systems.

Fig. 5
figure 5

View of the analysis tab

Additionally, in the program, some boundary conditions are used to analyze complex hydraulic systems. The boundary conditions are as follows: upstream reservoir with constant head, downstream reservoir with constant head, upstream reservoir with variable head, downstream dead-end, single centrifugal pump, air chamber with orifice, simple surge tank, surge tank with standpipe. These boundaries can be found frequently in most pipelines where transient events are expected. The equations and solution process of these boundary conditions are presented in Uyanık [16] in detail.

4 Validation of the Program

In the present study, the software was validated using reliable and appropriate benchmarks in the literature. In this paper, five different types of case studies are used, and their results are compared with those obtained by the new software. These cases are examples of valve closure in pipes connected in series, pump failure due to power loss, and a hydraulic system with a simple surge tank.

4.1 Case-1: Valve Closure in Single Pipe Scenario

The purpose of this case study is to prove that the calculations of fluid transient events that occur as a result of valve closure in a single pressurized pipe are performed accurately by the software. For this reason, an example used in Wood et al. [17] was selected as a benchmark. Wood et al. [17] used the characteristics method for this case, as was the case in the program. In this case study, the hydraulic system consists of an upstream reservoir with a constant head, pipe, and a downstream valve. In Fig. 6, the hydraulic system with notations and the visual model drawn on the program are shown side by side. In this example, the fluid transient event is caused by the closure of the valve at the downstream end.

Fig. 6
figure 6

Illustration of Case-1 and drawn model on the program

In this case study, the pipe's centerline is accepted as the datum line, which means that the hydraulic grade line elevation at the exit of the pipe (HEx) is zero. According to Wood et al. [17], hydraulic grade line elevation at the reservoir is 13.72 m, diameter of the pipe is 0.3 m, length of the pipe is 1098 m, wave speed for the pipe is 1098 m/s, initial discharge through the pipe (Q0) is 0.085 m3/s, valve closure time (Tc) is 10 s, the maximum time for the simulation (Tmax) is 10 s. In addition, for this case, the valve closure data are provided in tabular form Wood et al. [17].

In order to satisfy the Courant condition, the maximum allowed time step value is determined as 1 s, so the time step (∆t) is selected as 1 s for the simulation. Transient analyses and simulation results can be shown in the form of tables, time charts, and animation charts after all the data have been entered into the program's appropriate panels.

The results are compared to the results provided by Wood et al. [17] after being obtained in both tabular and graphical forms. The comparison graphs of time variations for the head (H) and discharge (Q) values at the valve section are shown in Fig. 7.

Fig. 7
figure 7

Comparison graphs of H versus t and Q versus t at the valve

As shown in Fig. 7, the comparison demonstrates how accurate the computed findings of the current study are to the case results reported by Wood et al. [17]. The highest difference, which is approximately 1.5 m, is obtained in the head at the fifth second for the valve section. The usage of different assumptions in the method of characteristics or differences in data used may be a reason for this difference. However, this discrepancy is negligible when considering the magnitudes.

4.2 Case-2: Valve Closure in Two Pipes Connected in Series Scenario

In this case study, the purpose is to prove that the calculations of fluid transient events that occur as a result of valve closure in two pressurized pipes connected in series are performed accurately by the software. In this way, an example used in Chaudhry [18] was selected as a benchmark. Chaudhry [18] used the characteristics method for this case, as was the case in the program. In this case study, the hydraulic system consists of a downstream valve, two pipes connected in series, and an upstream reservoir with a constant head. In Fig. 8, the hydraulic system with notations and the visual model drawn on the program are shown. In this example, the closure of the valve at the downstream end causes fluid transients event.

Fig. 8
figure 8

Illustration of Case-2 and drawn model on the program

In this case study, the pipe's centerline is accepted as the datum line. According to Chaudhry [18], the initial head at the valve (H0), which is in a steady-state condition, is 60.05 m, the initial discharge through the system (Q0) is 1 m3/s, the closure time of the valve (Tc) is 6 s, and the maximum simulation time (Tmax) is 10 s. Table 1 presents the properties of the first and second pipe, which are diameter, length, wave speed, and friction factor. Moreover, for this case, the valve closure data are provided in tabular form by Chaudhry [18].

Table 1 Properties of pipes in Case-2

In order to satisfy the Courant condition, the maximum allowed time step value is determined as 0.5 s, so the time step (∆t) is selected as 0.5 s for the simulation. Transient analyses and simulation results can be shown in the form of tables, time charts, and animation charts after all the data have been entered into the program's appropriate panels. At first, the initial water level elevation of the upstream reservoir (HR) can be calculated as 67.706 m. Then, at each nodal point, the program calculates all of the unknowns.

The results are compared to the results provided by Chaudhry [18] after being obtained in both tabular and graphical forms. The comparison graphs of time variations for the head (H) values at the valve and discharge (Q) values at the reservoir section are shown in Fig. 9.

Fig. 9
figure 9

Comparison graphs of H versus t at the valve and Q versus t at the reservoir

The results obtained in the current study are coincident with those reported in Chaudhry [18], as shown in Fig. 9. This demonstrates that the characteristics method is correctly coded in the program for pipe systems having configured as pipes connected in series.

4.3 Case-3: Valve Closure in Three Pipes Connected in Series Scenario

In this scenario (Case-3), the purpose is to prove that the calculations of fluid transient events that occur as a result of valve closure in three pressurized pipes having different characteristics and connected in series are performed accurately by the software. Therefore, an example used in Wylie et al. [19] was selected as a benchmark. Wylie et al. [19] used the characteristics method for this case, as was the case in the program. In this case study, the hydraulic system consists of a downstream valve, three pipes connected in series, and an upstream reservoir with a constant head. As shown in Fig. 10, the hydraulic system with notations and the model drawn on the program are visualized. In this benchmark, as previously, the closure of the valve at the downstream end causes fluid transients event.

Fig. 10
figure 10

Illustration of Case-3 and drawn model on the program

In Case-3, the datum line is accepted at the centerline of the pipe components. According to Wylie et al. [19], initial head value at the valve (H0), which is the head at the valve in the steady-state condition, is 100 m, initial discharge through the pipeline (Q0) is 0.2 m3/s, valve closure time (Tc) is 1.8 s, maximum time for the simulation (Tmax) is 2.1 s, and the time step for the simulation is 0.1 s.

The properties, which are diameter, length, wave speed, and friction factor values, of the pipes are given in Table 2. Moreover, valve closure tabular data are provided by Wylie et al. [19] for Case-3.

Table 2 Properties of pipes in Case-3

In order to satisfy the Courant condition, the maximum allowed time step value is calculated as 0.1 s, so the time step (∆t) is selected as 0.1 s for the case. Transient analyses and simulation results can be obtained in the form of tables, time charts, and animation charts after all the data have been entered into the program's appropriate panels.

At first, the initial reservoir head value (HR) is calculated as 289.036 m by the software. Then, the rest of the computations are made with help of calculated HR value. Finally, the software calculated the whole data at each node and connection points.

The wave speed values for the pipes are changed during the calculation time from 1200 m/s at the start of the computation to 1170, 1207.5, and 1150 m/s for "Pipe 1," "Pipe 2," and "Pipe 3," respectively. This modification, which is the consequence of the software's grid mesh selection, is designed to guarantee the stability of the Courant condition without changing the outcomes.

The results are compared to the results provided by Wylie et al. [19] after being obtained in both tabular and graphical forms. The comparison graphs of time variations for the head (H) values and discharge (Q) values at the valve are shown in Fig. 11.

Fig. 11
figure 11

Comparison graphs of H versus t and Q versus t at the valve

The results obtained in the current study are coincident with those reported in Wylie et al. [19], as shown in Fig. 11. This also demonstrates that the characteristics method is correctly coded in the program for pipe systems having configured as pipes connected in series.

4.4 Case-4: Pump Failure Scenario

The validation of the software for pump failure scenarios is provided with an example case study presented by Wylie et al. [19]. In this case study, called Case-4, the hydraulic system consists of an upstream reservoir, a downstream reservoir, a constant diameter pipeline between the two reservoirs, and a pump with a discharge valve. It is assumed that the pump failure occurs at t = 0 due to a sudden power loss. Furthermore, 1.5 s after the power loss, a discharge valve located just downstream of the pump begins to close. The hydraulic system model of the case is shown in Fig. 12.

Fig. 12
figure 12

Illustration of Case-4 and drawn model on the program

In Case-4, the datum line is assumed to be at the water surface level of the upstream reservoir. Table 3 shows the list of known data for the system presented by Wylie et al. [19].

Table 3 Given data for Case-4 by Wylie et al. [19]

Then, in the software's properties panels, the properties of the downstream reservoir, pipeline, pump, discharge valve, and upstream reservoir components are entered in the appropriate areas. The pump characteristics (Suter) curve and the rated values from Table 3 are defined in the software in order to enter pump properties. The benchmark utilizes the pump characteristics curve for NS = 35 rpm. In order to satisfy the Courant condition, a maximum time increment value of 0.4 s is determined. So, the time increment can be set to 0.2 s. Moreover, 12 s has been chosen as the maximum time for the simulation. Then, tabular valve closure data are inserted into the software based on the information provided by Wylie et al. [19].

Following the input of all data, firstly steady-state and later transient analyses can be performed. The initial discharge of the system is calculated as 0.1805 m3/s in the steady-state calculation. Next, the software program computed the unknowns at each node using the transient analysis. Tables, time charts, and animation chart forms can be used for the observation of transient analyses and simulations. The results, which have been acquired in both tabular and graphical forms, are then compared with those given by Wylie et al. [19]. Next, the head values at the pump section are graphically compared for the time intervals of [0–4.8] and [7.6–10.8] as shown in Fig. 13. Moreover, the discharge values at the pump section are graphically compared for the same time intervals, as shown in Fig. 14.

Fig. 13
figure 13

Comparison graphs of H versus t at the pump

Fig. 14
figure 14

Comparison graphs of Q versus t at the pump

The results computed from the present software are quite accurate and remarkably similar to those provided by Wylie et al. [19], as shown in Figs. 13 and 14. Even though the results are very similar, there are some negligible differences in the results. These negligible differences could be the result of the unit conversions and the node numbers used in the analyses. According to Wylie et al. [19], the node number is chosen to be four. The developed software computes the node number as two based on the time increment value. It should be noted that the inputs and outputs are provided in US Customary units in the literature. For this program, the data were converted to SI units. It is possible that there was a minor conversion error since the digits were truncated. Consequently, with this case study, the code is deemed to be validated for the pump trip or failure circumstances.

4.5 Case-5: Computations for a Simple Surge Tank

In this case study (Case 5) presented by Cofcof [20], the hydraulic system consists of a large upstream reservoir that has a constant head, an energy tunnel, a simple surge tank, a downstream control valve, and a penstock before the turbine unit. It should be noted that Cofcof [20] simulated this case study using empirical equations. Figure 15 provides an illustration of the system and notations for Case 5. In this case, a complete load rejection at the turbine at "t = 0" is examined. Then, the case is analyzed to observe water surface oscillation in the surge tank.

Fig. 15
figure 15

Illustration of Case-5 and drawn model on the software

According to data described by Cofcof [20], water surface elevation in the reservoir (WSER) is 350 m, the elevation of the tunnel centerline (WSER) is 310 m, the maximum value of initial discharge through the energy tunnel for the first operation (Qtmax ) is 40 m3/s, the maximum value of initial discharge through the energy tunnel for the second operation (Qtmin) is 25 m3/s, the head losses in the energy tunnel for Qmax and Qmin are 8.72 m and 3.45 m, respectively, length of the penstock (Lp) is 170 m, the length of the energy tunnel (Lt) is 4000 m, the diameter of the tunnel (Dt) is 4 m, the diameter of the penstock (Dp) is 3.1 m, diameter of the surge tank (Dst) is 15 m, and turbine flow (Qturbine) is taken as zero.

This case is analyzed on the surge tank simulator panel of the software. In order to analyze the case, in the solution of the equations, the Runge–Kutta method is utilized. In the surge tank simulator panel, all data are entered into the appropriate areas. In order to accurately detect changes in the water surface level in the surge tank, a simulation time of 1000 s was used. Then, a time increment of 0.5 s is chosen.

The Darcy–Weisbach equation is used to calculate the friction head losses in the tunnel, with a friction factor of 0.017. This case is analyzed and simulated for the tunnel discharge of 45 m3/s and 25 m3/s separately.

The highest change in water surface level from the static water level (Y1) for this case with Qtunnel value of 40 m3/s and 25 m3/s is calculated as 12.96 m and 8.87 m, respectively, as presented in Figs. 16 and 17. Next, the case is analyzed and simulated again to examine the value of the maximum increase in water level in the surge tank from the static water level under frictionless conditions (Ymax). For this reason, the friction factor is entered as zero in the simulations. As a result, the computed Ymax values are 17.36 m and 10.85 m for Qtunnel values of 40 m3/s and 25 m3/s, respectively.

Fig. 16
figure 16

Simulation of Case-5 for Qtunnel = 40 m3/s in the surge tank simulator

Fig. 17
figure 17

Simulation of Case-5 for Qtunnel = 25 m3/s in the surge tank simulator

Finally, as shown in Table 4, results computed in the surge tank simulator panel are compared to the results in Cofcof [20].

Table 4 Comparison of Y1 and Ymax values for Case-5

The comparison, which is observed in Table 4, shows that the results of the current study are close and similar to those reported in Cofcof [20]. On the other hand, there are small differences in the results. Different way of head loss computations, use of different methods, and consideration of minor losses can all lead to these differences.

5 Discussions and Recommendations

The developed software has some advantages compared to the previous studies. In this section, the innovative features of the program are presented as advantages. However, some recommendations and additional features that can be added in future studies are also listed for improvement.

The software has been tested against several transient analysis benchmark cases successfully. It is observed that the program can analyze the cases with an acceptable speed of computation. The computer run times of all 5 cases that are tested on the software are less than 1 s. According to the observation, Case-1, Case-2, Case-3, Case-4, and Case-5 are analyzed in 0.08, 0.09, 0.08, 0.11, and 0.82 s, respectively. On the other hand, the complexity of the hydraulic systems or the selection of a smaller time increment value may cause the run time to increase.

The software's ability to identify the item order in the designed hydraulic system is a key innovation. In other words, the software can sort the system and present a solution by taking into account the change in order, if users add a new component to any position in the system or delete a component from the hydraulic system. The software is more user-friendly because of this ability.

The software can operate independently without depending on additional applications like AutoCAD and MS Excel because it has its own drawing canvas area and a variety of useful panels, graphics, and text areas to enter inputs. This ability is quite useful for users.

The steady-state analysis of the system is also available for users in the developed software. This is important since the steady-state results are required as the initial conditions for the unsteady-state analysis. Additionally, the software includes wave speed, friction factor, and Reynolds number calculator windows if the user wants to compute them separately for any reason.

The software can analyze the transient flow of hydraulic systems that contain a single pipe or pipes connected in series. Then, the simulation results can be observed as tables, graphs, and animations. However, hydraulic systems that include parallel pipes or branch connections are not added into the software yet. These configurations will be added in the future. In addition, the feature of importing a sketch from AutoCAD can be added to the software, if the hydraulic system has a large number of junctions. This option can make the software more user-friendly.

For pipes connected in series systems, the software can analyze numerous transient flow scenarios with varying boundary conditions, which is mentioned in previous sections. However, the current program excludes an air chamber with a standpipe, pumps connected in series or parallel, and turbine boundary conditions. Furthermore, additional commonly used boundary conditions, such as various types of valves, air valves, and protective devices, are not included in the designed software. The addition of these new boundary conditions, along with computational methodologies, is recommended to be considered in future research.

The developed software provides the computations of minor losses between the pipes and entrance losses. However, there is no validation for this feature in this study. This ability can be validated with appropriate benchmarks in future investigations.

Similarly, even though elevations of junctions in the hydraulic system can be entered as textbox inputs in the junction properties panels, this function is not used in the calculations, and no software verification is supplied. Some improvements and modifications should be made to the program in the future for hydraulic systems with sloped pipes.

The developed software uses SI units and a quasi-steady friction model in the computations. Alternatively, different unsteady friction models and U.S. Customary units options can be added to the program to provide more choices in future studies.

There are also various well-known commercial computer programs available to analyze transient flows. Those commercial programs are very sophisticated, more comprehensive and expensive. It is known that they were created by large teams in a professional manner with significant investments over an extended period of time. Therefore, the software developed in the present study, for the time being, may not be considered equivalent to them by no means. At this stage, it is developed just for research and educational purposes. However, it is believed that the current study is a small initial step toward developing an accurate and more affordable local software for dealing with transient analysis problems in pressurized pipeline systems.

6 Conclusion

In the current study, a local software was developed to analyze and simulate the transient flow in pressurized pipeline systems, which consist of various boundary conditions for educational purposes. The boundary conditions are as follows: upstream reservoir with a constant head, upstream reservoir with a variable head, downstream reservoir with a constant head, a valve located at downstream end of a pipeline, a valve located at an interior point, single pump, air chamber with an orifice, simple surge tank, and surge tank with standpipe. The widely used method of characteristics (MOC) was utilized in the software to investigate unsteady pipe flow. The program was validated by comparing the results of various benchmark studies from the literature with those determined by the software developed in this study. The simulations of the benchmarks can be observed graphically, tabularly, or as a graphical animation in the developed program without requiring any external program or high system requirements on any computer. Despite being user-friendly already, a user guide has been created to make this program even easier to use more effectively.

In this paper, five different case studies were tested on the program. In Case 1, the fluid transients caused by the valve closure in a hydraulic system containing a pressurized single pipe were examined by comparing the head and discharge data at the valve end. In Case 2, the fluid transients caused by the valve closure in a hydraulic system containing two pressurized pipes were examined by comparing the discharge data at the reservoir and the head data at the valve end. In Case 3, the fluid transients caused by valve closure in a hydraulic system containing three pressurized pipes were examined by comparing the head and discharge data at the valve end. In Case 4, the fluid transients caused by the sudden loss of power of the pump in a hydraulic system were examined by comparing the head and discharge data. In Case 5, the water surface oscillations in a surge tank caused by the load rejection of the turbine in a hydraulic system were examined. The fact that the results found in the literature and the results calculated in this study are similar or identical validates the software.

Despite the fact that the software has numerous features, there is still considerable potential for advancement, and new features may be incorporated into the program. Future research on the subject might include additional boundary conditions as well as the calculation approach for more complicated hydraulic pipeline systems. However, it is deemed that it might be seen as an important step toward developing a local alternative that is both economical and user-friendly in the near future.