|
1 | 1 | # Two particles
|
2 | 2 |
|
3 |
| -Define two particles with the first centred at [1.,-2.], with radius 1.0, sound speed 2.0 and density 10.0 |
| 3 | +Define two particles with the first centred at [1.0,-2.0], with radius 1.0, sound speed 2.0 and density 10.0. |
4 | 4 | ```julia
|
5 | 5 | using MultipleScattering
|
6 | 6 | using Plots
|
7 | 7 | pyplot()
|
8 | 8 |
|
9 |
| -p1 = Particle(Acoustic(2; c = 20.0, ρ = 10.),Sphere([1.,-4.], 1.0)) |
10 |
| -p2 = Particle(Acoustic(2; c = 1.0, ρ = 0.1),Sphere([3.,3.], 3.0)) |
| 9 | +p1 = Particle(Acoustic(2; c = 20.0, ρ = 10.0),Sphere([1.0,-4.0], 1.0)) |
| 10 | +p2 = Particle(Acoustic(2; c = 1.0, ρ = 0.1),Sphere([3.0,3.0], 3.0)) |
11 | 11 | particles = [p1,p2]
|
12 | 12 | ```
|
13 | 13 |
|
14 |
| -Specify the angular frequency of the incident wave and calculate the response |
| 14 | +Specify the angular frequency of the incident wave and calculate the response. |
15 | 15 | ```julia
|
16 |
| -w_arr = collect(0.1:0.01:1.) |
| 16 | +ωs = collect(0.1:0.01:1.0) |
17 | 17 | source = plane_source(Acoustic(1.0, 1.0, 2));
|
18 |
| -# calculate and plot the frequency response at x |
| 18 | +# Calculate and plot the frequency response at x. |
19 | 19 | x = [[-10.0,0.0]];
|
20 |
| -simulation = run(particles, source, x, w_arr) |
| 20 | +simulation = run(particles, source, x, ωs) |
21 | 21 | plot(simulation)
|
22 | 22 | ```
|
23 | 23 | 
|
24 | 24 |
|
25 |
| -The above used an incident plane with the default position at [0.0, 0.0] and x direction to change these defaults use |
| 25 | +The above used an incident plane with the default position at [0.0, 0.0] and x direction. To change these defaults use: |
26 | 26 | ```julia
|
27 | 27 | x = [[-10.0,-10.0]]
|
28 | 28 | source = plane_source(Acoustic(1.0, 1.0, 2); direction = [1.0,1.0], position = [0.0,0.0]);
|
29 |
| -simulation = run(particles, source, x, w_arr) |
| 29 | +simulation = run(particles, source, x, ωs) |
30 | 30 | ```
|
31 |
| -then plot the response around the particles and receiver |
| 31 | +Then plot the response around the particles and receiver. |
32 | 32 | ```julia
|
33 |
| -region = Box([[-11.;-11.], [6.;6.]]) |
34 |
| -w = 3.2 |
35 |
| -result = run(particles, source, region, [w]; res=80) |
36 |
| -plot(result, w; field_apply=abs, seriestype = :contour) |
| 33 | +region = Box([[-11.0;-11.0], [6.0;6.0]]) |
| 34 | +ω = 3.2 |
| 35 | +result = run(particles, source, region, [ω]; res=80) |
| 36 | +plot(result, ω; field_apply=abs, seriestype = :contour) |
37 | 37 | ```
|
38 | 38 | 
|
39 | 39 |
|
40 |
| -the green circle in the plot is the receiver position. Looking at the region between the particles we see the complicated results of multiple scatttering. |
| 40 | +The green circle in the plot is the receiver position. Looking at the region between the particles we see the complicated results of multiple scatttering. |
0 commit comments