Skip to content

Commit

Permalink
Merge pull request #37 from Ariskar93/patch-2
Browse files Browse the repository at this point in the history
Updated README.md
  • Loading branch information
arturgower authored Jul 14, 2022
2 parents 3490f19 + 0ff216c commit 9042f64
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions docs/src/example/two_particles/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# Two particles

Define two particles with the first centred at [1.,-2.], with radius 1.0, sound speed 2.0 and density 10.0
Define two particles with the first centred at [1.0,-2.0], with radius 1.0, sound speed 2.0 and density 10.0.
```julia
using MultipleScattering
using Plots
pyplot()

p1 = Particle(Acoustic(2; c = 20.0, ρ = 10.),Sphere([1.,-4.], 1.0))
p2 = Particle(Acoustic(2; c = 1.0, ρ = 0.1),Sphere([3.,3.], 3.0))
p1 = Particle(Acoustic(2; c = 20.0, ρ = 10.0),Sphere([1.0,-4.0], 1.0))
p2 = Particle(Acoustic(2; c = 1.0, ρ = 0.1),Sphere([3.0,3.0], 3.0))
particles = [p1,p2]
```

Specify the angular frequency of the incident wave and calculate the response
Specify the angular frequency of the incident wave and calculate the response.
```julia
w_arr = collect(0.1:0.01:1.)
ωs = collect(0.1:0.01:1.0)
source = plane_source(Acoustic(1.0, 1.0, 2));
# calculate and plot the frequency response at x
# Calculate and plot the frequency response at x.
x = [[-10.0,0.0]];
simulation = run(particles, source, x, w_arr)
simulation = run(particles, source, x, ωs)
plot(simulation)
```
![Plot against frequency](plot_simulation.png)

The above used an incident plane with the default position at [0.0, 0.0] and x direction to change these defaults use
The above used an incident plane with the default position at [0.0, 0.0] and x direction. To change these defaults use:
```julia
x = [[-10.0,-10.0]]
source = plane_source(Acoustic(1.0, 1.0, 2); direction = [1.0,1.0], position = [0.0,0.0]);
simulation = run(particles, source, x, w_arr)
simulation = run(particles, source, x, ωs)
```
then plot the response around the particles and receiver
Then plot the response around the particles and receiver.
```julia
region = Box([[-11.;-11.], [6.;6.]])
w = 3.2
result = run(particles, source, region, [w]; res=80)
plot(result, w; field_apply=abs, seriestype = :contour)
region = Box([[-11.0;-11.0], [6.0;6.0]])
ω = 3.2
result = run(particles, source, region, [ω]; res=80)
plot(result, ω; field_apply=abs, seriestype = :contour)
```
![Plot absolute value of wave field](plot_field.png)

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.
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.

2 comments on commit 9042f64

@arturgower
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/64686

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.12 -m "<description of version>" 9042f64ec209b8df9e6aec1b627d889507b7863d
git push origin v0.1.12

Please sign in to comment.