Possible "Quick-Fix" for Variable Particle Resolution and request for feedback

Hello everybody!

As some of you might be aware, I have for some time worked on making tools for reading data directly from the bi4 files, with the help of my brother.

So for example what I have been able to do other than just reading files, is to modify the file which DualSPHysics uses to generate the particle distributions. So for an example for the "examples/main/11_Floating", 2D case - where a floating sphere in 2D is falling down a column of water - one would normally get a distribution like;

WHere it is clear that this sphere, does not represent a circular shape very well. Using the utility I have been working on I could modify the geometry to;

Which in my opinion, represents a circular shape better, but one can discuss this at length etc. The point is that it is possible, if one wants it enough.

The why I have done it is basically to generate the usual files by initializing the case as normally, then copying the "Part_Head.ibi4" out of the data folder, deleting rest of the content inside and running my code, which overwrites the position properties of the selected particles.

I originally intented to present this at the workshop, but it was postponed due to the COVID-19 situation, so I just wanted to hear, if anyone would like to play around with this or support this project in some way?

Just to give people a general feel of the process, I have included the main code I used to do this for this case;

And then one just has to run the DualSPHysics case, without using "GenCase".

Kind regards


  • Nice work. I want to do the same thing. But i just re-distribute the particles in the main code, it easy to code, but poor compatibility.

    And im interested in your code about loading and writing the bi4 file. I coded a lot base on dualsphysics, and that bring a trouble that how i load and write my new arrays, and other operate ,like restart. And i have no time to do with it now.

    Are you base on the simple geometry? i mean circle, etc.... just bulid it in polar coordinates, then convert to cartesian coordinate system.

    In my opinion, i think maybe it isn't a good choice. Because diffcult to deal with the complex geo. So, i think if we build it in some other CAD software, even mesh building software like ICEM. And then load it in our SPH code. After that, i think maybe it would be better if we rebuild the fluid particles. like pacing algorithm

    Anyway, maybe we can keep in touch.

  • the reason i think the fluid particles sould also be re-distribute is because you can see in your second figure, there ard some void between the floating and fluid, which i have no idea if it is important, maybe. we can set a higher resolution but it is clear that these void won't go away.

  • All these issues are already solved in version 5.0 that we plan to release soon.

    You can read something we are preparing in section 7.2.4 FreeDrawMode at https://github.com/DualSPHysics/DualSPHysics/wiki/7.-Testcases#72-extra-examples

    It will be available soon


  • edited March 17

    Nice to hear that, waiting for the release

  • edited March 17

    And some other questions, for the MDBC.

    I ve noticed all the examples in your youtube channel about MDBC are modeling the fixed wall or maybe motive wall. So if it available for the floating object? or , maybe working on it, and it would be done before the release?

    Moreover, in my opinion, all mirror based BC have a common drawback, which is handling the complex geometry, and MDBC is one of mirror based method. So, how the dualsphysics team think about it, maybe some test. At least i think DBC is still a good tool for aribitary boundary.

  • @JOJO

    Thanks for you very much for your interest. I agree with you that it is not the best way to do this, i.e. using a CAD program or some utility to generate points would be better, but this was also more a proof of concept. Yes, one should also change fluid particles to match the geometry a bit better, but when I ran the simulation I couldn't detect any "visual" errors at least.


    Awesome to hear about the new option! I had no idea it was coming. Looking forward to testing it out.

    Kind regards

  • @Alex

    Awesome news! Thanks for all the work the DSPH team is doing!

    I have the same question as @JOJO :

    "I ve noticed all the examples in your youtube channel about MDBC are modeling the fixed wall or maybe motive wall. So if it available for the floating object? or , maybe working on it, and it would be done before the release?"


  • Next release v5.0 will include mDBC only for fixed or moving objects, but not for floating objects since we are still working on that


  • @Alex Thanks for the answer !


  • I am looking forward to test the official version from DualSPHysics, but I kept playing around with my own tool and by accident I discovered this cool possibility to simulate permeability

    Where I just had a tank of fluid on a floor with some random noise attached to it.

  • @JOJO

    The paper you mentioned, Particle packing algorithm for SPH schemes, do you happen to have tried to implement it your self?

    I am trying to do it since I managed to make geometry like this using my tool;

    But as is evident the intial fluid distribution is now placed very badly to the new profile - therefore I need to use something like the Particle Packing Algorithm you mentioned. Currently I am trying to remake their figure 15 in Matlab;

    But unfortunately I am not able to do it, I am having some mistake which makes my initial distribution (left side) drift out of bounds..

    If you happen to have a simple implementation of their algorithm or can make an example for me, it would be very beneficial.

    Kind regards

  • More information can be found in section 7.2.4 FreeDrawMode of:

  • edited March 30

    Thank you very much @Alex ! That looks so exciting! It makes it a lot easier to do many things, especially with the new mDBC constraint. I assume that the freedrawmode can be used for both fluid and solid particles?

    And also it can take any arbitrarily complex body right? So in theory it should be able to generate a profile like this, if I input an 3d file of this shape?

    Kind regards, can really not wait to test the new release :-)

  • That would be a game-changing feature in my opinion!

    Thanks for all the work the DSPH team is doing!

  • With the release of the new DualSPHysics beta, which has the possibility to use the free draw mode, it seems that this kind of tool is not necessary more. So I just wanted to post the last result, which is;

    Where I managed to use the algorithm to fill a square domain using the initial circular distribtuion shown earlier in the thread. So finally think I understood so I am pretty happy :-)

Sign In or Register to comment.