Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

Introduction
In fluid-structure interaction simulations, the fluid equations are solved on a deforming mesh.
An often used method for dealing with deforming meshes is the Arbitrary Lagrangian-Eulerian
(ALE) approach, which allows the fluid dynamics equations to be solved on arbitrarily mov-
ing/deforming control volumes. When using the ALE approach, a Geometric Conservation Law
(GCL) can be identified that ties the mesh deformation to mesh velocities, used in the governing
equations. In this exercise we will investigate the GCL for a range of simple test problems.

Governing equations
A general formulation for the fluid dynamics equations on a domain Ω is

Ωi

∂Ω

Figure 1: Computational domain

 
d d~x
Z I
UdV + F(U) − U · ~ndS = 0, (1)
dt Ω ∂Ω dt

wherein U the conservative variables (ρ, ρ~u, ρE), F the flux vector containing convective and
x
diffusive terms, d~
dt the mesh velocity, ~
n the outward pointing normal to surface ∂Ω. Suppose we
discretize the domain Ω using a finite number of volumes Ωi , we can write for a single volume
 
d d~x
Z I
UdV + F(U) − U · ~ndS = 0. (2)
dt Ωi ∂Ωi dt

This will be the starting point for deriving the continuous Geometric Conservation Law, and
the semi-discrete and discrete versions.

Geometric Conservation Law


One of the viewpoints on the significance of the GCL is that it ensures uniform flow to remain
uniform on arbitrarily moving meshes. This feature is used to derive first of all the continous
GCL.

Continuous GCL
In the derivation we assume U = U0 to be uniform in the domain Ω and hence one may expect
that F0 = F(U0 ) also uniform. The control volume Ωi has a closed surface ∂Ωi .

1
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

Exercise Derive the GCL by substitution of U0 into (2)


Substitution of U0 in (2) yields:
 
d d~x
Z I
U0 dV + F(U0 ) − U0 · ~ndS = 0,
dt Ωi ∂Ωi dt
H
since ∂Ωi F(U0 ) · ~ndS = 0 for a closed surface ∂Ωi , we obtain

d d~x
Z I
U0 dV − U0 · ~ndS = 0,
dt Ωi ∂Ωi dt

or, since U0 is constant and can be taken out of the integral


 Z 
d d~x
I
U0 dV − · ~ndS = 0,
dt Ωi ∂Ωi dt

which should be satisfied for all U0 , and therefore we obtain the GCL:

d d~x
Z I
dV = · ~ndS
dt Ωi ∂Ωi dt

Note that up till now, the relation still uses continous functions and the continous GCL is inde-
pendent of the discretization method used for numerically solving the fluid dynamics equations.
For certain methods, such as space-time discretizations, the GCL is generally satisfied in a nat-
ural way. For other discretization approaches, such as finite-volume discretizations, this may not
be the case. Since a major part of engineering CFD codes use the finite volume approach, we
continue in a finite-volume framework for obtaining the semi-discrete formulation of the GCL.

Semi-discrete GCL
First the control volume Ωi is discretized to Vi and its boundary ∂Ωi to a sommation of discrete
faces (or edges in 2D), as shown in Fig. 2. The spatial integrals are discretized using

S3
S2
Vi
Ωi S4
S1
∂Ω i

Figure 2: Discrete domain of a single control volume Vi .

I
d~x X  d~x 
· ~ndS ≈ · ~nS , (3)
∂Ωi dt dt f ace
f aces

with S the face surface area for each disrete face, so that we obtain the semi-discrete GCL

d X  d~x 
Vi = · ~nS . (4)
dt dt f ace
f aces

2
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

Question What do the left and right sides of (4) represent?


 
d P x
d~
V
dt i describes the rate of change in control volume and f aces dt · ~
n S describes the
f ace
rate at which the cell faces sweep through space.

Discrete GCL
In (4) we still have a temporal derivative. To obtain a fully discrete equation a wide variety
of time integration schemes can be chosen to discretize the temporal derivative. Here we will
consider three well-known implicit integration schemes:

• Backward Euler The first order Backward Euler scheme is quite popular due to its
simplicity and stability. The integration of a quantity φ yields

φn+1 − φn
+ R(φn+1 ) = 0, (5)
∆t
wherein R(φn+1 ) is the spatial discretization, evaluated at the implicit time level tn+1 .

• BDF2 The second order Backward Differencing scheme is often used in CFD codes. It
obtains a second order accuracy by using the state of an additional time level tn−1 . The
integration of a quantity φ yields

α1 φn+1 − α2 φn + α3 φn−1
+ R(φn+1 ) = 0, (6)
∆t
wherein α~ = ( 32 , −2, 12 ) for BDF2 and R(φn+1 ) is the spatial discretization, evaluated
at the implicit time level tn+1 . Since the method needs data at time level tn−1 , which is
generally unavailable at tn = t0 , the first time step is generally performed with a Backward
Euler scheme for which α ~ = (1, −1, 0).

• θ-scheme The θ-scheme is a combination between a Backward Euler (θ = 1) and Forward


Euler (θ = 0) integration scheme. It obtains a second order accuracy when θ = 12 . The
integration of a quantity φ yields

φn+1 − φn
+ θR(φn+1 ) + (1 − θ)R(φn ) = 0, (7)
∆t
wherein R(φn+1 ) is the spatial discretization, evaluated at the implicit time level tn+1 and
R(φn ) is the spatial discretization, evaluated at the explicit time level tn .

As shown in the lecture, the change in volume of the cell is decomposed into volume changes
caused by the motion of each cell face individually:
X
V n+1 − V n = ∆Vfn+1
ace , (8)
f aces

wherein ∆Vfn+1
ace the so-called swept-volume for a face moving from its location at tn to its
location at tn+1 . Therefore, we obtain for the Backward Euler scheme the following Discrete-
GCL (D-GCL)
V n+1 − V n X ∆Vfn+1 ace
X  d~x n+1
= = · ~nS , (9)
∆t ∆t dt f ace
f aces f aces

3
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

which is enforced for each face individually

∆Vfn+1
 n+1
ace d~x
= · ~nS , (10)
∆t dt f ace

x
so that the face normal velocity ( d~ n)n+1 should be
dt · ~

d~x n+1
∆Vfn+1
ace
( · ~n) = , (11)
dt ∆tS
in order to ensure that the D-GCL is satisfied.

Exercise Derive the D-GCL for the BDF2 scheme


x
φ = V and R(φ) = − f aces ( d~ nS)n+1
P
dt · ~ f ace ; therefore, according to (6)

α1 V n+1 − α2 V n + α3 V n−1 X d~x


= ( · ~nS)n+1
f ace ,
∆t dt
f aces

n+1 − α V n + α V n−1 = α
P n+1
since
P α2 = −α 1 − α3 , we can write α1 V 2 3 1 f aces ∆Vf ace −
n
α3 f aces ∆Vf ace , which leads to the D-GCL for the BDF2 scheme
 n+1
d~x 1 
n+1 n

· ~n = α1 ∆V f ace − α3 ∆V f ace .
dt f ace ∆tSfn+1
ace

Exercise Derive the D-GCL for the θ-scheme


x
φ = V and R(φ) = − f aces ( d~ nS)n+1
P
dt · ~ f ace ; therefore, according to (7)

V n+1 − V n X d~x X d~x


=θ ( · ~nS)n+1
f ace + (1 − θ) ( · ~nS)nface ,
∆t dt dt
f aces f aces

n+1
since V n+1 − V n =
P
f aces ∆Vf ace , this leads to the D-GCL for the θ-scheme

∆Vfn+1
 n+1 "  n #
d~x 1 ace d~x
· ~n = − (1 − θ) · ~nS .
dt f ace θSfn+1
ace
∆t dt f ace

Simulation of uniform flow on a one-dimensional moving mesh


Next we investigate the simulation of uniform flow on a moving mesh and the disturbances that
can be generated when not satisfying the D-GCL. The matlab files necessary are stored in folder
H:\matlab\DGCL-1D\. We start with the example shown in the lectures for a one-dimensional
testcase (Fig. 3) for which an exact mesh motion is known:

x = x0 + ∆x0 sin(2πx0 ) sin(2πt), (12)


dx
= 2π∆x0 sin(2πx0 ) cos(2πt), (13)
dt
wherein x0 = x(t = 0) and ∆x0 = 1/N , with N the number of finite volume cells to discretize
the domain [0,1]. The model that is discretized in given in (2). We assume a constant scalar

4
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

cell center
i−1 i i+1 cell face
i−1/ 2 i+1/ 2

Figure 3: One dimensional mesh.

field u, so that F (u) is constant as well and can be eliminated from the equation. As long as u
remains uniform, this is correct. However, for the sake of simplicity, we do not add the influence
of the numerical flux F to the equation when the solution does not remain uniform (when the
D-GCL is violated). The model is therefore
 
d dx
Z I
udV − u · ndS = 0, (14)
dt Ωi ∂Ωi dt

for which the boundary integral reduces to a sommation of a left and right face contribution:
   
d dx dx
(uV )i + u − u = 0, (15)
dt dt i−1/2 dt i+1/2

wherein we use a simple avarage to approximate the solution at the cell faces i ± 1/2:
ui + ui+1
ui+1/2 = . (16)
2
When e.g. a Backward Euler time integration is chosen, (15) and (16) result in
n+1 n+1
un+1 + un+1
n+1 n+1
un+1 Vin+1 − uni Vin ui−1 + ui
 
i dx i i+1 dx
+ − = 0, (17)
∆t 2 dt i−1/2 2 dt i+1/2

or,
" #
∆t dx n+1 ∆t dx n+1
   
Vin+1+ − un+1
2 dt i−1/2 2 dt i+1/2 i
" # " #
∆t dx n+1 ∆t dx n+1
   
n+1
+ u − un+1 = Vin uni , (18)
2 dt i−1/2 i−1 2 dt i+1/2 i+1

which results in a system


Lun+1 = Run . (19)
The matlab program dgcl BE.m sets-up this system of equations and solves the system for every
time step. The influence of the DGCL is through the ( dx
dt ) terms in L.

Backward Euler For the Backward Euler scheme, the swept volumes of the faces reduce to
a change in position of the face coordinate χ and therefore its D-GCL (11) becomes
n+1
χn+1 − χn

dx
= , (20)
dt ∆t

which is implemented into the matlab file dgcl BE.m, along with the options to choose the exact
mesh velocities at tn+1/2 and tn+1 .

5
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

Table 1: Time step and formst settings.


case ∆t fmt
1 0.1 ’-b’
2 0.05 ’-r’
3 0.025 ’-g’

Exercise In dgcl BE.m we set N = 20, tend = 10 and for each method=1,2,3 we set the time
step and plot format according to Table 1. When switching from one method to the other, you
can close the figures to start a clean plot. You can verify that satisfying the D-GCL preserves
the constant solution. By judging the amplitude decrease in the solution at tend for various ∆t
one can judge the order of the error with respect to ∆t, e.g. when the amplitude ≈ halves when
∆t is halved, the error reduces with O(∆t). Which orders do you find for method=1,2?
Approximately O(∆t) for the exact mesh velocity at tn+1
Approximately O(∆t2 ) for the exact mesh velocity at tn+1/2

Exercise Write the D-GCL you derived for the BDF2 scheme in terms of the face locations
χn−1 , χn , χn+1 and the coefficients α ~.
~n is either +1 or −1:
For a left-face of a cell (i − 1/2), ~n = −1 and the swept volume is −(χni−1/2 − χni−1/2 ).
For a right-face of a cell (i + 1/2), ~n = +1 and the swept volume is +(χni−1/2 − χni−1/2 ).
In both cases this results in
 n+1
dx 1  
= α1 (χn+1
f ace − χ n
f ace ) − α (χ n
3 f ace − χ n−1
f ace ) ,
dt f ace ∆t

which can also be written as


 n+1
dx 1  
= α1 χn+1
f ace + α2 χnface + α3 χfn−1
ace ,
dt f ace ∆t

Implement the D-GCL into dgcl BDF2.m. We set N = 20, tend = 10 and for each mesh velocity
method method=1,2,3 we set the time step and plot format according to Table 1. Verify you
implemented the D-GCL correctly so that the constant solution is preserved. Which orders for
the convergence of the error do you find for method=1,2?
Approximately O(∆t2 ) for the exact mesh velocity at tn+1
Approximately O(∆t) for the exact mesh velocity at tn+1/2

Exercise Write the D-GCL you derived for the θ-scheme in terms of the face locations χn ,
χn+1 , the coefficient θ and the mesh velocity at tn ( dx n
dt ) .
Again we find for both left and right sided faces:
n+1 n
 n+1 "  n #
dx 1 ∆χf ace − χf ace dx
= − (1 − θ) .
dt f ace θ ∆t dt f ace

Implement the D-GCL into dgcl theta.m. We set N = 20, tend = 10, theta = 0.5 and for
each mesh velocity method method=1,2,3 we set the time step and plot format according to

6
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

Table 1. Verify you implemented the D-GCL correctly so that the constant solution is preserved.
Which orders for the convergence of the error do you find for method=1,2?
The error is zero at tend = 10 for the exact mesh velocity at tn+1 , however, when tend = 10.2
(not an exact number of periods), the method behaves approximately O(∆t2 )
Approximately O(∆t) for the exact mesh velocity at tn+1/2

Redo the computation for method = 1 and this time set tend = 10.2

7
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

Simulation of uniform flow on a moving two-dimensional mesh


In this exercise, the D-GCL is applied to two-dimensional mesh motion. The mesh contains 9
cells (Fig. 4), and the motion that is prescribed is a rotation of the cell that is in the center of

Figure 4: Two dimensional mesh.

the domain. Again we use (2) as governing equation and assume that the solution is a constant
scalar u so that the flux F (u) drops out of the equation. We therefore obtain
 
d d~x
Z I
udV − u · ~ndS = 0. (21)
dt Ωi ∂Ωi dt

The boundary integral now becomes a sommation over 4 cell faces (edges):
4  
d d~x
Z X
udV − u · ~nS = 0, (22)
dt Ωi dt j
j=1

and again we use a simple average to define the solution u at the internal faces
ucell1 + ucell2
uj = , (23)
2
as all of the internal faces have two neighboring cells. For the boundary faces we just use the
value of the neigboring cell. Discretization in time with a Backward Euler scheme yields
4  n+1
un+1
i Vin+1 − uni Vin X d~x
− u · ~nS = 0, (24)
∆t dt j
j=1

x
which means that we need the mesh velocities d~
dt at the cell faces, which are determined from
the . can also be written as
Lun+1 = Run . (25)

Matlab code
The matlab code that is available to solve this problem can be found in H:\matlab\DGCL-2D\and
consists of the following files:

dgcl BE 2D.m This is the main program; it takes the following steps:

• determine node locations,

• create cells by assigning 4 nodes for each cell,

• create connectivity information (for each cell face determine neighbor cells),

8
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

• intialization of data (solution, mesh velocities, cell volumes),

• for each time step:

1. compute displacements of nodes,


2. move the mesh (update node locations),
3. compute new volumes,
4. compute mesh velocity,
5. construct L, R and solve system to obtain new solution.

create mesh.m Creates the cell datastructure (each cell consists of 4 nodes)

compute cellvol.m Computes the volume (in 2D surface) of the cell defined by 4 nodes.

compute connectivity.m Determines the neighboring cells for all faces.

compute facecenter.m Computes the center of the face (or edge).

compute faceSN.m Computes the face normal and surface (in 2D this is the outward pointing
normal and edge length).

compute meshVelocity.m Computes the mesh velocity for the faces.

movemesh.m Updates the mesh nodes to the new location.

plotMesh.m Displays the mesh and creates colors depending on skewness of the cells.

plotSolution.m Displays the solution on the given mesh.

Mesh velocity computation


The mesh velocity computation is obtained from the displacement of a cell face from tn to tn+1 ,
see Fig. 5. From (11) we know that the normal velocity component of the mesh velocity should

nS n
cn cn+1
nS n+1

Figure 5: Two dimensional mesh.

satisfy
d~x ∆Vfn+1
ace
( · ~n)n+1 = ,
dt ∆tS n+1

9
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law

therefore, a finite difference of the displacement of the face center

d~x n+1 ~cn+1 − ~cn


( ) = , (26)
dt ∆t
does not generally satisfy the D-GCL.

Example Use the following settings: number of time steps per period NdtP = 10 and number
of periods to simulate Np = 2, and run the script dgcl BE 2D.m. From the results you can
observe that the solution does not remain uniform. Using smaller time steps by increasing NdtP
= 20, 40 shows that the error decreases approximately with O(∆t).

Exercise Write the swept volume ∆Vfn+1 nS n+1 , ~nS n ,


ace in terms of the geometric parameters ~
x n+1
~cn+1 , ~cn and write an expression for ( d~
dt ) that satisfies the D-GCL
The swept volume of a cell face in 2D is equal to the surface area swept by the cell’s edge
  (~nS)n + (~nS)n+1
f ace f ace
∆Vfn+1
ace
n+1 n
= ~cf ace − ~cf ace · ,
2
so that according to (11)

d~x n+1
~cn+1 cnface (~nS)nface + (~nS)n+1
f ace − ~ f ace
( · ~n)f ace = · ,
dt ∆tSfn+1
ace
2

x n+1
and, in order to obtain a velocity ( d~
dt ) that satisfies the above equation, we impose

~cf ace − ~cnface (~nS)nface + (~nS)n+1


" n+1 #
d~x n+1 f ace
( )f ace = n+1 · ~nn+1
f ace .
dt ∆tSf ace 2

Note that only the normal component of the velocity has an influence so that any tangental
velocity can be added to the mesh velocity without violating the D-GCL.

The expression derived above can be implemented into compute meshVelocity.m, and you can
verify that the solution remains uniform.
If you like, you can modify the program for the BDF2 or θ-method and implement the mesh
velocities for those methods as well.

10

You might also like