CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Arbitrary rigid bodies in coarse grid (https://www.cfd-online.com/Forums/main/100306-arbitrary-rigid-bodies-coarse-grid.html)

 DrummerB April 23, 2012 18:12

Arbitrary rigid bodies in coarse grid

Hi!

I'm trying to implement a realtime smoke simulation in 2D. I spent the last two weeks experimenting with different approaches in the CFD field.

I successfully implemented an Eulerian fixed-grid algorithm (based on this and this article) and it works as expected.

http://i.imgur.com/s9IsV.png

Now I'm trying to figure out how to include rigid bodies to the simulation. I think I understand the theory:
The velocity at the boundaries has to be updated. Either the normal component of the velocity (free-slip) or the whole velocity vector (no-slip) has to be set to 0.
The pressure gradient has to be zero at the boundaries.

I could easily implement this if the rigid bodies would fit exactly into the grid. But what if that's not the case?

http://i.imgur.com/XnkQp.png

Imagine an upstream airflow in the above situation. At the rectangle's bottom edge, in which cells would I set the velocity to zero? The ones that are completely outside (below) the rectangle, the ones on the edge or the ones inside? None of these seem to be a good idea, because either the smoke would be redirected early (making it look like the rectangle had some repellent force on it), or the smoke would go inside of the box. At least that's how I see it.

And it just gets more complicated once I start to rotate the objects.

http://i.imgur.com/wgOJy.png

Is there a way to prevent staircase artifacts in this case and make the smoke flow smoothly around the box (beside increasing the resolution)?

I was thinking about using dynamic resolution (higher around bodies) or dynamic meshes. What do you think? Is there a better solution?

I also looked into vortex based approaches instead of fixed grids. But I couldn't yet figure out how to implement rigid bodies in that method either.

Thanks for reading. Any help would be very appreciated!

 cdegroot April 23, 2012 19:17

I believe what you want to use is the "immersed boundary method". I am no expert on this, so I can't offer you any good references.

 cdegroot April 23, 2012 19:19

Of course you can also use unstructured grids, but this would require some reworking of your code.

 Rami April 24, 2012 02:59

Unstuctured grid is indeed the most flexible option. However, maybe you can solve your problem using a structured BFC (body fitted coordinates) grid aligned with your objects, while still retaining a single block topological structure.

 arjun April 25, 2012 20:22

Quote:
 Originally Posted by Rami (Post 356583) Unstuctured grid is indeed the most flexible option. However, maybe you can solve your problem using a structured BFC (body fitted coordinates) grid aligned with your objects, while still retaining a single block topological structure.

Do not agree.

When there is motion in solids the unstructured grids are more hinderance than help.

 DrummerB April 26, 2012 05:09

Quote:
 Originally Posted by arjun (Post 357066) When there is motion in solids the unstructured grids are more hinderance than help.
Why is that? Because it's difficult and/or time consuming to automatically set up a grid? I was thinking that since I wanted to achieve real time performance anything that included changing the grid at every frame wouldn't be fast enough.

EDIT:
Body fitted grid's seem to have the same problem.

EDIT 2:
Do you think SPH would be a good approach for smoke? I've not seen anything but water simulations with SPH and I'm not sure how much vorticity would be conserved.

 arjun April 26, 2012 09:42

Quote:
 Originally Posted by DrummerB (Post 357136) Why is that? Because it's difficult and/or time consuming to automatically set up a grid? I was thinking that since I wanted to achieve real time performance anything that included changing the grid at every frame wouldn't be fast enough.
Yes.
I understand you are not overly interested in ultra accuracy. What you want is real time type performance.

Quote:
 Originally Posted by DrummerB (Post 357136) EDIT: Body fitted grid's seem to have the same problem. EDIT 2: Do you think SPH would be a good approach for smoke? I've not seen anything but water simulations with SPH and I'm not sure how much vorticity would be conserved.
My experience is that Cartesian grid and immersed boundary would be fastest if the Cartesian grid is uniform.
Use finite difference and extend the stencil till the body surface. This is fastest way to represent general body and that would allow fast movement too.

(even in non uniform cartesian mesh one can mark body very very fast.)

If the flow viscosity is large enough than lattice boltzman would be the fastest approach to this problem. And good thing with lattice boltzman is that you could program it in GPU too.

SPH would be bad approach as it asks you to mark neighbors after every step. This means doing nearest neighbor search, which will slow you down very much. Not worth the effort.

 DrummerB April 26, 2012 09:58

Thanks very much. I will look into Immersed Boundary Methods.

Do you know any good resource where I could read about it? Most of the things I find with Google are either restricted (pay to view) or too math based. Now, both wouldn't be a problem (I'm happy to pay for a good article) but I'd rather not buy something without knowing if it's what I'm looking for. And the math heavy papers generally don't care a lot about performance and aim for accuracy.

 arjun April 26, 2012 10:09

Quote:
 Originally Posted by DrummerB (Post 357207) Thanks very much. I will look into Immersed Boundary Methods. Do you know any good resource where I could read about it? Most of the things I find with Google are either restricted (pay to view) or too math based. Now, both wouldn't be a problem (I'm happy to pay for a good article) but I'd rather not buy something without knowing if it's what I'm looking for. And the math heavy papers generally don't care a lot about performance and aim for accuracy.

Nothing special is needed for immersed boundary. The velocity field is supposed to follow velocity of solid in the region where solid lies. This you could force by many methods. If you are using Gauss Seidel type iterations then you can just keep replacing velocity to be equal to that of solid even during the iterations. Otherwise a matrix based approach can force the velocity (i will write down tomorrow how i did few years back).

Rest of the algorithm is same. Solve the pressure equation etc exactly the way you do otherwise.

Just force the velocity field.

PS: If you are interested in very accurate results then things do get complicated. By accuracy I mean say , want to predict lift and drag on a rotating body. (In this case you will need ghost cell based immersed boundary). Please search cfd-online i made a explanatory comment about it long back.

 All times are GMT -4. The time now is 17:41.