computational methods in acoustics
TRANSCRIPT
-
7/30/2019 Computational Methods in Acoustics
1/75
COMPUTATIONAL METHODSIN ACOUSTICS
ULF R. KRISTIANSEN
ERLEND M. VIGGEN
DEPARTMENT OF ELECTRONICS AND
TELECOMMUNICATIONS NTNU 2010
-
7/30/2019 Computational Methods in Acoustics
2/75
-
7/30/2019 Computational Methods in Acoustics
3/75
Contents
Preface v
1 The finite difference method 1
1.1 The Taylor series and finite differences . . . . . . . . . . . . . . . 1
1.1.1 Discretisation and finite 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 Reflection-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 . . . . . . . . . . . . . . . . . . 161.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
-
7/30/2019 Computational Methods in Acoustics
4/75
iv
2.3.2 Sound sources and walls . . . . . . . . . . . . . . . . . . . 29
2.3.3 Further TLM topics . . . . . . . . . . . . . . . . . . . . . . 302.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3 The finite 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 Infinite 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 field . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534.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
-
7/30/2019 Computational Methods in Acoustics
5/75
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-
lum of 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 find it useful.
Why computational acoustics?
In acoustics, and in most other fields 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 find analytical
solutions to these equations in a few simple special cases, but for more com-
plex cases it quickly becomes virtually impossible to find a solution by direct
analytical calculation.
Computational physics saves us from this mess, making it possible to find
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
-
7/30/2019 Computational Methods in Acoustics
6/75
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 find an error?
While we have tried not to include any mistakes in the text, there may be some
errors left. If you find an error anywhere in the compendium, mathematical
or lingual, tell Erlend Viggen and hell fix it. Corrections and suggestions are
very much appreciated.
-
7/30/2019 Computational Methods in Acoustics
7/75
Chapter1
The finite difference method
The finite difference method is one of the most classic methods in numerical
analysis of differential equations. Instead of trying to find an exact solution of
a differential equation in an entire domain (e.g. finding the sound field in a
room), one attempts to find 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 find solutions in domains of pretty
much any shape. The fineness of this grid generally determines how good the
approximate solution is.In the finite 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 finite difference method is
very direct, simple, and powerful.
In this chapter, we will describe how finite 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 finite differences
It is known from earlier 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 infinite number of terms. It is possible to
1
-
7/30/2019 Computational Methods in Acoustics
8/75
2 CHAPTER 1 THE FINITE DIFFERENCE METHOD
truncate this series as
f(x) = f(c) +f(c)
1!(x c) + . . . + f
(n)(c)
n!+ Rn(x), (1.2)
where the term Rn is called the remainder, and is given by
Rn(x) =f(n+1)()
(n + 1)!(x c)n+1, (1.3)
where is a value between c and x. We will now examine how the Taylor series
is useful for creating finite difference expressions, i.e. estimating derivatives of
f(x) at some point x from f(x) itself.
3 2 1 0 1 2 35
0
5
10
15
20
x
ex
2 terms4 terms6 terms8 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 finite differences
We assume that we have a differential equation D(x) = 0, where the differ-ential operator D may contain derivatives of different orders.We wish to examine the function (x) over an interval 0 x Lx, and
start by discretising the independent variable x. We restrict x to a discrete set
ofM + 1 different values xi, where
xi+1 xi = x and xi = 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/x2 + k2.
-
7/30/2019 Computational Methods in Acoustics
9/75
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 finite differ-
ences. These are found from the Taylor series in equation 1.2, which can now
be written as
(xi+1) = (xi + x) = (xi) + xd
dx(xi) + . . . +
xn
n!
dn
dxn(xi)
+
xn+1
(n + 1)!
dn+1
dxn+1 (xi +
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
(xi) to i, we then find
i+1 = i + xdidx
+x2
2!
d2
dx2(xi + x), (1.6)
giving
di
dx=
i+1
i
x+x
2!
d2
dx2(
xi+
x)
=i+1 i
x+ O(x).
(1.7)
The remainder is proportional to x, or in other words, O(x). This meansthat if we remove it, the equation gets an approximation error proportional to
x.
Equation 1.7 is called a forward difference approximation of the first deriva-
tive of(xi), since we estimate the derivative by looking forward. We can find
the backward difference approximation by first using the Taylor series to esti-
mate (xi1),
i1 = i x didx + x2
2!d
2
dx2(xi x). (1.8)
From this, we obtaindidx
=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 find expressions for i+1 and i1 which can be combined tofind an expression for the central difference equation,
didx
=i+1 i1
2x+ O(x2). (1.10)
-
7/30/2019 Computational Methods in Acoustics
10/75
4 CHAPTER 1 THE FINITE DIFFERENCE METHOD
We see from the error term that 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 find 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 derivativeForward difference
Backward differenceCentral 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 find approximations for the first four derivatives,
where all equations have approximation errors ofO(x2):didx
i+1 i12x
, (1.11a)
d2
idx2
i+1 2i + i1x2
, (1.11b)
d3idx3
i+2 2i+1 + 2i1 i22x3
, (1.11c)
d4idx4
i+2 4i+1 + 6i 4i1 + i2x4
. (1.11d)
Expressions for approximated derivatives where the error is even smaller
(i.e. O(x4), O(x6), etc.) are sometimes necessary. We would then need touse 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
-
7/30/2019 Computational Methods in Acoustics
11/75
1.2 HELMHOLTZ EQUATION 5
pressure and particle velocity are occasionally computed via first order differ-
ential expressions. To minimize dispersion, eighth order differences may benecessary in some cases.
1.2 Helmholtz equation
As our first acoustic example, we imagine wave propagation in a long pipe of
length Lx. We write the Helmholtz equation for plane harmonic waves with
wavenumber k, moving in x direction,
2p
x2+ k2p = 0. (1.12)
We can write this in a finite difference form for node i by replacing the double
derivative with the finite difference expression from equation 1.11b,
pi+1 2pi + pi1x2
+ k2pi = 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.
MM 1M 2
Open ends
Since we have the boundary condition p = 0 at the mouth of an open pipe, we
get the conditions p0 = 0 and pM = 0 at the end nodes of the system if both
ends of the pipe are open to air.
If we need to find the pressure at a node beyond the end of the pipe (say,
a node at i = M + 1), we can find this by examining the finite difference
Helmholtz equation at the end node at i = M,
pM+1 2pM + pM1x2
+ k2pM = 0pM=0 pM+1 + pM1
x2= 0, (1.14a)
which tells us that pM+1 = pM1.
-
7/30/2019 Computational Methods in Acoustics
12/75
6 CHAPTER 1 THE FINITE DIFFERENCE METHOD
MM 1M 2
Hard walls
For hard walls, we wish the particle velocity normal to the surface to be zero.
From the linear Eulers equation, we find that
uwall =1
jp
x
wall
= 0. (1.15)
For the end node at i = M, we can write this boundary condition in finite
difference form aspM+1 pM1
2x= 0, (1.16)
so that pM+1 = pM1. This means that for the wall node M, the discretisedHelmholtz equation (1.13) becomes
2pM1 2pMx2
+ k2pM = 0. (1.17)
MM 1M 2
Impedance boundary condition
If we have a given impedance ZM in the end node at i = M, we can find the
value in a fictional exterior point at i = M + 1 through
ZM =pMuM
=pM
1j
pM+1pM12x
, (1.18)
so that
pM+1 = pM1 2jx pMZM . (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.
MM 1M 2
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 uMat the node to a certain value. In equation 1.19, we can replace ZM with pM/uM
to get pM+1 = pM1 2jx uM. (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
uM at xM = Lx, which gives a system
(A+ k2I)p = b, (1.21)
-
7/30/2019 Computational Methods in Acoustics
13/75
1.3 EXAMPLE: SIMPLE MODEL OF A DRUM 7
where I is the identity matrix. More explicitly, this is
1
x2
2 11 2 1
1 2 1. . .
2 2
+ k
2I
p1p2p3
...
pM
=
0
0
0
...
2juMx
. (1.22)
Note how we get a tridiagonal matrix, since we are using a central difference
method to approximate 2p/x2.
If we were to solve for p, we would first need to set values for and k, in
addition to the other constants. Then, we would be able to find p by invertingthe (A+ k2I) matrix,
p = (A+ k2I)1(A+ k2I)p = (A+ k2I)1b. (1.23)
If we have (A + k2I) and b in MATLAB as a matrix called B and a vector called
b, we can find p through left matrix division, p = B\b. (This is MATLAB swell-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+ k2I)p = 0. (1.24)
We note that this resembles the eigenvalue equation
(A I)p = 0, (1.25)
with k2 = . Therefore, eigenmode values ofkcan be found through findingthe eigenvalues ofA.
1.3 Example: Simple model of a drum
In this section we present a finite 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 few degrees of freedom, so that the analytic equations for
the resonant wavenumbers might be obtained and discussed.
For more information on finding eigenvalues, see for instance Elementary Linear Algebra byC.H. Edwards, Jr. and D.E. Penney.
-
7/30/2019 Computational Methods in Acoustics
14/75
8 CHAPTER 1 THE FINITE DIFFERENCE METHOD
a
L
Membrane
Acousticcavity
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
2
r2+
1
r
r
+ p =
2
t2, (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,
2p
y2 1
c2a
2p
t2= 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=
2
t2. (1.28)
We assume harmonic time variation and seek the eigenvalues of the system.
-
7/30/2019 Computational Methods in Acoustics
15/75
1.3 EXAMPLE: SIMPLE MODEL OF A DRUM 9
We rewrite the equations as
T2r2
+1
r
r
+ 2 + p = 0, (1.29)
2p
y2+
2
c2ap = 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 fixed 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 lHopitals rule, giving
2T2
r2+ 2 = 0. (1.32)
1.3.2 Finite difference equations
For point 2, equation 1.32 becomes
4T 2r2
+ 22 + p2 = 0. (1.33)
The Helmholtz equation (1.30) at the same point becomes
p4 2p2 + p6y2
+2
c2ap2 = 0, (1.34)
while the Helmholtz equation for point 4 becomes
2p4 + p2y2
+2
c2ap2 = 0. (1.35)
The coupling equation for membrane displacement and pressure (1.31) be-
comesp4 p6
2y= 22. (1.36)
In the above equations, p5, 1, and 3 have been set to zero. p6 is eliminated bycombining equations 1.36 and 1.34.
The unknowns of the system are p2, p4, 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, 2y2
c2a 2
2+
2y2
c2a 2
2r2
c2m 4
2y
2r2
c2m 2 = 0, (1.37)
where cm is the membrane wave velocity, given by c2m = T/.
-
7/30/2019 Computational Methods in Acoustics
16/75
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 from equation 1.33
as
kma =T/
r = 2. (1.38)
The analytical value is found from the zeroth order Bessel function as kma =
2.41 (found from J0(kma) = 0). The one active node membrane equationtherefore 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 infinity, we essentially make the membrane a hard
wall. Since cm also approaches infinity, equation 1.37 loses the large second
term, and can be simplified to
ka L = 222. (1.39)The lowest possible wavenumber, found by using the minus sign, gives the
fundamental wavenumber of an open/closed waveguide as ka L 1.531, whichis within 2.6 % of its analytical value ofka L = /2.
T = 0
In this case, the membrane acts as a limp mass. cm now goes to zero, so that
we can simplify equation 1.37 to
2y2c2a 2
2y2
c2a 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 fluid divided by the area mass density of
the membrane.
In the limit of 0, the equation gives a value ka L =
8 2.83, whichapproaches the analytical value for an open end ofwith an error of 10%.
In the limit of , we essentially assume the membrane to be a hardwall. Equation 1.40 also reduces to equation 1.39, giving the same result of
ka L 1.531, which is nearly the hard-wall analytical result of/2.
-
7/30/2019 Computational Methods in Acoustics
17/75
1.4 THE WAVE EQUATION 11
1.3.4 Summary
We see that even with this extremely simple model, we find 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 spaceand 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 xi = ix, the time t is
given as tk = kt, where know is our time index. We thus denote the pressure
at different points in space and time as
p(xi, tk) = pki . (1.41)
Thus, the one-dimensional wave equation,
2p
x2 1
c22p
t2= 0, (1.42)
is discretised to
pki+1 2pki + pki1x2
1c2
pk+1i 2pki + pk1it2
= 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 1and i + 1).
Solving for pk+1i , we get
pk+1i = 21 2pki + 2 pki+1 + pki1 p
k1i , (1.44)
where = ctx , 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.For the two-dimensional wave equation, the wave equation is given by
2p
x2+
2p
y2 1
c22p
t2= 0. (1.45)
This can be shown either from von Neumann stability analysis or the CFL condition, whichwe will not go into in this text.
-
7/30/2019 Computational Methods in Acoustics
18/75
12 CHAPTER 1 THE FINITE DIFFERENCE METHOD
Assuming an equal node spacing in both directions (i.e. y = x), we can find
in a similar manner that
pk+1i,j = 2
1 22
pki,j + 2
pki+1,j + pki1,j + p
ki,j+1 + p
ki,j1
pk1i,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
2p
r2+
1
r
p
r+
2p
z2 1
c22p
t2= 0. (1.47)
Discretising this and solving for pk+1i,j , where i is the r index and j is the z index,
we get
pk+1i,j = 2
1 22pki,j + 2 pki+1,j + pki1,j + pki,j+1 + pki,j1+
2
ir
pki+1,j pki1,j
pk1i,j .
(1.48)
For axisymmetric systems we have a special case for r 0, since the rcoordinate 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 LHopitals rule to find that
limr0
p/r
r=
2p
r2. (1.49)
For the two-dimensional and three-dimensional axisymmetric forms of the
wave equation, stable calculations require that 1/2.
1.4.1 Initial conditions
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 startingour simulation, since it means that we cannot simply set up a single pressure
field for t0 = 0 in our domain and let it propagate. This is because we would
also need to know what the pressure field is at t1 = 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 tosome 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 field present for t 0.We can thus dodge the problem described in the previous paragraph.
1.4.2 Reflection-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.
-
7/30/2019 Computational Methods in Acoustics
19/75
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 dampedgradually. This method is called the perfectly matched layer (PML) method. We
now take a closer look at the first method.
In one dimension, as for wave propagation in a pipe, the wave equation is
given by 2
x2 1
c22
t2
p = 0. (1.50)
This can be factorised as1
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 1c t x
1 + 1
2
2y2
2
x2
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 c1 and c2, have an
interface at node M, as shown in Figure 1.5. The boundary conditions to be
fulfilled are continuity in sound pressure and particle velocity.
M 1 M 1/2 M M + 1/2 M + 1
Figure 1.5: Interface between two media at node M.
Denoting pressure in the first medium as p(1) and pressure in the second
as p(2), the first boundary condition is given by
p(1)M = p(2)M, (1.53)
-
7/30/2019 Computational Methods in Acoustics
20/75
14 CHAPTER 1 THE FINITE DIFFERENCE METHOD
while the second condition is given from the linear Eulers equation as
1
1
p(1)Mx
=1
2
p(2)Mx
(1.54)
The wave equation for each material can be written as
1
1
2p(1)
x2=
1
1c21
2p(1)
t2, (1.55)
and1
2
2p(2)
x2=
1
2c22
2p(2)
t2. (1.56)
The two equations are now integrated with respect to x from M 1/2 toM, 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
11c
21
x
2
2p(1)
t2= 0, (1.57)
and1
2
p(2)M+1/2
x p(2)M
x
12c
22
x
2
2p(2)
t2= 0. (1.58)
By writing these equations in a finite difference form, adding them, and us-
ing the boundary conditions in equations 1.53 and 1.54, we find for the bound-ary point M that
1
x2
1
2pkM+1
1
1+
1
2
pkM +
1
1pkM1
12
1
1c21
+1
2c22
pk+1M 2pkM + pk1M
t2= 0.
(1.59)
This equation is really just a more general version of equation 1.43. If we let
1 = 2 = and c1 = c2 = c, the two equations become identical.
1.5 Further topics
We will now look at a few mathematical aspects of the finite difference method.
1.5.1 Creating difference schemes
In section 1.1, we saw how to derive the simplest first-order forward and back-
ward difference schemes, but did not look at how to derive better schemes. We
will now look closer at this.
-
7/30/2019 Computational Methods in Acoustics
21/75
1.5 FURTHER TOPICS 15
The Taylor series for i+2, i+1, i1, and i2 can be truncated to
i+2 i + 2x didx +4x2
2
d2idx2
+8x3
6
d3idx3
+16x4
24
d4idx4
, (1.60a)
i+1 i + x didx +x2
2
d2idx2
+x3
6
d3idx3
+x4
24
d4idx4
, (1.60b)
i1 i x didx +x2
2
d2idx2
x3
6
d3idx3
+x4
24
d4idx4
, (1.60c)
i2 i 2x didx +4x2
2
d2idx2
8x3
6
d3idx3
+16x4
24
d4idx4
. (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/240 0 1 1 0 1 1/2 1/6 1/240 0 1 0 1 2 2 4/3 2/3
i+2i+1ii1i2x
didx
x2d2idx2
x3d3idx3
x4d4idx4
0. (1.61)
We can find difference schemes by linear combination of the rows ofA. For
instance,A
1 2A2 + 2A3 A4 results in the equation i+2 + 2i+1 2i1 + i2 + 2x3 d
3idx3
0, (1.62)
which can be rewritten as
d3idx3
i+2 2i+1 + 2i1 i22x3
. (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 finite difference
scheme to arbitrary order with this method.
This is one of several methods to derive finite difference schemes. There
exist more direct methods, such as the method of undetermined coefficients, but
these are more complicated.
1.5.2 Approximation error
As we saw in section 1.1.1, the finite 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 saw that the errors in forward and
backward difference approximations of the first derivative are proportional to
x, while the errors in the central difference approximation are proportional
-
7/30/2019 Computational Methods in Acoustics
22/75
16 CHAPTER 1 THE FINITE DIFFERENCE METHOD
to x2. We therefore say that the forward and backward difference scheme is
first order, while the central difference scheme is second order.Given an unknown finite 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 find that
i+1 2i + i1x2
=1
x2
i + x
didx
+x2
2
d2idx2
+x3
6
d3idx3
+x4
24
d4idx4
+O(x5)
2i
+ i
x
di
dx +
x2
2
d2i
dx2 x3
6
d3i
dx3 +
x4
24
d4i
dx4 +O(
x
5
),which becomes
i+1 2i + i1x2
=d2idx2
+x2
12
d4idx4
+ O(x3)
=d2idx2
+O(x2).(1.64)
We have now shown that this numerical scheme estimates d2i/dx2 with
an approximation error which scales as x2.
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 find a good estimate
from two poorer ones.
As an example, lets say we want to numerically find the wave number kof
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 find a value k =
8 2.83.If we use four nodes (x = 1/3), we find k = 3. These values seem to be
-
7/30/2019 Computational Methods in Acoustics
23/75
1.6 SUMMARY 17
converging towards , which is what we want to find. But we will now see
how we can find 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(x2), it is not unnatural to assume that the differencebetween the exact solution kex and the numerical solution k(x) is
kex k(x) Kx2, (1.65)where K is some constant. Connecting two different estimates k(x1) and
k(x2) through K, we find that
kex k(x1)x21
kex k(x2)x22
,
kex k(x1)x22 k(x2)x21x22 x21
. (1.66)
Using the values we found for x1 = 1/2 and x2 = 1/3, we find that
kex 3.1373, which is a very good approximation of . Directly finding aresult 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 finite 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 kand 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 tk+1 as the pressures in the node and
its neighbours at tk and the pressure of the node at tk1. For stability in onedimension, we need to have ct
x 1. In two-dimensional and an axisymmetricthree-dimensional simulations, we need to have ct
x 1/
2.
Generally, the finite difference method is a fairly straightforward method inwhich any partial differential equation can be discretised. This discretisation
can be used to find an approximate solution to the equation, given appropriate
boundary conditions (and initial values, for time-dependent equations).
While the finite 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 finer. This will improve the approximationaround the boundary at the cost of strongly increased computation time.
-
7/30/2019 Computational Methods in Acoustics
24/75
18 CHAPTER 1 THE FINITE DIFFERENCE METHOD
Figure 1.7: Circular boundary wall, along with suggested discretised approxi-
mation.
Adaptive grid: Make the grid finer locally around difficult boundaries. This issomewhat complicated in practice.
Improved boundary conditions: Use improved boundary conditions whichcan 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 finite difference method.
This is one of the reasons why the finite element method has gained popularity,
since it elegantly handles complicated boundaries. We go into this method in
Chapter 3.
Also, computer hardware limits how fine you can make a grid. This limitis quite strict in three dimensions: If you have M nodes along each edge, you
get a total ofM3 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 ofx = /2 = 8.5 103 m. As anexample, 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.7m3, whichwould require 1.4 108 nodes! If we use double precision variables and storetwo pressures per node in memory at any time (we need pk and pk1 to find
pk+1), we need 16 bytes of memory per node, or 2 GB of memory in total. Thiswould 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 finite differences in the kind of spatial
scales you find 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.
-
7/30/2019 Computational Methods in Acoustics
25/75
Chapter2
Cellular automata methods
In this chapter we will look at a number of methods which are created for
efficient 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 threeneighbours.
Life and death: A living cell remains alive if it has two or three livingneighbours. In any other case, it dies.
The challenge lies in finding 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 first five 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
-
7/30/2019 Computational Methods in Acoustics
26/75
20 CHAPTER 2 CELLULAR AUTOMATA METHODS
Parallelism: All cells are updated simultaneously.
Locality: The development of a cell is only determined by cells in itsimmediate 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 find 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
A lattice 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 first 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 from their node to the neighbouring nodein the direction of their velocity vector.
Collision: If two particles meet head on after translation in a node withno 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 defined 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 from which particles are present at the node. Ifci are the four velocity
vectors (i = 1,2, 3,4) and ni(x, t) = 0, 1 indicates the absence or presence of a
-
7/30/2019 Computational Methods in Acoustics
27/75
2.1 LATTICE GASE S 21
t
(a) Translation rule
t
(b) Collision rule
Figure 2.2: Update rules of the HPP model.
particle with a velocity vector ci in the node at x at time t, the particle density
and total momentum are given by
(x, t) = i
ni(x, t), (2.1)
(x, t)u(x, t) = i
cini(x, t). (2.2)
In words, the density is given by the total number of particles in the node,
while the momentum is found by summing the individual momentum of 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 utiliseas 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.
-
7/30/2019 Computational Methods in Acoustics
28/75
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 fluid, i.e. abehaviour 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 fluid behaviour, it would also give
correct wave behaviour since wave propagation is a property of compressible
fluids.
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 fluid
flow 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. Thecollision 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 infinite 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 sixdifferent 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.
-
7/30/2019 Computational Methods in Acoustics
29/75
2.1 LATTICE GASE S 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.
-
7/30/2019 Computational Methods in Acoustics
30/75
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 fluids, not merely lattice gases.
When we interact with fluids in our daily lives, we see them as continuous
and uniform. If we were able to look at the fluid at size scales on the or-
der of nanometers, though, we would be able to see that the fluid 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 fluid is no longer uniform.
The statistical noise in lattice gases is a desired property if the goal is to
study these fluctuations, but a problem if the goal is to simulate fluids 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 first 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,
-
7/30/2019 Computational Methods in Acoustics
31/75
2.2 THE LATTICE BOLTZMANN METHOD 25
where one tracks the movement ofdistributions 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, fi(x, t). These variables, called distribution func-
tions, represent the density of particles travelling in direction ci 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 ci, shown in
Figure 2.6.
c1
c2
c3
c4
c5c6
c7 c8
c0
Figure 2.6: The most common two-dimensional set of lattice vectors in the
lattice Boltzmann method. c0 = (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 fi(x, t) through the relations
(x, t) = i
fi(x, t), (2.3)
(x, t)u(x, t) = i
ci fi(x, t). (2.4)
If there were no collisions between particles, we could mathematically for-
mulate the streaming of particles through the grid as
fi(x + ci, t + t) = fi(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 disturbancefrom this pure translation,
fi(x + ci, t + t) = fi(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
-
7/30/2019 Computational Methods in Acoustics
32/75
26 CHAPTER 2 CELLULAR AUTOMATA METHODS
BGK operator,
i = 1fi feqi , (2.6)
where is a relaxation time and feqi is an equilibrium distribution analogous
to the Maxwell-Boltzmann distribution.Inserting this BGK operator into equation 2.5, we find that
fi(x + ci, t + t) =
1 1
fi +
1
f
eqi . (2.7)
This represents a relaxation of the current particle distribution fi to the equi-
librium particle distribution feqi .
The equilibrium distribution is in each time step constructed from the nodes
particle density and particle velocity from before the collision,
feqi = ti
1 +
u cic2s
+(u ci)2
2c4s u
2
2c2s
. (2.8)
cs is the speed of sound in the lattice Boltzmann method, which for the set of
lattice vectors shown in Figure 2.6 is cs = x/(t
3). ti is a set of weightings,
one for each type of lattice vector. For the lattice vectors shown in Figure 2.6,
t0 = 4/9, ti = 1/9 for i = 1,2, 3,4, and ti = 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
eqi 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 fluid
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/cs < 0.1. The simulated fluid has a kinematic shear viscosity of
= c2s
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.
Viscosity can be considered as internal friction in a fluid. Acoustically, it causes propagating
plane waves to be damped exponentially in space. See Chapter 8 in reference [9] for more.
-
7/30/2019 Computational Methods in Acoustics
33/75
2.3 THE TRANSMISSION LINE MATRIX (TLM) METHOD 27
The viscosity can in principle be made arbitrarily low by letting 1/2, butthis 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, figure 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 104
Figure 2.7: Double-slit diffraction simulated with the lattice Boltzmannmethod. 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
-
7/30/2019 Computational Methods in Acoustics
34/75
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 Z0.
P tP2
P2
P2P2
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 from the left. The other three transmission
lines are parallel coupled at the node, so that their total impedance is Z0/3 [9].
The reflection coefficient in the node becomes
=Z0/3 Z0Z0/3 + Z0
=
1
2
. (2.11)
The pulse to be reflected 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. Boththese quantities are preserved if the transmitted pressure pulses have ampli-
tudes ofP/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 fi in a node represent incoming pressure pulses in pipe i,
we can write outgoing pressure pulses gi in pipe i as
gi = fi
2 +j=i
fj
2 , (2.12)
or in matrix form,
g1g2g3g4
= 12
1 1 1 1
1 1 1 11 1 1 11 1 1 1
f1f2f3f4
.
Conserving energy implies conserving the square of the pressure.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.
-
7/30/2019 Computational Methods in Acoustics
35/75
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 modified to
gi = A sin
2
Tkt
fi
2+
j=i
fj
2, (2.14)
where A is the amplitude of the sound source and kis the time step.
P t RP
Figure 2.9: Reflection at a wall node with reflection coefficient 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
reflection coefficient R are very simple to implement. Certain nodes can be set
as wall nodes, and these reflect back incoming pulses as shown in Figure 2.9.
A pulse moves one grid space for each time step. Since a reflected pulse
reappears in the same node as it left, we can look at it as having been reflected
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.
-
7/30/2019 Computational Methods in Acoustics
36/75
30 CHAPTER 2 CELLULAR AUTOMATA METHODS
It is also possible to implement open boundaries in the method, which do
not reflect waves. These are useful as edges of an open domain. We will not gointo 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 figure 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 TLMfig 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 fluids. 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 fix 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 fluid flow, it iswidely used in fluid 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 fields and fluid flows, 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
-
7/30/2019 Computational Methods in Acoustics
37/75
2.4 SUMMARY 31
Figure 2.10: Diffraction study with the TLM method. (H. Solvik, 1998)
-
7/30/2019 Computational Methods in Acoustics
38/75
32 CHAPTER 2 CELLULAR AUTOMATA METHODS
in accordance only with the wave equation, so any interaction between fluid
flows and acoustic fields is impossible to simulate with the TLM method. Butthen again, this is usually not very interesting in most acoustic cases.
-
7/30/2019 Computational Methods in Acoustics
39/75
Chapter3
The finite element method
The finite element method is reminiscent of the finite difference method, but
the approach is somewhat different. In both methods, we divide a domain
into pieces and attempt to find the solution of an equation at the corners of
these pieces. In the finite difference method, the domain is divided into pieces
by a regular grid. In the finite 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 finer 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 finite element method is significantly more mathematically complicated
than the finite 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 finite element method,
we will go through a simplified 1D example of the Helmholtz equation and
then find a general solution method for higher dimensions. This chapter at-
tempts to give a better understanding of the finite element method, but will not
teach everything which is required to make a general finite element method
solver. In most cases, finding finite 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 finite 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
-
7/30/2019 Computational Methods in Acoustics
40/75
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 asa 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
34
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: p1, p2, p3, and p4. Within this element,
-
7/30/2019 Computational Methods in Acoustics
41/75
3.1 FINITE ELEMENTS 35
we describe the pressure as
p(x,y) = N1(x,y)p1 + N2(x,y)p2 + N3(x,y)p3 + N4(x,y)p4, (3.1)
where Ni(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,
N1(x,y) =
1 xa
1 y
b
, (3.2a)
N2(x,y) =x
a
1 y
b
, (3.2b)
N3(x,y) =x
a
y
b, (3.2c)
N4(x,y) = 1 x
ay
b, (3.2d)
for 0 x a,0 y b.
In matrix form, we write this as
p(x,y) =
N1(x,y) N2(x,y) N3(x,y) N4(x,y)
p1p2p3p4
, (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 ofthe node values, where the weighting depends on the distance to the nodes.
Here, we have used basis functions which are defined 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 Ni(xi,yi) =1 while Nj=i(xi,yi) = 0, so that p(xi,yi) = pi.
i Ni = 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 beeasily 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 pi in the do-
main. We will then be able to solve this system to find the values pi which give
a pressure field which solves the differential equation in question.
-
7/30/2019 Computational Methods in Acoustics
42/75
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 defined 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
defined 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.
Ni(x,y)
xi
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 how an 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 x0, x1, . . . , xM. This is shown in
Figure 3.4.
We wish to construct a piecewise linear function (x), using node values
(xi) = i and the basis functions Ni(x). We can look at Ni(x) as global hat
functions, illustrated in Figure 3.4 and given mathematically by
Ni(x) = xxi1xixi1 for xi1 x xi,xi+1
x
xi+1xi for xi x xi+1,0 otherwise and outside.
(3.5)
The function (x) is constructed from Ni(x) and i as
(x) = i
i Ni(x) in . (3.6)
If we wish (x) to be an estimate of(x), we somehow need to find the opti-
mal node values i so that the deviation between (x) and (x) is as small as
possible.
-
7/30/2019 Computational Methods in Acoustics
43/75
3.1 FINITE ELEMENTS 37
xx0 x1 x2 xi1 xi xi+1 xM1 xM0 L
Ni1
Ni
Ni+1
Global basis
functions
Ni Ni+1
xi xi+1
Local basis
functions
(x)
(x)
Figure 3.4: Approximation of a one-dimensional function through linear basis
functions.
-
7/30/2019 Computational Methods in Acoustics
44/75
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 thedomain, 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 as2 + k2
p(x) = DHp(x) = 0, (3.7)
where DH is the Helmholtz operator, DH = 2 + k2.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,
DH(N(x) p) = R(x). (3.8)We wish to find a system of equations which can be solved to give the set of
node values pi which minimises this residual.
As the first step in finding this system of equations, we integrate equation
3.8 over the entire domain, giving
DH(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
Note that the Laplacian term 2 in the Helmholtz operator destroys any linear functions. Thismeans 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.
-
7/30/2019 Computational Methods in Acoustics
45/75
3.2 THE WEIGHTED RESIDUAL METHOD 39
would have found
W(x)DH(N(x) p)d =
W(x)R(x)d. (3.10)
If we can find 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, Wi(x). This set of weighting
functions should ideally cover the entire domain. Setting the equation to zero,
we get
W(x)DH(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,
Wi(x)DH(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 Wi(x)
as there are unknownnode values pi.
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
Wi(x) =
1 for x in i,
0 for x not in i.(3.12)
With this weighting function, we are trying to find 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 Wi(x) in W(x) is given
by
Wi(x) = (x yi), (3.13)where (x) is the Dirac delta function.
-
7/30/2019 Computational Methods in Acoustics
46/75
40 CHAPTER 3 THE FINITE ELEMENT METHOD
When using this weighting function we are trying to find a node pressure
vector p which gives a minimum value of DH(N(x) p) at certain points inspace, yi. 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.
Wi(x) = Ni(x). (3.14)
Thus, with Galerkins method, equation 3.11 becomes
N(x)DH(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 ofa and b. Using this, we can rewriteequation 3.15 into
N(x) DHN(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 finite element method is that quite a few
derivations must be gone through before one finds a system of equations which
can be solved directly on a computer. We will therefore restrict ourselves to the
Helmholtz equation.
We will first 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 theproduct of a columnvector anda row vector whichresultsin a matrix,i.e.
a b =
a1a2
b1 b2
=
a1b1 a1b2a2b1 a2b2
.
In both cases, the ith component of the resulting vector becomes
{a(b c)}i = {(a b)c}i = j
aibjcj.
-
7/30/2019 Computational Methods in Acoustics
47/75
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 finite element method to
a one-dimensional Helmholtz equation using Galerkins method. We solve for
the domain = [0, L], using nodes x0, x1, . . . , xM with an even spacing x, so
that our global basis functions become
Ni(x) =
xxi1x for xi1 x xi,
xi+1xx for xi x xi+1,
0 otherwise and outside .
(3.17)
We will solve the equation with a open-end boundary condition p0 = 0 at one
end and a given velocity boundary condition uM at the other.
xx00
x1 xi xM1 xML
N0 N1 Ni NM1 NM
Figure 3.5: Global linear basis functions for a one-dimensional system between
x = 0 and x = L.
Equation 3.16 equates one vector on the left side with another on the rightside, 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
Ni(x)2 Nj(x)
x2dx + k2
L0
Ni(x)Nj(x)dx
pj = 0. (3.18)
Since we know the pressure p0 at x0, 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 thesecond derivative in the Helmholtz equation destroys linear basis functions.
We resolve this by performing a partial integration of the first integral,
L0
Ni(x)2 Nj(x)
x2dx =
Ni(x)
Nj(x)
x
L0
L
0
Ni(x)
x
Nj(x)
xdx.
There are now only first 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,
-
7/30/2019 Computational Methods in Acoustics
48/75
42 CHAPTER 3 THE FINITE ELEMENT METHOD
The first term on the left side isNi(x)
Nj(x)
x
L0
= Ni(L)Nj(L)
x Ni(0)
Nj(0)
x
We have that Ni(0) = 0 only for the i = 0 case, which we have removed. Thus,the last term falls away. Also, the first term is only nonzero for i = M, where
NM(L) = 1. When we multiply it with pj as in equation 3.18 and apply the
Eulers equation, it becomes
j
Ni(L)
xNj(L)pj Ni(L)p(L)x = jNi(L)uM.
We can use these results to rewrite equation 3.18 as
j
L
0
Ni(x)
x
Nj(x)
xdx + k2
L0
Ni(x)Nj(x)dx
pj = jNi(L)uM. (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
Ni(x)
x
Nj(x)
xdx =
1x for j = i 1, 2x for j = i,
1x for j = i + 1,
0 otherwise,
L0
Ni(x)Nj(x)dx =
16x for j = i 1,46x for j = i,16x 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 1x and 26x in these cases.Thus, equation 3.19 becomes
1
x+
k2
6x
pi1 +
2x
+4k2
6x
pi +
1
x+
k2
6x
pi+1 = 0
for 1 i M 1(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.The Eulers equation at x = L becomes
p(L)
x= ju(L).
-
7/30/2019 Computational Methods in Acoustics
49/75
3.3 GALERKIN SOLUTION OF THE HELMHOLTZ EQUATION 43
and 1
x+
k2
6x
pi1 + 1x
+2k2
6x
pi = juM
for i = M
(3.21)
Using our knowledge that p0 = 0, we write this in m