From f6ad290506329568665f005d66d099c8e27c1643 Mon Sep 17 00:00:00 2001 From: Darwin Darakananda Date: Sat, 30 Jun 2018 12:04:40 -0400 Subject: [PATCH] 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](https://github.com/JuliaLang/julia/pull/25896#issuecomment-365726197) in v1.0 --- .../notebooks/Conformally mapped body.ipynb | 17 +- binder/notebooks/Doublets.ipynb | 20 +-- binder/notebooks/Pitching Plate - K07.ipynb | 115 +++----------- binder/notebooks/Point Source Demo.ipynb | 18 +-- .../Translating Plate - 20\302\260.ipynb" | 121 +++----------- .../Translating Plate - 60\302\260.ipynb" | 9 +- binder/notebooks/Vortex Sheet Roll-up.ipynb | 149 ++++-------------- test/notebooks.jl | 2 +- 8 files changed, 116 insertions(+), 335 deletions(-) diff --git a/binder/notebooks/Conformally mapped body.ipynb b/binder/notebooks/Conformally mapped body.ipynb index d2492c2..64fb42a 100644 --- a/binder/notebooks/Conformally mapped body.ipynb +++ b/binder/notebooks/Conformally mapped body.ipynb @@ -22,6 +22,7 @@ "metadata": {}, "outputs": [], "source": [ + "using Compat\n", "using Plots\n", "pyplot()\n", "clibrary(:colorbrewer)\n", @@ -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", @@ -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,α)" ] @@ -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)))" ] }, @@ -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", @@ -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", @@ -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" }, diff --git a/binder/notebooks/Doublets.ipynb b/binder/notebooks/Doublets.ipynb index 3d1fb2c..0ae8b11 100644 --- a/binder/notebooks/Doublets.ipynb +++ b/binder/notebooks/Doublets.ipynb @@ -124,7 +124,7 @@ "source": [ "using PotentialFlow\n", "using Plots\n", - "\n", + "using Compat\n", "using Interact\n", "\n", "clibrary(:colorbrewer);\n", @@ -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)" ] @@ -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", @@ -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", @@ -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", @@ -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", @@ -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" }, diff --git a/binder/notebooks/Pitching Plate - K07.ipynb b/binder/notebooks/Pitching Plate - K07.ipynb index 5245c42..5291ecf 100644 --- a/binder/notebooks/Pitching Plate - K07.ipynb +++ b/binder/notebooks/Pitching Plate - K07.ipynb @@ -2,10 +2,7 @@ "cells": [ { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "# Pitchup at $k = 0.7$" ] @@ -29,6 +26,7 @@ }, "outputs": [], "source": [ + "using Compat\n", "using Plots\n", "\n", "clibrary(:colorbrewer)\n", @@ -38,10 +36,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "## Setup" ] @@ -56,11 +51,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -87,10 +78,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Once we have advected all the vortex elements, we release new segments of the vortex sheet from the edges of the plate.\n", "Since we are dealing with a low angle of attack case, only the trailing edge will be forced to satisfy the Kutta condition.\n", @@ -100,11 +88,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -134,20 +118,14 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "### Motion Parameters" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We start with a plate at around 5ᵒ that smoothly pitches up to 90ᵒ, while moving forward at a constant velocity" ] @@ -155,11 +133,7 @@ { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "L = 1.0 # length of the plate\n", @@ -180,10 +154,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "### Discretization and Initialization" ] @@ -191,15 +162,11 @@ { "cell_type": "code", "execution_count": 6, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "N = 128\n", - "plate = Plate(N, L, zero(Complex128), pitchup.α(0))\n", + "plate = Plate(N, L, zero(ComplexF64), pitchup.α(0))\n", "\n", "Δt = 1e-2\n", "\n", @@ -223,7 +190,7 @@ "sys₊ = deepcopy(sys₀) # Used for storage during time-marching\n", "ẋs = (motion, allocate_velocity(blobs))\n", "\n", - "forces = Complex128[];" + "forces = ComplexF64[];" ] }, { @@ -236,11 +203,7 @@ { "cell_type": "code", "execution_count": 7, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "T = 0.0:Δt:8.0\n", @@ -267,11 +230,7 @@ { "cell_type": "code", "execution_count": 8, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -291,11 +250,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -315,20 +270,14 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "### Alternate ramp functions" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The `Motion` type has four fields\n", "- `ċ` is the current centroid velocity\n", @@ -346,9 +295,7 @@ "cell_type": "code", "execution_count": 10, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -364,21 +311,17 @@ "end;\n", "\n", "motion = Plates.RigidBodyMotion(pitchup);\n", - "plate = Plate(N, L, zero(Complex128), pitchup.α(0))\n", + "plate = Plate(N, L, zero(ComplexF64), pitchup.α(0))\n", "\n", "sys = (plate, sys₀[2])\n", "sys₊ = deepcopy(sys)\n", - "forces = Complex128[];" + "forces = ComplexF64[];" ] }, { "cell_type": "code", "execution_count": 11, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "for t in T\n", @@ -403,11 +346,7 @@ { "cell_type": "code", "execution_count": 12, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -427,11 +366,7 @@ { "cell_type": "code", "execution_count": 13, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -452,7 +387,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Julia 0.6.1-pre", + "display_name": "Julia 0.6.3-pre", "language": "julia", "name": "julia-0.6" }, diff --git a/binder/notebooks/Point Source Demo.ipynb b/binder/notebooks/Point Source Demo.ipynb index 6bd0266..b96caa2 100644 --- a/binder/notebooks/Point Source Demo.ipynb +++ b/binder/notebooks/Point Source Demo.ipynb @@ -46,7 +46,7 @@ "end\n", "\n", "using PotentialFlow \n", - "\n", + "using Compat\n", "# Set default plotting options\n", "using Plots\n", "default(markerstrokealpha = 0, legend = false, ratio = 1,\n", @@ -268,7 +268,7 @@ "metadata": {}, "outputs": [], "source": [ - "tracer_start = -3.0 .+ linspace(-3,3,30)*im;\n", + "tracer_start = -3.0 .+ Compat.linspace(-3,3,30)*im;\n", "T = 0:1e-2:20\n", "\n", "freestream = trace_pathlines((), U∞, tracer_start, T)\n", @@ -21733,7 +21733,7 @@ } ], "source": [ - "function simulate_flow(sources, Δs, n̂, U∞; tracer_start = -3.0 .+ linspace(-3,3,30)*im, T = 0:1e-2:20)\n", + "function simulate_flow(sources, Δs, n̂, U∞; tracer_start = -3.0 .+ Compat.linspace(-3,3,30)*im, T = 0:1e-2:20)\n", " b = -component.(n̂, U∞);\n", "\n", " A = [component(n, induce_velocity(target, source, 0)) for (n, target) in zip(n̂, targets), source in sources]\n", @@ -24373,7 +24373,7 @@ } ], "source": [ - "θ = linspace(0, 2π, 101)[1:end-1]\n", + "θ = Compat.linspace(0, 2π, 101)[1:end-1]\n", "Δs = fill(step(θ), length(θ))\n", "sources = Source.Point.(exp.(im.*θ), 1.0);\n", "targets = Elements.position.(sources)\n", @@ -40484,7 +40484,7 @@ } ], "source": [ - "plt, actual_sources, tracers = simulate_flow(sources, Δs, n̂, -im, tracer_start = linspace(-3,3,40) .+ 3im)\n", + "plt, actual_sources, tracers = simulate_flow(sources, Δs, n̂, -im, tracer_start = Compat.linspace(-3,3,40) .+ 3im)\n", "plt" ] }, @@ -42689,7 +42689,7 @@ } ], "source": [ - "θ = linspace(π/6, 5π/6, 100)\n", + "θ = Compat.linspace(π/6, 5π/6, 100)\n", "Δs = step(θ)\n", "targets = exp.(-im*θ)\n", "n̂ = targets;\n", @@ -42706,7 +42706,7 @@ "#Δs = abs.(gradient(targets))\n", "\n", "\n", - "θᵢ = linspace(0, 2π, 30)[1:end-1]\n", + "θᵢ = Compat.linspace(0, 2π, 30)[1:end-1]\n", "left_eye = 0.1exp.(im*θᵢ) - 0.5 + 0.2im\n", "right_eye = 0.1exp.(im*θᵢ) + 0.5 + 0.2im;\n", "\n", @@ -53250,7 +53250,7 @@ } ], "source": [ - "plt, actual_sources, tracers = simulate_flow(sources, Δs, n̂, -1.0im, tracer_start = linspace(-3,3,41) .+ 3im)\n", + "plt, actual_sources, tracers = simulate_flow(sources, Δs, n̂, -1.0im, tracer_start = Compat.linspace(-3,3,41) .+ 3im)\n", "plt" ] }, @@ -61648,7 +61648,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Julia 0.6.2", + "display_name": "Julia 0.6.3-pre", "language": "julia", "name": "julia-0.6" }, diff --git "a/binder/notebooks/Translating Plate - 20\302\260.ipynb" "b/binder/notebooks/Translating Plate - 20\302\260.ipynb" index d2f17d3..61023e0 100644 --- "a/binder/notebooks/Translating Plate - 20\302\260.ipynb" +++ "b/binder/notebooks/Translating Plate - 20\302\260.ipynb" @@ -2,10 +2,7 @@ "cells": [ { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "# Translating Plate at 20°" ] @@ -14,31 +11,24 @@ "cell_type": "code", "execution_count": 1, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ - "using PotentialFlow" + "using PotentialFlow\n", + "using Compat" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "## Set up" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "At the beginning of every time-step, we first determine the bound vortex sheet strength required to satisfy the no-flow-through condition, then velocity of all vortex elements:" ] @@ -46,11 +36,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -77,10 +63,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Once we have advected all the vortex elements, we release new segments of the vortex sheet from the edges of the plate.\n", "Since we are dealing with a low angle of attack case, only the trailing edge will be forced to satisfy the Kutta condition.\n", @@ -90,11 +73,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -124,20 +103,14 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "### Discretize the plate and sheets" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We are simulating a flat plate with zero thickness impulsively translating horizontally at a fixed velocity and angle of attack" ] @@ -145,11 +118,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "L = 2.0 # chord length\n", @@ -160,16 +129,13 @@ "\n", "Δt = 1e-2; # time step\n", "\n", - "plate = Plate(N, L, zero(Complex128), α)\n", + "plate = Plate(N, L, zero(ComplexF64), α)\n", "motion = Plates.RigidBodyMotion(ċ, 0.0);" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We place the initial segments of the vortex sheets perpendicularly off each edge of the plate.\n", "The sheets themselves are represented as discrete vortex blobs, all with the same blob radius `δ`.\n", @@ -179,11 +145,7 @@ { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -217,11 +179,7 @@ { "cell_type": "code", "execution_count": 6, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -247,10 +205,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We organize the flow elements into the plate and ambient elements." ] @@ -259,9 +214,7 @@ "cell_type": "code", "execution_count": 7, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -272,20 +225,14 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "## Time-Marching" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We use forward Euler to evolve the system and apply filtering on both the leading and trailing edge vortex sheets to surpress small-scale instabilities." ] @@ -293,11 +240,7 @@ { "cell_type": "code", "execution_count": 8, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "tf = 9\n", @@ -319,20 +262,14 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "## Plotting" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Most flow elements in the library has [plot recipes](https://github.com/JuliaPlots/RecipesBase.jl) defined for them.\n", "So once [`Plots.jl`](https://github.com/JuliaPlots/Plots.jl) is installed along with the appropriate backend, we can directly call `plot` on the potential flow elements." @@ -341,11 +278,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -366,9 +299,7 @@ { "cell_type": "code", "execution_count": 10, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -390,7 +321,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Julia 0.6.1-pre", + "display_name": "Julia 0.6.3-pre", "language": "julia", "name": "julia-0.6" }, diff --git "a/binder/notebooks/Translating Plate - 60\302\260.ipynb" "b/binder/notebooks/Translating Plate - 60\302\260.ipynb" index bd4052c..a26f610 100644 --- "a/binder/notebooks/Translating Plate - 60\302\260.ipynb" +++ "b/binder/notebooks/Translating Plate - 60\302\260.ipynb" @@ -13,7 +13,8 @@ "metadata": {}, "outputs": [], "source": [ - "using PotentialFlow" + "using PotentialFlow\n", + "using Compat" ] }, { @@ -125,7 +126,7 @@ "\n", "Δt = 1e-2; # time step\n", "\n", - "plate = Plate(N, L, zero(Complex128), α)\n", + "plate = Plate(N, L, zero(ComplexF64), α)\n", "motion = Plates.RigidBodyMotion(ċ, 0.0);" ] }, @@ -220,7 +221,7 @@ "# Storage for pressure and forces\n", "pressures = Vector{Float64}[];\n", "Γs₋ = circulation(ambient_sys) .+ Plates.bound_circulation(plate);\n", - "forces = Complex128[];" + "forces = ComplexF64[];" ] }, { @@ -390,7 +391,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Julia 0.6.2", + "display_name": "Julia 0.6.3-pre", "language": "julia", "name": "julia-0.6" }, diff --git a/binder/notebooks/Vortex Sheet Roll-up.ipynb b/binder/notebooks/Vortex Sheet Roll-up.ipynb index 0483184..ba9cb57 100644 --- a/binder/notebooks/Vortex Sheet Roll-up.ipynb +++ b/binder/notebooks/Vortex Sheet Roll-up.ipynb @@ -2,10 +2,7 @@ "cells": [ { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "# Vortex Sheet Roll-up" ] @@ -14,9 +11,7 @@ "cell_type": "code", "execution_count": 1, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -26,13 +21,10 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ + "using Compat\n", "using Plots\n", "clibrary(:colorbrewer)\n", "default(legend = :none, ratio = 1, linewidth = 2,\n", @@ -42,20 +34,14 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "## Initializing the sheet" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We want to recreate the simulation of a vortex sheet roll-up as presented in [Krasny 1987: Computation of vortex sheet roll-up in the Trefftz plane](https://doi.org/10.1017/S0022112087002830).\n", "The discretization parameters are listed below:" @@ -65,14 +51,12 @@ "cell_type": "code", "execution_count": 3, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ "N = 200\n", - "α = linspace(0, π, 2N+1)\n", + "α = Compat.linspace(0, π, 2N+1)\n", "zs = complex.(cos.(α))\n", "Γs = sin.(α)\n", "δ = 0.05;\n", @@ -81,10 +65,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We can initialize the vortex sheet by providing it with a list of control points `zs`, the circulation from the tip of the sheet `zs[1]` to any subsequent control point, and a blob radius.\n", "\n", @@ -94,11 +75,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -120,20 +97,14 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "## Time Marching" ] }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We start by using forward-Euler:" ] @@ -141,11 +112,7 @@ { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "sheet = Vortex.Sheet(zs, Γs, δ)\n", @@ -163,11 +130,7 @@ { "cell_type": "code", "execution_count": 6, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -186,10 +149,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "which seems to work just fine. But over a longer time interval, instabilities in the sheet start to show, resulting in sheet segments that overlap with each other:" ] @@ -198,9 +158,7 @@ "cell_type": "code", "execution_count": 7, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -212,11 +170,7 @@ { "cell_type": "code", "execution_count": 8, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -235,10 +189,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "If we use 4th-order Runge-Kutta, as was done in [Krasny 1987](https://doi.org/10.1017/S0022112087002830), we obtain: " ] @@ -247,9 +198,7 @@ "cell_type": "code", "execution_count": 9, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -266,11 +215,7 @@ { "cell_type": "code", "execution_count": 10, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -289,10 +234,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The higher order time-marching scheme gives us a more stable vortex core, but the large strain-rates start to reveal the discrete nature of our vortex sheet.\n", "\n", @@ -305,9 +247,7 @@ "cell_type": "code", "execution_count": 11, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -324,11 +264,7 @@ { "cell_type": "code", "execution_count": 12, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -347,10 +283,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "and if we use 4th-order Runge-Kutta on top of the filtering, we get:" ] @@ -359,9 +292,7 @@ "cell_type": "code", "execution_count": 13, "metadata": { - "collapsed": true, - "deletable": true, - "editable": true + "collapsed": true }, "outputs": [], "source": [ @@ -379,11 +310,7 @@ { "cell_type": "code", "execution_count": 14, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -402,10 +329,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The continuity of the sheet comes at the cost of increased particle count. Before filtering, we have:" ] @@ -413,11 +337,7 @@ { "cell_type": "code", "execution_count": 15, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -436,10 +356,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "with filtering, we have:" ] @@ -447,11 +364,7 @@ { "cell_type": "code", "execution_count": 16, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -471,7 +384,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Julia 0.6.1-pre", + "display_name": "Julia 0.6.3-pre", "language": "julia", "name": "julia-0.6" }, diff --git a/test/notebooks.jl b/test/notebooks.jl index 09f6923..e4f70e5 100644 --- a/test/notebooks.jl +++ b/test/notebooks.jl @@ -10,7 +10,7 @@ using NBInclude notebook_dir = joinpath(splitdir(@__FILE__())[1], "../binder/notebooks") @testset "$notebook" for notebook in notebooks - nbinclude(joinpath(notebook_dir, "$notebook.ipynb")) + @nbinclude(joinpath(notebook_dir, "$notebook.ipynb")) @test true end end