Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
fail-fast: false
matrix:
version:
- '1.8'
- '1.10'
- 'lts'
- '1'
- 'nightly'
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: actions/cache@v1
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand All @@ -45,7 +45,7 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1.10'
version: '1'
- run: |
julia --project=docs -e '
using Pkg
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ SchwarzChristoffel = "6e93f119-a087-51f0-a155-b73ce4943121"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
ColorTypes = "0.10, 0.11"
ColorTypes = "0.10, 0.11, 0.12"
DiffRules = "1"
DocStringExtensions = "0.8, 0.9"
FFTW = "1"
ForwardDiff = "0.10"
ForwardDiff = "0.10, 1"
Interpolations = "0.12.10, 0.13, 0.14, 0.15"
MacroTools = "0.5.6"
MappedArrays = "0.3.0, 0.4"
PlotUtils = "1.0, 1.1, 1.2, 1.3"
PlotUtils = "1.0, 1.1, 1.2, 1.3, 1.4"
RecipesBase = "1.0"
Reexport = "0.2.0, 1"
SchwarzChristoffel = "0.1.13"
Expand Down
30 changes: 15 additions & 15 deletions docs/src/manual/elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ These collections can be represented as an array or a tuple.
Arrays should be used when the elements are the same type, for example:
```jldoctest overview
julia> points = Vortex.Point.(rand(ComplexF64, 5), rand(5))
5-element Vector{PotentialFlow.Points.Point{Float64, Float64}}:
Vortex.Point(0.23603334566204692 + 0.34651701419196046im, 0.5557510873245723)
Vortex.Point(0.3127069683360675 + 0.00790928339056074im, 0.43710797460962514)
Vortex.Point(0.4886128300795012 + 0.21096820215853596im, 0.42471785049513144)
Vortex.Point(0.951916339835734 + 0.9999046588986136im, 0.773223048457377)
Vortex.Point(0.25166218303197185 + 0.9866663668987996im, 0.2811902322857298)
5-element Vector{PotentialFlow.Points.Point{Float64, Float64, Val{Inf}}}:
Vortex.Point(0.07336635446929285 + 0.34924148955718615im, 0.5710874493423871)
Vortex.Point(0.6988266836914685 + 0.6282647403425017im, 0.4528085872833483)
Vortex.Point(0.9149290036628314 + 0.19280811624587546im, 0.30232547191787174)
Vortex.Point(0.7701803478856664 + 0.7805192636751863im, 0.0013502779247226426)
Vortex.Point(0.6702639583444937 + 0.16771210647092682im, 0.5670236732404312)

julia> Elements.impulse(points)
1.3362266530178137 - 1.2821936908564113im
0.638372558313404 - 1.0160351596663442im

julia> blobs = [Vortex.Blob(rand(ComplexF64), rand(), 0.1) for i in 1:5]
5-element Vector{PotentialFlow.Blobs.Blob{Float64, Float64}}:
Vortex.Blob(0.20947237319807077 + 0.25137920979222494im, 0.02037486871266725, 0.1)
Vortex.Blob(0.2877015122756894 + 0.859512136087661im, 0.07695088688120899, 0.1)
Vortex.Blob(0.6403962459899388 + 0.8735441302706854im, 0.27858242002877853, 0.1)
Vortex.Blob(0.7513126327861701 + 0.6448833539420931im, 0.07782644396003469, 0.1)
Vortex.Blob(0.8481854810000327 + 0.0856351682044918im, 0.5532055454580578, 0.1)
5-element Vector{PotentialFlow.Blobs.Blob{Float64, Float64, Val{Inf}}}:
Vortex.Blob(0.6159379234562881 + 0.19573857852575793im, 0.012461945950411835, 0.1)
Vortex.Blob(0.3119923865097316 + 0.11479916823306191im, 0.5460487092960259, 0.1)
Vortex.Blob(0.6232150941621899 + 0.2708693898950604im, 0.8451820156319791, 0.1)
Vortex.Blob(0.49359045543272007 + 0.9003405842788204im, 0.37215957409032674, 0.1)
Vortex.Blob(0.8686942572391998 + 0.8667711192602672im, 0.7305508461555176, 0.1)

julia> Elements.impulse(blobs)
0.41217890550975256 - 0.7325028967929701im
1.2623499011326258 - 1.523088752876448im
```
Knowing that every element has the same type allows the compiler to perform more aggressive optimizations.
Tuples are used when we want to mix and match *different* element types.
Expand All @@ -50,7 +50,7 @@ For example:
julia> sys = (points, blobs);

julia> Elements.impulse(sys)
1.7484055585275664 - 2.0146965876493814im
1.9007224594460297 - 2.5391239125427925im
```

This rest of this page documents the data types that represent these elements and some key functions that act on them.
Expand Down
8 changes: 4 additions & 4 deletions docs/src/manual/motions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Rigid Body Motion:
Here, `Constant` is a subtype of [`Kinematics`](@ref) that returns the same `(ċ, c̈, α̇)` triple at all times
```jldoctest constant
julia> motion.kin.([0.0, 1.0, 2.0])
3-element Vector{Tuple{ComplexF64, ComplexF64, Float64, ComplexF64}}:
(0.0 + 1.0im, 0.0 + 0.0im, 1.5707963267948966, 0.0 + 0.0im)
(0.0 + 1.0im, 0.0 + 0.0im, 1.5707963267948966, 0.0 + 0.0im)
(0.0 + 1.0im, 0.0 + 0.0im, 1.5707963267948966, 0.0 + 0.0im)
3-element Vector{Tuple{ComplexF64, ComplexF64, Float64, Float64}}:
(0.0 + 1.0im, 0.0 + 0.0im, 1.5707963267948966, 0.0)
(0.0 + 1.0im, 0.0 + 0.0im, 1.5707963267948966, 0.0)
(0.0 + 1.0im, 0.0 + 0.0im, 1.5707963267948966, 0.0)

```
Calling `Plates.RigidBodyMotion(1.0im, π/2)` is equivalent doing
Expand Down
88 changes: 43 additions & 45 deletions docs/src/manual/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ julia> N = 5;
julia> zs = Complex.(randn(N), randn(N));

julia> vortices = Vortex.Point.(zs .+ 1.5, rand(N))
5-element Vector{PotentialFlow.Points.Point{Float64, Float64}}:
Vortex.Point(1.7972879845354617 + 0.31111133849833383im, 0.42471785049513144)
Vortex.Point(1.882395967790608 + 2.2950878238373105im, 0.773223048457377)
Vortex.Point(0.9023655232717689 - 2.2670863488005306im, 0.2811902322857298)
Vortex.Point(1.4895547553626243 + 0.5299655761667461im, 0.20947237319807077)
Vortex.Point(0.660973145611236 + 0.43142152642291204im, 0.25137920979222494)
5-element Vector{PotentialFlow.Points.Point{Float64, Float64, Val{Inf}}}:
Vortex.Point(1.429416861046102 + 0.2675644186288851im, 0.5710874493423871)
Vortex.Point(2.0314767537831964 + 1.7499336925282452im, 0.4528085872833483)
Vortex.Point(0.693147673993286 - 0.8260207919192974im, 0.30232547191787174)
Vortex.Point(3.956991333983293 - 1.0427524178910967im, 0.0013502779247226426)
Vortex.Point(2.6648740735275194 - 0.3291338458564041im, 0.5670236732404312)

julia> sources = Source.Point.(zs .- 1.5, rand(N))
5-element Vector{PotentialFlow.Points.Point{ComplexF64, Float64}}:
Source.Point(-1.2027120154645383 + 0.31111133849833383im, 0.02037486871266725)
Source.Point(-1.117604032209392 + 2.2950878238373105im, 0.2877015122756894)
Source.Point(-2.0976344767282313 - 2.2670863488005306im, 0.859512136087661)
Source.Point(-1.5104452446373757 + 0.5299655761667461im, 0.07695088688120899)
Source.Point(-2.339026854388764 + 0.43142152642291204im, 0.6403962459899388)
5-element Vector{PotentialFlow.Points.Point{ComplexF64, Float64, Val{Inf}}}:
Source.Point(-1.570583138953898 + 0.2675644186288851im, 0.6159379234562881)
Source.Point(-0.9685232462168037 + 1.7499336925282452im, 0.19573857852575793)
Source.Point(-2.306852326006714 - 0.8260207919192974im, 0.012461945950411835)
Source.Point(0.956991333983293 - 1.0427524178910967im, 0.3119923865097316)
Source.Point(-0.3351259264724804 - 0.3291338458564041im, 0.11479916823306191)

```

Expand Down Expand Up @@ -82,29 +82,29 @@ These accessor methods, combined with the dot syntax, also make it easier to wor

```jldoctest quickstart
julia> Elements.circulation(vortices)
1.939982714228534
1.894595459708761

julia> Elements.circulation(sources)
0.0

julia> Elements.circulation(sys)
1.939982714228534
1.894595459708761

julia> Elements.circulation.(vortices)
5-element Vector{Float64}:
0.42471785049513144
0.773223048457377
0.2811902322857298
0.20947237319807077
0.25137920979222494
0.5710874493423871
0.4528085872833483
0.30232547191787174
0.0013502779247226426
0.5670236732404312

julia> Elements.position.(sources)
5-element Vector{ComplexF64}:
-1.2027120154645383 + 0.31111133849833383im
-1.117604032209392 + 2.2950878238373105im
-2.0976344767282313 - 2.2670863488005306im
-1.5104452446373757 + 0.5299655761667461im
-2.339026854388764 + 0.43142152642291204im
-1.570583138953898 + 0.2675644186288851im
-0.9685232462168037 + 1.7499336925282452im
-2.306852326006714 - 0.8260207919192974im
0.956991333983293 - 1.0427524178910967im
-0.3351259264724804 - 0.3291338458564041im

```

Expand All @@ -119,35 +119,35 @@ The target can be
- a complex position
```jldoctest quickstart
julia> induce_velocity(0.0 + 0.0im , vortices, 0.0)
0.05610938572529216 - 0.1319030126670981im
-0.009273430685548957 - 0.14388782250895069im

julia> induce_velocity(0.0 + 0.0im , sys, 0.0)
0.14592914759546077 - 0.1264803675281937im
0.06371598168246967 - 0.11447266706501986im

```
- a vortex element
```jldoctest quickstart
julia> induce_velocity(p, sys, 0.0)
-0.004302294537820467 - 0.07805396403126988im
-0.05427421225945314 - 0.09252070426470571im

```
- an array/tuple of vortex elements
```jldoctest quickstart
julia> induce_velocity(vortices, sources, 0.0)
5-element Vector{ComplexF64}:
0.06454384396015585 + 0.007898382618214123im
0.053907048316969616 + 0.02790291832733651im
0.0706678480701265 - 0.02711822881988212im
0.06764122439359754 + 0.011120627964923711im
0.07894704527850091 + 0.01178636990942516im
0.06394802926014045 + 0.031010783429706375im
0.044311854409737575 + 0.02909416162231901im
-0.056688156118723444 + 0.05984574850840092im
0.04258756546240927 - 0.0073936799851473615im
0.06039151039573569 + 0.00348881879586619im

julia> induce_velocity(sources, sys, 0.0)
5-element Vector{ComplexF64}:
0.1406920003437716 - 0.09680661285216872im
-0.003388443511578354 - 0.004829334922251807im
0.03508222004503095 - 0.10591880362792691im
0.1221234594021031 - 0.04477695050245835im
-0.02942885432058654 - 0.03924892616438964im
-0.03819846572429091 - 0.08854228453987956im
-0.02825741998318055 - 0.0012332495590173659im
-0.05468961297718501 - 0.1411284938189232im
0.23933127172071716 + 0.003620998811504985im
0.05240511983016098 - 0.15976070174985801im

```

Expand All @@ -166,11 +166,11 @@ julia> induce_velocity!(vel_vortices, vortices, sources, 0.0);

julia> vel_vortices
5-element Vector{ComplexF64}:
0.06454384396015585 + 0.007898382618214123im
0.053907048316969616 + 0.02790291832733651im
0.0706678480701265 - 0.02711822881988212im
0.06764122439359754 + 0.011120627964923711im
0.07894704527850091 + 0.01178636990942516im
0.06394802926014045 + 0.031010783429706375im
0.044311854409737575 + 0.02909416162231901im
-0.056688156118723444 + 0.05984574850840092im
0.04258756546240927 - 0.0073936799851473615im
0.06039151039573569 + 0.00348881879586619im

```
To make it easier to allocate velocities for more complex collections of vortex elements, the library provides the `allocate_velocity` function:
Expand Down Expand Up @@ -243,6 +243,4 @@ for t in 0:Δt:1.0
advect!(sys, sys, vels, Δt)
end
plot(sys, color = :reds, clim = (0, 1))
savefig("final_clusters.svg"); nothing # hide
```
![Final clusters](final_clusters.svg)
```
12 changes: 10 additions & 2 deletions src/elements/Source.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,17 @@ Blob(z::Real,S::T,δ;period=Inf) where {T<:Real} = Blobs.Blob{Complex{T}}(comple

function Base.show(io::IO, s::Blob)
if iszero(real(s.S))
print(io, "Source.Blob($(s.z), $(imag(s.S)), $(s.δ))")
if isinf(s.period)
print(io, "Source.Blob($(s.z), $(imag(s.S)), $(s.δ))")
else
print(io, "Source.Blob($(s.z), $(imag(s.S)), $(s.δ), $(s.period))")
end
else
print(io, "Blobs.Blob($(s.z), $(imag(s.S)), $(s.δ))")
if isinf(s.period)
print(io, "Blobs.Blob($(s.z), $(imag(s.S)), $(s.δ))")
else
print(io, "Blobs.Blob($(s.z), $(imag(s.S)), $(s.δ), $(s.period))")
end
end
end
circulation(::Blob) = 0.0
Expand Down
4 changes: 3 additions & 1 deletion src/elements/Vortex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ circulation(b::Blob) = b.S
flux(::Blob) = 0.0
impulse(b::Blob) = -im*b.z*b.S
angularimpulse(b::Blob) = -0.5*b.z*conj(b.z)*b.S
Base.show(io::IO, s::Blob) = print(io, "Vortex.Blob($(s.z), $(s.S), $(s.δ), $(s.period))")
#Base.show(io::IO, s::Blob) = print(io, "Vortex.Blob($(s.z), $(s.S), $(s.δ), $(s.period))")
Base.show(io::IO, s::Blob) = isinf(s.period) ? print(io, "Vortex.Blob($(s.z), $(s.S), $(s.δ))") :
print(io, "Vortex.Blob($(s.z), $(s.S), $(s.δ), $(s.period))")



Expand Down
Loading