Skip to content

List of JustPIC functions

Here an overview of all functions in JustPIC.jl, , for a complete list see here:

JustPIC.Particles Type
julia
Particles{Backend,N,I,T1,T2} <: AbstractParticles

A struct representing a collection of particles.

Arguments

  • backend: The backend used for particle computations (CPUBackend, CUDABackend, AMDGPUBackend).

  • coords: Coordinates of the particles

  • index: Helper array flaggin active particles

  • nxcell: Initial number of particles per cell

  • max_xcell: Maximum number of particles per cell

  • min_xcell: Minimum number of particles per cell

  • np: Number of particles

source
JustPIC.nphases Method
julia
nphases(x::PhaseRatios)

Return the number of phases in x::PhaseRatios.

source
JustPIC._2D.advection! Method
julia
advection!(particles::Particles, method::AbstractAdvectionIntegrator, V, grid_vi::NTuple{N,NTuple{N,T}}, dt)

Advects the particles using the advection scheme defined by method.

Arguments

  • particles: Particles object to be advected.

  • method: Time integration method (Euler or RungeKutta2).

  • V: Tuple containing Vx, Vy; and Vz in 3D.

  • grid_vi: Tuple containing the grids corresponding to Vx, Vy; and Vz in 3D.

  • dt: Time step.

source
JustPIC._2D.advection_LinP! Method
julia
advection!(particles::Particles, method::AbstractAdvectionIntegrator, V, grid_vi::NTuple{N,NTuple{N,T}}, dt)

Advects the particles using the advection scheme defined by method.

Arguments

  • particles: Particles object to be advected.

  • method: Time integration method (Euler or RungeKutta2).

  • V: Tuple containing Vx, Vy; and Vz in 3D.

  • grid_vi: Tuple containing the grids corresponding to Vx, Vy; and Vz in 3D.

  • dt: Time step.

source
JustPIC._2D.advection_MQS! Method
julia
advection!(particles::Particles, method::AbstractAdvectionIntegrator, V, grid_vi::NTuple{N,NTuple{N,T}}, dt)

Advects the particles using the advection scheme defined by method.

Arguments

  • particles: Particles object to be advected.

  • method: Time integration method (Euler or RungeKutta2).

  • V: Tuple containing Vx, Vy; and Vz in 3D.

  • grid_vi: Tuple containing the grids corresponding to Vx, Vy; and Vz in 3D.

  • dt: Time step.

source
JustPIC._2D.centroid2particle! Method
julia
centroid2particle!(Fp, xci, F, particles)

Interpolates properties F that are defined on a mesh at center points with location xci to particles Fp.

source
JustPIC._2D.checkpointing_particles Method
julia
checkpointing_particles(dst, particles;phases=nothing, phase_ratios=nothing, chain=nothing, t=nothing, dt=nothing, particle_args=nothing)

Save the state of particles and related data to a checkpoint file in a jld2 format. The name of the checkpoint file is particles_checkpoint.jld2.

Arguments

  • dst: The destination directory where the checkpoint file will be saved.

  • particles: The array of particles to be saved.

Keyword Arguments

  • phases: The array of phases associated with the particles. If nothing is stated, the default is nothing.

  • phase_ratios: The array of phase ratios. If nothing is stated, the default is nothing.

  • chain: The chain data to be saved. If nothing is stated, the default is nothing.

  • t: The current time to be saved. If nothing is stated, the default is nothing.

  • dt: The timestep to be saved. If nothing is stated, the default is nothing.

  • particle_args: Additional particle arguments to be saved. If nothing is stated, the default is nothing.

source
JustPIC._2D.fill_chain_from_chain! Method
julia
fill_chain!(chain::MarkerChain, topo_x, topo_y)

Fill the given chain of markers with topographical data.

Arguments

  • chain::MarkerChain: The chain of markers to be filled.

  • topo_x: The x-coordinates of the topography.

  • topo_y: The y-coordinates of the topography.

Description

This function populates the chain with markers based on the provided topographical data (topo_x and topo_y). The function modifies the chain in place.

source
JustPIC._2D.force_injection! Method
julia
force_injection!(particles::Particles{Backend}, p_new) where {Backend}

Forces the injection of new particles into the existing particles collection. This function modifies the particles in place by adding the new particles specified in p_new.

Arguments

  • particles::Particles{Backend}: The existing collection of particles to which new particles will be added. The type of backend is specified by the Backend parameter.

  • p_new: The new particles to be injected into the existing collection.

source
JustPIC._2D.force_injection! Method
julia
force_injection!(particles::Particles{Backend}, p_new, fields::NTuple{N, Any}, values::NTuple{N, Any}) where {Backend, N}

Forcefully injects new particles into the particles object. This function modifies the particles object in place.

Arguments

  • particles::Particles{Backend}: The particles object to be modified.

  • p_new: The new particles to be injected.

  • fields::NTuple{N, Any}: A tuple containing the fields to be updated.

  • values::NTuple{N, Any}: A tuple containing the values corresponding to the fields.

Returns

  • Nothing. This function modifies the particles object in place.
source
JustPIC._2D.init_particles Method
julia
init_particles( backend, nxcell, max_xcell, min_xcell, coords::NTuple{N,AbstractArray}, dxᵢ::NTuple{N,T}, nᵢ::NTuple{N,I})

Initialize the particles object.

Arguments

  • backend: Device backend

  • nxcell: Initial number of particles per cell

  • max_xcell: Maximum number of particles per cell

  • min_xcell: Minimum number of particles per cell

  • xvi: Grid cells vertices

source
JustPIC._2D.inject_particles! Method
julia
inject_particles!(particles::Particles, args, grid)

Injects particles if the number of particles in a given cell is such that n < particles.min_xcell.

Arguments

  • particles: The particles object.

  • args: CellArrayss containing particle fields.

  • grid: The grid cell vertices.

source
JustPIC._2D.interpolate_velocity_to_markerchain! Method
julia
interpolate_velocity_to_markerchain!(chain::MarkerChain, chain_V::NTuple{N, CellArray}, V, grid_vi::NTuple{N, NTuple{N, T}}) where {N, T}

Interpolates the velocity field to the positions of the marker chain.

Arguments

  • chain::MarkerChain: The marker chain object containing the particle coordinates and indices.

  • chain_V::NTuple{N, CellArray}: The output velocity field at the marker chain positions.

  • V: The velocity field to be interpolated.

  • grid_vi::NTuple{N, NTuple{N, T}}: The grid information for each dimension.

source
JustPIC._2D.lerp Method
julia
lerp(v, t::NTuple{nD,T}) where {nD,T}

Linearly interpolates the value v between the elements of the tuple t. This function is specialized for tuples of length nD.

Arguments

  • v: The value to be interpolated.

  • t: The tuple of values to interpolate between.

source
JustPIC._2D.move_particles! Method
julia
move_particles!(particles::AbstractParticles, grid, args)

Move particles in the given particles container according to the provided grid and particles fields in args.

Arguments

  • particles: The container of particles to be moved.

  • grid: The grid used for particle movement.

  • args: CellArrayss containing particle fields.

source
JustPIC._2D.particle2centroid! Method
julia
particle2centroid!(F, Fp, xci::NTuple, particles::Particles)

Interpolates properties Fp from particles to the grid F at center points that are defined by 1D coordinate arrays in xci

source
JustPIC._2D.@idx Macro
julia
@idx(args...)

Make a linear range from 1 to args[i], with i ∈ [1, ..., n]

source
JustPIC._3D.advection! Method
julia
advection!(particles::Particles, method::AbstractAdvectionIntegrator, V, grid_vi::NTuple{N,NTuple{N,T}}, dt)

Advects the particles using the advection scheme defined by method.

Arguments

  • particles: Particles object to be advected.

  • method: Time integration method (Euler or RungeKutta2).

  • V: Tuple containing Vx, Vy; and Vz in 3D.

  • grid_vi: Tuple containing the grids corresponding to Vx, Vy; and Vz in 3D.

  • dt: Time step.

source
JustPIC._3D.advection_LinP! Method
julia
advection!(particles::Particles, method::AbstractAdvectionIntegrator, V, grid_vi::NTuple{N,NTuple{N,T}}, dt)

Advects the particles using the advection scheme defined by method.

Arguments

  • particles: Particles object to be advected.

  • method: Time integration method (Euler or RungeKutta2).

  • V: Tuple containing Vx, Vy; and Vz in 3D.

  • grid_vi: Tuple containing the grids corresponding to Vx, Vy; and Vz in 3D.

  • dt: Time step.

source
JustPIC._3D.advection_MQS! Method
julia
advection!(particles::Particles, method::AbstractAdvectionIntegrator, V, grid_vi::NTuple{N,NTuple{N,T}}, dt)

Advects the particles using the advection scheme defined by method.

Arguments

  • particles: Particles object to be advected.

  • method: Time integration method (Euler or RungeKutta2).

  • V: Tuple containing Vx, Vy; and Vz in 3D.

  • grid_vi: Tuple containing the grids corresponding to Vx, Vy; and Vz in 3D.

  • dt: Time step.

source
JustPIC._3D.centroid2particle! Method
julia
centroid2particle!(Fp, xci, F, particles)

Interpolates properties F that are defined on a mesh at center points with location xci to particles Fp.

source
JustPIC._3D.checkpointing_particles Method
julia
checkpointing_particles(dst, particles;phases=nothing, phase_ratios=nothing, chain=nothing, t=nothing, dt=nothing, particle_args=nothing)

Save the state of particles and related data to a checkpoint file in a jld2 format. The name of the checkpoint file is particles_checkpoint.jld2.

Arguments

  • dst: The destination directory where the checkpoint file will be saved.

  • particles: The array of particles to be saved.

Keyword Arguments

  • phases: The array of phases associated with the particles. If nothing is stated, the default is nothing.

  • phase_ratios: The array of phase ratios. If nothing is stated, the default is nothing.

  • chain: The chain data to be saved. If nothing is stated, the default is nothing.

  • t: The current time to be saved. If nothing is stated, the default is nothing.

  • dt: The timestep to be saved. If nothing is stated, the default is nothing.

  • particle_args: Additional particle arguments to be saved. If nothing is stated, the default is nothing.

source
JustPIC._3D.fill_chain_from_chain! Method
julia
fill_chain!(chain::MarkerChain, topo_x, topo_y)

Fill the given chain of markers with topographical data.

Arguments

  • chain::MarkerChain: The chain of markers to be filled.

  • topo_x: The x-coordinates of the topography.

  • topo_y: The y-coordinates of the topography.

Description

This function populates the chain with markers based on the provided topographical data (topo_x and topo_y). The function modifies the chain in place.

source
JustPIC._3D.force_injection! Method
julia
force_injection!(particles::Particles{Backend}, p_new) where {Backend}

Forces the injection of new particles into the existing particles collection. This function modifies the particles in place by adding the new particles specified in p_new.

Arguments

  • particles::Particles{Backend}: The existing collection of particles to which new particles will be added. The type of backend is specified by the Backend parameter.

  • p_new: The new particles to be injected into the existing collection.

source
JustPIC._3D.force_injection! Method
julia
force_injection!(particles::Particles{Backend}, p_new, fields::NTuple{N, Any}, values::NTuple{N, Any}) where {Backend, N}

Forcefully injects new particles into the particles object. This function modifies the particles object in place.

Arguments

  • particles::Particles{Backend}: The particles object to be modified.

  • p_new: The new particles to be injected.

  • fields::NTuple{N, Any}: A tuple containing the fields to be updated.

  • values::NTuple{N, Any}: A tuple containing the values corresponding to the fields.

Returns

  • Nothing. This function modifies the particles object in place.
source
JustPIC._3D.init_particles Method
julia
init_particles( backend, nxcell, max_xcell, min_xcell, coords::NTuple{N,AbstractArray}, dxᵢ::NTuple{N,T}, nᵢ::NTuple{N,I})

Initialize the particles object.

Arguments

  • backend: Device backend

  • nxcell: Initial number of particles per cell

  • max_xcell: Maximum number of particles per cell

  • min_xcell: Minimum number of particles per cell

  • xvi: Grid cells vertices

source
JustPIC._3D.inject_particles! Method
julia
inject_particles!(particles::Particles, args, grid)

Injects particles if the number of particles in a given cell is such that n < particles.min_xcell.

Arguments

  • particles: The particles object.

  • args: CellArrayss containing particle fields.

  • grid: The grid cell vertices.

source
JustPIC._3D.interpolate_velocity_to_markerchain! Method
julia
interpolate_velocity_to_markerchain!(chain::MarkerChain, chain_V::NTuple{N, CellArray}, V, grid_vi::NTuple{N, NTuple{N, T}}) where {N, T}

Interpolates the velocity field to the positions of the marker chain.

Arguments

  • chain::MarkerChain: The marker chain object containing the particle coordinates and indices.

  • chain_V::NTuple{N, CellArray}: The output velocity field at the marker chain positions.

  • V: The velocity field to be interpolated.

  • grid_vi::NTuple{N, NTuple{N, T}}: The grid information for each dimension.

source
JustPIC._3D.lerp Method
julia
lerp(v, t::NTuple{nD,T}) where {nD,T}

Linearly interpolates the value v between the elements of the tuple t. This function is specialized for tuples of length nD.

Arguments

  • v: The value to be interpolated.

  • t: The tuple of values to interpolate between.

source
JustPIC._3D.move_particles! Method
julia
move_particles!(particles::AbstractParticles, grid, args)

Move particles in the given particles container according to the provided grid and particles fields in args.

Arguments

  • particles: The container of particles to be moved.

  • grid: The grid used for particle movement.

  • args: CellArrayss containing particle fields.

source
JustPIC._3D.particle2centroid! Method
julia
particle2centroid!(F, Fp, xci::NTuple, particles::Particles)

Interpolates properties Fp from particles to the grid F at center points that are defined by 1D coordinate arrays in xci

source
JustPIC._3D.@idx Macro
julia
@idx(args...)

Make a linear range from 1 to args[i], with i ∈ [1, ..., n]

source