Need help to exclude particles according to an addtional pattern


I wanna implement particles refinement in dualsphysics. and it is already done (only refinement without derefinement). Details show in picture.

red particles means the daughter particles.And they should be excluded once they leave the refinement zone.But obviously, it didn't happen.

So the problem is the derefinement process do not work.
Here is the changes in code for definement process:
1.Type.h Declare a new particles code 0xc000 for merge.
2.JSphCpu.cpp-------UpdataPos. if the daughter particles leave the refinement zone set the code Outmerge. for countting particles which have the code Outmerge.

Maybe some thing i missed. I read the code JCellDivCpuSingle.cpp------PreSort. where set the cellpart[code_outxxx particles]=BoxFluidOut. So, i think it should be worked. But it didn't.

Thanks for any response.


  • OK,all done
    12.png 30.2K
  • Awesome, well done! Can I give you some suggestions?
  • @Asalih3d
    Of cause, thanks.
    It is very tired working alone
  • Okay, so one of my suggestions would be to implement something like this idea. When you start generating daughter particles I imagine that the former parent particle must be destroyed. This can make it a bit hard to track what is going on ie. which particles are daughters of which parent particles etc. So I imagine a system like this (example for ONE particle):
    1. Father particle 1 has an idp = 1, refinement = 0 (refinement is a new array I made up)
    2. Father particle is then split in 4 daughter particles and then destroyed, ie. idp = 1 is removed completely
    3. Daughter particles are then given idp = 1A, idp = 1B, idp = 1C, idp 1D and each of them is given refinement = 1
    4. Then if these particles get split into 4 again (might not be possible now), but maybe in future, then idp = 1A, 1B, 1C, 1D would be destroyed and new particles would have idp = 1AA, 1AB, 1AC, 1AD etc. and every particle would get refinement = 2 now
    In this way having the daughter reflect which parents they came from, one could make an algorithm to visualize how particles are split up in Paraview, which can be useful for verifying if code is functioning properly. Also having the refinement array makes it easy to see which particles have been split a lot.

    One of the problems with this approach might be that idp cannot become an array of numbers anymore, since A and B has to represented in another way (as far as I understand) to make it properly human readable.

    Then another approach would be:
    1. Use three arrays, idp, idpold and refinement, and let father particle have idp = 1, idpold = nothing/NaN/empty and refinement 0
    2. When a father particle becomes 4 daughter particles, delete father particle, then give idp = 1, idp = 2, idp = 3, idp = 4 and let all have idpold = 1 and refinement now becomes 1
    Which is a bit simpler and would achieve the same thing as before, making you able to properly see what is happening. I don't know if this is what you've done earlier, so just wanted to suggest it anyways.

    Kind regards
  • @Asalih3d
    Very useful. You are saying the crucial problem in my changes.
    But some are different with your imagine.
    1. Parent particles don' t have to destroy, deactivate them, treat them just like the normal particles, they can move. But they have no contribution to their adjust particles. When they leave the refinement area, activate them, changing to normal particles.
    2. If the mass (a new array) of normal particles (also parent particles) is 1. Then the mass of daughter particles will be 0.25 (one parent particle split to four daughter particles). Then we can distingulish daugther particles and parent particles.
    3. When we add new particles (daughter particles). We can assgin a value (a big value, at least an order of magnitude, and it links to their parent id) to their id. Then we can know how is their father. That why in the upper figure, the red point means daughter particles, a big id. But, i am not sure if wo really need to know which their father particle is.
    4. And i add a new array idps, like a bool variable. 0 means this particles have no daughter, they can split once they satisfy the conditions. 1 means they have daughter, then they would not split even they satisfy the conditions.

    And, as you say. We can add something for debugging, i am really weak about this.
    Thanks for suggestions

    Kind regards
  • Ah okay, I see now what you mean, I thought you were using another method, my bad. Hope the suggestions might be helpful in some way. But the work you are doing / implementing is very interesting, looking forward to see more about it in the future.

    Kind regards
Sign In or Register to comment.