anders markendahl302882/... · 2010. 3. 10. · anders markendahl the muscl-hancock finite volume...

78
UPTEC F10 014 Examensarbete 30 hp February 2010 Finite volume simulation of fast transients in a pipe system Anders Markendahl

Upload: others

Post on 14-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

UPTEC F10 014

Examensarbete 30 hpFebruary 2010

Finite volume simulation of fast transients in a pipe system

Anders Markendahl

Page 2: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

2

Page 3: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Teknisk- naturvetenskaplig fakultet UTH-enheten Besöksadress: Ångströmlaboratoriet Lägerhyddsvägen 1 Hus 4, Plan 0 Postadress: Box 536 751 21 Uppsala Telefon: 018 – 471 30 03 Telefax: 018 – 471 30 00 Hemsida: http://www.teknat.uu.se/student

Abstract

Finite volume simulation of fast transients in a pipesystem

Anders Markendahl

The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient flow problem. A derivation and analysis of the axial forces inside a pipe system due to a flow transient is also performed.

The following slope limiters were implemented and compared: MC, van Leer, van Albada, Minmod and Superbee. The comparison was based on the method's ability to calculate the forces due to a flow transient inside a pipe system.

The tests and comparisons in this thesis show that the MC, van Leer, van Albada and Minmod limiters behave very much the same for the flow transient problem. If one would rank these four limiters with respect to the numerical error, the order would be the one presented above, the MC limiter being the most accurate. The error the four limiters produce is mainly of diffusive nature and it is just the magnitude of the diffusion that seems to differ between the methods. One should also note that the workload rank of the four limiters is the same as the order presented above. The MC limiter being the least efficient of the four and the Minmod limiter the most efficient.

In most of the tests performed the Superbee limiter display a rather negative unpredictable behavior. For some relatively simple cases this particular approach shows big difficulties maintaining the dynamical properties of the force. However, the upside of the Superbee limiter is its remarkable ability to maintain the maximum value of the forces present in the pipe system, preventing underestimation of the maximum magnitude of the force.

ISSN: 1401-5757, UPTEC F10 014Examinator: Tomas NybergÄmnesgranskare: Gunilla KreissHandledare: Per Nilsson

Page 4: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

4

Page 5: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Sammanfattning

Snabba strömningstransienter är en förändring i tryck och hastighet som skerunder en kort tid. Processen kan till exempel uppkomma i ett rörsystem vidstängningen av en ventil. Den snabba förändringen i tryck och hastighet hos�uiden kan resultera i stora krafter på rörsystemet. Krafterna kan i sin turåstadkomma brott och sprickor i rören eller andra sorters deformationer. Pågrund av detta är det viktigt att ha pålitliga och noggranna numeriska metoderför att beräkna dessa krafter.

Undersökningar av vilka numeriska metoder som passar bäst vid ett specielltströmningstransient problem, studeras ofta utifrån hur noggrannt variablernatryck och hastighet beräknas. Denna rapport fokuserar istället på vad somhänder när metoder jämförs utifrån beräkningarna av krafter i rörsystemet.

Studien har begränsats till att jämföra MUSCL-Hancock metoden, vilket ären �nit volymmetod av andra ordningens noggrannhet. Jämförelsen fokuserarpå olika sorters lutningsbegränsare (slope limiters). Lutningsbegränsarna ärolika sätt att dämpa oscillationer som annars uppkommer i den numeriskalösningen när andra ordningens metoder används. Följande begränsare harjämförts: Minmod, Superbee, MC, van Leer och van Albada. Ett rörsystembestående av en trycktank, rörsegment och en ventil användes för att utförasimuleringarna och analyserna. Vanligt vatten användes och en stängning avventilen orsakar strömningstransienten inuti rörsystemet.

Det numeriska felet har studerats främst genom att analysera två olika egen-skaper hos de numeriska metoderna. Den första egenskapen är metodernas för-måga att beräkna och bibehålla den dynamiska informationen hos krafterna isystemet. Den andra egenskapen är beräkning av maxvärdet hos krafterna.

Testerna och jämförelserna som har utförts visar att MC, van Leer, vanAlbada och Minmod begränsaren beter sig väldigt lika för strömningstransientproblemet som har behandlats. Om man rangordnar dessa fyra lutningsbegrän-sare utifrån det numeriska felet så skulle ordningen bli den som de presenteradesovan i detta stycke, med MC begränsaren som den mest noggranna. Det nu-meriska felet hos dessa fyra begränsare har visats sig vara av di�usiv typ, detvill säga att det numeriska lösningen tenderar att bli utsmetad. Metodernaskiljer sig bara genom omfattningen av denna di�usion. Det är också värt attnämna att beräkningsbördan hos dessa olika begränsare är också ordningen somnämns ovan; MC begränsaren har störst arbetsbörda och Minmod använder sigav minst datorkraft.

Det positiva med Superbee begränsaren är dess enastående förmåga attberäkna magnituder av krafterna, vilket förebygger underskattning av maxkrafternai systemet. Denna begränsare visar också mindre numeriskt fel när simuler-ingstiden ökades, jämfört med de andra metoderna. Trots detta är Superbeeinte en begränsare som har visat sig särskilt pålitlig. I de �esta testerna somhar utförts har Superbee begränsaren haft ett negativt, oförutsägbart beteende.Under många relativt enkla förhållanden visar Superbee begränsaren tydligaproblem med att bibehålla de dynamiska egenskaperna hos kraften. Superbeeär även den begränsaren som använder sig av mest datorkraft vid användning.

5

Page 6: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

6

Page 7: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Contents

1 Introduction 91.1 Prologue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

1.1.1 The company . . . . . . . . . . . . . . . . . . . . . . . . . 91.1.2 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 9

1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.3 Problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . 101.4 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.5 The pipe system . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.6 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.6.1 Introduction to slope limiters . . . . . . . . . . . . . . . . 111.7 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2 Model 132.1 Governing equations . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.1.1 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . 142.1.2 Boundary conditions . . . . . . . . . . . . . . . . . . . . . 14

2.2 The pipe system . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.3 Flow transients . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.4 Forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.4.1 Force pro�les . . . . . . . . . . . . . . . . . . . . . . . . . 162.4.2 Wave propagation . . . . . . . . . . . . . . . . . . . . . . 182.4.3 Force acting on a pipe segment . . . . . . . . . . . . . . . 20

3 Method 253.1 Finite volume methods (FVM) . . . . . . . . . . . . . . . . . . . 25

3.1.1 Discretization/approximation of the axial force. . . . . . . 253.1.2 Boundary conditions in FVM . . . . . . . . . . . . . . . . 263.1.3 Godunov scheme and Riemann problems . . . . . . . . . . 283.1.4 Reconstruct, evolve and average algorithm (REA) . . . . 293.1.5 MUSCL-Hancock (M-H) . . . . . . . . . . . . . . . . . . . 313.1.6 Slope limiters . . . . . . . . . . . . . . . . . . . . . . . . . 33

3.2 Numerical error . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373.2.1 Numerical di�usion . . . . . . . . . . . . . . . . . . . . . . 373.2.2 Numerical dispersion . . . . . . . . . . . . . . . . . . . . . 383.2.3 Comparing force pro�les . . . . . . . . . . . . . . . . . . . 383.2.4 Order of a method . . . . . . . . . . . . . . . . . . . . . . 40

3.3 Estimating an error . . . . . . . . . . . . . . . . . . . . . . . . . . 403.3.1 Maximum value . . . . . . . . . . . . . . . . . . . . . . . . 403.3.2 Regular norms . . . . . . . . . . . . . . . . . . . . . . . . 413.3.3 Dynamic load factor (DLF) . . . . . . . . . . . . . . . . . 41

7

Page 8: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

4 Tests 434.1 Basic pipe system . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.2 Parameters of the pipe system . . . . . . . . . . . . . . . . . . . 444.3 Workload of the limiters . . . . . . . . . . . . . . . . . . . . . . . 45

5 Numerical experiments/Discussion 475.1 Basic pipe system . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

5.1.1 CFL=0.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 475.1.2 CFL=0.95 . . . . . . . . . . . . . . . . . . . . . . . . . . . 545.1.3 CFL=0.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 545.1.4 Pressure vs force . . . . . . . . . . . . . . . . . . . . . . . 55

5.2 Changing closing time of valve . . . . . . . . . . . . . . . . . . . 585.3 Changing the length of the middle pipe segment . . . . . . . . . 635.4 The order of the methods . . . . . . . . . . . . . . . . . . . . . . 665.5 Workload of the limiters . . . . . . . . . . . . . . . . . . . . . . . 67

6 Conclusion/Summary 696.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696.2 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696.3 Further work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

A Appendix 75A.1 Slope limiters derivation . . . . . . . . . . . . . . . . . . . . . . . 75A.2 Minmod/maxmod function . . . . . . . . . . . . . . . . . . . . . 76A.3 Compare MATLAB implementation with C . . . . . . . . . . . . 76A.4 Courant number (CFL) is equal to 1.0. . . . . . . . . . . . . . . . 77A.5 Computer speci�cations. . . . . . . . . . . . . . . . . . . . . . . . 77

8

Page 9: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

1 Introduction

1.1 Prologue

1.1.1 The company

This thesis was produced at the company ÅF-TÜV Nord AB in Helsingborg,Sweden. ÅF-TÜV Nord is a collaboration between the two companies ÅF fromSweden and TÜV Nord Group from Germany. It is an accredited inspectionbody, AIB, which means that ÅF-TÜV Nord are certi�ed for third party in-spection of mechanical designs within the nuclear power industry in Sweden.

1.1.2 Acknowledgements

First of all I would like to thank the company ÅF-TUV Nord in Helsingborg forgiving me the opportunity to work on this thesis. My supervisor at ÅF-TÜVNord Per Nilsson Ph.D. deserves special thanks for his encouraging attitude,helpful discussions and interest in my work.

I would also like to thank my supervisor at Uppsala University Prof. GunillaKreiss at the Department of Information Technology for answering my manyquestions.

Anders Markendahl, Uppsala, January 2010.

1.2 Background

Fluid �ows can occur in many di�erent kind of situations; the �ow of air aroundthe wings of an airplane, the blood �ow inside the human body or the �ow ofan oilspill in the ocean. In this thesis the focus lies on the �ow of water insidea pipe system, that could for example reside inside a nuclear powerplant.

Fast transient �ow is a �ow where the velocity and pressure changes over ashort duration in time. Due to the rapid changes in a fast transient �ow thename �uid hammer �ow is also often used.

A fast �ow transient inside a piping system can be caused by a number ofdi�erent situations. The rapid change in pressure and velocity could for examplebe the result of the stopping and starting of a pump or the opening and closingof a valve. In this thesis the latter is assumed and implemented.

The rapid changes of the pressure and velocity travels through the pipesystem resulting in forces acting on the di�erent pipe segments. Forces occuringinside the pipe system is a critical element when the construction of a pipesystem is to be carried out. The impact of the forces on the pipes should not beunderestimated since it could lead to unwanted movement of the pipes and itssuspension, which in turn could lead to pipe ruptures or lasting deformations.

Accurate numerical methods are needed in such a system to make sure thatthe real forces and their impact on the system are not underestimated.

9

Page 10: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

1.3 Problem formulation

The main task will be to compare di�erent �nite volume methods to see whichmethods that calculates the forces inside a pipe system with the least amountof error. This is done in order to make a suggestion of what numerical methodsthat are suitable for the �ow simulation of a fast transient problem. Whenstudying the accuracy of a method in computational �uid dynamics the focusoften lies with the computation of pressure and velocity. In this thesis thecomputation of the forces will instead be the part where the comparison of thenumerical methods are made. This approach is necessary since the forces arethe quantities that in the end decides the impact on the pipe system due to the�ow transient.

The accuracy of the methods is broken down into two primary properties.The �rst property is that the methods should not underestimate the magnitudeof the forces present in the system. This is of course an important contributorto the impact on the pipe system.

The second property is the methods ability to calculate and capture thedynamical properties of the forces, which means how fast the forces changes.This is also a very important factor for the impact on the pipe system sincea �uctuating force can have a big impact on a pipe system, even if the forcemagnitude is fairly low.

1.4 Objectives

The goal is to construct and simulate a suitable event in a pipe system in orderto be able to compare the accuracy of the di�erent �nite volume methods. Theaccuracy refers to the the calculation of the forces in a pipe system.

Simulations are carried out by numerically solving a system of partial di�er-ential equations with respect to the variables pressure and velocity.

Even though the accuracy of the methods is the main focus, a small com-parison of the di�erent methods workload/e�ciency will also be performed.

1.5 The pipe system

The pipe system that is used to investigate the accuracy of the di�erent methodsis shown in �gure 1.1. It consists of a pressure tank with constant pressure Ptank,a number of pipe segments and a valve with a constant pressure on the otherside Pright. A closing of the valve triggers a pressure wave that propagatesthrough the system resulting in forces on the pipe segments.

1.6 Approach

The main goal is to �nd a method that will capture and preserve the shapeof the pressure wave and in turn calculate the resulting forces with the leasterror. To �nd the method that is best suited, the total axial force acting onthe two 10 m pipe segments in �gure 1.1 are calculated. The pressure wave

10

Page 11: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Pressure tank

Valve

10 m 10 m

60 m

90 m

PtankFF 12

Pright

Figure 1.1: The pipe system used for the transient simulations

(and the resulting force) �rst reaches the segment corresponding to the forceF1 and a while later reaches the segment corresponding to the force F2. Thecorrectness of the methods are estimated by comparing the forces F1 and F2.According to the theory, the force acting on the two segments should be identicalin magnitude and only shifted in time, see chapter 2.4.2 for discussion on thattopic.

There are an endless number of di�erent numerical methods available, butthis comparison is made between �nite volume methods (FVM). The �nite vol-ume method is a well known and often used method when it comes to computa-tional �uid dynamics (CFD). There are of course other approaches that will notbe considered in this thesis, perhaps the most common are: the �nite di�erencemethod and the �nite element method.

The �nite volume method is known for its ability to handle rapid changes andshocks in the solution, which makes it suitable for a water hammer problem.This property is rooted in the fact that �nite volume methods are so calledconservative schemes, see [6] for further information on that topic. Handlingcomplex geometries is another important ability of the �nite volume methods.The method does not need a structured mesh like the classical �nite di�erenceapproach.

1.6.1 Introduction to slope limiters

An important part of �nite volume methods are the slope limiters, functionsused to reduce the oscillations and overshot caused by second order �nite volumemethods. These functions are compared to see how complicated the method willhave to be, in order to describe the forces su�ciently. The pros and cons of thedi�erent limiters are studied.

11

Page 12: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

1.7 Related work

The work by Zhao and Ghidaoui [13] is related to this thesis. The implementa-tion of the boundary conditions are based on their work. A similiar pipe systemwas used and the comparison included some numerical methods that are alsopresent here. The numerical error was there de�ned by measuring the energydissipation of the methods over time and did not focus on the calculation of theforces.

The work by Nilsson [9] is the main inspiration for this thesis. The approachof using the forces F1 and F2 to estimate the error of a method , see section 1.6,was very much in�uenced by [9]. A similiar pipe system was also used and thecomparison basically included the same methods used in [13]. The numericalerror of the methods was estimated by just monitoring the maximum values ofthe forces inside the system.

There are two main di�erences between the papers mentioned above andthe work done in this thesis. Firstly, the comparison of the numericals methodsalso take the dynamical properties of the solution into account. Secondly, more�nite volume methods are included in the comparison, even if the main class ofmethods is basically the same.

12

Page 13: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

2 Model

2.1 Governing equations

The governing system of partial di�erential equations for the study of a one-dimensional water hammer �ow are equations (2.1) and (2.2) [6].

∂p(x, t)

∂t+ ρc2

∂u(x, t)

∂x= 0 (2.1)

∂u(x, t)

∂t+

1

ρ

∂p(x, t)

∂x= 0 (2.2)

where p is pressure, u is velocity, ρ density, c the pressure wave propagationspeed of the �uid i.e. the speed of sound, t time variable and x is the spacevariable in the lengthwise direction of the pipe. Note that the value p is notthe actual pressure but merely the perturbation from a given pressure state.These governing equations are the result of a number of assumptions and someare explained in the next section. No consideration is taken to what sort ofpipe is used containing the �uid. The sti�ness of the pipe and other propertiesare completely left out of the governing equations and it is only the �uid itselfthat decides the propagation of the �ow. The governing equations for a waterhammer problem stems from linearizing the non-linear Navier-Stokes equationsaround some state. For a thorough derivation to the water hammer equationsthe reader can consult the literature, for example [6].

Equations (2.1) and (2.2) forms a hyperbolic system of partial di�erentialequations. The characteristic behaviour of a hyperbolic system is that a per-tubation in the boundary or initial conditions travels through the system at a�nite speed.

The governing equations can be rewritten by introducing the vector q asseen in equation (2.3).

qt +Aqx = 0 (2.3)

where q(x, t) =

(p(x, t)u(x, t)

), A =

(0 ρc2

1/ρ 0

)and subscripts denotes the

partial derivative. The wave propagation speed and density are in this thesisset to be 1500m/s and 1000kg/m3 respectively, which are approximate values ofthe speed of sound and density in regular, gas-free water. This notation of thegoverning equation (2.3) and the variable q is used frequently during the rest ofthe thesis. The variable q is sometimes shown as a one dimensional variable in�gures. This is just a simpli�cation made, and the value of q is in reality de�nedas a two dimensional vector containing the values of the pressure and velocity.

A vector Aq is in this context called the �ux function of the linear governingequation (2.3). The �ux function Aq(xi, tj) represents the �ux of q throughpoint xi at time tj [6].

13

Page 14: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

2.1.1 Limitations

Here follows a short description of some of the assumptions made when using(2.3) as the governing equation.

No wall friction The wall friction of the pipe is neglected. This means thatthe �ow through the pipe system does not loose any energy or momentumdue to friction against the pipe. The shape of the water transient should beunchanged during the simulation, so the di�erence that do arise is solely dueto the numerical error of the methods. This fact is explained further on in thethesis.

One dimensional The �ow inside the pipe system is computed in one dimen-sion only. This is an approximation/restriction of the complexity of the �ow andcan be seen as a uniform �ow in each cross section of the pipe. The forces thatare monitored are strictly in axial direction and the pipe has a constant area.

Pipe bending Since the model does not contain wall friction and the �ow isconsidered one dimensional the e�ect of the pipe bends is in a way neglected.The �uid �ow itself is not a�ected by pipe bends, but when the forces on aspeci�c pipe segment is calculated the pipe bends are considered, see section2.4.3.

2.1.2 Boundary conditions

The model problem is well posed by the boundary conditions de�ned for the pipesystem in �gure 1.1. A pressure tank at the left boundary (x = 0) correspondsto a constant pressure, equation (2.4). A valve on the right boundary (x = L)corresponds to a relationship between the pressure and the velocity, equation(2.5) [7].

p(0, t) = ptank (2.4)

1

2ρu(L, t)2 = α(t)2(p(L, t)− pright) (2.5)

where ptank is the pressure in the tank, pright the pressure on the other side ofthe valve and α is the opening coe�cent of the valve, α = 1 for fully open andα = 0 for fully closed valve. From equation (2.5) follows that the velocity fora fully closed valve is equal to zero. The valve closes linearly in time betweentstart and tstop so the corresponding α as a function of time is α(t) = 1− t−tstart

tstop.

Maybe a more common notation is the loss coe�cient KL = 1/α2 , which isthe variable that have been used in the implementation during this project, seeequation (2.6).

p− pright =KLρu

2

2(2.6)

14

Page 15: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Pressure tank

Valve

10 m 10 m

60 m

90 m

PtankFF 12

Pright

x

Figure 2.1: The pipe system used for the transient simulations

where pright is the pressure on the other side of the valve.The actual de�nition of the loss coe�cient is KL = 1/α2 − 1, which results

in a zero pressure di�erence when the valve is fully open. However, some kindof pressure di�erence and loss is needed at a fully open valve to make the math-ematical problem well-posed and the system stable. Using the simpli�cationKL = 1/α2 instead gives a pressure di�erence of ρ2u

2 Pa for a fully open valve.The needed pressure loss can be interpreted as a property of the used valve.This can represent a non-ideal valve, still having a small pressure loss whenbeing fully open.

2.2 The pipe system

The model domain is the pipe system in �gure 2.1. It consists of a pressure tankwith constant pressure Ptank and a valve with a constant pressure on the otherside Pright. The length of the middle pipe segment is set to be 90m for most ofthe simulations which gives a total pipe system length of 170m. However, forcertain tests the middle segment has a varying length. At the beginning of thesimulation the valve is fully open and after a certain amount of time the valvecloses linearly. Before the valve starts to close, the �uid in the pipe system moveswith a constant velocity and the pressure is constant. The starting velocity andpressure in the pipe system is chosen in a way that no discontinuities occur atthe boundaries. A closing of the valve results in a �ow transient going throughthe pipe system resulting in a pressure change and an acceleration of the �uid.The acceleration of the �uid will in turn result in forces acting on the pipesegments inside the system.

2.3 Flow transients

The closing of the valve de�nes what sort of transient that travels through thepipe system. In this thesis this is enforced as a boundary condition at one sideof the pipe system. In �gure 2.2 the general shape of the transient is shown in

15

Page 16: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 2.2: Shape of pressure transient. Closing time of valve 0.1s

pressure, the x-axis of 0−10m gives an idea of the extent of the transient insidethe pipe system. The change in pressure (and corresponding change in velocity)propagates through the pipe system resulting in forces upon the pipe segments.

In order to alter the shape of the transient the closing time of the valve canbe changed. The closing time is later on used as a parameter when comparingthe di�erent numerical methods, see section 4.2. When decreasing the closingtime of the valve the shape of the pressure transient goes towards somethingthat looks similiar to a step function, see �gure 2.3. The static pressure in thesystem is 500Pa and the height of the step function is 1.5MPa, which meansthat the transient ranges from values between 500Pa− 1.5005MPa.

2.4 Forces

Solving the governing equations mentioned in the section 2.1 results in valuesof the pressure and velocity through the pipe system. The main interest inthis thesis is to monitor how well the numerical methods manage to computethe corresponding forces. From the pressure or velocity given by solving thegoverning equations one can compute the total axial force acting on a speci�cpipe segment. This is explained in detail during this chapter.

2.4.1 Force pro�les

The force pro�le is the way that the forces are monitored in this thesis. A forcepro�le shows the total axial force on a speci�c pipe segment as a function of

16

Page 17: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 2.3: Shape of pressure transient for di�erent closing times of the valve.

time during the passing of the water hammer. The shape of the force pro�leis of course decided by the boundary condition enforced at the valve. Theclosing process of the valve can be de�ned in numerous ways and is discussed insection 3.1.2. In this thesis the closing process of the valve yields a force pro�lewith both smooth transitions and sudden changes in order to see the �aws ofthe di�erent methods. Forces upon the pipe segments should also stem froma realistic occurence in the pipe system, in this case a realistic closing of thevalve. In �gure 2.4 the general shape of the force pro�le for a 10m pipe segmentcan be seen.

The smooth part of the force pro�le is the process when the pressure transient, see �gure 2.2, enters the pipe segment. Then a sudden drop of the force givesa jagged shape at the top. This is the part that shows a di�erence if a shorterclosing time was to be used, see �gure 2.3. A shorter closing time would resultin a more �attened top of the force pro�le, as discussed in section 2.4.3. This isfollowed by a smooth downward slope, corresponding to the pressure transientsexit from the pipe segment, ending with a sharp edge back to zero force on thepipe segment. The shape of the force pro�le is quite simple but it also includesmany good properties that numerical methods often �nd hard to manage.

The actual shape of the force pro�le also depends on whether or not thepressure wave can be enclosed into the 10m pipe segments where the forces arecomputed. This is one of the reasons for a rather drastic change in the shape ofthe force pro�le when the closing time of the valve is varied, see result section5.2.

17

Page 18: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 2.4: Shape of the force pro�le.

2.4.2 Wave propagation

Before a derivation of the force on a pipe segment can be discussed the wavepropagation of the values in pressure and velocity needs to clari�ed.

qt +Aqx = 0 (2.7)

Equation (2.7) is the partial di�erential system that needs to be solved. But�rst it is important to understand what happens in the one dimensional case,when the matrix A is instead a constant a and the variable q is instead a scalarvariable u. It is important since equation (2.7) is later on rewritten as twodecoupled equations of that form. The one dimensional equation (2.8) is oftencalled the advection equation.

ut + aux = 0 (2.8)

Equation (2.8) is a scalar, constant-coe�cient PDE of hyperbolic type. And itcan be seen that any di�erentiable function on the form u(x, t) = u(x− at) is asolution to equation (2.8), easily veri�ed below. A variable substitution is madein order to do this veri�cation: x− at = φ(x, t).

∂φ

∂t=∂(x− at)

∂t= (−a)

∂φ

∂x=∂(x− at)

∂x= 1

18

Page 19: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

u(x−at)t+au(x−at)x =∂u(φ)

∂φ

∂φ

∂t+a

∂u(φ)

∂φ

∂φ

∂x=∂u(φ)

∂φ(−a)+a

∂u(φ)

∂φ(1) = 0

(2.9)It is also understood that the solution to equation (2.8), the value of u, isconstant whenever x−at is constant. Which means that the solution is the samealong the lines that is de�ned by equation (2.10), where C is some constant.These lines in the x − t plane are called characteristics. The values of u(x, t)travel along the characteristics with the velocity a. This concludes that thevalues of u travels with a velocity a and the values remains constant.

x− at = C ⇒ x = C + at (2.10)

Decoupled equations Now turning the focus back to the actual governingequation (2.7).

The eigenvalues and corresponding eigenvectors of the matrix A is denotede1, e2 and r1,r2 respectively. Matrix R and E are the eigen matrices de�ned inequation (2.11).

R =(r1r2

), E =

(e1 00 e2

)(2.11)

Assuming that matrix A has two distinct real eigenvalues the diagonalizationequation of the matrix A can be seen in equation (2.12) [1].

R−1AR = E (2.12)

Using the diagonalization property the governing equation can be rewritten asseen below.

R−1qt +R−1ARR−1qx = 0⇒ R−1qt + ER−1qx = 0

Making a variable substitution R−1q = w =

(w1

w2

)results in the �nal decou-

pled equations (2.13).

w1t + e1w

1x = 0

w2t + e2w

2x = 0

(2.13)

Water hammer problem. The governing equations (2.1) and (2.2) is on the

form (2.7) with q =

(pu

)and A =

(0 ρc2

1/ρ 0

). The eigen values e1, e2

and corresponding eigen vectors r1,r2 for matrix A can be seen in equation(2.14).

e1 = c , r1 =

(ρc1

)e2 = −c , r2 =

(−ρc

1

) (2.14)

19

Page 20: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

The solution to equation (2.7), written in the new variable w, is traveling with

velocities c and −c. The solution in the new variable w =

(w1

w2

)consists of

the two waves corresponding to each of the w components. w1 travel with avelocity c and w2 with velocity −c.

2.4.3 Force acting on a pipe segment

In this section the goal is to derive the forces that the �uid exercises on a segmentof the pipe.

General pipe segment. Newton's second law of motion states that the forceacting upon a body is equal to the change in momentum. In this case the bodyis a control volume containing the �uid.

F =d

dt(p) =

d

dt(mu) (2.15)

where p is momentum, m stands for mass and u is the velocity. The rate ofchange in momentum in the control volume can be rewritten using Reynoldsfamous transport theorem, equation (2.16). See for example Wesseling [12] or[8] for reference.

d

dt(mu) =

ˆc.v.

d

dt(ρu)dV +

ˆc.s.

ρu(u · dA) (2.16)

where ρ stands for density, c.v. is the control volume and c.s. is the controlsurface enclosing the control volume.

The �rst integral computes the change in momentum inside the control vol-ume and the second integral represents the loss and gain of momentum over theboundary, e.g. that the control volume will gain and lose �uid with di�erentmomentum. One can also represent the forces acting on the �uid as seen in�gure 2.5 which results in equation (2.17).

F = R−ˆAin

PdAin −ˆAout

PdAout (2.17)

R is the reaction force on the �uid from the pipe. The integrals in (2.17)describe the pressure forces from the surrounding �uid. Combining equations(2.15), (2.16) and (2.17) results in the total force from the pipe acting on the�uid.

De�ne a new variable, T , as the forces from the �uid onto the pipe. Then byNewton's third law, it is understood that this force must be equal to R but withopposite sign. The surface-integral in equation (2.16) can be simpli�ed, sinceno �uid exits or enter the control volume through the pipe wall. The scalarproduct u · dA is zero at the surface corresponding to the pipe wall, which givesus equation (2.18).ˆ

c.s.

ρu(u · dA) =

ˆAin

ρu(u · dA) +

ˆAout

ρu(u · dA) (2.18)

20

Page 21: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

out

PdA

PdA

in

Ain

Aout

R

Figure 2.5: Forces acting on the �uid inside a pipe segment.

Using equation (2.18) the formula for the force acting on the pipe segment canbe derived, equation (2.19).

T = −R = −(

ˆc.v.

d

dt(ρu)dV+

ˆAin

ρu(u·dA)+

ˆAout

ρu(u·dA)+

ˆAin

PdAin+

ˆAout

PdAout)

(2.19)

Axial force. Equation (2.19) is a general expression that is applicable forany pipe segment. This equation is simpli�ed in order to be applicable for thecurrent �ow simulation. A more speci�c case emerges, see �gure 2.6.

The speci�c pipe segment and the �ow within is assumed to have the fol-lowing properties:

1. Constant area over the whole pipe, denoted Area.

2. Uniform �ow at any cross-section area.

The axial direction of the force is the x-direction, see �gure 2.6. The vector dAin equation (2.19) is the normal vectors to the in�ow and out�ow surfaces. Thesurface integrals in equation (2.19) will only have components in the directionnormal to the x-direction, the y-direction. This conclusion gives the force actingon the pipe segment in the x-direction. Tx = −

´c.v.

ddt (ρux)dV and property

21

Page 22: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

y-direction

x-direction

Figure 2.6: Speci�c pipe segment.

1 and 2 of the system give the �nal axial force from the �uid onto the pipe,equation (2.20). This is only valid if the pipe segment has two 90 degree bendsat each end. The interval [a, b] is the range of a pipe segment in the x-direction.

Tx = −Area · ρˆ b

a

d

dt(ux)dx (2.20)

where Area is the cross-section area of the pipe.

Force pulse travels with velocity c. The total force, T , acting on asegment at time t is:

T = −Area · ρˆ b

a

∂u

∂tdx (2.21)

As seen in section 2.4.2, equation (2.12) is used to rewrite the variable q interms of w . p and u (the components of q) are linear combinations of the twowaves w1 and w2. Remember that w1 and w2 in this case are two waves goingin opposite directions.

ρcw1 − ρcw2 = pw1 + w2 = u

As seen in equation (2.21) the force behaves as the term ∂u/∂t. Since theboundary condition at the valve is the only thing that causes the pressure wavethrough the pipe, the velocity u in the domain is only represented by the leftgoing wave. A disturbance in the velocity u, that travels with a velocity c, inturn result in a disturbance of the acceleration ∂u/∂t that travels by the samespeed. The analytical solution is that the force pulse travels by the speed c andthe force pro�le at the second segment should be identical to the one computedat the �rst pipe segment.

Another representation of the force. Equation (2.21) can be rewrittenusing the second part of the original governing equation (see equation 2.2) to getan expression for the force that is not directly connected to the time derivative.

22

Page 23: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Instead it uses the derivative of the pressure with respect to space, equation(2.22).

T = Area

ˆ b

a

∂p

∂xdx (2.22)

Representing the force as a function of the pressure gives two advantages in thecomputational sense. The velocity or pressure derivative needs to be approxi-mated and this is done by central di�erence. When using equation (2.21), theforce computation needs the velocity for three consecutive time steps. By using(2.22) this is not the case and the force in each time step is given only by valuesfrom the current time step.

This way of representing the force can also help understanding what happensto the force pro�le when the closing time of the valve becomes very short,mentioned in section 2.3. The pressure change in the problem considered in thisthesis is not di�erentiable at all points, see �gure 2.2. If one would assume fora moment that the change was smooth and di�erentiable, then equation (2.22)could be simpli�ed as in equation (2.23). This is done by the fundamentaltheorem of calculus.

T = Area

ˆ b

a

∂p

∂xdx = Area(pb − pa) (2.23)

The force acting on a pipe segment would be decided only by the di�erence inpressure when comparing the left and right edge of the pipe segment. So if thepressure change of the transient would be a step function (in�nitely short closingtime) the force pro�le would have the shape of a hat function. It can be brokendown in the following way: The force pro�le represents the total (axial) forceacting on a pipe segment as a function of time. Before the transient has reachedthe segment the di�erence pb−pa is equal to zero and the total force is then zero.The moment the transient (step function) enters the pipe segment the di�erencebecomes4p and the corresponding force is Area4p. When the transient travelsinside the pipe segment the force is the constant value Area4p. The momentwhen the transient has passed through the segment the force returns to a zerovalue. This process results in a hat function of the force pro�le with heightArea4p. Where Area is the area of the pipe and 4p is the magnitude ofthe pressure change for the transient. For the transient used in this thesis thechange in pressure is 1.5MPa, see section 2.3, and the area of the pipe is set tobe 0.1m2. This in turn results in a theoretical height of the force pro�le to be0.15MN , if an ideal step function de�ned the pressure change of the transient.

As mentioned in section 2.3, the pressure change is never really a step func-tion. This characteristic is either way worth remembering for when the closingtime of the valve is used as a parameter. See result section 5.2.

23

Page 24: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

24

Page 25: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Q Q Q

f fi,left i,right

t

t

nn+1

i-1 i+1i

n

n

n+1

n

Q i

n n

Figure 3.1: Sketch of a �nite volume method

3 Method

3.1 Finite volume methods (FVM)

A �nite volume method divides the space region into cells, i.e. �nite volumes.Each cell i has a cell average Qi that is an approximation of the average valueof q over the cell. Here one should remember that the cell average Qi actually

contains two averages Qi =

(PiUi

), a cell average for the pressure denoted Pi

and one for the velocity, Ui. These cell averages are, in each time step, updatedusing approximations of the �ux at the cell boundaries as seen in equation (3.1)[6]. A sketch over the cells in �nite volume methods can also be seen in �gure3.1. The approximated �uxes at the boundaries are denoted fni,left ≈ (Aq)leftand fni,right ≈ (Aq)right respectively.

Qn+1i = Qni −

∆t

∆x(fni,right − fni,left) (3.1)

where ∆x and ∆t is the space and time discretization sizes. The approxima-tion used to obtain the �uxes fni,left and f

ni,right de�nes di�erent kinds of �nite

volume methods. This way of updating the cell values gives a straight-forwardtime stepping scheme. For further information on the subject of �nite volumemethods see for example [6].

3.1.1 Discretization/approximation of the axial force.

Here follows a discretization of equation (2.20) , the total axial force acting ona pipe segment.

When the �nite volume method is used, the segment [a, b] (the control vol-ume) is divided into cells. These cells are here numbered 1, 2, 3...N . Inside thei : th cell the velocity, u, is represented by the cell average value Ui. The integralcan be simpli�ed as a sum of parts from each cell.

T = −Area · ρN∑i=1

ˆcelli

d

dt(Ui)dx (3.2)

25

Page 26: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Cell 1 Cell 2 Cell N

f f1/2 N+1/2

Figure 3.2: Boundary �uxes for the �nite volume methods.

Equation (3.2) is also discretized in time by using a central di�erence scheme.This gives a �nal formula for computing the forces on the pipe, see equation(3.3).

T = −Area · ρN∑i=1

ˆcelli

d

dt(Ui)dx ≈ −Area · ρ

N∑i=1

ˆcelli

(Un+1i − Un−1

i

2∆t)dx =

= −Area · ρN∑i=1

(Un+1i − Un−1

i

2∆t)

ˆcelli

dx = −Area · ρ∆x

2∆t

N∑i=1

Un+1i − Un−1

i

Tnc.v. = −Area · ρ∆x

2∆t

N∑i=1

Un+1i − Un−1

i (3.3)

where i is the cell index and n is the time index. Equation (3.3) gives the forceacting on a pipe segment, c.v., stretching from cell number 1 to cell number N .Since equation (3.3) is implicit one can shift the equation in time to be able touse it explicit at each time step.

Tn−1c.v. = −Area · ρ∆x

2∆t

N∑i=1

Uni − Un−2i (3.4)

At each time step the force for the chosen segment can be calculated. Thecalculation gives the axial force on the pipe segment for the previous time step.

3.1.2 Boundary conditions in FVM

The implementation of the boundary conditions used in the model problem aremainly based on [13]. When using the �nite volume approach to solve a problem,the boundary condition is implemented by de�ning the �uxes at the utmost celledges. The two �uxes are denoted f1/2 and fN+1/2 for the �uxes at the �rstand last cell edge respectively, see �gure 3.2.

26

Page 27: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

These are the �uxes f1,leftand fN,rightwith the notation used in section 3.1.The superscripts n represents the value in a cell at the previous time step,subscripts 1 and N denotes the �rst and last cell. Then the �uxes are set in thefollowing way (for each time step):

f1/2 = A

(p1/2

u1/2

)(3.5)

fN+1/2 = A

(pN+1/2

uN+1/2

)(3.6)

where p1/2,u1/2 and pN+1/2, uN+1/2 are related by the Riemann invariant equa-tions (3.7) and (3.8) according to [13]:

p1/2 − ρcu1/2 = pn1 − ρcun1 (3.7)

pN+1/2 + ρcuN+1/2 = pnN + ρcunN (3.8)

Pressure tank The cell edge that corresponds to the reservoir should havethe constant pressure of the tank, i.e. p1/2 = preservoir. By combining equation(3.5) and (3.7), the �ux at the reservoir cell edge is given by (3.9).

f1/2 =

((ρc2(u+ 1/ρc(preservoir − pn1 )

1ρpreservoir

)(3.9)

Valve At the other end of the pipe there is a valve. The closing processof the valve is done linearly in time and generates the �ow transient. Thelinearity in time refers to the area of the valve, which can be seen as a pipe withquadratic cross section and a closing slot moving with constant velocity. It canalso describe a circular cross section with a slot that moves with the correctvelocity in order to have the opening area decrease linearly in time. This is aboundary that is subdivided into two parts.

Values pN+1/2 and uN+1/2 are inserted into equation (2.6) in order to getequation (3.10).

pN+1/2 − pright =KLρ

2u2N+1/2 (3.10)

Equations (3.6), (3.8) and (3.10) gives the �ux at the edge corresponding to thevalve, see equation (3.13). The system of equations (3.8) and (3.10) �rst needsto be solved, and the solution can be seen in equations (3.11) and (3.12):

uN+1/2 = − c

KL+

c

KL

√1 +

2KL

ρc2(pnN − pright + ρcunN ) (3.11)

pN+1/2 = pright +KLρ

2u2N+1/2 (3.12)

fN+1/2 = A

(pN+1/2

uN+1/2

)=

(ρc2uN+1/2

1ρpN+1/2

)(3.13)

27

Page 28: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

For a fully closed valve, the condition states that we want no �ow over theboundary, i.e. uN+1/2 = 0. This condition together with equations (3.6) and(3.8) gives us the �ux at a boundary corresponding to a fully closed valve, seeequation (3.14).

fN+1/2 =

(0

1ρpnN + cunN

)(3.14)

The equation used to include the loss coe�cient KL, equation (2.6), is takenfrom the work in [7]. The methods in [7] are not �nite volume methods butinstead node based schemes. A node based scheme enforces the boundary valueat the outmost node and the �nite volume methods instead enforces the value atthe edge of the outmost volume. This might result in a shift of the solutions whencomparing di�erent resolutions. However, the comparison of the force pro�lesF1and F2 is done at the same resolution. This means that the performed studyshould not be a�ected by this behaviour of the solutions.

3.1.3 Godunov scheme and Riemann problems

A very important �nite volume method is the Godunov scheme. This schemeis of �rst order accuracy1. The idea of the scheme, however, is used in manyother methods of higher order accuracy, especially the higher order methodspresented in this thesis.

A linear system of the form (3.15) is used in this thesis.

qt +Aqx = 0 (3.15)

The �ux functions for such a system when using the �rst order Godunov methodcan be seen in equations (3.16).

fni,left = AQni,leftfni,right = AQni,right

(3.16)

The values Qni,left and Qni,right are solutions to the so called Riemann problems

that can be de�ned at the left and right boundary of the cell, due to the fact thatthe value inside each cell is considered constant. Next follows a short descriptionof the Riemann problem and its solution.

A Riemann problem are the conservation laws , in this case equation (3.15),together with the special initial condition which contains a single discontinuity.The Riemann problem for the acoustic equation can be seen in equation (3.17).

qt +Aqx = 0

A =

(0 ρc21ρ 0

)(3.17)

q0 = q(x, 0) =

{ql x < 0qr x > 0

1The order of a method describes how the magnitude of the error depends on the dis-

cretization size, see section 3.2.4

28

Page 29: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

The solution to the Riemann problem consists of two discontinuities travelingin the positive and negative x-directions. This separates the solution into threedi�erent states, creating a middle-state in-between that is denoted by the valueqm. The discontinuities travel with velocities corresponding to the eigenvaluesof the matrix A. A sketch of the solution presented at t = 0 and also a small stepahead in time is seen in �gure (3.3) and (3.4) respectively. These sketches are asimpli�cation of the problem in equation (3.17) since the variable q is actuallytwo dimensional.

The solution to the Riemann problem is therefore completely decided by thevalue in the middle-state (and the eigenvalues of matrix A). The middle-statevalue is given by equation (3.18) [6].

qm = w1r r

1 + w2l r

2 (3.18)

w1r and w2

l are de�ned in the same way as in section (2.4.2). R−1ql = wl =(w1l

w2l

)and R−1qr = wr =

(w1r

w2r

). Two Riemann problems are solved

at each side of the cell since two discontinuities will arise, one at each edge.When updating the cell average Qni , the Riemann problem needs to be solvedfor (ql, qr)left = (Qni−1, Q

ni ) on the left boundary and (ql, qr)right = (Qni , Q

ni+1)

on the right boundary. These two Riemann problems leads to the correspondingmiddle-state solutions qleftm = Qni,left for the left boundary and qrightm = Qni,rightfor the right boundary.

Equations (3.1) and (3.16) gives the �nal formulation (3.19) for updatingthe cell average using the Godunov scheme.

Qn+1i = Qni −

∆t

∆x(AQni,left −AQni,right) (3.19)

It should be noted that this �rst order Godunov scheme is, in the particularproblem considered in this thesis, identical to the Method of Characteristics.This connection is derived in the work by Zhao and Ghidauoi [13]. The schemeis widely used when solving conservation law problems like the one seen inequation (3.15). This method is throughout the rest of the paper referred to asthe �rst order Godunov scheme or simply the �rst order scheme/method.

3.1.4 Reconstruct, evolve and average algorithm (REA)

The �rst order Godunov scheme can actually be seen as a special case of theREA-algorithm. The algorithm is named after the three components of the pro-cess. Reconstruction is the step where the cell averages are used to reconstructthe complete function q(x, tn). The evolution step is where the conservationlaws are used to evolve the function from tn to tn+1. The last step means thatthe complete function needs to be averaged in order to the get the cell averagesat time tn+1.

In the Godunov scheme the reconstruction step is simpli�ed and the cellaverages themselves are used for the reconstruction of q(x, tn), see �gure 3.5.

29

Page 30: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

l

r

q

q

q

x

Figure 3.3: Initial state of a Riemann problem.

l

r

q

q

q

x

qm

Figure 3.4: State of the Riemann problem a small step forward in time.

30

Page 31: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

This widely used �rst order method is known to be e�cient when implementedproperly.

3.1.5 MUSCL-Hancock (M-H)

The original Godunov scheme is, as stated earlier, of �rst order accuracy. To geta more accurate method from the Godunov scheme a more precise reconstructionstep is needed. Second order accuracy can be obtained by using piecewise linearapproximations instead of the constant approximation used in the Godunovscheme, see �gure 3.6.

The MUSCL-Hancock scheme is one of the methods that is based on theGodunov scheme and it is second order accurate in both time and space [11].There are several other MUSCL schemes available but the M-H scheme di�ersfrom many of the others because of its second order accuracy in the time domain[3]. The M-H scheme uses a linear function inside each cell to approximate thefunction q(x, tn) over the cell. The choice of this linear function will have a greatimpact on what kind of accuracy and behavior the method will have in the end.The M-H scheme then evolves the solution by half a time step. These evolvedvalues are used to solve the Riemann problems at the boundaries of the cell.The solution to the Riemann problems is used in the same way as was done forthe Godunov scheme to update the cell averages, according to equation (3.19).

Here follows a step by step walkthrough for updating a cell average Qni usingthe M-H scheme [3], one time step.

1. De�ne the slope σvi of the linear function inside the cell i.

2. Compute the values of the linear function at the cell edges using the cellaverage Qni and the slope σvi, see �gure 3.7.{

Qnr,left = Qni − σvi∆x2

Qnr,right = Qni + σvi∆x2

(3.20)

The index i is disregarded in the following notations.

3. The boundary values are evolved over half a time step using the recon-structed values according to equation (3.21).{

Qne,left = Qnr,left + ∆t2∆xA(Qnr,left −Qnr,right)

Qne,right = Qnr,right + ∆t2∆xA(Qnr,left −Qnr,right)

(3.21)

4. Two Riemann problems are solved for each edge of the cell i using theevolved values. In the same way as for the �rst order Godunov schemeusing the boundary values for the neighboring cells.

(ql, qr)left = ((Qni−1)e,right, (Qni )e,left)→ Qni,left = qleftm

(ql, qr)right = ((Qni )e,right, (Qni+1)e,left)→ Qni,right = qrightm

(3.22)

.

31

Page 32: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Q/q

i i+1i-1

Original function

Reconstructed function

Figure 3.5: Reconstructed function using constant values inside each cell. The�rst order Godunov scheme.

Q/q

i i+1i-1

Original function

Reconstructed function

Figure 3.6: Reconstructed function using piecewise linear functions inside eachcell. The second order approach.

32

Page 33: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Q

Q r,left

i

n

n

Qr,right

n

x

Figure 3.7: Average and edge values of the i:th cell.

5. The middle-state solutions for the Riemann problems are used to updatethe cell average according to equation (3.19).

That completes the walkthrough of the MUSCL-Hancock scheme.

3.1.6 Slope limiters

The choice of σv will have a great impact on how well the numerical solutionbehaves. Perhaps the most intuitive approach would be to simply choose aslope that is de�ned by the slope between the cell averages.

• σvi = Qi+1−Qi

∆x downwind

• σvi = Qi−Qi−1

∆x upwind

• σvi = Qi+1−Qi−1

2∆x central

These approaches all result in linear second order M-H schemes, however allthree choices often generates oscillations at shocks or discontinuous solutions.This is mentioned numerous times in the literature (for example [6]) and issomething that should be avoided. If the pressure of the system is close tothe vaporization pressure of the �uid, over- or undershots could in fact triggera change in the state of aggregation of the �uid. This unwanted vaporizationor condensation could of course present a problem, but the model used in thisthesis does not take into account that a �uid can change its state of aggregation.

One way to deal with this problem is to apply a slope limiter when decidingthe value of the slope σv. The idea is to limit the slopes in such a way thatincreasing oscillations does not occur. There are several di�erent slope limitersavailable but there is one general property that is important. Since the goal is tocounteract oscillations the limiter should result in a total variation diminishing(TVD) method. The total variation is a measurement of the oscillations of a

33

Page 34: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

function. For the discrete function Q the de�nition can be seen in equation(3.23) [6].

TV (Q) =

∞∑i=−∞

|Qi −Qi−1| (3.23)

A method is called total variation diminishing (TVD) if the inequality (3.24)holds for any set of data Qn.

TV (Qn+1) ≤ TV (Qn) (3.24)

Qn+1 are the values computed by the method for the next time step. The TVDproperty guarantees that the method will not increase the overall oscillationswhen measured in the way de�ned by equation (3.23).

All the limiters used in this thesis have the TVD property. There exists manylimiters that do not have this property and they might give a more accuratesolution in some cases. For example, equation (3.24) might be full�lled for allthe sets Qn that are relevant in a certain problem. The TVD property is in thisthesis used to help to decide what limiters to choose for investigation.

Popular slope limiters which ful�lls the TVD property are:

1. Minmod

σvni = minmod(

Qni −Qni−1

∆x,Qni+1 −Qni

∆x)

2. Superbeeσvni = maxmod(σv1i ,σv

2i )

σv1i = minmod(

Qni −Qni−1

∆x, 2(

Qni+1 −Qni∆x

))

σv2i = minmod(2(

Qni −Qni−1

∆x),Qni+1 −Qni

∆x)

3. MC (monotonized central-di�erence limiter)

σvni = minmod(

Qni+1 −Qni−1

2∆x, 2(

Qni+1 −Qni∆x

), 2(Qni+1 −Qni

∆x))

4. van Leer (see appendix A.1)

σvni = θV anLeer(Q

ni+1, Q

ni , Q

ni−1)

5. van Albada (see appendix A.1)

σvni = θV anAlbada(Qni+1, Q

ni , Q

ni−1)

34

Page 35: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

i i+1i-1

Q

i i+1i-1

Q

Figure 3.8: Discrete functions: Smooth solution and solution containing a shock.

See appendix A.2 for a de�nition of the minmod/maxmod functions.To set the limiter functions in some sort of perspective, the comparison also

include the original �rst order scheme (or method of characteristics or Godunovscheme) where the slope inside the cells is always set to 0. This method isincluded since it has been a very common method in commercial programs [13].The upwind and downwind slopes are also included to show the necessity ofthe slope limiters and also to show some of the pitfalls when using that kind ofsecond order methods.

According to [6], if the slopes used in the original REA-method are upwindand downwind the corresponding methods simply become the very commonsecond order methods Beam-Warming and Lax-Wendro�. In this thesis theoriginal REA-method is not used but instead the MUSCL-Hancock scheme, sowhen the upwind and downwind slopes are used the resulting method is notthe common methods mentioned above. However they can still show how thesecond order methods behave when limiters are not applied.

A limiter should return a zero slope whenever the upwind and downwindslopes are of di�erent signs. This is done in order to preserve the TVD property[6]. The value then corresponds to a function with a maximum or a minimumvalue in the current cell.

Description of the limiters. Here follows a short description of the limitersmentioned above. A clari�cation should be made about the notion of smoothnessof a curve. When talking about smoothness of the discrete function used in the�nite volume method, what is meant is that the values representing the upwindand downwind are about the same. A cell corresponding to a discontinuity or ashock on the other hand can have upwind and downwind slopes of very di�erentmagnitude. This fact can be seen in �gure (3.8). The central slope is the meanvalue of the upwind and downwind slopes, which means that the central valuealways lie exactly between the two slopes. This is important to notice since somelimiters uses the central slope (see MC limiter) during certain circumstances.

Perhaps the simplest limiter is the Minmod limiter. This limiter uses theminmod function when making the choice which slope to use in the currentcell. A comparison between the upwind and downwind slope is made and the

35

Page 36: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Q

i i+1i-1 i i+1i-1 i i+1i-1

Q Q

Figure 3.9: Slope inside a �nite volume cell using the Minmod limiter.

limiter chooses the slope with the smallest absolute value, if the slopes are not ofdi�erent signs as mentioned above. By choosing the smallest slope, the limiterreduces the over- and undershots during the simulation. The major problemwith this approach is that the di�usion becomes clear when applied to problemscontaining very steep slopes. Because the method always chooses the slope withthe smallest magnitude, steep slopes tends to get smeared out. A sketch of howthe Minmod limiter would decide the slope, can be seen in �gure 3.9.

The Superbee limiter uses the minmod and the maxmod functions to specifythe slopes inside the cells. The limiter is divided into three steps (see limiternumber 2 in the list above). The upwind slope is compared to twice the down-wind slope and vice versa using the minmod function to �nd the one with small-est absolute value. Then these slopes are compared using the maxmod functionto �nd the slope with the largest magnitude. For smooth sections (when theupwind and downwind are fairly similar) the limiter returns the slope with thelargest magnitude. This means that steep slopes at smooth solutions do not suf-fer from the di�usion problem as can be noted when using the Minmod limiter.At parts of the solution containing shocks or discontinuities (when the upwindand downwind slopes di�er in size) the limiter will return a value correspondingto twice the magnitude of the smaller slope. Therefore the limiter will in a betterway contain the shocks. One of the downsides for using the Superbee limiter isthat since the limiter returns the maximum slope in the third step, smooth partsmight get steepened. The literature sometimes mention the term �squaring� fordescribing the unwanted e�ect of the Superbee limiter. A smooth function hav-ing a Gaussian shape sometimes tends to turn into a sharper square-shapedfunction.

The MC (Monotonized Central-di�erence) limiter compares the central slopewith twice the upwind and downwind slopes using the minmod function withthree arguments. When the solution is smooth the upwind, downwind andcentral slope will be about the same, which means that the limiter returns thevalue of the central slope. When the solution contains shocks, the result fromthe limiter will be twice the smallest when comparing the upwind and downwindslope. The way that the MC limiter uses the central slope when the solution issmooth, unwanted steepening of the curve as described in the Superbee limiter

36

Page 37: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

should not occur.The van Leer and van Albada limiters are, as mentioned above, not im-

plemented in the same way as the other limiters. Instead of using di�erentcomparisons between the upwind, downwind and central slopes directly, thelimiters uses appropriate non-linear functions for deciding what value the slopeinside each cell should be. These functions are chosen in such a way to ensurethe TVD property and gives appropriate values for the slopes.

Here it is also important to mention that the slope limiters greatest strengthis most noticeable when the solution contains jaggedness and sudden changes. Ifthe force pro�le presented in �gure 2.4 was instead a smooth and di�erentiablecurve, the e�ect of the slope limiters would not be quite as signi�cant. Forexample, the Minmod limiter compares the upwind and downwind slopes andreturns the one with the smallest magnitude. If the solution is smooth, then thetwo slopes are almost the same, which means that the limiter basically behavesas a linear second order method. In our case the linear second order methodsare represented by the MUSCL-Hancock method with the upwind or downwindslopes.

3.2 Numerical error

The most important property of the methods is that they do not give an un-derestimation of the maximum force on the pipe. This is the main part, butit is not the only thing that is important. Maintaining the shape of the forcecurve is also important to ensure that the used method is able solve the systemin a su�ciently accurate way. This leads to a discussion of numerical di�usionand dispersion. These e�ects gives rise to a change of the force pro�le shape,resulting in an error in the solution. The di�usion and dispersion are the twomain e�ects that results in an error of the solution to the wave propagationproblem and for many methods the error is a combination of the two e�ects.

3.2.1 Numerical di�usion

Numerical di�usion is when a numerical method tends to even out the solution.Sharp changes in the solution will be smooth and a type of overall �smearing� canbe seen. This e�ect will increase with each time step. Some partial di�erentialequations contains terms that correspond to a physical di�usive behavior, butthe acoustic equation (2.3) does not contain any such terms. The di�usion seenwhen the di�erent methods are applied is therefore of completely numericalnature. In �gure 3.10 an example can be seen when a method that results indi�usion is applied to a wave propagation problem. What kind of problem andwhat method used to generate �gure 3.10 does not matter for now, it is merelyto show the idea of di�usion on an example curve.

37

Page 38: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 3.10: The e�ect of numerical di�usion

3.2.2 Numerical dispersion

Numerical dispersion is an e�ect that is maybe not as intuitive as di�usion.The solution to a wave propagation problem can be seen as a combination ofmany waves of di�erent frequencies. This is rooted in the theory of Fourierseries (see for example Leveque [5]). The analytical solution to the system isthat all the di�erent waves (all the frequencies) travel with the same velocity, asdiscussed in section 2.4.2. When a method shows signs of numerical dispersionthe waves corresponding to di�erent frequencies travel with di�erent velocities.An example of how dispersion can look like can be seen in �gure 3.11.

The maximum value of the solution might be shifted and the overall shape isdestroyed. Oscillations occurrs when some frequencies travels to fast or to slow.The oscillatory behavior gives rise to over- and undershots of the solution.

3.2.3 Comparing force pro�les

The pressure wave that gives rise to the force pro�le propagates from the valvethroughout the pipe system. The force pro�le computed at the �rst segment iscalled F1 and the force pro�le at the second segment, F2. The true solution isassumed to be, during this time interval, that the pressure wave travels by avelocity of c (= 1500m/s) and that the shape of the force pro�le should be thesame for the �rst and second segment (see section 2.4.2). The error introducedby the numerical methods is estimated by comparing the two force pro�les F1

and F2. The true propagation is only done in pressure and velocity (the variables

38

Page 39: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 3.11: The e�ect of numerical dispersion

in the governing equations) but one can interpret the force pro�le as somethingthat also propagates through the pipe system when comparing pipe segmentsof equal length. But do not forget that the force pro�le is a force function thatshows the total axial force acting on a speci�c pipe segment.

The methods have already been used to compute the force curve F1 andtherefore the shape and maximum value di�er somewhat between the methods.Because of this, it is important that the methods for estimating the error arecomputed as relative values. That is, a relative value to the given F1 for eachmethod. The force pro�le F1 is not the true solution for the whole pipe systemsince the numerical method has been used to calculate it but can be interpretedas the correct solution. Error estimations give us an idea of how the force pro�leF1 is changed due to the numerical method during the wave propagation fromthe �rst to the second pipe segment.

Another approach, not taken in this thesis, would have been to compareforce pro�les of di�erent resolutions. A force pro�le F1 calculated with a veryhigh resolution could have been considered as the correct solution. In this thesisthe error is instead de�ned as the di�erence between the force pro�les F1 and F2

computed by the same resolution. One of the reasons for taking this approach isthat the comparison should not be a�ected by the enforced boundary conditions.

39

Page 40: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

3.2.4 Order of a method

The order of a method is de�ned by how errors decrease when the resolution ofthe grid is increased. An important fact is that this de�nition only holds whenthe numerical method is applied to a smooth curve, i.e. when the derivativesare de�ned and continous at all points. The resolution of the grid could refer tothe discretization step in space but also in time. If u is the exact solution andU is the solution generated by the numerical method a method is of order p ifequation (3.25) holds.

‖u− U‖ = O(hp) (3.25)

where h is the size de�ning the numerical grid, e.g. the cell size in �nite volumemethods, and ‖•‖ is a suitable norm used to compute the error.

Equation (3.25) means that the error behaves as a polynomial of degree p.For example, if a method is second order (p = 2) then the error should bedecreased by a factor of 1

4 when the discretization size is decreased by a factorof 1

2 . The norm used could for example be the common 1- and 2-norms, seesection 3.3.2.

A standard way of estimating the order of a method is to use the logarithmicvalues of the error.

log(‖u− U‖) = log(O(hp)) = p · log(O(h))

By doing this, the value of p is manifested as the proportional constant con-necting the logarithmic value of the error and the discretization size. The valuep is then the slope of the linear function from log(O(h)) to log(‖u− U‖). Thisis the way that the order of the methods are estimated during this thesis.

3.3 Estimating an error

3.3.1 Maximum value

In order to check if the methods are capable of maintaining the maximum valuethe following relative error, Emax, is computed for the force pro�les F1and F2,see equation (3.26).

Emax =|max(F1)−max(F2)|

|max(F1)|(3.26)

This does not take into account, however, where the maximum value occursin the force pro�le. The error estimation does not give any indication if thetop of the pro�le has been deformed. An estimation of this type is used onlyto monitor how well the maximum value is maintained. Other approaches areneeded to see the other e�ects introduced by the numerical method. This workis, as mentioned earlier, based on a paper by Nilsson [9]. In that paper thecomparison was mainly carried out using this approach on the maximum values.As seen later on, this approach does not give a complete image of what sort oferror the numerical methods introduce.

40

Page 41: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

3.3.2 Regular norms

To monitor how well the numerical methods preserve the overall shape of theforce pro�le, ordinary mathematical norms can be used. This is an easy andfairly straight forward way of estimating the total di�erence of the two forcepro�les. There are an endless amount of norms available but in this thesis the1- and 2-norm are used. As seen later on, the conclusions from the two normsoften coincides. The 1- and 2-norm are special cases of the more general p-normthat is de�ned in the following way, see equation (3.27). v is a vector withelements v1, v2, ... , vN−1, vN

‖v‖p ≡p

√√√√ N∑i=1

|vi|p (3.27)

The 1- and 2-norms is then de�ned by equations (3.28) and (3.29) respec-tively.

‖v‖1 ≡N∑i=1

|vi| (3.28)

‖v‖2 ≡2

√√√√ N∑i=1

|vi|2 (3.29)

A relative error between two vectors (in our case the force pro�les F1 and F2) isseen in equation (3.30). F1 and F2 are the vectors de�ning the force functionsF1(t) and F2(t) in the current time discretization.

Ep =‖F1 − F2‖p‖F1‖p

(3.30)

3.3.3 Dynamic load factor (DLF)

The dynamic load factor is used to describe the dynamical properties of a force.When analyzing the force acting on the pipe it is not just the maximum valuethat is important. The result and severity of damage on the pipe system alsodepend on the dynamical properties of the force.

Eigen frequencies can be described as the frequencies at which a systemis easy to move. When a force is applied to the system (for example a pipesystem) at the appropriate frequencies the displacements and �uctuations ofthe system will be high. This means more displacement than the system wouldhave for a force of the same magnitude at a non-eigen frequency. These eigenfrequencies are decided by many di�erent properties. For a pipe system someof the important properties are; sti�ness of the pipes themselves, the mass ofthe di�erent parts of the system, how and where the pipes are attached toits surroundings etc. These properties are not discussed further in this thesis.

41

Page 42: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

The idea with dynamic load factor is to measure at which frequencies the forcefunction can result in the most displacement.

The DLF is computed for a force function F (t) in the following way. Theforce F (t) is set as a driving force on a linear undamped oscillator with eigen-frequency ν and a mass m. This oscillator represents a piece of a pipe withsti�ness corresponding to the given frequency. The equation of motion is solvednumerically for the oscillator and the maximum displacement xmax is calcu-lated. This maximum value gives an estimate on how much impact the forceF (t) will have on a pipe segment with the sti�ness and mass correspondingto the frequency ν. To put the maximum displacement value in some sort ofperspective the same maximum value is calculated, but this time when the os-cillator is under the in�uence of a static force Fstatic = max(F (t)). The static(constant) force results in a static maximum displacement xmaxStatic . The con-stant force gives an idea of how much the pipe would have been a�ected if theforce changed very slowly. The ratio between the two maximum displacementsis calculated and that is called the dynamic load factor for the frequency ν.DLF = xmax/xmaxStatic .

One should note that in the �nal stage, when computing the DLF, the valuem is cancelled out. The procedure of computing the DLF is done for all thefrequencies corresponding to the pipe system. The frequency interval representsthe di�erent parts of the pipe system and the function DLF (ν) shows at whichfrequencies the dynamic force F (t) can have the most impact on the pipe. Themost impact referes to the largest relative displacement of a pipe segment.

When using the DLF to compare two force pro�les F1(t) and F2(t) thestatic force used for computing the dynamic load factor should be the same.The DLF values needs to be computed relative to a common value (the staticdisplacement) in order to make the comparison feasible. Otherwise a force withvery small amplitude could give rise to very large values for the DLF. A way todo this is to simply choose either F1 or F2 static displacements as the reference.In this thesis the static displacement at the �rst segment, F1, is used.

Monitoring the change in the DLF when the numerical methods are appliedis a way to study the change in frequency content of the force. The dynamicload factor shows which frequencies are maintained and which are not. It alsoshows if a method have introduced a frequency shift.

42

Page 43: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

4 Tests

The scripts used for simulations and tests during this thesis is written exclusivelyin MATLAB-code. A simpli�ed version is also produced in C-code, see appendixA.3 for a short description on that implementation.

4.1 Basic pipe system

The basic pipe system can be seen in �gure 2.1. The error for each method,used in this thesis, is shown as a function of the space discretization size. Thelimiters presented in section 3.1.6 are incorporated using the MUSCL-Hancockmethod and the tests also includes the original �rst order zero slope scheme andthe second order methods de�ned by using the upwind or the downwind slopesin the MUSCL-Hancock method. As stated in chapter (3.3) the main approachfor comparing how well the method contain the force pro�le is divided into twoparts.

The �rst question is if the methods contain the overall shape of the forcepro�le. This error is mainly measured using the two common vector normscalled the 1-norm and 2-norm respectively. The shape of the curve is closelyrelated to the frequency content of the force pro�le. Because of this, the 1-and 2-norms will in some cases be supported using the dynamic load factor (seesection 3.3).

The second question is if the di�erent methods preserve the maximum valueof the force acting on the segments. This question is somewhat of a subgroupof the �rst one, because if the method preserves the shape of the force pro�le sowill be the case with the maximum value. The question of the maximum value ison the other hand a very important question since one of the jobs of a methodis to make sure that the forces in the pipe system are not underestimated.Underestimation of the forces present in a pipe system could for example havedisastrous result if the pipes and suspension components are not constructedto withhold forces of the right magnitude. Maximum values of the forces arecompared independent of the position of the maximum value. The reason forthis is that one might be interested in a method preserving the maximum value(see chapter 3.3 for a description of the comparison).

Even though the magnitue of the applied force is often a critical point, thefrequency content of a force also play an important role whether the impact onthe pipe system is signi�cant or not. A pipe system very sensitive to certainfrequencies can also have disastrous result even though the magnitude of theforce does not seem to be particulary large.

The Courant number, denoted CFL, is the value of the ratio between thespace resolution, dx, and time resolution, dtmultiplied by the propagation speedc [6].

CFL =dt · cdx

(4.1)

The Courant-Friedrichs-Lewy condition (CFL condition) states that: A neces-sary condition for convergence of a �nite volume method (or �nite di�erence

43

Page 44: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

method) is that the Courant number is less than or equal to 1.0 [6]. The testsfor the methods are carried out with three di�erent values of the Courant num-ber, but �xed space resolutions. A change in this value then results in a changein the time discretization resolution. When the Courant number is equal to 1.0the wave propagation is almost exact (the di�erence is related to the round o�errors, see appendix A.4) and the closer to this value the more accurate themethods becomes. But on the other hand, the stability of a method might bejeopardized when doing simulations with large Courant numbers. Most of thetime, in practical simulations it is also not possible to ful�ll the ideal Courantnumber. The reason for this is that the length of the di�erent pipe segmentsmay not be divisible by the same discretization sizes and this means that thelowest common denominator is used instead. When the number of pipe seg-ments increases, the lowest common divisor can become very small, which inturn means a big workload for the simulation.

The three di�erent values of the Courant number represents a value close tothe ideal case (CFL = 0.95), a value further away from the ideal case (CFL =0.5) and �nally a value very far away from the ideal case (CFL = 0.3). This isdone in order to give an idea of how the methods behaves for di�erent types ofspace and time resolutions.

4.2 Parameters of the pipe system

In order to further see how the methods handles the water hammer problemsone can use several types of pipe systems. The parameters that can be changedare many, and in this paper two of them have been chosen. These are tests thatare performed in addition to the basic pipe system.

The �rst parameter is the closing time of the valve. This is changedin order to generate di�erent kinds of pressure waves and in our case it can beused to see how well the methods handles di�erent frequencies. A short closingtime of the valve should give a more steep pressure wave that results in higherfrequencies of the force and vice versa.

In order to not make the tests too complicated, the basic pipe system (�gure1.1) was used and the simulations were carried out with the Courant numberequal to 0.5 and a space discretization dx = 0.5 .

The length of the middle pipe segment. The two pipe segments wherethe forces are computed are separated by one pipe segment. This is referred toas the middle segment. In the basic comparison the distance between the �rstand second segment is set to be 100m. This in turn means that the middle pipesegment is 90m. During this part of the simulations the length of the middlesegment is instead varied.

This is done in order to see which methods that can preserve the forcepro�le when the length of the pipe system and therefore the simulation timeis increased. The idea is to see if the methods introduce any long time errors,when compared to each other.

44

Page 45: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

It is also possible that methods have a harder time conserving the shape ofthe pressure wave in the beginning of the simulation, since the curve containsjaggedness at the �rst segment. An early smoothing of the jaggedness might befollowed by a very accurate propagation of the pressure wave. By changing thesize of the middle pipe segment one can get an idea of where the problems ofthe methods occur.

4.3 Workload of the limiters

The comparison between the slope limiters, presented in section 3.1.6, is mainlybased on the accuracy. When implementing a method the e�ciency or workloadis something that is very closely related to the generated error. A method maybe very accurate but also very complicated to implement. If a problem requiresa certain amount of precision the cost of increasing the resolution may be toomuch for the computing power used for the simulations. In some cases a lessaccurate and more e�cent method should be used instead and the requiredprecision may be met with less workload.

This is a complicated question to answer and a full investigation of theaccuracy versus e�ciency will not be performed during this thesis. A small testand discussion comparing the workload of the di�erent limiters will howeverbe carried out. When using the MUSCL-Hancock scheme the only di�erencebetween the limiters is the reconstruction step where the slope inside the �nitevolume cells is calculated. The workload of only the slope functions will becompared using a simple test.

Function calls are made to all the slope limiter functions and the executiontimes are measured. The number of function calls are: 104, 5·104, 105, 5·105, 106

number of times and this is done in 5 repetitions in order to exclude random�uctuations to some extent. The mean values from the tests are the foundationof the workload comparison.

A description of the computer used for the simulations can be seen in ap-pendix A.5.

45

Page 46: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

46

Page 47: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

5 Numerical experiments/Discussion

The comparison has been carried out by using three somewhat di�erent ap-proaches. These approaches have been described in the previous chapter. Firstthe basic pipe system (see �gure 2.1) have been considered and by varying thespace/time discretization size the methods has been compared. Second, theclosing time of the valve has been used as a parameter. Lastly the length of thepipe system has been varied in order to see how the methods compare when thesimulation time increases.

5.1 Basic pipe system

5.1.1 CFL=0.5

Figure 5.1 and 5.2 shows the computed relative errors for comparing the overallerror (using the 2-norm) and error in the maximum value. The 1-norm has beenleft out since it looks very much the same as the 2-norm. Studying the �gures onecan note that the �rst order method is not a reasonable choice compared to theother methods. Neither the maximum value nor the overall shape ( measured bythe 1- and 2-norm) of the force pro�le seems to be preserved when compared tothe other methods. In the �gures in this chapter the �rst order method is alwaysincluded, but may not always be incorporated into the discussion because of itsmuch less accurate result. Of course one should note that even though the �rstorder method is naturally less accurate than its second order counterparts themethod is less demanding. Increasing the resolution of the discretization whenusing a properly implemented Godunov scheme occupies much less memory andCPU-time than the second order methods. In this thesis the main goal is tocompare the higher order methods and this is the reason that the �rst ordermethod often is left out of later parts of the discussion. The �rst order methodshows, as predicted, cases of severe di�usion. The di�usion and smearing of theforce pro�le can be seen in �gure (5.3) .

In �gure 5.4 the DLF for the �rst order method is presented. It shows thatthe �rst order method is having signi�cant problems maintaining the higherfrequencies. The lower frequencies on the other hand is much easier for themethod to preserve. The fact that the DLF curve just seems to be subject toan overall damping of the higher frequencies, veri�es that the methods problemis its di�usive behaviour.

It is important to notice that the force curve computed at the �rst segmentthat is used to estimate the error of the current numerical method does nothave exactly the same shape for the di�erent methods. The di�usive behaviorof the �rst order method can be seen already at the �rst segment. This is mostnotable during the last part of the force pro�le where the force on the segmentis returning to zero.

Another notable property of the norm in �gure 5.1 is that the methods usingthe upwind and downwind slopes, clearly do not come close to the accuracy ofthe methods using limiters. In �gure 5.5 the force pro�les for the upwind slopes

47

Page 48: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.1: Relative error of the force using the 2-norm

Figure 5.2: Relative error in the maximum force magnitude

48

Page 49: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.3: Force pro�le for the �rst order zero slope method, CFL=0.5.

Figure 5.4: Dynamic load factor for the �rst order method, CFL=0.5.

49

Page 50: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.5: Force pro�le for upwind slopes, CFL=0.5

show the dispersion problem introduced by the second order linear methods. Anoscillatory behavior is very clear with amplitude increasing when the resolutionis lowered.

When studying the comparison of the maximum values (�gure 5.2) it lookslike the linear second order methods (upwind and downwind) handles the preser-vation of the maximum value much better for discretization sizes in the range[0.5−1.0] m. A hint that this behavior is not something that can be trusted forgeneral problems is that the method's accuracy of the maximum value increasesfor space discretization sizes in the range [0.05 − 0.1]. And also the 1- and2-norm and force pro�les shows that the overall shape is not preserved as wellas done with the other methods using limiters. The linear second order meth-ods produced by using upwind and downwind slopes in the MUSCL-Hancockmethod cannot really be trusted for this particular problem. The jaggednessof the force solution in �gure 2.4 (sprouting from the jaggedness of the pres-sure/velocity curves) in this problem makes the mentioned methods unsuitable.

Now shifting focus to the MUSCL-Hancock scheme with the di�erent limiterswhich are the methods that are the main focus in this thesis. For a morethorough description of the limiters see chapter 3.1.6.

When comparing the Minmod limiter to the other approaches (See �gure 5.1and 5.2) it is clear that this particular limiter does not preserve the shape ofthe force pro�le or the maximum value of the force especially good. Figure 5.6shows the di�usive error introduced by the MUSCL-Hancock method with theMinmod limiter. The di�usion is not as severe as the case with the �rst order

50

Page 51: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.6: Force pro�le for the Minmod limiter

method but the deformation of the force pro�le follows a similar pattern.The van Leer and van Albada force pro�les looks very similiar to each other

and the only di�erence to the Minmod limiter is the severity of the di�usion.Of the three, the van Leer limiter generate the least amount of di�usion andMinmod generates the most and the van Albada limiter somewhere in between.

The limiter that preserves the shape of the force curve best according to�gure 5.1 (excluding the Superbee limiter for now) is the MC limiter. The forcepro�le for the MC limiter can be seen in �gure 5.7 and the dynamic load factorin �gure 5.8. Showing the DLF is merely to show the di�erence to the �rst ordermethods DLF in �gure 5.4. The dampening is done to the higher frequenciesjust as for the �rst order method, but it is much less severe.

In �gure 5.9 the four limiters are compared against each other. As mentionedbefore, the force pro�le computed at the �rst segment does not look exactly thesame for the di�erent methods, but yet very similar, so �gure 5.9 might be abit misleading on how accurate the methods are. The reason for showing thisimage is merely to demonstrate the magnitude of how well the methods handlethe jagged parts, both the maximum value and the last part of the force pro�le.The four limiters mentioned in this case seem to behave very similar except forthe severity of the di�usion and smearing around the sharp edges.

The behavior of the Superbee limiter is somewhat di�erent than the othermethods. In �gure 5.2 it can be seen that the Superbee limiter preserves themaximum value better than all the other limiters. However, the Superbee lim-iter shows at some parts an increasing error of the maximum value when the

51

Page 52: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.7: Force pro�le for the MC limiter, CFL=0.5.

Figure 5.8: Dynamic load factor for the MC limiter, CFL=0.5.

52

Page 53: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.9: Force pro�le comparison for the MC, van Leer, van Albada andMinmod limiter, CFL=0.5.

resolution is increased. A closer look on how the Superbee limiter handles theproblem of preserving the force curve is needed in order to understand �gure5.1 and 5.2.

The force pro�le for the Superbee limiter in �gure 5.10 shows that it pre-serves the maximum value of the force, but does in fact deform the shape of theforce pro�le. The �squaring� behavior of the Superbee limiter, that was men-tioned in chapter 3.1.6, is very clear for when the space discretization dx = 1.0is used. The curves maximum value is preserved but the characteristic jaggedshape at the top of the force pro�le is utterly destroyed. This is the explanationthat the overall accuracy of the Superbee limiter (measured by 1- and 2-norm)does not seem to increase at the same rate as the other limiters when usinga higher resolution. When studying �gure 5.1 and the overall error of the Su-perbee limiter is small when comparing to the other methods for larger spacediscretizations dx = 1.0 − 4.0. The reason for this is probably the Superbeelimiters ability to preserve steep slopes. The other methods fail to preservethese slopes and hence resulting in a larger underestimation of the maximumvalue and also a less accurate overall shape. This is of course also the Super-bee limiters biggest problem since it unwittingly tends to steepen some of theslopes of the solution. This is especially noticeable for the gentle slopes in the�rst part of the force pro�le in �gure 5.10. To further investigate the behaviourof the Superbee limiter the dynamic load factor is shown in �gure 5.11. Thehigher frequencies in the DLF diagram are actually ampli�ed, resulting in the

53

Page 54: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.10: Force pro�le for the Superbee limiter, CFL=0.5.

frequencies needed for the steep slopes.As a mid-time conclusion one could say that the MC limiter, when using the

highest resolution, gives a very satisfactory result. Studying the force curve forthe MC limiter shows that the shape is very much preserved. The limiter givesa more accurate result than the Minmod, van Leer and van Albada limiterswith respect to both the preservation of the maximum value and the overallshape (�g 5.1 and 5.2) for all resolutions of the grid. It does not introduceany unwanted deformation of the shape of the force pro�le as the case with theSuperbee limiter.

5.1.2 CFL=0.95

The tests performed using the close to ideal case of the Courant number showsa similar pattern for all the methods. The problems generated by the numericalmethods are the same, only less signi�cant. Figure 5.12 shows the maximumvalue comparison to underline that the error produced is of smaller magnitude.

5.1.3 CFL=0.3

The last simulation performed with the basic pipe system, used a very lowcourant number CFL = 0.3. As mentioned before, the reason for using smallerCourant numbers is that the stability of the methods increases. This is donewith a signi�cant increase in error for the methods. Since the simulation doesnot give any new information regarding the comparison of the di�erent methods

54

Page 55: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.11: Dynamic load factor for the Superbee limiter, CFL=0.5.

�gure 5.13 instead shows the smallest Courant number in relation to the onepresented in section 5.1.1. This is only done for the Minmod and the MC limitersin order to get a clear image.

A smaller Courant number gives a less accurate result for all the methodsas expected.

5.1.4 Pressure vs force

The reason for comparing the forces with corresponding pressure is to showthat even though two methods shows a similar approximation of the pressureit does not mean that the computed forces are equally accurate. To be ableto do this kind of comparison the relative error for the pressure needs to becomputed. This is done by considering the shape of the pressure wave insidethe �rst and second segment, see �gure 5.14. The relative error of the pressurecan be computed using the 2-norm in the same way as for the two force pro�les.

The shape of the pressure wave can also be used to show a dangerous pitfallof the linear second order methods. Figure 5.15 shows the shape of the pressurewave for the two pipe segments when using the upwind slopes. Oscillatorybehaviour is notable and overshots of the solution generated by the upwindscheme is clear.

In �gure 5.16 a comparison for the force and pressure error can be seen fortwo limiters. It is clear that the realtive pressure error is much smaller than theforce error. But the important fact is that the error for the pressure for two

55

Page 56: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.12: Relative error in the maximum force magnitude,CFL=0.95

Figure 5.13: Relative error of the force using the 2-norm,CFL=0.3, 0.5

56

Page 57: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.14: Shape of the pressure wave for the Minmod limiter.

Figure 5.15: Shape of pressure wave for the upwind slopes.

57

Page 58: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

methods can be relatively equal but the di�erence when computing the force ismuch more signi�cant. When studying �gure 5.16 one can see that the shape ofthe relative error looks similar for the pressure and the force, but the pressure isshifted downward representing less error. Since the logarithmic values are usedfor the norms one can see that the di�erence for the force pro�les is much moresigni�cant than for the pressure.

Figure 5.16: Comparison of the relative error for the force pro�les and thepressure wave. Certain methods are chosen.

5.2 Changing closing time of valve

The following tests were carried out in order to see how the methods behavewhen the closing time of the valve is varied.

The reason for using a faster closing time of the valve was to produce wavesthrough the system of di�erent frequencies than for the basic pipe system, seechapter 5.1. One would think that a shorter closing time of the valve wouldresult in higher frequencies and a slow closing of the valve resulting in a set oflower frequencies. This is partly true in the this model, but it is not the wholetruth.

In �gure 5.19 one can see what kind of force pro�le the valve produces withrespect to the closing time for some examples. The limiter chosen is the MClimiter, but the other methods produce almost identical force pro�les at the �rstsegment.

When comparing the shape of the force pro�les (�gure 5.19) for shorter and

58

Page 59: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.17: Relative error of the force using the 2-norm, varying closing timeof the valve

Figure 5.18: Relative error in the maximum force magnitude,varying closingtime of the valve

59

Page 60: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

longer closing times the following can be made clear. The force pro�le residesin a smaller window in time, when shorter closing time is used, which can bean indication that higher frequencies are present. However, the shape at thetop of the force pro�le is a bit smoother than for longer closing times. This canexplain the behavior seen when comparing the maximum values. Almost all themethods show signs that the maximum values are easier to withhold when theclosing time of the valve is small. Instead when making the overall comparisonusing the 1- or 2-norm it can clearly be seen that the methods handles the longerclosing times more accurate.

A steeper slope and higher frequencies can be noted for the �rst part of theforce pro�le. For long closing times the pro�le is a gentle curve towards themaximum value and a faster closing time corresponds to a much more suddenrise to the maximum value. However, the second part of the force pro�le, thedescent to zero force in magnitude, does not follow the same pattern. For thefast closing times (closing times equal to 0.01s and 0.025s) the second part isrounded o� before the descent begins and a longer closing time instead generatea more rapid decline. This can be studied in �gure 5.20, where the top of someof the pro�les from �gure 5.19 has been magni�ed.

The rounding of the top part of the force pro�le is probably the reasonthat the methods using limiters in �gure 5.18 preserves the maximum valuebetter when the closing time is decreased. This shape of the force pro�le is nocoincident remembering the discussion in section 2.4.3. There was stated thatif the closing time of the valve was set to be in�nitely small the force pro�lewould resemble a hat function. The rounding of the top of the force pro�le ismost likely that characteristic behaviour. Since numerical methods persistentproblem is managing to conserve jagged shapes, the maximum value is moreunderestimated when the closing time of the valve is short. This is seen as afast decrease in the error of the maximum force when a shorter closing timeis imposed. All the MUSCL-Hancock implementations with limiters seems tofollow this pattern.

To further establish how the shape of the force pro�le depends on the closingtime, the dynamic load factor is calculated. This is done for some of the forcepro�les in �gure 5.19 and can be seen in �gure 5.21. It is very clear that a fastclosing time gives a much larger value of the DLF for the higher frequencies.One can also note that the longer closing times has a slightly larger value of theDLF for the lower frequencies. This facts contribute to the claim that a fastclosing time corresponds to higher frequencies.

The dynamic load factor describes the impact of the force on pipe segmentscorresponding to certain frequencies and is not a complete frequency descriptionof the force. A deeper investigation using other methods would have to be madeon this subject in order to clarify the exact change in frequency information dueto the numerical method.

The maximum value of the force increases when the closing time of the valvedecreases. In section 2.4.3 it was mentioned that if the transient was de�ned bya (ideal) step function of the pressure the force pro�le would be a hat functionof height 0.15MN or 1.5e105N . When the closing time decreases the shape

60

Page 61: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.19: Force pro�les examples for di�erent closing time of the valve.

Figure 5.20: Force pro�les for di�erent closing times of the valve, magni�ed.

61

Page 62: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.21: Dynamic load factor for di�erent closing times of the valve.

of the force pro�le seems to tend to be a hat function. This is most notablefor the shortest closing time of the valve (0.01s) in �gure 5.20. The maximumvalues of the force pro�les can be seen in �gure 5.22 and shows that the valuesactually seems to land at the maximum value of the force equal to 1.5e104N .For the shortest closing time the corresponding maximum value of the force is1.4994e104N .

All the methods in �gure 5.17 show a somewhat unpredictable behavior. Theoverall errors seem to have a minimum around a closing time equal to 0.1−0.2sand then increasing error for both shorter and longer closing time. This couldbe explained by the two notions presented above. On the one hand the errorincreases when the closing time is longer since the �rst part of the force pro�lebecomes a gentler curve. On the other hand the second part of the force pro�lebecomes steeper when longer closing time is used, resulting in more error fromthe numerical methods. When the closing time is around 0.1 − 0.2s the twoe�ects maybe have reached some sort of equilibrium and the error reaches aminimum value. This is of course only shown for this particular transient wave.

The Superbee limiter seems to get a smaller error for the shortest closing timeof the valve. If one study the shape of the force curve (see �gure 5.20) generatedfor the shortest closing time one can notice that the shape is a square-like form.As mentioned earlier this is the shape that the Superbee limiter often handleswith the least error. This characteristic behavior of the Superbee limiter ismentioned in chapter 3.1.6 and discussed several times in the literature, see forexample [6].

62

Page 63: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.22: Maximum value of the force pro�le for di�erent closing times.

5.3 Changing the length of the middle pipe segment

During this part of the simulation the length of the middle segment is varied.Studying �gure 5.23 shows that all the limiters, except Superbee, gives a

rather straight-forward view on when the error in this simulation occurs. Thelonger the middle segment is the greater the error is generated, with no unex-pected behavior. One could draw the conclusion that the error is then not moresevere in the beginning of the simulation. The length of the middle segmentseems to be proportional (using the logarithmic values) to the relative errorintroduced. Here a small di�erence can be seen when comparing the methodsusing limiters and the �rst order method. The error of the �rst order methodbehaves as not proportional to the length of the middle segment. Instead, thechange in error becomes less signi�cant for when the middle segment is long (200and 500m), see �gure 5.23. This could be explained by the �rst order meth-ods massive problem with maintaining the sharp edges within the force pro�le.When comparing the simulations using the longer middle segments most of thesimulation time is used for propagating an already smeared out curve, hencethe small di�erence in error.

When studying how well the methods manages for long and short simulationtimes respectively the �rst order method and the linear second order methodscan be left out. This is due to the same problems they have presented in allthe previous sections. Also the limiters Minmod, van Leer and van Albada are,as in the previous sections, only less accurate siblings to the more accurate MC

63

Page 64: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.23: Relative error of the force using the 2-norm, varying length of themiddle pipe segment

Figure 5.24: Relative error in the maximum force magnitude,varying length ofthe middle pipe segment

64

Page 65: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure 5.25: Force pro�le for the Superbee-limiter, varying length of the middlepipe segment. Magni�ed.

limiter. The MC and Superbee limiters on the other hand needs to be discussedfurther since the lengthening of the middle pipe segment reveal a weakness in theMC limiter(and the other three remaining limiters) that the Superbee limiterdoes not indicate to the same extent.

Figure 5.24 again shows the ability of the Superbee limiter to maintain themaximum value of the force. In previous sections this ability sometimes comeswith a greater error of the overall force pro�le. But �gure 5.23 shows clearlythat, at larger distances, the Superbee limiter actually manages to also preservethe overall shape to greater extent. The di�usion e�ect introduced by the MClimiter (and the three other limiters) becomes predominant when the length ofthe system and simulation time increases. This in the end makes the Superbeelimiter a better choice both with respect to the overall error and the preservationof the maximum value for the longer type of simulation. One should rememberthat the shape of the force pro�le in this paper does not contain all the possiblecharacteristics of a force pulse. The Superbee limiters ability to maintain themaximum value might be di�erent for other types of force pro�les.

In �gure 5.25 the top of the Superbee force pro�le has been magni�ed. Themaximum value is actually overestimated for when the distance between segment1 and 2 is equal to 500m.

If the maximum value is more or less overestimated by the Superbee limiterthen it is underestimated by the other limiters, might be hard to predict in manycases. But one can underline that in most practical cases an overestimation of

65

Page 66: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

the force is not as serious as an underestimation. So the Superbee limiter mightbe more suitable for some cases where the preserving of the frequency contentis not the main priority.

5.4 The order of the methods

The order of the methods are computed using the basic pipe system and thecorresponding result from section 5.1.

CFL = 0.5 1-norm 2-normGodunov scheme 0.46 0.40Minmod limiter 0.86 0.68Superbee limiter 0.62 0.47

MC limiter 1.03 0.76van Leer limiter 1.01 0.75

van Albada limiter 1.00 0.74Downwind slope 0.85 0.69Upwind slope 0.87 0.67

CFL = 0.95 1-norm 2-normGodunov scheme 0.59 0.48Minmod limiter 0.81 0.64Superbee limiter 0.84 0.63

MC limiter 0.91 0.74van Leer limiter 0.91 0.73

van Albada limiter 0.88 0.70Downwind slope 0.58 0.40Upwind slope 0.78 0.62

Table 1: Order of the methods during the force computations, using the 1- and2-norm for CFL = 0.5

The order of the methods mentioned in section 3.1.5 refers to the computa-tion made in the original variables of the governing equations, pressure p andvelocity u. As seen in �gure 5.16 the two governing variables follows approxi-mately the same order as the force.

In table 1 the order of the methods are presented for the computation of theforce pro�les. As stated in section 3.1.5 the MUSCL-Hancock schemes shouldbe of second order. The probable reason that this is not met in this thesisis that the shape of the force pro�le is not di�erentiable. If the solution to aproblem is not di�erentiable the concept of order becomes a bit blurry. Forthe smooth parts of the solution the methods probably manages to reduce theerror by an order of 2, but for the sharp edges the error becomes much moresevere. The error de�ning a method's order is the global error, which means atotal error for the whole domain (both in time and space). Even if the methodsmanages to keep a second order accuracy in the smooth parts of the solutionat the beginning, the error in the non-di�erentiable parts will lower the overallaccuracy as the solution propagates.

The order of the methods seem to follow the same pattern as the previouscomparisons, sections 5.1-5.3. The �rst order Godunov scheme presents a lowerorder than all the second order methods (very reasonable) and the upwind anddownwind slopes shows a lower order than the methods using limiters.

The Superbee limiter is once again the limiter that needs to be commentedsince it presents much lower order when the Courant number was equal to 0.5.This in fact signals an important weakness with this particular limiter. In order

66

Page 67: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

to reduce the error a certain percentage one would need to increase the resolutionmore than would be needed by one of the others limiting methods.

The MC, van Leer, van Albada and Minmod limiter shows the same rank aswhen the general error was considered. Minmod with the lowest order and theMC limiter with the highest order.

5.5 Workload of the limiters

A comparison of the workload for computing the di�erent limiters was performedand the result can be seen in �gure 5.26.

Figure 5.26: Workload for the computation of the slopes using the di�erentslope limiters.

The implementation of the di�erent limiters may di�er and the implemen-tation in this thesis is not in any way the ideal approach. Optimization of thecode used for calculating the slopes have not been made. The van Leer andvan Albada limiter is not used in exactly the same way as in the reference [2],see section 3.1.6 and appendix A.1. Lastly the implementation has been carriedout using MATLAB 6.1 , which may not be the ideal platform when discussinge�ciency and performance. However, some conclusions can still be drawn using�gure 5.26.

The linear second order methods (upwind and downwind slopes) are byfar the most e�cient. This is not a surprise since the methods does not useany limiting method but merely calculates the upwind and downwind slopesrespectively.

67

Page 68: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

The Minmod limiter that has been shown to produce the least accurateresults also is the most e�cient limiter. This method consists only of one callto the minmod function that basically is a comparsion between the upwind anddownwind slopes. The rest of the limiters follows a rather predictable pattern;In general, straight-forward arithmetic computations requires less e�ort thanconditions statements.

The van Albada and the van Leer limiter follow each other rather closely withrespect to the e�ciency, which they have been doing also during the previouschapters. These methods produce slopes based solely on arithmetic calculationsfrom the values of the cell averages. This is probably the reason that theirworkload seems signi�cantly lower than the MC and Superbee limiters. The MClimiter uses the minmod3 function, see appendix A.2 , to estimate the slopesinside the cells. This is a more complicated version of the minmod functioncomparing three arguments. Lastly the Superbee limiter, which is basically acall to the minmod function followed by a call to the maxmod function, is byfar the most expensive limiting method used in this thesis.

The axis used in �gure 5.26 are of the logarithmic values and the limitersfollow a proportional pattern. The MC limiter seems to calculate the slopesin about half the time it takes for the Superbee limiter and about 20% slowerthan the van Leer and van Albada limiters and almost 40% slower than theMinmod limiter. This gives an approximate comparison of the slope computingfunctions.

One should remember that the part of calculating the slopes is just onepart of the MUSCL-Hancock scheme. The other parts might be demandingand contributing even more to the workload. This comparison was made onlyfor the slope computing part since it is the only thing that di�ers between thelimiters. A more complete study needs to be made in order to establish thequestion if the less accurate methods could produce similar accuracy with thecorresponding workload.

The workload di�erence between the MC and the van Leer/Albada limiteropens up for an interesting further comparison since the methods generatessimilar problem when it comes to the accuracy in the previous sections. Acomparison if the larger workload of the MC limiter could in fact cancel out itsaccurate results, would be interesting.

Figure 5.26 shows another weakness of the Superbee limiter since it is by farthe least e�cient limiter implemented in this thesis.

68

Page 69: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

6 Conclusion/Summary

6.1 Summary

Finite volume methods have been compared in the context of a fast �ow transientproblem inside a pipe system. The study has been limited to the second orderMUSCL-Hancock �nite volume scheme using di�erent kinds of slope limiters.Slope limiters are a way to reduce oscillations caused by second order methods.During the thesis, focus has been on the accuracy of the methods with respectto the computation of the forces. The �ow transient corresponds to changes inpressure and velocity which in turn results in forces inside the system.

To calculate and compare the forces a simple piping system was constructedfor simulation. The piping system consisted of a pressure tank, pipe segmentsand a valve. A linear closing of the valve caused the pressure transient thatpropagated through the pipe system. The numerical error of the methods wasestablished by computing the forces acting on two identical pipe segments inthe system. These segments were denoted the �rst and the second segmentin order to underline in what order the �ow transient reached the segments.The equations solved in the model problem corresponded to a wave propagationproblem without any losses. This means that the analytical solution to theproblem is that the forces acting on the �rst and second segment should coincide.A comparison of the force pro�les (functions) was carried out in order to seehow well the di�erent slope limiters manage to preserve the shape of the pro�le.

In order to study the di�erence of the force pro�les two main approacheshave been taken. First the overall shape of the force function and the frequencycontent has been studied using ordinary vector norms and dynamic load factors.Secondly the preservation of the maximum value of the force was investigated.

To further analyze the behaviour of the di�erent slope limiters two param-eters of the pipe system was changed. First the closing time of the valve wasvaried in order to see how the methods manages �ow transients of di�erentshapes and frequencies. Secondly the length of the pipe system was changed tomonitor the methods with respect to the simulation time.

The di�erent methods have been compared and the main focus has been theaccuracy. The e�ciency of the methods have often been left out of discussion,but in section 5.5 a short comparison concerning the workload of the limiterswas performed.

6.2 Conclusion

The numerical methods used in this thesis all stems from the MUSCL-Hancockscheme and a number of di�erent slope limiters. Corresponding methods thatdo not use limiters have also been included in the comparison in order to seethe need for slope limiters when a fast �ow transient is present. Below followsa list of the di�erent approaches studied during this thesis.

1. MC limiter.

69

Page 70: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

2. van Leer limiter.

3. van Albada limiter.

4. Minmod limiter.

5. Superbee limiter.

6. Downwind slope (linear second order method).

7. Upwind slope (linear second order method).

8. Zero slope (standard �rst order method).

Limiter 1-4 all follows a very similiar pattern, and if one just considers theaccuracy during the simulations performed, the rank is the order presentedabove starting with the most accurate.

The Minmod limiter is very easy to implement and it is also the limiterwith least the workload. However, this comes at the cost of an introduction ofdi�usion. The work done here shows that the Minmod limiter may be a simpleand e�cient limiter, but it can also show cases of di�usion.

Limiters 2 and 3, the van Albada and van Leer limiters are similiar when itcomes to implementation and also follows each other to some degree during thewhole study. In all the tests performed the van Leer limiter seems to to be themost accurate. Since the implementation of the two limiters are so much alike,the di�erence in workload is almost neglectable. Due to this the van Leer seemsto be the clear choice when comparing the two. Problems introduced by thesemethods are of the same character as the Minmod limiter, mainly representedby di�usion, but with a less severe result. One should note that the workloadof these limiters are higher than the Minmod limiter.

The MC limiter produces the most accurate result in all tests when onlylimiters 1-4 are taken into consideration. One can again note that the higheraccuracy come at the cost of more signi�cant workload than for limiter 2-4.

In order to make a complete study of limiter 1-4 a further study is neededwith respect to workload versus accuracy. A less accurate method (for examplethe Minmod limiter) could produce a more accurate result at a given workload.Increasing the resolution of the system grid is not as costly for the Minmodlimiter as it is for example the MC limiter. Yet another factor that would needto be taken into account for further analysis is the order of the di�erent limiters.The ranking of the order for limiter 1-4 are the same as when comparing theaccuracy, with the MC limiter having the highest order and the Minmod limiterthe lowest. Increasing the resolution with a higher order method gives a largerreduction of the error (relatively) than a lower order method. This could workin advantage of the limiters with the higher workload.

The Superbee limiter can only be up for discussion if the maximum value ofthe force is in focus. In almost all cases considered in this thesis the maximumvalue of the force was best preserved by the Superbee limiter. Also when theforce pro�le resembles a square function the Superbee limiter is unbeatable. This

70

Page 71: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

corresponds to when the short closing time of the valve was used, see section5.2. Another positive property of the Superbee limiter was shown in section5.3 where the time of the simulation was increased. The di�usion problemsintroduced by limiter 1-4 become more severe than the squaring problem of theSuperbee limiter. However, the severe deformation of the force pro�le in manyof the rather simple cases, the large workload and the low order of the methodwill probably outweigh the positive characteristics. The unpredictabiliy oftenseen by this particular limiter makes it unsuitable for the range of problemspresented here.

6.3 Further work

The linear �rst order method do in all cases presents less accurate results, but theworkload of the method is also less signi�cant. Therefore, it would be interestingto include a comparison between the linear �rst order and the MUSCL-Hancockmethod with limiters where the workload is taken into account as well.

The model problem can be expanded to include friction of the pipe wall, see[13], and even more complicated �uid-wall interactions.

There are of course higher order methods available that might be interest-ing to include in future comparisons. Studying the literature one can comeacross two popular higher order methods. Information on the Essentially non-oscillatory (ENO) Shock-Capturing schemes can for example be found in thework by Shu and Osher [10]. For the Piecewise Parabolic method (PPM) onecan see the work done by Colella and Woodward [4].

71

Page 72: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

72

Page 73: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

References

[1] Alan F. Beardon, (2005). Algebra and Geometry. Cambridge UniversityPress.

[2] M. Berger, M.J. Aftosmis and S.M. Murman, (2005). Analysis of Slope Lim-iters on Irregular Grids. 43:rd AIAA Aerospace Sciences Meeting, Reno;AIAA Paper 2005-0490.

[3] Christophe Berthon, (2006). Why the MUSCL�Hancock Scheme is L1-stable. Numerische Mathematik; Volume 104, Number 1/July.

[4] P. Colella and P.R. Woodward, (1984). The Piecewise Parabolic Method(PPM) for Gas-Dynamical Simulations. Journal of Computational Physics;Volume 54, pp. 174-201.

[5] Randall J. Leveque, (1992). Numerical methods for conservation laws.Basel: Birkhäuser.

[6] Randall J. Leveque, (2002). Finite Volume Methods for Hyperbolic Prob-lems. Cambridge University Press.

[7] Frederick J. Moody, (1990). Introduction to Unsteady Thermo�uid Mechan-ics. Wiley.

[8] Frank M. White, (1994). Fluid Mechanics av Frank M. White. McGraw-Hill.

[9] Per Nilsson, (2007).When MOC is Insu�cient. Inspecta's Swedish NuclearTechnology Symposium 2007.

[10] C-W Shu and S. Osher, (1988). E�cient Implementation of Essen-tially Non-oscillatory Shock-Capturing Schemes. Journal of ComputationalPhysics; Volume 77, pp. 439-471.

[11] Eleuterio F. Toro, (1999). Riemann Solvers and Numerical Methods forFluid Dynamics. Springer-Verlag.

[12] Pieter Wesseling, (2001). Principles of Computational Fluid Dynamics.Springer-Verlag.

[13] M. Zhao and M.S. Ghidaoui, (2004). Godunov-Type Solutions for WaterHammer Flows. Journal of Hydraulic Engineering; Volume 130, pp. 341-348.

73

Page 74: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Nomenclature

A coe�cient matrix

c acoustic wave speed of �uid

CFL Courant number

E matrix containing the eigenvalues of A

F force [N]

f �ux terms

ρ density [kg/m3]

p pressure [Pa]

Q cell average of q

q vector containing p and u

R matrix containing the eigenvectors of A

σv slope in cell

u velocity [m/s]

ν frequency

74

Page 75: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

A Appendix

A.1 Slope limiters derivation

Here follows a derivation of the van Leer and van Albada limiters used in thisthesis. The �nal functions θV anLeer and θV anAlbada can be seen in equation A.6.

Step 2 in the MUSCL-Hancock scheme is given in equation (A.1).

Qnr,left = Qni − σvi∆x2

Qnr,right = Qni + σvi∆x2

(A.1)

In [2], for the van Leer and van Albada limiters, the approach is somewhatdi�erent.

Qnr,left = Qni − 12ϕ( 1

Ri)(Qn

i+1−Qni−1

2 )

Qnr,right = Qni + 12ϕ(Ri)(

Qni+1−Q

ni−1

2 )(A.2)

where ϕ(R) is the so called slope limiter function and R =Qn

i+1−Qni

Qni −Qn

i−1. The slope

limiter functions for the van Leer and van Albada approach is given by equation(A.3) for R ≥ 0. The slope-limiter function should return 0 for R ≤ 0 in orderto preserve the TVD property, the discrete function then has a local extremum.

ϕV anLeer(R) = 4R(R+1)2

ϕV anAlbada(R) = 2R(R2+1)

R ≥ 0 (A.3)

Now follows a derivation to the other notation used by [6]. First it is easy tocheck that the slope limiter functions in equation (A.3) have the symmetricproperty, that is ϕ(R) = ϕ(1/R). Equations (A.2) can then be rewritten interms of Qni+1, Q

ni and Qni−1. De�ne a new slope function θ(Qni+1, Q

ni , Q

ni−1)

that will represent the slopes actually used when calculating the reconstructededge values as seen in the MUSCL-Hancock scheme.

θi(Qni+1, Q

ni , Q

ni−1) =

{1

∆xϕ(Qn

i+1−Qni

Qni −Qn

i−1)

(Qni+1−Q

ni−1)

2 R > 0

0 R≤0(A.4)

Equation (A.2) can then be rewritten so the slopes can be used in the same wayas in equation (A.1).

Qnr,left = Qni − θi∆x2

Qnr,right = Qni + θi∆x2

(A.5)

Rewriting the slope limiters in the form used in equation (A.4), omitting theindex i, gives the slope limiters van Leer and van Albada.

θV anLeer(Qni−1, Q

ni , Q

ni+1) =

{( 2

∆x )(Qn

i+1−Qni )(Qn

i −Qni−1)

(Qni+1−Qn

i−1) R>0

0 R ≤ 0

θV anAlbada(Qni−1, Qni , Q

ni+1) =

{( 1

∆x )(Qn

i+1−Qni )(Qn

i −Qni−1)(Qn

i+1−Qni−1)

(Qni+1−Qn

i−1)2+(Qni −Qn

i−1)2 R>0

0 R ≤ 0(A.6)

75

Page 76: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

dx 1.0 m 0.5 m 0.1 m 0.05 m 0.025 mMATLAB 2.7 s 9.0 s 237.3 s 938.7 s 3755.0 s

C ~0 ~0 5.5 s 18.3 s 79.3 s

Table 2: Execution time for the MC limiter, di�erent discretizations dx. MAT-LAB and C implementations.

The term 1/∆x will just cancel out when inserting equation (A.6) into (A.5).The reason for de�ning the function θ as done in equation (A.4) is to be ableto use a function that in fact de�nes a slope. This is of course not important inthe actual implementation, where the 1/∆x can be omitted and a simpli�cationcan be made.

A.2 Minmod/maxmod function

minmod(a, b) =

a if (|a| < |b|) & (ab > 0)b if (|a| > |b|) & (ab > 0)0 else

maxmod(a, b) =

a if (|a| > |b|) & (ab > 0)b if (|a| < |b|) & (ab > 0)0 else

minmod3(a, b, c) =

min(a, b, c) if a, b, c > 0max(a, b, c) if a, b, c < 0

0 else

A.3 Compare MATLAB implementation with C

The wave propagation part of the implementation is rewritten into C-code.This program does not contain any force computation or complicated boundaryconditions but is merely a wave propagation engine. The wave propagationprogram uses the MUSCL-Hancock method with any of the limiters used in thisthesis. A simulation includes writing the pressure and velocity to an external�le for all the time steps. The boundary conditions is no longer a pressure tankand a valve but instead de�ned as constant values and the simulation time isset to be the time it takes for a transient to travel from one end of the pipesystem to the other. A corresponding program was also written in MATLABin order to be able to make a comparison. In table 2 a small comparison of theexecution time can be seen for di�erent discretization sizes. The chosen methodis the MC limiter, the length of the pipe system is set to be L = 100m andthe simulation time is set to be the propagation time through the whole pipesystem, T = L

c .The result presented in table 2 is not in any way a complete study of the

workload of the two programming languages. Instead it is meant to show thesimple fact that the implementation done in MATLAB is not a reasonable choice

76

Page 77: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure A.1: Force pro�le for the Minmod limiter, CFL = 1.0.

when performing simulation of such a system with the given discretizations. Atleast not compared to the corresponding implementation in C.

The computing power used for this comparison was not the same as for therest of simulations. Instead, the small performance test of the two implemen-tations was exercised on one of the servers at Uppsala University, Sweden. Thespeci�cation for the server is not included since the purpose of the test wasmearly to show the vast di�erence between the MATLAB and the C implemen-tation.

A.4 Courant number (CFL) is equal to 1.0.

Figures A.1-A.3 shows that the wave propagation is exact when CFL = 1.0 isused, at least up to the rounding o� error.

A.5 Computer speci�cations.

• Processor: Genuine Intel(R) CPU T2500 Duo @ 2.00 GHz

• Memory: 2 GB RAM 800Hz

• Operating system: Windows XP SP3

• MATLAB version: 6.1

77

Page 78: Anders Markendahl302882/... · 2010. 3. 10. · Anders Markendahl The MUSCL-Hancock finite volume method with different slope limiters has been analyzed in the context of a fast transient

Figure A.2: Force pro�le for the Minmod limiter , CFL = 1.0. Magni�cation ofthe top of the force pro�le from �gure A.1.

Figure A.3: Force pro�le for the Minmod limiter , CFL = 1.0. Heavily magni�edof the top of the force pro�le from �gure A.2.

78