CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Looking for simple, robust interface tracking algorithm (http://www.cfd-online.com/Forums/main/73124-looking-simple-robust-interface-tracking-algorithm.html)

ThomasTC February 27, 2010 10:21

Looking for simple, robust interface capturing algorithm
 
I'm building a 2D simulation algorithm for a two-phase incompressible viscous fluid simulation (water and air). My requirements are:
  • volume change as small as machine accuracy can get it
  • relatively simple to implement
  • publically available (well-documented in an article, or working source code)
  • I don't care much about physical accuracy
  • I don't care about the location of the interface at sub-grid accuracy
The (Eulerian) flow calculation itself is working fine, but I'm having great trouble with the interface (free surface) capturing.

Currently, I have a working implementation of the Hirt & Nichols SOLA-VOF scheme [1], but it has two problems: (1) unacceptable levels of volume change; (2) "flotsam and jetsam" all over the place.

I tried the piecewise linear Youngs scheme [2]. Since I could not access the original paper online, I used the description by Rudman [3] to implement it. It's screens full of code with conditionals and tangents and cotangents and angles; and I've got a bug somewhere. So I feel this is too complex for my needs.

I also looked at the MAC (marker-and-cell) style methods. In particular, I implemented something similar to Foster and Fedkiw [4]. But even with 25 markers per cell, they sometimes all advect out of a fluid cell, resulting in gaps in the fluid volume. Maybe it's possible to apply some correction to marker positions to prevent this?

I would like to try the SLIC scheme by Noh and Woodward [5], because it sounds pretty simple, but I can't find the paper online.

I am fairly new to the field of CFD, and I've been at this for two weeks now. Does anyone know a way to fix one of the algorithms I tried, or a suggestion for different algorithm altogether?

[1] Hirt and Nichols, 1979, "Volume of Fluid (VOF) methods for the dynamics of free boundaries"
[2] Youngs, 1982, "Time-dependent multi-material flow with large fluid distortion"
[3] Rudman, 1997, "Volume-tracking methods for interfacial flow calculations"
[4] Foster and Fedkiw, 2001, "Practical animation of liquids"

[5] Noh and Woodward, 1976, "SLIC (simple line interface calculation)"

rmh26 February 17, 2012 11:57

I know this post is two years old and you probably aren't around anymore, but did you make any progess?

ThomasTC February 17, 2012 13:45

You're in luck; I was subscribed to email updates ;)

The only progress I recall that's not in my original post is a hack to fix most of the problems with VOF. Details are in my blog post here: http://frozenfractal.com/blog/2010/3...oblems-solved/

Here is the relevant section of code:

Code:

        for (size_t y = 1; y < d_ny - 1; ++y) {
                for (size_t x = 1; x < d_nx - 1; ++x) {
                        switch (d_types(x, y)) {
                                case SurfaceLeft:
                                        if (isInterior(x - 1, y)) {
                                                float move = min(1.0f - d_vof(x - 1, y), d_vof(x, y));
                                                d_vof(x, y) -= move;
                                                d_vof(x - 1, y) += move;
                                                if (d_vof(x, y) > 1.0f && isInterior(x + 1, y)) {
                                                        d_vof(x + 1, y) += d_vof(x, y) - 1.0f;
                                                        d_vof(x, y) = 1.0f;
                                                }
                                        }
                                        break;
                                case SurfaceRight:
                                        if (isInterior(x + 1, y)) {
                                                float move = min(1.0f - d_vof(x + 1, y), d_vof(x, y));
                                                d_vof(x, y) -= move;
                                                d_vof(x + 1, y) += move;
                                                if (d_vof(x, y) > 1.0f && isInterior(x - 1, y)) {
                                                        d_vof(x - 1, y) += d_vof(x, y) - 1.0f;
                                                        d_vof(x, y) = 1.0f;
                                                }
                                        }
                                        break;
                                case SurfaceBottom:
                                        if (isInterior(x, y - 1)) {
                                                float move = min(1.0f - d_vof(x, y - 1), d_vof(x, y));
                                                d_vof(x, y) -= move;
                                                d_vof(x, y - 1) += move;
                                                if (d_vof(x, y) > 1.0f && isInterior(x, y + 1)) {
                                                        d_vof(x, y + 1) += d_vof(x, y) - 1.0f;
                                                        d_vof(x, y) = 1.0f;
                                                }
                                        }
                                        break;
                                case SurfaceTop:
                                        if (isInterior(x, y + 1)) {
                                                float move = min(1.0f - d_vof(x, y + 1), d_vof(x, y));
                                                d_vof(x, y) -= move;
                                                d_vof(x, y + 1) += move;
                                                if (d_vof(x, y) > 1.0f && isInterior(x, y - 1)) {
                                                        d_vof(x, y - 1) += d_vof(x, y) - 1.0f;
                                                        d_vof(x, y) = 1.0f;
                                                }
                                        }
                                        break;
                                default:
                                        break;
                        }
                }
        }

If you want me to hunt down the paper that describes this, reply on this thread and I'll see if I still have it somewhere. It's still not perfect though...

arjun February 17, 2012 16:45

From your blog:

Quote:

Originally Posted by ThomasTC (Post 344987)

Another problem was fluid loss: because cells cannot be filled with fluid for more than 100%, all values above that were set to 100%. Over time, these small differences added up, resulting in slow evaporation of all the water in the simulation. As I wrote before, there seems to be no simple fix. This new algorithm performs much better in that respect, reducing fluid loss to a mere 0.1% after tens of seconds, which is quite acceptable.


There is a very easy fix to fluid loss. I recently was thinking about coupling VOF with immersed boundary and there this loss is significant so i had to think about this issue.

For me I am lucky whenever I run into problems I usually come up with neat solutions. I hope my luck not run out soon.

In this case the solution is this: At the start calculate the total volume of fluid. After every step calculate the fluid loss. You have to make up for this loss. what you are supposed to do is add the this much fluid to the system so that volume of this fluid remain constant. Question is how do you do this.

Easiest solution is that count the cells where volume fraction is between 0 and 1 , I used 0.1 and 0.9 as limit. Now add the lost fluid equally among them. That is add equally to the interface. If your time step was small this loss is usually small and you are adding very small values to each cell but keeping total volume constant.

ThomasTC February 17, 2012 16:47

I think I actually tried that at some point, but it came with its own set of problems. Unfortunately, I can't remember what those were...

arjun February 17, 2012 17:10

Quote:

Originally Posted by ThomasTC (Post 345008)
I think I actually tried that at some point, but it came with its own set of problems. Unfortunately, I can't remember what those were...


I did work for me but let me know of problems, there might be something i missed.

With small delta it the redistribution works out easily.

rmh26 February 17, 2012 19:13

That sounds like the level set methods where they reinitialize the LS function to conserve mass at each time step.

Anyone have experience with combing AMR with these two phase flow problems. I fear I have to head down that path to get the results i'm looking for.


All times are GMT -4. The time now is 18:13.