100% found this document useful (1 vote)
523 views

Two Phase Level Set COMSOL Tutorial

This document is a course report submitted by two students, Rune Barnkob and Mathias Bækbo Andersen, to their supervisors at the Technical University of Denmark. The report models two-phase flow using a level set method, with the goal of helping HemoCue, a blood analysis company, address issues with air bubbles getting trapped in their product chambers. The report provides theoretical background on capillary effects, analyzes capillary pumping using equations of motion, and describes implementing a level set method to simulate complex two-phase flows.

Uploaded by

unomas9579
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
523 views

Two Phase Level Set COMSOL Tutorial

This document is a course report submitted by two students, Rune Barnkob and Mathias Bækbo Andersen, to their supervisors at the Technical University of Denmark. The report models two-phase flow using a level set method, with the goal of helping HemoCue, a blood analysis company, address issues with air bubbles getting trapped in their product chambers. The report provides theoretical background on capillary effects, analyzes capillary pumping using equations of motion, and describes implementing a level set method to simulate complex two-phase flows.

Uploaded by

unomas9579
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Course Report, s032091 and s031849

Two Phase Flow by Level Set


Method
Rune Barnkob and Mathias Bkbo Andersen

Supervisors: Professor Henrik Bruus and PhD Student Martin Heller

MIC Department of Micro and Nanotechnology


Technical University of Denmark

17 January 2007
ii

Preface
This report is written at the Technological University of Denmark. The Department of
Micro and Nanotechnology offers the three week course 33443 Microfluidics Theory and
Simulation, which sorts under the Microfluidics Theory and Simulation (MIFTS) group [4],
headed by Professor Henrik Bruus.
The motivation for the present report is built on a contact from the Swedish company
HemoCue [3], who requests theoretical calculations on their blood analysis products. De-
velopment of the HemoCue products has until now based on a trial and error approach
and further progress now demands a more theoretical and analytical treatment. The main
problem is air bubbles that get stuck in the central analysis chamber, which is filled using
the capillary forces. Optical measurements on the blood are very sensitive to these bubbles
that give rise to incorrect outcomes. It is therefore decided that this report shall act as a
preliminary treatment of the problem.
During the three weeks the authors and their supervisors has visited the R&D depart-
ment of HemoCue in Angelholm, Sweden. It has been an interesting meeting, which first
of all has given an introduction to the company and their visions, but has also clarified
the specific problem of trapped bubbles. This report focuses on following a two phase flow
interface by using a level set method, which can simulate complex flows. It does not give
the specific answer for the HemoCue problem, but provides a tool, which together with
analytical treatments of the problem, can provide HemoCue with the necessary guidelines
when developing new micro cuvettes.
Throughout the report the Einstein summation rule will be used when appropriate.
The reader is assumed to be familiar with this notation. For notational simplicity x will
be used instead of x etc.
We hope the reader will enjoy reading the report.

Rune Barnkob and Mathias Bkbo Andersen


MIC Department of Micro and Nanotechnology
Technical University of Denmark
17 January 2007
Contents

1 Theory 1
1.1 Capillary Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Analytical analysis of capillary micro pump . . . . . . . . . . . . . . . . . . 3
1.3 A conservative level set method for two phase flow . . . . . . . . . . . . . . 5

2 Numerical implementation 9
2.1 Setting up the model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.1 Domain variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.2 Boundary variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3 Results 15

4 Conclusions 19

iii
iv CONTENTS
Chapter 1

Theory

In this chapter the general physics that give rise to capillary effects is presented. Physical
quantities such as surface tension and contact angle are described. The length scale for
which capillary effects are dominant is found. This will explain why capillary rise is not
observed in, e.g. , an ordinary water bottle but is unavoidable in small structures such
as the HemoCue micro cuvettes. Finally, the theory for the level set method is briefly
reviewed. The level set method makes complicated simulations of capillary effects possible
and can be a relevant tool, when designing new products with optimal functionality.

1.1 Capillary Effects


As things get smaller the surface to bulk ratio increases and at a certain characteristic
length, surface forces dominate the system and so-called capillary effects appear. For a
bloodair 2.4 mm. A
blood-air interface this characteristic capillary length is given by lcap
very used capillary effect is the capillary pump, where a liquid is sucked into a narrow
channel due to surface forces.
An important concept, when considering capillary effects, is the surface tension. Since
it costs energy to create a surface, the surface tension, , of an interface is defined as
the Gibbs free energy per surface area. The surface tension for an blood-air interface is
approximately 60 mJ m2 . When having a surface tension the interface will curve and
thus give rise to the so-called Young-Laplace pressure drop, p, across the curved interface
 
1 1
p = + , (1.1)
R1 R2

where R1 and R2 are the radii of curvature. An everyday analog of the Young-Laplace
pressure drop is blowing up of a balloon. Here one obviously adds pressure to the internal
volume of the balloon, which gives rise to a surface tension and radii of curvature.
Another important parameter is the contact angle, , which appears at the contact line
between three different phases, which is typically two immisible fluids and a solid wall.
The contact angle is an important parameter, since it is directly related to the radii of
curvature and the surface tensions between the different phases. This is given by Youngs

1
2 CHAPTER 1. THEORY

Figure 1.1: Graphical representation of the contact angle, c . The figure shows a drop
of liquid on a substrate. There are three interfaces all denoted with the corresponding
surface tension, sl , lg and sg . The contact line is the geometrical line where the three
phases meet and the contact angle is measured between the tangents to the solid-liquid
and liquid-gas interfaces at this line. The picture is from WikiPedia.

equation.
sg sl
cos = , (1.2)
lg
where s, g and l refer to the solid, gas and liquid phases, respectively. See Fig. 1.1. This
section is build on [1].
1.2. ANALYTICAL ANALYSIS OF CAPILLARY MICRO PUMP 3

z
p0 p0 p p0
0 h

x
0 L(t)

Figure 1.2: Basic sketch of the capillary micro pump in a channel with open ends at an
arbitrary pressure, p0 . Notice the finite pressure jump, p, across the meniscus that drives
the fluid column into the channel. The hydraulic resistance is proportional to the length,
L(t), of the water column and thus increases, making it more difficult to draw in fluid, as
time goes. The height of the channel is h.

1.2 Analytical analysis of capillary micro pump


Consider a micro channel consisting of two infinite parallel plates separated by the height
h, see Fig. 1.2. The infinite parallel plate model is a good approximation for a wide channel
with a low height to width ratio, which is the case when analysing the HemoCue micro
cuvette. As usual in micro fluidics no-slip boundary conditions is assumed at the walls
v(r) = 0, for r . (1.3)
Due to translational invariance in the x- and y-direction the velocity field only depends on
z. If the driving force is directed along the x-axis, only the x-component of the velocity
field is non-zero
v(r) = vx (z) ex . (1.4)
This form of the velocity field renders the Navier-Stokes equation linear. In the quasi-
stationary regime the velocity is independent of time and Navier-Stokes equation is sim-
plified to an ordinary differential equation of second order. Assuming, for simplicity, that
the infinite parallel plate channel is oriented perpendicular to the field of gravity, one
can justify that the force of gravity is cancelled out due to hydrostatic pressure in the
z-direction. The curvature of the meniscus gives rise to a finite pressure difference across
the interface as described in the Young-Laplace equation, Eq. (1.1). Assuming both ends
of the channel are exposed to the same pressure, e.g. , atmospheric pressure, the fluid
will experience a pressure difference, p, when going from x = 0 to the position of the
meniscus, L(t). This pressure difference is assumed to be linearly dependent on the posi-
tion. Under the above mentioned circumstances one can describe the flow of the fluid by
a Poiseuille flow if the small deviations close to the meniscus are neglected. Furthermore
one has to assume that the timescale for the advancement of the meniscus is sufficiently
long, such that the Poiseuille flow is fully developed. From [1] it is known that for a typical
microfluidic system it takes approximately 2 ms for a Poiseuille flow to be fully developed.
As described in [1, p. 100] one can, by use of mass conservation and incompressibility,
identify the velocity of the moving meniscus with the average velocity of the Poiseuille
flow
dL(t) Q
= V0 = , (1.5)
dt A
4 CHAPTER 1. THEORY

where L is the position of the meniscus, Q is the volume flow rate and A is the cross
sectional area of the rectangular channel. The volume flow rate for a Poiseuille flow in a
an infinite parallel plate channel is calculated by use of the Hagen-Poiseuille law,
p
Q= , (1.6)
Rhyd

where Rhyd is the hydraulic resistance of the channel. The hydraulic resistance of an
infinite parallel plate channel is given by
1
Rhyd = 12 L(t) , (1.7)
h3 w
with being the viscosity of the fluid1 and w being the width of a finite section in the
y-direction. Eq. (1.5) becomes an ordinary first order differential equation for the position
of the meniscus. The solution is stated in [1, Eq. (5.34)] and reproduced below
s
t 3h
L(t) = h , adv . (1.8)
adv cos()

Note that the position


goes as the square root of time and is proportional to the square
root of the height, h, which means that the fluid propagates faster as the height, h, of
the channel increases. If one chooses a characteristic length and time, e.g. the heigth of
the channel and adv , Eq. (1.8) can be non-dimensionalized

L
L = , (1.9)
h
t
t = . (1.10)
adv

Eq. (1.8) then reads p


L(t) = t. (1.11)
This simple result for the position of the meniscus is compared to the results from the
numerical simulation in Chapter 2 in order to validate the COMSOL code.

1
Whole blood at 37 C and 1 atm has a viscosity of blood = 3.26 0.43 103 Pa s
(http://www.clinchem.org/cgi/content/abstract/42/8/1189)
1.3. A CONSERVATIVE LEVEL SET METHOD FOR TWO PHASE FLOW 5

1.3 A conservative level set method for two phase flow


The level set methods were first introduced in 1988 by Osher and Sethian. It is a class of
numerical techniques that deal with fluid-interface motion. The interface is represented
implicitly and the equation of motion is numerically approximated using schemes built
from hyperbolic-conservation laws. Level set methods are particularly useful for problems
in which the topology of the evolving interface changes during the course of events and
for problems in which sharp corners and cusps are present.
Consider a simple closed curved l(t) moving in two dimensions. A given velocity field,
v = (vx , vy ), transports the interface. The so-called analysis-view considers the function
: R2 [0, ) R where the zero-level set = 0 corresponds to the evolving front l(t).
This defines the front implicitly. The level set function is constricted to a domain
= (r, t), r , (1.12)
with being the domain of interest, defined by the physical problem. The equation for
the evolution of corresponding to the motion of the interface is given by the convection
equation
t + v = 0. (1.13)
If the flow is incompressible the velocity field will be divergence free, v = 0. This fact
can be shown using the continuity equation. Eq. (1.13) can then be written as
t + (v) = 0, (1.14)
which corresponds to a continuity equation of the level set function. The numerical ap-
proach approximates the solution to the time-dependent intial value problem to follow
the evolution of the associated level set function, whose zero-level set2 always gives the
location of the propagating interface, see Fig. 1.3.
The level set function can be chosen to be the signed distance function from the interface.
That means the smallest distance between a given point in the domain and the interface
|(r)| = d(r) = min(|r rl |). (1.15)
rl l

The level set function is positive on one side of the interface, (r) > 0, and negative on
the other, (r) < 0. To represent the density and the viscosity in the two phases one has
to use a Heaviside function (
0, < 0,
H() = (1.16)
1, > 0.
In numerical simulations the abrupt jump in the fields due to Eq. (1.16) will cause insta-
bilities in the Finite Element Method. Therefore a smeared out Heaviside function is used
instead e.g.
0,
< ,
1 1
Hsm () = 2 + 2 + 2 sin( ), , (1.17)

1, > ,

2
Note that this is a general introduction to the level set method. The actual level set method used in
this report follows the 21 -level set.
6 CHAPTER 1. THEORY

Figure 1.3: Graphical representation of the level set function. Imagine a forest fire where
the gray areas represents trees and the edge is the burning fire front. Time then propagates
as one moves to the right in the upper part of the figure and the fire front eats into the
trees. This two phase problem (trees/burnt tress) is modeled with a level set function
shown below in the figure. Observe that the propagation of the fire front is given as a
level set of the level set function.

where corresponds to half the thickness of the interface3 . The interface thickness shall
depend on the grid size in the mesh, such that it is sufficiently resolved. One can now
define a new level set function
(r) = Hsm ((r)). (1.18)
The level set function in Eq. (1.18) has the advantage that it is straightforward to represent
the density and viscosity in the two different phases. One simply defines scalar fields that
use the level set function to distinguish between the phases

(r) = 1 + (2 1 )(r), (1.19)


(r) = 1 + (2 1 )(r), (1.20)

where the i and i is the density and viscosity of phase i = 1, 2. The interface is in
1
this case given as the -level set of Eq. (1.18). For convenience the tilde is dropped and
2
throughout the rest of this report the level set function is interpreted as given in Eq. (1.18).
When operating with interfaces it is necessary to work with the interface normal vector
3
Note again that the Heaviside function in Eq. (1.17) is different from the one used in this report. It
just serves as an example.
1.3. A CONSERVATIVE LEVEL SET METHOD FOR TWO PHASE FLOW 7

and interface curvature. These two quantities are obtained from the level set function
gradient and the divergence of the gradient

nl = , (1.21a)
||

= nl = , (1.21b)
||

where nl is the normal vector of the level set function and is the curvature. Notice that
these two quantities are defined in all of the domain, , and not just on the interface and
domain boundary, . In order to maintain the thickness of the interface an interme-
diate step has to be performed in the numerical simulation. This step adds an artificial
compression and are implemented by solving the conservation law

+ f () = 0, (1.22)

where is an artificial time and f is the artificial flux. As Eq. (1.22) shall work in the
regions where 0 < < 1 and in the normal direction of the interface, the artificial flux is
chosen to be

f = (1 )nl = (1 ) . (1.23)
||
To avoid discontinuities at the interface, a small amount of viscosity/diffusion is added to
Eq. (1.22)
+ f () = 2 , (1.24)
where is the viscosity. When implementing Eq. (1.13) and Eq. (1.24) in COMSOL it is
possible to combine the equations to one - setting the artificial time equal to the real time
- such that the resulting equation for the level set function becomes

t + (v) = 2 f (), (1.25)

where the time, t, is the real time and the divergence of the artificial flux has been moved
to the right-hand-side. Notice that this equation resembles a continuity equation for .
The term with the Laplacian in Eq. (1.25) can be thought of as a kind of diffusion term,
trying to enlarge the width of the interface. To counteract this diffusion one has the term
with the divergence of the flux. These two terms are in equilibrium when the interface has
a thickness of . Keeping the thickness of the interface constant is achieved. Eq. (1.25)
can be written in conservative form
 

t + v + (1 ) = 0. (1.26)
||

Eq. (1.26) is on the form that COMSOL uses for the numerical implementation. The
equation is coupled to the Navier-Stokes equation through the level set function and the
velocity field. The Navier-Stokes equation reads

t v + (v )v = + (r rl )nl , (1.27)
8 CHAPTER 1. THEORY

where is the surface tension. The stress tensor, , is for an incompressible fluid given
by
ik = pik + (k vi + i vk ), (1.28)
where index notation has been used. The Kronecker delta, ik , is given by
(
0 if i 6= k
ik = . (1.29)
1 if i = k

Finally, it is possible to express the Dirac delta function as the absolute value of the

||

x x

Figure 1.4: The graph to the left is the level set function, , in two dimensions. Notice the
transition from zero to unity. The absolute value of the gradient of the level set function,
||, is displayed to the right. Observe that this is a good approximation to the Dirac
delta function at the interface.

gradient of the level set function

(r rl ) ||, rl l(t). (1.30)

That Eq. (1.30) is a good approximation is intuitively clear when looking at Eq. (1.17).
The absolute value of the gradient is zero for points away from the interface since the level
set function is constant. As one reaches the interface the absolute value of the gradient
1
increases, has maximum exactly at the -contour of the level set function and falls off
2
again, see Fig. 1.4. This resembles a Dirac delta function.This concludes the introduction
to the level set function. This chapter is based on [5] and [6].
Chapter 2

Numerical implementation

This chapter describes the numerical implementation of the physical equations into COM-
SOL. First the model is set up with the necessary approximations. Then the equations
are rewritten in order to implement them in the correct form. In numerics it is possible
to formulate the equations and boundary conditions in strong or weak form. The strong
form is what one would think of as the normal way to write the equations. The weak form
is a special integral formulation of the equations that in some cases are more suited for
numerical simulations. It provides the user with more possibilities to control and enforce
given constraints. Nevertheless, the weak form is not as accurate as the strong form. Both
forms are used to solve the present problem.

2.1 Setting up the model


The micro cuvettes can in a first approximation be thought of as two parallel plates. This
geometry corresponds to the one that is analyzed in Section 1.2. Due to symmetry one
only has to calculate the solution in half of the space between the plates. The full solution
is obtained by mirroring in the symmetry plane. The symmetry plane is parallel with
the two plates and lies half way between them. The meniscus of the fluid is assumed to
be translational invariant in one direction. This direction is chosen to be the z-direction.
Instead of three independent variables the problem is reduced to two independent variables,
namely the x and y coordinates. In figure Fig. 2.1 one can see the domain when it is
subdued to the above assumptions. The problem is reduced to two dimensions which
means that COMSOL solves for four fields - the level set function, the two components of
the velocity and the pressure. These fields can be written as

= (x, y, t) (2.1)
vx = vx (x, y, t) (2.2)
vy = vy (x, y, t) (2.3)
p = p(x, y, t) (2.4)

9
10 CHAPTER 2. NUMERICAL IMPLEMENTATION

y
3
y0

4 2

O 1 x0 x

Figure 2.1: Sketch of the domain. The symmetry plane is given by x = 0.

where p is the pressure. Notice that an Eulerian reference frame is used. The velocity
vector field is
v(x, y, t) = (vx (x, y, t), vy (x, y, t)). (2.5)

Each of the four fields has a corresponding governing equation. The level set function
is governed by Eq. (1.26) corresponding to the numerical extension of the convection
equation. The Navier-Stokes equation governs the two components of the velocity field.
Finally the continuity equation for mass conservation governs the pressure field. For
incompressible fluids the continuity equation reads

i vi = 0. (2.6)

This gives a set of four coupled linear/non-linear differential equations. COMSOL uses a
special form when solving differential equations [2]

dui t ui + ui = Fui , in (2.7)


nb ui = Gui (ui Rui )ui , on (2.8)
0 = Rui , on . (2.9)
2.1. SETTING UP THE MODEL 11

The solution vector u contains



vx
vy
u=
p ,
(2.10)

and nb is the normal vector on the domain boundary. The ui s are Lagrange multipli-
ers. These Lagrange multipliers are only relevant when the Rui s are different from zero
i.e. Rui 6= 0. More generally speaking one can create a Lagrange multiplier for each con-
straint the problem is subjected to. The Rui could e.g. be equal to one of the velocity
components Rui = vx on a specific boundary segment. This means that the x-component
of the velocity must be zero on that domain boundary part. Looking at Eq. (2.8) one
observes that the derivative with respect to x-component of the velocity is different from
zero. It is unity. COMSOL has the freedom to choose the Lagrange multiplier - on this
special part of the boundary - such that Eq. (2.8) is fulfilled for any Gui . The conclusion
is that if a Lagrange multiplier is introduced for a given constraint in the problem then
the Gui is irrelevant and can be left out of the treatment. One has thereby eliminated a
constraint in the expense of another equation for the Lagrange multiplier.

2.1.1 Domain variables


Strong form

In the Navier-Stokes equation, Eq. (1.27), one can with advantage use the weak formulation
to include the force density from the surface tension. Rewriting the remaining terms yields

t vi i ki = (vi i )vi (2.11)



d vx =

vx = [xx , xy ] (2.12)

Fvx = (vi i )vx


d vy =

vy = [yx , yy ] . (2.13)

Fvy = (vi i )vy

For the pressure one has the liberty to choose between two formulations. One where
is non-zero and one where F is non-zero. In this context F is chosen to be non-zero

0 = i vi (2.14)

dp = 0

p = 0 . (2.15)

Fp = i vi

12 CHAPTER 2. NUMERICAL IMPLEMENTATION

For the level set function Eq. (1.26) is on the correct form and it is straightforward to
identify the different variables
 
i
t + i vi + (1 ) i = 0 (2.16)
||

d = 1


= v + (1 ) || . (2.17)

F = 0

This accounts for all the strong contributions in the numerical implementation concerning
the domain, . The variables are given in the fem.equ.da, fem.equ.ga and fem.equ.f
COMSOL structs and summarized in Table 2.1.
ui vx vy p
d ui 0 1

ui [xx , xy ] [yx , yy ] 0 v + (1 ) ||
Fui (vi i )vx (vi i )vy vi i 0

Table 2.1: The variables for the strong form in the domain implemented in COMSOL.

Weak form
For the domain the only weak contribution comes from the Navier-Stokes equation. There-
fore COMSOL only needs two equations for the velocity components. The weak contribu-
tion stems from the term including the surface tension reads
(r rl )nl . (2.18)
One can multiply Eq. (2.18) with a test/basis function and integrate over the domain.
Using Greens theorem this integral can be divided up into a integral over the domain
and one over the boundary. It is the integral over the domain that defines the weak
contribution. Without going into the details the weak contributions are simply stated
below

(x v x )nl,x + (y v x )nl,y ||nl,x , for x, (2.19)

(x v y )nl,x + (y v y )nl,y ||nl,y , for y. (2.20)
where the v i s are the so-called test/basis functions used by COMSOL. These equations
are given in the fem.equ.weak struct.

2.1.2 Boundary variables


The boundary constraints are given by specifying the Rui in Eq. (2.8) for each boundary
segment. In the current set-up there is four boundary parts denoted k for k = 1..4, see
Fig. 2.1. One may write
R = Ru ik , i = 1..4, k = 1..4, (2.21)
2.1. SETTING UP THE MODEL 13

which gives a total of 16 variables. One Lagrange multiplier is introduced for 2 in order
to enforce the contact angle condition on this boundary. This results in a weak equation
on this boundary. The integral along the boundary from the transformation of Eq. (2.18)
is also implemented as a weak equation.

Strong form
For the first boundary, 1 , the assumptions are free flow, a pressure of zero and a constant
value of the level set function of one.
For the second boundary, 2 , the component of the velocity normal to the wall, vx ,
has to be zero. The no-slip condition is relaxed such that the component of the velocity
parallel to the wall are free. No conditions are applied to the pressure and the level set
function.
Boundary three, 3 , has free flow like boundary one. Different simulations are pre-
formed - some with zero pressure and some with a back pressure, p. A constant value
of the level set function of zero are assumed.
The last boundary, 4 , is the symmetry boundary. The condition for symmetry is
that the component of the velocity normal to the boundary, vx , is zero.
COMSOL uses the struct fem.bnd.r for the R values. The values are summarized in
Table 2.2. The strong form on the domain boundary is ultimately converted to weak form

Ru ik 1 2 3 4
vx 0 vx 0 vx
vy 0 0 0 0
p p 0 p p 0
1 0 0

Table 2.2: The R variables implemented in COMSOL. The back pressure, p, is the
Young-Laplace pressure for the given cylindrical meniscus such that no capillary rise is
expected.

in COMSOL. Nevertheless, the R variables are given and then by the command flform
converted from fem.bnd.r to fem.bnd.constr. This means that the G variables at the same
time are converted to weak equations. No G variables are therefore given.

Weak form
The general Neumann condition is given in Eq. (2.8). In weak form this corresponds to
Z
u i Gui dr. (2.22)

The weak equation is then the integrand in Eq. (2.22). On boundary segment two, 2 ,
a contact angle of has to be applied. This boundary condition can be expressed by the
dot product between the level set normal vector at the interface and the boundary normal
vector
nl nb = cos(). (2.23)
14 CHAPTER 2. NUMERICAL IMPLEMENTATION

If one finds the Gui that fulfills Eq. (2.8) and then convert the constraint to weak form by
use of Eq. (2.22) the result is

||nl,x v x cos(), for x, (2.24)


||nl,y v y cos(), for y. (2.25)

For the Lagrange multiplier two weak equations appear

(y cos()), (2.26)
, (2.27)

where and are test/basis functions for the Lagrange multiplier and the level set
function. The weak equations are given in fem.bnd.weak.
Chapter 3

Results

The simulations carried out considers the capillary pump and uses the COMSOL script
shown in the appendix. To verify that the script is able to keep a certain contact angle
at the boundary, the interface is started as a cosine, which is unphysical due to the
equations of the system. See Fig. 3.1. Besides the unperturbed interface a back pressure -
corresponding to the Young-Laplace pressure - is added in order to avoid propagation of the
interface. As time goes the unperturbed interface relaxes through some small oscillations.
It obtains the correct shape with respect to the contact angle. In figure 3.2 is shown the
water-air interface for three different times. The ends in top and bottom are open and
have a zero pressure. It is therefore the pressure difference due to the surface tension,
which causes the dynamics. The interface starts to be linear, but as time goes it finds the
contact angle, , at the wall and an angle of 90 at the center of the channel, and starts to
propagate. The figure considers a very short timescale and thus a Poiseuille flow has not
been fully developed. The capillary propagation length can therefore not be compared to
the analytical solution given in Eq. (1.8). In figure 3.3 is plotted the capillary length, L(t),
as a function of time, t, and for clarity also the analytical capillary length is plotted. In
the time t [0; 0.5] 107 s the water-air interface accelerates to an almost linear velocity
and at the time t = 1 107 s the interface hits the end of the channel and the calculation
is no more valid. It is expected that for further times the capillary length will follow the
analytical solution. It is important to stress that the simulation is not yet verified until a
simulation for longer times has been executed.

15
16 CHAPTER 3. RESULTS

Figure 3.1: Relaxing of a cosine-perturbed water-air interface. The ends in top and bottom
are closed and a back pressure corresponding to the Young-Laplace pressure is added at
the top boundary. The geometry is symmetric and thus the boundary at x = 0 corresponds
to the middle of the channel.
17

Figure 3.2: Capillary propagation of water-air interface. The ends in top and bottom are
open and have a zero pressure. The geometry is symmetric and thus the boundary at
x = 0 corresponds to the middle of the channel.
18 CHAPTER 3. RESULTS

7
x 10
8

5
L(t)

1 numerical
analytical
0
0 0.5 1 1.5 2
7
x 10
t

Figure 3.3: Capillary length, L(t), as a function of time, t. Both the numerical and
analytic results are shown, even though they are not comparable.
Chapter 4

Conclusions

A COMSOL script for simulating a two phase flow interface by using a conservative level
set method has been made. It is not yet verified by comparing to analytical solutions, but
it does act intuitively correct. It succeeds to keep a correct contact angle at the boundaries,
which has been the most difficult part. The report does not contain very many results,
but mainly describes the theory and implementation of the level set method. It has been
far from trivial to implement the method, but the promising strength of the method is
worth the work done.

19
20 CHAPTER 4. CONCLUSIONS

Script linear phi0.m


1 % linearphi0.m
2 % COMSOL script
3 %
4 % Rune Barnkob
5 % Mathias Baekbo Andersen
6 % Microuidics Theory and Simulation
7 % Department of Micro- and Nanotechnolog
8 % The Technological University of Denmark
9 %
10 % 17/1-2007
11 %
12 % u = vx, x-component of the velocity
13 % v = vy, y-component of the velocity
14
15 clear fem
16 clear
17
18 %Unix or other
19 vstr = version;
20 if strcmp(vstr(1),1)
21 disp(running COMSOL script)
22 iscomsol = 1;
23 else
24 disp(running MATLAB)
25 iscomsol = 0;
26 end
27 if isunix
28 pathsep = /;
29 else
30 pathsep = ;
31 end
32
33 %Making results directory
34 cvec = clock;
35 dataname = [sprintf(%4.0f,cvec(1)) - sprintf(%02.0f,cvec(2)) -...
36 sprintf(%02.0f,cvec(3)) sprintf(%02.0f,cvec(4)) :...
37 sprintf(%02.0f,cvec(5)) : sprintf(%02.0f,cvec(6))];
38 dataname = [inniteparallelplates dataname];
39 datadir = [pwd pathsep Results pathsep dataname pathsep];
40 mkdir(datadir);
41
42 % Geometry
43 fem.geom = rect2(0.2E-6,2E-6,base,corner,pos,0,0,rot,0);
44
45 % Constants
46 fem.const = rho1,1.293, ... % Density of phase 1
47 rho2,1e3, ... % Density of phase 2
48 eta1,1.67e-3, ... % Viscosity of phase 1
49 eta2,1e-3, ... % Viscosity of phase 2
50 gamma,73e-3, ... % Surface tension air-water
51 radius,0.2e-6, ... % Radius of channel
52 theta,73/180*pi, ... % Equilibrium contact angle
53 rad0,(tan(1/2*pi-theta)2+1)(1/2)*radius/tan(1/2*pi-theta), ... % Radius of curvature
54 epsilon,0.05e-6, ... % Interface thickness control parameter
55 dp,1/rad0*gamma; % Young-Laplace pressure
56
57 % Scalar expressions
58 fem.expr = gphi,sqrt(phix2+phiy2), ... % Length of gradient of phi
59 normx,phix/gphi, ... % x-component of normal vector to phi
60 normy,phiy/gphi, ... % y-component of normal vector to phi
21

61 rho,rho1+(rho2-rho1)*phi, ... % Continous density


62 eta,eta1+(eta2-eta1)*phi, ... % Continous viscosity
63 phi0,1/(1+exp(-(x-tan(theta)*(y-0.1E-6))/epsilon)), ... % Start guess on the level set function
64 angle,acos(normx), ... % Dynamic contact angle
65 vslip,1e-9*4*(angle-theta)/theta*phi*(1-phi), ... % Slip velocity
66 sigmaxx -p+2*eta*ux ... % Stress tensor element
67 sigmaxy eta*(uy+vx) ... % Stress tensor element
68 sigmayy -p+2*eta*vy % Stress tensor element
69
70
71 fem.mesh = meshinit(fem,hmax,1*0.03e-6,report,o);
72
73 fem.sdim = x,y;
74
75 % Shape functions
76 fem.shape = shlag(2,u),shlag(2,v),shdisc(2,1,p),shlag(2,phi),shlag(2,lm);
77
78 % Integration order
79 fem.gporder = 4,2;
80
81 % Constraint order
82 fem.cporder = 2,1;
83 fem.border = 1;
84
85 % Equation form
86 fem.form = general;
87
88 % Subdomain settings
89 equ.ind = [1];
90 equ.dim = vx,vy,p,phi;
91 equ.init = 0;0;0;phi0;
92 equ.cporder = 1;1;2;1;
93 equ.gporder = 1;1;2;1;
94
95 equ.da = rho;rho;0;1;
96 equ.f = -rho*(u*ux+v*uy);...
97 -rho*(u*vx+v*vy); ...
98 ux+vy; ...
99 0;
100 equ.ga = -sigmaxx;-sigmaxy; ...
101 -sigmaxy;-sigmayy; ...
102 0;0; ...
103 u*phi+phi*(1-phi)*normx-epsilon*phix;v*phi+phi*(1-phi)*normy-epsilon*phiy;
104 equ.weak = gamma*(test(ux)*normx*normx+test(uy)*normx*normy)*gphi; ...
105 gamma*(test(vx)*normx*normy+test(vy)*normy*normy)*gphi;
106
107 fem.equ = equ;
108 clear equ
109
110 % Boundary settings
111 clear bnd
112 bnd.dim = u,v,p,phi,lm;
113 bnd.ind = [1,2,3,4];
114 bnd.shape = [1:4] [1:5] [1:4] [1:4];
115 bnd.cporder = 1;1;2;1;1;
116 bnd.gporder = 1;1;2;1;1;
117
118 bnd.r = 0;0;-p;1-phi, ... % bottom
119 -u;0;0;0, ... % right
120 0;0;-p;0-phi, ... % top
121 -u;; % left
122
22 CHAPTER 4. CONCLUSIONS

123 fem.bnd = bnd;


124 clear bnd
125
126 fem = form(fem,outform,weak);
127 fem.bnd.weak = 0, ...
128 -gamma*gphi*normx*test(u)*cos(theta); ...
129 -gamma*gphi*normy*test(v)*cos(theta); ...
130 0; ...
131 test(lm)*(phiTy-cos(theta)); ...
132 test(phi)*lm, ...
133 0,0;
134
135 fem.xmesh = meshextend(fem);
136
137 init = asseminit(fem);
138
139 tnal = ((1.9E-6-0.3E-6)/0.4E-6)2*3*1E-3*0.4E-6/(73e-3*cos(73/180*pi));
140
141 fem.sol=femtime(fem,init,init, ...
142 solcomp,u,phi,p,v, ...
143 outcomp,u,phi,p,v, ...
144 tlist,[0:1e-9:tnal], ...
145 tout,tlist,report,o);
146 clear init
147
148 % Saving data to Results directory
149 save([datadir data],fem);
Bibliography

[1] Henrik Bruus. Theoretical Microfluidics. Department of Micro and Nanotechnology


at The Technological University of Denmark, August 2006.

[2] COMSOL. Comsol Multiphysics, Oscillating Liquid Cobalt Droplet, 2006.

[3] http://www.hemocue.com.

[4] http://www.mic.dtu.dk/Research/BCMS/MIFTS.aspx.

[5] E. Olsson and G. Kreiss. A conservative level set method for two phase flow. Journal
of Computational Physics, 210(1):225246, 2005.

[6] Peter Smereka and J.A. Sethian. Level set methods for fluid interfaces. Annual Review
of Fluid Mechanics, 35:341372, 2003.

23

You might also like