Guided Examples

Vortex Ring

using FLOWVPM
using LinearAlgebra

rm("ring", recursive=true, force=true)
max_particles = 20
pfield = ParticleField(max_particles);

# Ring parameters
r = 1.0                             # vortex ring radius
n_particles = max_particles         # number of particles in the ring
circulation = 10.0                   # circulation strength

sigma = 2*pi*r / n_particles
d_theta = 2*pi / n_particles
omega = circulation / (pi*r^2)      # Average vorticity
dr = pi*r^2 / n_particles

for i in 1:n_particles
    theta = d_theta * (i-1)
    X = [0.0, r*cos(theta), r*sin(theta)]
    Gamma_hat = cross(X, [-1.0, 0.0, 0.0])
    Gamma_hat = Gamma_hat / norm(Gamma_hat)
    Gamma = omega * Gamma_hat * dr

    add_particle(pfield, X, Gamma, sigma)
end

run_vpm!(pfield, 0.1, 200; save_path="ring")
-------------------------------------------------------------------------

	SOLVER SETTINGS
		  maxparticles----> 20
		   formulation----> formulation_rVPM
		       viscous----> (Symbol("*userfunction"), "FLOWVPM.Inviscid{Float64}(0.0)")
		        kernel----> gaussianerf
		            UJ----> UJ_fmm
		          Uinf----> nofreestream
		           SFS----> SFS_none
		   integration----> rungekutta3
		    transposed----> true
		    relaxation----> pedrizzetti
		           fmm----> FLOWVPM.FMM(4, 10, 0.5, true, 0.001, 0.001, true, true, true, 1.0)
		        useGPU----> 0

	SIMULATION SETTINGS
		dt:			0.1
		Runtime function:	Nothing
		Static particles:	Nothing
		nsteps_save:		1

-------------------------------------------------------------------------
*************************************************************************
START ring/pfield
	2025-08-05T12:11:28.468
*************************************************************************
	Time step 0 out of 200	Particles: 20
	Time step 10 out of 200	Particles: 20
	Time step 20 out of 200	Particles: 20
	Time step 30 out of 200	Particles: 20
	Time step 40 out of 200	Particles: 20
	Time step 50 out of 200	Particles: 20
	Time step 60 out of 200	Particles: 20
	Time step 70 out of 200	Particles: 20
	Time step 80 out of 200	Particles: 20
	Time step 90 out of 200	Particles: 20
	Time step 100 out of 200	Particles: 20
	Time step 110 out of 200	Particles: 20
	Time step 120 out of 200	Particles: 20
	Time step 130 out of 200	Particles: 20
	Time step 140 out of 200	Particles: 20
	Time step 150 out of 200	Particles: 20
	Time step 160 out of 200	Particles: 20
	Time step 170 out of 200	Particles: 20
	Time step 180 out of 200	Particles: 20
	Time step 190 out of 200	Particles: 20
	Time step 200 out of 200	Particles: 20
*************************************************************************
END ring/pfield
	2025-08-05T12:11:31.342
*************************************************************************
ELAPSED TIME: 0 hours 0 minutes 2 seconds

Leapfrogging Vortex Rings

using FLOWVPM
using LinearAlgebra

function build_ring!(pfield, n_particles, r, circulation, x_center)
    sigma = 2*pi*r / n_particles
    d_theta = 2*pi / n_particles
    omega = circulation / (pi*r^2)      # Average vorticity
    dr = pi*r^2 / n_particles

    for i in 1:n_particles
        theta = d_theta * (i-1)
        X = [x_center, r*cos(theta), r*sin(theta)]
        Gamma_hat = cross(X, [-1.0, 0.0, 0.0])
        Gamma_hat = Gamma_hat / norm(Gamma_hat)
        Gamma = omega * Gamma_hat * dr

        add_particle(pfield, X, Gamma, sigma)
    end
    return pfield
end

rm("leapfrog", recursive=true, force=true)
max_particles = 40
pfield = ParticleField(max_particles);

# Ring parameters
r = 1.0                             # vortex ring radius
n_particles = max_particles         # number of particles in the ring
circulation = 10.0                   # circulation strength

build_ring!(pfield, max_particles/2, r, circulation, 0.0)
build_ring!(pfield, max_particles/2, r, circulation, r)

run_vpm!(pfield, 0.1, 200; save_path="leapfrog")
-------------------------------------------------------------------------

	SOLVER SETTINGS
		  maxparticles----> 40
		   formulation----> formulation_rVPM
		       viscous----> (Symbol("*userfunction"), "FLOWVPM.Inviscid{Float64}(0.0)")
		        kernel----> gaussianerf
		            UJ----> UJ_fmm
		          Uinf----> nofreestream
		           SFS----> SFS_none
		   integration----> rungekutta3
		    transposed----> true
		    relaxation----> pedrizzetti
		           fmm----> FLOWVPM.FMM(4, 10, 0.5, true, 0.001, 0.001, true, true, true, 1.0)
		        useGPU----> 0

	SIMULATION SETTINGS
		dt:			0.1
		Runtime function:	Nothing
		Static particles:	Nothing
		nsteps_save:		1

-------------------------------------------------------------------------
*************************************************************************
START leapfrog/pfield
	2025-08-05T12:11:31.595
*************************************************************************
	Time step 0 out of 200	Particles: 40
	Time step 10 out of 200	Particles: 40
	Time step 20 out of 200	Particles: 40
	Time step 30 out of 200	Particles: 40
	Time step 40 out of 200	Particles: 40
	Time step 50 out of 200	Particles: 40
	Time step 60 out of 200	Particles: 40
	Time step 70 out of 200	Particles: 40
	Time step 80 out of 200	Particles: 40
	Time step 90 out of 200	Particles: 40
	Time step 100 out of 200	Particles: 40
	Time step 110 out of 200	Particles: 40
	Time step 120 out of 200	Particles: 40
	Time step 130 out of 200	Particles: 40
	Time step 140 out of 200	Particles: 40
	Time step 150 out of 200	Particles: 40
	Time step 160 out of 200	Particles: 40
	Time step 170 out of 200	Particles: 40
	Time step 180 out of 200	Particles: 40
	Time step 190 out of 200	Particles: 40
	Time step 200 out of 200	Particles: 40
*************************************************************************
END leapfrog/pfield
	2025-08-05T12:11:31.957
*************************************************************************
ELAPSED TIME: 0 hours 0 minutes 0 seconds

Leapfrog simulation