Skip to content

Commit f6ad290

Browse files
committed
Update notebooks to v0.7 syntax
The `linspace` to `range` change is a bit awkward at the moment. Instead of `linspace(start,stop,len)`, we have to use `range(start, stop = stop, length = len)`. The `stop` keyword is only necessary in v0.7, and will [probably be relaxed](JuliaLang/julia#25896 (comment)) in v1.0
1 parent 5c93d4b commit f6ad290

8 files changed

+116
-335
lines changed

binder/notebooks/Conformally mapped body.ipynb

+9-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"metadata": {},
2323
"outputs": [],
2424
"source": [
25+
"using Compat\n",
2526
"using Plots\n",
2627
"pyplot()\n",
2728
"clibrary(:colorbrewer)\n",
@@ -65,7 +66,7 @@
6566
}
6667
],
6768
"source": [
68-
"a1 = 1; b1 = 0.1; ccoeff = Complex128[0.5(a1+b1),0,0.5(a1-b1)]\n",
69+
"a1 = 1; b1 = 0.1; ccoeff = ComplexF64[0.5(a1+b1),0,0.5(a1-b1)]\n",
6970
"c = 0.0+0.0im\n",
7071
"α = π/4\n",
7172
"b = Bodies.ConformalBody(ccoeff,c,α)\n",
@@ -459,8 +460,8 @@
459460
}
460461
],
461462
"source": [
462-
"a1 = 1; b1 = 0.1; ccoeff = Complex128[0.5(a1+b1),0,0.5(a1-b1)]\n",
463-
"c = Complex128(0)\n",
463+
"a1 = 1; b1 = 0.1; ccoeff = ComplexF64[0.5(a1+b1),0,0.5(a1-b1)]\n",
464+
"c = ComplexF64(0)\n",
464465
"α = π/4;\n",
465466
"b = Bodies.ConformalBody(ccoeff,c,α)"
466467
]
@@ -700,11 +701,11 @@
700701
"ẋs = [(motion, allocate_velocity(init_ω_ζ)) for k = 1:4];\n",
701702
"\n",
702703
"# To keep track of element trajectories\n",
703-
"track = Complex128[]\n",
704+
"track = ComplexF64[]\n",
704705
"append!(track,Elements.position(init_ω_z))\n",
705706
"\n",
706707
"# To keep track of linear impulse\n",
707-
"imp = Complex128[]\n",
708+
"imp = ComplexF64[]\n",
708709
"append!(imp,Elements.impulse((b,init_ω_z)))"
709710
]
710711
},
@@ -855,7 +856,7 @@
855856
"\n",
856857
"nth = 400 # number of circumferential points\n",
857858
"dth = 2π/nth\n",
858-
"θ = linspace(0,2π,nth+1)\n",
859+
"θ = Compat.linspace(0,2π,nth+1)\n",
859860
"dr = dth\n",
860861
"r = [1+eps]\n",
861862
"while maximum(r) < rmax\n",
@@ -1007,7 +1008,7 @@
10071008
}
10081009
],
10091010
"source": [
1010-
"a1 = 1; b1 = 0.1; ccoeff = Complex128[0.5(a1+b1),0,0.5(a1-b1)];\n",
1011+
"a1 = 1; b1 = 0.1; ccoeff = ComplexF64[0.5(a1+b1),0,0.5(a1-b1)];\n",
10111012
"body = Bodies.ConformalBody(ccoeff,0.0+0.0im,π/4);\n",
10121013
"motion = RigidBodyMotion(1,0);\n",
10131014
"points = Vortex.Point.([-2, 2], 1.0);\n",
@@ -1028,7 +1029,7 @@
10281029
],
10291030
"metadata": {
10301031
"kernelspec": {
1031-
"display_name": "Julia 0.6.2",
1032+
"display_name": "Julia 0.6.3-pre",
10321033
"language": "julia",
10331034
"name": "julia-0.6"
10341035
},

binder/notebooks/Doublets.ipynb

+10-10
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"source": [
125125
"using PotentialFlow\n",
126126
"using Plots\n",
127-
"\n",
127+
"using Compat\n",
128128
"using Interact\n",
129129
"\n",
130130
"clibrary(:colorbrewer);\n",
@@ -749,8 +749,8 @@
749749
],
750750
"source": [
751751
"freestream = Freestream(1.0);\n",
752-
"ψ_levels = collect(linspace(-5, 5, 31))\n",
753-
"X = Y = linspace(-3.5, 3.5, 100)\n",
752+
"ψ_levels = collect(Compat.linspace(-5, 5, 31))\n",
753+
"X = Y = Compat.linspace(-3.5, 3.5, 100)\n",
754754
"streamlines(X, Y, freestream, levels = ψ_levels, color = streamline_colors)\n",
755755
"plot!(cos.(0:0.1:2π), sin.(0:0.1:2π), linestyle = :dash)"
756756
]
@@ -2171,7 +2171,7 @@
21712171
}
21722172
],
21732173
"source": [
2174-
"@manipulate for Δy in linspace(0, 1, 10)\n",
2174+
"@manipulate for Δy in Compat.linspace(0, 1, 10)\n",
21752175
"point = Vortex.Point.(0.5Δy*[im, -im], [-2π, 2π])\n",
21762176
"streamlines(X, Y, (point, freestream), levels = ψ_levels, color = streamline_colors)\n",
21772177
"plot!(cos.(0:0.1:2π), sin.(0:0.1:2π), linestyle = :dash)\n",
@@ -2889,7 +2889,7 @@
28892889
}
28902890
],
28912891
"source": [
2892-
"@manipulate for Δy = slider(linspace(0, 2, 10), value = 1.0)\n",
2892+
"@manipulate for Δy = slider(Compat.linspace(0, 2, 10), value = 1.0)\n",
28932893
"points = Vortex.Point.(0.5Δy*[im, -im], [-2π, 2π]./Δy)\n",
28942894
"streamlines(X, Y, (points, freestream), levels = ψ_levels, color = streamline_colors)\n",
28952895
"plot!(cos.(0:0.1:2π), sin.(0:0.1:2π), linestyle = :dash)\n",
@@ -4116,9 +4116,9 @@
41164116
"source": [
41174117
"Γ₁ = 1.0\n",
41184118
"zs = [1 + im, -1 + im, -1 - im, 1 - im]\n",
4119-
"@manipulate for Γ₂ in linspace(-Γ₁, Γ₁, 51),\n",
4120-
" Γ₃ in linspace(-Γ₁, Γ₁, 51),\n",
4121-
" Γ₄ in linspace(-Γ₁, Γ₁, 51)\n",
4119+
"@manipulate for Γ₂ in Compat.linspace(-Γ₁, Γ₁, 51),\n",
4120+
" Γ₃ in Compat.linspace(-Γ₁, Γ₁, 51),\n",
4121+
" Γ₄ in Compat.linspace(-Γ₁, Γ₁, 51)\n",
41224122
" points = Vortex.Point.(zs, [Γ₁, Γ₂, Γ₃, Γ₄])\n",
41234123
" streamlines(X, Y, points, color = streamline_colors)\n",
41244124
" plot!(points, markersize = 10, color = :RdBu)\n",
@@ -8514,7 +8514,7 @@
85148514
}
85158515
],
85168516
"source": [
8517-
"@manipulate for x in linspace(-2, 2, 21)\n",
8517+
"@manipulate for x in Compat.linspace(-2, 2, 21)\n",
85188518
"point = Vortex.Point(x + 1.2im, 10)\n",
85198519
"image = Vortex.Point(conj(1/point.z), -10)\n",
85208520
"streamlines(X, Y, (freestream, PotentialFlow.Doublets.Doublet(0.0im, π), point, image), levels = ψ_levels, color = streamline_colors)\n",
@@ -8526,7 +8526,7 @@
85268526
"metadata": {
85278527
"celltoolbar": "Slideshow",
85288528
"kernelspec": {
8529-
"display_name": "Julia 0.6.0-pre.beta",
8529+
"display_name": "Julia 0.6.3-pre",
85308530
"language": "julia",
85318531
"name": "julia-0.6"
85328532
},

0 commit comments

Comments
 (0)