A Julia library for simulating, processing, and plotting multiple scattering of acoustic waves.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
example
src
test
.codecov.yml
.editorconfig
.gitignore
.travis.yml
CONTRIBUTORS.md
LICENSE.md
README.md
REQUIRE
appveyor.yml

README.md

MultipleScattering

DOI Build Status Coverage Status codecov.io

A Julia library for simulating, processing, and plotting multiple scattering of acoustic waves.

The library uses the multipole method to solve the Helmholtz equation (time-harmonic acoustics) in two dimensions. This method is particularly efficient at solving scattering problems for particles in an infinite domain. The library is configured to use T-matrices to represent scattering from particles with any shape and properities. Currently, T-matrices are provided for circular and capsule particles with any radius, density, sound speed and packing fraction. For details on the maths see Martin (1995) and Gower et al. (2017).

Near Surface Backscattering

If you are here to learn about Near Surface Backscattering, then click here to see an example. For details on the maths see Gower et al. (2018). To see how to take the moments of the backscattering click here.

Get started

This package is tested and works for Julia 0.6. To get started, download and include the library

Pkg.clone("https://github.com/jondea/MultipleScattering.jl.git")
using MultipleScattering

Simple example

Run

Define the properties of your host medium, for example

host_medium = Acoustic(2; ρ=1.0, c=1.0) # 2D acoustic medium with density ρ = 1.0 and soundspeed c = 1.0

an acoustic medium in 2D with density 1 and wavespeed 1.

Next, define two dense, circular acoustic particles, the first centred at [-2,2] with radius 2 and the second at [-2,-2] with radius 0.5,

particle_medium =  Acoustic(2; ρ=10.0, c=2.0) # 2D acoustic particle with density ρ = 10.0 and soundspeed c = 2.0
p1 = Particle(particle_medium, Circle([-2.0,2.0], 2.0))
p2 = Particle(particle_medium, Circle([-2.0,-2.0], 0.5))
particles = [p1,p2]

Lastly we define the source, for example an incident plane wave (incident plane wave) using a helper function.

source = plane_source(host_medium; direction = [1.0,0.0])

Once we have these three components, we can build our FrequencySimulation object

simulation = FrequencySimulation(host_medium, particles, source)

To get numerical results, we run our simulation for specific positions and angular frequencies,

x = [[-10.0,0.0], [0.0,0.0]]
max_ω = 1.0
ω = 0.01:0.01:max_ω
result = run(simulation, x, ω)

Plot

The package also provides recipes to be used with the Plots package for plotting simulations after they have been run. In our above simulation we ran the simulation for 100 different wavenumbers, and measured the response at the location (-10,0). We can plot the time-harmonic response across these wavenumbers by typing:

using Plots
plot(result)

Plot of response against wavenumber

For a better overview you can plot the whole field in space for a specific angular frequency by typing:

ω = 0.8
plot(simulation,ω)

Plot real part of acoustic field

This measures the field at lots of points in the domain, so we can get an understanding of what is happening for one particular angular frequency.

Note: most things in the package can be plotted by typing plot(thing) if you need an insight into a specific part of your simulation.

To calculate an incident plane wave pulse in time use:

time_result = frequency_to_time(result)
plot(time_result)

Plot real part of acoustic field Or for a Gaussian impulse in time:

t_vec = linspace(0.,700.,400)
time_result = frequency_to_time(result; t_vec = t_vec, impulse = GaussianImpulse(max_ω))
plot(time_result)

Plot real part of acoustic field

More examples

There are a lot of defaults implicit in this basic example. Almost every part of the problem can be controlled, for example we can manually construct the set of particles, define their positions, radii and give them specific material properties. For all examples see here.

Acknowledgements and contributing

This library was restructured from one written by Artur L Gower and Jonathan Deakin. Please contribute, if nothing else, criticism is welcome. We are relatively new to Julia, and this is our first package, if anything is untoward or even non-standard, please let us know.