-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from Ariskar93/patch-2
Updated README.md
- Loading branch information
Showing
1 changed file
with
15 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
9042f64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register()
9042f64
There was a problem hiding this comment.
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: