-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_geometry.jl
61 lines (53 loc) · 1.26 KB
/
test_geometry.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# TEST SINGLE VORTEX RING
include("vm2d.jl")
# create circle geometry
center = [0.0,0.0]
radius = 0.1
thetastart = 0.0
thetaend = 2*pi
refinement = 9
points = circlexy(center,radius,refinement,thetastart,thetaend)
# set vectorial vortex strengths
gamma = [0,0,1.0]
gammas = Array{Float64,1}[]
for point in points
push!(gammas,gamma)
end
# set initial particle velocities
vs = Array{Float64,1}[]
for point in points
v = Uinf(point)
push!(vs,v)
end
particles = place(points,gammas,vs)
# set simulation variables
name = "vortexrings"
global currenttime
currenttime = 0.0
timestep = 0.01
numtimesteps = 3
# plot
## OPTION 1: toggle 2D x-y plot
plt.plot()
plt.hot()
plt.axis("equal")
for particle in particles
plt.scatter(particle.x[1],particle.x[2],c=particle.gamma[3])
end
plt.title("time: "*string(round(currenttime; digits=3)))
## save frame
for i in range(1,length=numtimesteps)
## advance timestep
advance(particles,timestep,Uinf)
currenttime += timestep
## update plot
plt.clf()
for particle in particles
plt.scatter(particle.x[1],particle.x[2],c=particle.gamma[3])
end
plt.title("time: "*string(round(currenttime; digits=3)))
plt.axis("equal")
## save frame
# println(particles[1])
plt.pause(0.0001)
end