Core

SmoothedParticles.apply_binary!Method
apply_binary!(sys::ParticleSystem, action!::Function)

Apply a binary operator action!(p::T, q::T, r::Float64) between any two neighbouring particles p, q in sys::ParticleSystem{T}. Value r is their mutual distance. This excludes particle pairs with distance greater than sys.h. This has linear complexity in number of particles and runs in parallel.

Warning

Modifying second particle q within action! can lead to race condition, so do not do this. Also, make sure that result will not depend on the order of particle evaluation, which is implementation-specific.

source
SmoothedParticles.apply_unary!Method
apply_unary!(sys::ParticleSystem, action!::Function)

Apply a unary operator action!(p::T) on every particle p in sys::ParticleSystem{T}. This has linear complexity in number of particles and runs in parallel.

source
SmoothedParticles.assemble_matrixMethod
assemble_matrix(sys::ParticleSystem, func::Function)::SparseMatrixCSC{Float64}

For given function func(p::T, q::T)::Float64 where T <: AbstractParticle, assemble a sparse matrix $\mathbb{A}$, such that

\[ A_{ij} = \text{func}(p_i, p_j, r_{ij}),\]

where $p_i$, $p_j$ are respectively the i-th and j-th particle in sys::ParticleSystem{T} and $r_{ij}$ is their mutual distance. This assumes that $A_{ij} = 0$ for $r_{ij} > h$.

source
SmoothedParticles.assemble_vectorMethod
assemble_vector(sys::ParticleSystem, func::Function)::Vector{Float64}

For given function func(q::T)::Float64 where T <: AbstractParticle, assemble a vector $\mathbf{v}$, such that

\[ v_i = \text{func}(p_i),\]

where $p_i$ is the i-th particle in sys::ParticleSystem{T}.

source
SmoothedParticles.create_cell_list!Method
create_cell_list!(sys::ParticleSystem)

Create the cell list for given particle system sys. This function should be always called after updating positions. Without updated cell list, applying binary particle operators or assembling matrices will lead to incorrect results.

source
SmoothedParticles.distMethod
dist(p::AbstractParticle, q::AbstractParticle)::Float64

Computes the distance between any two particles.

source
SmoothedParticles.sumMethod
sum(sys::ParticleSystem, func::Function, x::RealVector)::Float64

For given function func(p::T, q::T, r::Float64)::Float64 where T <: AbstractParticle and particle p it returns the sum

\[ \sum_{q \in \text{sys.particles}} \text{func}(p, q, r).\]

source
SmoothedParticles.sumMethod
sum(sys::ParticleSystem, func::Function, x::RealVector)::Float64

For given function func(p::T, r::Float64)::Float64 where T <: AbstractParticle it returns the sum

\[ \sum_{p \in \text{sys.particles}} \text{func}(p, \sqrt{(p.x - x)^2 + (p.y - y)^2}).\]

This can be useful if one needs to compute SPH interpolation at a point which is not occupied by a particle.

source