Re: [deal.II] Particles and field interpolation error

2020-07-22 Thread franco.m...@gmail.com
Aha! That was the missing piece, thanks, you've solved the problem! Thanks! Franco On Wednesday, July 22, 2020 at 8:15:30 AM UTC+2 luca@gmail.com wrote: > Dear Franco, > > you need read access to the locally active dofs, not just the locally > owned dofs. > > Take a look at how things

Re: [deal.II] Particles and field interpolation error

2020-07-21 Thread luca.heltai
Dear Franco, you need read access to the locally active dofs, not just the locally owned dofs. Take a look at how things are done in step-70: the vector that is used to interpolate the field on the particles is a read-only ghosted vector, that contains the locally relevant dofs locally

Re: [deal.II] Particles and field interpolation error

2020-07-21 Thread franco.m...@gmail.com
Thanks for your hint, now the parallel distributed triangulation works and global particles are correct. However, it crashes when interpolating the field on particles. This is how I initialize the field vector: GridGenerator::hyper_cube(triangulation, 0, 1); triangulation.refine_global(

Re: [deal.II] Particles and field interpolation error

2020-07-21 Thread franco.m...@gmail.com
Thanks for your hint, now the parallel distributed triangulation works and global particles are correct. However, it crashes when interpolating the field on particles. This is how I initialize the field vector: GridGenerator::hyper_cube(triangulation, 0, 1); triangulation.refine_global(

Re: [deal.II] Particles and field interpolation error

2020-07-20 Thread luca.heltai
Dear Franco, what type of triangulation are you using? If you look at the code that is run with `update_cached_numbers` https://github.com/dealii/dealii/blob/9e50f3ac04d088a9d2ffa74a81f08348e7f98a65/source/particles/particle_handler.cc#L173 you will see that the numbers are updated (just as y

Re: [deal.II] Particles and field interpolation error

2020-07-20 Thread franco.m...@gmail.com
Dear Luca, thanks for your answer, I've moved along but I am still encountering problems in the interpolation. This seems to be a problem with the way I use PETSc. So, as far as I understand, I need to initialize a PETSc vector of length n_global_particles * components (in my case, 2, the spac

Re: [deal.II] Particles and field interpolation error

2020-07-16 Thread luca.heltai
Ciao Franco, ParticleHandler was built with the intention of “losing” particles whenever they fall out of the domain. This is the default behaviour of the ParticleHandler, and unless you store a pointer to an existing particle somewhere, you should not be in trouble. If you iterate over the

Re: [deal.II] Particles and field interpolation error

2020-07-16 Thread franco.m...@gmail.com
Thanks, Luca. I have read the documentation, that's why I was skeptic of my own code: I still think I am doing it wrong. As far as I understand from the documentation, particles should be removed from the handler after updating the cache, and thus the interpolated field should not contain the

Re: [deal.II] Particles and field interpolation error

2020-07-15 Thread Luca Heltai
Franco, The interpolated field says that the field value is zero (on the line above your arrow). This is how it is documented: if a particle is removed, its interpolated value is left unchanged in the target vector. Zero in your case. Luca > Il giorno 15 lug 2020, alle ore 18:18, Franco Milic

[deal.II] Particles and field interpolation error

2020-07-15 Thread Franco Milicchio
Dear all, I am playing with 9.2 and particles, but I've encountered a weird problem. If I remove a particle, the interpolated field on particle locations yields a wrong answer. My code does (now) everything by hand: // Here be drangons... Point<2> p_0(0.1,0.5); auto ref_cell_0 = GridToo