Skip to content

Commit

Permalink
Merge pull request #32 from SarThak191119/dev
Browse files Browse the repository at this point in the history
Added channel vortex imprinting option
  • Loading branch information
AshtonSBradley authored Nov 30, 2021
2 parents a0a78a8 + 2d6465a commit a2577fc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/creation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ ScalarVortex(ξ::Array{Float64,1},pv::Array{PointVortex,1}) = @. ScalarVortex(Ex
ScalarVortex::Float64,pv::PointVortex) = ScalarVortex(ξ,[pv])
ScalarVortex(pv::Array{PointVortex,1}) = ScalarVortex(1.0,pv)


#Same construction as scalar vortex but due to being in a channel needs the channel width as an extra parameter
#Vortex in a infinite channel.
#Toikka et al, 2017 New J. Phys. 19 023029


ChannelVortex(vort::PointVortex) = ChannelVortex(Exact(),vort)
function (s::ChannelVortex{T})(x,y,z::Real) where T <: CoreShape
@unpack xv,yv,qv = s.vort
return s.core(x - xv, y - yv)*exp(im*qv*(real(1im*log((exp*(x+1im*(y+z/2))/z)
-exp*(xv-1im*(yv+z/2))/z))/(exp*(x+1im*(y+z/2))/z)
-exp*(xv+1im*(yv+z/2))/z)+1e-10)))))
end

"""
rv = rand_scalarvortex()
rv = rand_scalarvortex(n::Int)
Expand Down Expand Up @@ -135,6 +149,16 @@ function vortex!(psi::F,vort::Array{S}) where {F <: Field, S <: Vortex}
end
end


#New dispatch for channel. Assertion that channel length should not be complex

function vortex!(psi::F,vort::ChannelVortex{T},D) where {T <: CoreShape, F<:Field}
@unpack ψ,x,y = psi
@assert typeof(D)<:Real "Channel length cannot be imaginary"
ψ .*= vort.(x,y',D)
@pack! psi = ψ
end

function rand_vortexfield(n)
Nx = 400; Ny = 400
Lx = 200; Ly = 200
Expand Down Expand Up @@ -189,6 +213,9 @@ function periodic_dipole!(psi::F,dip::Vector{ScalarVortex{T}}) where {T <: CoreS
@pack! psi = ψ
end




# TODO: dispatch on dipole type
# function periodic_dipole!(psi::F,dip::Dipole) where F <: Field
# @unpack ψ,x,y = psi
Expand Down
6 changes: 6 additions & 0 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ mutable struct ScalarVortex{T<:CoreShape} <: Vortex
vort::PointVortex
end

mutable struct ChannelVortex{T<:CoreShape} <: Vortex
core::T
vort::PointVortex
end


mutable struct Dipole <: VortexGroup
vp::PointVortex
vn::PointVortex
Expand Down

0 comments on commit a2577fc

Please sign in to comment.