tum-pbs/PhiFlow

Flat obstacles in 3D space

Closed this issue · 7 comments

Hi,

I was wondering what is the best way to represent a flat (or nearly flat) obstacle in 3D space. (Like a sheet of paper.) I tried OBSTACLE = Obstacle(Box(x=(5, 95), y=(50, 51), z=(0,100)) and this seemed to possibly work, but I couldn't tell for sure. When I added a rotation with OBSTACLE = Obstacle(Box(x=(5, 95), y=(50, 51), z=(0,100)).rotated((0,0,0.15))) it's even harder for me to tell if it's working or not.

I am using the default solver (MacCormack) which I believe is grid-based. I wonder if a particle-based solver you have would better deal with this type of boundary condition, and if not, if there's another way to ensure that no fluid gets past this thin obstacle. Or perhaps the simulation is working as it is?

I would also like to have flat triangular obstacles, but I haven't found a way to do this yet. What is the best way to accomplish this?

Any guidance here would be much appreciated. Thank you!

Here is the animation of a rotated obstacle (XY-plane cross-section of the 3D simulation):
rot
Here is the non-rotated obstacle:
no_rot

Hi @crackalamoo,

The obstacle is mapped to the grid in order to work with the simulation. It needs to be thick enough to include the centers of all connected grid cells, else there will be holes. In order to see whether resampling works correctly, you can plot the resampled obstacle like so:

box = Box(x=(5, 95), y=(50, 51))
rotated = box.rotated(0.15)
show(CenteredGrid(box, x=64, y=64, bounds=Box(x=100, y=100)),
     CenteredGrid(rotated, x=64, y=64, bounds=Box(x=100, y=100)))

obstacles

Or for 3D, you can plot slices, e.g.

box = Box(x=(5, 95), y=(50, 51), z=(0,100))
rotated = box.rotated(vec(x=0,y=0,z=0.15))
show(resample(box, smoke).z[15], resample(rotated, smoke).z[31])

obstacle_slice

Here, the obstacle was too thin to be sampled correctly on the grid.

However, with a thick enough obstacle, the simulation should work. Here is a 2D example:

2D_flat

Also if there are strange numerical artefacts, you might want disable the pressure solve preconditioner (if you are using one).

Hi @holl-

Thank you for your prompt response, this is very helpful. Is there a way to create flat triangular obstacles in 3D space? Can this be accomplished with heightmaps as in #147 ?

Do you mean a thin triangle or a prism with a triangular cross section? Do you have a picture of what the geometry should look like?

I mean a thin triangle. Here is a plot in Matplotlib:

triangle

Okay, for this you could approximate your triangle with multiple boxes, i.e. something like this

y = math.linspace(0, 2, instance(tri_boxes=30))
g = geom.rotate(Box(x=.5 * (y[:-1] + y[1:]), y=(y[:-1], y[1:])), .2, pivot=vec(x=0, y=0))
show(CenteredGrid(g, x=64, y=64, bounds=g.bounding_box()))

It's not perfect but should do the trick. In this example, I build up a triangle from 30 boxes. The union of boxes is represented by a Box with an instance dimension listing the individual properties.

Thank you, this answers my question! I'll close this issue.