Skip to content

Commit 5177d2f

Browse files
committed
Rename all variables and files with model -> simulation
1 parent 9472057 commit 5177d2f

29 files changed

+276
-276
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ particles = [p1,p2]
3737
Specify the angular frequency of the defualt incident plane wave ![incident plane wave](https://latex.codecogs.com/gif.latex?%5Cdpi%7B120%7D%20e%5E%7Bi%20%28k%20x%20-%20%5Comega%20t%29%7D) and calculate the response
3838
```julia
3939
w_arr = collect(0.1:0.01:1.)
40-
model = FrequencySimulation(particles, w_arr; source_direction = [1.0,0.0])
40+
simulation = FrequencySimulation(particles, w_arr; source_direction = [1.0,0.0])
4141
```
4242

4343
### Plot
4444
The package also provides recipes to be used with the `Plots` package for
45-
plotting models after they have been run.
46-
In our above model we ran the simulation for 100 different wavenumbers, and
45+
plotting simulations after they have been run.
46+
In our above simulation we ran the simulation for 100 different wavenumbers, and
4747
measured the response at the default location (-10.,0.).
4848
We can plot the time-harmonic response across these wavenumbers by typing:
4949
```julia
5050
using Plots
5151
pyplot()
52-
plot(model)
52+
plot(simulation)
5353
```
54-
![Plot of response against wavenumber](example/intro/plot_model.png)
54+
![Plot of response against wavenumber](example/intro/plot_simulation.png)
5555

5656
For a better overview you can plot the whole field for a specific k by typing:
5757
```julia
58-
plot(model,0.8)
58+
plot(simulation,0.8)
5959
```
6060
![Plot real part of acoustic field](example/intro/plot_field.png)
6161

@@ -64,7 +64,7 @@ This way we can get an understanding of what is happening for one particular
6464
wavenumber.
6565

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

6969
## More examples
7070
There are a lot of defaults implicit in this basic example.

example/box_size/box_size.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@ function box_size_convergence(m=4, volfrac = 0.05,
1010
seed = MersenneTwister(1).seed
1111
allparticles = random_particles(volfrac, radius, bigshape; seed = seed)
1212

13-
models = map(times) do t
13+
simulations = map(times) do t
1414
println("Calculating response with particles at a maximum of $t away")
1515
shape = TimeOfFlight(listener_position,t)
1616
particles = filter(p->inside(shape,p),allparticles)
1717
return FrequencySimulation(particles, k_arr; seed=seed, hankel_order=m)
1818
end
1919

20-
return map(m->TimeSimulation(m;time_arr=linspace(0.0,100.0,201)),models)
20+
return map(m->TimeSimulation(m;time_arr=linspace(0.0,100.0,201)),simulations)
2121
end
2222

23-
function plot_box_size_convergence(models;times = [20,30,40,50,60,70])
23+
function plot_box_size_convergence(simulations;times = [20,30,40,50,60,70])
2424

2525
colors = linspace(RGB(0.6,1,0.6),RGB(0,0.4,0),length(times))
2626

2727
plot(xlab="Time (t)",ylab="Response")
28-
for m in eachindex(models)
29-
plot!(models[m],color=colors[m],label="Box cut at t=$(times[m])")
28+
for s in eachindex(simulations)
29+
plot!(simulations[s],color=colors[s],label="Box cut at t=$(times[s])")
3030
end
3131
plot!(title="Time response from random particles from increasingly large boxes")
3232
end
3333

34-
models = box_size_convergence()
35-
plot_box_size_convergence(models)
34+
simulations = box_size_convergence()
35+
plot_box_size_convergence(simulations)

example/convergence/convergence.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,41 @@ function hankel_order_convergence(m=[0,1,2,3,4,5,6,7,8,9,10], volfrac = 0.1,
1010
seed = MersenneTwister(1).seed
1111
particles = random_particles(volfrac, radius, shape; seed = seed)
1212

13-
models = Vector{FrequencySimulation{Float64}}(length(m))
13+
simulations = Vector{FrequencySimulation{Float64}}(length(m))
1414

1515
for i = eachindex(m)
16-
models[i] = FrequencySimulation(particles, k_arr; seed=seed, hankel_order=m[i])
16+
simulations[i] = FrequencySimulation(particles, k_arr; seed=seed, hankel_order=m[i])
1717
end
1818

19-
return models
19+
return simulations
2020
end
2121

22-
function plot_hankel_order_convergence(models)
23-
responses = Vector{Vector{Complex{Float64}}}(length(models))
24-
m = Vector{Int64}(length(models))
22+
function plot_hankel_order_convergence(simulations)
23+
responses = Vector{Vector{Complex{Float64}}}(length(simulations))
24+
m = Vector{Int64}(length(simulations))
2525

2626
labels = Matrix{String}(1,0)
27-
for i = eachindex(models)
28-
responses[i] = reshape(models[i].response, size(models[i].response,1))
29-
m[i] = models[i].hankel_order
27+
for i = eachindex(simulations)
28+
responses[i] = reshape(simulations[i].response, size(simulations[i].response,1))
29+
m[i] = simulations[i].hankel_order
3030
labels = [labels "m = $(m[i])"]
3131
end
3232

3333
error = [r .- responses[end] for r in responses[1:end-1]]
34-
integrated_error = norm.(error).*map(m->((m.k_arr[end]-m.k_arr[1])/length(m.k_arr)),models[1:end-1])
34+
integrated_error = norm.(error).*map(m->((m.k_arr[end]-m.k_arr[1])/length(m.k_arr)),simulations[1:end-1])
3535

3636
colors = reshape(linspace(RGB(0.6,1,0.6),RGB(0,0.4,0),length(m)),1,length(m))
3737
realcolors = reshape(linspace(RGB(0.6,0.6,1),RGB(0,0,0.4),length(m)),1,length(m))
3838
imagcolors = reshape(linspace(RGB(1,0.6,0.6),RGB(0.4,0,0),length(m)),1,length(m))
3939

4040
absvec(v) = abs.(v)
4141
plot(
42-
plot(models[end],0.5),
43-
plot(models[1].k_arr, [real(responses),imag(responses)],
42+
plot(simulations[end],0.5),
43+
plot(simulations[1].k_arr, [real(responses),imag(responses)],
4444
labels=[ map(c -> "real "*c,labels) map(c -> "imag "*c,labels)],
4545
xlab="Wavenumber (k)", ylab="Response", linecolor=[realcolors imagcolors]
4646
),
47-
plot(models[1].k_arr, absvec.(error),
47+
plot(simulations[1].k_arr, absvec.(error),
4848
yscale=:log10, labels=labels, linecolor=colors,
4949
xlab="Wavenumber (k)", ylab="Absolute error",
5050
),
@@ -56,5 +56,5 @@ function plot_hankel_order_convergence(models)
5656

5757
end
5858

59-
models = hankel_order_convergence()
60-
plot_hankel_order_convergence(models)
59+
simulations = hankel_order_convergence()
60+
plot_hankel_order_convergence(simulations)

example/intro/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ particles = [p1,p2]
1010
Specify the angular frequency of the defualt incident plane wave ![incident plane wave](https://latex.codecogs.com/gif.latex?%5Cdpi%7B120%7D%20e%5E%7Bi%20%28k%20x%20-%20%5Comega%20t%29%7D) and calculate the response
1111
```julia
1212
w_arr = collect(0.1:0.01:1.)
13-
model = FrequencySimulation(particles, w_arr; source_direction = [1.0,0.0])
13+
simulation = FrequencySimulation(particles, w_arr; source_direction = [1.0,0.0])
1414
```
1515

1616
## Plot
1717
The package also provides recipes to be used with the `Plots` package for
18-
plotting models after they have been run.
19-
In our above model we ran the simulation for 100 different wavenumbers, and
18+
plotting simulations after they have been run.
19+
In our above simulation we ran the simulation for 100 different wavenumbers, and
2020
measured the response at the default location (-10.,0.).
2121
We can plot the time-harmonic response across these wavenumbers by typing:
2222
```julia
2323
using Plots
2424
pyplot()
25-
plot(model)
25+
plot(simulation)
2626
```
27-
![Plot of response against wavenumber](plot_model.png)
27+
![Plot of response against wavenumber](plot_simulation.png)
2828

2929
For a better overview you can plot the whole field for a specific k by typing:
3030
```julia
31-
plot(model,0.8)
31+
plot(simulation,0.8)
3232
```
3333
![Plot real part of acoustic field](plot_field.png)
3434

@@ -37,4 +37,4 @@ This way we can get an understanding of what is happening for one particular
3737
wavenumber.
3838

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

example/intro/intro.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ p2 = Particle([-2.,-2.])
55
particles = [p1,p2]
66

77
w_arr = collect(0.1:0.01:1.)
8-
model = FrequencySimulation(particles, w_arr)
8+
simulation = FrequencySimulation(particles, w_arr)
99

1010
using Plots
1111
pyplot()
12-
plot(model)
12+
plot(simulation)
1313

14-
savefig("plot_model.png")
14+
savefig("plot_simulation.png")
1515

16-
plot(model,0.8)
16+
plot(simulation,0.8)
1717
savefig("plot_field.png")
File renamed without changes.

example/lens/lens.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ function run_lens(;
1919
innershape = TimeOfFlight(listener_position,innertime)
2020
particles = filter(p -> !inside(innershape,p), outerparticles)
2121

22-
freqmodel = FrequencySimulation(particles, k_arr; listener_positions=listener_position)
22+
freqsimulation = FrequencySimulation(particles, k_arr; listener_positions=listener_position)
2323

24-
return freqmodel, TimeSimulation(freqmodel; impulse = get_gaussian_freq_impulse(1.0, 3./maximum(k_arr)^2))
24+
return freqsimulation, TimeSimulation(freqsimulation; impulse = get_gaussian_freq_impulse(1.0, 3./maximum(k_arr)^2))
2525
end
2626

2727
function plot_lens()
28-
freqmodel, TimeSimulation = run_lens()
28+
freqsimulation, TimeSimulation = run_lens()
2929

3030
plot(
31-
plot(freqmodel.particles),
31+
plot(freqsimulation.particles),
3232
plot(TimeSimulation)
3333
)
3434
end

example/moments/moments.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ function moments_example()
99
radius = 1.0
1010
k_arr = collect(linspace(0.01,1.0,100))
1111

12-
# Holder for our models
13-
models = Vector{FrequencySimulation{Float64}}(10)
12+
# Holder for our simulations
13+
simulations = Vector{FrequencySimulation{Float64}}(10)
1414
for i=1:10
15-
models[i] = FrequencySimulation(volfrac,radius,k_arr;seed=[0x7f5def91, 0x82255da3, 0xc5e461c7, UInt32(i)])
15+
simulations[i] = FrequencySimulation(volfrac,radius,k_arr;seed=[0x7f5def91, 0x82255da3, 0xc5e461c7, UInt32(i)])
1616
end
1717

18-
moments = StatisticalMoments(models)
18+
moments = StatisticalMoments(simulations)
1919
return moments
2020
end

example/random_particles/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ which wavenumbers (k) to evaluate at
1616
volfrac = 0.01
1717
radius = 1.0
1818
k_arr = collect(linspace(0.01,1.0,100))
19-
model = FrequencySimulation(volfrac,radius,k_arr)
19+
simulation = FrequencySimulation(volfrac,radius,k_arr)
2020
```
2121

2222
We use the `Plots` package to plot both the response at the listener position
2323
and the whole field for a specific wavenumber (k=0.8)
2424
```julia
2525
using Plots
2626
plot(
27-
plot(model),
28-
plot(model,0.8;res=100)
27+
plot(simulation),
28+
plot(simulation,0.8;res=100)
2929
)
3030
```
3131

32-
![Plot of response against wavenumber](plot_model.png)
32+
![Plot of response against wavenumber](plot_simulation.png)
3333

3434
![Plot real part of acoustic field](plot_field.png)
3535

File renamed without changes.

0 commit comments

Comments
 (0)