Introduction To Fluid Dynamics and Simulations in COMSOL
Introduction To Fluid Dynamics and Simulations in COMSOL
1
x m Fx (t , x, y , z , x, y , z )
1
y Fy (t , x, y , z , x, y , z )
m
1
z m Fz (t , x, y, z , x, y , z )
Classical mechanics (Newtonian)
The equations of motion are supplemented with the initial conditions (for the position
and velocity of the point mass at the initial time t = t0)
r (t0 ) r0 , (t0 ) 0 ,
that is
d 2r mM
m 2 G 2 rˆ
dt r
This is a set of the following equations in 3D:
d2x x
2 GM 2 2 2 3/ 2
, In fact, this system can be
dt (x y z ) reduced to 2D (planar) problem,
d 2 y y because the trajectory
2 GM 2 2 2 3/ 2
, (x(t),y(t),z(t)) lies in the plane
dt (x y z ) defined by the initial position
and velocity.
d2z x
2 GM 2 2 2 3/ 2
.
dt (x y z )
Classical mechanics (Newtonian)
Example (cond.)
d2x x
2 GM 2 2 2 3/ 2
,
dt ( x y z )
d 2 y y
2 GM 2 2 2 3/ 2
,
dt (x y z )
d2z x
2 GM 2 2 2 3/ 2
.
dt (x y z )
F V .
This function is called the potential of the force or simply the potential energy. It is also
denoted by Ep. Then the mechanical energy E is defined as the sum of the kinetic and
potential energy
1
E Ekin E pot m 2 V .
2
Important property of E is that this quantity is preserved: for any motion r(t) in the force
field F it holds that
E (r (t )) const.
E p V mgh,
hence
1
E Ekin E pot m 2 mgh const
2
The notion of such conserved quantity helps solving many problems. For example,
what is the maximum height that a stone thrown vertically upward will attain if the
initial velocity is v0?
1 1
E Ekin E pot const m0 2 mg 0 m 02 mg hmax
2 2
1 2 0 2
m0 mg hmax hmax .
2 2g
Classical mechanics (Newtonian)
Example: In the motion of a point mass (m) in the gravitational field of a big stationary
planet/star (M) the potential energy of the mass m is
Mm
E p G ,
hence
r
1 mM
E Ekin E pot m 2 G 2 const
2 r
In this particular case the mass m disappears as we can divide by it to obtain
2 M
G 2 const
2 r
Even if we do not know the solution r(t) we know that the above quantity must be
constant with respect to time durrng the motion.
Classical mechanics (Newtonian)
W F r
In general case when the force may vary in space the work is defined by the line
integral
W F dr
AB
where AB is a path along which the mass is moved from point A to B.
Note that in general this definition implies that the work may depend on the path.
This is not true if the force is conservative. In the case of conservative force we have
W F dr E (r ) E (r )
B A
AB
Fluid mechanics (concept of a continuum)
Materials (solids, liquids and gases) are composed of molecules separated by
empty space. But the continuum model as a mathematical concept assumes that
material exists as a continuous entity. It means that the matter in the body is
continuously distributed and fills the entire region of space it occupies. A
continuum body can, for example, be infinitely sub-divided into smaller and
smaller elements preserving properties of the bulk material. It also means that
two points in such body may be close at arbitrary small distance. Due to these
assumption we can consider physical quantities (density, pressure, velocity, forces
etc.) as defined at every point as continuous functions of space position and that
space derivatives can be also defined.
m(Wt ) m(W0 )
This formula is just a statement of the mass conservation law. It is also called the
continuity equation or mass balance equation.
Let us notice that it can also be written as
dV const
Wt
d
dt Wt
dV 0
Fluid mechanics (mass conservation)
The form of mass conservation law from the previous slide
d
dV const
Wt
or
dt Wt
dV 0
may be converted to more useful differential form. It can be done in two ways:
(1) from the above integral form by applying Reynold’s transport theorem; (2) By
direct application of Gauss’ divergence theorem. Th final form is
div ( v) 0
t
Some textbooks use the notation for the divergence operator: u = div u.
Fluid mechanics (material derivative)
The material derivative of a scalar function f(t,r) in the region filled with a moving fluid
with the velocity field v(t,r) is defined as
Df f
: ( ) f
Dt t
It takes into account the fact that the fluid is moving and that the positions of fluid
particles change with time. Thus, if r(t) = [x(t), y(t), z(t)] describes the movement of a
fluid particle (the path followed by the fluid particle), then the change of any quantity f
along this path can be computed as follows
d f 3
f dxi
f (t , x(t ), y (t ), z (t )) (t , r (t ))
dt t i 1 xi dt
f dx(t ) f dy (t ) f dz (t ) Df
(t , r (t )) (t , r (t )) (t , r (t )) ( ) f
x dt y dt z dt t ( t , r ( t )) Dt ( t , r ( t ))
Hence we can write for the change of function f(t,r) along the path r(t):
d Df
f (t , r (t )) (t , r (t )).
dt Dt
Fluid mechanics (ideal fluid)
For any continuum, forces acting on a piece of material are of two types:
• External, or body, forces such as gravity, intertial (pseudoforce) , a magnetic field, which
exert a force per unit volume on the continuum
• forces of stress, whereby the piece of material is acted on by forces across its surface by
the rest of the continuum.
hence
SW p dV
W
Fluid mechanics (ideal fluid – momentum equation)
If b(t,r) denotes the given body force per unit mass, then the total body force is
Fb ,W ={body force on W } b dV .
W
Thus the total force acting on the fluid domain W in the case of ideal fluid is
Fb ,W + SW
W
(p) dV b dV (p b) dV
W W
FW (p b) dV
W
Hence
Acceleration: let r(t) is the motion of the fluid particle. From the very definition of the
velocity we get
dr
(t ) v (t , r (t ))
dt
The acceleration a=d2r/dt2 thus
d 2r d
a (t ) 2 (t ) v(t , r (t ))
dt dt
But, by the chain rule one can show
d v
a (t ) v(t , r (t )) ( v ) v
dt t
Fluid mechanics (ideal fluid – Euler’s equations)
Let us summarize:
v
v v p b
t
The above equation is called Euler’s equation for ideal fluid. In fact it is the momentum
balance for the ideal fluid.
Fluid mechanics (NavierStokes equations)
Now we consider a more general fluid than the ideal one. Real fluids possess the
phenomenon of viscosity. The microscopic basis of the effect of viscosity is
connected with the transfer of momentum between layers of moving fluid.
In the previous slide the viscosity was explained in the qualitative way. Here is
how we can measure it.
The dynamic viscosity (sometimes ) of a fluid describes its resistance to
shearing flows. In the picture (the speed of the top plate is parallel to the x axis.
We see that an external force F is required in order to keep the top plate moving
at constant speed v.
F A A A
y
F
A y
Fluid mechanics (NavierStokes equations)
Instead of assuming that (ideal fluid)
where is the stress tensor which describes the shear forces (tensions) in the
fluid. It is called the Cauchy stress tensor. In a fixed coordinate system the tensor
stress is just a matrix 3 x 3. Hence the expression n should be understood as
the matrix multiplication (n is written here as a column).
From this formulation we see that shear force term is linear with respect to n. It
is not obvious! It can be proved under a general assumption (continuous
dependence on n) and using balance of momentum. This result is called Cauchy’s
theorem.
Fluid mechanics (NavierStokes equations)
As in the case of the ideal fluid we can formulate for viscous fluid Newton’s
second law for the moving fluid particle Wt
d
dt Wt
vdV ( pn n)dA
Wt
bdV
Wt
internal forces external (body) forces
where dV indicates the volume integral and dA is the surface integral. The
internal forces acting through surface are now composed of two terms: normal
(represented by scalar function p – the pressure) and shear/tangential
(represented by matrix function – the stress tensor). It can be also proved that
the stress tensor is symmetric.
Fluid mechanics (NavierStokes equations)
To obtain a more specific equation for the motion of the fluid we have to analyze
in more detail the stress tensor . The following assumptions are physically
sound:
The velocity gradient is just a matrix of first order space derivatives of all
componets of the velocity v=[vx, vy, vz]
vxx v x
y
v x
z
v y v y v y
v x y z
vxz v z v z
y z
Fluid mechanics (NavierStokes equations)
Under the assumptions 1,2,3 (previous slide) it can be shown that the stress
tensor has the following form
(div v)I + 2 D
Where and are non-negative parameters characterazing the viscous fluid and
v y
v x
x
1
2 (
v x
y x )
1
2 ( zx vxz )
v
1
D = v (v) 2 ( y x )
T 1 v x v y v y v v z
y
1
(
2 z
y
y )
2
1 ( v x v z ) 1 v
( zy vyz ) v z
2 z x 2 z
Fluid mechanics (NavierStokes equations)
If we now employ the transport theorem and the divergence theorem to the
balance of momentum with the stress tensor = (div v)I + 2D after some
algebra we will obtain the famous Navier-Stokes equations (NS):
v
( v ) v p ( )(div v) v
t
This form is for a general fluid – at that stage we do not assume incompressibility,
so the unknowns are: v(t,r), (t,r), p(t,r). Thus we have five unknown functions, but
the NS system gives only three equations. One more equation is obvious – it is the
mass balance equation
div ( v ) 0
t
The fifth equation (for compressible fluid) comes usually in the form of a constitutive
relation between pressure, density and temperature:
( p, T ).
Fluid mechanics
(incompressible NavierStokes equations)
Assumption: the viscous fluid is incompressible, i.e. = const. The mass balanace
equation gives now
0
div ( v) 0 0 div ( v) 0 div v = 0.
t
and the term ( + )(div v) vanishes from the NS system. Thus we obtain the
NavierStokes equations for incompressible fluid (usually written with the
kinematic viscosity = / >0):
v 1
( v ) v p v
t
div v = 0
Fluid mechanics boundary conditions
We will consider only two basic boundary conditions. Boundary is denoted by .
1) v n 0 on
The expression means that the normal component of the velocity on the
boundary is zero. It is rather obvious statement that the wall is impenetrable.
The tangential component may be non-zero (fluid can slip along the wall. This
condition is consistent with the inviscid fluid and is used with Euler’sequation.
2) v 0 on
This condition says that the velocity on the boundary is completely zero. The
tangential component must vanish, hence this is called non-slip boundary
condition. It is consistent with viscous fluid ( > 0) and is used in the Navier-
Stokes equations.
Fluid mechanics (energy conservation)
For any moving fluid region of volume Wt we can define its energy as
2
EWt e dV ,
Wt 2
where is the density, v is the velocity field, and e is the density of internal energy. We
identify here
2
Ekin
Wt
2
dV the kinetic energy of the moving volume Wt
Eint e dV
Wt
the internal energy of the moving volume Wt
d 2 D 2
e dV
dt Wt 2
W Dt 2 e dV
t
d Df
dt Wt
f dV
Wt
Dt
dV ,
valid for any quantity f(t,r)=f(t,x,y,z) that may depend on time and location. And
moving region Wt. Here, Df/Dt is defined earlier the material derivative.
Fluid mechanics (energy conservation)
The previous slide described a defintion of energy of a moving element and how its
change can be written with derivative under the integral. But these were merely
mathematical manipulations of purely kinematical nature.
Now we have to add some constitutive relations to bind the energy of the moving element
Wt with other processes present in the system. This leads to the following general form of
energy balance in the integral form:
d 2
e dV F dV p dA ( J Q ) n dA Rq dV ,
dt Wt 2 Wt Wt Wt Wt
where:
F dV
Wt
rate of work by (external) mass forces
Wt
p dA rate of work by (internal) pressure forces
(J
Wt
Q ) n dA flux of the ”heat” energy
R dV
Wt
q energy gain/loss due the internal sources/sinks (e.g. reactions)
Fluid mechanics (energy conservation)
The integral form:
d 2
e dV F dV p dA ( J Q ) n dA Rq dV ,
dt Wt 2 Wt Wt Wt Wt
Wt
p dA div ( ) dV ,
Wt
(J
Wt
Q ) n dA div J Q dV ,
Wt
div u dV u n dA.
Wt Wt
Wt
p dA div ( ) dV ,
Wt
where a major assumption concerning the nature of the internal stress p was made.
First, p=p(t,r,n) which means that it not only depend on time and location – but also on
the normal to the surface!
Second, it can be proved under some broad assumptions that it is a linear function of n,
hence:
p n
where is called the stress tensor. It is symmetric tensor that can be expressed as a
matrix pxx pxy pxz
pxy p yy p yz
pxz p yz pzz
Fluid mechanics (energy conservation)
Now we write all integrals on the right hand side as volume integrals
d 2
e dV F dV div ( ) dV div J Q dV Rq dV ,
dt Wt 2 Wt Wt Wt Wt
D 2
W Dt 2 dV W F dV W div ( ) dV W div J Q dV W Rq dV .
e
t t t t t
Because this integral equality holds for any domain Wt we obtain following general form
of energy conservation equation
D 2
e F div ( ) div J Q Rq .
Dt 2
Heat transport – elementary derivation
The heat flux Jq in direction Ox. A domain is in the form of a parallelepiped
with edges parallel to the coordinate axes.
A cross-sectional are perpendicular to the flux (m2)
density of the body (kg/m3)
cw specific heat of the material (J/kgm3)
S volumetric heat sources (J/m3s)]
Basic definitions and properties:
Q m cw T Change of internal energy (heat) with the change of temperature T
Jq The mount of energy which flows through the surface of unit area in
unit time in the direction perpendicular to the surface
x x+x
Balance of energy in the domain in time t:
Qtotal = (the flux through boundary) + (sources)
T J q ( x x, t ) J q ( x, t )
cw S ( x, t )
t x
Take the limit x 0, t 0
T J q
cw S ( x, t )
t x
Heat transport – boundar conditions
T Tenv on or part of it
n J q 0 on or part of it
3) Newton’s law of cooling (the transfer of heat through boundary is proportional to the
differnec between temperatures at both sides,of the boundary
n J q h (T Tenv ) on or part of it
Chemical reactions
Homogeneous Heterogeneous
reactions reactions
Homogeneous reactions take place in the same phase in the whole volume. These
reactions usually take place in a liquid or gaseous state. An example is the reaction
between oxygen and nitrogen gases (without any catalyst)
N2 + O2 2NO
Heterogeneous reactions usually take place at the boundaries of two different phases.
In most cases one of the phase is in a solid state.
In a description of the chemical reaction we may be interested in how quickly it
proceeds and how the concentration of reagents change with time.
In an homogeneous reaction
A+BC
Is elementary, the we can assume the rate („speed”) of this reaction is given by
v = k[A][B]
Here we used a standard notation used in chemistry: [A] denotes the molar
concentration per volume, i.e.
[A] = n/V = (number of moles of A)/(volume)
The SI unit of molar concentration is mole/m3 but in laboratory practice the unit
mole/dm3 is used.
The rate of reaction v means in this example that
d [C ]
v k[ A][ B]
dt
The equation for [C] is an ordinary differential equation. But, we have to eliminate the
functions [A] and [B ] to close the system.
There are simple relations between [A], [B], and [C] coming from the fact that they are
related by the transformation A + B C. If for simplicity we assume that at the beginning
there was no product C in the system ([C]0 =0), then
[A] = [A]0 – [C],
[B] = [B]0 – [C].
where [A]0 = the initial (t=0) concentration for A, [B]0 = the initial (t=0) concentration for B.
Thus we have ODE with initial condition problem
d [C ]
k ([ A]0 [C ])([ B]0 [C ]),
dt
[C ]0 0,
H 2 Br2 2HBr
The kinetics of this reaction (how the concentration of the product HBr changes with
time) is given by the following ODE
H 2 Br2 2HBr
We have the molar balance equations
[H 2 ] [H 2 ]0 12 [HBr] [H 2 ]0 12 y,
[Br2 ] [Br2 ]0 12 [HBr] [Br2 ]0 12 y.
d [HBr]
k1[H 2 ][Br2 ].
dt
Lotka-Volterra model (predator-prey system)
In the lecture it was described in terms of the population dynamics context
k1
A X 2X (autocatalytic production of X)
k2
X Y 2Y (autocatalytic production of Y)
k3
Y B (decay of Y)
d[ X ]
dt k1[ A][ X ] k2 [ X ][Y ],
d [Y ] k [ X ][Y ] k [Y ].
dt 2 3
The Lotka-Voltera system as a predator-prey model
The are two interacting species in a given region: the prey (for instance rabbits)
and predators (for instance foxes). The prey have plenty of food and can easily
multiply, but predators feed on the prey. Spatialy the system is homogeneous
(the average density of both species is constant in the whole region). Neither
species can leave nor enter the system from outside.
Let us introduce: y1 (t ) the prey (rabbits), y2 (t ) predators (foxes).
y1 y2
b ay2 , d cy1.
y y
1 2
relative change relative change
of rabbits of foxes
population population