FindNearbySegments

VortexPasta.FindNearbySegmentsModule
FindNearbySegments

A module for finding pairs of nearby filament segments.

This is a common operation, used for instance for:

  • computing short-range Biot-Savart interactions between filament segments;
  • detecting vortex reconnection candidates.
source

Backends

VortexPasta.FindNearbySegments.NaiveSegmentFinderType
NaiveSegmentFinder <: NearbySegmentFinder
NaiveSegmentFinder(fs::AbstractVector{<:AbstractFilament})

Initialise nearby segment finder based on a naive searching method.

When using this segment finder, nearby_segments iterates through all segments in all filaments fs, performing no filtering at all. One should manually use segment_is_close to filter the returned segments while iterating.

source
VortexPasta.FindNearbySegments.CellListSegmentFinderType
CellListSegmentFinder <: NearbySegmentFinder
CellListSegmentFinder(
    fs::AbstractVector{<:AbstractFilament},
    r_cut::Real,
    Ls::NTuple{3, Real};
    nsubdiv = Val(1),
)

Initialise nearby segment finder based on cell lists algorithm.

Only supports fully periodic domains.

See the CellLists module for more details.

Mandatory arguments

  • fs: vector of filaments;
  • r_cut::Real: cut-off distance;
  • Ls::NTuple{3, Real}: domain period in each direction. Note that this backend doesn't support non-periodic (Infinity) directions.

Optional keyword arguments

  • nsubdiv = Val(M): number of cell lists subdivisions. Here M must be a positive integer (M = 1 means no subdivisions). See PeriodicCellList for details.
source

Functions

VortexPasta.FindNearbySegments.nearby_segmentsFunction
nearby_segments(c::NearbySegmentFinder, x⃗::Vec3)

Return an iterator over the segments that are "close" to the location x⃗.

A segment is considered to be close to x⃗ if the minimum[mindist] distance between x⃗ and the segment midpoint is smaller than the cutoff distance $r_{\text{cut}}$.

Typical usage:

x⃗ = Vec3(0.1, 0.3, 0.2)
for segment ∈ nearby_segments(c, x⃗)
    # Get the filament `f` and the index `i` of the segment within the filament.
    # The segment is between the filament nodes `f[i]` and `f[i + 1]`.
    (; f, i,) = segment
    # Do something with the segment...
end
source
VortexPasta.FindNearbySegments.segment_is_closeFunction
segment_is_close(s::Segment, x⃗, r_cut::Real, r²_cut::Real, Ls, Lhs) -> Bool

Determine whether segment s is close to the point x⃗.

Here r_cut is the critical distance below which s and x⃗ will be considered to be "close", and r²_cut = r_cut^2 is its squared value.

Moreover, Ls = (Lx, Ly, Lz) contains the domain period along each dimension (components can be Infinity() for infinite non-periodic domains), and Lhs = (Lx/2, Ly/2, Lz/2) contains half the domain periods.

source
  • mindistWhen periodicity is enabled, the relevant distance is the minimum distance between the two points, after considering all their periodic images.