-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_debug.jl
45 lines (36 loc) · 914 Bytes
/
test_debug.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# debug script
pos = particles[2].x
for particle in particles
vi = vinduced(particle,pos)
println(vi)
end
# passed
for particle in particles
vi = netv(particles, particle.x) .+ Uinf(particle.x)
println(vi)
end
# passed
for particle in particles
println(netv(particles, particle.x) .+ Uinf(particle.x))
end
# passed
timestep = 0.01
for particle in particles
newx = particle.x + particle.v * timestep
println(newx)
end
# passed
for particle in particles
particle.v .= netv(particles, particle.x) .+ Uinf(particle.x)
end
# DID NOT PASS
function advance(particles::Array{Particle,1},timestep::Float64,Uinf)
# update velocity of each particle
for particle in particles
particle.v .= netv(particles, particle.x) .+ Uinf(particle.x)
end
# move each particle
for particle in particles
particle.x .= particle.x + particle.v * timestep
end
end