Variational Methods for Computational Fluid Dynamics

1
Variational Methods for Computational Fluid Dynamics
Année 2013 - 2014, X 2011.
PC 8 (TP)
Exercise 1. Sedimentation in a Stokes flow.
We consider a column (0, 1) × (0, 5) filled of fluid. We assume that the fluid is viscous enough so that inertial effect are negligible and Stokes equation apply, and no-slip
boundary conditions are assumed on the boundary. The exercise consists in simulating
the sedimentation of a solid ball inside the fluid.
For the simulation we consider the following parameters:
• Viscosity of the fluid µ = 0.02
• Radius of the ball r = 0.1
• The ball begins at position (xB , yB ) = (0.5, 4)
• The time-step for the evolution is taken to be dt = 0.1
• the gravity is g = −1
1. Write a FreeFem++code that solves Stokes equations with the proper boundary
conditions on the right domain. For the simulation we consider the mesh fixed once
for all.
• The ball is represented by its coordinates (xB , yB ) and is assumed to be dale to
move only downwards and without rotating, we use the method of penalization
to represent it (and search for u = Cte in the ball). In particular implement
the variational formulation
Z
Z
Z
Z
µ̄(x)∇u : ∇v dx− p div v dx− q div u dx− ρg v2 dx = 0 .
a([u, p], [v, q]) =
Ω
Ω
Ω
Ω
• The “pseudo-” viscosity µ̄ is given by
µ in the fluid,
µ̄ =
1e6 otherwise,
and the density
ρ=
ρF = 1 in the fluid,
ρS = 10 otherwise.
In that aim, we use the FreeFem++commands (inside the main loop)
chi = ((x-x1)^2+(y-y1)^2>r^2)?0:1;
mu = 1e6*chi+mu0;
rho = (rhoB-rhoF)*chi+rhoF;
2
• Update the new vertical position, by using the value of the velocity at (xB , yB )
yB = yB + dt*uy(xB,yB);
Exercise 2. A bifurcation in the lung.
We consider a bifurcation as the ones that one has in the bronchial lung. The mesh
(somehow difficult to build) is given in the following code and can be downloaded from
the website.
//
//
//
//
//
Numerical resolution of the Navier-Stokes equations
in a bifurcation, with Boundary Conditions (4.10)
(pressure Drop problem)
The Respiratory System in Equations, Springer
Bertrand Maury
// Physical data
real mu = 0.0025; // viscosity
real rho = 1.00; // density
real Pin = 0; // inlet pressure
real Pout = -1; // outlet pressure
// Numerical data
real dt = 0.01; // time step
real Ttot = 0.5; // computational time
int Niter = Ttot/dt; // number of time iterations
int m = 15; // number of vertices per unit length
real alpha = rho/dt ;
//-------------------// Definition of the geometry
real r0 = 0.5 ; // Half width of inlet
real r1 = 0.3 ; // Half width of sub-branches
real L0 = 3 ; // Length of parent branche
real L1 = 4 ; // Length of offspring branches
real theta = pi/4 ; // Angle of the bifurcation
// Bezier curve (to build the boundary components)
func real bzi(real p0,real p1,real q1,real q2,real t)
{ return p0*(1-t)^3 + q1*3*(1-t)^2*t+q2*3*(1-t)*t^2+p1*t^3; }
real[int] X1 = [-r0,0], X2 = [-L1*sin(theta)-r1*cos(theta),
-L0-L1*cos(theta)+r1*sin(theta)];
real[int]
X3 = [-L1*sin(theta)+r1*cos(theta),
-L0-L1*cos(theta)-r1*sin(theta)];
3
real[int]
real[int]
real[int]
real[int]
real[int]
X4 = [+L1*sin(theta)-r1*cos(theta),
-L0-L1*cos(theta)-r1*sin(theta)];
X6 = [+r0,0], X5 = [+L1*sin(theta)+r1*cos(theta),
-L0-L1*cos(theta)+r1*sin(theta)];
Q12x1 = [-0.8*r0,-L0+0.2*r0+0.0 ] , Q12x2 = [-1*r0+0.0*r0,-L0] ;
Q65x1 = [+r0,-L0+r1] , Q65x2 = [+r0-0.2*r0,-L0+r1] ;
Q34x1 = [-0.4*r1,-L0-0.3*r1] , Q34x2 = [+0.4*r1,-L0-0.3*r1] ;
border GG1(t=0,1) { x=bzi(X1[0],X2[0],Q12x1[0],Q12x2[0],t);
y=bzi(X1[1],X2[1],Q12x1[1],Q12x2[1],t); label = 1;};
border GG2(t=0,1) {x = (1-t)*X2[0] + t*X3[0] ;
y = (1-t)*X2[1] + t*X3[1] ;label = 2;} ;
border GG3(t=0,1) { x=bzi(X3[0],X4[0],Q34x1[0],Q34x2[0],t);
y=bzi(X3[1],X4[1],Q34x1[1],Q34x2[1],t); label = 3;};
border GG4(t=0,1) {x = (1-t)*X4[0] + t*X5[0] ;
y = (1-t)*X4[1] + t*X5[1] ;label = 4;} ;
border GG5(t=0,1) {
border GG6(t=0,1)
x=bzi(X6[0],X5[0],Q65x1[0],Q65x2[0],t);
y=bzi(X6[1],X5[1],Q65x1[1],Q65x2[1],t); label = 5;};
{x = (1-t)*X6[0] + t*X1[0] ;
y = (1-t)*X6[1] + t*X1[1] ;label = 6;} ;
mesh Th = buildmesh(GG1(1.2*(L0+L1*cos(theta))*m)+GG2(2*r1*m)
+GG3(2*L1*m)+GG4(2*r1*m)+GG5(-1.2*(L0+L1*cos(theta))*m)+GG6(1.5*r0*m));
1. Write a Stokes solver on this geometry. Use pressure boundary condition (P in = 0
at the inflow and P out at the outflow. Use the variational formulation without the
strain tensor.
2. Compare the solution when there is a Poiseuille flow at the inlet (inspiration) or at
the outlet (expiration).
3. In each situation compare the magnitude of the velocity of the fluid at the inlet and
at the outlet.
4. Extend to Navier-Stokes and increase the Reynolds number.