Leopart - Writing particle locations to XDMF

Dear all,

Currently I am trying to implement lagrangian particle tracking in an incompressible Navier stokes solver in FEniCS. To this end, I installed LEoPart, a library that adds Lagrangian particle functionality to FEniCS.

My code follows the incompressible navier stokes demo from fenics. I use LEoPart to create particles inside the velocity field and to advect them every timestep.

To get a visual insight into the functioning of the code, I would like to save the particle locations to an XDMF file for post-processing in Paraview.
The section for introducing particles, advection and post-processing looks as follows:

# Initialize particles
xp = RandomSphere(Point(0.0,-0.016,0.0),0.001).generate([100, 100, 100])
part = particles(xp, [], mesh)
ap = advect_particles(part, V, u_,"closed")
xp0 = part.positions()

 ap.do_step(dt)
 xpE = part.positions()
points_list = list(Point(*pp) for pp in part.positions())
XDMFFile(os.path.join("/home/tkonings/fe1/LPTresult/", str(t)+"particles.xdmf")) \
 .write(points_list)

However, I get the following error:

HDF5-DIAG: Error detected in HDF5 (1.10.4) MPI-process 0:
  #000: H5Dio.c line 336 in H5Dwrite(): can't write data
    major: Dataset
    minor: Write failed
  #001: H5Dio.c line 828 in H5D__write(): can't write data
    major: Dataset
    minor: Write failed
  #002: H5Dmpio.c line 671 in H5D__contig_collective_write(): couldn't finish shared collective MPI-IO
    major: Low-level I/O
    minor: Write failed

What could be the reason for this error?
Is there a better way to output and visualize particle locations in 3D when using LEoPart in parallel?

Thank you in advance for your attention to this matter.

It turns out that I was not creating any particles with RandomSphere (perhaps due to my inappropriate usage), this resulted in the error.
When using RandomBox, I managed to create particles and this made the code above function appropriately.

1 Like