computational acoustics

Attribution Non-Commercial (BY-NC)

60 visualizações

computational acoustics

Attribution Non-Commercial (BY-NC)

- Transformation of second derivatives in weak formulation
- Tutorial Computational Methods for Aeroacoustics
- Theoretical and Computational Acoustics
- Computational Aeroacoustics An Overview.pdf
- A Meta-heuristic Approach to Rail-Truck Intermodal Transportation of Hazardous Materials
- Evaluation of Definite Integral
- Acoustics Fluent
- Acoustics Tutorials
- rungeKuttaFormulas
- School Project on java
- Analyzing Muffler Performance Using the Transfer Matrix Method
- Numerical Methods and Modelling
- Edge Colony
- economic load dispatch
- engineering acoustics
- Acoustics of Ducts and Mufflers-Munjal
- A Comparison of Numerical Techniques for American Option Pricing
- PPT on Heat and Electric LF_neural_networks
- ChangMcMechan_ReverseMigVSP
- An Improvement to the QUEST Algorithm - Yang Cheng and Malcolm D. Shuster

Você está na página 1de 75

IN ACOUSTICS

ULF R. KRISTIANSEN

ERLEND M. VIGGEN

DEPARTMENT OF ELECTRONICS AND

TELECOMMUNICATIONS NTNU 2010

Contents

Preface v

1 The nite difference method 1

1.1 The Taylor series and nite differences . . . . . . . . . . . . . . . 1

1.1.1 Discretisation and nite differences . . . . . . . . . . . . 2

1.1.2 Higher order derivatives . . . . . . . . . . . . . . . . . . . 4

1.2 Helmholtz equation . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.2.1 Boundary conditions . . . . . . . . . . . . . . . . . . . . . 5

1.2.2 Matrix form . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.3 Example: Simple model of a drum . . . . . . . . . . . . . . . . . 7

1.3.1 Governing equations . . . . . . . . . . . . . . . . . . . . . 8

1.3.2 Finite difference equations . . . . . . . . . . . . . . . . . . 9

1.3.3 Special cases . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.3.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1.4 The wave equation . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1.4.1 Initial conditions . . . . . . . . . . . . . . . . . . . . . . . 12

1.4.2 Reection-free boundary conditions . . . . . . . . . . . . 12

1.4.3 Interface between two media, 1D example . . . . . . . . 13

1.5 Further topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

1.5.1 Creating difference schemes . . . . . . . . . . . . . . . . . 14

1.5.2 Approximation error . . . . . . . . . . . . . . . . . . . . . 15

1.5.3 Richardson extrapolation . . . . . . . . . . . . . . . . . . 16

1.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2 Cellular automata methods 19

2.1 Lattice gases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.1.1 The HPP model . . . . . . . . . . . . . . . . . . . . . . . . 20

2.1.2 The FHP model . . . . . . . . . . . . . . . . . . . . . . . . 22

2.2 The lattice Boltzmann method . . . . . . . . . . . . . . . . . . . . 24

2.3 The transmission line matrix (TLM) method . . . . . . . . . . . . 27

2.3.1 Basic theory . . . . . . . . . . . . . . . . . . . . . . . . . . 28

iii

iv

2.3.2 Sound sources and walls . . . . . . . . . . . . . . . . . . . 29

2.3.3 Further TLM topics . . . . . . . . . . . . . . . . . . . . . . 30

2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3 The nite element method 33

3.1 Finite elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

3.1.1 Global and local basis functions . . . . . . . . . . . . . . 36

3.2 The weighted residual method . . . . . . . . . . . . . . . . . . . 38

3.2.1 Subdomain collocation . . . . . . . . . . . . . . . . . . . . 39

3.2.2 Point collocation . . . . . . . . . . . . . . . . . . . . . . . 39

3.2.3 Galerkins method . . . . . . . . . . . . . . . . . . . . . . 40

3.3 Galerkin solution of the Helmholtz equation . . . . . . . . . . . 40

3.3.1 In one dimension . . . . . . . . . . . . . . . . . . . . . . . 41

3.3.2 In higher dimensions: General solution . . . . . . . . . . 43

3.3.3 General boundary conditions . . . . . . . . . . . . . . . . 44

3.4 Different types of elements . . . . . . . . . . . . . . . . . . . . . . 45

3.4.1 Isoparametric elements . . . . . . . . . . . . . . . . . . . 46

3.4.2 One-dimensional pipe elements . . . . . . . . . . . . . . 47

3.4.3 Innite Bettess elements . . . . . . . . . . . . . . . . . . . 48

3.4.4 Wave envelope elements . . . . . . . . . . . . . . . . . . . 49

3.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

4 The boundary element method 50

4.1 The Kirchhoff-Helmholtz integral theorem . . . . . . . . . . . . 50

4.1.1 Free eld . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

4.2 Discretisation of the surface integral . . . . . . . . . . . . . . . . 54

4.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

5 Raytracing methods 57

5.1 The ray approximation . . . . . . . . . . . . . . . . . . . . . . . . 58

5.2 Raytracing for marine and atmospheric acoustics . . . . . . . . . 61

5.3 Room acoustics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

5.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

Preface

What am I reading?

This compendium is written for the course TTT12 Numerical acoustics at the

Norwegian University of Science and Technology. In earlier years, the curricu-

lumof this course was a collection of articles, mostly written by Ulf Kristiansen

in Norwegian. These articles have been collected, translated to English, rewrit-

ten and expanded by Erlend Viggen, and the result is this compendium! We

hope youll nd it useful.

Why computational acoustics?

In acoustics, and in most other elds of physics for that matter, the equations

that govern the behaviour of physical systems are well-known. For instance,

the wave equation describes how sound propagates. We can nd analytical

solutions to these equations in a few simple special cases, but for more com-

plex cases it quickly becomes virtually impossible to nd a solution by direct

analytical calculation.

Computational physics saves us from this mess, making it possible to nd

approximately correct solutions to these more complex cases. We simplify the

analytical problem into a problem of doing many smaller calculations, which

give us the desired result. In the old days, before digital computers existed,

these smaller calculations were done by hand by humans whose job title

actually was computer! Nowadays, almost everything is done on digital

computers, making it feasible to handle very large computations.

Naturally, computational physics has increased in popularity as computers

have increased in power. Nowadays, it is seen a separate branch of physics,

along with theoretical and experimental physics.

Computational acoustics is used throughout the entire acoustic industry.

Automobile manufacturers simulate the acoustics of cars to determine how

much noise they will create. Loudspeaker manufacturers simulate the acoustic

behaviour of loudspeaker cabinets before building prototypes. Acoustic con-

sultants simulate the acoustics of concert halls before they are built. After all,

its much cheaper and more effective to correct the acoustics of the concert hall

v

vi

before it is built rather than after.

Although there exist several different computer programs that can do per-

form different kinds of acoustic simulations, these are limited in usefulness

without any understanding of how they work. With this understanding, it is

possible to do simulations that are more correct, more effective and more rele-

vant.

What will I learn from this compendium?

You will be introduced to a wide variety of different computational methods

which can be used to perform acoustic simulations on the computer. You will

learn the basics of these methods, and you will be able to implement many of

them as computer programs.

In short, this compendium gives you an extremely useful skill: The ability

to write your own computer programs to simulate a wide variety of acoustical

problems. Not bad!

What if I nd an error?

While we have tried not to include any mistakes in the text, there may be some

errors left. If you nd an error anywhere in the compendium, mathematical

or lingual, tell Erlend Viggen and hell x it. Corrections and suggestions are

very much appreciated.

Chapter 1

The nite difference method

The nite difference method is one of the most classic methods in numerical

analysis of differential equations. Instead of trying to nd an exact solution of

a differential equation in an entire domain (e.g. nding the sound eld in a

room), one attempts to nd approximate solutions at a number of points in the

domain.

These points are placed on the nodes of a grid which covers the entire do-

main. With a clever choice of grid, we can nd solutions in domains of pretty

much any shape. The neness of this grid generally determines how good the

approximate solution is.

In the nite difference method, partial differential equations are discretised.

Derivatives in the equations can be directly replaced by approximations which

can be found from the Taylor series, so that each nodes value ends up depend-

ing on its neighbours values. This gives a system of linear equations which

may be solved directly on a computer. Thus, the nite difference method is

very direct, simple, and powerful.

In this chapter, we will describe how nite differences can be found from

the Taylor series, and show how the Helmholtz equation and the wave prop-

agation can be discretised. We will also give an example of a system with a

coupling of vibrations and acoustics.

1.1 The Taylor series and nite dierences

It is known fromearlier courses that any smooth function f (x) can be rewritten

as a Taylor series around a point c,

f (x) = f (c) +

f

(c)

1!

(x c) +

f

(c)

2!

(x c)

2

+ . . . =

i=0

f

(i)

(c)

i!

(x c)

i

. (1.1)

The Taylor series is a sum of an innite number of terms. It is possible to

1

2 CHAPTER 1 THE FINITE DIFFERENCE METHOD

truncate this series as

f (x) = f (c) +

f

(c)

1!

(x c) + . . . +

f

(n)

(c)

n!

+ R

n

(x), (1.2)

where the term R

n

is called the remainder, and is given by

R

n

(x) =

f

(n+1)

()

(n +1)!

(x c)

n+1

, (1.3)

where is a value between c and x. We will nowexamine howthe Taylor series

is useful for creating nite difference expressions, i.e. estimating derivatives of

f (x) at some point x from f (x) itself.

3 2 1 0 1 2 3

5

0

5

10

15

20

x

e

x

2 terms

4 terms

6 terms

8 terms

Figure 1.1: By including more and more terms of the Taylor series of e

x

, we see

that the series converges to the desired function.

1.1.1 Discretisation and nite dierences

We assume that we have a differential equation D(x) = 0, where the differ-

ential operator D may contain derivatives of different orders.

x

, and

start by discretising the independent variable x. We restrict x to a discrete set

of M +1 different values x

i

, where

x

i+1

x

i

= x and x

i

= ix, for i = 0, 1, . . . , M. (1.4)

The distribution of nodes is shown in Figure 1.2.

For instance, the Helmholtz equation can be written in one dimension with a differential op-

erator D =

2

/x

2

+ k

2

.

1.1 THE TAYLOR SERIES AND FINITE DIFFERENCES 3

0 x 2x ix Mx

Figure 1.2: M +1 nodes spaced evenly with a spacing x.

The differential terms in the operator D can be replaced with nite differ-

ences. These are found from the Taylor series in equation 1.2, which can now

be written as

(x

i+1

) = (x

i

+x) = (x

i

) +x

d

dx

(x

i

) + . . . +

x

n

n!

d

n

dx

n

(x

i

)

+

x

n+1

(n +1)!

d

n+1

dx

n+1

(x

i

+ x),

(1.5)

where 0 < < 1.

The last term in this series is the remainder, as in equation 1.3. We can for

instance let the second derivative term represent the remainder. Abbreviating

(x

i

) to

i

, we then nd

i+1

=

i

+x

d

i

dx

+

x

2

2!

d

2

dx

2

(x

i

+ x), (1.6)

giving

d

i

dx

=

i+1

i

x

+

x

2!

d

2

dx

2

(x

i

+ x)

=

i+1

i

x

+O(x).

(1.7)

The remainder is proportional to x, or in other words, O(x). This means

that if we remove it, the equation gets an approximation error proportional to

x.

Equation 1.7 is called a forward difference approximation of the rst deriva-

tive of (x

i

), since we estimate the derivative by looking forward. We can nd

the backward difference approximation by rst using the Taylor series to esti-

mate (x

i1

),

i1

=

i

x

d

i

dx

+

x

2

2!

d

2

dx

2

(x

i

x). (1.8)

From this, we obtain

d

i

dx

=

i

i1

x

+O(x). (1.9)

If instead we let the third order term in the Taylor series represent the re-

mainder, we can nd expressions for

i+1

and

i1

which can be combined to

nd an expression for the central difference equation,

d

i

dx

=

i+1

i1

2x

+O(x

2

). (1.10)

4 CHAPTER 1 THE FINITE DIFFERENCE METHOD

We see fromthe error termthat the central difference approximation gets better

as x 0 faster than the forward and backward difference approximations.

Therefore, it is generally a much better idea to use central differences than

forward or backward differences.

Figure 1.3 shows a comparison of how well forward, backward and central

difference schemes nd the derivative of sin(x) at x = 1 with widely spaced

nodes.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0.4

0.6

0.8

1

x

sin(x)

Actual derivative

Forward difference

Backward difference

Central difference

Figure 1.3: Approximations to the derivative of sin(x) at x = 1, with x = 0.5.

1.1.2 Higher order derivatives

By including an increasing number of terms in the Taylor series and combin-

ing different series, we can nd approximations for the rst four derivatives,

where all equations have approximation errors of O(x

2

):

d

i

dx

i+1

i1

2x

, (1.11a)

d

2

i

dx

2

i+1

2

i

+

i1

x

2

, (1.11b)

d

3

i

dx

3

i+2

2

i+1

+2

i1

i2

2x

3

, (1.11c)

d

4

i

dx

4

i+2

4

i+1

+6

i

4

i1

+

i2

x

4

. (1.11d)

Expressions for approximated derivatives where the error is even smaller

(i.e. O(x

4

), O(x

6

), etc.) are sometimes necessary. We would then need to

use even more points around the node where the derivative is being calculated.

For studies of sound propagation over long distances in the time domain, both

1.2 HELMHOLTZ EQUATION 5

pressure and particle velocity are occasionally computed via rst order differ-

ential expressions. To minimize dispersion, eighth order differences may be

necessary in some cases.

1.2 Helmholtz equation

As our rst acoustic example, we imagine wave propagation in a long pipe of

length L

x

. We write the Helmholtz equation for plane harmonic waves with

wavenumber k, moving in x direction,

2

p

x

2

+ k

2

p = 0. (1.12)

We can write this in a nite difference form for node i by replacing the double

derivative with the nite difference expression from equation 1.11b,

p

i+1

2p

i

+ p

i1

x

2

+ k

2

p

i

= 0. (1.13)

This results in a system of linear equations which relate the values of the

node pressures to each other. To be able to solve this system of equations,

we will need to know something about the edges of the system, the boundary

conditions.

1.2.1 Boundary conditions

Some possible boundary conditions for this pipe are open ends (also known as

a homogenous Dirichlet condition), hard walls (known as a homogenous Neu-

mann condition), an impedance boundary condition, and a velocity condition

(for instance caused by a piston). We go through all of these in order.

M M1 M2

Open ends

Since we have the boundary condition p = 0 at the mouth of an open pipe, we

get the conditions p

0

= 0 and p

M

= 0 at the end nodes of the system if both

ends of the pipe are open to air.

If we need to nd the pressure at a node beyond the end of the pipe (say,

a node at i = M + 1), we can nd this by examining the nite difference

Helmholtz equation at the end node at i = M,

p

M+1

2p

M

+ p

M1

x

2

+ k

2

p

M

= 0

p

M

=0

p

M+1

+ p

M1

x

2

= 0, (1.14a)

which tells us that p

M+1

= p

M1

.

6 CHAPTER 1 THE FINITE DIFFERENCE METHOD

M M1 M2

Hard walls

For hard walls, we wish the particle velocity normal to the surface to be zero.

From the linear Eulers equation, we nd that

u

wall

=

1

j

p

x

wall

= 0. (1.15)

For the end node at i = M, we can write this boundary condition in nite

difference form as

p

M+1

p

M1

2x

= 0, (1.16)

so that p

M+1

= p

M1

. This means that for the wall node M, the discretised

Helmholtz equation (1.13) becomes

2p

M1

2p

M

x

2

+ k

2

p

M

= 0. (1.17)

M M1 M2

Impedance boundary condition

If we have a given impedance Z

M

in the end node at i = M, we can nd the

value in a ctional exterior point at i = M +1 through

Z

M

=

p

M

u

M

=

p

M

1

j

p

M+1

p

M1

2x

, (1.18)

so that

p

M+1

= p

M1

2jx p

M

Z

M

. (1.19)

Note that the nodes are now related to each other through a complex num-

ber. Since we are solving the Helmholtz equation, a complex pressure ampli-

tude implies a phase shift.

M M1 M2

Pipe driven with a given velocity

If we have a boundary, for instance at a moving piston, where the particle

velocity u is given, we can implement this by pinning the particle velocity u

M

at the node to a certain value. In equation 1.19, we can replace Z

M

with p

M

/u

M

to get

p

M+1

= p

M1

2jx u

M

. (1.20)

1.2.2 Matrix form

When the discretised Helmholtz equation has been written for each node, the

system of equations can be written in matrix form. We will look at an example

of a pipe which is open at x = 0 and driven by a piston with a given velocity

u

M

at x

M

= L

x

, which gives a system

(A+ k

2

I)p = b, (1.21)

1.3 EXAMPLE: SIMPLE MODEL OF A DRUM 7

where I is the identity matrix. More explicitly, this is

_

_

_

_

_

_

_

_

1

x

2

_

_

2 1

1 2 1

1 2 1

.

.

.

2 2

_

_

+ k

2

I

_

_

_

_

_

_

_

_

_

_

p

1

p

2

p

3

.

.

.

p

M

_

_

=

_

_

0

0

0

.

.

.

2ju

M

x

_

_

. (1.22)

Note how we get a tridiagonal matrix, since we are using a central difference

method to approximate

2

p/x

2

.

If we were to solve for p, we would rst need to set values for and k, in

addition to the other constants. Then, we would be able to nd p by inverting

the (A+ k

2

I) matrix,

p = (A+ k

2

I)

1

(A+ k

2

I)p = (A+ k

2

I)

1

b. (1.23)

If we have (A+ k

2

I) and b in MATLAB as a matrix called B and a vector called

b, we can nd p through left matrix division, p = B\b. (This is MATLAB s

well-optimized way of calculating expressions like equation 1.23.)

The values of k corresponding to eigenmodes of a system can sometimes

be found directly from the matrix A. If we have openings in both ends of the

pipe, the matrix equation becomes

(A+ k

2

I)p = 0. (1.24)

We note that this resembles the eigenvalue equation

(AI)p = 0, (1.25)

with k

2

= . Therefore, eigenmode values of k can be found through nding

the eigenvalues of A.

In this section we present a nite difference model for a basic coupled system.

The model is sketched in Figure 1.4. A circular drum skin (an ideal membrane)

is coupled to a hard walled tube. Only axisymmetric motion in assumed for

the membrane, and the acoustic motion is assumed one-dimensional. One goal

is to model with very fewdegrees of freedom, so that the analytic equations for

the resonant wavenumbers might be obtained and discussed.

For more information on nding eigenvalues, see for instance Elementary Linear Algebra by

C.H. Edwards, Jr. and D.E. Penney.

8 CHAPTER 1 THE FINITE DIFFERENCE METHOD

a

L

Membrane

Acoustic

cavity

1 2 3

4

5

6

y

Figure 1.4: Geometry of the problem on the left, with discretisation nodes

shown and labelled on the right.

1.3.1 Governing equations

The membrane is governed by Newtons second law, relating the force per

area caused by tension and pressure with the acceleration of the membrane.

The equation becomes

T

_

r

2

+

1

r

r

_

+ p =

t

2

, (1.26)

where is the displacement away from the cavity (i.e. in negative y direction),

T the tension and the mass density per area. The air in the acoustic cavity is

governed by the wave equation,

2

p

y

2

1

c

2

a

2

p

t

2

= 0. (1.27)

In addition, a coupling equation for the membrane/cavity interface can be

found from the linear Eulers equation and written as

p

y

=

t

2

. (1.28)

We assume harmonic time variation and seek the eigenvalues of the system.

1.3 EXAMPLE: SIMPLE MODEL OF A DRUM 9

We rewrite the equations as

T

_

r

2

+

1

r

r

_

+

2

+ p = 0, (1.29)

2

p

y

2

+

2

c

2

a

p = 0, (1.30)

p

y

=

2

. (1.31)

We also have a set of boundary conditions. At the open end at y = L (point 5),

we have that p = 0. As the membrane is xed at its ends, = 0 at r = a (points

1 and 3). Also, we assume axisymmetric displacement of the membrane, so

that /r = 0 for r = 0 (point 2). Note the introduction of point 6, an outside

non-physical point.

As the membrane equation (1.29) must be written for point 2 (r = 0), the

second term in the parenthesis poses a problem, as /r 0 while 1/r

when r 0. This is solved by using lH opitals rule, giving

2T

r

2

+

2

= 0. (1.32)

1.3.2 Finite dierence equations

For point 2, equation 1.32 becomes

4T

2

r

2

+

2

2

+ p

2

= 0. (1.33)

The Helmholtz equation (1.30) at the same point becomes

p

4

2p

2

+ p

6

y

2

+

2

c

2

a

p

2

= 0, (1.34)

while the Helmholtz equation for point 4 becomes

2p

4

+ p

2

y

2

+

2

c

2

a

p

2

= 0. (1.35)

The coupling equation for membrane displacement and pressure (1.31) be-

comes

p

4

p

6

2y

=

2

2

. (1.36)

In the above equations, p

5

,

1

, and

3

have been set to zero. p

6

is eliminated by

combining equations 1.36 and 1.34.

The unknowns of the system are p

2

, p

4

, and

2

, meaning that we have a

system with three degrees of freedom.

Simple algebra on the above equations gives a somewhat complicated re-

sult,

_

2

y

2

c

2

a

2

_

2

+

2

y

2

c

2

a

2

2

r

2

c

2

m

4

2y

2

r

2

c

2

m

2 = 0, (1.37)

where c

m

is the membrane wave velocity, given by c

2

m

= T/.

10 CHAPTER 1 THE FINITE DIFFERENCE METHOD

1.3.3 Special cases

Some physical insight might be gained by inspecting a few special cases of this

equation.

In vacuo membrane

If the membrane is not coupled to air in any way, for instance if it is in a vac-

uum, the resonant membrane wavenumber is given directly fromequation 1.33

as

k

m

a =

T/

r = 2. (1.38)

The analytical value is found from the zeroth order Bessel function as k

m

a =

2.41 (found from J

0

(k

m

a) = 0). The one active node membrane equation

therefore gives a value which is 83 % of the analytical value. This is a fairly

good result, considering we have only used three nodes to get this result, two

of which were set to zero.

T

When we let T approach innity, we essentially make the membrane a hard

wall. Since c

m

also approaches innity, equation 1.37 loses the large second

term, and can be simplied to

k

a

L = 2

_

2

2. (1.39)

The lowest possible wavenumber, found by using the minus sign, gives the

fundamental wavenumber of an open/closed waveguide as k

a

L 1.531, which

is within 2.6 % of its analytical value of k

a

L = /2.

T = 0

In this case, the membrane acts as a limp mass. c

m

now goes to zero, so that

we can simplify equation 1.37 to

_

2

y

2

c

2

a

2

___

2

y

2

c

2

a

2

_

+

2y

_

2 = 0. (1.40)

That is, for a given geometry, the angular frequency depends on the ratio of

the area mass density of the cavity uid divided by the area mass density of

the membrane.

In the limit of 0, the equation gives a value k

a

L =

8 2.83, which

approaches the analytical value for an open end of with an error of 10%.

In the limit of , we essentially assume the membrane to be a hard

wall. Equation 1.40 also reduces to equation 1.39, giving the same result of

k

a

L 1.531, which is nearly the hard-wall analytical result of /2.

1.4 THE WAVE EQUATION 11

1.3.4 Summary

We see that even with this extremely simple model, we nd a solution to the

Helmholtz equation which actually is fairly correct in the special cases we have

looked at. The results would be even better if we had used more nodes on

the membrane and inside the drum, but the resulting equations would be so

complex that we would need to solve them numerically on a computer.

1.4 The wave equation

So far, we have looked only at the Helmholtz equation, which is the time-

independent form of the wave equation. The wave equation includes both

space and time derivatives. Therefore, we now need to discretise both in space

and in time.

As an example, we use a 1D system and call our discretisation lengths x

and t. In the same way as the x coordinate is given by x

i

= ix, the time t is

given as t

k

= kt, where k now is our time index. We thus denote the pressure

at different points in space and time as

p(x

i

, t

k

) = p

k

i

. (1.41)

Thus, the one-dimensional wave equation,

2

p

x

2

1

c

2

2

p

t

2

= 0, (1.42)

is discretised to

p

k

i+1

2p

k

i

+ p

k

i1

x

2

1

c

2

p

k+1

i

2p

k

i

+ p

k1

i

t

2

= 0. (1.43)

This means that we can compute the pressure value of node i for the next time

step (k +1) by knowing the pressure at point i at the current (k) and previous

(k 1) time step, as well as the current values in the neighbouring nodes (i 1

and i +1).

Solving for p

k+1

i

, we get

p

k+1

i

= 2

_

1

2

_

p

k

i

+

2

_

p

k

i+1

+ p

k

i1

_

p

k1

i

, (1.44)

where =

ct

x

, which can be physically interpreted as the travelled length

of the signal during a time step t compared to the node spacing x. For a

one-dimensional simulation, it is necessary for stability reasons that 1.

2

p

x

2

+

2

p

y

2

1

c

2

2

p

t

2

= 0. (1.45)

This can be shown either from von Neumann stability analysis or the CFL condition, which

we will not go into in this text.

12 CHAPTER 1 THE FINITE DIFFERENCE METHOD

Assuming an equal node spacing in both directions (i.e. y = x), we can nd

in a similar manner that

p

k+1

i,j

= 2

_

1 2

2

_

p

k

i,j

+

2

_

p

k

i+1,j

+ p

k

i1,j

+ p

k

i,j+1

+ p

k

i,j1

_

p

k1

i,j

, (1.46)

where j is the node index in y direction (i.e. y = jy).

For three-dimensional axisymmetric geometries, the wave equation is given

by

2

p

r

2

+

1

r

p

r

+

2

p

z

2

1

c

2

2

p

t

2

= 0. (1.47)

Discretising this and solving for p

k+1

i,j

, where i is the r index and j is the z index,

we get

p

k+1

i,j

= 2

_

1 2

2

_

p

k

i,j

+

2

_

p

k

i+1,j

+ p

k

i1,j

+ p

k

i,j+1

+ p

k

i,j1

_

+

2

ir

_

p

k

i+1,j

p

k

i1,j

_

p

k1

i,j

.

(1.48)

For axisymmetric systems we have a special case for r 0, since the r

coordinate is a denominator in the second term in the wave equation. We can

observe that the numerator in the term, p/t, also must go to zero due to

axisymmetry. We can then use LH opitals rule to nd that

lim

r0

p/r

r

=

2

p

r

2

. (1.49)

For the two-dimensional and three-dimensional axisymmetric forms of the

wave equation, stable calculations require that 1/

2.

We saw that to calculate the pressure in time step k +1, we need to know both

the pressure in time step k and k 1. This gives us a problem when starting

our simulation, since it means that we cannot simply set up a single pressure

eld for t

0

= 0 in our domain and let it propagate. This is because we would

also need to know what the pressure eld is at t

1

= t.

This is not a problem if we want to simulate a wave which propagates from

a single source. We then typically wish to pin the pressure at a certain node to

some time-varying function, i.e. a sine function. We can then assume that this

source is turned on at t = 0, so that there is no pressure eld present for t 0.

We can thus dodge the problem described in the previous paragraph.

1.4.2 Reection-free boundary conditions

This can be achieved in different ways. One way is to write the equations for

the outer parts of the discretised area in such a way that they are valid only for

Again, this can be shown either from von Neumann stability analysis or the CFL condition.

1.4 THE WAVE EQUATION 13

one-way wave motion, moving out of the solution area. Another way is to put

a damping layer on the outside of the area so that the wave will be damped

gradually. This method is called the perfectly matched layer (PML) method. We

now take a closer look at the rst method.

In one dimension, as for wave propagation in a pipe, the wave equation is

given by

_

2

x

2

1

c

2

2

t

2

_

p = 0. (1.50)

This can be factorised as

_

1

c

t

+

x

__

1

c

t

x

_

p = 0. (1.51)

Each factor represents a one-dimensional wave equation for waves in positive

and negative direction, respectively. These are called the one-way equations,

as they allow wave propagation in only one direction.

The problem is that such expressions can easily be written for plane waves

normally incident on the walls, but not for more complex waveforms. For two-

dimensional expressions, Alistair C. Reynolds found [1] an expression of the

form

_

_

_

1

c

t

x

_

_

1 +

1

2

_

_

2

y

2

2

x

2

_

_

_

_

_

_

_

p = 0, (1.52)

with the + sign indicating waves moving in positive x or y direction and the

sign indicating waves moving in negative x or y direction.

1.4.3 Interface between two media, 1D example

Two media, with densities

1

and

2

and speeds of sound c

1

and c

2

, have an

interface at node M, as shown in Figure 1.5. The boundary conditions to be

fullled are continuity in sound pressure and particle velocity.

M1 M1/2 M M +1/2 M +1

Figure 1.5: Interface between two media at node M.

Denoting pressure in the rst medium as p(1) and pressure in the second

as p(2), the rst boundary condition is given by

p(1)

M

= p(2)

M

, (1.53)

14 CHAPTER 1 THE FINITE DIFFERENCE METHOD

while the second condition is given from the linear Eulers equation as

1

1

p(1)

M

x

=

1

2

p(2)

M

x

(1.54)

The wave equation for each material can be written as

1

2

p(1)

x

2

=

1

1

c

2

1

2

p(1)

t

2

, (1.55)

and

1

2

p(2)

x

2

=

1

2

c

2

2

2

p(2)

t

2

. (1.56)

The two equations are now integrated with respect to x from M1/2 to

M, and M to M + 1/2 respectively, while the sound pressure is considered

constant in the hatched area in Figure 1.5. We get that

1

1

_

p(1)

M

x

p(1)

M1/2

x

_

1

c

2

1

x

2

2

p(1)

t

2

= 0, (1.57)

and

1

2

_

p(2)

M+1/2

x

p(2)

M

x

_

2

c

2

2

x

2

2

p(2)

t

2

= 0. (1.58)

By writing these equations in a nite difference form, adding them, and us-

ing the boundary conditions in equations 1.53 and 1.54, we nd for the bound-

ary point M that

1

x

2

_

1

2

p

k

M+1

_

1

1

+

1

2

_

p

k

M

+

1

1

p

k

M1

_

1

2

_

1

1

c

2

1

+

1

2

c

2

2

_

p

k+1

M

2p

k

M

+ p

k1

M

t

2

= 0.

(1.59)

This equation is really just a more general version of equation 1.43. If we let

1

=

2

= and c

1

= c

2

= c, the two equations become identical.

1.5 Further topics

We will nowlook at a fewmathematical aspects of the nite difference method.

1.5.1 Creating dierence schemes

In section 1.1, we saw how to derive the simplest rst-order forward and back-

ward difference schemes, but did not look at how to derive better schemes. We

will now look closer at this.

1.5 FURTHER TOPICS 15

The Taylor series for

i+2

,

i+1

,

i1

, and

i2

can be truncated to

i+2

i

+2x

d

i

dx

+

4x

2

2

d

2

i

dx

2

+

8x

3

6

d

3

i

dx

3

+

16x

4

24

d

4

i

dx

4

, (1.60a)

i+1

i

+x

d

i

dx

+

x

2

2

d

2

i

dx

2

+

x

3

6

d

3

i

dx

3

+

x

4

24

d

4

i

dx

4

, (1.60b)

i1

i

x

d

i

dx

+

x

2

2

d

2

i

dx

2

x

3

6

d

3

i

dx

3

+

x

4

24

d

4

i

dx

4

, (1.60c)

i2

i

2x

d

i

dx

+

4x

2

2

d

2

i

dx

2

8x

3

6

d

3

i

dx

3

+

16x

4

24

d

4

i

dx

4

. (1.60d)

This system of equations can be more conveniently written in matrix form,

A

..

_

_

1 0 1 0 0 2 2 4/3 2/3

0 1 1 0 0 1 1/2 1/6 1/24

0 0 1 1 0 1 1/2 1/6 1/24

0 0 1 0 1 2 2 4/3 2/3

_

_

_

i+2

i+1

i1

i2

x

d

i

dx

x

2

d

2

i

dx

2

x

3

d

3

i

dx

3

x

4

d

4

i

dx

4

_

_

0. (1.61)

We can nd difference schemes by linear combination of the rows of A. For

instance, A

1

2A

2

+2A

3

A

4

results in the equation

i+2

+2

i+1

2

i1

+

i2

+2x

3

d

3

i

dx

3

0, (1.62)

which can be rewritten as

d

3

i

dx

3

i+2

2

i+1

+2

i1

i2

2x

3

. (1.63)

This scheme is familiar from equation 1.11c. If we include more terms in

our Taylor series and include more points, we can derive any nite difference

scheme to arbitrary order with this method.

This is one of several methods to derive nite difference schemes. There

exist more direct methods, such as the method of undetermined coefcients, but

these are more complicated.

1.5.2 Approximation error

As we saw in section 1.1.1, the nite difference method gives out an approxi-

mation of the exact solution to the problem. The approximation error is directly

linked to the discretisation: For example, we sawthat the errors in forward and

backward difference approximations of the rst derivative are proportional to

x, while the errors in the central difference approximation are proportional

16 CHAPTER 1 THE FINITE DIFFERENCE METHOD

to x

2

. We therefore say that the forward and backward difference scheme is

rst order, while the central difference scheme is second order.

Given an unknown nite difference scheme, it is not immediately obvi-

ous how large its approximation errors are. We will now see how they can be

found.

As an example, lets take the central difference approximation of the second

derivative, which we have used to discretise the Helmholtz and wave equa-

tions. If we replace

i+1

and

i1

with their Taylor series, we nd that

i+1

2

i

+

i1

x

2

=

1

x

2

_

i

+x

d

i

dx

+

x

2

2

d

2

i

dx

2

+

x

3

6

d

3

i

dx

3

+

x

4

24

d

4

i

dx

4

+O(x

5

)

2

i

+

i

x

d

i

dx

+

x

2

2

d

2

i

dx

2

x

3

6

d

3

i

dx

3

+

x

4

24

d

4

i

dx

4

+O(x

5

)

_

,

which becomes

i+1

2

i

+

i1

x

2

=

d

2

i

dx

2

+

x

2

12

d

4

i

dx

4

+O(x

3

)

=

d

2

i

dx

2

+O(x

2

).

(1.64)

We have now shown that this numerical scheme estimates d

2

i

/dx

2

with

an approximation error which scales as x

2

.

1.5.3 Richardson extrapolation

If we know the order of the error term in the method used to calculate some-

thing, we can use a trick called Richardson extrapolation to nd a good estimate

from two poorer ones.

As an example, lets say we want to numerically nd the wave number k of

the fundamental of an open-ended pipe of L = 1 m length. Since this funda-

mental has a wavelength of 2L, the analytical solution to this is k = 2/ =

2/2L = .

(a) Three nodes (b) Four nodes

Figure 1.6: Numerical estimation of the fundamental in an open-ended pipe.

This problem is simple to solve numerically using the standard discretised

Helmholtz equation (1.13), and setting the end nodes values to zero. If we use

three nodes to discretise the pipe (x = 1/2), we nd a value k =

8 2.83.

If we use four nodes (x = 1/3), we nd k = 3. These values seem to be

1.6 SUMMARY 17

converging towards , which is what we want to nd. But we will now see

how we can nd a very good result based on these two relatively poor results.

Since we know that the numerical scheme used in the estimation has an

approximation error O(x

2

), it is not unnatural to assume that the difference

between the exact solution k

ex

and the numerical solution k(x) is

k

ex

k(x) Kx

2

, (1.65)

where K is some constant. Connecting two different estimates k(x

1

) and

k(x

2

) through K, we nd that

k

ex

k(x

1

)

x

2

1

k

ex

k(x

2

)

x

2

2

,

k

ex

k(x

1

)x

2

2

k(x

2

)x

2

1

x

2

2

x

2

1

. (1.66)

Using the values we found for x

1

= 1/2 and x

2

= 1/3, we nd that

k

ex

3.1373, which is a very good approximation of . Directly nding a

result of similar quality would actually require using 18 nodes in the discreti-

sation!

1.6 Summary

In this chapter, we have seen how to use the nite difference method to discre-

tise the Helmholtz equation and the wave equation.

For the Helmholtz equation, the result of the discretisation was a system of

equations relating the pressure at a node with the pressure at its neighbouring

nodes through the wavenumber k and the spatial resolution x. If this system

of equations is small, it can be solved by hand. If it is large, it should be written

in matrix form and solved by inversion of the matrix.

For the wave equation, the discretisation resulted in an equation giving

the pressure for every node at time step t

k+1

as the pressures in the node and

its neighbours at t

k

and the pressure of the node at t

k1

. For stability in one

dimension, we need to have

ct

x

1. In two-dimensional and an axisymmetric

three-dimensional simulations, we need to have

ct

x

1/

2.

Generally, the nite difference method is a fairly straightforward method in

which any partial differential equation can be discretised. This discretisation

can be used to nd an approximate solution to the equation, given appropriate

boundary conditions (and initial values, for time-dependent equations).

While the nite difference method is powerful and simple, it is not simple

to adapt it properly to boundaries of arbitrary shape. For instance, how to

discretise the circular boundary in Figure 1.7? Some solutions to that problem

are:

Finer grid: Make the entire grid ner. This will improve the approximation

around the boundary at the cost of strongly increased computation time.

18 CHAPTER 1 THE FINITE DIFFERENCE METHOD

Figure 1.7: Circular boundary wall, along with suggested discretised approxi-

mation.

Adaptive grid: Make the grid ner locally around difcult boundaries. This is

somewhat complicated in practice.

Improved boundary conditions: Use improved boundary conditions which

can take into account a wall placed anywhere between two adjacent nodes.

Also quite complicated.

All in all, there is no simple, good way to do this in the nite difference method.

This is one of the reasons why the nite element method has gained popularity,

since it elegantly handles complicated boundaries. We go into this method in

Chapter 3.

Also, computer hardware limits how ne you can make a grid. This limit

is quite strict in three dimensions: If you have M nodes along each edge, you

get a total of M

3

nodes. This quickly gets out of hand for larger rooms, such as

cinemas and concert halls!

If we want to be able to represent frequencies of up to 20 000 Hz, we need

a theoretical minimum spatial resolution of x = /2 = 8.5 10

3

m. As an

example, we can look at how much memory we need to be able to hold the

pressures for each node in memory if we were to solve the wave equation for

a room the size of B245. This room has dimensions 5.8 5.5 2.7m

3

, which

would require 1.4 10

8

nodes! If we use double precision variables and store

two pressures per node in memory at any time (we need p

k

and p

k1

to nd

p

k+1

), we need 16 bytes of memory per node, or 2 GB of memory in total. This

would be quite possible to handle on a normal personal computer, but since

this number scales linearly with the volume of the room, it quickly gets out of

hand for larger rooms. And the time required to do such calculations would be

formidable! Also, we havent even mentioned marine acoustics. Imagine sim-

ulating high-frequency acoustics with nite differences in the kind of spatial

scales you nd there!

For this reason, high-frequency approximations such as raytracing are used

in cases where the wavelength is small compared to the geometry of the prob-

lem. We will take a closer look at raytracing in Chapter 5.

Chapter 2

Cellular automata methods

In this chapter we will look at a number of methods which are created for

efcient implementation on computers, rather than being true to a set of dif-

ferential equations. Such methods have received some interest also in acoustic

wave propagation. These types of methods are often called cellular automata.

One example of a cellular automaton is the english mathematician John

Conways The Game of Life from 1970. It takes place on a set of cells arranged in

a two-dimensional cartesian grid, like a chess board, where each cell has eight

neighbours. One decides before the automaton starts running which cells are

to be inhabited and which are to be empty.

The state of the system develops from one time step to the next according

to the following two rules:

Birth: An empty cell becomes inhabited if it has three and only three

neighbours.

Life and death: A living cell remains alive if it has two or three living

neighbours. In any other case, it dies.

The challenge lies in nding initial populations which grow, repeat themselves

after a certain number of updates, etc. An example of a developing population

is shown in Figure 2.1.

Figure 2.1: The rst ve time steps of the development of the initial condition

known as the F-pentomino, which takes 1103 time steps to stabilise.

The Game of Life utilises two principles which are typical for cellular au-

tomata:

19

20 CHAPTER 2 CELLULAR AUTOMATA METHODS

Parallelism: All cells are updated simultaneously.

Locality: The development of a cell is only determined by cells in its

immediate vicinity.

Both principles also characterise physical processes.

This automaton showed that simple rules applied on a microscopic level

can give large macroscopic consequences, depending on the initial condition.

Populations can grow exponentially, be stable, or simply die off.

The goal is to nd a set of rules which are both parallel and local, rules

which also give a behaviour corresponding to the differential equations gov-

erning physical systems. This can be done for a lot of physical systems (see for

instance reference [2]), but can it be done for acoustics?

2.1 Lattice gases

Alattice gas automaton is one type of cellular automata. It attempts to simulate

the behaviour and interaction of many single particles in a gas in a simple

fashion as possible. Particles of equal mass move around on a regular grid at

a velocity of one grid node per time step, and may collide with each other if

several particles meet in the same node. The purpose of lattice gas automata

is to simulate the microscopic behaviour of gases through a very simple set of

rules.

2.1.1 The HPP model

The rst lattice gas model to be proposed was the HPP model. This was named

after its creators, Hardy, Pomeau, and de Pazzis, who proposed the method in

1973 [3, 4]. It is based on a two-dimensional square grid, where particles can

have one of four possible velocity vectors: East, north, west and south. In any

node, up to four particles may be present simultaneously, but they must all

have unique velocity vectors.

For each time step, two rules are applied:

Translation: All particles move fromtheir node to the neighbouring node

in the direction of their velocity vector.

Collision: If two particles meet head on after translation in a node with

no other particles present, they are thrown out at right angles.

These rules are illustrated in Figure 2.2. It is important to note that these rules

are dened so that the physical quantities of mass and momentum are pre-

served in each collision.

The particle density and total particle velocity u of particles at a node can

be found fromwhich particles are present at the node. If c

i

are the four velocity

vectors (i = 1, 2, 3, 4) and n

i

(x, t) = 0, 1 indicates the absence or presence of a

2.1 LATTICE GASES 21

t

(a) Translation rule

t

(b) Collision rule

Figure 2.2: Update rules of the HPP model.

particle with a velocity vector c

i

in the node at x at time t, the particle density

and total momentum are given by

(x, t) =

i

n

i

(x, t), (2.1)

(x, t)u(x, t) =

i

c

i

n

i

(x, t). (2.2)

In words, the density is given by the total number of particles in the node,

while the momentumis found by summing the individual momentumof every

particle in the node.

The most interesting properties of the HPP model (which are in fact shared

by all lattice gas automata) are:

Simplicity: It is extremely simple, both in concept and implementation.

Space: It requires very little memory the state of a node can be repre-

sented using 4 bits, each indicating the presence or absence of a particle.

Parallelism: It is very simple to parallelise. In principle, one can utilise

as many processors as there are nodes in the grid. This means that the

computational time required to perform a simulation decreases linearly

with the number of processors, at least to a certain point.

It is obvious that such a model does not directly describe waves. Waves

follows differential equations and not collision rules of this kind. Still, macro-

scopic quantities such as mass, momentum, and total energy are conserved.

22 CHAPTER 2 CELLULAR AUTOMATA METHODS

Due to the physically correct nature of the collisions, it was hoped that the

HPP method would give the correct macroscopic behaviour of a uid, i.e. a

behaviour corresponding with the Navier-Stokes equation, so that values of

density and particle velocity would tend to correspond to the physically cor-

rect values. If the method gave the correct uid behaviour, it would also give

correct wave behaviour since wave propagation is a property of compressible

uids.

Unfortunately, the HPP model was mathematically shown to fail due to

a lacking symmetry property of the lattice. This means that it does not give

correct Navier-Stokes behaviour, and cannot be used for simulations of uid

ow or wave propagation.

One example where it still gives reasonably correct wave behaviour is a

situation where two plane waves meet each other, as shown in Figure 2.3. The

collision rules cause the two waves to pass through each other with double

amplitude in the plane of collision.

t t

Figure 2.3: Collision of two innite plane waves in the HPP model.

2.1.2 The FHP model

The FHP model was named after Frisch, Hasslacher, and Pomeau, who pro-

posed it in 1986 [5]. It is based on the same idea as the HPP model. The main

difference lies in the lattice where the lattice is square in the HPP model, it

is hexagonal in the FHP model. This means that each particle can now have six

different possible velocities, and each node can have up to six particles with

equal mass and different velocities.

While the translation rule is unchanged from the HPP model, the collision

rules are somewhat different. In a hexagonal lattice, there are two possible res-

olutions for a head-on collision which conserve both mass and momentum. To

choose between the two, randomness is introduced. There is a 50 %probability

for each of the two possible resolutions, as shown in Figure 2.4a. There is also

a second collision rule in the FHP model called the triple collision rule, which

is shown in Figure 2.4b.

2.1 LATTICE GASES 23

p

=

0

.

5

p

=

0

.

5

t

(a) Double collision rule

t

(b) Triple collision rule

Figure 2.4: Collision rules of the FHP model.

24 CHAPTER 2 CELLULAR AUTOMATA METHODS

Unlike the HPP model, the FHP model has been shown to give behaviour

consistent with the Navier-Stokes equation [6]. It has even been used to simu-

late complex acoustic behaviour [7].

The FHP model retains all the advantages of the HPP model, with the addi-

tional advantage of actually being able to simulate real physics. Still, it suffers

under certain disadvantages inherent to lattice gas methods. Lattice gas sim-

ulations are inherently noisy, as the concentration and distribution of particles

is constantly changing.

This statistical noise is a property of real uids, not merely lattice gases.

When we interact with uids in our daily lives, we see them as continuous

and uniform. If we were able to look at the uid at size scales on the or-

der of nanometers, though, we would be able to see that the uid is neither

continuous nor uniform, as it consists of individual molecules which are con-

stantly moving around. We would be able to see that some areas of this cloud

of molecules are denser than others, as in Figure 2.5. When looking at larger

size scales, these non-uniformities even out due to the law of large numbers.

Figure 2.5: Molecules in a glass of water. When zooming in far enough, one

sees that the uid is no longer uniform.

The statistical noise in lattice gases is a desired property if the goal is to

study these uctuations, but a problem if the goal is to simulate uids on large

scales. To alleviate this problem, it was common to present results based on

space or time averages of lattice gas results, but the noise problem could never

be entirely removed.

The solution to the noise problem was to go from looking at individual par-

ticles to looking at particle distributions indicating the concentration of parti-

cles. This was the idea behind the lattice Boltzmann method, which we will

now look into.

2.2 The lattice Boltzmann method

The lattice Boltzmann method was rst proposed in 1988 by McNamara and

Zanetti [8]. It is a change from the microscopic scope of lattice gases, where

one tracked the movement of individual particles, to a larger, mesoscopic scope,

2.2 THE LATTICE BOLTZMANN METHOD 25

where one tracks the movement of distributions of particles. These distributions

can be seen as averages of a large number of individual particles.

In the lattice Boltzmann method, each node in the grid has several different

variables associated with it, f

i

(x, t). These variables, called distribution func-

tions, represent the density of particles travelling in direction c

i

at the node

with position x at time t. In the most commonly used two-dimensional lat-

tice, the grid is square and there are nine different velocity vectors c

i

, shown in

Figure 2.6.

c

1

c

2

c

3

c

4

c

5

c

6

c

7

c

8

c

0

Figure 2.6: The most common two-dimensional set of lattice vectors in the

lattice Boltzmann method. c

0

= (0, 0) is a rest vector.

The macroscopic quantities of particle density (x, t) and particle velocity

u(x, t) at the node can be recovered from f

i

(x, t) through the relations

(x, t) =

i

f

i

(x, t), (2.3)

(x, t)u(x, t) =

i

c

i

f

i

(x, t). (2.4)

If there were no collisions between particles, we could mathematically for-

mulate the streaming of particles through the grid as

f

i

(x +c

i

, t +t) = f

i

(x, t).

This is a simple translation rule, like the translation rule of the lattice gas au-

tomata. Now, collisions between particles can be included as a disturbance

from this pure translation,

f

i

(x +c

i

, t +t) = f

i

(x, t) +

i

(x, t). (2.5)

We call

i

(x, t) the collision operator, which can take many forms. (From here

on, well drop the (x, t) parenthesis and consider it implicit.) One important

restriction on it is that it must preserve the total mass and the total momentum

in the node. In the early days of the lattice Boltzmann method, this collision

operator was based on the collision methods of lattice gas automata. In recent

years, the most popular form of the collision operator has been the so-called

26 CHAPTER 2 CELLULAR AUTOMATA METHODS

BGK operator,

i

=

1

_

f

i

f

eq

i

_

, (2.6)

where is a relaxation time and f

eq

i

is an equilibrium distribution analogous

to the Maxwell-Boltzmann distribution.

f

i

(x +c

i

, t +t) =

_

1

1

_

f

i

+

1

f

eq

i

. (2.7)

This represents a relaxation of the current particle distribution f

i

to the equi-

librium particle distribution f

eq

i

.

The equilibriumdistribution is in each time step constructed fromthe nodes

particle density and particle velocity from before the collision,

f

eq

i

= t

i

_

1 +

u c

i

c

2

s

+

(u c

i

)

2

2c

4

s

u

2

2c

2

s

_

. (2.8)

c

s

is the speed of sound in the lattice Boltzmann method, which for the set of

lattice vectors shown in Figure 2.6 is c

s

= x/(t

3). t

i

is a set of weightings,

one for each type of lattice vector. For the lattice vectors shown in Figure 2.6,

t

0

= 4/9, t

i

= 1/9 for i = 1, 2, 3, 4, and t

i

= 1/36 for i = 5, 6, 7, 8.

To summarise, updating the state of the system from one time step to the

next is done through the following steps:

1. Macroscopic quantities: From the current distribution of particles, cal-

culate the macroscopic quantities and u from equations 2.3 and 2.4.

2. Equilibrium: Calculate the equilibrium distribution f

eq

i

for each node

from the nodes macroscopic variables and u using equation 2.8.

3. Collision: Calculate the post-collision distribution of particles for all uid

nodes, given by the right side of equation 2.7.

4. Streaming: Move particles one step in the direction of their velocity, com-

pleting equation 2.7.

The lattice Boltzmann method has been mathematically shown to give a

behaviour consistent with the compressible Navier-Stokes equation as long as

u/c

s

< 0.1. The simulated uid has a kinematic shear viscosity

of

= c

2

s

_

1

2

_

t, (2.9)

and a kinematic bulk viscosity of

=

2

3

. (2.10)

The Maxwell-Boltzmann distribution describes the most probable velocity distribution of par-

ticles in a gas in equilibrium.

plane waves to be damped exponentially in space. See Chapter 8 in reference [9] for more.

2.3 THE TRANSMISSION LINE MATRIX (TLM) METHOD 27

The viscosity can in principle be made arbitrarily low by letting 1/2, but

this has a negative impact on the accuracy and stability of the method.

The lattice Boltzmann has shown itself to be capable of simulating wave

propagation [10, 11]. As an example, gure 2.7 shows the result of a simulation

of double-slit diffraction of an acoustic plane wave.

40 60 80 100

20

40

60

80

100

120

140

160

6

4

2

0

2

4

6

x 10

4

Figure 2.7: Double-slit diffraction simulated with the lattice Boltzmann

method. The dashed line shows the node lines, where the density is theoreti-

cally expected to be zero. Taken from ref. [11].

Unfortunately, viscosity in the model is inescapable. Thus, the lattice Boltz-

mann method is restricted to very high viscosities or very small scales in time

and space if a real material is to be simulated.

One interesting variation on the lattice Boltzmann method was published

by Chopard et al [12]. They showed that by removing the non-linear terms

in the equilibrium distribution, restricting it to a square HPP-like grid, and

choosing = 0.5, the lattice Boltzmann method reduces to the TLM method,

which we will discuss in section 2.3. This is interesting, since the TLM method

was derived independently from the lattice Boltzmann method.

For more information on the lattice Boltzmann method, see references [11,

1316].

2.3 The transmission line matrix (TLM) method

The TLM method has gained particular popularity in calculations of electro-

magnetic wave propagation, but it can also be applied to acoustics. It is based

28 CHAPTER 2 CELLULAR AUTOMATA METHODS

on Huygens principle, which states that each point on a wavefront is itself a

new source of waves. The TLM method again uses a square grid of nodes.

We can see the connections between the nodes as a grid of pipes, or acoustic

transmission lines, that each have an impedance Z

0

.

P t

P

2

P

2

P

2

P

2

Figure 2.8: Scattering of a pressure pulse in the TLM method.

2.3.1 Basic theory

Let us look at the two-dimensional example in Figure 2.8. A pressure pulse of

amplitude P enters the middle node fromthe left. The other three transmission

lines are parallel coupled at the node, so that their total impedance is Z

0

/3 [9].

The reection coefcient in the node becomes

=

Z

0

/3 Z

0

Z

0

/3 + Z

0

=

1

2

. (2.11)

The pulse to be reected back therefore has the amplitude P/2.

To know what the magnitude of the transmitted pressure pulses are, we

need to use the principles of conserved pressure and conserved energy.

Both

these quantities are preserved if the transmitted pressure pulses have ampli-

tudes of P/2. The scattering is shown graphically in Figure 2.8. This scattering

is essentially the only update rule of the basic TLM method.

If we use a similar notation as the one used for lattice gases and lattice

Boltzmann, and let f

i

in a node represent incoming pressure pulses in pipe i,

we can write outgoing pressure pulses g

i

in pipe i as

g

i

=

f

i

2

+

j=i

f

j

2

, (2.12)

or in matrix form,

_

_

g

1

g

2

g

3

g

4

_

_

=

1

2

_

_

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

_

_

_

_

f

1

f

2

f

3

f

4

_

_

.

This notation is slightly different from the one used for lattice gases and lattice Boltzmann:

Here, the different values of i correspond to pipes in the junction, not to pulse directions.

2.3 THE TRANSMISSION LINE MATRIX (TLM) METHOD 29

These pressure pulses are transmitted directly on to the neighbouring nodes.

It can be shown [17] that the speed of sound in the TLM method is given by

c =

1

2

x

t

, (2.13)

where as usual, x is the space resolution and t is the time resolution. This

equation relates x and t through the desired physical speed of sound.

One problem with the TLM method is related to propagation direction.

Since the energy quanta can only move along the main axes of the grid, a wave

propagating along an axis may move more quickly than a wave moving along

a diagonal. It can be argued that this problem is frequency dependent, and is

negligible for cases where the wavelength is large compared to the cell length.

2.3.2 Sound sources and walls

It is possible to implement sound sources in the TLM method as nodes where

sound pulses constantly appear with amplitudes given by some time-dependent

function. For instance, if we wish that a node should radiate a single-frequency

wave with period T, equation 2.12 is modied to

g

i

= Asin

_

2

T

kt

_

f

i

2

+

j=i

f

j

2

, (2.14)

where A is the amplitude of the sound source and k is the time step.

P t RP

Figure 2.9: Reection at a wall node with reection coefcient R. (The effective

position of the wall is indicated as a grey rectangle.)

One of the strengths of the TLM method is that walls with arbitrary real

reection coefcient R are very simple to implement. Certain nodes can be set

as wall nodes, and these reect back incoming pulses as shown in Figure 2.9.

A pulse moves one grid space for each time step. Since a reected pulse

reappears in the same node as it left, we can look at it as having been reected

halfway, so that its total moved distance is one grid space. Therefore, we can

see that the effective wall position is halfway between the wall nodes and the

neighbouring nodes. This is also indicated in Figure 2.9.

30 CHAPTER 2 CELLULAR AUTOMATA METHODS

It is also possible to implement open boundaries in the method, which do

not reect waves. These are useful as edges of an open domain. We will not go

into the theory of these boundaries here, but instead refer to Kagawa et al. [17]

2.3.3 Further TLM topics

Figure 2.10 shows snapshots in time of the result of a simulation where a wave

is diffracted by a screen. Notice how diffraction phenomena can be modelled

with the TLM method, and how other expected wave phenomena, such as

near-standing waves in front of the screen, are present. Notice also how the

wavefronts in the second gure are smooth and circular, indicating that there

are enough cells per wavelength for the wave propagation to be independent

of angle.

It is worth mentioning that a MATLAB program called TLMg was written

some years ago by the acoustics group at NTNU to perform two-dimensional

TLM simulations of acoustics.

For further information on the TLM method, see references [1719].

2.4 Summary

The methods we have looked into in this chapter share the common property

that they all consist of small computations which are performed simultane-

ously for every node in the grid. This means that the algorithms may be com-

puted on massively parallel processors such as graphics cards. Although it is

not obvious by looking at them, some of these algorithms will give a large-

scale behaviour in accordance with the wave equation, making it possible to

simulate acoustics.

The original lattice gas automaton, the HPP model, turned out to be useless

since it did not actually simulate anything physical. Its successor, the FHP

model, improved upon HPP so that it could be used to simulate uids. Still, all

lattice gases have the weakness that they track individual particles, and they

are thus troubled by statistical noise.

The lattice Boltzmann method was invented to x the problems inherent

in the lattice gas automata, which it does quite well. Since it gives behaviour

consistent with the Navier-Stokes equation, which describes uid ow, it is

widely used in uid simulations. Since the wave equation is a special case of

Navier-Stokes, it can simulate sound propagation also. But the method is not

very useful in linear acoustics, since it becomes unstable and inaccurate when

viscosity is reduced. It seems more well-suited for simulating the complex

interaction between acoustic elds and uid ows, i.e. aeroacoustics.

Finally, we looked at the TLM method, which probably is the most gen-

erally useful method in this chapter. It has all the advantages of the lattice

Boltzmann method, but it is simpler and has none of the disadvantages as

long as one is only interested in simulating linear acoustics. It gives behaviour

2.4 SUMMARY 31

Figure 2.10: Diffraction study with the TLM method. (H. Solvik, 1998)

32 CHAPTER 2 CELLULAR AUTOMATA METHODS

in accordance only with the wave equation, so any interaction between uid

ows and acoustic elds is impossible to simulate with the TLM method. But

then again, this is usually not very interesting in most acoustic cases.

Chapter 3

The nite element method

The nite element method is reminiscent of the nite difference method, but

the approach is somewhat different. In both methods, we divide a domain

into pieces and attempt to nd the solution of an equation at the corners of

these pieces. In the nite difference method, the domain is divided into pieces

by a regular grid. In the nite element method, these pieces, called elements,

may be created by an irregular mesh. The elements may have many kinds of

shapes, but very simple shapes such as triangles and quadrilaterals are com-

monly used.

The fact that the mesh may be irregular makes it possible to adapt the mesh

to complex boundaries, and to make the mesh ner in some parts of the do-

main than in others. This allows us to prioritize parts of the domain where we

need the solution to be more accurate.

This added freedom in choosing where we want our nodes comes at a cost:

The nite element method is signicantly more mathematically complicated

than the nite difference method. The road from an partial differential equa-

tion to a solvable system of linear equations is also longer and tougher.

Due to this extra complexity, we will not go as deeply in this chapter as we

did in Chapter 1. After going through the basics of the nite element method,

we will go through a simplied 1D example of the Helmholtz equation and

then nd a general solution method for higher dimensions. This chapter at-

tempts to give a better understanding of the nite element method, but will not

teach everything which is required to make a general nite element method

solver. In most cases, nding nite element solutions is better left to ready-

made software packages such as the ones in listed in reference [20].

3.1 Finite elements

In the nite element method, a domain (a line segment in 1D, an area in 2D, or

a volume in 3D) is divided into small pieces, called elements, which may vary

33

34 CHAPTER 3 THE FINITE ELEMENT METHOD

in alignment and size. In 1D, an element is a line segment. In 2D, an element

is some sort of polygon which can be used to tile the entire domain, such as

a triangle or quadrilateral (see Figure 3.1). In 3D, it could be any polyhedron

which can be used to tile the entire space, such as a parallelepiped.

The corners of these elements are known as nodes. In acoustics, we usually

attempt to compute a single variable in each node, namely the acoustic pres-

sure. When node values are known, the pressure values in the space between

the nodes can be interpolated using basis functions. There are several types of

basis functions, but we will mostly look at linear basis functions to keep our

discussion as simple as possible.

x

y

(a) Quadrilateral meshing

x

y

(b) Triangular meshing

Figure 3.1: A division into elements, or meshing, of a two-dimensional domain.

x

y

1 2

3 4

a

b

Figure 3.2: The nodes of a single rectangular element.

Figure 3.1 shows an example where a two-dimensional area has been di-

vided into elements, and Figure 3.2 shows a rectangular element in detail. We

use this element to illustrate the idea of basis functions. Lets say we have one

constant pressure value for each node: p

1

, p

2

, p

3

, and p

4

. Within this element,

3.1 FINITE ELEMENTS 35

we describe the pressure as

p(x, y) = N

1

(x, y)p

1

+ N

2

(x, y)p

2

+ N

3

(x, y)p

3

+ N

4

(x, y)p

4

, (3.1)

where N

i

(x, y) is the basis function belonging to node i. In this element, we

have chosen basis functions which are linear in both x and y direction,

N

1

(x, y) =

_

1

x

a

_ _

1

y

b

_

, (3.2a)

N

2

(x, y) =

x

a

_

1

y

b

_

, (3.2b)

N

3

(x, y) =

x

a

y

b

, (3.2c)

N

4

(x, y) =

_

1

x

a

_

y

b

, (3.2d)

for 0 x a,

0 y b.

In matrix form, we write this as

p(x, y) =

_

N

1

(x, y) N

2

(x, y) N

3

(x, y) N

4

(x, y)

_

p

1

p

2

p

3

p

4

_

_

, (3.3)

or

p(x, y) = N(x, y) p, (3.4)

Essentially, this means that we are estimating p(x, y) as a weighted average of

the node values, where the weighting depends on the distance to the nodes.

Here, we have used basis functions which are dened only inside the element,

and which are zero outside it.

The basis functions have two important requirements:

If we evaluate the basis functions in node i, we must have that N

i

(x

i

, y

i

) =

1 while N

j=i

(x

i

, y

i

) = 0, so that p(x

i

, y

i

) = p

i

.

i

N

i

= 1 everywhere inside the element.

In this example, the basis functions are specially designed for this particular

element. This will be impractical in the general case, where elements will not

have convenient shapes or positions. We need basis functions which can be

easily used for all elements the entire domain. In section 3.4.1, we will see how

this can be done through transformations to local coordinate systems.

Through considering basis functions as local for an element (i.e. as zero

outside the element), equation 3.4 can be valid for each element in the entire

domain of interest. By including all the elements in our geometry and con-

sidering the differential equations in question, we wish to reach a system of

simultaneous algebraic equations in all the unknown node values p

i

in the do-

main. We will then be able to solve this system to nd the values p

i

which give

a pressure eld which solves the differential equation in question.

36 CHAPTER 3 THE FINITE ELEMENT METHOD

3.1.1 Global and local basis functions

In the previous section, we considered the basis functions to be dened only

locally, inside the element, so that they were zero everywhere outside it. It is

also possible to look at the basis functions in a different way that they are

dened globally, so that a basis function is nonzero in all elements that border

the node that it belongs to. This is illustrated in Figure 3.3.

N

i

(x, y)

x

i

Figure 3.3: A global linear basis function on regular triangular elements be-

comes a pyramid with a hexagonal base.

To further illustrate the idea of global basis functions, we look at howan ar-

bitrary function (x) can be approximated within a one-dimensional domain

= [0, L]. We divide into M different non-overlapping areas our ele-

ments. These are bordered by M +1 nodes at x

0

, x

1

, . . . , x

M

. This is shown in

Figure 3.4.

We wish to construct a piecewise linear function

(x), using node values

(x

i

) =

i

and the basis functions N

i

(x). We can look at N

i

(x) as global hat

functions, illustrated in Figure 3.4 and given mathematically by

N

i

(x) =

_

_

xx

i1

x

i

x

i1

for x

i1

x x

i

,

x

i+1

x

x

i+1

x

i

for x

i

x x

i+1

,

0 otherwise and outside .

(3.5)

The function

(x) is constructed from N

i

(x) and

i

as

(x) =

i

N

i

(x) in . (3.6)

If we wish

(x) to be an estimate of (x), we somehow need to nd the opti-

mal node values

i

so that the deviation between (x) and

(x) is as small as

possible.

3.1 FINITE ELEMENTS 37

x

x

0

x

1

x

2

x

i1

x

i

x

i+1

x

M1

x

M

0 L

N

i1

N

i

N

i+1

Global basis

functions

N

i

N

i+1

x

i

x

i+1

Local basis

functions

(x)

(x)

Figure 3.4: Approximation of a one-dimensional function through linear basis

functions.

38 CHAPTER 3 THE FINITE ELEMENT METHOD

There are many possible ways to measure the deviation between (x) and

(x). Maybe we want the deviation to be very small at certain points in the

domain, at the cost of having a higher deviation elsewhere. The estimation

becomes even more problematic if (x) is actually not a known function, but

for instance the exact solution to some partial differential equation. We will

look into these subjects in the following sections.

We will see later that we will need to calculate integrals over the entire do-

main, integrals which include these basis functions. If we have global basis

functions, we can integrate directly over the entire domain. If the basis func-

tions are local, we divide the integral over the domain into the sum of integrals

over all the elements. In practice, the last method is the most common, since

global basis functions become tricky to handle in two and three dimensions.

3.2 The weighted residual method

The Helmholtz equation can be written as

_

2

+ k

2

_

p(x) = D

H

p(x) = 0, (3.7)

where D

H

is the Helmholtz operator, D

H

=

2

+ k

2

.

We now insert the approximated pressure, p(x) (N(x) p).

Since this is

only approximately correct, we get a small error, which we call the residual, on

the right-hand side,

D

H

(N(x) p) = R(x). (3.8)

We wish to nd a system of equations which can be solved to give the set of

node values p

i

which minimises this residual.

As the rst step in nding this system of equations, we integrate equation

3.8 over the entire domain, giving

_

D

H

(N(x) p)d =

_

R(x)d. (3.9)

We still want to minimise the right-hand side of this equation, which now de-

scribes the average of the residual over the entire domain. Unfortunately, we

have now lost the ability to distinguish between node values p which give a

good solution (i.e. a small residual) everywhere and values which give large

residuals which cancel each other when averaged over the entire domain.

On the other hand, if we had multiplied equation 3.8 with some local weight-

ing function W(x) which is nonzero in only a small region of the domain, we

2

in the Helmholtz operator destroys any linear functions. This

means that we have a problem applying this operator on the linear basis functions described in

section 3.1. We will see in section 3.3 that the solution lies not in using non-linear basis functions,

but in changing the form of the Helmholtz operator so there is no second derivative. For now, we

will pretend that there is no problem, in order to make the following discussion simpler.

3.2 THE WEIGHTED RESIDUAL METHOD 39

would have found

_

W(x)D

H

(N(x) p)d =

_

W(x)R(x)d. (3.10)

If we can nd a set of node values which give us a zero right-hand side in this

equation, we know that R(x) is small in the small area where W(x) is nonzero.

Unfortunately, this only tells us that the solution is good in a small area,

so that the solution might still be bad elsewhere in the domain. We solve this

problem by using many weighting functions instead of just one. Instead of

using a single weighting function W(x), we use a vector W(x) where each

vector element is a different weighting function, W

i

(x). This set of weighting

functions should ideally cover the entire domain. Setting the equation to zero,

we get

_

W(x)D

H

(N(x) p)d =

_

W(x)R(x)d = 0. (3.11)

This represents a system of equations, where each row in the vector gives

us a single equation,

_

W

i

(x)D

H

(N(x) p)d = 0.

We will generally want to have a number of equations equal to the number of

unknowns, so that the system of equations can be solved exactly. This means

that we need to use as many weighting functions W

i

(x) as there are unknown

node values p

i

.

Many different types of weighting functions can be used, and we will go

into some of these.

3.2.1 Subdomain collocation

Here, the domain is divided into subdomains

i

, which might for instance

correspond to elements. The vector W(x) must then consist of vector elements

W

i

(x) =

_

1 for x in

i

,

0 for x not in

i

.

(3.12)

With this weighting function, we are trying to nd a node pressure vector p

which gives a minimum residual R(x) inside each subdomain

i

.

3.2.2 Point collocation

For this type of weighting function, each vector element W

i

(x) in W(x) is given

by

W

i

(x) = (x y

i

), (3.13)

where (x) is the Dirac delta function.

40 CHAPTER 3 THE FINITE ELEMENT METHOD

When using this weighting function we are trying to nd a node pressure

vector p which gives a minimum value of D

H

(N(x) p) at certain points in

space, y

i

. In practice, the number of such points is generally much larger than

the number of unknowns. This gives an overdetermined system of equations,

which can be approximately solved by a method of least squares.

3.2.3 Galerkins method

This is the most commonly used method. We choose to use the basis functions

themselves as weighting functions, i.e.

W

i

(x) = N

i

(x). (3.14)

Thus, with Galerkins method, equation 3.11 becomes

_

N(x)D

H

(N(x) p)d = 0. (3.15)

Generally, if we have three vectors a, b, and c, where b and c have the same

number of elements, it can be shown that

a(b c) = (a b)c,

where a b indicates the outer product of a and b.

equation 3.15 into

_

N(x) D

H

N(x)dp = 0. (3.16)

We have put the node pressure vector outside the integral, as it is not a function

of space. Notice how the integrations are now only performed over the basis

functions.

3.3 Galerkin solution of the Helmholtz equation

One characteristic property of the nite element method is that quite a few

derivations must be gone through before one nds a systemof equations which

can be solved directly on a computer. We will therefore restrict ourselves to the

Helmholtz equation.

We will rst show how to solve this equation in a simple one-dimensional

system, ending up with a matrix equation which can be solved directly. We

will then indicate how the derivation is performed in higher dimensions.

The outer product is the product of a column vector and a rowvector which results in a matrix,

i.e.

a b =

_

a

1

a

2

_

_

b

1

b

2

=

_

a

1

b

1

a

1

b

2

a

2

b

1

a

2

b

2

_

.

In both cases, the ith component of the resulting vector becomes

{a(b c)}

i

= {(a b)c}

i

=

j

a

i

b

j

c

j

.

3.3 GALERKIN SOLUTION OF THE HELMHOLTZ EQUATION 41

3.3.1 In one dimension

First we give a detailed example of how to apply the nite element method to

a one-dimensional Helmholtz equation using Galerkins method. We solve for

the domain = [0, L], using nodes x

0

, x

1

, . . . , x

M

with an even spacing x, so

that our global basis functions become

N

i

(x) =

_

_

xx

i1

x

for x

i1

x x

i

,

x

i+1

x

x

for x

i

x x

i+1

,

0 otherwise and outside .

(3.17)

We will solve the equation with a open-end boundary condition p

0

= 0 at one

end and a given velocity boundary condition u

M

at the other.

x x

0

0

x

1

x

i

x

M1

x

M

L

N

0

N

1

N

i

N

M1

N

M

Figure 3.5: Global linear basis functions for a one-dimensional systembetween

x = 0 and x = L.

Equation 3.16 equates one vector on the left side with another on the right

side, so that each element in these vectors is a single equation based around

a single weighting function. In our case, when we insert for the Helmholtz

operator, element i of equation 3.16 becomes

j

_

_

L

_

0

N

i

(x)

2

N

j

(x)

x

2

dx + k

2

L

_

0

N

i

(x)N

j

(x)dx

_

_

p

j

= 0. (3.18)

Since we know the pressure p

0

at x

0

, we have one unknown less. To compen-

sate, we remove the corresponding weighting function, so that we still have

the same number of equations and unknowns. In other words, we remove the

i = 0 case and let 1 i M, while we still have that 0 j M.

We will now resolve the problem that was alluded to earlier that the

second derivative in the Helmholtz equation destroys linear basis functions.

We resolve this by performing a partial integration of the rst integral,

L

_

0

N

i

(x)

2

N

j

(x)

x

2

dx =

_

N

i

(x)

N

j

(x)

x

_

L

0

L

_

0

N

i

(x)

x

N

j

(x)

x

dx.

There are now only rst derivatives on the right side of this equation, which

means that it is now possible to use linear basis functions.

This works well, but is not exactly mathematically rigorous if the basis functions are linear,

42 CHAPTER 3 THE FINITE ELEMENT METHOD

The rst term on the left side is

_

N

i

(x)

N

j

(x)

x

_

L

0

= N

i

(L)

N

j

(L)

x

N

i

(0)

N

j

(0)

x

We have that N

i

(0) = 0 only for the i = 0 case, which we have removed. Thus,

the last term falls away. Also, the rst term is only nonzero for i = M, where

N

M

(L) = 1. When we multiply it with p

j

as in equation 3.18 and apply the

Eulers equation,

it becomes

j

N

i

(L)

x

N

j

(L)p

j

N

i

(L)

p(L)

x

= jN

i

(L)u

M

.

We can use these results to rewrite equation 3.18 as

j

_

_

L

_

0

N

i

(x)

x

N

j

(x)

x

dx + k

2

L

_

0

N

i

(x)N

j

(x)dx

_

_

p

j

= jN

i

(L)u

M

. (3.19)

Since the integrals on the left side is performed only over the basis functions,

we can insert the basis function expressions from equation 3.17 and integrate

directly. It can easily be shown that the integrals become

L

_

0

N

i

(x)

x

N

j

(x)

x

dx =

_

_

1

x

for j = i 1,

2

x

for j = i,

1

x

for j = i +1,

0 otherwise,

L

_

0

N

i

(x)N

j

(x)dx =

_

_

1

6

x for j = i 1,

4

6

x for j = i,

1

6

x for j = i +1,

0 otherwise.

These integrals are zero unless the basis functions are neighbours, since only

neighbouring basis functions overlap at all.

As we can see in Figure 3.5, the basis functions at the end are one-sided.

This means that the values of the integrals are halved for j = i = 0 or j = i =

M, so that we get respective integral values of

1

x

and

2

6

x in these cases.

Thus, equation 3.19 becomes

_

1

x

+

k

2

6

x

_

p

i1

+

_

2

x

+

4k

2

6

x

_

p

i

+

_

1

x

+

k

2

6

x

_

p

i+1

= 0

for 1 i M1

(3.20)

the left side is zero while the right-side is non-zero. We could have found the same result in a more

rigorous manner, but then the derivation would become even more complicated and confusing.

p(L)

x

= ju(L).

3.3 GALERKIN SOLUTION OF THE HELMHOLTZ EQUATION 43

and

_

1

x

+

k

2

6

x

_

p

i1

+

_

1

x

+

2k

2

6

x

_

p

i

= ju

M

for i = M

(3.21)

Using our knowledge that p

0

= 0, we write this in matrix form as

_

_

_

_

_

_

1

x

_

_

2 1

1 2 1

.

.

.

1 2 1

1 1

_

_

+

k

2

x

6

_

_

4 1

1 4 1

.

.

.

1 4 1

1 2

_

_

_

_

_

_

_

_

_

_

p

1

p

2

.

.

.

p

M1

p

M

_

_

=

_

_

0

0

.

.

.

0

ju

M

_

_

.

(3.22)

This matrix system can be solved directly on a computer by inversion. Note

that the problem we solve here is the exact same problem as we solved by

the nite difference method in equation 1.22. There are marked similarities

between the matrix systems, which is only reasonable since both solve the same

problem.

We have now seen how different types of boundary conditions are handled

in the Galerkin nite element method. Constant-value (Dirichlet) boundaries,

such as the open end, are handled by removing their corresponding weighting

function, while derivative-value (Neumann) boundaries, such as the velocity

boundary, are handled through the partial integration.

3.3.2 In higher dimensions: General solution

It is also possible to do a more general derivation which works for problems in

higher dimensions than one. We will now perform this for a general domain

, with impedance boundary conditions along its boundary .

_

N(x)

2

N(x)dp + k

2

_

To avoid our notation becoming long and messy, we will drop (x) and consider

it implicit from now.

In the rst integral in this equation, we integrate over matrix elements of

the form N

i

2

N

j

. Using a vector differential identity,

For example, is the curve containing the area in 2D, or the surface containing the volume

in 3D.

(F) = () F + ( F).

We can nd by associating the arbitrary scalar with N

i

and the arbitrary vector F with N

j

that

N

i

2

N

j

= (N

i

) (N

j

) + (N

i

N

j

).

44 CHAPTER 3 THE FINITE ELEMENT METHOD

integral as

_

N

i

2

N

j

d =

_

(N

i

) (N

j

)d+

_

(N

i

N

j

)d.

Using the divergence theorem,

this becomes

_

N

i

2

N

j

d =

_

(N

i

) (N

j

)d+

_

N

i

(N

j

n

)d,

where is the boundary of and n

d. By doing this, we have changed the differential terms in the integration

to a lower order, enabling use of the simpler linear basis functions. This is

equivalent to the partial integration we did for the one-dimensional case. (In

fact, the divergence theorem is a generalisation of partial integration!)

Similarly to the one-dimensional case, we apply the matrix in the last term

to the vector p and use the linear Eulers equation to nd

j

_

N

i

_

N

j

p

j

n

_

d

_

N

i

(p(x) n

) d = j

_

N

i

u

n

(x)d,

where u

n

is the normal velocity on . If we now dene a boundary admittance

A as the reciprocal of the impedance, i.e. A = u

n

/p, this becomes

j

_

N

i

u

n

(x)d = j

_

AN

i

p(x)d j

j

_

AN

i

N

j

dp

j

.

We may now use these results to rewrite equation 3.23 as

NNdp + k

2

_

NNdp j

_

ANNdp = 0. (3.24)

This is essentially what we were looking for: A general nite element formu-

lation of the Helmholtz equation which may be solved with an appropriate

meshing of the domain and an appropriate selection of basis functions.

3.3.3 General boundary conditions

Together with the general solution in equation 3.24, we need to specify bound-

ary conditions for the outer edges of the domain. These are specied through

the admittance A, which was introduced earlier. If we have different values of

the admittance on different parts of the boundary, we can split the boundary

integral into a sum of several integrals.

Among different types of admittance boundary conditions, we have:

_

Fd =

_

F n

d,

where is a domain, is the boundary of the domain, and n

of .

3.4 DIFFERENT TYPES OF ELEMENTS 45

Hard surface: u

n

= 0, so that A = 0.

Constant velocity: u

n

= U

0

, so that A = U

0

/p.

Plane waves: A = 1/c.

1

, A

1

= U

0

/p

A

0

= 0

2

, A

2

= 1/c

Figure 3.6: Boundary geometry of a bafed piston system.

1

represents

the piston of constant velocity amplitude U

0

, while

2

represents a boundary

where we expect nearly plane wavefronts. On the hard wall, u

n

= 0 so that

A = 0.

As an example, Figure 3.6 shows the geometry of a bafed piston system

(i.e. a surface of constant velocity set in a hard wall). For this system, equation

3.24 becomes

NNdp + k

2

_

NNdp

jU

0

_

1

Nd

1

jk

_

2

NNd

2

p = 0.

(3.25)

Note how the boundary integral over the hard wall disappears due to A being

zero on the wall.

Constant-value boundary conditions (i.e. open ends of a pipe) are imple-

mented as for the one-dimensional case. Since the pressure nodes values are

known along the boundary, their corresponding weighting functions should

be removed to ensure the same number of equations and unknowns.

3.4 Dierent types of elements

We will now look at a few special types of elements which are useful in differ-

ent circumstances.

46 CHAPTER 3 THE FINITE ELEMENT METHOD

3.4.1 Isoparametric elements

This type of element is widely used, as it is suitable for irregular element

shapes, and has advantages related to the numerical integration of the element

matrices. We wish to place the element arbitrarily with regard to the coordinate

system, and place the nodes where it is appropriate. This leads to a distortion

of the element. We will conduct this discussion for two-dimensional quadri-

lateral elements, but the method is equally applicable in other dimensions and

for other shapes.

We introduce a local coordinate system in the variables and , which are

dened for

1 , 1.

For a four-node element, linear basis functions will be given by

N

1

(, ) =

1

4

(1 )(1 ), (3.26a)

N

2

(, ) =

1

4

(1 )(1 + ), (3.26b)

N

3

(, ) =

1

4

(1 + )(1 + ), (3.26c)

N

4

(, ) =

1

4

(1 + )(1 ). (3.26d)

x

y

1

2

3

4

1 1

1

1 1

2 3

4

Figure 3.7: Transformation between a complex element in the xy plane and a

simple element in the plane.

This element is transformed to an element in the (x, y) plane, where the

nodes are placed in given points (x

i

, y

i

). The transformation is done simply by

using the same transformations as for the pressure interpolation,

x = N

1

x

1

+ N

2

x

2

+ N

3

x

3

+ N

4

x

4

, (3.27a)

y = N

1

y

1

+ N

2

y

2

+ N

3

y

3

+ N

4

y

4

. (3.27b)

3.4 DIFFERENT TYPES OF ELEMENTS 47

For the matrix integrations, we need terms of the type N

i

/x and N

i

/y.

From the chain rule of partial derivatives, we have that

N

i

=

N

i

x

x

+

N

i

y

y

,

so that

_

N

i

N

i

_

=

_

x

_ _

N

i

x

N

i

y

_

= J

_

N

i

x

N

i

y

_

.

J is known as the Jacobian matrix, and can be evaluated from the interpolation

expressions in equation 3.27. From this, we have that

N

i

(x, y) =

_

N

i

x

N

i

y

_

= J

1

_

N

i

N

i

_

= J

1

N

i

(, ). (3.28)

When performing a coordinate transformation in an area integral, one must

relate the two innitesimal areas through the determinant of the Jacobian ma-

trix,

dxdy = |J|dd.

Thus, our integrals over individual elements

k

may be transformed:

_

k

N

i

(x, y)N

j

(x, y)dxdy =

1

_

1

1

_

1

N

i

(, )N

j

(, )|J|dd, (3.29a)

_

k

[N

i

(x, y)] [N

j

(x, y)]dxdy =

1

_

1

1

_

1

[J

1

N

i

(, )] [J

1

N

j

(, )]|J|dd.

(3.29b)

While N

i

(, ) does not change between elements, J changes both between

elements and during the integration. These integrals are most commonly solved

numerically.

3.4.2 One-dimensional pipe elements

For pipe systems where the wave propagation is mainly one-dimensional but

where continuous or instantaneous changes in cross-section are important, for

instance music instruments, mufers, etc., special pipe elements have been de-

veloped.

We reformulate the innitesimal volume element d as A(x)dx. We can

insert this into the Galerkins method formulation, equation 3.16. Assuming

that the area varies slowly, it is possible to derive a nite element formulation

for these pipe elements,

j

_

_

L

_

0

N

i

x

N

j

x

A(x)dx + k

2

L

_

0

N

i

N

j

A(x)dx +

_

N

i

N

j

x

A(x)

_

L

0

_

_

p

j

= 0.

(3.30)

48 CHAPTER 3 THE FINITE ELEMENT METHOD

i i +1

A

i

A

i+1

Figure 3.8: A simple conical pipe element.

The area A(x) can be expressed through values A

i

for the area at nodes and

the basis functions,

A(x) = N

i

A

i

+ N

i+1

A

i+1

in

i

. (3.31)

As in reference [21], we assume that the area A(x) has a linear variation, like

the pressure.

3.4.3 Innite Bettess elements

In addition to the common nite elements, element types which extend to

innity have been developed. The rst element type of this kind was pro-

posed by Peter Bettess in 1977 [22], although it was not specically designed

for acoustics. The elements are based on standard one-dimensional basis func-

tions given by Lagrange polynomials,

N

i

(x) =

n

j=1,j=i

x

j

x

x

j

x

i

for i = 1, 2, . . . , n,

where i and j are nodes in an element with n nodes. The innite elements were

formulated by using the same basis functions multiplied with an exponential

decay,

N

i

(x) = e

(x

i

x)/L

n1

j=1,j=i

x

j

x

x

j

x

i

for i = 1, 2, . . . , n. (3.32)

Note how the j = n term is not used, as it is assumed that x

n

= . If N

n

is

required, it can be found from

N

n

= 1

n1

i=1

N

i

. (3.33)

The element type was developed further by including a wave factor,

N

i

(x) = e

(x

i

x)/L

e

jkx

n1

j=1,j=i

x

j

x

x

j

x

i

for i = 1, 2, . . . , n. (3.34)

3.5 SUMMARY 49

3.4.4 Wave envelope elements

A more recent development is the wave envelope element, proposed in the

1980s by R. Astley [23, 24]. This modies other basis functions N

i

by multiply-

ing them with a wave factor, given by

N

i

= N

i

r

i

r

e

jk(rr

i

)

(3.35)

in three dimensions. This element is used in an outer region of the geometry

to simulate a wave which propagates outwards from the origin. The scaling

ensures that N

i

= N

i

for r = r

i

.

This type of elements avoids a problem with the Bettess elements that

the integration over basis functions such as the one in equation 3.34 required

integrating over trigonometric functions to innity. This is avoided with the

wave envelope elements if the weighting functions are chosen as complex con-

jugates of the basis functions, i.e.

W

i

= N

i

= N

i

r

i

r

e

+jk(rr

i

)

.

Using the Galerkin method, W

i

N

i

=

_

N

i

r

i

r

_

2

, resulting in simpler integrals.

3.5 Summary

In the nite element method, the computational domain is divided into ele-

ments with simple shapes, where each element corner is a node. The nodes

have solution values and basis functions associated with them. These basis

functions are used to interpolate the nodes values throughout the domain. In

this way, it is possible to relate the solution value at any point in the domain

with the values of surrounding nodes. The solution is found by nding the

node values which minimize the error throughout the domain.

It is natural to compare the nite element method with the nite difference

method, since both work by nding approximate solutions to partial differ-

ential equations through a discretisation process. The nite element method

avoids certain problems which the nite difference method has with complex

boundaries: Making the mesh ner and thus getting better accuracy in crit-

ical areas in the domain is theoretically straightforward in the nite element

method. It is also much simpler to implement moving boundaries, as when

simulating a car crash. The domain may be remeshed for each time step if

necessary.

On the other hand the nite element method loses to the nite difference

method in mathematical simplicity and directness. Many equations, such as

the Helmholtz equation which we have looked into, require considerable math-

ematical manipulation before a nite element method of solution can be found.

The nite element method is preferred in certain scientic elds where its

advantages are important, such as solid mechanics. In other elds, such as

uid dynamics, the nite difference method is preferred.

Chapter 4

The boundary element method

The boundary element method is a more recent method than the others. It can

be derived froman older theorem, called the Kirchhoff-Helmholtz integral the-

orem. This states that the solution of the Helmholtz equation inside a domain

may be found from an integral over the boundary of the domain. For this to

be valid, the pressure itself and its normal derivative must be known on this

boundary, and there must be no acoustic sources inside the domain itself.

In the boundary element method, the boundary is discretised into elements.

Inside each element, the pressure and its normal derivative is either assumed to

be constant or somehow interpolated. With these approximations, the integral

over the boundary is greatly simplied.

The method also goes one step further if the pressure on the surface is

unknown, it may be found if its normal derivative on the surface (which is

related to the normal velocity) is known, or vice versa. This means that we

need only know either the pressure or its normal derivative on the surface to

nd the solution inside the domain.

In this chapter, we will briey describe the basics of the boundary element

method. Not necessarily enough to write an implementation of the method,

but hopefully enough to give an understanding of how it works.

4.1 The Kirchho-Helmholtz integral theorem

We assume that we have a three-dimensional domain which is bounded by

a surface , as shown in Figure 4.1. (The formulation will be slightly different

if the problem is not three-dimensional.)

We start with Greens 2. identity, which relates two functions (y) and (y)

through a modied divergence theorem,

_

2

2

_

d =

_

n

_

d. (4.1)

50

4.1 THE KIRCHHOFF-HELMHOLTZ INTEGRAL THEOREM 51

Figure 4.1: Two examples of a domain bounded by a surface .

Here, /n = n

(y) and (y) must be twice continuously differentiable

inside .

We rewrite and as

(y) = p(y), (y) = G(y),

and let both functions be solutions of the Helmholtz equation inside . The

integrand of the volume integral then becomes

p

2

G G

2

p = k

2

pG + k

2

pG = 0,

and we are left with only the surface integral,

_

_

p

G

n

G

p

n

_

d = 0. (4.2)

Now, we assume one more thing: That the function G(y) is a Greens func-

tion, i.e. the eld around a point source placed at a point x,

G(y) =

e

jkR

R

, where R = |x y|. (4.3)

This is an entirely valid solution for the Helmholtz equation. However, it goes

to innity for y = x. At this singularity, it is not continuously differentiable,

and Greens 2. theorem, equation 4.1, is no longer valid if x is inside .

We may avoid this problem by placing a spherical surface

with radius

around x, removing this point from the domain, as shown in Figure 4.2. Thus,

G(y) becomes twice continuously differentiable inside . On the surface

,

we have that

R = ,

n

=

R

, d =

2

sin d d.

2

(y) and

2

(y) must both be continuous functions.

52 CHAPTER 4 THE BOUNDARY ELEMENT METHOD

x

(a) x inside

inside a surface

.

Since we have now redened the surface in our problem by adding

, we

will need to integrate over both and

becomes

_

_

p

G

n

G

p

n

_

d =

_

0

sin d

2

_

0

_

p

R

e

jkR

R

+

e

jkR

R

p

R

_

2

d

=

_

0

sin d

2

_

0

_

p

e

jk

_

jk +

1

_

+

e

jk

p

R

_

2

d.

If we let 0, all the O() terms in this integral disappear, e

jk

1, and

p(y) p(x). We are only left with the O(1) term,

_

_

p

G

n

G

p

n

_

d =

_

0

sin d

2

_

0

p d = 4p(x).

Thus, the integral over and

gives us

p(x) =

1

4

_

_

e

jkR

R

p

n

p

n

e

jkR

R

_

d. (4.4)

This is the Kirchhoff-Helmholtz integral theorem!

The theorem states that we may calculate the pressure p(x) anywhere in-

side the domain from the pressure p and its normal derivative p/n on the

surfaces surrounding .

For this theorem to be valid, p(x) must be twice continuously differentiable

inside the domain. This means that we cannot have sources inside ; any

sources must be enclosed within a surface so that p(x) does not have any sin-

gularities inside .

4.1 THE KIRCHHOFF-HELMHOLTZ INTEGRAL THEOREM 53

4.1.1 Free eld

So far, weve been working under the assumption that is an enclosed do-

main. It is also possible to investigate free eld problems with the Kirchhoff-

Helmholtz integral theorem, which makes it even more useful.

.

We may redene our surface again, letting

+

.

We now denote internal surfaces as , while

shell around the origin at r , as shown in Figure 4.3. The integral in equa-

tion 4.4 must therefore be performed over both and

becomes

_

_

e

jkr

r

p

n

p

n

e

jkr

r

_

d

= lim

r

_

0

sin d

2

_

0

e

jkr

r

2

_

r

_

p

r

+ jkp

_

+ p

_

r

2

d.

(4.5)

To solve this, we need to use the Sommerfeld radiation condition, which

states that we cannot have spherical waves propagating inwards from innity.

In Sommerfelds own words, [25]

the sources must be sources, not sinks of energy. The energy which

is radiated from the sources must scatter to innity; no energy may

be radiated from innity into [. . . ] the eld.

54 CHAPTER 4 THE BOUNDARY ELEMENT METHOD

Mathematically, the Sommerfeld radiation condition states that

r

_

p

r

+ jkp

_

0, p 0 when r . (4.6)

Inserting this into our integral, we nd that the entire integrand goes to zero,

so that

_

_

e

jkr

r

p

n

p

n

e

jkr

r

_

d = 0. (4.7)

This means that the Kirchhoff-Helmholtz integral theorem in equation 4.4

is equally valid both when encloses , and when is a surface inside an

innite domain .

4.2 Discretisation of the surface integral

The Kirchhoff-Helmholtz integral theorem in equation 4.4 is quite powerful,

but it is obviously difcult to calculate analytical solutions except in very sim-

ple cases. However, we may approximate by discretising the surface integral.

We split the surface into plane surface elements

i

with centers y

i

, and

assume that the pressure and normal derivative of the pressure are constant

on each element,

p(y)|

on

i

= p(y

i

) = p

i

,

p(y)

n

on

i

=

p(x

i

)

n

= q

i

.

We have also renamed the partial derivative of the pressure to q(y) for nota-

tional simplicity. Through the Eulers equation, this quantity is also related to

the normal velocity amplitude u

n

(y),

q(y) = ju

n

(y). (4.8)

For instance: On a rigid surface, we have u

n

(y) = 0, giving q(y) = 0.

Thus, the Kirchhoff-Helmholtz integral theorem becomes

p(x)

1

4

j

_

q

j

_

j

e

jkR

R

d p

j

_

n

e

jkR

R

d

_

. (4.9)

This is ne as long as we know both p

i

and q

i

on every surface element

i

.

However, it is possible to nd unknown values of p

i

from known values of q

i

or vice versa, meaning that we only need to know one to nd the other. This

is a key point in the boundary element method, and we start by evaluating the

pressure on the surface element

i

, setting p(x) = p(x

i

) = p

i

.

When placing x on , we no longer need to cover it in a full sphere to re-

move it from like we did when deriving the Kirchhoff-Helmholtz integral

theorem. Instead, it is sufcient to cover it in a hemisphere. The only dif-

ference halving the sphere in this way makes is that the factor 4 is halved,

becoming 2.

4.2 DISCRETISATION OF THE SURFACE INTEGRAL 55

Thus, equation 4.9 becomes

2p

i

+

j

p

j

_

n

e

jkR

R

d =

j

q

j

_

j

e

jkR

R

d,

or

j

p

j

_

H

ij

+2

ij

_

=

j

q

j

G

ij

,

where

H

ij

=

_

n

e

jkR

R

d and G

ij

=

_

j

e

jkR

R

d.

(4.10)

In

H

ij

and G

ij

, we integrate over functions of R. This is the distance from x

i

,

the center of the surface element

i

which we are evaluating the pressure on,

and y, a point on another surface element

j

.

While most elements of

H

ij

and G

ij

are simple in principle to calculate nu-

merically, special attention must be paid to the i = j case, where 1/R goes to

innity at y = x

i

.

The integrand in

H

ii

is

n

e

jkR

R

= n

i

_

e

jkR

R

_

.

Since R is the length of a vector pointing from the center of the plane element

i

to another point on

i

, the gradient in this equation must always lie in the

same plane as

i

. Since the normal vector n

i

is always normal to

i

, it is

perpendicular to the gradient. The dot product becomes zero, so that

H

ii

= 0.

On the other hand, the integrand in G

ii

actually goes to innity at y = x

i

.

This integral still converges to a specic value, but we will not go into how to

calculate it here.

Equation 4.10 is equivalent to the matrix equation

Hp = Gq, where H =

H+2I. (4.11)

Since all the matrix elements

H

ij

and G

ij

are nonzero, these matrices are fully

populated. Formulating the problemin this manner allows us to nd unknown

values of the pressures on the surface from known values of the normal veloc-

ities.

First, lets assume that the normal velocities, which are related to q

i

through

equation 4.8, are known on all the surface elements. We may then nd the

unknown surface pressures as p = H

1

Gq. Now we know both p

i

and q

i

on

each surface element

i

, and we may nd the pressure in the domain through

the discretised Kirchhoff-Helmholtz integral theorem in equation 4.9.

56 CHAPTER 4 THE BOUNDARY ELEMENT METHOD

Second, if we know the pressures on all the surface elements but not the

normal velocities, we may nd these as q = G

1

Hp. We may then nd use

these to nd the pressure in the domain, as in the previous case.

Third, if we know the pressures on some of the surfaces and the normal

velocities on the others, it is possible to use linear algebra methods to reformu-

late these matrices and vectors so that one vector holds all our knowns and the

other holds all our unknowns. Then, the unknowns may be found through in-

version. We will not go into any detail here beyond stating that this is possible.

4.3 Summary

In this chapter, we have seen how a solution of the Helmholtz equation may be

found inside a domain from an integral over its boundary. We have also seen

how a discretisation of this boundary allows us to nd the boundary pressure

from its normal derivative, or vice versa. This allows us to calculate the pres-

sure anywhere in the domain, simply by knowing either the pressure on the

boundary or its normal derivative.

Finding the pressure or its normal derivative from the other is done by re-

lating themthrough a systemof equations, which may be formulated in matrix

form. The two matrices relate each boundary element with every boundary el-

ement including itself, resulting in fully populated matrices. When the number

of elements grows, the storage requirements and required computational time

increase more quickly than for other methods.

This means that the boundary element method is most appropriate for

problems where we have a large volume and a small surface, for instance if

we want to examine the radiated sound eld around a loudspeaker in a free

eld.

It is also difcult to handle cases where the eld around a point source (the

Greens function) is not linear or changes through the domain. For this reason,

the BEM is not an appropriate method for nonlinear acoustics or underwater

acoustics with a varying sound speed prole.

Chapter 5

Raytracing methods

Raytracing is a method used not only in acoustics, but also in other elds such

as radio communication, optics, seismology, and computer graphics. By tak-

ing a high-frequency approximation and thus neglecting the low-frequency

phenomenon of diffraction, we may see the sound eld as being transported

along a number of rays emanating from an acoustic source. This concept may

be familiar from geometrical optics, where we track rays of light emitted by a

light source and passing through e.g. lenses, as shown in Figure 5.1.

Figure 5.1: Rays from a light source being bent by a lens.

A major advantage of the raytracing approach is that it makes it simple to

study propagation of sound in cases where the speed of sound varies through-

out the domain. In these cases, the sound path will tend to bend throughout

the domain, and the rays will bend accordingly. For this reason, raytracing is

widely used in marine and atmospheric acoustics.

Another advantage is that raytracing may be less computationally expen-

sive than the other methods for studying high-frequency sound propagation

in a large domain. For this reason, raytracing is also commonly used as a

tool for predicting the acoustic character of e.g. concert halls before these are

built. While raytracing may give somewhat erroneous results at low frequen-

cies since diffraction is neglected, the method works when the wavelengths are

much smaller than the domains geometry.

57

58 CHAPTER 5 RAYTRACING METHODS

5.1 The ray approximation

We may not always assume that the speed of sound is constant. For instance,

in marine and atmospheric acoustics, the speed of sound is a function of depth

and altitude. A general speed of sound may be written as c(x), so that the

wave equation becomes

2

p(x, t) =

1

c

2

(x)

2

p(x, t)

t

2

. (5.1)

We now assume that this equation is solved by

p(x, t) = A(x)e

j(tW(x)/c

0

)

, (5.2)

Here, c

0

is some reference speed of sound, and W(x) is called the eikonal. The

eikonal is a generalised representation of how the phase of a pressure wave

varies with position.

For instance, for a plane wave moving in x direction, the eikonal would be

simply

W(x) = x.

For a spherical wave radiating from the origin, the eikonal would be

W(x) = r.

In both cases, it is clear that the waves direction of propagation, represented

by the unit vector s, may be related to the eikonal as

s =

W

|W|

. (5.3)

We normalize by |W| here to ensure that | s| = 1 always.

If we substitute our trial solution (5.2) into the wave equation (5.1) and

apply the derivatives, we can separate the result into two equations: One for

the real part and one for the imaginary part,

Real:

2

A

A

+

2

c

2

0

W W =

2

c

2

, (5.4a)

Imaginary: 2

A

A

W +

2

W = 0. (5.4b)

This is a difcult system of equations to solve, since they include A, W, their

gradients, and their Laplacians.

We may simplify things a great deal by assuming that the frequency is very

high, i.e. . The rst term in equation 5.4a is then negligible, and the

equation may be simplied to

W W =

c

2

0

c

2

(x)

= n

2

, (5.5)

5.1 THE RAY APPROXIMATION 59

where n is the index of refraction. This equation is called the eikonal equation,

and we might have attempted to solve it to nd the eikonal W(x). This is one

possible way to calculate sound propagation in inhomogeneous media, but this

method has its own problems and is not related to raytracing, which is what

we want to be studying. More information on solving the eikonal equation

numerically may be found in e.g. reference [26].

The neglected A term is related to diffraction of the sound eld. By ne-

glecting it, we similarly neglect diffraction. This corresponds well with the

fact that we have done a high-frequency approximation, and diffraction is a

low-frequency phenomenon.

The eikonal equation implies that

|W| = n.

Combining this with equation 5.3, we nd that

W = n s. (5.6)

s

s

Figure 5.2: Two ray path unit vectors s at two different points along a ray.

Now, the main concept of raytracing is that we may see the propagation

of sound as happening along rays which start at some acoustic source and

move throughout the domain, carrying the acoustic energy with them. At ev-

ery point along the ray it is moving in s direction, as shown in Figure 5.2. This

means that the ray is bending according to how s is changing along its path.

Each ray carries a certain amount of acoustic power. The rays tend to di-

verge as they move further away from their source, so that the intensity be-

comes lower with distance. In Figure 5.3, the total power on the left side of the

gray area is equal to the total power on the right side. We know this classically

from the inverse square law intensity goes down as the surface goes up,

but their product stays constant. In the raytraing approach, we may also see

the power on both sides as being equal because the same amount of rays pass

though both surfaces. This may be derived from equation 5.4b, as in references

[9, 27].

We may also nd an expression for the ray path direction s through ds,

which is the length of an innitesimal step along the ray path, and its x, y,

60 CHAPTER 5 RAYTRACING METHODS

Figure 5.3: Since the rays are denser on the left side of the gray area, the inten-

sity is higher than on the right side. But since the same amount of rays pass

through the surface, the power is the same on both sides.

and z components dx, dy, and dz, which are shown in Figure 5.4. The ray path

direction may be expressed as

s =

dx

ds

x +

dy

ds

y +

dz

ds

z, (5.7)

where x is the unit vector in x direction, etc.

d

s

dx

dy

x

y

Figure 5.4: Innitesimal components on a ray moving in the x y plane.

We may nd the derivative along the ray of some quantity through the

derivative in the direction of the ray path,

d

ds

= s . (5.8)

To nd out how the ray bends along its path, we apply this ray path derivative

to the ray path direction itself and use equation 5.6,

d

ds

n s =

d

ds

W =

d

ds

W = ( s W) = ( s n s) = n ( s s)

= n.

(5.9)

5.2 RAYTRACING FOR MARINE AND ATMOSPHERIC ACOUSTICS 61

Thus, we see that the bending of the ray is only dependent on the gradient of

the index of refraction.

We could derive a similar equation for the behaviour of light as well. In

that case, we would have a well-dened reference speed c

0

; the speed of light

in a vacuum. In acoustics, we do not have such a well-dened reference speed,

so we may as well set c

0

= 1, so that the index of refraction becomes n = 1/c,

and equation 5.9 becomes

d

ds

s

c

=

_

1

c

_

=

1

c

2

c. (5.10)

This equation may be used to calculate how the ray path bends as it moves

through a medium with a position-dependent speed of sound. It shows us

that the ray will tend to bend away from an increase in the speed of sound.

However, we may simplify these calculations further by making assumptions

on how the speed of sound changes in the domain.

5.2 Raytracing for marine and atmospheric acoustics

In the ocean and the atmosphere, the speed of sound may be assumed to be

a function of depth or altitude only, so that c(x) = c(z). The sound speed

variations are due to variations in factors such as temperature and density in

the acoustic medium.

When the speed of sound does not depend on x or y, we can see that the

x and y components of equation 5.10 are zero. Therefore, the ray will stay

in the same vertical plane, which we may dene to be the x z plane, thus

simplifying our problem to a two-dimensional one.

A segment of a bending ray will form an arc which may be seen as part of

a circle with radius R, as shown in Figure 5.5. If the angle is dened as in the

gure, we nd

dz = sin ds, (5.11a)

dx = cos ds, (5.11b)

ds = Rd. (5.11c)

The last of these equations is found from the arc length formula.

Using equation 5.11b, the x component of equation 5.10 becomes

d

ds

_

1

c

dx

ds

_

=

d

ds

_

cos

c

_

= 0.

This means that the quantity cos (z)/c(z) is constant along the entire ray. If

we dene

0

and c

0

as the angle of the ray and the speed of sound at its starting

position, we may nd an expression similar to Snells law,

cos (z)

c(z)

=

cos

0

c

0

= . (5.12)

62 CHAPTER 5 RAYTRACING METHODS

R

d

d

s

dx

dz

x

z

Figure 5.5: A ray segment forms an arc d which is part of a circle with radius

R. The z axis is drawn downward, as common in marine acoustics.

We have here introduced the ray parameter , which is constant along the ray.

If we take the z derivative of both sides, we nd from the product rule that

d

dz

cos (z)

c(z)

= cos

d

dz

1

c

+

1

c

d

dz

cos = 0. (5.13)

From the chain rule, we have that

d

dz

cos =

d

dz

d

d

cos =

d

dz

sin ,

and from equations 5.11a and 5.11c we nd that

d

dz

=

1

Rsin

.

We may insert these into equation 5.13 to get

cos

c

2

dc

dz

sin

cRsin

= 0,

Solving this for R, we get

R(z) =

c(z)

cos (z)

1

dc(z)

dz

=

1

g(z)

. (5.14)

Here, we have introduced g(z) as a briefer notation for the sound speed gradi-

ent dc(z)/dz.

The sign of R(z) is relevant. For positive or negative R, the ray will curve in

positive or negative z direction, respectively. For instance, R would be negative

in Figure 5.5.

5.2 RAYTRACING FOR MARINE AND ATMOSPHERIC ACOUSTICS 63

From the above equation we may nd the curvature radius of the ray at

any depth or altitude z directly from the initial state of the ray (c

0

/cos

0

) and

the sound speed gradient. We may use this to trace the ray exactly in any area

where the gradient is constant. In reality however, g(z) will change smoothly

with z. To nd the ray path, we will need to start discretising.

z

0

z

1

z

2

z

3

z

4

c(z)

z

Figure 5.6: The continuous sound speed prole ( ) is discretised into a func-

tion which is piecewise linear ( ).

We assume that our acoustic medium is divided into layers of constant

sound speed gradient, as shown in Figure 5.6. The speed of sound itself be-

comes piecewise linear,

c(z) = c

i

+ g

i

(z z

i

) for z

i

z z

i+1

,

where c

i

= c(z

i

), and g

i

=

c

i+1

c

i

z

i+1

z

i

.

(5.15)

We may measure c(z

i

) in the ocean with a CTD instrument, and in the atmo-

sphere we may measure it with a weather balloon. The ray curvature in each

layer becomes

R

i

=

1

g

i

. (5.16)

Nowthat we knowthe ray curvature, we want to nd howfar in x direction

the ray travels as it passes through one layer. We want to nd the position x

i+1

,

as illustrated in Figure 5.7.

From equations 5.11b and 5.11c, we nd that

dx = Rcos d.

64 CHAPTER 5 RAYTRACING METHODS

i+1

z

i

z

i+1

x

i

x

i+1 x

z

Figure 5.7: A ray segment passing through one layer of constant sound speed

gradient.

Integrating this from one layer to the next, we nd

x

i+1

_

x

i

dx = R

i

i+1

_

i

cos d,

x

i+1

x

i

= R

i

(sin

i+1

sin

i

) . (5.17)

We may nd R

i

from equation 5.16, and we may nd

i

from equation 5.12 as

i

= cos

1

( c

i

) .

Thus, we are able to track the ray as it moves from layer to layer. When the

ray hits a surface, e.g. the water surface, the seabed, or the ground, we may

assume the reection to be specular. A at surface will not cause the ray pa-

rameter to change since cos() = cos(), but will need to be recalculated

if the surface is sloped.

Examples of raytracing results may be found for instance in Hovems book

[27].

5.3 Room acoustics

In room acoustics, raytracing is used to predict important parameters such as

impulse responses, acoustic coverage, and the directivity of received sound.

The rst article on raytracing in concert halls was published in 1968 by Krok-

stad, Strm, and Srsdal [28], who were all afliated with the Technical Uni-

versity of Norway (now NTNU) at the time.

One problemwith using raytracing for roomacoustics is the high-frequency

approximation which underlies the method. The effects of diffraction, which

is a low-frequency phenomenon, are not included in the results. However, the

low frequency content of sound matters less for the perception of sound in the

5.3 ROOM ACOUSTICS 65

room [28], so we may just accept that our results may be somewhat inaccurate

at low frequencies.

In a room, we may assume that the speed of sound is constant. From equa-

tion 5.10 we get that

d

ds

s

c

= 0.

Thus, the ray will never bend along its path. It will only change direction when

bouncing off a wall.

Figure 5.8: Some of the rays from a source which pass through a counting

sphere.

To examine the transmission of sound fromsource to a receiver in the room,

we let the source send out rays, track their path through the room, and count

how many rays pass through a counting sphere, as shown in Figure 5.8.

When a ray bounces off a surface, we decrease its energy by a factor 1 ,

where is the absorption coefcient of the surface. Thus, we may track how

the ray is losing energy as it is bouncing around the room. When the rays

energy falls below a certain threshold, we stop tracing it.

We also track how far the ray has moved as we trace it. In this way, we may

nd when the ray hits the counting sphere. By adding the energy of all rays

which hit the counting sphere within different time intervals, we may make a

histogramto estimate the impulse response between source and receiver. More

information on this may be found for instance in references [28, 29].

Figure 5.9: When a ray impinges on a diffusing wall, there is a chance that the

ray will be reected in a random direction.

66 CHAPTER 5 RAYTRACING METHODS

Some surfaces have a tendency to scatter incoming sound into other direc-

tions instead of giving specular reection. We may dene a scattering coef-

cient as the amount of energy not reected specularly. When a ray hits such

a surface, we may give it a probability of of being reected in a random di-

rection instead having a specular reection. This simulates diffusion in such a

way that we get statistically correct behaviour.

This section gives only a brief idea of some of the methods used in ray-

tracing for room acoustics. There are many alternative methods in this eld.

More information may be found in the book by Kuttruff [29], or by taking other

courses such as TT8302 Room acoustics.

5.4 Summary

Raytracing is a high-frequency approximation in which we assume that sound

propagates along rays which emanate from an acoustic source. If the speed of

sound varies throughout the domain, the rays will tend to bend towards lower

speed of sound. We may trace the movement of these rays to determine the

acoustic coverage of the domain. The more rays we trace from the source, the

more accurate our result becomes.

The method is particularly well adapted for cases where the speed of sound

varies, such as marine or atmospheric acoustics, where the speed of sound is

generally assumed to be a function of depth or height only. It is also widely

used for room acoustics, where it may be less computationally expensive than

other methods, particularly at high frequencies. Also, using raytracing gives

directional information which may be valuable for analysis and auralisation of

rooms.

One disadvantage of raytracing is that the effects of diffraction are neglected

due to the high-frequency approximation. This means that even with in-

nite computational resources, raytracing can never be completely accurate in all

cases. However, since the importance of diffraction decreases with frequency,

the potential accuracy of raytracing will increase correspondingly.

Bibliography

[1] A. C. Reynolds, Boundary conditions for the numerical solution of wave

propagation problems, Geophysics, vol. 43, no. 6, pp. 10991110, 1978.

[2] B. Chopard and M. Droz, Cellular Automata Modelling of Physical Systems.

Cambridge University Press, 1998.

[3] J. Hardy, Y. Pomeau, and O. de Pazzis, Time evolution of a two-

dimensional classical lattice system, Physical Review Letters, vol. 31, no. 5,

pp. 276279, 1973.

[4] J. Hardy, Y. Pomeau, and O. de Pazzis, Time evolution of a two-

dimensional model system. I. Invariant states and time correlation func-

tions, Journal of Mathematical Physics, vol. 14, no. 12, pp. 17461759, 1973.

[5] U. Frisch, B. Hasslacher, and Y. Pomeau, Lattice-gas automata for the

Navier-Stokes equation, Physical Review Letters, vol. 56, no. 14, pp. 1505

1508, 1986.

[6] U. Frisch, D. dHumieres, B. Hasslacher, P. Lallemand, Y. Pomeau, and J.-P.

Rivet, Lattice gas hydrodynamics in two and three dimensions, Complex

Systems, vol. 1, no. 4, pp. 649707, 1987.

[7] P. Stansell and C. A. Greated, Lattice gas automaton simulation of acous-

tic streaming in a two-dimensional pipe, Physics of Fluids, vol. 9, no. 11,

pp. 32883299, 1997.

[8] G. McNamara and G. Zanetti, Use of the Boltzmann equation to simulate

lattice-gas automata, Physical Review Letters, vol. 61, no. 20, pp. 2332

2335, 1988.

[9] L. E. Kinsler, A. R. Frey, A. B. Coppens, and J. V. Sanders, Fundamentals of

acoustics. John Wiley & Sons, 4th ed., 2000.

[10] J. M. Buick, C. A. Greated, and D. M. Campbell, Lattice BGK simulation

of sound waves, Europhysics Letters, vol. 43, no. 3, pp. 235240, 1998.

67

68

[11] E. M. Viggen, The lattice Boltzmann method with applications in acous-

tics, Masters thesis, NTNU, 2009.

[12] B. Chopard and P. O. Luthi, Lattice Boltzmann computations and appli-

cations to physics, Theoretical Computer Science, vol. 217, no. 1, pp. 115

130, 1999.

[13] D. H. Rothman and S. Zaleski, Lattice-Gas Cellular Automata: Simple Models

of Complex Hydrodynamics. Cambridge University Press, 1997.

[14] M. Sukop and D. Thorne, Lattice Boltzmann Modeling: An Introduction for

Geoscientists and Engineers. Springer, 2006.

[15] J. L att, Hydrodynamic Limit of Lattice Boltzmann Equations. PhD thesis, Uni-

versity of Geneva, 2007. Freely available online at http://lbmethod.org.

[16] S. Succi, The Lattice Boltzmann Equation for Fluid Dynamics and Beyond. Ox-

ford University Press, 2001.

[17] Y. Kagawa, T. Tsuchiya, B. Fujii, and K. Fujioka, Discrete Huygens model

approach to sound wave propagation, Journal of Sound and Vibration,

vol. 218, no. 3, pp. 419 444, 1998.

[18] Y. Kagawa, T. Tsuchiya, K. Fujioka, and M. Takeuchi, Discrete huygens

model approach to sound wave propagation - reverberation in a room,

sound source identication and tomography in time reversal, Journal of

Sound and Vibration, vol. 225, no. 1, pp. 6178, 1999.

[19] C. Christopoulos, The Transmission-Line Modeling Method: TLM. IEEE

Press, 1995.

[20] List of nite element software packages. Wikipedia article.

[21] M. J. Crocker, Handbook of Acoustics. John Wiley & Sons, 1998.

[22] P. Bettess, Innite elements, International Journal for Numerical Methods

in Engineering, vol. 11, no. 1, pp. 5364, 1977.

[23] R. Astley, Wave envelope and innite elements for acoustical radiation,

International Journal for Numerical Methods in Fluids, vol. 3, no. 5, pp. 507

526, 1983.

[24] R. Astley and W. Eversman, Finite element formulations for acoustical

radiation, Journal of Sound and Vibration, vol. 88, no. 1, pp. 4764, 1983.

[25] A. Sommerfeld, Partial Differential Equations in Physics. Academic Press,

1964.

[26] B. Engquist and O. Runborg, Computational high frequency wave prop-

agation, Acta Numerica, vol. 12, pp. 181266, 2003.

69

[27] J. M. Hovem, Marine acoustics: The physics of sound in underwater en-

vironments.

[28] A. Krokstad, S. Strm, and S. Srsdal, Calculating the acoustical room

response by the use of a ray tracing technique, Journal of Sound and Vibra-

tion, vol. 8, no. 1, pp. 118125, 1968.

[29] H. Kuttruff, Room Acoustics. Elsevier, 4th ed., 2000.

- Transformation of second derivatives in weak formulationEnviado porAnaika Balan
- Tutorial Computational Methods for AeroacousticsEnviado pornd1977
- Theoretical and Computational AcousticsEnviado porRh Espindola
- Computational Aeroacoustics An Overview.pdfEnviado porVenu Madhav
- A Meta-heuristic Approach to Rail-Truck Intermodal Transportation of Hazardous MaterialsEnviado poridescitation
- Evaluation of Definite IntegralEnviado pornishagoyal
- Acoustics FluentEnviado porPetre Cojan
- Acoustics TutorialsEnviado porwoongs73
- rungeKuttaFormulasEnviado porumsterfigo
- School Project on javaEnviado porProjjal Gop
- Analyzing Muffler Performance Using the Transfer Matrix MethodEnviado poramrt
- Numerical Methods and ModellingEnviado pormthmstr
- Edge ColonyEnviado porSujeet Sharma
- economic load dispatchEnviado porRonak Patel
- engineering acousticsEnviado por420
- Acoustics of Ducts and Mufflers-MunjalEnviado porconcord1103
- A Comparison of Numerical Techniques for American Option PricingEnviado porNicolas Nalpas
- PPT on Heat and Electric LF_neural_networksEnviado porgsaibaba
- ChangMcMechan_ReverseMigVSPEnviado porjfungj
- An Improvement to the QUEST Algorithm - Yang Cheng and Malcolm D. ShusterEnviado poralvaroroman92
- Subspace MethodsEnviado porDhimas Arief Dharmawan
- Two Step MethodEnviado porksrinivas9999
- seat_it_00Enviado porMona Sayed
- Lecture 20 11-17Enviado porenazimf
- Chap 2 HyperbolicEnviado porB Raghavendra Bejgam
- W10-W11 Math Ch.11Enviado porShafa Alya
- IHT_AGUNGEnviado porErenHunter
- ex02Enviado porAnonymous pu8GAmB4
- 13Enviado porPrem
- Answer 2Enviado porChiew Jun Siew

- Writing Fast MATLAB CodeEnviado porsir_jon43
- Syllabus_6500Enviado porSheng Wang
- White Sides Writing Res PaperEnviado porإلياس صادق
- Handout 1Enviado porSheng Wang
- Handout 0Enviado porSheng Wang
- Har08bEnviado porSheng Wang
- Financial Numerical Recipes in C++Enviado porpab58
- Ramjet HistoryEnviado porcliff20
- Baltimore,DEnviado porSheng Wang
- Nonlinear Bubble DynamicsEnviado porSheng Wang
- Nonlinear Bubble MITEnviado porSheng Wang

- arcsinEnviado porbibbiblos
- Re-expression and Regression.pdfEnviado porLeez17
- [8]+ easier..Enviado porKelvin Fook
- Data Structures - Question SetEnviado porRajeshkannan Vasinathan
- Numerical recipesEnviado porVinay Gupta
- 10Enviado porĐức Dương
- MATHEMATICS Form 1 NotaEnviado porDevaky_Dealish_182
- MAC 1105 College AlgebraEnviado porCornerstoneFYE
- FDheatEnviado porShaan Shafaat
- Rad Appendix 07Enviado porLe Thang
- OpenFOAM编程指南中文版Enviado porZhaobin Li
- Legendre Equation ProblemsEnviado porShahbaz Ahmed
- ECE476_2016_Lect13.pptxEnviado porzhafranabd
- The Numerical Solution of Variational PrEnviado porLen Dierickx
- Addmath DifferentiationEnviado porIzzat Azizi
- LdaEnviado porAadil Aziz
- Matrices 1Enviado porPhine-has
- Partial DerivativesEnviado porsuvendu behera
- Math Am a TicsEnviado porabhishek_bhagat29
- S11MTH3175GroupThQ4PractSolEnviado poroscura
- GradientEnviado porBrian T. Kim
- Array ProgramsEnviado porBijay Ojha
- Chapter 2 in managerial economicEnviado pormyra
- CHE 555 PDEEnviado porMXR-3
- 18614765Enviado porKhurram Shahzad
- DC Lab ReportEnviado porSivaranjan Goswami
- C Important QuestionsEnviado porAbhishek Punna Netha
- Assignment UpEnviado porHemesh Jain Surana
- MA Numerical AnalysisEnviado porNikhilSharma
- Generation of Complex ExponentialEnviado porirum jafri