Hack to delete particles

Hey,
Working on stuff for the granular doc… I’ve been using @RobertoPorcu’s hack to move particles in src/des/mfix_pc_updates_K.H with something like:

  if (p_realarray[SoArealData::radius][i] < 2.99e-3 ) {
    p_velx_new = p_velx_old;
    p_vely_new = p_vely_old;
    p_velz_new = p_velz_old;
    //
    p_omegax_new = p_omegax_old;
    p_omegay_new = p_omegay_old;
    p_omegaz_new = p_omegaz_old;
  } 

Now, I want to do the case of Zhou et al, Physica A, 269 (1999). Can I make the particles just “vanish?”

If you set particle.id() = -1, that particle should “vanish” the next time a “particles redistribute” operation is called

Thanks, Roberto, I’ll try that

Sounds good. If you want to have an example, you can find a few calls to p.id() = -1 into des/mfix_pc_remove_out_of_range.cpp

That gave me the compiler error

/nfs/scr/2/wfullmer/granular/mfix/src/des/mfix_pc_updates_K.H:93:7: error: ?particle? was not declared in this scope
   93 |       particle.id() = -1;
      |       ^~~~~~~~

ah, p.id() = -1 compiles, let me run my test…

yeah, sorry about that. I wrote particle meaning any variable name you have in your function that refers to a amrex::Particle object.
Do you have anything like this :point_down: in your code?
auto p = pstruct[p_id];

idk Roberto, it’s your code, I’m just butchering it. but that worked. I put a fake particle in so I could count once per dem dt and the side supports were deleted after an initial settling period like I wanted. thanks!

ta da

Can you share the inputs you used for this?