Professional Documents
Culture Documents
Exercise DGCL Elaboration
Exercise DGCL Elaboration
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
∂Ω
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.
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
d d~x
Z I
U0 dV − U0 · ~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
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
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).
φ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
∆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.
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
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
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
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
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
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
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
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:
• create connectivity information (for each cell face determine neighbor cells),
8
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law
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 faceSN.m Computes the face normal and surface (in 2D this is the outward pointing
normal and edge length).
plotMesh.m Displays the mesh and creates colors depending on skewness of the cells.
nS n
cn cn+1
nS n+1
satisfy
d~x ∆Vfn+1
ace
( · ~n)n+1 = ,
dt ∆tS n+1
9
JMBC course on Fluid-Structure Interation Discrete Geometric Conservation Law
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).
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
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