Skip to content

Particle field not correctly exported to vtk #38

Description

@RaphaelBevand

Description

When running the tutorial vortex ring tutorial, the particles are all over the place in ParaView. When I export the positions to a csv file and plot them, they are on the circumference of the vortex ring as intended.

Example code

This slightly adjusted code was used. It saves the positions before and after the run_vpm call to a csv file. The positions are along a circle, but have somehow not changed, i.e. have same radius before and after the simulation.

using FLOWVPM
using LinearAlgebra

# Define particle field
rm("ring", recursive=true, force=true)
max_particles = 20
particle_field = ParticleField(max_particles);

# Define vortex ring parameters
ring_radius = 1.0
n_particles = max_particles
circulation = 100.0

circumference = 2.0 * pi * ring_radius
area = pi * ring_radius^2

sigma = circumference / n_particles 
vorticity = circulation / area
delta_theta = 2.0 * pi / n_particles
delta_radius = area / n_particles

for i in 1:n_particles
    theta = delta_theta * (i - 1)
    position = [0.0, ring_radius*cos(theta), ring_radius*sin(theta)]
    gamma_hat = cross(position, [-1.0, 0.0, 0.0])
    gamma_hat = gamma_hat / norm(gamma_hat)
    gamma = vorticity * gamma_hat * delta_radius
    add_particle(particle_field, position, gamma, sigma)
end

open("output.csv", "w") do file
for i in 1:n_particles
        position = FLOWVPM.get_particle(particle_field, i)
        println(file, position[1], ",", position[2], ",", position[3])
    end
end

FLOWVPM.save(particle_field, "test")

dt = 0.01
n_steps = 100
run_vpm!(particle_field, dt, n_steps, save_path="ring")

open("output-final.csv", "w") do file
for i in 1:n_particles
        position = FLOWVPM.get_particle(particle_field, i)
        println(file, position[1], ",", position[2], ",", position[3])
    end
end

Additional Notes

I installed all the relevant repositories from ByuFlowLab in development mode commenting out the [compat] section in the Project.toml because I always ran into issues with version compatibilities between dependencies.

import Pkg

# Clone repositories 
# Install dependencies like below ...
Pkg.develop(path="FastMultipole")
Pkg.develop(path="FLOWVPM")

I had the same behavior with weird particle positions in vtk when running the simple wing example in FLOWUnsteady.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions