Binary Fluid

73 views
Skip to first unread message

Fabíola

unread,
May 11, 2012, 1:31:08 PM5/11/12
to sailfish-cfd
Hello,

I want to simulate a two-fluid flow, they are immiscible but they
blend themselves till a certain point. I would like to know if it is
possible to do it with Sailfish.

Thank you

Michal Januszewski

unread,
May 11, 2012, 3:14:22 PM5/11/12
to sailfi...@googlegroups.com
Hi Fabiola,

Both of the binary fluid models implemented in Sailfish (Shan-Chen,
free-energy) are diffuse interface methods and therefore allow some
level of blending. Check out for instance the spinodal decomposition
examples. It might be easier to advise you if provide more details
about what you want to simulate.

Hope that helps,
Michal
--
Michal Januszewski
http://people.gentoo.org/spock

Fabíola

unread,
May 16, 2012, 5:09:31 PM5/16/12
to sailfish-cfd
Hi,

I have doubts on how to calculate the single term of viscosity for two
fluids which is present in the sc_capillary.py example.

Thank you in advance,
Fabíola

On 11 maio, 16:14, Michal Januszewski <mich...@gmail.com> wrote:
> Hi Fabiola,
>
> Both of the binary fluid models implemented in Sailfish (Shan-Chen,
> free-energy) are diffuse interface methods and therefore allow some
> level of blending.  Check out for instance the spinodal decomposition
> examples.  It might be easier to advise you if provide more details
> about what you want to simulate.
>
> Hope that helps,
> Michal
>

Michal Januszewski

unread,
May 27, 2012, 5:48:56 PM5/27/12
to sailfi...@googlegroups.com
The fluids have different viscosities. The relaxation time for the
first fluid is set via --visc, while the relaxation time for the
second fluid is overridden in modify_config
(https://github.com/sailfish-team/sailfish/blob/master/examples/binary_fluid/sc_capillary.py#L62),
so that by default the viscosities are always the same. You can
change the modify_config function to set a different viscosity.

Hope that helps,
Michal

Fabíola

unread,
May 29, 2012, 2:58:05 PM5/29/12
to sailfish-cfd
The viscosities values should be a number between 0.333e-6 and 0.17,
right?

I have a 320x320 lattice and a bitmap with the path for the fluids.
At the inlet, the path occupies 45 lattice nodes. The fluid enters
this path with 0.00111 m/s.
I calculated 23 for the viscosity value.

Do you know what is wrong?

Thanks a lot,
Fabíola

On 27 maio, 18:48, Michal Januszewski <mich...@gmail.com> wrote:
> The fluids have different viscosities.  The relaxation time for the
> first fluid is set via --visc, while the relaxation time for the
> second fluid is overridden in modify_config
> (https://github.com/sailfish-team/sailfish/blob/master/examples/binary...),

Fabíola

unread,
May 29, 2012, 3:01:10 PM5/29/12
to sailfish-cfd
I forgot, the Reynolds number is 0.0917 and the path's height is
500e-6m.

Michal Januszewski

unread,
Jun 3, 2012, 9:34:40 AM6/3/12
to sailfi...@googlegroups.com
Where did you get these specific numbers for the viscosities? Are
these the numerical viscosities as used in the LB simulation? If so,
0.3e-6 seems awfully small, and the simulation will be unstable at
such low values.

Can you show us the whole calculation you did, step by step? This
will make any mistakes easier to spot.

Michal

Fabíola

unread,
Jun 3, 2012, 12:32:47 PM6/3/12
to sailfish-cfd
Using equation: visc=1/3*(tau-1/2) (Lattice Boltzmann Modeling, Sukop,
M.C and Thorne, D.T., Springer)
There, it is said that tau>1/2 and tau=1 is the safest (then visc=1/6
lu²/ts).

I have:
Fluid 1 rho=957 kg/m³, velocity=0.00111 m/s
Fluid 2 rho=789 kg/m³, velocity=0.000556 m/s
L=0.25e-3 m (each fluid enters half of the path, so L_total = 0.5e-3
m)
Re_avg = 0.0917

I did for fluid 1:
delta_x = L/(Ny-1) = 0.25e-3/21 = 11.905e-6 m/lu

0.00111 m/s = 0.1 lu/lt * 11.905e-6 m/lu * 1/delta_t => delta_t =
1.073e-3 s/lt

visc = delta_t * u_phys * L / (delta_x² * Re) = 1.073e-3 * 0.00111 *
0.25e-3 / (11.905e-6² * 0.0917) = 23 lu²/lt

and tau = 69.5

Do these values make sense? Because when I use them in the simulation,
it goes to NaN values.

Michal Januszewski

unread,
Jun 3, 2012, 1:23:12 PM6/3/12
to sailfi...@googlegroups.com
On Sun, Jun 3, 2012 at 6:32 PM, Fabíola <fabiol...@gmail.com> wrote:

> Using equation: visc=1/3*(tau-1/2) (Lattice Boltzmann Modeling, Sukop,
> M.C and Thorne, D.T., Springer)
> There, it is said that tau>1/2 and tau=1 is the safest (then visc=1/6
> lu²/ts).

Yeah, generally tau \in (0.5, 1], which corresponds to visc \in (0, 0.1666].

> I have:
> Fluid 1 rho=957 kg/m³, velocity=0.00111 m/s
> Fluid 2 rho=789 kg/m³, velocity=0.000556 m/s
> L=0.25e-3 m (each fluid enters half of the path, so L_total = 0.5e-3
> m)
> Re_avg = 0.0917
>
> I did for fluid 1:
> delta_x = L/(Ny-1) = 0.25e-3/21 = 11.905e-6 m/lu

Why is Ny = 22 here? Didn't you want a 320x320 lattice?

> 0.00111 m/s = 0.1 lu/lt * 11.905e-6 m/lu * 1/delta_t => delta_t =
> 1.073e-3 s/lt
> visc = delta_t * u_phys * L / (delta_x² * Re) = 1.073e-3 * 0.00111 *
> 0.25e-3 / (11.905e-6² * 0.0917) = 23 lu²/lt
>
> and tau = 69.5
>
> Do these values make sense? Because when I use them in the simulation,
> it goes to NaN values.

Your calculations look correct, but the tau value is too large. What
is driving it up is the relatively high LB velocity u_lb = 0.1. If
you dial this down to, say u_lb = 0.0005, you will get a viscosity
that is within the range of the capabilities of the model. In fact,
you could also just start from visc_lb = 1/6. (the most stable one),
and choose a matching u_lb.

Fabíola

unread,
Jun 8, 2012, 11:28:48 AM6/8/12
to sailfish-cfd
Thanks a lot!
I realised that even when I set max_v = 0.0005, the simulation has a
higher maximum velocity than max_v. What is the meaning of these
parameters?
Another doubt I have is how can I calculate or find the force
interaction between the fluids, G.


On 3 jun, 14:23, Michal Januszewski <mich...@gmail.com> wrote:

Michal Januszewski

unread,
Jun 9, 2012, 10:14:01 AM6/9/12
to sailfi...@googlegroups.com
max_v is just some reference velocity in your simulation (typically
the maximum one). In sc_capillary, its value is used to calculate the
body force acting on a fluid, which is set to such value that if the
simulation described a 2D Poiseuille flow, the maximum fluid velocity
would be max_v. Since in sc_capillary the geometry is not that of a
Poiseuille flow, the actual maximum velocity might be larger.

In a Shan-Chen model the force is calculated for you in
shan_chen_force
(https://github.com/sailfish-team/sailfish/blob/master/sailfish/templates/shan_chen.mako#L123),
which is called at
https://github.com/sailfish-team/sailfish/blob/master/sailfish/templates/binary_fluid.mako#L318
and the force acting on the 1st and 2nd component is stored in sca0
and sca1, accordingly. Since you only need the densities to calculate
this force, you can also do it off-line after the simulation is
finished if you need to.

Hope that helps,
Michal

Fabíola

unread,
Jul 11, 2012, 3:58:31 PM7/11/12
to sailfi...@googlegroups.com
Hi!

Adding some more details, I would like to know if it is possible to use Shan-Chen model to simulate
a multicomponent multiphase flow and if there is an example.

Thanks,
Fabíola
Reply all
Reply to author
Forward
0 new messages