CVortex.CVortexModule
CVortex

A GPU accelerated vortex particle and vortex filament library.

CVortex.RedistributionFunctionType

A vortex redistribution function.

The method by which vortex particles are redistibuted in lagrangian vortex particles onto a grid to ensure long term stability.

Examples

using CVortex
my_redistribution_kernel = singular_regularisation()
my_redistribution_kernel = winckelmans_regularisation()
my_redistribution_kernel = planetary_regularisation()
my_redistribution_kernel = gaussian_regularisation()
CVortex.RegularisationFunctionType

A 3D vortex regularisation function.

The method by which the singular nature of a vortex particle is managed. Generally, this structure is best obtained via *regularisation(). For example singularregularisation(), planetaryregularisation(), gaussianregularisation() and winckelmans_regulariation().

Exposure of this allows the use of user kernels in the CPU multithreaded implementations in cvortex. If you're interested in this, looking at the cvortex library and the source of cvortex.jl is suggested to understand the required functions signitures.

Examples

using CVortex
my_regularisation_kernel = singular_regularisation()
my_regularisation_kernel = winckelmans_regularisation()
my_regularisation_kernel = planetary_regularisation()
my_regularisation_kernel = gaussian_regularisation()
CVortex.VortexFilamentType

CVortex internal representation of a straight singular vortex filament

The filament starts at coord1, ends at coord2 and has vorticity per unit length of vorticity_density.

You only need to use this if you plan on calling CVortex's underlying library directly.

CVortex.VortexParticle2DType
Representation of a 2D vortex particle in CVortex

You do not need this to use the CVortex API.

coord is a particle's position. vorticity is the particle's vorticity volume is the volume of the particle. This is only important for viscous vortex particle strength exchange methods (not included in this wrapper)

CVortex.VortexParticle3DType
Representation of a 3D vortex particle in CVortex

You do not need this to use the CVortex API.

coord is a particle's position. vorticity is the particle's vorticity volume is the volume of the particle. This is only important for viscous vortex particle strength exchange methods (not included in this wrapper)

CVortex.accelerator_nameMethod
The name of an accelerator.

Input is an integer in the range 1:numberofaccelerators(). Returns the name of the accelerator as a string.

CVortex.check_filament_definitionMethod
Gives an assert message if something cannot be converted to a 
CVortex.VortexFilament or Vector{CVortex.VortexFilament}.

Part of CVortex. Not for client use.

CVortex.check_particle_definition_2DMethod
Gives an assert message if something cannot be converted to a 
CVortex.VortexParticle2D or Vector{CVortex.VortexParticle2D}.

Part of CVortex. Not for client use.

CVortex.check_particle_definition_3DMethod
Gives an assert message if something cannot be converted to a 
CVortex.VortexParticle or Vector{CVortex.VortexParticle}.

Part of CVortex. Not for client use.

CVortex.convertable_to_F32Method
Gives an assert message if something cannot be converted to something
of type or eltype Float32.

Part of CVortex. Not for client use.

CVortex.convertable_to_Vec2f_vectMethod
Gives an assert message if something cannot be converted to a 
CVortex.Vec2f or Vector{CVortex.Vec2f}.

Part of CVortex. Not for client use.

CVortex.convertable_to_Vec3f_vectMethod
Gives an assert message if something cannot be converted to a 
CVortex.Vec3f or Vector{CVortex.Vec3f}.

Part of CVortex. Not for client use.

CVortex.filament_induced_dvortMethod
filament_induced_dvort(
    filament_start_coord :: Vector{<:Real},
    filament_end_coord :: Vector{<:Real},
    filament_strength :: Real,
    induced_particle_position :: Vector{<:Real},
    induced_particle_vorticity :: Vector{<:Real})

filament_induced_dvort(
    filament_start_coords :: Matrix{<:Real},
    filament_end_coords :: Matrix{<:Real},
    filament_strengths :: Vector{<:Real},
    induced_particle_position :: Vector{<:Real},
    induced_particle_vorticity :: Vector{<:Real})

filament_induced_dvort(
    filament_start_coords :: Matrix{<:Real},
    filament_end_coords :: Matrix{<:Real},
    filament_strengths :: Vector{<:Real},
    induced_particle_position :: Matrix{<:Real},
    induced_particle_vorticity :: Matrix{<:Real})

Compute the rate of change of vorticity of vortex particles induced by vortex filaments. Multiple-multiple method may be GPU accelerated. Modelled as singular vortex particles and filaments.

Arguments

  • filament_start_coord : The start coordinates of vortex filaments
  • filament_end_coord : The end coordinates of vortex filaments
  • filament_strengths : The vorticity per unit length of vortex filaments.
  • induced_particle_position : The positions of vortex particles.
  • induced_particle_vorticity : The vorticities of vortex particles

Vector arguments are expected to have length 3. Filament matrix arguments are expected to have size N by 3. Vortex particles matrix arguments are expected to have size M by 3. Returns an M by 3 matrix representing particle vorticity derivatives.

CVortex.filament_induced_velocityMethod
filament_induced_velocity(
    filament_start_coord :: Vector{<:Real},
    filament_end_coord :: Vector{<:Real},
    filament_strength :: Real,
    measurement_point :: Vector{<:Real})

filament_induced_velocity(
    filament_start_coords :: Matrix{<:Real},
    filament_end_coords :: Matrix{<:Real},
    filament_strengths :: Vector{<:Real},
    measurement_point :: Vector{<:Real})

filament_induced_velocity(
    filament_start_coords :: Matrix{<:Real},
    filament_end_coords :: Matrix{<:Real},
    filament_strengths :: Vector{<:Real},
    measurement_points :: Matrix{<:Real})

Compute the velocity induced in the flow field by vortex filaments. The third multiple-multiple method may be GPU accelerated.

Arguments

  • filament_start_coord : The start coordinates of vortex filaments
  • filament_end_coord : The end coordinates of vortex filaments
  • filament_strengths : The vorticity per unit length of vortex filaments.
  • measurement_points : The points where induced velocity is measured.

Vector arguments are expected to have length 3. Filament matrix arguments are expected to have size N by 3. Measurement matrix arguments are expected to have size M by 3. Returns an M by 3 matrix representing velocities.

CVortex.filament_induced_velocity_influence_matrixMethod
induced_velocity_influence_matrix(
    filament_start_coords :: Matrix{<:Real},
    filament_end_coords :: Matrix{<:Real},
    measurement_points :: Matrix{<:Real},
    measurement_directions :: Matrix{<:Real})

The influence of vortex filaments on normal velocities at points in the domain.

Arguments

  • filament_start_coord : The start coordinates of vortex filaments. Matrix

of size N by 3.

  • filament_end_coord : The end coordinates of vortex filaments. Matrix of

size N by 3.

  • measurement_points : The positions at which induced velocity is evaluated.

Matrix of size M by 3

  • measurement_directions : The directions for which velocity compents are

computed. Matrix of size M by 3

Returns a Matrix{Float32} with size (M, N).

CVortex.lambda0_redistributionMethod

Implements 0th order redistribution method. The use of this redistribution is not advised. lambda3redistribution or m4predistribution are advised. returns RedistributionFunction struct.

CVortex.lambda1_redistributionMethod

Implements 1st order redistribution method. This method is dissipative. returns RedistributionFunction struct.

CVortex.lambda2_redistributionMethod

Implements 2nd order redistribution method. This redistribution is discontinuous, and consequently numerically less useful than the lambda3redistribution or m4predistribution. returns RedistributionFunction struct.

CVortex.number_of_acceleratorsMethod
The number of GPU or other accelerators found by the CVortex library.

It is possible that accelerators may be listed multiple times if they can be used by more than one installed platform. To know how many are in use see numberofenabled_accelerators()

CVortex.number_of_enabled_acceleratorsMethod
The number of accelerators that CVortex has been directed to use.

If no accelerators are in use this is zero, and the CPU is used for all computation.

Find which accelerators are enabled using acceleratorenabled, and enable and disable with acceleratorenable and accelerator_disable.

CVortex.particle_field_vorticityMethod

3D vortex particle functions

Single particle -> single vorticity measurement

particle_field_vorticity(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	measurement_point :: Vector{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Vector{Float32}

Single particle -> multiple vorticity measurements

particle_field_vorticity(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	measurement_points :: Matrix{<:Real},
	kernel :: RegularisationFunction,
	regularisation_radius :: Real
	) :: Matrix{Float32}

Multiple particles -> single vorticity measurement

particle_field_vorticity(
	inducing_particle_positions :: Matrix{<:Real},
	inducing_particle_vorticities :: Matrix{<:Real},
	measurement_point :: Vector{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Vector{Float32}

Multiple particles -> multiple vorticity measurements

particle_field_vorticity(
	inducing_particle_positions :: Matrix{<:Real},
	inducing_particle_vorticities :: Matrix{<:Real},
	measurement_points :: Matrix{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Matrix{Float32}

Compute the vorticity induced in the flow field by vortex particles. The multiple->multiple method may be GPU accelerated.

Arguments

  • inducing_particle_position : Position of inducing particles
  • inducing_particle_vorticity : Vorticity of inducing particles
  • mesurement_points : Measurement points
  • kernel :: RegularisationFunction : Regularisation function (winckelmans_regularisation() for example)
  • regularisation_radius :: Real : Regularisation distance

In 3D, matrix arguments are expected to have size N by 3.

The method will return vorticity as:

  • 3D - S2S: Vector length 3
  • 3D - S2M: Matrix size N by 3
  • 3D - M2S: Vector length 3
  • 3D - M2M: Matrix size N by 3
CVortex.particle_induced_dvortMethod
particle_induced_dvort(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	induced_particle_position :: Vector{<:Real},
	induced_particle_vorticity :: Vector{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Vector{Float32}
	
particle_induced_dvort(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	induced_particle_position :: Matrix{<:Real},
	induced_particle_vorticity :: Matrix{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Matrix{Float32}

particle_induced_dvort(
	inducing_particle_position :: Matrix{<:Real},
	inducing_particle_vorticity :: Matrix{<:Real},
	induced_particle_position :: Vector{<:Real},
	induced_particle_vorticity :: Vector{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Vector{Float32}

particle_induced_dvort(
	inducing_particle_position :: Matrix{<:Real},
	inducing_particle_vorticity :: Matrix{<:Real},
	induced_particle_position :: Matrix{<:Real},
	induced_particle_vorticity :: Matrix{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Matrix{Float32}

Rate of change of vorticity induced on vortex particles by vortex stretching. The multiple-multiple variant may be GPU accelerated. In 2D, vortex stretching does not occur, so there is no 2D counterpart.

Arguments

  • inducing_particle_position : Position of inducing particles
  • inducing_particle_vorticity : Vorticity of inducing particles
  • induced_particle_position : Position of induced particles
  • induced_particle_vorticity : Vorticity of induced particles
  • kernel :: RegularisationFunction : Regularisation function

(VortFunc_winckelmans for example)

  • regularisation_radius :: Real : Regularisation distance

Vector arguments are expected to have length 3. Matrix arguments are expected to have size N by 3.

CVortex.particle_induced_velocityMethod

3D vortex particle functions

Single particle -> single velocity measurement

particle_induced_velocity(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	measurement_point :: Vector{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Vector{Float32}

Single particles -> multiple velocity measurement

particle_induced_velocity(
	inducing_particle_positions :: Matrix{<:Real},
	inducing_particle_vorticities :: Matrix{<:Real},
	measurement_points :: Matrix{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Matrix{Float32}

Multiple particles -> single velocity measurement

particle_induced_velocity(
	inducing_particle_positions :: Matrix{<:Real},
	inducing_particle_vorticities :: Matrix{<:Real},
	measurement_point :: Vector{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Vector{Float32}

Multiple particles -> multiple velocity measurements

particle_induced_velocity(
	inducing_particle_positions :: Matrix{<:Real},
	inducing_particle_vorticities :: Matrix{<:Real},
	measurement_points :: Matrix{<:Real},
	kernel :: RegularisationFunction, regularisation_radius :: Real
	) :: Matrix{Float32}

2D vortex particle functions

Single particle -> single velocity measurement

particle_induced_velocity(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Real,
	measurement_point :: Vector{<:Real},
	kernel :: RegularisationFunction,
	regularisation_radius :: Real
	) :: Vector{Float32}

Single particles -> multiple velocity measurement

particle_induced_velocity(
	inducing_particle_positions :: Matrix{<:Real},
	inducing_particle_vorticities :: Matrix{<:Real},
	measurement_points :: Matrix{<:Real},
	kernel :: RegularisationFunction, 
	regularisation_radius :: Real
	) :: Matrix{Float32}

Multiple particles -> single velocity measurement

particle_induced_velocity(
	inducing_particle_positions :: Matrix{<:Real},
	inducing_particle_vorticities :: Vector{<:Real},
	measurement_point :: Vector{<:Real},
	kernel :: RegularisationFunction,
	regularisation_radius :: Real
	) :: Vector{Float32}

Multiple particles -> multiple velocity measurements

particle_induced_velocity(
	inducing_particle_positions :: Matrix{<:Real},
	inducing_particle_vorticities :: Vector{<:Real},
	measurement_points :: Matrix{<:Real},
	kernel :: RegularisationFunction,
	regularisation_radius :: Real
	) :: Matrix{Float32}

Compute the velocity induced in the flow field by vortex particles. The (multiple->multiple) method may be GPU accelerated.

Arguments

  • inducing_particle_position : Position of inducing particles
  • inducing_particle_vorticity : Vorticity of inducing particles
  • mesurement_points : Measurement points
  • kernel :: RegularisationFunction : Regularisation function (winckelmans_regularisation() for example)
  • regularisation_radius :: Real : Regularisation distance

In 3D, matrix arguments are expected to have size N by 3. In 2D, matrix arguments are expected to have size N by 2.

The method will return velocity as:

  • 3D - S2S: Vector length 3
  • 3D - M2S: Matrix size N by 3
  • 3D - M2S: Vector length 3
  • 3D - M2M: Matrix size N by 3
  • 2D - S2S: Vector length 2
  • 2D - M2S: Matrix size N by 2
  • 2D - M2S: Vector length 2
  • 2D - M2M: Matrix size N by 2
CVortex.particle_pedrizzetti_relaxationMethod

Pedrizzetti relaxation is currently unverified! Use at own risk!

particle_pedrizzetti_relaxation(
	particle_positions :: Matrix{<:Real},
	particle_vorticities :: Matrix{<:Real},
	relaxation_parameter :: Real,
	kernel :: RegularisationFunction,
	regularisation_radius :: Real
	) :: Matrix{Float64}

Use Pedrizzetti's relaxation method to reduce the divergence of a vortex particle vorticity field.

Arguments

  • particle_positions : Position of particles to be redistributed.
  • particle_vorticities : Vorticity of particles to be redistributed
  • relaxation_parameter :: Real : A tuneable parameter equal to delta t * f where f is the parameter. Should in [0, 1], which corresponds to the strength of the relaxation. 1 is very diffusive.
  • kernel :: RegularisationFunction : Regularisation function (winckelmans_regularisation() for example)
  • regularisation_radius :: Real : Regularisation distance

returns

new_particle_vorticity = particle_pedrizzetti_relaxation(...)
CVortex.particle_visc_induced_dvortMethod

Viscous interaction is currently unverified! Use at own risk!

3D functions

particle_visc_induced_dvort(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	inducing_particle_volume :: Real,
	induced_particle_position :: Vector{<:Real},
	induced_particle_vorticity :: Vector{<:Real},
	induced_particle_volume :: Real,
	kernel :: RegularisationFunction,
	regularisation_radius :: Real,
	kinematic_visc :: Real
	) :: Vector{Float32}
	
particle_visc_induced_dvort(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	inducing_particle_volume :: Real,
	induced_particle_position :: Matrix{<:Real},
	induced_particle_vorticity :: Matrix{<:Real},
	induced_particle_volume :: Vector{<:Real},
	kernel :: RegularisationFunction,
	regularisation_radius :: Real,
	kinematic_visc :: Real
	) :: Matrix{Float32}
	
particle_visc_induced_dvort(
	inducing_particle_position :: Matrix{<:Real},
	inducing_particle_vorticity :: Matrix{<:Real},
	inducing_particle_volume :: Vector{<:Real},
	induced_particle_position :: Vector{<:Real},
	induced_particle_vorticity :: Vector{<:Real},
	induced_particle_volume :: Real,
	kernel :: RegularisationFunction,
	regularisation_radius :: Real,
	kinematic_visc :: Real
	) :: Vector{Float32}
	
particle_visc_induced_dvort(
	inducing_particle_position :: Matrix{<:Real},
	inducing_particle_vorticity :: Matrix{<:Real},
	inducing_particle_volume :: Vector{<:Real},
	induced_particle_position :: Matrix{<:Real},
	induced_particle_vorticity :: Matrix{<:Real},
	induced_particle_volume :: Vector{<:Real},
	kernel :: RegularisationFunction,
	regularisation_radius :: Real,
	kinematic_visc :: Real
	) :: Matrix{Float32}

2D functions

particle_visc_induced_dvort(
	inducing_particle_position :: Vector{<:Real},
	inducing_particle_vorticity :: Real,
	inducing_particle_area :: Real,
	induced_particle_position :: Vector{<:Real},
	induced_particle_vorticity :: Real,
	induced_particle_area :: Real,
	kernel :: RegularisationFunction,
	regularisation_radius :: Real,
	kinematic_visc :: Real
	) :: Float32
	
particle_visc_induced_dvort(
	inducing_particle_position :: Matrix{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	inducing_particle_area :: Vector{<:Real},
	induced_particle_position :: Vector{<:Real},
	induced_particle_vorticity :: Real,
	induced_particle_area :: Real,
	kernel :: RegularisationFunction,
	regularisation_radius :: Real,
	kinematic_visc :: Real
	) :: Vector{Float32}

particle_visc_induced_dvort(
	inducing_particle_position :: Matrix{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	inducing_particle_area :: Vector{<:Real},
	induced_particle_position :: Vector{<:Real},
	induced_particle_vorticity :: Real,
	induced_particle_area :: Real,
	kernel :: RegularisationFunction,
	regularisation_radius :: Real,
	kinematic_visc :: Real
	) :: Float32
	
particle_visc_induced_dvort(
	inducing_particle_position :: Matrix{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	inducing_particle_area :: Vector{<:Real},
	induced_particle_position :: Matrix{<:Real},
	induced_particle_vorticity :: Vector{<:Real},
	induced_particle_area :: Vector{<:Real},
	kernel :: RegularisationFunction,
	regularisation_radius :: Real,
	kinematic_visc :: Real
	) :: Vector{Float32}

The rate of change of vorticity induced on vortex particles by elements in the flowfield due to viscosity. The multiple-multiple variant may be GPU accelerated.

Arguments

  • inducing_particle_position : Position of inducing particles
  • inducing_particle_vorticity : Vorticity of inducing particles
  • inducing_particle_volume : Volume of inducing particles
  • induced_particle_position : Position of induced particles
  • induced_particle_vorticity : Vorticity of induced particles
  • induced_particle_volume : Volume of induced particles
  • kernel :: RegularisationFunction : Regularisation function (winckelmans_regularisation() for example)
  • regularisation_radius :: Real : Regularisation distance
  • kinematic_visc :: Real : Kinematic viscosity
CVortex.redistribute_particles_on_gridMethod
redistribute_particles_on_grid(
	particle_positions :: Matrix{<:Real},
	particle_vorticities :: Matrix{<:Real},
	redistribution_function :: RedistributionFunction,
	grid_density :: Real;
	negligible_vort::Real=1e-4,
	max_new_particles::Integer=-1)

redistribute_particles_on_grid(
	particle_positions :: Matrix{<:Real},
	inducing_particle_vorticity :: Vector{<:Real},
	redistribution_function :: RedistributionFunction,
	grid_density :: Real;
	negligible_vort::Real=1e-4,
	max_new_particles::Integer=-1)

Redistribute vorticity from vortex particles onto a regular grid.

Arguments

  • particle_positions : Position of particles to be redistributed.
  • particle_vorticities : Vorticity of particles to be redistributed
  • redistribution_function :: RedistributionFunction : Redistribution function (lambda3_redistribution() for example).
  • grid density :: Real : The distance between newly placed particles on the grid.
  • negligible_vort :: Real : The vorticity threshold at which to discard vortex particles. Given as abs(vorticity) as a proportion of the average particle's abs(vorticity)
  • max_new_particles::Integer : The maximum number of particles that the grid can contain. -1 indicates that any number of particles can be created.

returns

particle_positions, particle_vorts, particle_areas = redistribute_particles_on_grid(...)

where the number of created particles may be less that the maxnewparticles variable, even when the number of particles is limited by the maxnewparticles variable.