Skip to content

Commit

Permalink
Update notebooks to v0.7 syntax
Browse files Browse the repository at this point in the history
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
  • Loading branch information
darwindarak committed Jul 1, 2018
1 parent ab4f98c commit a4161c9
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 335 deletions.
17 changes: 9 additions & 8 deletions binder/notebooks/Conformally mapped body.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"metadata": {},
"outputs": [],
"source": [
"using Compat\n",
"using Plots\n",
"pyplot()\n",
"clibrary(:colorbrewer)\n",
Expand Down Expand Up @@ -65,7 +66,7 @@
}
],
"source": [
"a1 = 1; b1 = 0.1; ccoeff = Complex128[0.5(a1+b1),0,0.5(a1-b1)]\n",
"a1 = 1; b1 = 0.1; ccoeff = ComplexF64[0.5(a1+b1),0,0.5(a1-b1)]\n",
"c = 0.0+0.0im\n",
"α = π/4\n",
"b = Bodies.ConformalBody(ccoeff,c,α)\n",
Expand Down Expand Up @@ -459,8 +460,8 @@
}
],
"source": [
"a1 = 1; b1 = 0.1; ccoeff = Complex128[0.5(a1+b1),0,0.5(a1-b1)]\n",
"c = Complex128(0)\n",
"a1 = 1; b1 = 0.1; ccoeff = ComplexF64[0.5(a1+b1),0,0.5(a1-b1)]\n",
"c = ComplexF64(0)\n",
"α = π/4;\n",
"b = Bodies.ConformalBody(ccoeff,c,α)"
]
Expand Down Expand Up @@ -700,11 +701,11 @@
"ẋs = [(motion, allocate_velocity(init_ω_ζ)) for k = 1:4];\n",
"\n",
"# To keep track of element trajectories\n",
"track = Complex128[]\n",
"track = ComplexF64[]\n",
"append!(track,Elements.position(init_ω_z))\n",
"\n",
"# To keep track of linear impulse\n",
"imp = Complex128[]\n",
"imp = ComplexF64[]\n",
"append!(imp,Elements.impulse((b,init_ω_z)))"
]
},
Expand Down Expand Up @@ -855,7 +856,7 @@
"\n",
"nth = 400 # number of circumferential points\n",
"dth = 2π/nth\n",
"θ = linspace(0,2π,nth+1)\n",
"θ = Compat.linspace(0,2π,nth+1)\n",
"dr = dth\n",
"r = [1+eps]\n",
"while maximum(r) < rmax\n",
Expand Down Expand Up @@ -1007,7 +1008,7 @@
}
],
"source": [
"a1 = 1; b1 = 0.1; ccoeff = Complex128[0.5(a1+b1),0,0.5(a1-b1)];\n",
"a1 = 1; b1 = 0.1; ccoeff = ComplexF64[0.5(a1+b1),0,0.5(a1-b1)];\n",
"body = Bodies.ConformalBody(ccoeff,0.0+0.0im,π/4);\n",
"motion = RigidBodyMotion(1,0);\n",
"points = Vortex.Point.([-2, 2], 1.0);\n",
Expand All @@ -1028,7 +1029,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.6.2",
"display_name": "Julia 0.6.3-pre",
"language": "julia",
"name": "julia-0.6"
},
Expand Down
20 changes: 10 additions & 10 deletions binder/notebooks/Doublets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"source": [
"using PotentialFlow\n",
"using Plots\n",
"\n",
"using Compat\n",
"using Interact\n",
"\n",
"clibrary(:colorbrewer);\n",
Expand Down Expand Up @@ -749,8 +749,8 @@
],
"source": [
"freestream = Freestream(1.0);\n",
"ψ_levels = collect(linspace(-5, 5, 31))\n",
"X = Y = linspace(-3.5, 3.5, 100)\n",
"ψ_levels = collect(Compat.linspace(-5, 5, 31))\n",
"X = Y = Compat.linspace(-3.5, 3.5, 100)\n",
"streamlines(X, Y, freestream, levels = ψ_levels, color = streamline_colors)\n",
"plot!(cos.(0:0.1:2π), sin.(0:0.1:2π), linestyle = :dash)"
]
Expand Down Expand Up @@ -2171,7 +2171,7 @@
}
],
"source": [
"@manipulate for Δy in linspace(0, 1, 10)\n",
"@manipulate for Δy in Compat.linspace(0, 1, 10)\n",
"point = Vortex.Point.(0.5Δy*[im, -im], [-2π, 2π])\n",
"streamlines(X, Y, (point, freestream), levels = ψ_levels, color = streamline_colors)\n",
"plot!(cos.(0:0.1:2π), sin.(0:0.1:2π), linestyle = :dash)\n",
Expand Down Expand Up @@ -2889,7 +2889,7 @@
}
],
"source": [
"@manipulate for Δy = slider(linspace(0, 2, 10), value = 1.0)\n",
"@manipulate for Δy = slider(Compat.linspace(0, 2, 10), value = 1.0)\n",
"points = Vortex.Point.(0.5Δy*[im, -im], [-2π, 2π]./Δy)\n",
"streamlines(X, Y, (points, freestream), levels = ψ_levels, color = streamline_colors)\n",
"plot!(cos.(0:0.1:2π), sin.(0:0.1:2π), linestyle = :dash)\n",
Expand Down Expand Up @@ -4116,9 +4116,9 @@
"source": [
"Γ₁ = 1.0\n",
"zs = [1 + im, -1 + im, -1 - im, 1 - im]\n",
"@manipulate for Γ₂ in linspace(-Γ₁, Γ₁, 51),\n",
" Γ₃ in linspace(-Γ₁, Γ₁, 51),\n",
" Γ₄ in linspace(-Γ₁, Γ₁, 51)\n",
"@manipulate for Γ₂ in Compat.linspace(-Γ₁, Γ₁, 51),\n",
" Γ₃ in Compat.linspace(-Γ₁, Γ₁, 51),\n",
" Γ₄ in Compat.linspace(-Γ₁, Γ₁, 51)\n",
" points = Vortex.Point.(zs, [Γ₁, Γ₂, Γ₃, Γ₄])\n",
" streamlines(X, Y, points, color = streamline_colors)\n",
" plot!(points, markersize = 10, color = :RdBu)\n",
Expand Down Expand Up @@ -8514,7 +8514,7 @@
}
],
"source": [
"@manipulate for x in linspace(-2, 2, 21)\n",
"@manipulate for x in Compat.linspace(-2, 2, 21)\n",
"point = Vortex.Point(x + 1.2im, 10)\n",
"image = Vortex.Point(conj(1/point.z), -10)\n",
"streamlines(X, Y, (freestream, PotentialFlow.Doublets.Doublet(0.0im, π), point, image), levels = ψ_levels, color = streamline_colors)\n",
Expand All @@ -8526,7 +8526,7 @@
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Julia 0.6.0-pre.beta",
"display_name": "Julia 0.6.3-pre",
"language": "julia",
"name": "julia-0.6"
},
Expand Down
Loading

0 comments on commit a4161c9

Please sign in to comment.