You are on page 1of 11

İTÜ FBE - UUM510E Computational Fluid Dynamics

2020-2021 Spring Semester


Project 3

Student Student
Full Name ID
Erkan Ün 511191105
PROJECT # 3
The Euler equations governing unsteady compressible inviscid flows can be expressed in conservative
form as:
𝜕𝑄 𝜕𝐹1 𝜕𝐹2
+ + =0
𝜕𝑡 𝜕𝑥1 𝜕𝑥2
where
𝜌 𝜌 ∗ 𝑢1 𝜌 ∗ 𝑢2
𝜌 ∗ 𝑢1 𝜌∗𝑢 +𝑝2 𝜌 ∗ 𝑢2 ∗ 𝑢1
𝑄=[ ] , 𝐹 = [ 𝜌 ∗ 𝑢 1 ∗ 𝑢 ] , 𝐹1 = [ 𝜌 ∗ 𝑢2 + 𝑝 ]
𝜌 ∗ 𝑢2 1 2 1 2
𝐸 𝑢1 ∗ (𝐸 + 𝑃) 𝑢2 ∗ (𝐸 + 𝑃)
and the internal energy of the gas
1
𝐸 = 𝜌 ∗ (𝑒𝑖𝑛𝑡 + ∗ (𝑢12 + 𝑢22 ))
2
The Euler equations are not complete without an equation of state. We choose an ideal gas for which
𝑝
𝑒𝑖𝑛𝑡 =
𝜌 ∗ (𝛾 − 1)
and 𝛾 = 1.4. The free stream conditions are 𝜌 = 1, 𝑇 = 1, 𝑢1 = 6, 𝑢2 = 0 and 𝑝 = 1/1.4

[100/100] First implement a structured cell centered finite volume algorithm with the Euler explicit
method to solve the hypersonic inviscid non-reacting flow around a cylinder. The state variables are
located at element centroids. The inviscid fluxes should be computed with the Roe scheme. Use the
same structured meshes with 80x40, 160x80 and 320x160 as before. Compare the hypersonic solution
streamlines with the previous potential flow solutions.

[20/100] Use the MUSCL method for the second/third order spatial accuracy.
1) Introduction
Problem Definition:
In the project, it is requested that non-reacting inviscid flow around a 2-d cylinder at mach 6
should be solved with compressible Euler Explicit method. Problem is requested to be solved
with 2-D cell centered finite volume method with Roe Scheme. For this purpose, Roe scheme
is given in the files of the project.
Mesh generation & Cell properties:
3 different sized structured meshes are created in this project:
 80 angular and 40 radial divisions,
 160 angular and 80 radial divisions
 320 angular and 160 radial divisions
For created grid, property of each cell (quadrilateral) must be also created, which are listed as
follows:
 Normal vector of each face
 Side lengths of each cell side
 Cell area
 Cell center position in global coordinates
Structured grid eases the process of determining each cell’s vertex coordinates. Because of this,
only required inputs for the function are:
 Index i
 Index j
 x-coordinate
 y-coordinate
The created function is then called in main program as below:
for i=1:N_R
for j=1:N_Theta
[nx(i,j,:),ny(i,j,:),area_cell(i,j),dL(i,j,:),area_center_x(i,j),area_center_y(i,j)] =
...
Cells(point_x,point_y,i,j);
end
end
Compressible Euler Equation
The Euler equations governing unsteady compressible inviscid flows can be expressed in
conservative form as:
𝜕𝑄 𝜕𝐹1 𝜕𝐹2
+ + =0
𝜕𝑡 𝜕𝑥1 𝜕𝑥2
Where
𝜌 𝜌𝑢1 𝜌𝑢2
𝜌𝑢1 𝜌𝑢12 + 𝑝 𝜌𝑢1 𝑢2
𝑄=[ ] ; 𝐹1 = [ 𝜌𝑢 𝑢 ] ; 𝐹2 = [ 𝜌𝑢2 + 𝑝 ]
𝜌𝑢2 1 2 2
𝐸 𝑢1 (𝐸 + 𝑝) 𝑢2 (𝐸 + 𝑝)
And the internal energy of the gas is found as below:
1
𝐸 = 𝜌𝑒𝑖𝑛𝑡 + 𝜌(𝑢12 + 𝑢22 )
2
And, internal energy is taken as ideal gas:
𝜌
𝜌(𝛾 − 1)
Equations above can be discretized like this:
𝑛
𝑄𝑖 𝑛+1 − 𝑄𝑖 𝑛
𝐴𝑟𝑒𝑎 + ∑ ⃗⃗⃗⃗
𝑛𝑘 𝐹 = 0
Δ𝑡
𝑘=1

In here ⃗⃗⃗⃗
𝑛𝑘 is the unit normal vectors at the edges of elements. Sides of element are numbered
in counter-clockwise direction and bottom side is taken as first element. In the quadrilateral
element case, n is taken as 4
In 2D, eigenvalue matrix is given as below:
|𝑢𝑛𝑥 + 𝑢𝑛𝑦 − 𝑐|
|𝑢𝑛𝑥 + 𝑢𝑛𝑦 |
Λ̂ =
|𝑢𝑛𝑥 + 𝑢𝑛𝑦 + 𝑐|
[ |𝑢𝑛𝑥 + 𝑢𝑛𝑦 | ]
1 1 1 0
𝑢 − 𝑐𝑛𝑥 𝑢 𝑢 + 𝑐𝑛𝑥 −𝑛𝑦
𝑇̂ = 𝑣 − 𝑐𝑛_𝑥 𝑣 𝑣 + 𝑐𝑛 𝑛𝑥
[𝐻 − (𝑢𝑛𝑥 − 𝑣𝑛𝑦 )𝑐 0.5(𝑢2 + 𝑣 2 ) 𝐻𝑇(𝑢𝑛𝑥 − 𝑣𝑛𝑦 )𝑐 −𝑢𝑛𝑦 + 𝑣𝑛𝑥 ]

Where c is local speed of sound.


Transformed variables are given below:
Δ𝑃 − 𝜌𝑐Δ𝑉
2𝑐 2
Δ𝑃
+ Δ𝜌
Δ𝑊 = 𝑇̂ Δ𝑄 =
−1
𝑐2
Δ𝑃 + 𝜌𝑐Δ𝑉
2𝑐 2
[𝜌(−𝑢𝑅 𝑛𝑦 + 𝑣𝑅 𝑛𝑥 + 𝑢𝐿 𝑛𝑦 − 𝑣𝐿 𝑛𝑥 )]

Solution
This problem is sensitive at time step size, so it is important to determine Δ𝑡 for each analysis.
In this project, Δ𝑡 is calculated as follows:
dt=min(min(area_cell(:,:)))*0.3;
which founds the minimum cell area and multiplies it by a factor.
Error between each iteration step is calculated as below:
error_iter=norm(Q2(:,:,4)-Q1(:,:,4))/sqrt((N_R)*(N_Theta))

And,convergence limit is selected as 10-6. For 80 angular and 40 radial divisions, it took 4626
iterations and 2155 seconds.
Figure 1: Convergence plot of 80x40 mesh
Initialize from coarse mesh solution for higher mesh sizes
Cost of analysis in terms of time 160x80 and 320x160 sized meshes is too high compared to
the 80x40 mesh. To circumvent this problem in this project, initial condition is taken from
solution at 80x40 mesh at 2000 iteration and this solution’s size is interpolated from 80x40 to
respective mesh size; and created interpolation data then sent as initial data, Q0. Data is taken
into the code as below:
initialdata=load('results_40x80_all_2000it.mat')
Q0=initialdata.Q2
Of which result is saved in .mat format.
2) Results
In this section, solutions of requested mesh sizes are presented. Some of the velocity streamlines
are passing inside the object due to an error in streamline function or usage of function in
MATLAB
Also, incompressible potential flow (Laplace solution) is requested in the project and is given
below:

Figure 2: Laplace solution on 80x40 mesh


80x40 Mesh

Figure 3: Velocity results of 80x40 mesh

Figure 4: Pressure results of 80x40 mesh


Figure 5: Temperature results of 80x40 mesh

Figure 6: Density results of 80x40 mesh


160x80 Mesh

Figure 7: Velocity results of 160x80 mesh

Figure 8: Pressure results of 160x80 mesh


Figure 9: Temperature results of 160x80 mesh

Figure 10: Density results of 160x80 mesh


320x160 Mesh

Figure 11: Velocity results of 320x160 mesh

Figure 12: Pressure results of 320x160 mesh


Figure 13: Density results of 320x160 mesh

Figure 14: Temperature results of 320x160 mesh

REMARKS
From the results of code which is requested to be developed in this project, problem is solved
for requested mesh sizes. It is seen that mesh size increase gives more precise shock location.
For 80x40 mesh size, it can be said that from plots, shock is seen as a relatively large band of
area rather than a strong discontinuity. Further work may be applied for modifying the code for
unstructured meshes which will help to add more cells at shock location with shock capturing
methods.

You might also like