fdtd project report

42
TT8303 Numerical Methods in Acoustics Semester Project Simulating room acoustics with the Finite-Difference Time-Domain method by Jakob Vennerød Student, M.Sc. in Electronics December 11, 2012

Upload: jakob-vennerod

Post on 16-Apr-2015

184 views

Category:

Documents


7 download

DESCRIPTION

Project for the course TT8303 at NTNU, Trondheim, NO

TRANSCRIPT

Page 1: FDTD Project report

TT8303 Numerical Methods in Acoustics

Semester Project

Simulating room acoustics with the

Finite-Difference Time-Domain method

byJakob Vennerød

Student, M.Sc. in Electronics

December 11, 2012

Page 2: FDTD Project report
Page 3: FDTD Project report

Abstract

Today, numerical simulation of room acoustics is widely used in the audio industry as well asin architectural acoustics. Almost all commerical and non-commercial software restrict to usinggeometrical methods such as ray-tracing for the simulations. These methods have a draw-back:Low-frequency phenomena can not be simulated correctly. For many years, it has been known thatwave-based numerical methods can solve this problems, but computational issues has been a bigbarrier for these. However, recent development in computing performance gives us the possibilityto do wave-based simulations on personal computers.

This project concerns the Finite-difference Time-domain method, one of the simplest wave-basedmethods. It is shown that this method behaves very well for low frequencies, but not that well forhigher frequencies. By knowing the advantages and limitations of the method, which this reportexplores, it can very well be possible to use the method in practice for room acoustic simulations.

Page 4: FDTD Project report
Page 5: FDTD Project report

Contents

1 Introduction 11.1 Numerical methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Chosen method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Chosen simulation software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Theory 52.1 Room modes, reverberation time, absorption, reflection . . . . . . . . . . . . . . . . 52.2 Discretizing the wave equation in three dimensions . . . . . . . . . . . . . . . . . . . 62.3 Stability and numerical dispersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.4 Other FDTD schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.5 Source representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.5.1 Spatially distributed sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.5.2 Time varying sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.5.3 Signal type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.6 Boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.6.1 Hard (perfectly reflecting) walls . . . . . . . . . . . . . . . . . . . . . . . . . . 92.6.2 Frequency independent boundary conditions (Locally Reacting Surfaces) . . . 102.6.3 Frequency dependent LRS boundaries . . . . . . . . . . . . . . . . . . . . . . 122.6.4 Modeling boundaries with Digital Impedance Filters . . . . . . . . . . . . . . 12

2.7 Designing digital impedance filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3 Matlab Implementation 153.1 FDTDscript.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.2 FDTDsimulation.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.3 create2Dgrid.m and findBoundaries.m . . . . . . . . . . . . . . . . . . . . . . . . . . 163.4 createBoundaryConditions.m and createBoundaryConditionsLeastPth.m . . . . . . . 163.5 createSourceSignal.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4 Numerical Results 174.1 Source implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.2 Measurement of numerical dispersion . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Page 6: FDTD Project report

4.3 Room modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.4 Angled walls - using FDTD to determine room resonances for complex shapes . . . . 224.5 Boundary conditions - specular reflection . . . . . . . . . . . . . . . . . . . . . . . . 234.6 Reverberation time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

5 Discussion 295.1 Problem and purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295.2 Findings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295.3 Implications and future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

6 Concluding remarks 31

7 Nomenclature and Constants 33

Page 7: FDTD Project report

1

CHAPTER 1

Introduction

This semester project is written for the PhD course TT8303 Numerical Methods in Acoustics at theNorwegian University of Science and Technology. The main goal of the course is to give students anintroduction to solving acoustic problems with numerical mathematics, particularly with the useof computers. Since computers were invented, scientists and engineers have tried to solve acousticproblems with them. Major advancements in hardware, software and algorithm design make moderncomputers capable of solving more and more complex acoustic systems. User-friendly developmentsoftware such as Matlab makes solving such problems much easier. This project deals with solvingroom acoustic problems by approximating the three-dimensional wave equation.

1.1 Numerical methods

We can divide the field of numerical acoustics in two: Geometrical methods and wave-basedmethods.

In geometrical acoustics, sound is treated as rays, much like we perceive light. Ray-tracing andimage source methods are often used together to simulate sound waves which propagate through amedium like a ray of light, or a sound particle. These particles bounce off surfaces with a specularor random (diffuse) direction, and some energy is absorbed. In general, geometrical acoustics arethe most computationally efficient methods, and they work well for high frequency sounds andlow-order reflections[1]. Geometrical methods have a major drawback, though. Because real soundwaves do not behave as rays, and tend to bend around corners, geometrical methods give largeerrors when the wavelength is comparable to the size of the surfaces and objects in the simulation.By ”comparable” one means wavelengths where the wave propagation is affected by the object size,and not just reflected. For room acoustics, Odeon and CATT are commercial software which workwell for mid to high frequencies. Ray acoustics are also used for marine acoustic applications, wherethe wavelengths are small compared to the huge dimensions. In marine applications, one also haveto take into account ray bending resulting from different sound speeds at different water depths[2].

In wave-based numerical acoustics, one approach is to solve partial differential equations (PDEs)directly with numerical approximations. This is a more physical approach to problems, becauseknown equations such as the Wave equation and the Helmholtz equation describe exactly howsound propagates, assuming low enough sound pressure levels so we can neglect nonlinearity. The

TT8303 Numerical Methods in Acoustics Semester Project

Page 8: FDTD Project report

2 CHAPTER 1. INTRODUCTION

problems with wave-based methods are normally heavy computational power and memory require-ments. Numerical approximation also results in numerical errors, which depend on the method,the implementation and the machine number format. Popular wave-based methods are the FiniteDifference Method (FDM), the Finite Element Method (FEM), the Boundary Element Method(BEM), the Digital Waveguide Mesh method (DWM) and the Transmission Line Modeling method(TLM). Most of these methods are presented in the course compendium [3]. The FDM solves thePDEs with finite differences approximations, divides the space into a uniform grid, and can be usedto find solutions in both the time and frequency domain. The FEM is a more complex methodwith divides the space into non-uniform elements where the sound pressure is calculated. BEMdiscretizes only the surfaces and is more suitable for free-field calculations, such as loudspeakermodeling. The TLM and DWM are methods based on small pressure waves moving on rectangularor triangular grids.

Few or none computer programs exists for accurate and easy modeling of wave-based roomacoustics. There are however a few general-purpose programs such as COMSOL[4] and Abec2[5]which can solve these problems, but they are not very practical for room acoustic simulations.

1.2 Chosen method

In this project, the Finite-Difference Time-Domain (FDTD) method is investigated. This is amethod which discretizes the wave equation and simulates waves propagating in time and space.The method was chosen because of its simplicity and ease to implement, at least for simple geomet-rical shapes such as a ’shoebox’ room. The Finite-Difference Frequency-Domain (FDFD) method,which discretizes the Helmholtz equation, was also considered. This equation gives a solution inthe frequency domain (i.e. the steady-state frequency response). However, the FDTD method hasa major advantage: It can simulate impulse responses at all discrete points in the room, and is thusmore applicable to both architectural (engineering) acoustics and virtual sound environments usedin the entertainment industry. As a consequence, other important room acoustics parameters suchas reverberation time can be derived, not just the steady-state frequency response.

Traditionally, the FDTD method has been used for solving electromagnetic problems. Most ofthe literature concerns electromagnetics, but many of the principles also apply for acoustics sincethe wave propagation properties are somewhat similar. In the electromagnetic domain, one has tosolve both the electric and the magnetic field. A solution for this was first presented by Kane Yeein 1966, and is popularly called ”Yee’s staggered grid”, describing how the electric and magneticfields were discretized and solved numerically. The term ”Finite-Difference Time-Domain Method”was later applied by Allen Taflove in 1980.

1.3 Chosen simulation software

The chosen software for programming is Matlab. This software is often used for prototyping andsimulations before implementing the program in a lower-level language such as C/C++. The mainadvantages of Matlab with respect to this project are:

• Matrix operations are handled very quickly, and are easy to program

• Graphic representation and plotting is very easy

• One does not have to worry about memory allocation and other low-level hardware operations

TT8303 Numerical Methods in Acoustics Semester Project

Page 9: FDTD Project report

1.3. CHOSEN SIMULATION SOFTWARE 3

• De-bugging is easy with useful warnings and errors

There are a few disadvantages too:

• Performance optimization is difficult because one is restricted to using Matlab’s functions andalgorithms. However, high performance implementations are possible through the ParallelComputing Toolbox, but they will not be investigated in this project

• Good 3D visualizations are a bit tricky to create

• Creating stand-alone and user-friendly software can be a challenge.

• Matlab is expensive and a stand-alone software developed in C/C++ would be much easierand cheaper to use

For research and education purposes, Matlab is a good choice.

TT8303 Numerical Methods in Acoustics Semester Project

Page 10: FDTD Project report

4 CHAPTER 1. INTRODUCTION

TT8303 Numerical Methods in Acoustics Semester Project

Page 11: FDTD Project report

5

CHAPTER 2

Theory

2.1 Room modes, reverberation time, absorption, reflection

In this section, some classical room acoustic theory will be presented.For a rectangular room, the resonance frequencies (called room modes) can easily be determined

by the formula

fijk =c

2

√(i

L

)2

+

(j

W

)2

+

(k

H

)2

(2.1)

where L,W,H are the dimensions of the room and c is the sound speed. However, for more complexshapes such as rooms with angled walls, the resonance frequencies cannot be analytically calculated,and have to be numerically predicted. In a steady-state situation, the rectangular room modes willbe distributed as

p(x, y, z) =∑l,m,n

Al,m,n

[(cos

(lπx

L

)cos(mπyW

)cos(nπzH

))(

cos

(lπxsL

)cos(mπys

W

)cos(nπzsH

))](2.2)

given a source position (xs, ys, zs), a receiver position (x, y, z) and mode amplitudes Al,m,n. Thus,for a certain mode, if the source position is such that one of the cosine terms is zero, no sound willbe excited in theory.

The reverberation time is another important property of the room. Sabine’s classical equation,

T =0.161V

A, A =

∑i

Siαi (2.3)

where αi is the random-incidence absorption coefficient of surface Si, predicts the reverberationtime assuming a diffuse field. M. Schroeder found that a generalized requirement for a diffuse fieldis f ≥ fS = 2000

√T/V [10], called the Schroeder frequency, where T is the measured broadband

reverberation time and V is the room volume.

TT8303 Numerical Methods in Acoustics Semester Project

Page 12: FDTD Project report

6 CHAPTER 2. THEORY

For absorption coefficients close to one, we see that Sabine’s equation does not give close tozero reverberation time as expected. C. F. Eyring[10] reformulated the equation with

A = −S ln(1− α), α =∑i

Siαi/Stot (2.4)

which should be used for average absorption coefficients greater than 0.2-0.3. The absorption andreflection coefficients are defined as

α(θ) = 1− |R(θ)|2, R(θ) =prpi

(2.5)

i.e. the relationship between the reflected and incident pressure waves, assuming a plane waveincident at an angle θ.

2.2 Discretizing the wave equation in three dimensions

The FDTD method is used for solving the linear wave equation, given by

∂2p

∂x2+∂2p

∂y2+∂2p

∂z2− 1

c2∂2p

∂t2= 0 (2.6)

where p is the pressure field and c is the speed of sound. The equation can be approximated byfinite differences. The central difference for a second-order derivative is given by

∂2φi∂x2

≈ φi+1 − 2φi + φi−1

∆x2(2.7)

Equation (2.7) is derived from Taylor’s theorem[3], and it can be shown that the error is of orderO(∆x2). Approximating all the second derivatives in the wave equation gives

pkl+1,m,n − 2pkl,m,n + pkl−1,m,n

∆x2+pkl,m+1,n − 2pkl,m,n + pkl,m−1,n

∆y2

+pkl,m,n+1 − 2pkl,m,n + pkl,m,n−1

∆z2− 1

c2

pk+1l,m,n − 2pkl,m,n + pk−1

l−1,m,n

∆t2= 0 (2.8)

where pkl,m,n denotes the pressure node p(l∆x,m∆y, n∆z, k∆t) in a three-dimensional grid. If weassume the grid is uniformly spaced (i.e. ∆x = ∆y = ∆z = ∆h), we can rearrange and obtain theupdate equation for pk+1

l,m,n:

pk+1l,m,n = 2(1− 3λ2)pkl,m,n (2.9)

+ λ2(pkl+1,m,n + pkl−1,m,n + pkl,m+1,n + pkl,m−1,n + pkl,m,n+1 + pkl,m,n−1)

− pk−1l,m,n

where we define λ as the Courant number:

λ ≡ c∆t

∆h(2.10)

TT8303 Numerical Methods in Acoustics Semester Project

Page 13: FDTD Project report

2.3. STABILITY AND NUMERICAL DISPERSION 7

2.3 Stability and numerical dispersion

Two numerical issues with the FDTD method have to be discussed: Stability and dispersion.Stability means that under certain circumstances it is possible that the solution diverges and goesto infinity. The Courant number has to be positive, and it can be shown by von Neumann stabilityor the CFL condition that a criterion for numerical stability is λ ≤ 1/

√3 for the three-dimensional

case[3]. For the one dimensional case, the upper bound of λ is 1.

Numerical dispersion is the result of approximating the wave equation. The theoretical andnumerical phase velocity differs, and thus high frequency waves tend to travel slower than the realsound speed. In 2D and 3D simulations, dispersion is also dependent on the propagation direction ofthe wave, i.e. the axial, side-diagonal or diagonal direction. Actually, setting the Courant numberto its maximum, 1, in the 1D case, removes all numerical dispersion. It can also be shown that1/√

3 is the Courant number minimizing the numerical dispersion in the 3D case[6]. Observingthat the first term in the left side of Equation (2.9) vanishes when λ = 1/

√3, we can write

pk+1l,m,n = λ2(pkl+1,m,n + pkl−1,m,n + pkl,m+1,n + pkl,m−1,n + pkl,m,n+1 + pkl,m,n−1)− pk−1

l,m,n (2.11)

When using the FDTD method, the numerical dispersion will increase with frequency, up to acertain cut-off frequency where the waves essentially travel with zero phase velocity. The calculationof this cut-off frequency is out of the scope of this project, but for the update equation above, it canbe shown that the cut-off frequencies are 0.5fs, 0.304fs and 0.196fs for the diagonal(θ = 45◦, φ =35.3◦), side-diagonal(θ = 45◦, φ = 0◦) and axial wave propagation directions, respectively. Thus wecannot simulate sound waves with frequencies higher than 0.196fs with this particular numericalscheme. However, in the diagonal propagation direction, with λ = 1/

√3 no numerical dispersion

will occur (like the 1D case), and we can theoretically simulate up to 0.5fs with no error.

2.4 Other FDTD schemes

The update equation (2.9) is based on the Standard Leapfrog scheme (SLF). Other FDTD approx-imations which use more points in the space and time domain exist, and compact explicit schemescan be regarded as

pk+1l,m,n = f(pka,b,c)− pk−1

l,m,n, a = l − 1..l + 1, b = m− 1..m+ 1, c = n− 1..n+ 1 (2.12)

where it is possible to approximate from up to 26 points around the center. Implicit schemesalso exist, but are likely to need much more computational power. More advanced methods thanthe SLF method will not be discussed in detail here, however they are thoroughly investigated inKowalczyk’s PhD[6].

Yee’s original approach from 1966 to solve electromagnetic problems can also be used in acous-tics. Instead of discretizing the wave equation, the conservation of mass and momentum equationsare approximated, and we can solve for the pressure and velocity fields alternately. Yee’s methodshows the same stability and dispersion characteristics as the SLF scheme, and it is essentiallymathematically equivalent.

2.5 Source representations

We have now obtained equations for solving the wave equation in three dimensions inside a volume.We can find the pressure in node (l,m, n) for the time step k + 1 if we know the previous pressure

TT8303 Numerical Methods in Acoustics Semester Project

Page 14: FDTD Project report

8 CHAPTER 2. THEORY

values in the node and neighboring nodes. To obtain the values needed for the temporal boundaries(i.e. t = 0), we need initial conditions. The easiest way to deal with the initial conditions is to setall pressure values to zero. A source signal can then be input to the simulation in the next timesteps. It is also possible to start with an initial wave field.

2.5.1 Spatially distributed sources

Sakamoto, Nagatomo and Asakura [7] suggests an initial gaussian pulse

p(x, y, z) = exp

(−x

2 + y2 + z2

(A∆h)2

)(2.13)

where A decides the pulse width. The main spectral components will lie below 0.5c/(A∆x). Thegaussian pulse will then represent a source, and a wavelet will propagate outwards as the next timesteps are computed.

2.5.2 Time varying sources

While the initial wave field pulse may be a good choice for some applications, it is difficult toidentify the original signal[8]. Thus it is often more convenient to start with a ”clean” grid withzero pressure values, and input the source signal to a point in the grid (i.e. ps(t) = s(t)). This isknown as the hard source method, and can in some situations create substantial numerical artifactsbecause of a difference in the source and surrounding nodes update equations. By simply addingthe source signal to the already present signal in the source node (called the soft source method),we avoid the numerical artifacts, but the resulting source signal will be different. We then haveto measure the input signal in the source node. A third way to represent a source is to convolvethe source signal with the grid impulse response and subtract this from the source node, called atransparent source. A true transparent source is the best source type [8], but very computationallyheavy, and thus unpractical. However, by using an excitation signal with some beneficial properties,it is possible to obtain something almost as good as a true transparent source.

2.5.3 Signal type

Several signal types (also called excitation functions) have been proposed for the FDTD method.A popular one is the Gaussian pulse given by

s1(t) = exp

(−(t− t0)2

2σ2

)(2.14)

where σ decides the pulse width and t0 the peak position. This signal has a frequency spectrumsimilar to a low-pass filter, which removes high frequency components from the signal, but has somedisadvantages. Jeong et al.[8] found that a sine modulated Gaussian signal behaves much betterthan the Gaussian pulse when using a hard source, giving much less low frequency artifacts. Thesine modulated version is given as

s2(t) = − exp

(−(t− t0)2

2σ2

)sin(ω0(t− t0)) (2.15)

where ω0 is the centre frequency of the passband spectrum that this signal represents. A thirdsignal widely used in seismic applications is the Ricker wavelet (or ’Mexican hat’). This is the

TT8303 Numerical Methods in Acoustics Semester Project

Page 15: FDTD Project report

2.6. BOUNDARY CONDITIONS 9

second derivative of the Gaussian function, given as

s3(t) =

[1− 2

(πf0

(t− 1

f0

))2]

exp

[−(πf0

(t− 1

f0

))2]

(2.16)

where f0 is the peak frequency in the signal spectrum.There are thus different approaches on how to represent the source. One of the aims for this

project turned out to be how to implement the source in the best way. Jeong et al.[8] have foundthat a Time-Limited Sine-modulated Gaussian Hard source (TLSGH) behaves good when used inthe correct way, i.e. not too close to a wall or another source. This type of source avoids thelow-frequency artifacts resulting from the Gaussian method, as well as ”releasing” the source nodeby time-limiting the source signal. Different source types and excitation functions will be brieflyinvestigated later in this report, but for a detailed discussion of source methods, see Jeong’s paper.

2.6 Boundary conditions

The update Equation (2.9) shows how to update the nodes inside the volume and we now knowhow to do it from the time step t = 0. However, we need different equations at the boundary nodesto model spatial boundary conditions such as reflection, diffusion, absorption, and, in general,impedance. There are different methods to do this, a brief description of them will be given here.The methods for hard, frequency independent and frequency dependent boundaries are in generalacquired from Kowalczyk’s work on FDTD methods [6].

Figure 2.1 show how we need to eliminate the ”fictional” nodes outside the grid. We do not know,and do not want to know, the pressure values outside the boundaries. Thus, for the surface, edgeand corner boundary nodes we need to solve the wave equation in a different way. By introducingvarious boundary conditions relating to pressure and particle velocity, we can eliminate the fictionalnodes. Observe also that we can treat boundary nodes at edges and corners pointing into the roomjust as normal nodes inside the volume, using Equation (2.9).

In a room acoustic simulation, a combination of hard reflecting, absorbing and diffusing wallswill have to be used to model the correct materials.

2.6.1 Hard (perfectly reflecting) walls

The simplest case is the hard wall boundary condition. At a hard wall, we know that the particlevelocity normal to the wall is zero. The linear Euler’s equation in one dimension is given by:

∂ux∂t

= − 1

ρ0

∂p

∂x(2.17)

u = 0 in the x-direction so the derivative is 0. In the finite difference form we obtain:

uk+1 − uk−1

2∆t= −1

ρ

pL+1 − pL−1

2∆x= 0 (2.18)

and thus pL+1 = pL−1. For the (L,m,n) surface node we get can set pkL+1,m,n = pkL−1,m,n (we donot have any information about the fictional L+1 node) and obtain:

pk+1L,m,n = 2(1− 3λ2)pkL,m,n

+ λ2(2pkL−1,m,n + pkL,m+1,n + pkL,m−1,n + pkL,m,n+1 + pkL,m,n−1)− pk−1L,m,n (2.19)

TT8303 Numerical Methods in Acoustics Semester Project

Page 16: FDTD Project report

10 CHAPTER 2. THEORY

i,j,ki+1,j,k

i,j+1,k

i,j,k+1

i-1,j,k

i,j-1,k

i,j,k-1

X

Y

Z

(a) Standard leapfrog scheme node coor-dinates

i,j,k

i+1,j,k

i,j+1,ki,j,k+1

i-1,j,k

i,j-1,k

i,j,k-1

(b) A surface node

i,j,ki+1,j,k

i,j+1,k

i,j,k+1

i-1,j,k

i,j-1,k

i,j,k-1

(c) A node at the intersection be-tween to surfaces (edge)

i,j,k

i+1,j,k

i,j+1,k

i,j,k+1

i-1,j,k

i,j-1,k

i,j,k-1

(d) A corner node

i,j,ki+1,j,k

i,j+1,k

i,j,k+1

i-1,j,k

i,j-1,k

i,j,k-1

(e) A node at an edge pointing intothe room

i,j,k i+1,j,k

i,j+1,k

i,j,k+1

i-1,j,k

i,j-1,k

i,j,k-1

(f) A node at a corner pointing intothe room

Figure 2.1: Boundary nodes in our grid. Filled circles are nodes inside the grid, while transparent circlesare ”fictional nodes” outside the grid.

For an intersection between two surfaces (an edge) and for a corner we get, respectively:

pk+1L,M,n = 2(1− 3λ2)pkL,M,n + λ2(2pkL−1,M,n + 2pkL,M−1,n + pkL,M,n−1 + pkL,M,n+1)− pk−1

L,M,n (2.20)

pk+1L,M,N = 2(1− 3λ2)pkL,M,N + λ2(2pkL−1,M,N + 2pkL,M−1,N + 2pkL,M,N−1)− pk−1

L,M,N (2.21)

2.6.2 Frequency independent boundary conditions (Locally Reacting Surfaces)

To model absorption or transmission we can introduce a wall impedance at the boundary. For theL’th node in the x-direction, we can describe the wall with an impedance Zw, which describes theratio between pressure and particle velocity:

Zw =pL,m,nuL,m,n

(2.22)

The assumption that the particle velocity at a surface point is only dependent on the sound pressureat the point, and not on other points, is called a Locally Reacting Surface (LRS)[6], which in general

TT8303 Numerical Methods in Acoustics Semester Project

Page 17: FDTD Project report

2.6. BOUNDARY CONDITIONS 11

can be used to model planar surfaces that are unable to propagate vibrations in parallel with thesurface. The reflection factor from a surface with impedance Zw can be expressed as:

R(θ) =ξw cos(θ)− 1

ξw cos(θ) + 1, ξw = Zw/Z0 (2.23)

The LRS model is good for specularly reflecting surfaces, but as Zw approaches the characteristicimpedance of air, the reflection coefficient R(θ) is only zero for normal incidence. Thus ”anechoic”conditions will not work that well with locally reacting surfaces. Other methods such as thePerfectly Matched Layer (PML) method need to be used in such situations. We can rearrange andderivate Equation (2.22) with respect to time (generalizing and skipping the node indices):

∂p

∂t= Zw

∂ux∂t

(2.24)

Combining this with Euler’s linear Equation (2.17) we obtain

∂p

∂t= −Zw

ρ0

∂p

∂x= −cξw

∂p

∂x(2.25)

Now we can approximate this with finite differences, re-arrange and obtain

pk+1l − pk−1

l

2∆t= −cξw

pkl+1 − pkl−1

2∆x(2.26)

⇒ pkl+1 = − 1

cξw

∆x

∆t(pk+1l − pk−1

l ) + pkl−1

= − 1

λξw(pk+1l − pk−1

l ) + pkl−1, Z0 = ρ0c (2.27)

By inserting this into Equation (2.9) for the L’th node, we finally get

pk+1L,m,n =

[2(1− 3λ2)pkL,m,n + λ2(2pkL−1,m,n + pkL,m+1,n + ...)

+

ξw− 1

)pk−1L,m,n

]/

(1 +

λ

ξw

)(2.28)

Which means: To obtain the next node value, we only have to multiply the node with time index k-1with λ

ξw− 1 and divide the result by 1 + λ

ξwto model frequency independent absorption. Note that

for walls with different impedance we simply have to replace the following parts of the equation:

λ

ξw⇒ λ(

1

ξx+

1

ξy) (2.29)

for an edge andλ

ξw⇒ λ(

1

ξx+

1

ξy+

1

ξz) (2.30)

for a corner. We also have to multiply the pressure values at the opposite sides of the fictionalnodes with 2, just as in equations (2.19) - (2.20)

TT8303 Numerical Methods in Acoustics Semester Project

Page 18: FDTD Project report

12 CHAPTER 2. THEORY

2.6.3 Frequency dependent LRS boundaries

The ”ultimate goal” of boundary modeling is to simulate walls with frequency-dependent reflectionand absorption, which means we need to introduce boundaries with memory. A simple way to modela wall is to assume it contains resistance, spring and mass elements R, K and M. The impedancecan then be expressed as:

Zw(s) = R+Ms+K/s (2.31)

where s is the Laplacian variable. By transforming this to the z-domain and inserting it intoEquation (2.25) we can obtain a new update equation which can be used for these boundarytypes, needing only to store a few variables in the simulation. However, modeling walls as simplemass-spring-resistance systems is not a sufficient way to model real walls, which can have a muchmore complex frequency response than a simple mechanical system. Thus we need to extend theimpedance formulation to a more generalized one.

2.6.4 Modeling boundaries with Digital Impedance Filters

Kowalczyk[6] proposes using a Digital Impedance Filter (DIF) model to simulate the wall behavior.The boundary can be simulated with a digital IIR filter of any order. Assume we have a reflectioncoefficient R at a wall. A reflectance filter R0(z) can be designed for normal-incidence reflectiondata. This data could be acquired from the measured absorption coefficient α = 1 − |R|2. Notethat the phase information is not measured, and the reflection factor will not necessarily be phasecorrect. We can express the reflectance filter as

R0(z) =

N∑i=0

diz−i

N∑i=0

ciz−i

(2.32)

and the normalized wall impedance filter becomes

ξw(z) =1 +R0(z)

1−R0(z)=

N∑i=0

(ci + di)z−i

N∑i=0

(ci − di)z−i=

N∑i=0

biz−i

N∑i=0

aiz−i

, bi = ci + di, ai = ci − di (2.33)

Equation 2.26 now becomes

pk+1l − pk−1

l

2∆t= −cξw(z)

pkl+1 − pkl−1

2∆x(2.34)

By transforming the pressure pkl to the z-domain, doing some rearranging and transforming backto the time domain, it is possible to obtain update equations for the dimensional boundaries. Thederivation of these equations can be found in [6]. The final equation becomes:

pk+1L,m,n =

[2(1− 3λ2)pkL,m,n + λ2(2pkL−1,m,n + pkL,m+1,n + ...) +

λ2

b0gk

+

(λa0b0− 1

)pk−1L,m,n

]/

(1 +

λa0b0

)(2.35)

TT8303 Numerical Methods in Acoustics Semester Project

Page 19: FDTD Project report

2.7. DESIGNING DIGITAL IMPEDANCE FILTERS 13

For edges and corners, we can simply follow the same procedure as in chapter 2.6.2, and for thecorner we end up with

pk+1L,M,N =

[2(1− 3λ2)pkL,M,N + 2λ2(pkL−1,M,N + pkL,M−1,N + pkL,M,N−1)

+ λ2

(gkxb0,x

+gkyb0,y

+gkzb0,z

)+

(λa0,xb0,x

+λa0,yb0,y

+λa0,zb0,z

− 1

)pk−1L,m,n

]/

(1 +

λa0,xb0,x

+λa0,yb0,y

+λa0,zb0,z

)(2.36)

We have introduced a new variable gk for each coordinate direction, given by

gk =

N∑i=1

(bix

k−i − aiyk−i)

(2.37)

xk =a0λb0

(pk+1l,m,n − p

k−1l,m,n)− gk

b0(2.38)

yk =1

a0(b0x

k + gk) (2.39)

It can easily be seen that we can find the values of gk explicitly, by assuming g0 = 0. This boundaryis not valid for b0 = 0 or b0 = 1, which implies a reflection factor of -1 or no immediate reflection[6].Note also that the equations for xk and yk need to be updated after the equations for gk and pk+1.

2.7 Designing digital impedance filters

Obtaining suitable impedance filters is not a straight-forward task. One has to take two thingsinto consideration: Firstly, the filter must be stable, i.e. the poles must lie inside the unit circlein the z-plane. This can be done either by manually entering the zeros and poles of the filter, andadjusting it to fit a desired reflection filter response, or by using an optimization algorithm suchas the Least Pth-Norm Optimization algorithm. Secondly, the physical properties of the reflectionfilter must satisfy |R0(z)| ≤ 1, which implies a passive boundary, that does not reflect more energythan the incident wave energy. This results in the impedance filter ξw(z) being positive real, i.e.the real part of the impedance is positive over the whole frequency range.

To obtain the reflection filter, one can use Equation (2.23). The digital filter can then be fitto the frequency response of R(f, θ)|θ=0, and the impedance filter can be derived as shown in theprevious chapter. However, the absorption coefficient obtained from αn = 1 − |R(f, 0)|2 is thenormal-incidence absorption coefficient. To predict reverberation times through Sabine’s equationT = 0.161V/A, the random-incidence absorption coefficient is needed. This can be obtained by theintegral

αr =

∫ π/2

0α(θ) sin(2θ)dθ (2.40)

assuming a locally reacting surface [9]. The expression for the absorption coefficient can be foundfrom

α(θ) = 1− |R(θ)|2 = 1−∣∣∣∣ξw cos(θ)− 1

ξw cos(θ) + 1

∣∣∣∣2 (2.41)

TT8303 Numerical Methods in Acoustics Semester Project

Page 20: FDTD Project report

14 CHAPTER 2. THEORY

and the result of the integration becomes

αr =8

|ξw|cosβ

[1 +

cos 2β

|ξw| sinβtan−1

(|ξw| sinβ

1 + |ξw| cosβ

)

− cosβ

|ξw|ln(1 + 2|ξw| cosβ + |ξw|2)

], β = tan−1

(=(ξw)

<(ξw)

)(2.42)

It is also possible to design absorbers from theoretical formulas, resulting in frequency-dependentimpedances, and from these approximate impedance filters. Such absorber models can be used whenthe phase information of the reflection coefficient is crucial. The normal-incidence impedances of amembrane absorber and a porous absorber can be written like

Zg = Rm + jωm− jρ0c0 coth(kl) (2.43)

Zg =rd

3+ j

(ρ0ωd

3σ− ρ0c

20

ωσd

)(2.44)

whereRm is the system resistance, m is the mass-per-area and l is the cavity depth for the membraneabsorber, d the thickness of the porous material which is assumed much smaller than the wavelength.r is the flow resistance and σ is the porosity of the material. These formulas were taken from Vigran[10].

TT8303 Numerical Methods in Acoustics Semester Project

Page 21: FDTD Project report

15

CHAPTER 3

Matlab Implementation

This chapter briefly describes how the FDTD method has been implemented in Matlab. In additionto the main script FDTDscript, several other scripts were made for the different numerical exper-iments. However, they are not described in detail here, but comments can be found in the codeitself. Table 3.1 shows an overview of the different scripts and functions. Each m-file is explainedmore detailed in the following.

Function Name Description

FDTDscript.m Script for running 3D simulations. Defines constantsand room properties.

FDTDsimulation.m Runs a 3D FDTD simulation (run from FDTDscript)create2Dgrid.m Takes in (x,y) corner coordinates, and creates a 2D

node gridcreateBoundaryConditions.m Creates an impedance filter with invfreqzcreateBoundaryConditionsLeastPth.m Creates an impedance filter with iirlpnormccreateSourceSignal.m Creates a source signal (Impulse, Gaussian, Ricker or

TLSGH)findBoundaries.m Makes a 3D grid (with parallel floor/ceiling) and finds

properties of all boundary nodes

Table 3.1: Matlab scripts and functions

3.1 FDTDscript.m

This is the script that runs the whole simulation. It defines the following input parameters toFDTDsimulation: The length, width and height of the simulation space, the (x,y)-coordinatesof the two-dimensional corners (making it possible to angle the vertical walls), the simulationsampling rate, the positions of the source and receiver(s), source amplitude, bools which controlplotting during simulations, boundary type, boundary data for both frequency-independent andfrequency-dependent walls and the simulation duration.

TT8303 Numerical Methods in Acoustics Semester Project

Page 22: FDTD Project report

16 CHAPTER 3. MATLAB IMPLEMENTATION

Note that the digital impedance filter is made in this script, because the stability of this filterhas to be checked before a simulation can be run. Note also that all lengths are given in metres.

3.2 FDTDsimulation.m

This is the whole simulation procedure. It receives the constants defined in FDTDscript and thenexecutes the following: It defines internal constants, converts from metres to node indices, createsthe 2D floor grid, creates the 3D grid and identifies boundary nodes and their properties, initializesarrays, creates a source signal and finally runs the simulation loop. The loop itself consists ofupdating the interior and boundary nodes, adding source input, plotting and recording receiveroutputs.

3.3 create2Dgrid.m and findBoundaries.m

These two functions work together to identify the boundary nodes of the room. create2Dgrid takesin the corner coordinates of the side walls, and makes a 2D grid of ones and zeros, where the zerosare interior nodes. Then, findBoundaries adds a floor and a ceiling, identifies all boundaries, andreturns an array containing information about all the boundary nodes. This array contains locationand whether it is a surface, edge or corner node, and which neighbouring nodes are not fictionalnodes.

3.4 createBoundaryConditions.m and createBoundaryCondition-sLeastPth.m

The createBoundaryConditions function uses the Matlab function invfreqz to approximate a re-flection filter from a given complex frequency response. This method has some high frequencyinstability issues, so in general it should not be used. createBoundaryConditionsLeastPth uses theMatlab function iirlpnormc which fits a reflection filter to an arbitrary magnitude response ob-tained from absorption coefficients. Both methods create the impedance filter coefficients to beused in the simulations, and plots the resulting reflection filter.

3.5 createSourceSignal.m

This function simply creates the source signal, either ”Impulse”, ”Gaussian”, ”Ricker” or ”TLSGH”(Time-Limited Sine-modulated Gaussian Hard source). It also plots the source signal and frequencyspectrum.

TT8303 Numerical Methods in Acoustics Semester Project

Page 23: FDTD Project report

17

CHAPTER 4

Numerical Results

In this chapter, different properties of the FDTD method will be investigated with numericalexperiments. Focus will be on room acoustic simulations. For realistic simulations, we need thesource, medium, boundary and receiver representation to be accurate. We will look at sourceimplementations, numerical dispersion and different types of boundary conditions. The receiverrepresentation will not be experimented with in this project, only the recorded pressure at a nodewill be used, simulating an omnidirectional microphone. Directive sources such as loudspeakers willnot be implemented, however this would be important for simulating loudspeaker systems in roomacoustics. For all the simulations, the Courant number, λ, was set to the upper limit of 1/

√3.

4.1 Source implementations

Four different source implementations were implemented and tested in a simple environment: Thedelta pulse, the Gaussian function, the Ricker wavelet and the Time-Limited Sine-modulated Gaus-sian Hard source (TLSGH). Firstly, a ”free-field” response was measured at a distance of 3.33 metresfrom the source with a sampling rate of 8 kHz. The simulated room was 10x10x10 metres, whichprevented any reflections arriving before the direct sound had passed. Secondly, the impulse re-sponse of the room with hard walls was synthesized, investigating the long-term effects of using thedifferent sources. The sampling rate was set to 5kHz to reduce computational cost in this case.

Figure 4.1 shows the time and frequency responses of the Gaussian wavelet, Ricker wavelet andTLSGH wavelet. The delta pulse is not shown because of its well known flat frequency response.We can observe that the three signals have low-pass characteristics which contain almost no energyabove the axial cut-off frequency of 0.196fs. In addition, the Ricker wavelet and TLSGH wavelethas a high-pass characteristic that removes the DC content of the signals. The TLSGH waveletalso has much lower ripples in the frequency response, around -120dBFS compared to -80dBFS forthe Ricker wavelet.

TT8303 Numerical Methods in Acoustics Semester Project

Page 24: FDTD Project report

18 CHAPTER 4. NUMERICAL RESULTS

0 1 2 3 4 5

x 10−3

0

0.5

1

Time[s]

Am

plit

ud

e

Source signal

0 500 1000 1500 2000−80

−60

−40

−20

0

Source signal spectrum, fs = 8000 Hz

f[Hz]

Ma

gn

itu

de

[dB

]

(a) Gaussian wavelet

0 1 2 3 4 5

x 10−3

−0.5

0

0.5

1

Time[s]

Am

plit

ude

Source signal

0 500 1000 1500 2000−80

−60

−40

−20

0

Source signal spectrum, fs = 8000 Hz

f[Hz]

Magnitude[d

B]

(b) Ricker wavelet

0 1 2 3 4 5

x 10−3

−1

−0.5

0

0.5

1

Time[s]

Am

plit

ud

e

Source signal

0 500 1000 1500 2000−80

−60

−40

−20

0

Source signal spectrum, fs = 8000 Hz

f[Hz]

Ma

gn

itu

de

[dB

]

(c) TLSGH wavelet

Figure 4.1: Time and frequency responses of the different source types

The direct sound from all four source types are plotted in Figure 4.2 (linear amplitude) andFigure 4.3 (logarithmic amplitude). We can immediately see that the numerical dispersion messesup the delta pulse signal. Theoretically the pulse could maybe be used for some kinds of simulations,but it contains frequencies above the FDTD cut-off frequency, which implies high-frequency wavesmoving with low or no speed at all. Thus we do not get a zero pressure zone at the source positionshortly after the pulse, as would be expected in a physical situation. Figure 4.4 shows the soundfield in a section plane in the room, shortly after the the source input.

In the logarithmic plot of the direct sound signals, we can see that the Ricker wavelet has asomewhat larger dispersive tail than the two other signals. This is most likely due to more high-frequency content as can be seen in the frequency spectrum in Figure 4.1. Whether to choose theRicker or TLSGH wavelet is not obvious, but the weaker high frequency ripples in the latter maybe an advantage. There are however important reasons for not choosing the Gaussian wavelet, asdiscussed in chapter 2.5.3. The Gaussian source creates an artificial constant velocity which lastsuntil the source is freed (i.e. when the update equation is applied for the source node). Figure 4.5shows the disastrous low-frequency behavior (or rather DC drifting) of the Gaussian source whensimulating an impulse response in a hard-walled room.

TT8303 Numerical Methods in Acoustics Semester Project

Page 25: FDTD Project report

4.1. SOURCE IMPLEMENTATIONS 19

0 50 100 150 200 250

−1

0

1

Delta pulse

0 50 100 150 200 250

−1

0

1

Gaussian wavelet

0 50 100 150 200 250

−1

0

1

Ricker wavelet

0 50 100 150 200 250

−1

0

1

TLSGH wavelet

Figure 4.2: Source signal (dashed) and direct sound from different source types. Note that the receivedsignals are up-scaled.

0 50 100 150 200 250−100

−50

0

Gaussian wavelet

dB

0 50 100 150 200 250−100

−50

0

Ricker wavelet

dB

0 50 100 150 200 250−100

−50

0

TLSGH wavelet

dB

Figure 4.3: Source signal (dashed) and direct sound from different source types (log scale). The signals arenormalized to 0dB peak.

TT8303 Numerical Methods in Acoustics Semester Project

Page 26: FDTD Project report

20 CHAPTER 4. NUMERICAL RESULTS

Figure 4.4: Sound field shortly after an impulse has been injected into a room

0 500 1000 1500 2000 2500 3000−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

Samples

Am

plit

ud

e

Impulse response of different source signals

Gaussian

Ricker

TLSGH

Figure 4.5: Recorded impulse responses with hard walls for different source types

For this project, the TLSGH wavelet was chosen as the preferred source, since it shows similarbehavior to the Ricker wavelet, and is recommended by Jeong [8].

4.2 Measurement of numerical dispersion

To illustrate the effects of the numerical dispersion caused by the SLF scheme, the time response ofthe direct sound was simulated in the axial, side-diagonal and diagonal direction. In Figure 4.6 wecan see that the dispersive tail is longest in the axial direction, implying more dispersion than inthe other directions. This coheres with theory. However, it is a little difficult to tell the differencebetween the side-diagonal and diagonal measurements. This could be due to the shorter dispersivetail being hidden in the low frequency content of the time response (the excitation signal has verylittle high frequency content).

We can also compute the relative sound speed by measuring the transfer function between thesource and receiver positions. The transfer function can be calculated as the Fourier transform of

TT8303 Numerical Methods in Acoustics Semester Project

Page 27: FDTD Project report

4.2. MEASUREMENT OF NUMERICAL DISPERSION 21

0 50 100 150 200−150

−100

−50

0

Axial direction

dB

0 50 100 150 200−150

−100

−50

0

Side−diagonal direction

dB

0 50 100 150 200−150

−100

−50

0

Diagonal direction

dB

Figure 4.6: Time-domain dispersion for different propagation directions

the received signal divided by the Fourier transform of the source signal. By using the relations

∆t =θ

ω, c∆t = c∆t (4.1)

we can find the relative sound speed c/c by knowing the phase angle of the transfer function.Figure 4.7 shows the measured relative sound speed for the three propagation directions. Thesemeasurements confirm that the sound speed is slowest and the numerical dispersion is largest inthe axial direction. Note that the diagonal direction has a constant sound speed, implying nodispersion at all. This is in accordance with the theory from Kowalczyk [6]. Since the dispersionis lower for decreasing frequencies, the FDTD method is suitable for simulating low-frequencyphenomena which cannot be accurately modeled in geometrical acoustics approaches.

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.20.7

0.8

0.9

1

1.1Relative sound speed

c/c

0

f/fs

Axial

Side−Diagonal

Diagonal

Figure 4.7: Relative sound speed for different propagation directions

TT8303 Numerical Methods in Acoustics Semester Project

Page 28: FDTD Project report

22 CHAPTER 4. NUMERICAL RESULTS

4.3 Room modes

To investigate the modal properties of the FDTD method, modes in a hard-walled cubic room with10 metre sides was measured. A wavelet was excited in two positions; in the centre of the roomand in the corner, 1 metre from the walls. The receiver was placed in the centre and the oppositecorner, respectively. To reduce computation time the sampling rate was set to 4kHz and 1 secondof sound propagation was simulated.

0 20 40 60 80 100 120 140 160 180 200−10

0

10

20

30

40

f[Hz]

Am

plit

ud

e[d

B]

Figure 4.8: Room modes, centre source

Figure 4.8 shows the room frequency response below 200Hz for the centre source and receiverpositions, in addition to the theoretical room modes from Equation (2.1), shown as vertical dashedlines. Since the source and receiver are located at the centre, only even modes (i, j, k even) areexcited, and the theoretical odd modes are omitted from the plot. For low frequencies, the modes(which can be identified as peaks in the frequency response) coincide well with the theoreticalvalues. However, for higher frequencies, the simulated modes tend to drop in frequency. This isbecause the numerical sound speed decreases with frequency and the resonant frequencies whichare proportional to the sound speed will decrease. Note also that the theoretical lowest resonancefrequency of 17.15Hz is completely absent because of the centred source and receiver placement.

Figure 4.9 shows the sub-100Hz modes for the corner source/opposite corner receiver. Themode density is much larger as expected, and we clearly see the lowest resonance of 17.15Hz.

0 10 20 30 40 50 60 70 80 90 100−10

0

10

20

30

40

f[Hz]

Am

plit

ud

e[d

B]

Figure 4.9: Room modes, corner source

4.4 Angled walls - using FDTD to determine room resonances forcomplex shapes

One application of the FDTD method in room acoustics is to determine the resonance frequenciesof complex shapes, such as small recording studios. These types of problems are solvable with

TT8303 Numerical Methods in Acoustics Semester Project

Page 29: FDTD Project report

4.5. BOUNDARY CONDITIONS - SPECULAR REFLECTION 23

frequency methods, such as FEM, but annoying phenomena such as flutter echo needs geometricalmethods or other time-domain methods like the FDTD method. The simple cubic room fromchapter 4.3 was again simulated, but now with an angled wall as shown in Figure 4.10.

Source,

Receiver

10m

10m

6m

10m

Source,

Receiver

Figure 4.10: Cubic and complex-shaped test rooms

The measured frequency responses in Figure 4.11 show that the resonance frequencies tend tobe less pronounced when the wall is angled. The modes also seem a bit denser. However, this isjust an example of how the method can be used to determine resonance frequencies, and possiblyavoid ’boominess’ of small rooms.

0 10 20 30 40 50 60 70 80 90 100

0

20

40

f[Hz]

Am

plit

ud

e[d

B]

0 10 20 30 40 50 60 70 80 90 100

0

20

40

f[Hz]

Am

plit

ud

e[d

B]

Figure 4.11: Frequency responses of the cubic room (above) and complex-shaped room (below)

4.5 Boundary conditions - specular reflection

We now move over to the boundary conditions. Implementing correct boundary conditions iscrucial for the stability and accuracy of the simulation. To simulate specular reflections, a simplemeasurement setup shown in Figure 4.12 was used. First, the direct sound (1) was recorded inthe source node, as well as the response of an ”image receiver” (2) located at the opposite sideof the wall. Next, the dashed line was replaced with a wall, and the reflection response (3) wasthen recorded in the source node. To obtain a correct reflection signal, the direct sound (1) wassubtracted from the reflection (3). By applying the Fourier transforms to the resulting signals, it ispossible to calculate the reflection coefficient as function of frequency. Note that the signals weretruncated to eliminate other reflections, which creates some difficulties.

TT8303 Numerical Methods in Acoustics Semester Project

Page 30: FDTD Project report

24 CHAPTER 4. NUMERICAL RESULTS

Ls/2

(1),(3)

L

L

x

y

z

Figure 4.12: Reflection measurement setup

For the hard wall reflection, we get perfect results, i.e. the reflection coefficient is equal to oneover the whole frequency range (even above the FDTD cut-off frequency). Figure 4.13 shows thereflection factor up to the Nyquist frequency.

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.50.8

0.9

1

1.1

Reflection factor

f/fs

Am

plit

ude

Figure 4.13: Reflection from hard wall, Ls = 3 m, L = 7 m, fs = 8kHz

The reflectance of frequency-independent boundaries was tested with different reflection coef-ficients of 0.9, 0.5 and 0.2. Figure 4.14 shows that the reflection coefficient is no longer constant,because the numerical dispersion changes the reflection properties of the wall. For low reflectioncoefficients, the frequency dependency seems to be stronger, and actually the reflection is zero at apoint. This twisting of the reflection curve shows that the FDTD method in general, and the SLFscheme in particular, cannot reproduce frequency-independent reflection correctly for high frequen-cies compared to the cut-off frequency, at least not with the simple formulation in Equations (2.19)- (2.20). For frequencies just below the FDTD cut-off frequency, the reflectance has ripples. This isdue to truncating the impulse responses because simulating significantly longer impulse responseswithout unwanted reflections would require very long computation time. Note also that the rise forvery low frequencies is a result of the pressure wave not being plane [6].

TT8303 Numerical Methods in Acoustics Semester Project

Page 31: FDTD Project report

4.6. REVERBERATION TIME 25

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.20

0.5

1

Reflection factor

f/fs

Am

plit

ude

R = 0.9 R = 0.5 R = 0.2

Figure 4.14: Frequency independent reflection, R(0) = 0.5, Ls = 3 m, L = 7 m, fs = 8kHz

Finally, the reflectance of frequency-dependent boundaries was tested. Four different impedancefilters were tested, all of order 4. Different octave-band absorption coefficients were given to fit areflectance filter R(z). The values of these coefficient are not important, it is the difference betweentheoretical and simulated reflection coefficients that matter. Three of the reflectance filters wasdesigned to decrease with frequency, while the fourth was designed to have a low-frequency dipsimulating a resonant absorber. Figure 4.15 shows the simulated and theoretical reflectances,and it is clear that the reflectance error is larger for higher frequencies, just as in the frequency-independent case. However, for high reflectance values (which are present in reverberant rooms) theabsolute error is smaller, but it remains to show if the relative error is the same. The high frequencyripples are also a result of truncating the impulse responses. Low-frequency performance is rathergood, which strengthens the FDTD method’s ability to simulate low frequency phenomena.

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.20

0.2

0.4

0.6

0.8

1

1.2Reflection factor

f/fs

Am

plit

ude

Simulated Theoretical

Figure 4.15: Frequency dependent reflection, Ls = 3 m, L = 9 m, fs = 8kHz

4.6 Reverberation time

The most important of all room acoustic parametres is the reverberation time. Therefore, thereverberation time was simulated in rooms with different absorption and compared with the pre-dicted reverberation time from Sabine’s and Eyring’s equations. Both frequency-independent andfrequency-dependent boundaries were tested. In the frequency-independent situation, a reflectioncoefficient was defined and the normal and random incidence absorption coefficient was found withEquations (2.40) and (2.42). In the frequency-dependent situation, third-octave band reflection

TT8303 Numerical Methods in Acoustics Semester Project

Page 32: FDTD Project report

26 CHAPTER 4. NUMERICAL RESULTS

coefficients were fitted with a digital reflectance filter, and the normal-incidence absorption coef-ficients were obtained by sampling the reflectance filter. Finally the random-incidence absorptioncoefficients were calculated with Equation (2.42).

The simulated room measured 10x7x4 metres, as shown in Fig. 4.16. The source was placed at(2,2,2) metres and seven receivers were positioned randomly in the room. For all cases, the rever-beration time was predicted with Sabine’s formula (for low absorption coefficients) and Eyring’sformula (for high absorption coefficients). The sampling frequency was set to 12kHz and the simula-tion time to 75% of the maximum predicted reverberation time. This allows calculation of both T20and T30. To calculate these values, the integrated impulse response method was used, as describedin ISO 3382[11].

Figure 4.16: Simulated room, with source and seven receivers

Figure 4.17 shows simulated and predicted reverberation times in the room with frequency-independent boundaries. Here, R = 0.97, αn = 0.06 and αr = 0.11, with which we can predict thereverberation time to be 1.51 seconds by Sabine’s formula. The results show quite good correlationwith predicted values above 250Hz. Remember that we cannot assume a diffuse field under theSchroeder frequency (about 170Hz for this particular room), and thus Sabine’s formula is inaccuratefor frequencies lower than this. For the higher frequencies, we see a slightly shorter reverberationtime than predicted. This could have several reasons, but one of the reasons could very well be thefrequency-dependency introduced by dispersion, as shown in chapter 4.5. This indicates a lowerreflection coefficient, giving a shorter reverberation time. In addition, high-frequency waves travelslower due to the numerical errors, which will actually give a longer reverberation time (Sabine’sand Eyring’s equations are inverse proportional to c). The resulting effect of these phenomena arenot known, but the results indicate that they outweigh each other to a certain degree.

TT8303 Numerical Methods in Acoustics Semester Project

Page 33: FDTD Project report

4.6. REVERBERATION TIME 27

62.5 125 250 500 1000 2000 40000

0.5

1

1.5

2

2.5

3Reverberation time

F[Hz]

RT

(s)

Simulated, T20

Simulated, T30

Predicted, random incidence

Predicted, normal incidence

Figure 4.17: Simulated and predicted reverberation times, constant absorption

In figure 4.18 and 4.19 frequency-dependent boundaries were tested. A chosen set of absorptioncoefficients were fit with a 9th order impedance filter, giving the predicted reverberation times. Twosituations with low and high absorption, respectively, were tested. For both cases we see the samelow-frequency trend, which is a result of the sound field not being diffuse (the Schroeder frequencyis around 120Hz for the high absorption case and 200Hz for the low absorption case). However, themeasured reverberation times differ more at low frequencies in the high absorption case. The reasonfor this is not known, but it is possible that the sound field behaves more like plane normal-incidencewaves because of the rectangular room shape, thus giving reverberation times which looks morelike the predicted curve for normal-incidence absorption. In the high frequency region, we also seequite a large error (up to 50%). This is likely due to dispersion effects. Despite the discrepancies inthe high absorption room, the low absorption case gives fairly accurate results above the Schroederfrequency. This looks promising for the FDTD method, but larger rooms and higher samplingrates, giving diffuse field conditions over a broader frequency range, should be simulated to verifycorrect behavior.

62.5 125 250 500 1000 2000 40000

0.2

0.4

0.6

0.8

1

1.2

Reverberation time

F[Hz]

RT

(s)

Predicted, random incidence

Predicted, normal incidence

Simulated, T20

Simulated, T30

Figure 4.18: Simulated and predicted reverberation times, much absorption

TT8303 Numerical Methods in Acoustics Semester Project

Page 34: FDTD Project report

28 CHAPTER 4. NUMERICAL RESULTS

62.5 125 250 500 1000 2000 40000

0.5

1

1.5

2

2.5

3

3.5

4

Reverberation time

F[Hz]

RT

(s)

Predicted, random incidence

Predicted, normal incidence

Simulated, T20

Simulated, T30

Figure 4.19: Simulated and predicted reverberation times, little absorption

TT8303 Numerical Methods in Acoustics Semester Project

Page 35: FDTD Project report

29

CHAPTER 5

Discussion

5.1 Problem and purpose

This project has concerned simulation of room acoustic problems with the Finite-difference Time-domain method. Geometrical methods such as ray-tracing can simulate high-frequency acousticsquite accurately and efficiently, but for low-frequency simulations we need wave-based methods.Commercially available software mainly use geometrical approaches, because of the heavy compu-tational cost and memory load needed for wave-based simulations. This problem will however soonbe history, because of the rapid increase in computational efficiency and new parallel program-ming possibilities. Thus, much research has gone into wave-based methods over the last ten years,preparing them for use on future hardware.

Even though it would be possible to run simulations quickly, most wave-based methods have dis-advantages. The FDTD method suffers from numerical dispersion, and representations of sources,boundaries and receivers need thorough mathematical and physical foundations to be usable. Forexample, a source which does not behave as a real point source will create wrong impulse and fre-quency responses, even though the reverberation time and modal distribution will be quite accurate.This project investigates some of the FDTD method’s basic properties and challenges.

5.2 Findings

For the source implementations, different approaches exist in the literature ([7], [8]). It is possibleto initiate the grid with a certain wave field. However, a time-domain signal input to a node is amore preferred option, since it is possible to predict the behaviour of such methods. Four differentsource signals were tried out. A simple impulse does not work because of the high-frequency contentwhich becomes heavily dispersed. The Gaussian wavelet creates low-frequency artifacts as a resultof the lack of a rarefaction. The Ricker and TLSGH wavelets show good behaviour, both beingfree of DC content and time-limited. Time-limiting is essential because we do not want the sourcenode to affect the wave field after the wavelet has been excited. The TLSGH source behaves muchlike a true transparent source [8], and the Ricker wavelet has similar properties. However, moreresearch should be put into sources close to walls and multiple sources such as loudspeaker arrays.

Simple experiments showed that the numerical dispersion introduced in the grid is most promi-

TT8303 Numerical Methods in Acoustics Semester Project

Page 36: FDTD Project report

30 CHAPTER 5. DISCUSSION

nent in the axial directions, while it vanishes in the diagonal directions. This is only true for theSLF scheme, and better performance can be obtained with other numerical schemes [6], thoughthis is not discussed here. As a result of the dispersion, simulated room modes are only correctfor low frequencies. This is not a big issue, because room modes only occur at low frequencies inmost ordinary rooms. Thus we can combine geometrical ray-tracing methods with low-frequencywave-based methods in a complete room acoustic simulation.

Three types of boundary conditions were experimentally tested for normal-incidence reflection.Hard walls seems to work perfectly, giving a constant reflection factor equal to one for the wholefrequency range. Frequency-independent and -dependent boundary conditions cause the reflectanceto decrease with frequency, giving close to correct behaviour only for low frequencies. The reasonfor this is the numerical dispersion. However, simulations show that the obtained reverberationtimes correlate very well with predicted Sabine/Eyring reverberation times obtained from random-incidence absorption coefficients, at least for rooms with little absorption.

5.3 Implications and future work

From the results found above, we see that the FDTD method behaves very well at low frequencies.This solves the fundamental problem of geometrical acoustics approaches: Simulating low-frequencydiffraction effects. Applying more advanced numerical schemes can increase the frequency rangein which we can simulate with acceptable results, without needing significantly more computationpower. Previous studies ([12], [13]) show that this is possible with the use of GPU programming,giving real-time auralization of frequencies up to 1.5kHz with a maximum dispersion of 10%.

Future work includes studying directive sources, more advanced receivers such as human heads,more advanced numerical schemes and surface diffusion. Some work has been done on diffusion[6], but this still seems like a relatively new research field. In addition, programming issues suchas GPU computing and user-friendly interfaces needs more work. No practical commercial or freesoftware for FDTD simulations exist, to the author’s knowledge. Integrating ray-tracing, imagesource and wave-based methods can be a good approach to create a full room acoustic simulation.However, for simpler problems such as small recording studios, the FDTD method could very wellbe good enough itself when performance optimized. Finally, the effect of numerical dispersion andboundary models on auralization should be investigated. How does it sound?

TT8303 Numerical Methods in Acoustics Semester Project

Page 37: FDTD Project report

31

CHAPTER 6

Concluding remarks

The course TT8303 Numerical Methods in Acoustics is aimed to give students a basic introductionto numerical acoustics, in addition to a project which gives deeper insight to a certain method orproblem. The author chose the FDTD method because of it seemed like a quite simple method toimplement in practice, along with a general interest of room acoustics. After working a few weekswith the method, a lot of different topics appeared, but all of these could not be covered in such asmall project. However, the basics as well as selected numerical experiments were covered.

Advantages with the FDTD method showed to be the low-frequency accuracy, the ease toimplement the method for certain normal room shapes such as shoeboxes, as well as the theoreticalcorrectness of the method since it approximates the wave equation. Parallel implementation ispossible, giving the opportunity to make realistic models up to quite high frequencies on a singlecomputer.

Disadvantages include heavy computational cost and memory load on a single CPU/RAMconfiguration, numerical dispersion and challenges implementing realistic boundaries. In addition,a usable implementation for architectural acoustics would need models to be created with a 3Dmodeling program such as Sketchup, and then voxelized.

Working with this method has given the author much insight into numerical methods, especiallyvolume-based methods. This is a research field I would like to work more on in the future.

TT8303 Numerical Methods in Acoustics Semester Project

Page 38: FDTD Project report

32 CHAPTER 6. CONCLUDING REMARKS

TT8303 Numerical Methods in Acoustics Semester Project

Page 39: FDTD Project report

33

CHAPTER 7

Nomenclature and Constants

Nomenclature

BEM Boundary Element Method, a numerical method for solving PDEsCFL Courant-Friedrich-Lewy condition for solving PDEs with finite differencesdBFS deciBel relative to Full Scale, a way of measuring digital signal amplitudeDC Direct Current, i.e. the 0 Hz component of a signalDIF Digital Impedance FilterDWM Digital Waveguide Mesh, a numerical method mathematically equivalent

to the FDTD method with its maximum Courant numberFDM Finite Difference Method, a numerical method for solving PDEsFDFD Finite-Difference Frequency-Domain method, a variant of the FDM,

used for numerically solving the Helmholtz equationFDTD Finite-Difference Time-Domain method, a variant of the FDM,

used for solving the wave equationFEM Finite Element Method, a numerical method for solving PDEsGPU Graphics Processing UnitIIR Infinite Impulse Response, a digital filter typeLRS Locally Reacting Surface, a boundary modelPDE Partial Differential EquationPML Perfectly Matched Layer, a method to implement perfect absorptionSLF Standard Leap-Frog, the Finite Difference scheme implemented in this projectTLM Transmission Line Modeling, a numerical method for simulating wave fieldsTLSGH Time-Limited Sine-modulated Gaussian Hard source

TT8303 Numerical Methods in Acoustics Semester Project

Page 40: FDTD Project report

34 CHAPTER 7. NOMENCLATURE AND CONSTANTS

Constants

c The speed of sound in air, set to 343 m/s in the simulations.ρ0 The density of air, normally 1.21 kg/m3.Z0 The specific impedance of air, ρ0c.α Courant Number, c∆t/∆x, can be interpreted as the travel.

distance of sound between two time steps, divided by the node distance.

TT8303 Numerical Methods in Acoustics Semester Project

Page 41: FDTD Project report

35

Bibliography

[1] Jens H Rindel. The use of computer modeling in room acoustics. Journal of Vibroengineering,3(4), 2000.

[2] Jens M. Hovem. Marine Acoustics. NTNU, 2000.

[3] Ulf R. Kristiansen and Erlend M. Viggen. Computational methods in Acoustics. NTNU, 2011.

[4] http://www.comsol.com/.

[5] http://www.randteam.de/abec2/index.html.

[6] Konrad Kowalczyk. Boundary and medium modelling using compact finite difference schemesin simulations of room acoustics for audio and architectural design applications. PhD thesis,Sonic Arts Research Centre, Queen’s University Belfast, 2008.

[7] S Sakamoto, H Nagatomo, and T Asakura. Treatment of absorbing boundary conditions forFDTD analysis on room acoustics. 19th International Congress on Acoustics, Madrid 2007.

[8] Hyok Jeong and Yiu Wai Lam. Source implementation to eliminate low-frequency artifacts infinite difference time domain room acoustic simulation. The Journal of the Acoustical Sociteyof America, 131, January 2012.

[9] Dr. Yiu Wai Lam. Sabine and random incidence absorption coefficients. Acoustics of EnclosedSpaces, 1995.

[10] Tor Erik Vigran. Bygningsakustikk - et grunnlag. Tapir akademisk forlag, 2002.

[11] International Organization for Standardization. ISO 3382 Part 1 - Measurement of roomacoustic parameters in perforamance rooms, 2007.

[12] Lauri Savioja. Real-time 3D finite-difference time-domain simulation of low- and mid-frequencyroom acoustics. Proc. of the 13th Int. Conference on Digital Audio Effects (DAFx-10), Graz,Austria , September 6-10, 2010.

TT8303 Numerical Methods in Acoustics Semester Project

Page 42: FDTD Project report

36 BIBLIOGRAPHY

[13] J Scheaffer and B Fazenda. FDTD/K-DWM Simulation of 3D room acoustics on generalpurpose graphics hardware using compute unified device architecture (CUDA). Proceedings ofthe Institute of Acoustics, School of Computing, Science and Engineering, the University ofSalford, UK, 2010.

TT8303 Numerical Methods in Acoustics Semester Project