Inlet/Outlet - Vortex Error

Hello guys!

Thanks for the new release, very exciting. I have modified the example with flow over cylinder a bit, and I think I found something less optimal:

Instead of a cylinder I placed a rectangle covering 3/4 of the width of the channel, and the problem I observe is marked with yellow that the particle density is getting scarily low. This might be in connection with the second problem I observe which is that suddenly back flow occurs due to rotation of fluid:

Which of course can be solved by making the channel longer, but then I get a a very high amount of particles. Has anybody found another fix for this situation?

Kind regards


  • I made it longer now, to avoid the vortex overlap issue, but the issue with particles falling down still occurs. Gravity is not enabled.

    Trying to keep testing, any suggestions would be welcome!
  • The error seems to have be found - a very high shifting coefficient of -20 was used in the example. By lowering it to two I see:

    So now I am trying to adjust shifting until it stays "physically" correct.
  • Asalih,

    You should provide your XML section of I/O so we can see exactly what you are doing.
    Yes, you need to adjust your shifting coefficient to act sufficiently well for your case.
    Also, I would recommend checking that the threshold for the shifting correction at the free surface is not active, set that equal to a negative number to be sure.
  • @taffo thanks!

    Here it is as requested. I will try setting ShiftTFS to -5 instead of 0, but should be the same. Do you have any more suggestions?

    Kind regards
  • Now I've changed to artifical viscosity, and the problem with voids have been solved, but unfortunately, it seems like the SPH method cannot handle vortices at the outlet, which means I have to use way too many particles I think. Maybe I am doing something wrong:

    Picture to show what I mean. Coloured by idp
  • Hello all and @Asalih3d!

    I'm having the same problem. Fluid particles interact with a blunt object and at the regions where the fluid separates and I get void regions. I am using Laminar+Sps viscosity, so far I have tried adjusting the shifting coefficient and particle resolution but nothing seems to be working. I was wondering if you managed to find a solution other than using artificial viscosity.


  • Hello @circles

    I would love to help, but it seems like that all the pictures are gone... It seems like what helped me was playing with the shifting coefficient parameter - if your case is 2D I advise using artificial viscosity, and then doing the transformation from artificial to "viscous" Reynolds number, read this thread:

    If you insist on using Laminar+SPS, remember to activate delta-sph - Laminar-SPS gives density increases over time, which most of the time are alleviated by using delta-sph, which has a density diffusion term. Not necessary all the time, but handy to know

    Kind regards

  • @Asalih3d Thanks! I am running a case with a higher shifting coefficient(in magnitude) and higher particle resolution, after that I will play with delta-sph and post my updates here. Probably all tests will take about a week.

  • Yes, great hope you are able to do so - we need a lot more organized testing of different scenarios to improve DualSPHysics in my opinion. So hope you are able to make some nice tests.

    Kind regards

  • Above is the simulation with Laminar+Sps, no delta-sph and shifting coefficient of -20.

    When I activated delta-sph, change shifting coefficient to -40 and use artificial viscosity(0.4), I still get voids but it's much better.

    Few observations,

    Shifting coefficient by itself did not really affect anything. I ran 3 cases with laminar+SPS viscosity, and I played with it (-20,-30,-40). Should I keep playing with it?

    Artificial viscosity: I tried with 0.01,0.05,0.4 and as I increase it, the voids seem to disappear. However, 0.4 is way too high compared to what I want the kinematic viscosity to be. (

    I should mention that the speed of sound is about 50 times higher than the maximum velocity. I might try to run a case where speed of sound ~ 150*Umax.

    I believe next thing to play with is the number of particles.

    ** For all the cases Reynolds number is about 750. And that's pretty low compared to the Re I eventually would like to achieve.

  • It looks inded much better now! I assume it is flow inside of a pipe - have you considered looking at the Poisiuelle flow example? If I recall correctly they had a large amount of particles and sufficient parameters, to stabilize it. I think playing with delta-sph (which has changed name to DensityDT in future releases according to other form posts) is redundant - look now at number of particles, also your choice of speed of sound seems reasonable. I suggest you might have to lower it a bit in the future, if you have to use a lot of particles.

    Kind regards

  • So. the driving force is the acceleration(gravity) in that example. And in fact, if I take gravity or external force applied on particles to be the driving force I do not get those void regions. Things start to act this way whenever I use in/outflow.

  • Even if I set the driving force to be motion of a plate/piston at the inlet, it's much much better compared to inflow/outflow.

  • @circles When you initialize with inlet/outlet, is the pipe empty or filled with water? I think that might be the reason.

    Kind regards

  • It is filled with water otherwise those void regions get amplified. So, I ran 2 cases.

    I kept speed of sound, shifting coefficient and delta-sph to be same.

    c= 75*Umax



    I played with number of particles(dp). Case A is the higher resolution case and in Case B initial particle spacing dp is twice the one in Case A. In lower resolution case, the voids are not there but as I increase the resolution the void regions become more prominent. I would expect it to get better with increasing resolution.

  • @circles Try to use the increased resolution, but manually set the smoothing length in the XML file, as the previous smoothing length from the more rough case.

    Kind regards

  • @Asalih3d It worked. So with that we doubled the smoothing length. Are we not losing accuracy there since now the particles are allowed to interact with more particles?

  • Awesome, this thread spent over a few weeks, feel free to make a short review of what you did before it finally worked, so other can benefit more easily.

    Regarding your question, to my understanding, it is the opposite case. You are increasing the smoothing length and letting particles interact with more particles, so you should get a more numerically robust solution, with in theory a higher accuracy. Remember that when the smoothing length increases, the interaction domain which particles have to deal with, increases as well.

    What DualSPHysics does is that when you increase the number of particles it decreases the smoothing length, since it wants to simulate as efficiently as possible - in most cases this is totally fine behaviour, but for pipe flows where a volume has to be filled out, a bigger smoothing length ensures that this behaviour is not lost.

    Hope it made some sense, kind regards

  • So, let's say we are interested in eating disorder in European countries. We are increasing our sample pool by adding data from Eastern, Western, Central Europe. Now if I increase the size of my pool and start adding data from America, the results would be more robust or "smooth" since I have more samples but not necessarily reflect what I wanted to measure locally. So as the interaction domain increases, I feel like we are losing information in a local scale.

    Now, I am trying to get it to work with Lam+SPS viscosity, I will make a short review once I figure it out. But, as viscosity goes down(Re goes up) void regions get more prominent even with artificial viscosity.

  • I like your methaphor, but I don't believe that is how it works. In theory the best thing to do in SPH is to let all particles affect each other, but due to computational limitations, we have to use a smoothing length if we want to finish simulations in a reasonable time. You don't lose local information when you increase the smoothing length, since the number of particles "locally" is the same - but you let more particles affect a local space, which will increase accuracy. You are free to conduct tests to disprove this, but afaik this is how it works.

    To make it work with Lam+SPS, remember to enable delta-SPH (DensityDT in future), to ensure that the artificial density increase is handled due to the nature of Lam+SPS. Also shifting will probably be necessary since it is a 2D case - remember though; turbulence is a 3d phenomena, this is why lam+SPS is not suggested for use in this kind of scenario, but should be possible.

    Kind regards

Sign In or Register to comment.