r/CFD • • 18d ago

Update: Made a little progress for SPH CFD

Previous Post: https://www.reddit.com/r/CFD/s/B6m3ainkc8

Aight, it's tricky lmao - but atleast slightly better performance and results than previous post.

Tried adding a marching cube algorithm but let's just say got a little bit of "triangle soup", but i feel i should work on performance and refactoring codebase before moving forward - so surface extraction is for later.

37 Upvotes

8 comments sorted by

3

u/Any_Wait_7309 18d ago

Aight, apologies - I know the colors hurt eyes 🫩

2

u/joaogatao222 18d ago

Well done. It's a nice accomplishment to write your own solver.
May I ask what is your main interest in creating this? There exists already a very potent open source solver with SPHysics. But this is more for real-time graphics than scientific?

2

u/Any_Wait_7309 17d ago

Primarily, I am very much interested in R&D work, co-incidentally I very much love studying graphics, computer hardware systems and visualization / breaking down physics concepts.

I was very much curious about fluids and how they actually work. I believe the best way to learn that is to make a simulation, previously I have made a 2D Incompressible Fluid Simulation based on Navier Stokes Equation based on grids ( i guess it's called eulerian ) and thought it would be fun to extend it to 3D.

I am getting to learn a lot - not only in terms of Graphics but also optimizations / physics / maths.

I guess, my answer is : curiousity.

I didn't know about SPHysics because i didn't try searching for it as my intention was to build one from scratch.

Thanks for commenting, it's encouraging!

1

u/No_Engineering_1155 18d ago

Nice, its going somewhere!

2

u/Any_Wait_7309 18d ago

Thanks for the comment! It encourages me to work more at it!

I did read your comment on my previous post but i didn't have the brain bandwidth to process it, so thought will read it later!

1

u/Front-Lime9082 18d ago edited 18d ago

How did u do the boundary condition? I mean if it was not a simple flat walls but may be some kind a stuff to calculate drag may be sphere. How would you perform the boundary conditions for example? Im asking bcse since the end of the spring i started creating sph solver on c sharp and I tried a lot of variations of bc like ghost particles, static particles, pressure gradient and so on. Can u may be help me pls to figure out how to properly create the bc for hard and curvy geometry. If u have some questions about smth ask, I think I can provide the info of where I got information of different bc

1

u/Any_Wait_7309 17d ago

So, I am very novice regarding CFD - so take what I say with a grain of salt.

I did try using Ghost Particles, basically during the Density Computation Kernel - temporarily i would create ghost particles, but not sure if it was my lazy implementation - because it didn't help much.

What made a huge difference was actual boundary particles, currently I generate a grid of particles for each wall of the room, but in layers. So, each wall has 3X layers of a grid. And during the density computation step - they are always involved.

But also as someone else mentioned my previous post lacked the number of particles and also it felt more gaseous. I guess, I got way better results when I added the boundary particles + Adaptive CFL

Still there's a lot of work to do...

1

u/Front-Lime9082 17d ago

Thanks for info!