doyubkim/fluid-engine-dev

Why no Lamb vector in your Navier-Stokes expressions with buoyancy?

cesss opened this issue · 6 comments

cesss commented

I'm following your book, together with your code, but I need to solve a Thermodynamics problem which looks similar to your smoke problem, although I'm not sure if I can directly use your formulation:

In my case, the boundaries have a known temperature at each element in the boundary mesh. Such temperature is transmitted (via conduction) to the fluid (air) in contact with the boundary. We have convection because of density changes due to temperature (with Boussinesq approximation). Finally, there's also an imposed fixed velocity at the top of the model (due to wind).

As I said, this looks really analogous to your smoke problem.

However, the equation that I should be applying is Navier-Stokes for incompressible fluid (air at low speeds) as for example expressed here, which includes a term you don't consider in your advection/buoyancy sections in your book: the so-called Lamb vector.

Is your formulation for smoke implicitly considering the Lamb vector even if it's not explicitly shown?

How could I modify your smoke solver for the problem I'm trying to solve?

Hi @cesss! Thank you for asking this question.

As you can already see, the buoyancy model in the smoke simulator is an approximation by treating fluid density as a (spatially) constant variable. It does track smoke density (i.e. smoke particle occupancy) and temperature, but they are decoupled from the N-S equation and added back as an external force. To me, this is, in fact, a simplified version of Boussinesq approximation which assumes the density variation is small so that it can be ignored.

To my understanding, Lamb vector appears when you see the N-S equation from a vorticity perspective. But regardless of how the N-S equation is written, mathematically they should be the same. They are just having different forms depending on the needs of a model.

I think you can use the smoke simulator almost as-is. You should remove the negative buoyancy caused by smoke density (i.e. buoyancySmokeDensityFactor=0), and add Dirichlet boundary condition for the temperature field. The boundary condition part might need some work, I think.

Hope this answers to your question!

cesss commented

This is being pretty difficult to me. As you correctly point out in your book, CFD literature is usually targeted to readers who already have a high expertise in fluid mechanics and their maths. However, the main problem I'm finding is not the maths, but the code (in fact, I'm understanding the maths, the problem is that I don't find code that works "out of the box" for the problem I'm solving): There seems to be a complete void of source code "that works", except for your Jet framework, and some finite element packages (FreeFEM, OpenFOAM, SU2, etc), but I didn't find any working package for the finite difference method, nor for the finite volume method, but just for FEM (your Jet framework is an exception, but I'm still finding it difficult to understand it, because what I would need is to program the N-S equations myself, coupled with thermal conduction from boundaries, and then I'd understand it --reusing the smoke solver, whose hypotheses I don't completely understand yet, seems to me more difficult than writing a new solver).

And, even if you choose a FEM package, setting up a solver for a problem can be even more challenging than coding the solver yourself.

I feel a bit lost in this moment. Your book is of great help, but it's more targeted to computer graphics and games, where physical correctness is of secondary importance. I feel like I need to take the Ferziger-Peric-Street book and write the code on my own from chapter 1 to the end of the book. A very long process, I guess...

I feel a bit sad, because I hoped to find some existing code that could model a simple thermodynamics problem like the one I described above, with incompressible air and natural convection with Boussinesq approximation, with coupled thermal conduction from boundary surfaces... but it seems like there's no existing code for doing that (except for the FEM packages I said, but, again, they come with no demos for this problem: you need to set up the solver, and learning to do that is also a difficult task).

Hi @cesss,

Yes, finding the right package is a long journey and I definitely feel your pain! It is also quite hard to hit the right balance between math/code/engineering. You are right. My book was intentionally targeted for the folks with coding background after seeing/consulting people from the industry. Thus, the models are somewhat simplified and explanations are more application-centric.

I still think with a bit of adaptation, Jet Framework should be able to solve some of your problems without design changes to the existing solver. But then, we cycle back to the actual implementation problem :) If you prefer, please ping me via email and we can explore other options (implementing with or without Jet, prototyping ideas, etc).

Thanks,
Doyub

cesss commented

Dear Doyub,

I've been continuing my study on this topic. However, I'm finding difficulties to compare your approach with the approaches in the CFD literature. For example you mention that your implementation of the Finite Differences method is based on Jos Stam's "Stable Fluids" paper. On the other hand, the usual CFD literature shows algorithms like SIMPLE and PISO.

I know that your framework is more targeted at realtime graphics, but I want to implement solvers from the CFD literature. All the available open source CFD packages are huge and very complex, so I find your engine a great place to start, because it's relatively simple yet has important pieces ready for use, like being parallelization-ready, a flexible grid implementation, etc.

Would it be possible to write SIMPLE and PISO solvers with your framework? Could you briefly outline how this would be done?

Thanks!!
Note: I have asked a question at StackExchange (you can see it here) asking about how the method by Jos Stam can be compared to SIMPLE/PISO. I hope some interesting/clarifying answers are posted!

cesss commented

I'm going to close this because I realized it is straightforward to implement SIMPLE, SIMPLER, PISO, etc. solvers in your Jet framework: Just create a new class for a solver and code it there!!

Btw, congratulations, your framework is great!!

Thanks @cesss! :)

Yes, SIMPLE should be quite similar to the Stable Fluids approach. Glad you already found a way to make it!