# Water network modeling – Newton-Raphson Method

This design guide explores the Newton-Raphson method in solving clean water networks. The numerical method is used widely in current commercial engineering software. The theory is explained through an example of a looped network system completely which is solved step by step.

Step 1:

Step 2:

Assume your flow directions – first, guess:

Step 3:

– Q16 = Q12 | 1ST Unknown

– Q25 | 2nd Unknown

– Q56 | 3rd Unknown

– Q34 | 4th Unknown

– Q45 | 5th Unknown

– Q23 |6th Unknown

Step 4:

2 loops = 2 equations:

Head losses in a pipe is estimated as follow using the Darcy-Weisbach equation:
Kpipe . Q2pipe   > > >   Kpipe is equal to     where ‘f ‘ is the friction factor calculated using the Colebrook – white equation.

So for loop 1, the equation is:

K16.Q162 + K12.Q122+K25.Q252-K56.Q562 = 0, replace Q12 with Q16 because Q12=Q16
K16.Q162 + K12.Q162+K25.Q252-K56.Q562 = 0

Equation for loop 2 is:

K23.Q232 + K34.Q342– K25.Q252-K45.Q452 = 0

4 more equations needed to solve the 6 unknowns, let’s look at some flow conservation:

Node 6 > 25l/s – Q16 – Q56 = 0

Node 4 > Q56 + Q25 – Q45 = 0

Node 2 > Q12 – Q25 – Q23 = 0, Replace Q12 with Q16 because Q12 = Q16

Q16 – Q25 – Q23 = 0

Node 3 > Q23 – Q34 -10 = 0
Summary of equations:

25l/s – Q16 – Q56 = 0
Q56 + Q25 – Q45 = 0
Q16 – Q25 – Q23 = 0
Q23 – Q34 -10 = 0
K16.Q162 + K12.Q162+K25.Q252-K56.Q562 = 0
K23.Q232 + K34.Q342– K25.Q252-K45.Q452 = 0

The 6 equations above require solving using the Newton-Raphson method through the Jacobian matrix but we need to be careful while dealing with the K values in our equations. As mentioned earlier each K value is dependent on the diameter of the pipe and the friction factor. The friction factor is also dependent on the flow rate, therefore, K values must be replaced with the approximated explicit Colebrook – white equation. If you decide to use the exact implicit form of the Colebrook – white equation, then additional 7 implicit Colebrook – white equations should be added to the 6 equations above. Luckily we have the explicit approximations of Colebrook – white equation and for the purpose of this document, we will use it.

f: friction factor

l: length, m

D: diameter, m

Q: flow rate, m3

A: Cross-sectional area, m2

ρ: Density, Kg/m3

g: gravity acceleration, m/s2

Step 5:

How to solve the system of equations using Newton – Raphson method?

First:

You need to assume the values of the unknown flow rate; this will be called Trial 0.

Trial 0 assumption:

Second: list all the links parameters, Diameter and roughness factors:

Diameter = 0.6 m, Roughness = 0.000001

Diameter = 0.4 m, Roughness = 0.000001

Diameter = 0.2 m, Roughness = 0.000001

Diameter = 0.3 m, Roughness = 0.000001

Diameter = 0.2 m, Roughness = 0.000001

Diameter = 0.6 m, Roughness = 0.000001

Diameter = 0.2 m, Roughness = 0.000001

Assume all mains in this example have a length of 1m

Third: Write the following Jacobian Matrix:
The Jacobian matrix is made of the differential of the six equations with respect to the different unknown flows (Q)
Replace K with its equivalent as per equation (3), the function below should be with respect to Q.

The above matrix will be equal to:

The Newton iterative method is defined by:

Step 6:

Inserting the Trial 1 flow rates values in the Jacobian matrix will give the following:

Let’s find the inverse of the Jacobian Matrix:

A third trial can be carried out to reduce the % error but the answer above is satisfactory.