# 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 2:**

Assume your flow directions – first, guess:

**Step 3:**

Define your flow unknowns:

– Q16 = Q12 | 1^{ST} Unknown

– Q25 | 2^{nd }Unknown

– Q56 | 3^{rd} Unknown

– Q34 | 4^{th} Unknown

– Q45 | 5^{th} Unknown

– Q23 |6^{th} Unknown

**Step 4:**

Define your equations:

2 loops = 2 equations:

Head losses in a pipe is estimated as follow using the Darcy-Weisbach equation:

K_{pipe }. Q^{2}_{pipe } > > > K_{pipe }is equal to where ‘f ‘ is the friction factor calculated using the Colebrook – white equation.

So for loop 1, the equation is:

K16.Q16^{2} + K12.Q12^{2}+K25.Q25^{2}-K56.Q56^{2} = 0, replace Q12 with Q16 because Q12=Q16

K16.Q16^{2} + K12.Q16^{2}+K25.Q25^{2}-K56.Q56^{2} = 0

Equation for loop 2 is:

K23.Q23^{2} + K34.Q34^{2}– K25.Q25^{2}-K45.Q45^{2} = 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.Q16^{2} + K12.Q16^{2}+K25.Q25^{2}-K56.Q56^{2} = 0

K23.Q23^{2} + K34.Q34^{2}– K25.Q25^{2}-K45.Q45^{2} = 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

**Colebrook – white equation. If you decide to use the**

__explicit__**form of the Colebrook – white equation, then additional**

__exact implicit__**should be added to the 6 equations above. Luckily we have the**

__7 implicit Colebrook – white equations__**– white equation and for the purpose of this document, we will use it.**

__explicit approximations of Colebrook__f: friction factor

l: length, m

D: diameter, m

Q: flow rate, m^{3}

A: Cross-sectional area, m^{2}

*ρ: *Density, Kg/m^{3}

g: gravity acceleration, m/s^{2}

**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.

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

Link 1-2:

Diameter = 0.6 m, Roughness = 0.000001

Link 2-3:

Diameter = 0.4 m, Roughness = 0.000001

Link 3-4:

Diameter = 0.2 m, Roughness = 0.000001

Link 4-5:

Diameter = 0.3 m, Roughness = 0.000001

Link 6-5:

Diameter = 0.2 m, Roughness = 0.000001

Link 1-6:

Diameter = 0.6 m, Roughness = 0.000001

Link 2-5:

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.